RT# 82955 - will only try to delete if refund found
authorChristopher Burger <burgerc@freeside.biz>
Fri, 1 Mar 2019 08:58:35 +0000 (03:58 -0500)
committerChristopher Burger <burgerc@freeside.biz>
Fri, 1 Mar 2019 08:58:35 +0000 (03:58 -0500)
bin/cust_pay_batch_refund_delete

index 4e1f1e0..df893f5 100755 (executable)
@@ -29,10 +29,10 @@ foreach (@batch_refunds) {
        'extra_sql' => $extra_batch_refund_sql,
        });
 
        'extra_sql' => $extra_batch_refund_sql,
        });
 
-       warn "found cust refund number ".$cust_refund->{Hash}->{refundnum}.", now to delete it.\n";
+       warn "found cust refund number ".$cust_refund->{Hash}->{refundnum}.", now to delete it.\n" if $cust_refund;
 
        ## delete the cust_pay_refund
 
        ## delete the cust_pay_refund
-       my $delete_cust_refund_error = $cust_refund->delete;
+       my $delete_cust_refund_error = $cust_refund->delete if cust_refund;
        warn "could not delete cust refund $delete_cust_refund_error\n" if $delete_cust_refund_error;
 
      ## delete the refund from the batch.
        warn "could not delete cust refund $delete_cust_refund_error\n" if $delete_cust_refund_error;
 
      ## delete the refund from the batch.