[freeside-commits] freeside/FS/FS cust_pkg_discount.pm,1.4,1.5
Ivan,,,
ivan at wavetail.420.am
Fri Feb 5 18:57:14 PST 2010
Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv1433/FS/FS
Modified Files:
cust_pkg_discount.pm
Log Message:
discount reporting, RT#6679
Index: cust_pkg_discount.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_pkg_discount.pm,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- cust_pkg_discount.pm 5 Feb 2010 02:39:31 -0000 1.4
+++ cust_pkg_discount.pm 6 Feb 2010 02:57:12 -0000 1.5
@@ -1,7 +1,7 @@
package FS::cust_pkg_discount;
use strict;
-use base qw( FS::Record );
+use base qw( FS::cust_main_Mixin FS::Record );
use FS::Record qw( dbh qsearchs ); # qsearch );
use FS::cust_pkg;
use FS::discount;
@@ -165,6 +165,7 @@
|| $self->ut_float('months_used') #actually decimal, but this will do
|| $self->ut_numbern('end_date')
|| $self->ut_text('otaker')
+ || $self->ut_enum('disabled', [ '', 'Y' ] )
;
return $error if $error;
@@ -207,6 +208,24 @@
$self->replace();
}
+=item status
+
+=cut
+
+sub status {
+ my $self = shift;
+ my $discount = $self->discount;
+
+ if ( $self->disabled ne 'Y'
+ and ( ! $discount->months || $self->months_used < $discount->months )
+ #XXX also end date
+ ) {
+ 'active';
+ } else {
+ 'expired';
+ }
+}
+
=back
=head1 BUGS
More information about the freeside-commits
mailing list