[Bps-public-commit] rt-extension-rest2 branch, transaction-cfs, updated. 1.07-5-gcf8a9eb
? sunnavy
sunnavy at bestpractical.com
Fri Aug 9 15:24:38 EDT 2019
The branch, transaction-cfs has been updated
via cf8a9eb55e7a0d5b784b933b48852c6afa448ef0 (commit)
via 4e81bdafa96d090858eba0e5f2a15f043759c302 (commit)
from 52ef66d789ed1ddbd925464d63a954f2ef72cc87 (commit)
Summary of changes:
lib/RT/Extension/REST2/Resource/Message.pm | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
- Log -----------------------------------------------------------------
commit 4e81bdafa96d090858eba0e5f2a15f043759c302
Author: sunnavy <sunnavy at bestpractical.com>
Date: Sat Aug 10 02:57:46 2019 +0800
No need to pass EmptyTxn to get custom field input names
Passing an empty object is equivalent to not passing it at all.
diff --git a/lib/RT/Extension/REST2/Resource/Message.pm b/lib/RT/Extension/REST2/Resource/Message.pm
index a35cd51..e7b18dd 100644
--- a/lib/RT/Extension/REST2/Resource/Message.pm
+++ b/lib/RT/Extension/REST2/Resource/Message.pm
@@ -113,11 +113,6 @@ sub _update_txn_custom_fields {
# ie the keys are the "full names" of the custom fields
my %txn_custom_fields;
- # Create an empty Transaction object to pass to GetCustomFieldInputName
- # UpdateCustomFields expects ARGS where the Txn input name doesn't have
- # an Id yet. It uses $self to determine which Txn to operate on.
- my $EmptyTxn = RT::Transaction->new( RT->SystemUser );
-
foreach my $cf_name ( keys %{$TxnCustomFields} ) {
my $cf_obj = $TransObj->LoadCustomFieldByIdentifier($cf_name);
@@ -127,7 +122,6 @@ sub _update_txn_custom_fields {
}
my $txn_input_name = RT::Interface::Web::GetCustomFieldInputName(
- Object => $EmptyTxn,
CustomField => $cf_obj,
Grouping => undef
);
commit cf8a9eb55e7a0d5b784b933b48852c6afa448ef0
Author: sunnavy <sunnavy at bestpractical.com>
Date: Sat Aug 10 03:10:23 2019 +0800
Always call txn->UpdateCustomFields for txn cfs with default values
As "AddCustomFieldDefaultValues" is called inside UpdateCustomFields.
diff --git a/lib/RT/Extension/REST2/Resource/Message.pm b/lib/RT/Extension/REST2/Resource/Message.pm
index e7b18dd..dd966ca 100644
--- a/lib/RT/Extension/REST2/Resource/Message.pm
+++ b/lib/RT/Extension/REST2/Resource/Message.pm
@@ -129,11 +129,11 @@ sub _update_txn_custom_fields {
$txn_custom_fields{$txn_input_name} = $TxnCustomFields->{$cf_name};
}
- if ( keys %$TxnCustomFields ) {
- # UpdateCustomFields currently doesn't return messages on updates
- # Stub it out for now.
- my @return = $TransObj->UpdateCustomFields( %txn_custom_fields );
+ # UpdateCustomFields currently doesn't return messages on updates
+ # Stub it out for now.
+ my @return = $TransObj->UpdateCustomFields( %txn_custom_fields );
+ if ( keys %txn_custom_fields ) {
# Simulate return messages until we get real results
if ( @return && $return[0] == 1 ) {
push @results, 'Custom fields updated';
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list