internationalization/localization, RT12515
authorlevinse <levinse>
Mon, 16 May 2011 19:47:20 +0000 (19:47 +0000)
committerlevinse <levinse>
Mon, 16 May 2011 19:47:20 +0000 (19:47 +0000)
httemplate/view/cust_main/payment_history.html
httemplate/view/cust_main/payment_history/credit.html
httemplate/view/cust_main/payment_history/invoice.html
httemplate/view/cust_main/payment_history/payment.html
httemplate/view/cust_main/payment_history/refund.html
httemplate/view/cust_main/payment_history/voided_payment.html

index e561c70..49d6ff4 100644 (file)
@@ -478,4 +478,9 @@ sub translate_payby_refund {
     $payby;
 };
 
+sub areyousure_link {
+    my ($url,$msg,$title,$label) = (shift,shift,shift,shift);
+    ' (<A HREF="javascript:areyousure(\''.$url.'\',\''.$msg.'\')" TITLE="'.$title.'">'.$label.'</A>)';
+}
+
 </%init>
index ae388eb..ffe6133 100644 (file)
@@ -121,32 +121,21 @@ if (    scalar(@cust_credit_bill)   == 0
 }
 #
 my $delete = '';
-if ( $cust_credit->closed !~ /^Y/i
-
-     #s'pose deleting a credit isn't bad like deleting a payment
-     # and this needs to be generally available until we have credit voiding..
-     #&& $conf->exists('deletecredits')
-
-     && $curuser->access_right('Delete credit')
-   )
-{
-  $delete = qq! (<A HREF="javascript:areyousure('!.
-            qq!${p}misc/delete-cust_credit.cgi?!. $cust_credit->crednum.
-            qq!', 'Are you sure you want to delete this credit?')">!.
-            qq!delete</A>)!;
-}
+$delete = areyousure_link("${p}misc/delete-cust_credit.cgi?".$cust_credit->crednum,
+                            mt('Are you sure you want to delete this credit?'),
+                            '',
+                            mt('delete')
+                          )
+if ( $cust_credit->closed !~ /^Y/i && $curuser->access_right('Delete credit') );
 
 my $unapply = '';
-if (    $cust_credit->closed !~ /^Y/i
-     && scalar(@cust_credit_bill)
-     && $curuser->access_right('Unapply credit')
-   )
-{
-  $unapply = qq! (<A HREF="javascript:areyousure('!.
-             qq!${p}misc/unapply-cust_credit.cgi?!. $cust_credit->crednum.
-             qq!', 'Are you sure you want to unapply this credit?')">!.
-             qq!unapply</A>)!;
-}
+$unapply = areyousure_link("${p}misc/unapply-cust_credit.cgi?".$cust_credit->crednum,
+                            mt('Are you sure you want to unapply this credit?'),
+                            '',
+                            mt('unapply')
+                          )
+if ( $cust_credit->closed !~ /^Y/i && scalar(@cust_credit_bill)
+     && $curuser->access_right('Unapply credit') );
 
 my $reason = $cust_credit->reason
                ? ' ('. $cust_credit->reason. ')'
index fe14d3e..29389ef 100644 (file)
@@ -20,13 +20,12 @@ my $link = $curuser->access_right('View invoices')
              : '';
 
 my $delete = '';
-if ( $opt{'deleteinvoices'} && $curuser->access_right('Delete invoices') ) {
-  $delete = qq! (<A HREF="javascript:areyousure('!.
-            qq!${p}misc/delete-cust_bill.html?$invnum',!.
-            qq!'Are you sure you want to delete this invoice?')"!.
-            qq! TITLE="Delete this invoice from the database completely"!.
-            mt('delete') . '</A>)';
-}
+$delete = areyousure_link("${p}misc/delete-cust_bill.html?$invnum",
+                            mt('Are you sure you want to delete this invoice?'),
+                            mt('Delete this invoice from the database completely'),
+                            mt('delete')
+                        )
+    if ( $opt{'deleteinvoices'} && $curuser->access_right('Delete invoices') );
 
 my $events = '';
 #1.9
index 6148651..7df16cf 100644 (file)
@@ -169,7 +169,15 @@ if (    $cust_pay->closed !~ /^Y/i
 }
 
 my $void = '';
