[Bps-public-commit] RT-Extension-MandatoryOnTransition branch, master, updated. 0.09_01-9-gca9fe8f

Jim Brandt jbrandt at bestpractical.com
Wed Mar 30 15:54:25 EDT 2016


The branch, master has been updated
       via  ca9fe8fbf109f82473e2126a4098023eee7cc33c (commit)
       via  a3c9a286b9bf9f10c97dfa43d45b8da3d12c9224 (commit)
       via  fe0d990f30ac6cad7e2f525beafd2c36f8f0cae0 (commit)
       via  dfafa765a9c4fe08816356090177b27b39da0c27 (commit)
       via  25c2304c0335668e8bd6a287e0b7b73b274e261b (commit)
       via  70c3109ff7d7aa0f15b5dd6d5194998f79a67403 (commit)
       via  dba1810e8c7bd3733fa738afd843537ddac797c3 (commit)
      from  6fd0d66fe7208954a9cf0b0a675cb75678284693 (commit)

Summary of changes:
 Changes                                            |   6 +
 MANIFEST                                           |   4 +-
 META.yml                                           |   5 +-
 README                                             |  78 ++--
 .../Elements/EditCustomFields/BeforeCustomFields   |  15 +
 .../Elements/EditCustomFields/MassageCustomFields  |   1 +
 inc/Module/Install.pm                              |   2 +-
 inc/Module/Install/Base.pm                         |   2 +-
 inc/Module/Install/Can.pm                          |   2 +-
 inc/Module/Install/Fetch.pm                        |   2 +-
 inc/Module/Install/Include.pm                      |   2 +-
 inc/Module/Install/Makefile.pm                     |   2 +-
 inc/Module/Install/Metadata.pm                     |   2 +-
 inc/Module/Install/RTx.pm                          |  27 +-
 inc/Module/Install/Win32.pm                        |   2 +-
 inc/Module/Install/WriteAll.pm                     |   2 +-
 inc/YAML/Tiny.pm                                   |  29 +-
 inc/unicore/Name.pm                                | 417 ---------------------
 lib/RT/Extension/MandatoryOnTransition.pm          |  37 +-
 lib/RT/Extension/MandatoryOnTransition/Test.pm.in  |  10 +
 po/fr.po                                           |  14 +
 po/mandatoryontransition.pot                       |   6 +
 xt/basic.t                                         |  22 +-
 xt/mandatory_on_create.t                           |  16 +-
 24 files changed, 207 insertions(+), 498 deletions(-)
 create mode 100644 html/Callbacks/RT-Extension-MandatoryOnTransition/Elements/EditCustomFields/BeforeCustomFields
 delete mode 100644 inc/unicore/Name.pm
 create mode 100644 po/fr.po
 create mode 100644 po/mandatoryontransition.pot

- Log -----------------------------------------------------------------
commit dba1810e8c7bd3733fa738afd843537ddac797c3
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Tue Mar 29 16:47:32 2016 -0400

    Update tests to run cleanly against RT 4.4
    
    Two updates to run against 4.4:
    
    * We now create a Content CF for Articles so newly created CFs
    in tests don't get id #1. Update the test to make the id a
    variable.
    
    * The message when creating a ticket now includes the queue.
    Add a version branch to test both versions.

diff --git a/lib/RT/Extension/MandatoryOnTransition/Test.pm.in b/lib/RT/Extension/MandatoryOnTransition/Test.pm.in
index d7ad18d..41ae190 100644
--- a/lib/RT/Extension/MandatoryOnTransition/Test.pm.in
+++ b/lib/RT/Extension/MandatoryOnTransition/Test.pm.in
@@ -47,4 +47,14 @@ CONFIG
     require RT::Extension::MandatoryOnTransition;
 }
 
+sub RTAtorNewerThan{
+    my $version = shift;
+    my ($my_major, $my_minor, $my_sub) = split(/\./, $version);
+    my ($major, $minor, $sub) = split(/\./, $RT::VERSION);
+    return ($my_major >= $major
+            and $my_minor >= $minor
+            and $my_sub >= $sub)
+            ? 1 : 0;
+}
+
 1;
diff --git a/xt/basic.t b/xt/basic.t
index cb1fd15..71a8707 100644
--- a/xt/basic.t
+++ b/xt/basic.t
@@ -47,7 +47,7 @@ diag "Try a resolve without TimeWorked";
 
     $m->submit_form_ok( { form_name => 'TicketUpdate',
                           fields => { UpdateTimeWorked => 10,
-                                    'Object-RT::Ticket-' . $t->id . '-CustomField-1-Values' => 'foo'},
+                                    'Object-RT::Ticket-' . $t->id . "-CustomField-$id-Values" => 'foo'},
                           button => 'SubmitTicket',
                         }, 'Submit resolve with Time Worked and Test Field');
 
@@ -91,7 +91,7 @@ diag "Try a resolve without TimeWorked in mobile interface";
 
     $m->submit_form_ok( { form_number => 1,
                           fields => { UpdateTimeWorked => 10,
-                                    'Object-RT::Ticket-' . $ticket_id . '-CustomField-1-Values' => 'foo'},
+                                    'Object-RT::Ticket-' . $ticket_id . "-CustomField-$id-Values" => 'foo'},
                           button => 'SubmitTicket',
                         }, 'Submit resolve with Time Worked and Test Field');
 
diff --git a/xt/mandatory_on_create.t b/xt/mandatory_on_create.t
index 0bf3729..a635e4f 100644
--- a/xt/mandatory_on_create.t
+++ b/xt/mandatory_on_create.t
@@ -32,7 +32,13 @@ diag "Test mandatory fields on create";
                           fields => { Queue => 'General',},
                         }, 'Click button to create ticket');
 
