[Rt-commit] rt branch, 5.0/set-lifecycle-from-invalid-to-default, created. rt-5.0.0-69-g91f0e389e9

? sunnavy sunnavy at bestpractical.com
Fri Oct 30 17:21:19 EDT 2020


The branch, 5.0/set-lifecycle-from-invalid-to-default has been created
        at  91f0e389e973ec1ee83d8a2a7935d4429d18b380 (commit)

- Log -----------------------------------------------------------------
commit 91f0e389e973ec1ee83d8a2a7935d4429d18b380
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Sat Oct 31 04:49:19 2020 +0800

    Allow to set lifecycle from an invalid value to default on admin pages
    
    Previously RT::Record::Update compared new value with Lifecycle column
    and also LifecycleObj->Name to decide whether to update or not. As
    LifecycleObj->Name falls back to the default value if current one is
    invalid, RT::Record::Update would think values like "default" and
    "doesn't exist" are equal, which wrongly prevented valid updates.
    
    Since lifecycle name is already stored in queues/catalogs column, there
    is actually no need to check LifecycleObj->Name here anyway.

diff --git a/lib/RT/Record.pm b/lib/RT/Record.pm
index a4ed13fc44..39bce16b22 100644
--- a/lib/RT/Record.pm
+++ b/lib/RT/Record.pm
@@ -942,13 +942,16 @@ sub Update {
         # items. If it fails, we don't care
         do {
             no warnings "uninitialized";
-            local $@;
-            my $name = eval {
-                my $object = $attribute . "Obj";
-                $self->$object->Name;
-            };
-            unless ($@) {
-                next if $name eq $value || $name eq ($value || 0);
+
+            if ( $attribute ne 'Lifecycle' ) {
+                local $@;
+                my $name = eval {
+                    my $object = $attribute . "Obj";
+                    $self->$object->Name;
+                };
+                unless ($@) {
+                    next if $name eq $value || $name eq ( $value || 0 );
+                }
             }
 
             next if $truncated_value eq $self->$attribute();

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


More information about the rt-commit mailing list