Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

REST 1.0 - Add fetching and setting of transaction CustomFields #368

Open
wants to merge 6 commits into
base: 5.0-trunk
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Provide a helper to create a Transaction CustomField
Allow tests to easily create or reuse transaction custom fields on
a queue.
Andrew Ruthven authored and puck committed Oct 14, 2023
commit f855875717de0505665e06edde61da0577ada08d
27 changes: 27 additions & 0 deletions lib/RT/Test.pm
Original file line number Diff line number Diff line change
@@ -1000,6 +1000,33 @@ sub load_or_create_custom_field {
return $obj;
}

=head2 load_or_create_txn_custom_field

=cut

sub load_or_create_txn_custom_field {
my $self = shift;
my %args = ( Disabled => 0, @_ );
my $obj = RT::CustomField->new( RT->SystemUser );
if ( $args{'Name'} ) {
$obj->LoadByName(
Name => $args{'Name'},
LookupType => RT::Transaction->CustomFieldLookupType,
ObjectId => $args{'Queue'}->id,
);
} else {
die "Name is required";
}
unless ( $obj->id ) {
$args{'LookupType'} = 'RT::Queue-RT::Ticket-RT::Transaction';
my $queue = delete $args{'Queue'};
my ($val, $msg) = $obj->Create( %args );
$obj->AddToObject($queue);
}

return $obj;
}

sub last_ticket {
my $self = shift;
my $current = shift;