-    $m->title_is('Create a new ticket');
+    if (RT::Extension::MandatoryOnTransition::Test::RTAtorNewerThan('4.4.0')){
+        $m->title_is('Create a new ticket in General');
+    }
+    else{
+        # RT 4.2 or older
+        $m->title_is('Create a new ticket');
+    }
 
     $m->submit_form_ok( { form_name => 'TicketCreate',
                           fields => { Status => 'resolved' },
@@ -43,14 +49,14 @@ diag "Test mandatory fields on create";
 
     $m->submit_form_ok( { form_name => 'TicketCreate',
                           fields => { Status => 'resolved',
-                                    'Object-RT::Ticket--CustomField-1-Values' => 'foo'},
+                                    "Object-RT::Ticket--CustomField-$id-Values" => 'foo'},
                         }, 'Submit with resolved status');
 
     $m->content_contains('Time Worked is required when changing Status to resolved');
 
     $m->submit_form_ok( { form_name => 'TicketCreate',
                           fields => { Status => 'resolved',
-                                      'Object-RT::Ticket--CustomField-1-Values' => 'foo',
+                                      "Object-RT::Ticket--CustomField-$id-Values" => 'foo',
                                       'TimeWorked' => '10', },
                         }, 'Submit with resolved status');
 
@@ -74,14 +80,14 @@ diag "Test mandatory fields on create for mobile";
 
     $m->submit_form_ok( { form_name => 'TicketCreate',
                           fields => { Status => 'resolved',
-                                    'Object-RT::Ticket--CustomField-1-Values' => 'foo'},
+                                    "Object-RT::Ticket--CustomField-$id-Values" => 'foo'},
                         }, 'Submit with resolved status');
 
     $m->content_contains('Time Worked is required when changing Status to resolved');
 
     $m->submit_form_ok( { form_name => 'TicketCreate',
                           fields => { Status => 'resolved',
-                                      'Object-RT::Ticket--CustomField-1-Values' => 'foo',
+                                      "Object-RT::Ticket--CustomField-$id-Values" => 'foo',
                                       'TimeWorked' => '10', },
                         }, 'Submit with resolved status');
 

commit 70c3109ff7d7aa0f15b5dd6d5194998f79a67403
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Wed Mar 30 09:54:42 2016 -0400

    Update Module::Install

diff --git a/inc/Module/Install.pm b/inc/Module/Install.pm
index ff767fa..f44ab4d 100644
--- a/inc/Module/Install.pm
+++ b/inc/Module/Install.pm
@@ -31,7 +31,7 @@ BEGIN {
 	# This is not enforced yet, but will be some time in the next few
 	# releases once we can make sure it won't clash with custom
 	# Module::Install extensions.
-	$VERSION = '1.14';
+	$VERSION = '1.16';
 
 	# Storage for the pseudo-singleton
 	$MAIN    = undef;
diff --git a/inc/Module/Install/Base.pm b/inc/Module/Install/Base.pm
index 4206347..5762a74 100644
--- a/inc/Module/Install/Base.pm
+++ b/inc/Module/Install/Base.pm
@@ -4,7 +4,7 @@ package Module::Install::Base;
 use strict 'vars';
 use vars qw{$VERSION};
 BEGIN {
-	$VERSION = '1.14';
+	$VERSION = '1.16';
 }
 
 # Suspend handler for "redefined" warnings
diff --git a/inc/Module/Install/Can.pm b/inc/Module/Install/Can.pm
index 9929b1b..d859276 100644
--- a/inc/Module/Install/Can.pm
+++ b/inc/Module/Install/Can.pm
@@ -8,7 +8,7 @@ use Module::Install::Base ();
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '1.14';
+	$VERSION = '1.16';
 	@ISA     = 'Module::Install::Base';
 	$ISCORE  = 1;
 }
diff --git a/inc/Module/Install/Fetch.pm b/inc/Module/Install/Fetch.pm
index 3d8de76..41d3517 100644
--- a/inc/Module/Install/Fetch.pm
+++ b/inc/Module/Install/Fetch.pm
@@ -6,7 +6,7 @@ use Module::Install::Base ();
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '1.14';
+	$VERSION = '1.16';
 	@ISA     = 'Module::Install::Base';
 	$ISCORE  = 1;
 }
diff --git a/inc/Module/Install/Include.pm b/inc/Module/Install/Include.pm
index f274f87..2eb1d1f 100644
--- a/inc/Module/Install/Include.pm
+++ b/inc/Module/Install/Include.pm
@@ -6,7 +6,7 @@ use Module::Install::Base ();
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '1.14';
+	$VERSION = '1.16';
 	@ISA     = 'Module::Install::Base';
 	$ISCORE  = 1;
 }
diff --git a/inc/Module/Install/Makefile.pm b/inc/Module/Install/Makefile.pm
index 66993af..e9918d2 100644
--- a/inc/Module/Install/Makefile.pm
+++ b/inc/Module/Install/Makefile.pm
@@ -8,7 +8,7 @@ use Fcntl qw/:flock :seek/;
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '1.14';
+	$VERSION = '1.16';
 	@ISA     = 'Module::Install::Base';
 	$ISCORE  = 1;
 }
diff --git a/inc/Module/Install/Metadata.pm b/inc/Module/Install/Metadata.pm
index e547fa0..9792685 100644
--- a/inc/Module/Install/Metadata.pm
+++ b/inc/Module/Install/Metadata.pm
@@ -6,7 +6,7 @@ use Module::Install::Base ();
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '1.14';
+	$VERSION = '1.16';
 	@ISA     = 'Module::Install::Base';
 	$ISCORE  = 1;
 }
diff --git a/inc/Module/Install/RTx.pm b/inc/Module/Install/RTx.pm
index 97acf77..cb4cfde 100644
--- a/inc/Module/Install/RTx.pm
+++ b/inc/Module/Install/RTx.pm
@@ -37,6 +37,13 @@ sub RTx {
     }
     $self->add_metadata("x_module_install_rtx_version", $VERSION );
 
+    my $installdirs = $ENV{INSTALLDIRS};
+    for ( @ARGV ) {
+        if ( /INSTALLDIRS=(.*)/ ) {
+            $installdirs = $1;
+        }
+    }
+
     # Try to find RT.pm
     my @prefixes = qw( /opt /usr/local /home /usr /sw /usr/share/request-tracker4);
     $ENV{RTHOME} =~ s{/RT\.pm$}{} if defined $ENV{RTHOME};
