[Rt-commit] r5683 - in rt/branches/3.7-EXPERIMENTAL: .

ruz at bestpractical.com ruz at bestpractical.com
Wed Aug 2 15:47:06 EDT 2006


Author: ruz
Date: Wed Aug  2 15:47:06 2006
New Revision: 5683

Modified:
   rt/branches/3.7-EXPERIMENTAL/   (props changed)
   rt/branches/3.7-EXPERIMENTAL/lib/RT/CustomFieldValue_Overlay.pm

Log:
 r3576 at cubic-pc:  cubic | 2006-08-02 01:28:13 +0400
 CustomFieldValue::SetCategory
 * unset category (delete attribute) when value is undefined
   or empty string.


Modified: rt/branches/3.7-EXPERIMENTAL/lib/RT/CustomFieldValue_Overlay.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/lib/RT/CustomFieldValue_Overlay.pm	(original)
+++ rt/branches/3.7-EXPERIMENTAL/lib/RT/CustomFieldValue_Overlay.pm	Wed Aug  2 15:47:06 2006
@@ -45,7 +45,17 @@
 sub SetCategory {
     my $self = shift;
     my $category = shift;
-    $self->SetAttribute(Name => 'Category', Content => $category);
+    if ( defined $category && length $category ) {
+        return $self->SetAttribute(
+            Name    => 'Category',
+            Content => $category,
+        );
+    }
+    else {
+        $self->DeleteAttribute( Name => 'Category' );
+        # return true even if there was no category
+        return (1, $self->loc('Category unset'));
+    }
 }
 
 sub ValidateName { 1 };


More information about the Rt-commit mailing list