[freeside-commits] freeside/FS/FS cust_pkg.pm, 1.90, 1.91 cust_pkg_reason.pm, 1.1, 1.2
Jeff Finucane,420,,
jeff at wavetail.420.am
Wed Apr 16 11:33:00 PDT 2008
Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv12547/FS/FS
Modified Files:
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.90
retrieving revision 1.91
diff -u -d -r1.90 -r1.91
--- cust_pkg.pm 15 Apr 2008 13:41:01 -0000 1.90
+++ cust_pkg.pm 16 Apr 2008 18:32:57 -0000 1.91
@@ -772,6 +772,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.
@@ -779,13 +795,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.2
diff -u -d -r1.1 -r1.2
--- cust_pkg_reason.pm 19 Oct 2006 14:29:27 -0000 1.1
+++ cust_pkg_reason.pm 16 Apr 2008 18:32:58 -0000 1.2
@@ -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