@@ -71,7 +78,13 @@ sub RTx {
 
     # Installation locations
     my %path;
-    $path{$_} = $RT::LocalPluginPath . "/$name/$_"
+    my $plugin_path;
+    if ( $installdirs && $installdirs eq 'vendor' ) {
+        $plugin_path = $RT::PluginPath;
+    } else {
+        $plugin_path = $RT::LocalPluginPath;
+    }
+    $path{$_} = $plugin_path . "/$name/$_"
         foreach @DIRS;
 
     # Copy RT 4.2.0 static files into NoAuth; insufficient for
@@ -85,7 +98,7 @@ sub RTx {
     my %index = map { $_ => 1 } @INDEX_DIRS;
     $self->no_index( directory => $_ ) foreach grep !$index{$_}, @DIRS;
 
-    my $args = join ', ', map "q($_)", map { ($_, $path{$_}) }
+    my $args = join ', ', map "q($_)", map { ($_, "\$(DESTDIR)$path{$_}") }
         sort keys %path;
 
     printf "%-10s => %s\n", $_, $path{$_} for sort keys %path;
@@ -131,6 +144,7 @@ install ::
     if ( $path{lib} ) {
         $self->makemaker_args( INSTALLSITELIB => $path{'lib'} );
         $self->makemaker_args( INSTALLARCHLIB => $path{'lib'} );
+        $self->makemaker_args( INSTALLVENDORLIB => $path{'lib'} )
     } else {
         $self->makemaker_args( PM => { "" => "" }, );
     }
@@ -139,6 +153,13 @@ install ::
     $self->makemaker_args( INSTALLSITEMAN3DIR => "$RT::LocalPath/man/man3" );
     $self->makemaker_args( INSTALLSITEARCH => "$RT::LocalPath/man" );
 
+    # INSTALLDIRS=vendor should install manpages into /usr/share/man.
+    # That is the default path in most distributions. Need input from
+    # Redhat, Centos etc.
+    $self->makemaker_args( INSTALLVENDORMAN1DIR => "/usr/share/man/man1" );
+    $self->makemaker_args( INSTALLVENDORMAN3DIR => "/usr/share/man/man3" );
+    $self->makemaker_args( INSTALLVENDORARCH => "/usr/share/man" );
+
     if (%has_etc) {
         print "For first-time installation, type 'make initdb'.\n";
         my $initdb = '';
@@ -258,4 +279,4 @@ sub _load_rt_handle {
 
 __END__
 
-#line 390
+#line 428
diff --git a/inc/Module/Install/Win32.pm b/inc/Module/Install/Win32.pm
index 9706e5f..218a66b 100644
--- a/inc/Module/Install/Win32.pm
+++ b/inc/Module/Install/Win32.pm
@@ -6,7 +6,7 @@ use Module::Install::Base ();
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '1.14';
+	$VERSION = '1.16';
 	@ISA     = 'Module::Install::Base';
 	$ISCORE  = 1;
 }
diff --git a/inc/Module/Install/WriteAll.pm b/inc/Module/Install/WriteAll.pm
index dbedc00..530749b 100644
--- a/inc/Module/Install/WriteAll.pm
+++ b/inc/Module/Install/WriteAll.pm
@@ -6,7 +6,7 @@ use Module::Install::Base ();
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '1.14';
+	$VERSION = '1.16';
 	@ISA     = qw{Module::Install::Base};
 	$ISCORE  = 1;
 }
diff --git a/inc/YAML/Tiny.pm b/inc/YAML/Tiny.pm
index 1be0cb1..aa539f7 100644
--- a/inc/YAML/Tiny.pm
+++ b/inc/YAML/Tiny.pm
@@ -2,16 +2,12 @@
 use 5.008001; # sane UTF-8 support
 use strict;
 use warnings;
-package YAML::Tiny;
-BEGIN {
-  $YAML::Tiny::AUTHORITY = 'cpan:ADAMK';
-}
-# git description: v1.61-3-g0a82466
-$YAML::Tiny::VERSION = '1.62';
+package YAML::Tiny; # git description: v1.68-2-gcc5324e
 # XXX-INGY is 5.8.1 too old/broken for utf8?
 # XXX-XDG Lancaster consensus was that it was sufficient until
 # proven otherwise
 
+our $VERSION = '1.69';
 
 #####################################################################
 # The YAML::Tiny API.
@@ -300,10 +296,11 @@ Did you decode with lax ":utf8" instead of strict ":encoding(UTF-8)"?
             }
         }
     };
