[freeside-commits] freeside/FS/FS/TicketSystem RT_Internal.pm, 1.18, 1.19
Erik Levinson
levinse at wavetail.420.am
Thu Dec 16 17:16:02 PST 2010
Update of /home/cvs/cvsroot/freeside/FS/FS/TicketSystem
In directory wavetail.420.am:/tmp/cvs-serv3002/FS/FS/TicketSystem
Modified Files:
RT_Internal.pm
Log Message:
self-service improvements, RT10883
Index: RT_Internal.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/TicketSystem/RT_Internal.pm,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -w -d -r1.18 -r1.19
--- RT_Internal.pm 24 Nov 2010 01:31:18 -0000 1.18
+++ RT_Internal.pm 17 Dec 2010 01:16:00 -0000 1.19
@@ -215,6 +215,91 @@
$Ticket;
}
+=item get_ticket SESSION_HASHREF, OPTION => VALUE ...
+
+Class method. Retrieves a ticket. If there is an error, returns the scalar
+error. Otherwise, currently returns a slightly tricky data structure containing
+a list of the linked customers and each transaction's content, description, and
+create time.
+
+Accepts the following options:
+
+=over 4
+
+=item ticket_id
+
+The ticket id
+
+=back
+
+=cut
+
+sub get_ticket {
+ my($self, $session, %param) = @_;
+
+ $session = $self->session($session);
+
+ my $Ticket = RT::Ticket->new($session->{'CurrentUser'});
+ my $ticketid = $Ticket->Load( $param{'ticket_id'} );
+ return 'Could not load ticket' unless $ticketid;
+
+ my @custs = ();
+ foreach my $link ( @{ $Ticket->Customers->ItemsArrayRef } ) {
+ my $cust = $link->Target;
+ push @custs, $1 if $cust =~ /\/(\d+)$/;
+ }
+
+ my @txns = ();
+ my $transactions = $Ticket->Transactions;
+ while ( my $transaction = $transactions->Next ) {
+ my $t = { created => $transaction->Created,
+ content => $transaction->Content,
+ description => $transaction->Description,
+ };
+ push @txns, $t;
+ }
+
+ { txns => [ @txns ],
+ custs => [ @custs ],
+ };
+}
+
+
+=item correspond_ticket SESSION_HASHREF, OPTION => VALUE ...
+
+Class method. Correspond on a ticket. If there is an error, returns the scalar
+error. Otherwise, returns the transaction id, error message, and
+RT::Transaction object.
+
+Accepts the following options:
+
+=over 4
+
+=item ticket_id
+
+The ticket id
+
+=item content
+
+Correspondence content
+
+=back
+
+=cut
+
+sub correspond_ticket {
+ my($self, $session, %param) = @_;
+
+ $session = $self->session($session);
+
+ my $Ticket = RT::Ticket->new($session->{'CurrentUser'});
+ my $ticketid = $Ticket->Load( $param{'ticket_id'} );
+ return 'Could not load ticket' unless $ticketid;
+ return 'No content' unless $param{'content'};
+
+ $Ticket->Correspond( Content => $param{'content'} );
+}
+
#shameless false laziness w/RT::Interface::Web::AttemptExternalAuth
# to get logged into RT from afar
sub _web_external_auth {
More information about the freeside-commits
mailing list