[Rt-commit] rt branch, 4.4/set-custom-field-to-now-scrip-action, repushed

Shawn Moore shawn at bestpractical.com
Mon Nov 21 12:29:18 EST 2016


The branch 4.4/set-custom-field-to-now-scrip-action was deleted and repushed:
       was 5041e3d94c74ae1296646cb2efad9c837c588781
       now c1d1029ffdb07a8f85ac0a71fb66c38df0248ade

1:  4001682 ! 1:  c1d1029 Add scrip action that sets a custom field value to the current date/time
    @@ -2,31 +2,14 @@
     
         Add scrip action that sets a custom field value to the current date/time
         
    -    Adds a scrip action that sets a custom field's value to the current date/time.
    -    The CustomField name is provided as the actions argument.
    +    The CustomField name is provided as the action's Argument.
         
         Fixes: T#166550
     
    -diff --git a/etc/initialdata b/etc/initialdata
    ---- a/etc/initialdata
    -+++ b/etc/initialdata
    -@@
    -       Description => 'Update User TimeWorked',       # loc
    -       ExecModule  => 'UpdateUserTimeWorked',
    -     },
    -+    { Name        => 'Set custom field to now', # loc
    -+      Description => 'Set the value of a custom field, provided as the action argument, to the current datetime.', # loc
    -+      ExecModule  => 'SetCFtoNow',
    -+      Argument    => 'MyCustomField',
    -+    },
    - );
    - 
    - @ScripConditions = (
    -
    -diff --git a/lib/RT/Action/SetCFtoNow.pm b/lib/RT/Action/SetCFtoNow.pm
    +diff --git a/lib/RT/Action/SetCustomFieldToNow.pm b/lib/RT/Action/SetCustomFieldToNow.pm
     new file mode 100644
     --- /dev/null
    -+++ b/lib/RT/Action/SetCFtoNow.pm
    ++++ b/lib/RT/Action/SetCustomFieldToNow.pm
     @@
     +# BEGIN BPS TAGGED BLOCK {{{
     +#
    @@ -76,16 +59,15 @@
     +#
     +# END BPS TAGGED BLOCK }}}
     +
    -+package RT::Action::SetCFtoNow;
    ++package RT::Action::SetCustomFieldToNow;
     +use base 'RT::Action';
     +
     +use strict;
     +use warnings;
     +
    -+#What does this type of Action do?
     +sub Describe  {
     +    my $self = shift;
    -+    return (ref $self . " will set the value of a custom field, provided as an argument, to the current datetime.");
    ++    return (ref $self . " will set the value of a custom field, provided as the Argument, to the current datetime.");
     +}
     +
     +
    @@ -97,13 +79,14 @@
     +#Note: This action might require the scrip to be in 'Batch' mode.
     +sub Commit {
     +    my $self = shift;
    -+    my $DateObj = RT::Date->new ($self->TicketObj->CurrentUser);
    ++    my $DateObj = RT::Date->new($self->TicketObj->CurrentUser);
     +    $DateObj->SetToNow;
     +    my $value = $DateObj->RFC2822;
     +    my ($ret, $msg) = $self->TicketObj->AddCustomFieldValue(Field => $self->Argument, Value => $value);
     +    unless ($ret) {
     +        RT->Logger->error($msg);
     +    }
    ++    return $ret;
     +}
     +
     +RT::Base->_ImportOverlays();



More information about the rt-commit mailing list