-    if ( ref $@ eq 'SCALAR' ) {
-        $self->_error(${$@});
-    } elsif ( $@ ) {
-        $self->_error($@);
+    my $err = $@;
+    if ( ref $err eq 'SCALAR' ) {
+        $self->_error(${$err});
+    } elsif ( $err ) {
+        $self->_error($err);
     }
 
     return $self;
@@ -515,6 +512,10 @@ sub _load_hash {
             die \"YAML::Tiny failed to classify line '$lines->[0]'";
         }
 
+        if ( exists $hash->{$key} ) {
+            warn "YAML::Tiny found a duplicate key '$key' in line '$lines->[0]'";
+        }
+
         # Do we have a value?
         if ( length $lines->[0] ) {
             # Yes
@@ -828,9 +829,10 @@ sub _can_flock {
 #####################################################################
 # Use Scalar::Util if possible, otherwise emulate it
 
+use Scalar::Util ();
 BEGIN {
     local $@;
-    if ( eval { require Scalar::Util; Scalar::Util->VERSION(1.18); } ) {
+    if ( eval { Scalar::Util->VERSION(1.18); } ) {
         *refaddr = *Scalar::Util::refaddr;
     }
     else {
@@ -852,8 +854,7 @@ END_PERL
     }
 }
 
-
-
+delete $YAML::Tiny::{refaddr};
 
 1;
 
@@ -870,4 +871,4 @@ END_PERL
 
 __END__
 
-#line 1488
+#line 1489
diff --git a/inc/unicore/Name.pm b/inc/unicore/Name.pm
deleted file mode 100644
index d72eb6e..0000000
--- a/inc/unicore/Name.pm
+++ /dev/null
@@ -1,417 +0,0 @@
-#line 1
-# !!!!!!!   DO NOT EDIT THIS FILE   !!!!!!!
-# This file is machine-generated by lib/unicore/mktables from the Unicode
-# database, Version 6.3.0.  Any changes made here will be lost!
-
-
-# !!!!!!!   INTERNAL PERL USE ONLY   !!!!!!!
-# This file is for internal use by core Perl only.  The format and even the
-# name or existence of this file are subject to change without notice.  Don't
-# use it directly.  Use Unicode::UCD to access the Unicode character data
-# base.
-
-
-package charnames;
-
-# This module contains machine-generated tables and code for the
-# algorithmically-determinable Unicode character names.  The following
-# routines can be used to translate between name and code point and vice versa
-
-{ # Closure
-
-    # Matches legal code point.  4-6 hex numbers, If there are 6, the first
-    # two must be 10; if there are 5, the first must not be a 0.  Written this
-    # way to decrease backtracking.  The first regex allows the code point to
-    # be at the end of a word, but to work properly, the word shouldn't end
-    # with a valid hex character.  The second one won't match a code point at
-    # the end of a word, and doesn't have the run-on issue
-    my $run_on_code_point_re = qr/(?^aax: (?: 10[0-9A-F]{4} | [1-9A-F][0-9A-F]{4} | [0-9A-F]{4} ) \b)/;
-    my $code_point_re = qr/(?^aa:\b(?^aax: (?: 10[0-9A-F]{4} | [1-9A-F][0-9A-F]{4} | [0-9A-F]{4} ) \b))/;
-
-    # In the following hash, the keys are the bases of names which include
-    # the code point in the name, like CJK UNIFIED IDEOGRAPH-4E01.  The value
-    # of each key is another hash which is used to get the low and high ends
-    # for each range of code points that apply to the name.
-    my %names_ending_in_code_point = (
-'CJK COMPATIBILITY IDEOGRAPH' => 
-{
-'high' => 
-[
-64109,
-64217,
-195101,
-],
-'low' => 
-[
-63744,
-64112,
-194560,
-],
-},
-'CJK UNIFIED IDEOGRAPH' => 
-{
-'high' => 
-[
-19893,
-40908,
-173782,
-177972,
-178205,
-],
-'low' => 
-[
-13312,
-19968,
-131072,
-173824,
-177984,
-],
-},
-
-    );
-
-    # The following hash is a copy of the previous one, except is for loose
-    # matching, so each name has blanks and dashes squeezed out
-    my %loose_names_ending_in_code_point = (
-'CJKCOMPATIBILITYIDEOGRAPH' => 
-{
-'high' => 
-[
-64109,
-64217,
-195101,
-],
-'low' => 
-[
-63744,
-64112,
-194560,
-],
-},
-'CJKUNIFIEDIDEOGRAPH' => 
-{
-'high' => 
-[
-19893,
-40908,
-173782,
-177972,
-178205,
-],
-'low' => 
-[
-13312,
-19968,
-131072,
-173824,
-177984,
-],
-},
-
-    );
-
-    # And the following array gives the inverse mapping from code points to
-    # names.  Lowest code points are first
-    my @code_points_ending_in_code_point = (
-
-{
-'high' => 19893,
-'low' => 13312,
-'name' => 'CJK UNIFIED IDEOGRAPH',
-},
-{
-'high' => 40908,
-'low' => 19968,
-'name' => 'CJK UNIFIED IDEOGRAPH',
-},
-{
-'high' => 64109,
-'low' => 63744,
-'name' => 'CJK COMPATIBILITY IDEOGRAPH',
-},
-{
-'high' => 64217,
-'low' => 64112,
-'name' => 'CJK COMPATIBILITY IDEOGRAPH',
-},
-{
-'high' => 173782,
-'low' => 131072,
-'name' => 'CJK UNIFIED IDEOGRAPH',
-},
-{
-'high' => 177972,
-'low' => 173824,
-'name' => 'CJK UNIFIED IDEOGRAPH',
-},
-{
-'high' => 178205,
-'low' => 177984,
-'name' => 'CJK UNIFIED IDEOGRAPH',
-},
-{
-'high' => 195101,
-'low' => 194560,
-'name' => 'CJK COMPATIBILITY IDEOGRAPH',
-},
-,
-
-    );
-
-    # Convert from code point to Jamo short name for use in composing Hangul
-    # syllable names
-    my %Jamo = (
-4352 => 'G',
-4353 => 'GG',
-4354 => 'N',
-4355 => 'D',
-4356 => 'DD',
-4357 => 'R',
-4358 => 'M',
-4359 => 'B',
-4360 => 'BB',
-4361 => 'S',
-4362 => 'SS',
-4363 => '',
-4364 => 'J',
-4365 => 'JJ',
-4366 => 'C',
-4367 => 'K',
-4368 => 'T',
-4369 => 'P',
-4370 => 'H',
-4449 => 'A',
-4450 => 'AE',
-4451 => 'YA',
-4452 => 'YAE',
-4453 => 'EO',
-4454 => 'E',
-4455 => 'YEO',
-4456 => 'YE',
-4457 => 'O',
-4458 => 'WA',
-4459 => 'WAE',
-4460 => 'OE',
-4461 => 'YO',
-4462 => 'U',
-4463 => 'WEO',
-4464 => 'WE',
-4465 => 'WI',
-4466 => 'YU',
-4467 => 'EU',
-4468 => 'YI',
-4469 => 'I',
-4520 => 'G',
-4521 => 'GG',
-4522 => 'GS',
-4523 => 'N',
-4524 => 'NJ',
-4525 => 'NH',
-4526 => 'D',
-4527 => 'L',
-4528 => 'LG',
-4529 => 'LM',
-4530 => 'LB',
-4531 => 'LS',
-4532 => 'LT',
-4533 => 'LP',
-4534 => 'LH',
-4535 => 'M',
-4536 => 'B',
-4537 => 'BS',
-4538 => 'S',
-4539 => 'SS',
-4540 => 'NG',
-4541 => 'J',
-4542 => 'C',
-4543 => 'K',
-4544 => 'T',
-4545 => 'P',
-4546 => 'H',
-
-    );
-
-    # Leading consonant (can be null)
-    my %Jamo_L = (
-'' => 11,
-'B' => 7,
-'BB' => 8,
-'C' => 14,
-'D' => 3,
-'DD' => 4,
-'G' => 0,
-'GG' => 1,
-'H' => 18,
-'J' => 12,
-'JJ' => 13,
-'K' => 15,
-'M' => 6,
-'N' => 2,
-'P' => 17,
-'R' => 5,
-'S' => 9,
-'SS' => 10,
-'T' => 16,
-
-    );
-
-    # Vowel
-    my %Jamo_V = (
-'A' => 0,
-'AE' => 1,
-'E' => 5,
-'EO' => 4,
-'EU' => 18,
-'I' => 20,
-'O' => 8,
-'OE' => 11,
-'U' => 13,
-'WA' => 9,
-'WAE' => 10,
-'WE' => 15,
-'WEO' => 14,
-'WI' => 16,
-'YA' => 2,
-'YAE' => 3,
-'YE' => 7,
-'YEO' => 6,
-'YI' => 19,
-'YO' => 12,
-'YU' => 17,
-
-    );
-
-    # Optional trailing consonant
-    my %Jamo_T = (
-'B' => 17,
-'BS' => 18,
-'C' => 23,
-'D' => 7,
-'G' => 1,
-'GG' => 2,
-'GS' => 3,
-'H' => 27,
-'J' => 22,
-'K' => 24,
-'L' => 8,
-'LB' => 11,
-'LG' => 9,
-'LH' => 15,
-'LM' => 10,
-'LP' => 14,
-'LS' => 12,
-'LT' => 13,
-'M' => 16,
-'N' => 4,
-'NG' => 21,
-'NH' => 6,
-'NJ' => 5,
-'P' => 26,
-'S' => 19,
-'SS' => 20,
-'T' => 25,
-
-    );
-
-    # Computed re that splits up a Hangul name into LVT or LV syllables
-    my $syllable_re = qr/(|B|BB|C|D|DD|G|GG|H|J|JJ|K|M|N|P|R|S|SS|T)(A|AE|E|EO|EU|I|O|OE|U|WA|WAE|WE|WEO|WI|YA|YAE|YE|YEO|YI|YO|YU)(B|BS|C|D|G|GG|GS|H|J|K|L|LB|LG|LH|LM|LP|LS|LT|M|N|NG|NH|NJ|P|S|SS|T)?/;
-
-    my $HANGUL_SYLLABLE = "HANGUL SYLLABLE ";
-    my $loose_HANGUL_SYLLABLE = "HANGULSYLLABLE";
-
-    # These constants names and values were taken from the Unicode standard,
-    # version 5.1, section 3.12.  They are used in conjunction with Hangul
-    # syllables
-    my $SBase = 0xAC00;
-    my $LBase = 0x1100;
-    my $VBase = 0x1161;
-    my $TBase = 0x11A7;
-    my $SCount = 11172;
-    my $LCount = 19;
-    my $VCount = 21;
-    my $TCount = 28;
-    my $NCount = $VCount * $TCount;
-
-    sub name_to_code_point_special {
-        my ($name, $loose) = @_;
-
-        # Returns undef if not one of the specially handled names; otherwise
-        # returns the code point equivalent to the input name
-        # $loose is non-zero if to use loose matching, 'name' in that case
-        # must be input as upper case with all blanks and dashes squeezed out.
-
-        if ((! $loose && $name =~ s/$HANGUL_SYLLABLE//)
-            || ($loose && $name =~ s/$loose_HANGUL_SYLLABLE//))
-        {
-            return if $name !~ qr/^$syllable_re$/;
-            my $L = $Jamo_L{$1};
-            my $V = $Jamo_V{$2};
-            my $T = (defined $3) ? $Jamo_T{$3} : 0;
-            return ($L * $VCount + $V) * $TCount + $T + $SBase;
-        }
-
-        # Name must end in 'code_point' for this to handle.
-        return if (($loose && $name !~ /^ (.*?) ($run_on_code_point_re) $/x)
-                   || (! $loose && $name !~ /^ (.*) ($code_point_re) $/x));
-
-        my $base = $1;
-        my $code_point = CORE::hex $2;
-        my $names_ref;
-
-        if ($loose) {
-            $names_ref = \%loose_names_ending_in_code_point;
-        }
-        else {
-            return if $base !~ s/-$//;
-            $names_ref = \%names_ending_in_code_point;
-        }
-
-        # Name must be one of the ones which has the code point in it.
-        return if ! $names_ref->{$base};
-
-        # Look through the list of ranges that apply to this name to see if
-        # the code point is in one of them.
-        for (my $i = 0; $i < scalar @{$names_ref->{$base}{'low'}}; $i++) {
-            return if $names_ref->{$base}{'low'}->[$i] > $code_point;
-            next if $names_ref->{$base}{'high'}->[$i] < $code_point;
-
-            # Here, the code point is in the range.
-            return $code_point;
-        }
-
-        # Here, looked like the name had a code point number in it, but
-        # did not match one of the valid ones.
-        return;
-    }
-
-    sub code_point_to_name_special {
-        my $code_point = shift;
-
-        # Returns the name of a code point if algorithmically determinable;
-        # undef if not
-
-        # If in the Hangul range, calculate the name based on Unicode's
-        # algorithm
-        if ($code_point >= $SBase && $code_point <= $SBase + $SCount -1) {
-            use integer;
-            my $SIndex = $code_point - $SBase;
-            my $L = $LBase + $SIndex / $NCount;
-            my $V = $VBase + ($SIndex % $NCount) / $TCount;
-            my $T = $TBase + $SIndex % $TCount;
-            $name = "$HANGUL_SYLLABLE$Jamo{$L}$Jamo{$V}";
-            $name .= $Jamo{$T} if $T != $TBase;
-            return $name;
-        }
-
-        # Look through list of these code points for one in range.
-        foreach my $hash (@code_points_ending_in_code_point) {
-            return if $code_point < $hash->{'low'};
-            if ($code_point <= $hash->{'high'}) {
-                return sprintf("%s-%04X", $hash->{'name'}, $code_point);
-            }
-        }
-        return;            # None found
-    }
-} # End closure
-
-1;

commit 25c2304c0335668e8bd6a287e0b7b73b274e261b
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Wed Mar 30 13:58:14 2016 -0400

    Test showing non-mandatory fields appear on edit page
    
    Only mandatory fields should show up on edit pages. This test
    shows that optional fields are also appearing on RT 4.2/4.4.

diff --git a/xt/basic.t b/xt/basic.t
index 71a8707..285eda6 100644
--- a/xt/basic.t
+++ b/xt/basic.t
@@ -26,6 +26,22 @@ ok( $id, $msg );
 $cf->AddValue( Name => 'foo' );
 $cf->AddValue( Name => 'bar' );
 
+my $cf2 = RT::CustomField->new($RT::SystemUser);
+my $id2;
+
+diag "Create optional custom field";
+( $id2, $msg ) = $cf2->Create(
+    Name      => 'XXX Optional Field ZZZ',
+    Type      => 'Select',
+    LookupType => 'RT::Queue-RT::Ticket',
+    MaxValues => '1',
+    Queue     => 'General',
+);
+
+ok( $id2, $msg );
+$cf2->AddValue( Name => 'blue' );
+$cf2->AddValue( Name => 'green' );
+
 diag "Try a resolve without TimeWorked";
 {
     my $t = RT::Test->create_ticket(
@@ -39,6 +55,8 @@ diag "Try a resolve without TimeWorked";
     $m->goto_ticket($t->id);
 
     $m->follow_link_ok( { text => 'Resolve' }, 'Try to resolve ticket');
+    $m->content_contains('Test Field');
+    $m->content_lacks('XXX Optional Field ZZZ');
     $m->submit_form_ok( { form_name => 'TicketUpdate',
                           button => 'SubmitTicket',},
                           'Submit resolve with no Time Worked');

commit dfafa765a9c4fe08816356090177b27b39da0c27
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Wed Mar 30 14:01:51 2016 -0400

    Restore filtering to show only mandatory fields
    
    When EditCustomFields was moved from Tickets/Elements to
    the general /Elements, the MassageCustomFields callback
    was not also moved, so the code that filters the list of
    CFs to only mandatory fields was lost. This resulted in
    all CFs showing up on update pages. Restore this functionality
    by creating the appropriate new callback at
    BeforeCustomFields.
    
    Resolves: https://rt.cpan.org/Ticket/Display.html?id=102746

diff --git a/html/Callbacks/RT-Extension-MandatoryOnTransition/Elements/EditCustomFields/BeforeCustomFields b/html/Callbacks/RT-Extension-MandatoryOnTransition/Elements/EditCustomFields/BeforeCustomFields
new file mode 100644
index 0000000..0c27ca5
--- /dev/null
+++ b/html/Callbacks/RT-Extension-MandatoryOnTransition/Elements/EditCustomFields/BeforeCustomFields
@@ -0,0 +1,14 @@
+<%args>
+$CustomFields
+$ARGSRef
+</%args>
+<%init>
+return unless $ARGSRef->{'Named'} and @{$ARGSRef->{'Named'}};
+
+$CustomFields->Limit( FIELD => 'Name',
+                      VALUE => $_,
+                      SUBCLAUSE => 'names',
+                      ENTRYAGGREGRATOR => 'OR',
+                      CASESENSITIVE => 1 )
+    for @{$ARGSRef->{'Named'}};
+</%init>

commit fe0d990f30ac6cad7e2f525beafd2c36f8f0cae0
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Wed Mar 30 14:48:29 2016 -0400

    Provide an option to show all CFs on update
    
    Several versions had a bug that showed all CFs on update and
    not just the mandatory ones. This bug has been fixed, but
    some users may have gotten used to seeing all CFs on update,
    so provide an option to restore that behavior.

diff --git a/html/Callbacks/RT-Extension-MandatoryOnTransition/Elements/EditCustomFields/BeforeCustomFields b/html/Callbacks/RT-Extension-MandatoryOnTransition/Elements/EditCustomFields/BeforeCustomFields
index 0c27ca5..8bf4d24 100644
--- a/html/Callbacks/RT-Extension-MandatoryOnTransition/Elements/EditCustomFields/BeforeCustomFields
+++ b/html/Callbacks/RT-Extension-MandatoryOnTransition/Elements/EditCustomFields/BeforeCustomFields
@@ -3,6 +3,7 @@ $CustomFields
 $ARGSRef
 </%args>
 <%init>
+return if RT->Config->Get('ShowAllCustomFieldsOnMandatoryUpdate');
 return unless $ARGSRef->{'Named'} and @{$ARGSRef->{'Named'}};
 
 $CustomFields->Limit( FIELD => 'Name',
diff --git a/html/Callbacks/RT-Extension-MandatoryOnTransition/Ticket/Elements/EditCustomFields/MassageCustomFields b/html/Callbacks/RT-Extension-MandatoryOnTransition/Ticket/Elements/EditCustomFields/MassageCustomFields
index 1075e8b..8418d5c 100644
--- a/html/Callbacks/RT-Extension-MandatoryOnTransition/Ticket/Elements/EditCustomFields/MassageCustomFields
+++ b/html/Callbacks/RT-Extension-MandatoryOnTransition/Ticket/Elements/EditCustomFields/MassageCustomFields
@@ -3,6 +3,7 @@ $CustomFields
 $Named => []
 </%args>
 <%init>
+return if RT->Config->Get('ShowAllCustomFieldsOnMandatoryUpdate');
 return unless @$Named;
 
 $CustomFields->Limit( FIELD => 'Name', VALUE => $_, SUBCLAUSE => 'names', ENTRYAGGREGRATOR => 'OR' )
diff --git a/lib/RT/Extension/MandatoryOnTransition.pm b/lib/RT/Extension/MandatoryOnTransition.pm
index 7d3fec2..701020a 100644
--- a/lib/RT/Extension/MandatoryOnTransition.pm
+++ b/lib/RT/Extension/MandatoryOnTransition.pm
@@ -101,8 +101,18 @@ For RT 4.0, add this line:
 
 or add C<RT::Extension::MandatoryOnTransition> to your existing C<@Plugins> line.
 
-Then configure which fields should be mandatory on certain status changes
-(either globally or in a specific queue) using the C<%MandatoryOnTransition>
+=item Clear your mason cache
+
+    rm -rf /opt/rt4/var/mason_data/obj
+
+=item Restart your webserver
+
+=back
+
+=head1 CONFIGURATION
+
+To define which fields should be mandatory on certain status changes
+(either globally or in a specific queue) use the C<%MandatoryOnTransition>
 config option.  This option takes the generic form of:
 
     Set( %MandatoryOnTransition,
@@ -134,13 +144,14 @@ Category selection before resolving tickets in every other queue.
 The transition syntax is similar to that found in RT's Lifecycles.  See
 C<perldoc /opt/rt4/etc/RT_Config.pm>.
 
-=item Clear your mason cache
+=head2 C<$ShowAllCustomFieldsOnMandatoryUpdate>
 
-    rm -rf /opt/rt4/var/mason_data/obj
+By default, this extension shows only the mandatory fields on the update page
+to make it easy for users to fill them out when completing an action. If you
+would like to show all custom fields rather than just the mandatory ones,
+use this configuration option. You can set it like this:
 
-=item Restart your webserver
-
-=back
+    Set($ShowAllCustomFieldsOnMandatoryUpdate, 1);
 
 =head1 IMPLEMENTATION DETAILS
 

commit a3c9a286b9bf9f10c97dfa43d45b8da3d12c9224
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Wed Mar 30 15:25:47 2016 -0400

    Add French translations
    
    Submitted by Emmanuel Lacour on:
    https://rt.cpan.org/Ticket/Display.html?id=105691
    
    Thanks!
    
    Also provides examples for additional translations.

diff --git a/lib/RT/Extension/MandatoryOnTransition.pm b/lib/RT/Extension/MandatoryOnTransition.pm
index 701020a..cf76a48 100644
--- a/lib/RT/Extension/MandatoryOnTransition.pm
+++ b/lib/RT/Extension/MandatoryOnTransition.pm
@@ -371,7 +371,7 @@ sub CheckMandatoryFields {
         (my $label = $field) =~ s/(?<=[a-z])(?=[A-Z])/ /g; # /
         push @errors,
           $CurrentUser->loc("[_1] is required when changing Status to [_2]",
-                                     $label, $ARGSRef->{Status});
+                                     $label, $CurrentUser->loc($ARGSRef->{Status}));
     }
 
     return \@errors unless @$cfs;
@@ -428,7 +428,7 @@ sub CheckMandatoryFields {
 
         push @errors,
           $CurrentUser->loc("[_1] is required when changing Status to [_2]",
-                                     $cf->Name, $ARGSRef->{Status});
+                                     $cf->Name, $CurrentUser->loc($ARGSRef->{Status}));
     }
 
     return \@errors;
diff --git a/po/fr.po b/po/fr.po
new file mode 100644
index 0000000..fa384ad
--- /dev/null
+++ b/po/fr.po
@@ -0,0 +1,14 @@
+msgid ""
+msgstr ""
+"PO-Revision-Date: 2016-03-17 11:51+0200\n"
+"Last-Translator: Emmanuel Lacour <elacour at home-dn.net>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#. ($cf->Name, $ARGSRef->{Status})
+#. ($label, $ARGSRef->{Status})
+#: lib/RT/Extension/MandatoryOnTransition.pm:363 lib/RT/Extension/MandatoryOnTransition.pm:411
+msgid "%1 is required when changing Status to %2"
+msgstr "%1 est obligatoire lors du passage en %2"
+
diff --git a/po/mandatoryontransition.pot b/po/mandatoryontransition.pot
new file mode 100644
index 0000000..c2ba197
--- /dev/null
+++ b/po/mandatoryontransition.pot
@@ -0,0 +1,6 @@
+#. ($cf->Name, $ARGSRef->{Status})
+#. ($label, $ARGSRef->{Status})
+#: lib/RT/Extension/MandatoryOnTransition.pm:363 lib/RT/Extension/MandatoryOnTransition.pm:411
+msgid "%1 is required when changing Status to %2"
+msgstr ""
+

commit ca9fe8fbf109f82473e2126a4098023eee7cc33c
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Wed Mar 30 15:54:13 2016 -0400

    Prep for new release

diff --git a/Changes b/Changes
index af695da..855d476 100644
--- a/Changes
+++ b/Changes
@@ -1,3 +1,9 @@
+0.10 2016-04-02
+ - Updates to run on RT 4.4 (tests)
+ - Fix bug where non-mandatory fields were displayed on update
+ - Add a new config option if you liked the previously mentioned bug
+ - Add French translation. Thanks to Emmanuel Lacour
+
 0.09_01 2015-01-29
  - Support for Basics and Jumbo (Modify.html and ModifyAll.html)
 
diff --git a/MANIFEST b/MANIFEST
index cc4254b..7057039 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -1,4 +1,5 @@
 Changes
+html/Callbacks/RT-Extension-MandatoryOnTransition/Elements/EditCustomFields/BeforeCustomFields
 html/Callbacks/RT-Extension-MandatoryOnTransition/m/ticket/create/BeforeCreate
 html/Callbacks/RT-Extension-MandatoryOnTransition/m/ticket/reply/AfterWorked
 html/Callbacks/RT-Extension-MandatoryOnTransition/m/ticket/reply/BeforeUpdate
@@ -21,7 +22,6 @@ inc/Module/Install/RTx/Runtime.pm
 inc/Module/Install/Substitute.pm
 inc/Module/Install/Win32.pm
 inc/Module/Install/WriteAll.pm
-inc/unicore/Name.pm
 inc/YAML/Tiny.pm
 lib/RT/Extension/MandatoryOnTransition.pm
 lib/RT/Extension/MandatoryOnTransition/Test.pm
@@ -30,6 +30,8 @@ Makefile.PL
 MANIFEST			This list of files
 MANIFEST.SKIP
 META.yml
+po/fr.po
+po/mandatoryontransition.pot
 README
 xt/basic.t
 xt/mandatory_on_create.t
diff --git a/META.yml b/META.yml
index eabfe63..b2c9e29 100644
--- a/META.yml
+++ b/META.yml
@@ -8,7 +8,7 @@ configure_requires:
   ExtUtils::MakeMaker: 6.59
 distribution_type: module
 dynamic_config: 1
-generated_by: 'Module::Install version 1.14'
+generated_by: 'Module::Install version 1.16'
 license: gplv2
 meta-spec:
   url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -18,6 +18,7 @@ no_index:
   directory:
     - html
     - inc
+    - po
     - xt
   package:
     - RT::Extension::MandatoryOnTransition::Test
@@ -25,6 +26,6 @@ requires:
   perl: 5.8.3
 resources:
   license: http://opensource.org/licenses/gpl-license.php
-version: 0.09_01
+version: '0.10'
 x_module_install_rtx_version: '0.37'
 x_requires_rt: 4.0.9
diff --git a/README b/README
index e6d3be7..67dba88 100644
--- a/README
+++ b/README
@@ -78,46 +78,54 @@ INSTALLATION
         or add RT::Extension::MandatoryOnTransition to your existing
         @Plugins line.
 
-        Then configure which fields should be mandatory on certain status
-        changes (either globally or in a specific queue) using the
-        %MandatoryOnTransition config option. This option takes the generic
-        form of:
-
-            Set( %MandatoryOnTransition,
-                'QueueName' => {
-                    'from -> to' => [ 'BasicField', 'CF.MyField', ],
-                },
-            );
-
-        from and to are expected to be valid status names. from may also be
-        * which will apply to any status and also tickets about to be
-        created with status to.
-
-        The fallback for queues without specific rules is specified with '*'
-        where the queue name would normally be.
-
-        Below is an example which requires 1) time worked and filling in a
-        custom field named Resolution before resolving tickets in the
-        Helpdesk queue and 2) a Category selection before resolving tickets
-        in every other queue.
-
-            Set( %MandatoryOnTransition,
-                Helpdesk => {
-                    '* -> resolved' => ['TimeWorked', 'CF.Resolution'],
-                },
-                '*' => {
-                    '* -> resolved' => 'CF.Category',
-                },
-            );
-
-        The transition syntax is similar to that found in RT's Lifecycles.
-        See perldoc /opt/rt4/etc/RT_Config.pm.
-
     Clear your mason cache
             rm -rf /opt/rt4/var/mason_data/obj
 
     Restart your webserver
 
+CONFIGURATION
+    To define which fields should be mandatory on certain status changes
+    (either globally or in a specific queue) use the %MandatoryOnTransition
+    config option. This option takes the generic form of:
+
+        Set( %MandatoryOnTransition,
+            'QueueName' => {
+                'from -> to' => [ 'BasicField', 'CF.MyField', ],
+            },
+        );
+
+    from and to are expected to be valid status names. from may also be *
+    which will apply to any status and also tickets about to be created with
+    status to.
+
+    The fallback for queues without specific rules is specified with '*'
+    where the queue name would normally be.
+
+    Below is an example which requires 1) time worked and filling in a
+    custom field named Resolution before resolving tickets in the Helpdesk
+    queue and 2) a Category selection before resolving tickets in every
+    other queue.
+
+        Set( %MandatoryOnTransition,
+            Helpdesk => {
+                '* -> resolved' => ['TimeWorked', 'CF.Resolution'],
+            },
+            '*' => {
+                '* -> resolved' => 'CF.Category',
+            },
+        );
+
+    The transition syntax is similar to that found in RT's Lifecycles. See
+    perldoc /opt/rt4/etc/RT_Config.pm.
+
+  $ShowAllCustomFieldsOnMandatoryUpdate
+    By default, this extension shows only the mandatory fields on the update
+    page to make it easy for users to fill them out when completing an
+    action. If you would like to show all custom fields rather than just the
+    mandatory ones, use this configuration option. You can set it like this:
+
+        Set($ShowAllCustomFieldsOnMandatoryUpdate, 1);
+
 IMPLEMENTATION DETAILS
     If you're just using this module on your own RT instance, you should
     stop reading now. You don't need to know about the implementation
diff --git a/lib/RT/Extension/MandatoryOnTransition.pm b/lib/RT/Extension/MandatoryOnTransition.pm
index cf76a48..3b2fdfd 100644
--- a/lib/RT/Extension/MandatoryOnTransition.pm
+++ b/lib/RT/Extension/MandatoryOnTransition.pm
@@ -2,12 +2,18 @@ use strict;
 use warnings;
 package RT::Extension::MandatoryOnTransition;
 
-our $VERSION = '0.09_01';
+our $VERSION = '0.10';
 
 =head1 NAME
 
 RT-Extension-MandatoryOnTransition - Require core fields and ticket custom fields on status transitions
 
+=head1 RT VERSION
+
+Works with RT 4.0, 4.2, .4.4
+
+See below for some restrictions on RT 4.0.
+
 =head1 DESCRIPTION
 
 This RT extension enforces that certain fields have values before tickets are

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


More information about the Bps-public-commit mailing list