X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=FS%2FFS%2Fcust_pay.pm;h=a65520f6b6e2e6d3626ea4268eb5d6dbda0b1835;hb=7c0748c7e439cdbc14ced38c21e782f4669f9b15;hp=63d7c48351ab4ab3381be1260fdd2460547b360c;hpb=ac2ec4c0ce8ea098009340dd7e9756dad7219a5b;p=freeside.git diff --git a/FS/FS/cust_pay.pm b/FS/FS/cust_pay.pm index 63d7c4835..a65520f6b 100644 --- a/FS/FS/cust_pay.pm +++ b/FS/FS/cust_pay.pm @@ -414,12 +414,17 @@ sub void { } ); $cust_pay_void->reason(shift) if scalar(@_); my $error = $cust_pay_void->insert; - if ( $error ) { - $dbh->rollback if $oldAutoCommit; - return $error; + + my $cust_pay_pending = + qsearchs('cust_pay_pending', { paynum => $self->paynum }); + if ( $cust_pay_pending ) { + $cust_pay_pending->set('void_paynum', $self->paynum); + $cust_pay_pending->set('paynum', ''); + $error ||= $cust_pay_pending->replace; } - $error = $self->delete; + $error ||= $self->delete; + if ( $error ) { $dbh->rollback if $oldAutoCommit; return $error; @@ -611,11 +616,12 @@ sub send_receipt { 'custnum' => $cust_main->custnum, }; $error = $queue->insert( - FS::msg_template->by_key($msgnum)->prepare( + FS::msg_template->by_key($msgnum)->prepare( 'cust_main' => $cust_main, 'object' => $self, 'from_config' => 'payment_receipt_from', - ) + ), + 'msgtype' => 'receipt', # override msg_template's default ); } elsif ( $conf->exists('payment_receipt_email') ) { @@ -649,6 +655,8 @@ sub send_receipt { 'company_name' => $conf->config('company_name', $cust_main->agentnum), ); + $fill_in{'invnum'} = $opt->{cust_bill}->invnum if $opt->{cust_bill}; + if ( $opt->{'cust_pkg'} ) { $fill_in{'pkg'} = $opt->{'cust_pkg'}->part_pkg->pkg; #setup date, other things? @@ -658,6 +666,7 @@ sub send_receipt { 'job' => 'FS::Misc::process_send_generated_email', 'paynum' => $self->paynum, 'custnum' => $cust_main->custnum, + 'msgtype' => 'receipt', }; $error = $queue->insert( 'from' => $conf->config('invoice_from', $cust_main->agentnum),