use strict;
use base qw( FS::Record );
-use FS::Record; # qw( qsearch qsearchs );
+use FS::Record qw( qsearchs ); # qsearch );
use FS::cust_pkg;
use FS::discount;
$self->SUPER::check;
}
+=item cust_pkg
+
+Returns the customer package (see L<FS::cust_pkg>).
+
+=cut
+
+sub cust_pkg {
+ my $self = shift;
+ qsearchs('cust_pkg', { 'pkgnum' => $self->pkgnum } );
+}
+
+=item discount
+
+Returns the discount (see L<FS::discount>).
+
+=cut
+
+sub discount {
+ my $self = shift;
+ qsearchs('discount', { 'discountnum' => $self->discountnum } );
+}
+
+=item increment_months_used
+
+Increments months_used by the given parameter
+
+=cut
+
+sub increment_months_used {
+ my( $self, $used ) = @_;
+ #UPDATE cust_pkg_discount SET months_used = months_used + ?
+ #leaves no history, and billing is mutexed per-customer, so the dum way is ok
+ $self->months_used( $self->months_used + $used );
+ $self->replace();
+}
+
=back
=head1 BUGS