[Bps-public-commit] RT-Extension-MandatoryOnTransition branch, must-and-must-not-be, updated. 0.09_01-20-g5861a66

Jim Brandt jbrandt at bestpractical.com
Thu Jun 23 11:59:42 EDT 2016


The branch, must-and-must-not-be has been updated
       via  5861a66f9606b6aa09c9447a9665bac58025d3ca (commit)
      from  ff535764efd0e3c58e828168320a218b64ae8b4b (commit)

Summary of changes:
 lib/RT/Extension/MandatoryOnTransition.pm | 30 ++++++++++++++++++++----------
 1 file changed, 20 insertions(+), 10 deletions(-)

- Log -----------------------------------------------------------------
commit 5861a66f9606b6aa09c9447a9665bac58025d3ca
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Thu Jun 23 11:59:45 2016 -0400

    Update error messages for proper localization

diff --git a/lib/RT/Extension/MandatoryOnTransition.pm b/lib/RT/Extension/MandatoryOnTransition.pm
index 3600661..2f7b6d6 100644
--- a/lib/RT/Extension/MandatoryOnTransition.pm
+++ b/lib/RT/Extension/MandatoryOnTransition.pm
@@ -459,11 +459,16 @@ sub CheckMandatoryFields {
                 # OK if it's defined and is one of the specified values
                 next if defined $cf_value and grep { $cf_value eq $_ } @must_be;
                 my $valid_values = join ", ", @must_be;
-                my $one_of = '';
-                $one_of = " one of:" if @must_be > 1;
-                push @errors,
-                  $CurrentUser->loc("[_1] must be$one_of [_3] when changing Status to [_2]",
-                                    $cf->Name, $CurrentUser->loc($ARGSRef->{Status}), $valid_values);
+                if ( @must_be > 1 ){
+                    push @errors,
+                        $CurrentUser->loc("[_1] must be one of: [_3] when changing Status to [_2]",
+                        $cf->Name, $CurrentUser->loc($ARGSRef->{Status}), $valid_values);
+                }
+                else{
+                    push @errors,
+                        $CurrentUser->loc("[_1] must be [_3] when changing Status to [_2]",
+                        $cf->Name, $CurrentUser->loc($ARGSRef->{Status}), $valid_values);
+                }
                 next;
             }
 
@@ -473,11 +478,16 @@ sub CheckMandatoryFields {
                 # OK if it's defined and _not_ in the list
                 next if defined $cf_value and !grep { $cf_value eq $_ } @must_not_be;
                 my $valid_values = join ", ", @must_not_be;
-                my $one_of = '';
-                $one_of = " one of:" if @must_not_be > 1;
-                push @errors,
-                  $CurrentUser->loc("[_1] must not be$one_of [_3] when changing Status to [_2]",
-                                    $cf->Name, $CurrentUser->loc($ARGSRef->{Status}), $valid_values);
+                if ( @must_not_be > 1 ){
+                    push @errors,
+                        $CurrentUser->loc("[_1] must not be one of: [_3] when changing Status to [_2]",
+                        $cf->Name, $CurrentUser->loc($ARGSRef->{Status}), $valid_values);
+                }
+                else{
+                    push @errors,
+                        $CurrentUser->loc("[_1] must not be [_3] when changing Status to [_2]",
+                        $cf->Name, $CurrentUser->loc($ARGSRef->{Status}), $valid_values);
+                }
                 next;
             }
         }

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


More information about the Bps-public-commit mailing list