Bug 11210: Writeoff partial amounts
authorDavid Bourgault <david.bourgault@inlibro.com>
Mon, 25 Sep 2017 17:05:01 +0000 (13:05 -0400)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 11 Dec 2017 17:30:42 +0000 (14:30 -0300)
Minor changes to pay.pl and paycollect.tt to allow writing off a partial amount of a fine.

Test plan:
0) Go to the Fines tab of a test patron's profile
1) Create a fine if there are none (under the Manual invoice tab)
2) Go to the "Pay fines" tab
3) Press the write off button on the corresponding account line

Without patch, you'll be asked to confirm, but will not be able to edit the amount
With patch, you'll be able to edit the amount.

Followed test plan, patch worked as described. Also ran QA test tool and
modified files passed

Signed-off-by: Simon Pouchol <simon.pouchol@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt
members/pay.pl

index 9bf8a01..7629874 100644 (file)
@@ -140,7 +140,7 @@ function moneyFormat(textObj) {
     <li>
         <label for="paid">Collect from patron: </label>
             <!-- default to paying all -->
-        <input name="paid" id="paid" value="[% amountoutstanding | format('%.2f') %]" />
+        <input name="paid" id="paid" value="[% amountoutstanding %]" />
     </li>
 </ol>
 </fieldset>
@@ -159,7 +159,6 @@ function moneyFormat(textObj) {
     <input type="hidden" name="description" id="description" value="[% description %]" />
     <input type="hidden" name="accounttype" id="accounttype" value="[% accounttype %]" />
     <input type="hidden" name="amount" id="amount" value="[% amount %]" />
-    <input type="hidden" name="amountoutstanding" id="amountoutstanding" value="[% amountoutstanding %]" />
     <input type="hidden" name="accountlines_id" id="accountlines_id" value="[% accountlines_id %]" />
     <input type="hidden" name="title" id="title" value="[% title %]" />
     <input type="hidden" name="payment_note" id="payment_note" value="[% payment_note %]" />
@@ -170,7 +169,7 @@ function moneyFormat(textObj) {
             <th>Amount</th>
             <th>Amount outstanding</th>
         </tr></thead>
-    <tfoot><td colspan="3">Total amount to be written off:</td><td>[% amountoutstanding | format('%.2f') %]</td></tfoot>
+    <tfoot><td colspan="3">Total amount outstanding:</td><td>[% amountoutstanding | format('%.2f') %]</td></tfoot>
     <tbody><tr>
             <td>[% description %] [% title %]</td>
             <td>[% accounttype %]</td>
@@ -178,8 +177,16 @@ function moneyFormat(textObj) {
             <td class="debit">[% amountoutstanding | format('%.2f') %]</td>
         </tr></tbody>
     </table>
-    </fieldset>
-    <div class="action"><input type="submit" name="confirm_writeoff" id="confirm_writeoff" value="Write off this charge" />
+
+            <ol>
+                <li>
+                    <label for="paid">Writeoff amount: </label>
+                    <!-- default to writing off all -->
+                    <input name="amountwrittenoff" id="amountwrittenoff" value="[% amountoutstanding %]" />
+                </li>
+            </ol>
+        </fieldset>
+        <div class="action"><input type="submit" name="confirm_writeoff" id="confirm_writeoff" value="Write off this charge" />
         <a class="cancel" href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% borrower.borrowernumber %]">Cancel</a></div>
     </form>
 [% ELSE %]
index c51fde2..ce35b0a 100755 (executable)
@@ -97,7 +97,7 @@ if ($writeoff_all) {
     writeoff_all(@names);
 } elsif ($writeoff_item) {
     my $accountlines_id = $input->param('accountlines_id');
-    my $amount       = $input->param('amountoutstanding');
+    my $amount       = $input->param('amountwrittenoff');
     my $payment_note = $input->param("payment_note");
 
     Koha::Account->new( { patron_id => $borrowernumber } )->pay(