[freeside-commits] freeside/FS/FS/TicketSystem RT_External.pm, 1.36, 1.37
Jason Hall
jayce at wavetail.420.am
Mon Jan 25 20:47:05 PST 2010
Update of /home/cvs/cvsroot/freeside/FS/FS/TicketSystem
In directory wavetail.420.am:/tmp/cvs-serv24585/TicketSystem
Modified Files:
RT_External.pm
Log Message:
First version of RT Billing pkg. Basic concept is if a customer has this package, then any time added to ticket comments in RT will be added up and multiplied by the base rate, with each entry showing up as a lineitem on their next invoice.
This has not been used in production yet by anybody, it was just a proposal done for a customer.
Modified Files:
TicketSystem/RT_External.pm
Added Files:
part_pkg/rt_time.pm
Index: RT_External.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/TicketSystem/RT_External.pm,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- RT_External.pm 23 Sep 2009 23:47:25 -0000 1.36
+++ RT_External.pm 26 Jan 2010 04:47:03 -0000 1.37
@@ -9,6 +9,7 @@
use FS::UID qw(dbh);
use FS::Record qw(qsearchs);
use FS::cust_main;
+use Carp qw(cluck);
$me = '[FS::TicketSystem::RT_External]';
$DEBUG = 0;
@@ -96,6 +97,31 @@
}
+sub comments_on_tickets {
+ my ($self, $custnum, $limit, $time ) = @_;
+ $limit ||= 0;
+
+ my( $from_sql, @param) = $self->_from_customer( $custnum );
+ my $sql = qq{
+ SELECT transactions.*, Attachments.content, Tickets.subject
+ FROM transactions
+ JOIN Attachments ON( Attachments.transactionid = transactions.id )
+ JOIN Tickets ON ( Tickets.id = transactions.objectid )
+ JOIN Links ON ( Tickets.id = Links.LocalBase
+ AND Links.Base LIKE '%/ticket/' || Tickets.id )
+
+
+ WHERE ( Status = 'new' OR Status = 'open' OR Status = 'stalled' )
+ AND Target = 'freeside://freeside/cust_main/$custnum'
+ AND transactions.type = 'Comment'
+ AND transactions.created >= (SELECT TIMESTAMP WITH TIME ZONE 'epoch' + $time * INTERVAL '1 second')
+ LIMIT $limit
+ };
+ cluck $sql if $DEBUG > 0;
+ #AND created >
+ $dbh->selectall_arrayref( $sql, { Slice => {} } ) or die $dbh->errstr . " $sql";
+}
+
sub _from_customer {
my( $self, $custnum, $priority ) = @_;
More information about the freeside-commits
mailing list