
sartak at bestpractical
Nov 9, 2009, 3:25 PM
Post #1 of 1
(166 views)
Permalink
|
|
rt branch, create-action, updated. cf4ad660d5db5b152eccaf2d9ab650e76af7ff66
|
|
The branch, create-action has been updated via cf4ad660d5db5b152eccaf2d9ab650e76af7ff66 (commit) via 509fe87070b99e86b8389bf9cd434f18e7b68a02 (commit) from 19568579859bda4738fcad34a0d98a8ca8b1be2a (commit) Summary of changes: lib/RT/Interface/Web.pm | 4 ++-- lib/RT/Model/Ticket.pm | 2 +- lib/RT/Model/Transaction.pm | 10 ++-------- t/api/cf_transaction.t | 11 ++--------- 4 files changed, 7 insertions(+), 20 deletions(-) - Log ----------------------------------------------------------------- commit 509fe87070b99e86b8389bf9cd434f18e7b68a02 Author: Shawn M Moore <sartak [at] bestpractical> Date: Mon Nov 9 18:14:59 2009 -0500 Take the new-style cf_ID in txn's update_custom_fields diff --git a/lib/RT/Model/Transaction.pm b/lib/RT/Model/Transaction.pm index 9372e6e..7c5382d 100755 --- a/lib/RT/Model/Transaction.pm +++ b/lib/RT/Model/Transaction.pm @@ -1144,11 +1144,7 @@ sub friendly_object_type { Takes a hash of - CustomField-<<Id>> => Value - -or - - object-RT::Model::Transaction-CustomField-<<Id>> => Value + cf_<<Id>> => Value parameters to update this transaction's custom fields @@ -1159,9 +1155,7 @@ sub update_custom_fields { my %args = (@_); foreach my $arg ( keys %args ) { - next - unless ( $arg =~ /^(?:object-RT::Model::Transaction--)?CustomField-(\d+)/ ); - next if $arg =~ /-magic$/; + next unless $arg =~ /^cf_(\d+)$/; my $cfid = $1; my $values = $args{$arg}; foreach my $value ( UNIVERSAL::isa( $values, 'ARRAY' ) ? @$values : $values ) { commit cf4ad660d5db5b152eccaf2d9ab650e76af7ff66 Author: Shawn M Moore <sartak [at] bestpractical> Date: Mon Nov 9 18:24:50 2009 -0500 Stop using args_ref internally diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm index f3bfcd3..da9e690 100755 --- a/lib/RT/Interface/Web.pm +++ b/lib/RT/Interface/Web.pm @@ -518,11 +518,11 @@ sub process_update_message { if ( $args{args_ref}->{'update_type'} =~ /^(private|public)$/ ) { my ( $Transaction, $description, $object ) = $args{ticket_obj}->comment(%message_args); push( @results, $description ); - $object->update_custom_fields( args_ref => $args{args_ref} ) if $object; + $object->update_custom_fields( %{ $args{args_ref} } ) if $object; } elsif ( $args{args_ref}->{'update_type'} eq 'response' ) { my ( $Transaction, $description, $object ) = $args{ticket_obj}->correspond(%message_args); push( @results, $description ); - $object->update_custom_fields( args_ref => $args{args_ref} ) if $object; + $object->update_custom_fields( %{ $args{args_ref} } ) if $object; } else { push( @results, _("Update type was neither correspondence nor comment.") . " " . _("Update not recorded.") ); } diff --git a/lib/RT/Model/Ticket.pm b/lib/RT/Model/Ticket.pm index f04cbf0..c3f88b2 100755 --- a/lib/RT/Model/Ticket.pm +++ b/lib/RT/Model/Ticket.pm @@ -822,7 +822,7 @@ sub create { ); if ( $self->id && $Trans ) { - $TransObj->update_custom_fields( args_ref => \%args ); + $TransObj->update_custom_fields(%args); Jifty->log->info( "Ticket " . $self->id . " created in queue '" . $queue_obj->name . "' by " . $self->current_user->name ); $ErrStr = _( "Ticket %1 created in queue '%2'", $self->id, $queue_obj->name ); diff --git a/t/api/cf_transaction.t b/t/api/cf_transaction.t index f2ba336..7bff069 100644 --- a/t/api/cf_transaction.t +++ b/t/api/cf_transaction.t @@ -5,7 +5,7 @@ use strict; use Data::Dumper; use RT::Test strict => 1; use Test::More; -plan tests => 14; +plan tests => 13; use_ok('RT'); use_ok('RT::Model::TransactionCollection'); @@ -46,17 +46,10 @@ is ($txn_cf->id, $cf->id, "It's the right custom field"); my $values = $trans->custom_field_values($txn_cf->id); is ($values->count, 0, "It has no values"); -# Old API my %cf_updates = ( 'CustomField-'.$cf->id => 'Testing'); -$trans->update_custom_fields( args_ref => \%cf_updates); +$trans->update_custom_fields(%cf_updates); $values = $trans->custom_field_values($txn_cf->id); is ($values->count, 1, "It has one value"); -# New API - -$trans->update_custom_fields( 'CustomField-'.$cf->id => 'Test two'); - $values = $trans->custom_field_values($txn_cf->id); -is ($values->count, 2, "it has two values"); - # TODO ok(0, "Should updating custom field values remove old values?"); ----------------------------------------------------------------------- _______________________________________________ Rt-commit mailing list Rt-commit [at] lists http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-commit
|