[freeside-commits] freeside/FS/FS cust_pkg.pm, 1.73.2.12, 1.73.2.13 cust_pkg_reason.pm, 1.1, 1.1.2.1

Jeff Finucane,420,, jeff at wavetail.420.am
Wed Apr 16 11:32:36 PDT 2008


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

Modified Files:
      Tag: FREESIDE_1_7_BRANCH
	cust_pkg.pm cust_pkg_reason.pm 
Log Message:
show user who created (cancel/suspend) reason and possibly fix a lingering spurious usergroup bug

Index: cust_pkg.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_pkg.pm,v
retrieving revision 1.73.2.12
retrieving revision 1.73.2.13
diff -u -d -r1.73.2.12 -r1.73.2.13
--- cust_pkg.pm	29 Jan 2008 04:15:50 -0000	1.73.2.12
+++ cust_pkg.pm	16 Apr 2008 18:32:32 -0000	1.73.2.13
@@ -710,6 +710,22 @@
   $cust_bill_pkg ? $cust_bill_pkg->sdate : $self->setup || 0;
 }
 
+=item last_cust_pkg_reason
+
+Returns the most recent FS::reason associated with the package.
+
+=cut
+
+sub last_cust_pkg_reason {
+  my $self = shift;
+  qsearchs( {
+              'table' => 'cust_pkg_reason',
+              'hashref' => { 'pkgnum' => $self->pkgnum, },
+              'extra_sql'=> "AND date <= ". time,
+              'order_by' => 'ORDER BY date DESC LIMIT 1',
+           } );
+}
+
 =item last_reason
 
 Returns the most recent FS::reason associated with the package.
@@ -717,13 +733,8 @@
 =cut
 
 sub last_reason {
-  my $self = shift;
-  my $cust_pkg_reason = qsearchs( {
-                                    'table' => 'cust_pkg_reason',
-				    'hashref' => { 'pkgnum' => $self->pkgnum, },
-				    'extra_sql'=> 'ORDER BY date DESC LIMIT 1',
-				  } );
-  qsearchs ( 'reason', { 'reasonnum' => $cust_pkg_reason->reasonnum } )
+  my $cust_pkg_reason = shift->last_cust_pkg_reason;
+  $cust_pkg_reason->reason
     if $cust_pkg_reason;
 }
 

Index: cust_pkg_reason.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_pkg_reason.pm,v
retrieving revision 1.1
retrieving revision 1.1.2.1
diff -u -d -r1.1 -r1.1.2.1
--- cust_pkg_reason.pm	19 Oct 2006 14:29:27 -0000	1.1
+++ cust_pkg_reason.pm	16 Apr 2008 18:32:33 -0000	1.1.2.1
@@ -106,6 +106,29 @@
   $self->SUPER::check;
 }
 
+=item reason
+
+Returns the reason (see L<FS::reason>) associated with this cust_pkg_reason.
+
+=cut
+
+sub reason {
+  my $self = shift;
+  qsearchs( 'reason', { 'reasonnum' => $self->reasonnum } );
+}
+
+=item reasontext
+
+Returns the text of the reason (see L<FS::reason>) associated with this
+cust_pkg_reason.
+
+=cut
+
+sub reasontext {
+  my $reason = shift->reason;
+  $reason ? $reason->reason : '';
+}
+
 =back
 
 =head1 BUGS



More information about the freeside-commits mailing list