X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fcust_credit.pm;h=752d84275130638591be0cfc5e0616c534ebbbcf;hb=dd268209494ce9fc3491d02b8c3034a7dffc84e4;hp=badb673514ae49cfaf411a56adbbb35ba635d138;hpb=973d5dd654ea23dea3ff185e157a404556815ccb;p=freeside.git diff --git a/FS/FS/cust_credit.pm b/FS/FS/cust_credit.pm index badb67351..752d84275 100644 --- a/FS/FS/cust_credit.pm +++ b/FS/FS/cust_credit.pm @@ -348,13 +348,18 @@ adds a record of the voided credit to the cust_credit_void table. =cut -# yes, false laziness with cust_pay and cust_bill -# but frankly I don't have time to fix it now - sub void { my $self = shift; my $reason = shift; + unless (ref($reason) || !$reason) { + $reason = FS::reason->new_or_existing( + 'class' => 'X', + 'type' => 'Void credit', + 'reason' => $reason + ); + } + local $SIG{HUP} = 'IGNORE'; local $SIG{INT} = 'IGNORE'; local $SIG{QUIT} = 'IGNORE'; @@ -369,7 +374,7 @@ sub void { my $cust_credit_void = new FS::cust_credit_void ( { map { $_ => $self->get($_) } $self->fields } ); - $cust_credit_void->set('void_reason', $reason); + $cust_credit_void->set('void_reasonnum', $reason->reasonnum); my $error = $cust_credit_void->insert; if ( $error ) { $dbh->rollback if $oldAutoCommit;