[Rt-commit] rt branch, 4.4/record-transaction-cfs, created. rt-4.4.1-320-gb7acef8
Jim Brandt
jbrandt at bestpractical.com
Tue Mar 14 17:02:54 EDT 2017
The branch, 4.4/record-transaction-cfs has been created
at b7acef87f9e0dd7fe36be6730dda547c2164a662 (commit)
- Log -----------------------------------------------------------------
commit bd8e1e28bb62c499fd76d1def56f2ca65152d70b
Author: Jim Brandt <jbrandt at bestpractical.com>
Date: Tue Mar 14 16:55:32 2017 -0400
Abstract handle of transaction cf updates on TimeWorked updates
The previous implementation processed any transaction cf updates
in the same transaction as the TimeWorked update. This was added
primarily to support work in the TimeTracking extension. However,
there are use cases where you may want to record transaction cf
updates independent of a TimeWorked update.
Provide a subroutine stub and pass the transaction object so
you can record transaction cf updates against it, but don't make
it the default behavior for all transaction cfs.
diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index 53401fe..e2ea4cb 100644
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -2963,7 +2963,7 @@ sub ProcessTicketBasics {
if ( defined($ARGSRef->{'TimeWorked'}) && ($ARGSRef->{'TimeWorked'} || 0) != $TicketObj->TimeWorked ) {
my ( $val, $msg, $txn ) = $TicketObj->SetTimeWorked( $ARGSRef->{'TimeWorked'} );
push( @results, $msg );
- $txn->UpdateCustomFields( %$ARGSRef) if $txn;
+ TxnAfterUpdateTimeWorked(TransactionObj => $txn, ARGSRef => $ARGSRef);
}
# We special case owner changing, so we can use ForceOwnerChange
@@ -2987,6 +2987,11 @@ sub ProcessTicketBasics {
return (@results);
}
+# This subroutine is a stub to allow you to attach transaction custom field updates
+# to the transaction associated with the time worked update.
+sub TxnAfterUpdateTimeWorked {
+}
+
sub ProcessTicketReminders {
my %args = (
TicketObj => undef,
commit b7acef87f9e0dd7fe36be6730dda547c2164a662
Author: Jim Brandt <jbrandt at bestpractical.com>
Date: Tue Mar 14 16:59:32 2017 -0400
Record transaction CF updates even when no update message is provided
Provide a way for transaction CFs to be recorded even when an
update mesage is not provided and TimeWorked isn't updated.
Transaction CFs submitted without other associated transactions
will create a new transaction to record the transaction CF values.
diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index e2ea4cb..6ed3b48 100644
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -2344,6 +2344,7 @@ sub ProcessUpdateMessage {
if ( not @attachments
and not length $args{ARGSRef}->{'UpdateContent'} )
{
+ $args{'ARGSRef'}->{'NoContentUpdate'} = 1;
if ( $args{ARGSRef}->{'UpdateTimeWorked'} ) {
$args{ARGSRef}->{TimeWorked} = $args{TicketObj}->TimeWorked + delete $args{ARGSRef}->{'UpdateTimeWorked'};
}
@@ -3128,9 +3129,22 @@ sub _ValidateConsistentCustomFieldValues {
sub ProcessObjectCustomFieldUpdates {
my %args = @_;
+ my $TicketObj = $args{'TicketObj'};
my $ARGSRef = $args{'ARGSRef'};
my @results;
+ # This processes transaction cfs with no update content.
+ # Updates with a message are handled in ProcessUpdateMessage
+
+ if ( $TicketObj
+ and $ARGSRef->{'NoContentUpdate'}
+ and grep {/^(?:Object-RT::Transaction--)?CustomField-(\d+)/} keys %$ARGSRef ){
+ my ( $ret, $msg, $TransactionObj ) = $TicketObj->_NewTransaction(
+ Type => 'TransCustomField',
+ );
+ $TransactionObj->UpdateCustomFields( %$ARGSRef) if $TransactionObj;
+ }
+
# Build up a list of objects that we want to work with
my %custom_fields_to_mod = _ParseObjectCustomFieldArgs($ARGSRef);
diff --git a/lib/RT/Transaction.pm b/lib/RT/Transaction.pm
index 9e4bbea..3729907 100644
--- a/lib/RT/Transaction.pm
+++ b/lib/RT/Transaction.pm
@@ -990,6 +990,10 @@ sub _CanonicalizeRoleName {
my $self = shift;
return ("Comments added"); #loc()
},
+ TransCustomField => sub {
+ my $self = shift;
+ return ("Transaction custom field set"); #loc()
+ },
CustomField => sub {
my $self = shift;
my $field = $self->loc('CustomField');
-----------------------------------------------------------------------
More information about the rt-commit
mailing list