[freeside-commits] freeside/FS/FS cust_main_Mixin.pm,1.7,1.8

Ivan,,, ivan at wavetail.420.am
Sat Dec 19 12:29:50 PST 2009


Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv32073

Modified Files:
	cust_main_Mixin.pm 
Log Message:
fix event report w/ a customer status

Index: cust_main_Mixin.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_main_Mixin.pm,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- cust_main_Mixin.pm	30 Oct 2009 23:29:18 -0000	1.7
+++ cust_main_Mixin.pm	19 Dec 2009 20:29:48 -0000	1.8
@@ -2,6 +2,7 @@
 
 use strict;
 use vars qw( $DEBUG $me );
+use Carp qw( confess );
 use FS::UID qw(dbh);
 use FS::cust_main;
 
@@ -255,21 +256,22 @@
 
 =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 $@;
 }



More information about the freeside-commits mailing list