[Bps-public-commit] RT-Extension-MandatoryOnTransition branch, master, updated. 0.06-2-gb16e6cc

Jim Brandt jbrandt at bestpractical.com
Wed May 7 13:57:59 EDT 2014


The branch, master has been updated
       via  b16e6cc6a86183ef3511044f10f8a4cb402b8726 (commit)
       via  ddb9d6021d3486f8ac97876b8c0ed52b9360a874 (commit)
      from  59b2b376de93a1d63abd09a1fcef8317c5dc5a07 (commit)

Summary of changes:
 .../Ticket/Update.html/AfterWorked                         | 14 ++++++++++++--
 .../m/ticket/reply/AfterWorked                             | 12 ++++++++++--
 lib/RT/Extension/MandatoryOnTransition.pm                  |  3 ++-
 xt/basic.t                                                 | 13 +++++++++++--
 4 files changed, 35 insertions(+), 7 deletions(-)

- Log -----------------------------------------------------------------
commit ddb9d6021d3486f8ac97876b8c0ed52b9360a874
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Wed May 7 13:10:49 2014 -0400

    Silence 4.2 deprecation warnings
    
    We can't just switch to /Elements/EditCustomFields and remain 4.0
    compatible, so we have some shenanigans to figure out what version
    we're on.  /Elements/EditCustomFields didn't exist in 4.0 which makes it
    easier.
    
    See also rt-extension-customfieldsonupdate.

diff --git a/html/Callbacks/RT-Extension-MandatoryOnTransition/Ticket/Update.html/AfterWorked b/html/Callbacks/RT-Extension-MandatoryOnTransition/Ticket/Update.html/AfterWorked
index 8129e75..b00e7d7 100644
--- a/html/Callbacks/RT-Extension-MandatoryOnTransition/Ticket/Update.html/AfterWorked
+++ b/html/Callbacks/RT-Extension-MandatoryOnTransition/Ticket/Update.html/AfterWorked
@@ -7,11 +7,21 @@ my ($core, $cfs) = RT::Extension::MandatoryOnTransition->RequiredFields(
     To      => $ARGS{'Status'} || $ARGS{'DefaultStatus'},
 );
 return unless @$cfs;
+
+my $comp = '/Elements/EditCustomFields';
+my %obj_args = ( Object => $Ticket );
+
+# Handle location in 4.0 and 4.2
+if (!$m->comp_exists('/Elements/EditCustomFields')) {
+    $comp = '/Ticket/Elements/EditCustomFields';
+    %obj_args = ( TicketObj => $Ticket );
+}
+
 </%init>
 %# 'Named' is handled by this extension in the MassageCustomFields callback
-<& /Ticket/Elements/EditCustomFields,
+<& $comp,
     %ARGS,
-    TicketObj   => $Ticket,
+    %obj_args,
     InTable     => 1,
     Named       => $cfs,
     &>
diff --git a/html/Callbacks/RT-Extension-MandatoryOnTransition/m/ticket/reply/AfterWorked b/html/Callbacks/RT-Extension-MandatoryOnTransition/m/ticket/reply/AfterWorked
index dc7ccff..ca9ae5d 100644
--- a/html/Callbacks/RT-Extension-MandatoryOnTransition/m/ticket/reply/AfterWorked
+++ b/html/Callbacks/RT-Extension-MandatoryOnTransition/m/ticket/reply/AfterWorked
@@ -10,11 +10,19 @@ my ($core, $cfs) = RT::Extension::MandatoryOnTransition->RequiredFields(
 
 return unless @$cfs;
 
+my $comp = '/Elements/EditCustomFields';
+my %obj_args = ( Object => $Ticket );
+
+# Handle location in 4.0 and 4.2
+if (!$m->comp_exists('/Elements/EditCustomFields')) {
+    $comp = '/Ticket/Elements/EditCustomFields';
+    %obj_args = ( TicketObj => $Ticket );
+}
 </%init>
 %# 'Named' is handled by this extension in the MassageCustomFields callback
-<& /Ticket/Elements/EditCustomFields,
+<& $comp,
     %ARGS,
-    TicketObj   => $Ticket,
+    %obj_args,
     InTable     => 0,
     Named       => $cfs,
     &>
diff --git a/xt/basic.t b/xt/basic.t
index b8230bf..cb1fd15 100644
--- a/xt/basic.t
+++ b/xt/basic.t
@@ -1,7 +1,7 @@
 use strict;
 use warnings;
 
-use RT::Extension::MandatoryOnTransition::Test tests => 37;
+use RT::Extension::MandatoryOnTransition::Test tests => undef;
 
 use_ok('RT::Extension::MandatoryOnTransition');
 
@@ -51,7 +51,13 @@ diag "Try a resolve without TimeWorked";
                           button => 'SubmitTicket',
                         }, 'Submit resolve with Time Worked and Test Field');
 
-    $m->content_contains("TimeWorked changed from (no value) to '10'");
+    if ( $RT::VERSION =~ /^4\.0\.\d+/ ){
+        $m->content_contains("TimeWorked changed from (no value) to '10'");
+    }
+    else{
+        # 4.2 or later
+        $m->content_contains("Worked 10 minutes");
+    }
     $m->content_contains("Status changed from 'open' to 'resolved'");
 }
 
@@ -93,3 +99,6 @@ diag "Try a resolve without TimeWorked in mobile interface";
     $m->title_like(qr/^#$ticket_id:/, "Page title starts with ticket number $ticket_id");
     like($m->uri->as_string, qr/show/, "On show page after ticket resolve");
 }
+
+undef $m;
+done_testing;

commit b16e6cc6a86183ef3511044f10f8a4cb402b8726
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Wed May 7 13:21:21 2014 -0400

    Silence case sensitive search warnings

diff --git a/lib/RT/Extension/MandatoryOnTransition.pm b/lib/RT/Extension/MandatoryOnTransition.pm
index 637403d..18497e5 100644
--- a/lib/RT/Extension/MandatoryOnTransition.pm
+++ b/lib/RT/Extension/MandatoryOnTransition.pm
@@ -363,7 +363,8 @@ sub CheckMandatoryFields {
         return \@errors;
     }
 
-    $CFs->Limit( FIELD => 'Name', VALUE => $_, SUBCLAUSE => 'names', ENTRYAGGREGRATOR => 'OR' )
+    $CFs->Limit( FIELD => 'Name', VALUE => $_, SUBCLAUSE => 'names',
+        ENTRYAGGREGRATOR => 'OR', CASESENSITIVE => 0 )
       for @$cfs;
 
     # For constructing NamePrefix for both update and create

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


More information about the Bps-public-commit mailing list