From b06c6c8f6b6ae1193ac23ea30e24704aa913152c Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 19 Dec 2009 20:29:48 +0000 Subject: [PATCH] fix event report w/ a customer status --- FS/FS/cust_main_Mixin.pm | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/FS/FS/cust_main_Mixin.pm b/FS/FS/cust_main_Mixin.pm index 5a29a4c22..3dde95f2e 100644 --- a/FS/FS/cust_main_Mixin.pm +++ b/FS/FS/cust_main_Mixin.pm @@ -2,6 +2,7 @@ package FS::cust_main_Mixin; use strict; use vars qw( $DEBUG $me ); +use Carp qw( confess ); use FS::UID qw(dbh); use FS::cust_main; @@ -255,21 +256,22 @@ sub cust_statuscolor { =item cancelled_sql -Given an object that contains fields from cust_main (say, from a JOINed -search; see httemplate/search/ for examples), returns the equivalent of the -corresponding FS::cust_main method, or "0" if this object is not linked to -a customer. +Class methods that return SQL framents, equivalent to the corresponding +FS::cust_main method. =cut +# my \$self = shift; +# \$self->cust_linked +# ? FS::cust_main::${sub}_sql(\$self) +# : '0'; + foreach my $sub (qw( prospect active inactive suspended cancelled )) { eval " sub ${sub}_sql { - my \$self = shift; - \$self->cust_linked - ? FS::cust_main::${sub}_sql(\$self) - : '0'; - } + confess 'cust_main_Mixin ${sub}_sql called with object' if ref(\$_[0]); + 'cust_main.custnum IS NOT NULL AND '. FS::cust_main->${sub}_sql(); + } "; die $@ if $@; } -- 2.11.0