From: ivan Date: Thu, 4 Oct 2007 04:08:05 +0000 (+0000) Subject: whew, i think this might actually fix it X-Git-Tag: TRIXBOX_2_6~306 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=fa50dcaf8b9f1bdfd8ff717b0acc8cb72937c8aa whew, i think this might actually fix it --- diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm index 4238b9889..064190a33 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -5803,23 +5803,25 @@ sub _agent_plandata { ) }, #'hashref' => { 'optionname' => $option }, - 'hashref' => { 'part_event_option.optionname' => $option }, - 'extra_sql' => " AND event = 'cust_bill_send_agent' ". - " AND disabled != 'Y' ". - " AND peo_agentnum.optionname = 'agentnum' ". - " AND agentnum IS NULL OR agentnum = $agentnum ". - " ORDER BY - CASE WHEN peo_cust_bill_age.optionname != 'cust_bill_age' - THEN -1 - ELSE EXTRACT( EPOCH FROM - REPLACE( peo_cust_bill_age.optionvalue, - 'm', - 'mon' - )::interval - ) - END - , part_event.weight". - " LIMIT 1" + #'hashref' => { 'part_event_option.optionname' => $option }, + 'extra_sql' => + " WHERE part_event_option.optionname = ". dbh->quote($option). + " AND action = 'cust_bill_send_agent' " + " AND ( disabled IS NULL OR disabled != 'Y' ) ". + " AND peo_agentnum.optionname = 'agentnum' ". + " AND agentnum IS NULL OR agentnum = $agentnum ". + " ORDER BY + CASE WHEN peo_cust_bill_age.optionname != 'cust_bill_age' + THEN -1 + ELSE EXTRACT( EPOCH FROM + REPLACE( peo_cust_bill_age.optionvalue, + 'm', + 'mon' + )::interval + ) + END + , part_event.weight". + " LIMIT 1" }); unless ( $part_event_option ) {