-if (    $cust_pay->closed !~ /^Y/i
+my $voidmsg = $cust_pay->payby =~ /^(CARD|CHEK)$/
+              ? ' (' . mt('do not send anything to the payment gateway').')'
+              : '';
+$void = areyousure_link("${p}misc/void-cust_pay.cgi?".$cust_pay->paynum,
+                        mt('Are you sure you want to void this payment?'),
+                        mt('Void this payment from the database') . $voidmsg,
+                        mt('void')
+                       )
+    if (    $cust_pay->closed !~ /^Y/i
      && (    ( $cust_pay->payby eq 'CARD'
                && $curuser->access_right('Credit card void')
              )
@@ -180,43 +188,24 @@ if (    $cust_pay->closed !~ /^Y/i
                && $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 $delete = '';
-if ( $cust_pay->closed !~ /^Y/i
-     && $opt{'deletepayments'}
-     && $curuser->access_right('Delete payment')
-   )
-{
-  $delete = qq! (<A HREF="javascript:areyousure('!.
-            qq!${p}misc/delete-cust_pay.cgi?!. $cust_pay->paynum.
-            qq!', 'Are you sure you want to delete this payment?')"!.
-            qq! TITLE="Delete this payment from the database completely - not recommended"!.
-            qq!>delete</A>)!;
-}
+$delete = areyousure_link("${p}misc/delete-cust_pay.cgi?".$cust_pay->paynum,
+                            mt('Are you sure you want to delete this payment?'),
+                            mt('Delete this payment from the database completely - not recommended'),
+                            mt('delete')
+                         )
+    if ( $cust_pay->closed !~ /^Y/i && $opt{'deletepayments'}
+                                 && $curuser->access_right('Delete payment') );
 
 my $unapply = '';
-if (    $cust_pay->closed !~ /^Y/i
-     && scalar(@cust_bill_pay)           
-     && $curuser->access_right('Unapply payment')
-   )
-{
-  $unapply = qq! (<A HREF="javascript:areyousure('!.
-             qq!${p}misc/unapply-cust_pay.cgi?!. $cust_pay->paynum.
-             qq!', 'Are you sure you want to unapply this payment?')"!.
-             qq! TITLE="Keep this payment, but dissociate it from the invoices it is currently applied against"!.
-             qq!>unapply</A>)!;
-}
+$unapply = areyousure_link("${p}misc/unapply-cust_pay.cgi?".$cust_pay->paynum,
+                            mt('Are you sure you want to unapply this payment?'),
+                            mt('Keep this payment, but dissociate it from the invoices it is currently applied against'),
+                            mt('unapply')
+                          )
+    if ( $cust_pay->closed !~ /^Y/i && scalar(@cust_bill_pay)           
+                                && $curuser->access_right('Unapply payment') );
 
 </%init>
index 154525d..813836b 100644 (file)
@@ -1,6 +1,6 @@
-<% $refund %>
-(<% $payby. $payinfo %>)
-<% mt('by') |h %> <% $cust_refund->otaker %><% $view %><% $delete %>
+<% $refund %> 
+(<% "$payby$payinfo" %>)
+<% "$view$delete" %>
 <%init>
 
 my( $cust_refund, %opt ) = @_;
@@ -14,8 +14,10 @@ my $payinfo = $payby eq 'CARD'
 
 $payby = translate_payby_refund($payby,$payinfo);
 
-my $refund = mt('Refund');
-$refund = '<B><FONT COLOR="#FF0000">' . mt('Unapplied Refund') . '</FONT></B>' 
+my $refund = mt("Refund by [_1]",$cust_refund->otaker);
+$refund = '<B><FONT COLOR="#FF0000">' 
+    . mt("Unapplied Refund by [_1]",$cust_refund->otaker) 
+    . '</FONT></B>' 
     if $cust_refund->unapplied > 0;
 
 my $view =
@@ -29,17 +31,13 @@ my $view =
 
 
 my $delete = '';
-if ( $cust_refund->closed !~ /^Y/i
-     && $opt{'deleterefunds'}
-     && $curuser->access_right('Delete refund')
-   )
-{
-  $delete = qq! (<A HREF="javascript:areyousure('!.
-            qq!${p}misc/delete-cust_refund.cgi?!. $cust_refund->refundnum.
-            qq!', 'Are you sure you want to delete this refund?')"!.
-            qq! TITLE="!.mt('Delete this refund from the database completely - not recommended').
-            ">".mt('delete')."</A>)";
-}
+$delete = areyousure_link("${p}misc/delete-cust_refund.cgi?".$cust_refund->refundnum,
+                           mt('Are you sure you want to delete this refund?'),
+                           mt('Delete this refund from the database completely - not recommended'),
+                           mt('delete')
+                          ) 
+    if ( $cust_refund->closed !~ /^Y/i && $opt{'deleterefunds'} 
+                                && $curuser->access_right('Delete refund') );
 
 </%init>
 
index 0a8cd10..f4ffc23 100644 (file)
@@ -34,19 +34,14 @@ if ( $opt{'pkg-balances'} && $cust_pay_void->pkgnum ) {
 }
 
 my $unvoid = '';
-if ( $cust_pay_void->closed !~ /^Y/i
-     && $curuser->access_right('Unvoid')
-   )
-{
-  $unvoid = qq! (<A HREF="javascript:areyousure('!.
-            qq!${p}misc/unvoid-cust_pay_void.cgi?!. $cust_pay_void->paynum.
-            qq!', 'Are you sure you want to unvoid this payment?')"!.
-            qq! TITLE="!.mt('Unvoid this payment from the database').
-              ( $cust_pay_void->payby =~ /^(CARD|CHEK)$/
+my $unvoidmsg = $cust_pay_void->payby =~ /^(CARD|CHEK)$/
                 ? ' ('.mt('do not send anything to the payment gateway') .')'
-                : '' 
-              ). '"'.
-            '>'.mt('unvoid').'</A>)';
-}
+                : '';
+$unvoid = areyousure_link("${p}misc/unvoid-cust_pay_void.cgi?".$cust_pay_void->paynum,
+                            mt('Are you sure you want to unvoid this payment?'),
+                            mt('Unvoid this payment from the database') . $unvoidmsg,
+                            mt('unvoid')
+                         )
+    if ( $cust_pay_void->closed !~ /^Y/i && $curuser->access_right('Unvoid') );
 
 </%init>