[Bps-public-commit] rt-extension-createbyproblemtype branch master updated. 1.02-3-g9fcc203

BPS Git Server git at git.bestpractical.com
Thu Apr 28 04:43:04 UTC 2022


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "rt-extension-createbyproblemtype".

The branch, master has been updated
       via  9fcc203ca500f7c2a881b2924d342dc77134023c (commit)
       via  96ead28af38495a063b2b6ea6e5d4e90ed682bfa (commit)
       via  6c3f4b584e56c3ce100852e914eb5667035894fb (commit)
      from  91ded980ef568bba89b13eaea269f9247441d1d8 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 9fcc203ca500f7c2a881b2924d342dc77134023c
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Thu Apr 28 12:37:53 2022 +0800

    Prep 1.03

diff --git a/Changes b/Changes
index 374dd8d..66d7d94 100644
--- a/Changes
+++ b/Changes
@@ -1,3 +1,7 @@
+1.03 2022-04-28
+ - Ignore submitted "Problem Type" value on problem change
+ - Fix "Problem Type" lookup type: it's a ticket custom field
+
 1.02 2022-04-27
  - Support select problem on ticket create page for RT 5
  - Refactor to render options in normal mason instead of calling $m->out
diff --git a/META.yml b/META.yml
index cc0c42c..87db829 100644
--- a/META.yml
+++ b/META.yml
@@ -22,6 +22,6 @@ requires:
   perl: 5.8.3
 resources:
   license: http://opensource.org/licenses/gpl-license.php
-version: '1.02'
+version: '1.03'
 x_module_install_rtx_version: '0.43'
 x_requires_rt: 4.0.0
diff --git a/lib/RT/Extension/CreateByProblemType.pm b/lib/RT/Extension/CreateByProblemType.pm
index a40da7d..9f2f90d 100644
--- a/lib/RT/Extension/CreateByProblemType.pm
+++ b/lib/RT/Extension/CreateByProblemType.pm
@@ -1,6 +1,6 @@
 package RT::Extension::CreateByProblemType;
 
-our $VERSION = '1.02';
+our $VERSION = '1.03';
 
 use warnings;
 use strict;

commit 96ead28af38495a063b2b6ea6e5d4e90ed682bfa
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Thu Apr 28 12:34:30 2022 +0800

    Ignore submitted "Problem Type" value on problem change

diff --git a/html/Callbacks/CreateByProblemType/Ticket/Create.html/Init b/html/Callbacks/CreateByProblemType/Ticket/Create.html/Init
index 5ec3329..b8b3ab2 100644
--- a/html/Callbacks/CreateByProblemType/Ticket/Create.html/Init
+++ b/html/Callbacks/CreateByProblemType/Ticket/Create.html/Init
@@ -50,6 +50,15 @@ $cf->LoadByName(
 
 if ( $cf->Id ) {
     $ARGSRef->{"CustomField-".$cf->Id} = $ProblemValue;
+
+    # For RT 5, ignore submitted "Problem Type" value on problem change.
+    if ( $ARGSRef->{QueueChanged} ) {
+        my $id = $cf->Id;
+        for my $field ( keys %$ARGSRef ) {
+            delete $ARGSRef->{$field} if $field =~ /^Object-RT::Ticket--CustomField(?::.+)?-$id-/;
+        }
+    }
+
     # For RT 5, update Subject only on problem change, to avoid overriding user input value on "Create"
     $ARGSRef->{Subject} = $ProblemValue if $ARGSRef->{QueueChanged} || RT::Handle::cmp_version($RT::VERSION, '5.0.0') < 0;
 }

commit 6c3f4b584e56c3ce100852e914eb5667035894fb
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Thu Apr 28 12:14:55 2022 +0800

    Fix "Problem Type" lookup type: it's a ticket custom field
    
    In e4a92617a6, "Problem Type" was wrongly treaeted as a queue custom
    field, this commit fixes it.

diff --git a/html/Callbacks/CreateByProblemType/Ticket/Create.html/Init b/html/Callbacks/CreateByProblemType/Ticket/Create.html/Init
index 34b77b1..5ec3329 100644
--- a/html/Callbacks/CreateByProblemType/Ticket/Create.html/Init
+++ b/html/Callbacks/CreateByProblemType/Ticket/Create.html/Init
@@ -13,7 +13,7 @@ if ( RT::Handle::cmp_version( $RT::VERSION, '5.0.0' ) >= 0 && !$ARGSRef->{Proble
         my $cf = RT::CustomField->new( $session{'CurrentUser'} );
         $cf->LoadByName(
             Name          => 'Problem Type',
-            LookupType    => RT::Queue->CustomFieldLookupType,
+            LookupType    => RT::Ticket->CustomFieldLookupType,
             ObjectId      => $q->id,
             IncludeGlobal => 1,
         );
@@ -43,7 +43,7 @@ $QueueObj->Load($Queue) or return;
 my $cf = RT::CustomField->new($session{'CurrentUser'});
 $cf->LoadByName(
     Name          => 'Problem Type',
-    LookupType    => RT::Queue->CustomFieldLookupType,
+    LookupType    => RT::Ticket->CustomFieldLookupType,
     ObjectId      => $QueueObj->id,
     IncludeGlobal => 1,
 );
diff --git a/html/Elements/SelectProblem b/html/Elements/SelectProblem
index 54f4d5f..02330d1 100644
--- a/html/Elements/SelectProblem
+++ b/html/Elements/SelectProblem
@@ -19,7 +19,7 @@ while ( my $q = $queues->Next ) {
     my $cf = RT::CustomField->new( $session{'CurrentUser'} );
     $cf->LoadByName(
         Name          => 'Problem Type',
-        LookupType    => RT::Queue->CustomFieldLookupType,
+        LookupType    => RT::Ticket->CustomFieldLookupType,
         ObjectId      => $q->id,
         IncludeGlobal => 1,
     );
diff --git a/html/SelfService/CreateTicketInQueue.html b/html/SelfService/CreateTicketInQueue.html
index 8bcf2d9..80448ef 100644
--- a/html/SelfService/CreateTicketInQueue.html
+++ b/html/SelfService/CreateTicketInQueue.html
@@ -10,7 +10,7 @@
 %    my $cf = RT::CustomField->new($session{'CurrentUser'});
 %    $cf->LoadByName(
 %        Name          => 'Problem Type',
-%        LookupType    => RT::Queue->CustomFieldLookupType,
+%        LookupType    => RT::Ticket->CustomFieldLookupType,
 %        ObjectId      => $q->id,
 %        IncludeGlobal => 1,
 %    );

-----------------------------------------------------------------------

Summary of changes:
 Changes                                                    |  4 ++++
 META.yml                                                   |  2 +-
 html/Callbacks/CreateByProblemType/Ticket/Create.html/Init | 13 +++++++++++--
 html/Elements/SelectProblem                                |  2 +-
 html/SelfService/CreateTicketInQueue.html                  |  2 +-
 lib/RT/Extension/CreateByProblemType.pm                    |  2 +-
 6 files changed, 19 insertions(+), 6 deletions(-)


hooks/post-receive
-- 
rt-extension-createbyproblemtype


More information about the Bps-public-commit mailing list