X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fcust_credit.pm;h=026b92e84431c3f8f0936bfcbe5e011454b0cd31;hb=e96a3fd1c8ee8c711a7e119c0937da6866bbd4f0;hp=90f9b59edf0661adc829b274839fe2e90a341697;hpb=f3212b82d6d54500bbe31c02c8ffa456f018a067;p=freeside.git diff --git a/FS/FS/cust_credit.pm b/FS/FS/cust_credit.pm index 90f9b59ed..026b92e84 100644 --- a/FS/FS/cust_credit.pm +++ b/FS/FS/cust_credit.pm @@ -2,8 +2,10 @@ package FS::cust_credit; use strict; use vars qw( @ISA $conf $unsuspendauto ); +use Date::Format; use FS::UID qw( dbh getotaker ); use FS::Record qw( qsearch qsearchs ); +use FS::Misc qw(send_email); use FS::cust_main; use FS::cust_refund; use FS::cust_credit_bill; @@ -104,6 +106,8 @@ sub insert { return "error inserting $self: $error"; } + $dbh->commit or die $dbh->errstr if $oldAutoCommit; + #false laziness w/ cust_credit::insert if ( $unsuspendauto && $old_balance && $cust_main->balance <= 0 ) { my @errors = $cust_main->unsuspend; @@ -298,6 +302,18 @@ sub credited { sprintf( "%.2f", $amount ); } +=item cust_main + +Returns the customer (see L) for this credit. + +=cut + +sub cust_main { + my $self = shift; + qsearchs( 'cust_main', { 'custnum' => $self->custnum } ); +} + + =back =head1 BUGS