Bug 12415: Fee receipt: a charges description should be displayed in all cases
authorJonathan Druart <jonathan.druart@biblibre.com>
Fri, 13 Jun 2014 09:20:33 +0000 (11:20 +0200)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Fri, 21 Nov 2014 23:14:02 +0000 (20:14 -0300)
Bug 2546 removes the description DB field value in some case (3.15.00.003).
But the receipt generated by scripts members/printfeercpt.pl and
members/printinvoice.pl displays this field.
When the description field is empty, the default value (based on
accountlines.accounttype) should be displayed.

Test plan:
- Generate and pay some different kinds of fees for a patron without
  filling the 'description' field.
- In Fines>Account, click on the 'print' link.
- Before this patch, the "description of charges" values is empty if no
  description was given.
  It is a regression introduced by bug 2546, a default value was
  inserted in the description field depending on the account type
  selected.
- After this patch, the "description of charges" values should be based
  on the account type. The string display on printing receipt should be
  the same as on the account screen (staff and opac).

Note for QA: If removed the "payment" key, it is not used in template
and generated a warning ("odd number of elements...").

Signed-off-by: Nick Clemens <nick@quecheelibrary.org>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
This fixes the display of payments and other charges on the
fines slip.

Note: This patch fixes a line where the description in the
database was still updated to say "Payment thanks" for partial
payments. It might be worth to do a follow-up correcting the
accountlines table and removing the unwanted comment (see bug 2546).

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
C4/Accounts.pm
koha-tmpl/intranet-tmpl/prog/en/modules/members/printfeercpt.tt
koha-tmpl/intranet-tmpl/prog/en/modules/members/printinvoice.tt
members/printfeercpt.pl
members/printinvoice.pl

index 8cd9100..ce5671d 100644 (file)
@@ -720,7 +720,7 @@ sub makepartialpayment {
     . ' VALUES (?, ?, now(), ?, ?, ?, 0, ?, ?, ?)';
 
     $dbh->do(  $insert, undef, $borrowernumber, $nextaccntno, $amount,
-        "Payment, thanks - $user", 'Pay', $data->{'itemnumber'}, $manager_id, $payment_note);
+        '', 'Pay', $data->{'itemnumber'}, $manager_id, $payment_note);
 
     UpdateStats({
                 branch => $user,
index 64bbf35..13a02e8 100644 (file)
   [% FOREACH account IN accounts %]
 <tr class="highlight">
       <td>[% account.date %]</td>
-      <td>[% account.description %]</td>
+      <td>
+        [% SWITCH account.accounttype %]
+          [% CASE 'Pay' %]Payment, thanks
+          [% CASE 'Pay00' %]Payment, thanks (cash via SIP2)
+          [% CASE 'Pay01' %]Payment, thanks (VISA via SIP2)
+          [% CASE 'Pay02' %]Payment, thanks (credit card via SIP2)
+          [% CASE 'N' %]New Card
+          [% CASE 'F' %]Fine
+          [% CASE 'A' %]Account management fee
+          [% CASE 'M' %]Sundry
+          [% CASE 'L' %]Lost Item
+          [% CASE 'W' %]Writeoff
+          [% CASE %][% account.accounttype %]
+        [%- END -%]
+        [%- IF account.description %], [% account.description %][% END %]
+      </td>
       [% IF ( account.amountcredit ) %]<td class="credit">[% ELSE %]<td class="debit">[% END %][% account.amount %]</td>
     </tr>
 
index 29e64da..d5899d1 100644 (file)
   [% FOREACH account IN accounts %]
 <tr class="highlight">
       <td>[% account.date %]</td>
-      <td>[% account.description %]</td>
+       <td>
+        [% SWITCH account.accounttype %]
+          [% CASE 'Pay' %]Payment, thanks
+          [% CASE 'Pay00' %]Payment, thanks (cash via SIP2)
+          [% CASE 'Pay01' %]Payment, thanks (VISA via SIP2)
+          [% CASE 'Pay02' %]Payment, thanks (credit card via SIP2)
+          [% CASE 'N' %]New Card
+          [% CASE 'F' %]Fine
+          [% CASE 'A' %]Account management fee
+          [% CASE 'M' %]Sundry
+          [% CASE 'L' %]Lost Item
+          [% CASE 'W' %]Writeoff
+          [% CASE %][% account.accounttype %]
+        [%- END -%]
+        [%- IF account.description %], [% account.description %][% END %]
+      </td>
       [% IF ( account.amountcredit ) %]<td class="credit">[% ELSE %]<td class="debit">[% END %][% account.amount %]</td>
       [% IF ( account.amountoutstandingcredit ) %]<td class="credit">[% ELSE %]<td class="debit">[% END %][% account.amountoutstanding %]</td>
     </tr>
index cf14264..7f1e251 100755 (executable)
@@ -99,8 +99,7 @@ for (my $i=0;$i<$numaccts;$i++){
                 'amount'            => sprintf("%.2f",$accts->[$i]{'amount'}),
                 'amountoutstanding' => sprintf("%.2f",$accts->[$i]{'amountoutstanding'}),
                 'accountno' => $accts->[$i]{'accountno'},
-                'payment' => ( $accts->[$i]{'accounttype'} =~ /^Pay/ ),
-
+                accounttype => $accts->[$i]{accounttype},
                 );
 
     if ($accts->[$i]{'accounttype'} ne 'F' && $accts->[$i]{'accounttype'} ne 'FU'){
index 58eb7b2..ef01d54 100755 (executable)
@@ -99,7 +99,7 @@ for ( my $i = 0 ; $i < $numaccts ; $i++ ) {
         'amount'                  => sprintf( "%.2f", $accts->[$i]{'amount'} ),
         'amountoutstanding'       => sprintf( "%.2f", $accts->[$i]{'amountoutstanding'} ),
         'accountno'               => $accts->[$i]{'accountno'},
-        'payment'                 => ( $accts->[$i]{'accounttype'} =~ /^Pay/ ),
+        accounttype               => $accts->[$i]{accounttype},
     );
 
     if ( $accts->[$i]{'accounttype'} ne 'F' && $accts->[$i]{'accounttype'} ne 'FU' ) {