-if ( $cust_pay->closed !~ /^Y/i
- && ( ( $cust_pay->payby eq 'CARD'
- && $curuser->access_right('Credit card void')
- )
- || ( $cust_pay->payby eq 'CHEK'
- && $curuser->access_right('Echeck void')
- )
- || ( $cust_pay->payby !~ /^(CARD|CHEK)$/
- && $curuser->access_right('Regular void')
- )
- )
- )
-{
- $void = qq! (<A HREF="javascript:areyousure('!.
- qq!${p}misc/void-cust_pay.cgi?!. $cust_pay->paynum.
- qq!', 'Are you sure you want to void this payment?')"!.
- qq! TITLE="Void this payment from the database!.
- ( $cust_pay->payby =~ /^(CARD|CHEK)$/
- ? ' (do not send anything to the payment gateway)'
- : ''
- ). '"'.
- qq!>void</A>)!;
-}
+my $voidmsg = $cust_pay->payby =~ /^(CARD|CHEK)$/
+ ? ' (' . emt('do not send anything to the payment gateway').')'
+ : '';
+$void = areyousure_link("${p}misc/void-cust_pay.cgi?".$cust_pay->paynum,
+ emt('Are you sure you want to void this payment?'),
+ emt('Void this payment from the database') . $voidmsg,
+ emt('void')
+ )
+ if $cust_pay->closed !~ /^Y/i
+ && ( ( $cust_pay->payby eq 'CARD' && $opt{'Credit card void'} )
+ || ( $cust_pay->payby eq 'CHEK' && $opt{'Echeck void'} )
+ || ( $cust_pay->payby !~ /^(CARD|CHEK)$/ && $opt{'Void payments'} )
+ );