X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fcust_pay.pm;h=10b51ad7a1ea930cb8d7cd05bde6b62da0d1e7cb;hb=0692ff47a2eac65616bf24104a51e558506f1b8f;hp=63d7c48351ab4ab3381be1260fdd2460547b360c;hpb=ac2ec4c0ce8ea098009340dd7e9756dad7219a5b;p=freeside.git diff --git a/FS/FS/cust_pay.pm b/FS/FS/cust_pay.pm index 63d7c4835..10b51ad7a 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') ) { @@ -658,6 +664,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),