Bug 12001: Format DEBT correctly
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Sun, 7 Jan 2018 16:41:07 +0000 (13:41 -0300)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Fri, 23 Feb 2018 13:57:30 +0000 (10:57 -0300)
Before this patchset, DEBT was formatted in the module, now it should be
done template-side.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
C4/Circulation.pm
koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt
koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation_batch_checkouts.tt
koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt
opac/sco/sco-main.pl

index 9bd4e06..d583e53 100644 (file)
@@ -776,20 +776,20 @@ sub CanBookBeIssued {
 
     if ( C4::Context->preference("IssuingInProcess") ) {
         if ( $non_issues_charges > $amountlimit && !$inprocess && !$allowfineoverride) {
-            $issuingimpossible{DEBT} = sprintf( "%.2f", $non_issues_charges );
+            $issuingimpossible{DEBT} = $non_issues_charges;
         } elsif ( $non_issues_charges > $amountlimit && !$inprocess && $allowfineoverride) {
-            $needsconfirmation{DEBT} = sprintf( "%.2f", $non_issues_charges );
+            $needsconfirmation{DEBT} = $non_issues_charges;
         } elsif ( $allfinesneedoverride && $non_issues_charges > 0 && $non_issues_charges <= $amountlimit && !$inprocess ) {
-            $needsconfirmation{DEBT} = sprintf( "%.2f", $non_issues_charges );
+            $needsconfirmation{DEBT} = $non_issues_charges;
         }
     }
     else {
         if ( $non_issues_charges > $amountlimit && $allowfineoverride ) {
-            $needsconfirmation{DEBT} = sprintf( "%.2f", $non_issues_charges );
+            $needsconfirmation{DEBT} = $non_issues_charges;
         } elsif ( $non_issues_charges > $amountlimit && !$allowfineoverride) {
-            $issuingimpossible{DEBT} = sprintf( "%.2f", $non_issues_charges );
+            $issuingimpossible{DEBT} = $non_issues_charges;
         } elsif ( $non_issues_charges > 0 && $allfinesneedoverride ) {
-            $needsconfirmation{DEBT} = sprintf( "%.2f", $non_issues_charges );
+            $needsconfirmation{DEBT} = $non_issues_charges;
         }
     }
 
index 1e637fa..4c66feb 100644 (file)
@@ -97,7 +97,7 @@
 [% END %]
 
 [% IF ( DEBT ) %]
-    <li>The patron has a debt of [% DEBT %].</li>
+    <li>The patron has a debt of [% DEBT | $Price %].</li>
 [% END %]
 
 [% IF ( DEBT_GUARANTEES ) %]
index 4eefdbf..b40a9b3 100644 (file)
                       <li><i class="fa fa-li fa-exclamation"></i>The barcode was not found [% checkout_info.barcode |html %].</li>
                   [% END %]
                   [% IF checkout_info.DEBT %]
-                      <li><i class="fa fa-li fa-exclamation"></i>The patron has a debt of [% checkout_info.DEBT %].</li> <!-- Need debt_confirmed -->
+                      <li><i class="fa fa-li fa-exclamation"></i>The patron has a debt of [% checkout_info.DEBT | $Price %].</li> <!-- Need debt_confirmed -->
                   [% END %]
                 </p>
               [% END %]
index b0e9747..8cadb17 100644 (file)
@@ -1,6 +1,7 @@
 [% USE Koha %]
 [% USE KohaDates %]
 [% USE AudioAlerts %]
+[% USE Price %]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha [% END %] &rsaquo; Self checkout </title>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
@@ -53,7 +54,7 @@
                                 [% ELSIF ( circ_error_NOT_FOR_LOAN ) %]
                                     This item is not for loan.
                                 [% ELSIF ( circ_error_DEBT ) %]
-                                    You owe the library [% amount %] and cannot check out.
+                                    You owe the library [% DEBT | $Price %] and cannot check out.
                                 [% ELSIF ( circ_error_WTHDRAWN ) %]
                                     This item has been withdrawn from the collection.
                                 [% ELSIF ( circ_error_RESTRICTED ) %]
index 4a14858..cec66b6 100755 (executable)
@@ -114,11 +114,6 @@ if ( $patronid ) {
     $borrower = $patron->unblessed if $patron;
 }
 
-my $currencySymbol = "";
-if ( my $active_currency = Koha::Acquisition::Currencies->get_active ) {
-    $currencySymbol = $active_currency->symbol;
-}
-
 my $branch = $issuer->{branchcode};
 my $confirm_required = 0;
 my $return_only = 0;
@@ -163,7 +158,7 @@ elsif ( $patron and $op eq "checkout" ) {
             hide_main                 => 1,
         );
         if ($issue_error eq 'DEBT') {
-            $template->param(amount => $currencySymbol.$impossible->{DEBT});
+            $template->param(DEBT => $impossible->{DEBT});
         }
         #warn "issue_error: " . $issue_error ;
         if ( $issue_error eq "NO_MORE_RENEWALS" ) {
@@ -195,7 +190,7 @@ elsif ( $patron and $op eq "checkout" ) {
             hide_main                 => 1,
         );
         if ($issue_error eq 'DEBT') {
-            $template->param(amount => $currencySymbol.$needconfirm->{DEBT});
+            $template->param(DEBT => $needconfirm->{DEBT});
         }
     } else {
         if ( $confirmed || $issuenoconfirm ) {    # we'll want to call getpatroninfo again to get updated issues.