Bug 11944: Fix fund names encoding on the parcel page
authorJonathan Druart <jonathan.druart@biblibre.com>
Wed, 9 Apr 2014 13:21:50 +0000 (15:21 +0200)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Tue, 13 Jan 2015 16:07:16 +0000 (13:07 -0300)
On the parcel page, the subtotal values are stored in an hashref. The
key was the fund name. The fund name being encoded in utf8, the hashref
was broken.
This patch replaces this logic creating a key based on an integer.
The budget name is now stored in a new "budget_name" key.

Note: It also fixes a small ergonomic issue (a td was missing in the
tfoot).

Signed-off-by: Paola Rossi <paola.rossi@cineca.it>
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Dobrica Pavlinusic <dpavlin@rot13.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt

index 06402d6..0044a03 100644 (file)
        [% SET estimated_total = 0 %]
 
        [% FOREACH loop_receive IN loop_received %]
-           [% IF (funds.${ loop_receive.budget.budget_name }.estimated == '') %]
-              [% SET funds.${ loop_receive.budget.budget_name }.estimated = 0 %]
+           [% SET index = loop.count %]
+           [% SET funds.${ index }.budget_name = loop_receive.budget.budget_name %]
+           [% IF (funds.${ index }.estimated == '') %]
+              [% SET funds.${ index }.estimated = 0 %]
            [% END %]
-           [% IF (funds.${ loop_receive.budget.budget_name }.actual == '') %]
-              [% SET funds.${ loop_receive.budget.budget_name }.actual = 0 %]
+           [% IF (funds.${ index }.actual == '') %]
+              [% SET funds.${ index }.actual = 0 %]
            [% END %]
            [% SET estimated_total = estimated_total + ( loop_receive.ecost * loop_receive.quantityreceived ) %]
-           [% SET funds.${ loop_receive.budget.budget_name }.estimated = funds.${ loop_receive.budget.budget_name }.estimated + ( loop_receive.ecost * loop_receive.quantityreceived )%]
-           [% SET funds.${ loop_receive.budget.budget_name }.actual = funds.${ loop_receive.budget.budget_name }.actual + loop_receive.total %]
+           [% SET funds.${ index }.estimated = funds.${ index }.estimated + ( loop_receive.ecost * loop_receive.quantityreceived )%]
+
+           [% SET funds.${ index }.actual = funds.${ loop_receive.budget.budget_name }.actual + loop_receive.total %]
        [% END %]
 
    <form action="/cgi-bin/koha/acqui/parcel.pl" method="get" name="orderform">
         [% FOREACH key IN funds.keys.sort %]
             <tr>
                 <td colspan="6" class="total">(Tax exc.)</td>
-                <td><i>Subtotal for</i> [% key %]</td>
+                <td colspan="2"><i>Subtotal for</i> [% funds.$key.budget_name %]</td>
                 <td>[% currency( funds.$key.estimated ) %]</td>
                 <td>[% currency( funds.$key.actual ) %]</td>
                 <td>&nbsp;</td>