- $pre_hook = sub {
- my $hash = shift;
- my @cust_pay_batch = # this is dodgy, it works due to autoposting
- qsearch('cust_pay_batch', { 'custnum' => $hash->{'custnum'}+0,
- 'status' => ''
- } );
- if ( scalar(@cust_pay_batch) == 1 ) {
- $hash->{'paybatchnum'} = $cust_pay_batch[0]->paybatchnum;
- }else{
- return "can't find batch payment for customer number " .$hash->{custnum};
- }
- '';
- };
-