From 2f0584c5150a5b95556756f9731d70b2a4d37bab Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 20 Jan 2009 20:08:37 +0000 Subject: [PATCH] whew, hopefully that will actually fix agent-specific invoices migrated from 1.7->1.9, RT#4645 --- FS/FS/cust_main.pm | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm index 7544b80e0..77e08fe1c 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -7057,9 +7057,13 @@ sub _agent_plandata { AND peo_agentnum.optionname = 'agentnum' AND peo_agentnum.optionvalue }. $regexp. q{ '(^|,)}. $agentnum. q{(,|$)' ) - LEFT JOIN part_event_option AS peo_cust_bill_age - ON ( part_event.eventpart = peo_cust_bill_age.eventpart - AND peo_cust_bill_age.optionname = 'cust_bill_age' + LEFT JOIN part_event_condition + ON ( part_event.eventpart = part_event_condition.eventpart + AND part_event_condition.conditionname = 'cust_bill_age' + ) + LEFT JOIN part_event_condition_option + ON ( part_event_condition.eventconditionnum = part_event_condition_option.eventconditionnum + AND part_event_condition_option.optionname = 'age' ) }, #'hashref' => { 'optionname' => $option }, @@ -7073,7 +7077,7 @@ sub _agent_plandata { " ORDER BY CASE WHEN peo_cust_bill_age.optionname != 'cust_bill_age' THEN -1 - ELSE ". FS::part_event::Condition->age2seconds_sql('peo_cust_bill_age.optionvalue'). + ELSE ". FS::part_event::Condition->age2seconds_sql('part_event_condition_option.optionvalue'). " END , part_event.weight". " LIMIT 1" -- 2.11.0