[freeside-commits] freeside/rt/lib/RT Attribute_Overlay.pm, 1.1.1.8, 1.2 CustomField_Overlay.pm, 1.3, 1.4 Record.pm, 1.9, 1.10 Ticket_Overlay.pm, 1.17, 1.18 Transaction_Overlay.pm, 1.5, 1.6

Mark Wells mark at wavetail.420.am
Wed Feb 16 19:47:52 PST 2011


Update of /home/cvs/cvsroot/freeside/rt/lib/RT
In directory wavetail.420.am:/tmp/cvs-serv21777/lib/RT

Modified Files:
	Attribute_Overlay.pm CustomField_Overlay.pm Record.pm 
	Ticket_Overlay.pm Transaction_Overlay.pm 
Log Message:
TimeWorked-like custom fields, RT#11168

Index: CustomField_Overlay.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/rt/lib/RT/CustomField_Overlay.pm,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -w -d -r1.3 -r1.4
--- CustomField_Overlay.pm	17 Feb 2011 00:52:25 -0000	1.3
+++ CustomField_Overlay.pm	17 Feb 2011 03:47:50 -0000	1.4
@@ -102,6 +102,11 @@
         'Select date',			# loc
         'Select up to [_1] dates',	# loc
     ],
+    TimeValue => [
+        'Enter multiple time values (UNSUPPORTED)',
+        'Enter a time value',
+        'Enter [_1] time values (UNSUPPORTED)',
+    ],
 );
 
 
@@ -261,6 +266,10 @@
         $self->SetBasedOn( $args{'BasedOn'} );
     }
 
+    if ( exists $args{'UILocation'} ) {
+        $self->SetUILocation( $args{'UILocation'} );
+    }
+
     return ($rv, $msg) unless exists $args{'Queue'};
 
     # Compat code -- create a new ObjectCustomField mapping
@@ -835,7 +844,7 @@
 
 sub TypeComposites {
     my $self = shift;
-    return grep !/(?:[Tt]ext|Combobox|Date)-0/, map { ("$_-1", "$_-0") } $self->Types;
+    return grep !/(?:[Tt]ext|Combobox|Date|TimeValue)-0/, map { ("$_-1", "$_-0") } $self->Types;
 }
 
 =head2 SetLookupType
@@ -1447,4 +1456,21 @@
     return $obj;
 }
 
+sub UILocation {
+    my $self = shift;
+    my $tag = $self->FirstAttribute( 'UILocation' );
+    return $tag ? $tag->Content : '';
+}
+
+sub SetUILocation {
+    my $self = shift;
+    my $tag = shift;
+    if ( $tag ) {
+        return $self->SetAttribute( Name => 'UILocation', Content => $tag );
+    }
+    else {
+        return $self->DeleteAttribute('UILocation');
+    }
+}
+
 1;

Index: Attribute_Overlay.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/rt/lib/RT/Attribute_Overlay.pm,v
retrieving revision 1.1.1.8
retrieving revision 1.2
diff -u -w -d -r1.1.1.8 -r1.2
--- Attribute_Overlay.pm	17 Feb 2011 00:19:14 -0000	1.1.1.8
+++ Attribute_Overlay.pm	17 Feb 2011 03:47:50 -0000	1.2
@@ -309,12 +309,9 @@
 sub DeleteSubValue {
     my $self = shift;
     my $key = shift;
-    my %values = $self->Content();
-    delete $values{$key};
-    $self->SetContent(%values);
-
-    
-
+    my $values = $self->Content();
+    delete $values->{$key};
+    $self->SetContent($values);
 }
 
 

Index: Ticket_Overlay.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/rt/lib/RT/Ticket_Overlay.pm,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -w -d -r1.17 -r1.18
--- Ticket_Overlay.pm	17 Feb 2011 00:52:25 -0000	1.17
+++ Ticket_Overlay.pm	17 Feb 2011 03:47:50 -0000	1.18
@@ -734,7 +734,8 @@
 
         if ( $self->Id && $Trans ) {
 
-            $TransObj->UpdateCustomFields(ARGSRef => \%args);
+          #$TransObj->UpdateCustomFields(ARGSRef => \%args);
+            $TransObj->UpdateCustomFields(%args);
 
             $RT::Logger->info( "Ticket " . $self->Id . " created in queue '" . $QueueObj->Name . "' by " . $self->CurrentUser->Name );
             $ErrStr = $self->loc( "Ticket [_1] created in queue '[_2]'", $self->Id, $QueueObj->Name );
@@ -2222,6 +2223,7 @@
         NoteType     => 'Correspond',
         TimeTaken    => 0,
         CommitScrips => 1,
+        CustomFields => {},
         @_
     );
 
@@ -2278,6 +2280,7 @@
              TimeTaken => $args{'TimeTaken'},
              MIMEObj   => $args{'MIMEObj'}, 
              CommitScrips => $args{'CommitScrips'},
+             CustomFields => $args{'CustomFields'},
     );
 
     unless ($Trans) {

Index: Transaction_Overlay.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/rt/lib/RT/Transaction_Overlay.pm,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -w -d -r1.5 -r1.6
--- Transaction_Overlay.pm	17 Feb 2011 00:52:25 -0000	1.5
+++ Transaction_Overlay.pm	17 Feb 2011 03:47:50 -0000	1.6
@@ -116,6 +116,7 @@
 	ReferenceType => undef,
         OldReference       => undef,
         NewReference       => undef,
+        CustomFields   => {},
         @_
     );
 
@@ -158,6 +159,10 @@
         }
     }
 
+    # Set up any custom fields passed at creation.  Has to happen 
+    # before scrips.
+    
+    $self->UpdateCustomFields(%{ $args{'CustomFields'} });
 
     #Provide a way to turn off scrips if we need to
         $RT::Logger->debug('About to think about scrips for transaction #' .$self->Id);

Index: Record.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/rt/lib/RT/Record.pm,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -w -d -r1.9 -r1.10
--- Record.pm	17 Feb 2011 00:52:25 -0000	1.9
+++ Record.pm	17 Feb 2011 03:47:50 -0000	1.10
@@ -1467,6 +1467,7 @@
         MIMEObj   => undef,
         ActivateScrips => 1,
         CommitScrips => 1,
+        CustomFields => {},
         @_
     );
 
@@ -1500,6 +1501,7 @@
         MIMEObj   => $args{'MIMEObj'},
         ActivateScrips => $args{'ActivateScrips'},
         CommitScrips => $args{'CommitScrips'},
+        CustomFields => $args{'CustomFields'},
     );
 
     # Rationalize the object since we may have done things to it during the caching.



More information about the freeside-commits mailing list