Bug 6413 - QA Followup - Add notes for 'Pay selected'
authorPaul Poulain <paul.poulain@biblibre.com>
Wed, 20 Mar 2013 10:37:05 +0000 (11:37 +0100)
committerGalen Charlton <gmc@esilibrary.com>
Tue, 21 May 2013 23:32:12 +0000 (16:32 -0700)
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
C4/Accounts.pm
koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt
koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt
koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt
members/pay.pl
members/paycollect.pl

index 0854502..f087b7a 100644 (file)
@@ -789,7 +789,7 @@ will be credited to the next one.
 =cut
 
 sub recordpayment_selectaccts {
-    my ( $borrowernumber, $amount, $accts ) = @_;
+    my ( $borrowernumber, $amount, $accts, $note ) = @_;
 
     my $dbh        = C4::Context->dbh;
     my $newamtos   = 0;
@@ -849,9 +849,9 @@ sub recordpayment_selectaccts {
 
     # create new line
     $sql = 'INSERT INTO accountlines ' .
-    '(borrowernumber, accountno,date,amount,description,accounttype,amountoutstanding,manager_id) ' .
-    q|VALUES (?,?,now(),?,'Payment,thanks','Pay',?,?)|;
-    $dbh->do($sql,{},$borrowernumber, $nextaccntno, 0 - $amount, 0 - $amountleft, $manager_id );
+    '(borrowernumber, accountno,date,amount,description,accounttype,amountoutstanding,manager_id,note) ' .
+    q|VALUES (?,?,now(),?,'Payment,thanks','Pay',?,?,?)|;
+    $dbh->do($sql,{},$borrowernumber, $nextaccntno, 0 - $amount, 0 - $amountleft, $manager_id, $note );
     UpdateStats( $branch, 'payment', $amount, '', '', '', $borrowernumber, $nextaccntno );
 
     if ( C4::Context->preference("FinesLog") ) {
index 727430a..d64c63b 100644 (file)
@@ -45,7 +45,7 @@
    [% IF ( loop.odd ) %]<tr>[% ELSE %]<tr class="highlight">[% END %]
       <td>[% account.date %]</td>
       <td>[% account.description %]&nbsp;[% IF ( account.itemnumber ) %]<a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% account.biblionumber %]&amp;itemnumber=[% account.itemnumber %]">View item</a>&nbsp;[% END %][% account.title |html %]</td>
-      <td>[% account.note %]</td>
+      <td>[% account.note | html_line_break %]</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>
     [% IF ( reverse_col ) %]
index a0a26a2..874dcb1 100644 (file)
@@ -62,7 +62,7 @@
 </thead>
 <tfoot>
 <tr>
-    <td class="total" colspan="7">Total Due:</td>
+    <td class="total" colspan="8">Total Due:</td>
     <td>[% total | format('%.2f') %]</td>
 </tr>
 </tfoot>
@@ -93,7 +93,7 @@
     <input type="hidden" name="totals[% line.accountno %]" value="[% line.totals %]" />
     </td>
     <td>[% line.description %] ([% line.title |html_entity %])</td>
-    <td><input type="text" name="payment_note_[% line.accountno %]"></input></td>
+    <td><input type="text" name="payment_note_[% line.accountno %]" /></td>
     <td>[% line.accounttype %]</td>
     <td>[% line.notify_id %]</td>
     <td>[% line.notify_level %]</td>
 [% IF ( account_grp.total ) %]
 <tr>
 
-    <td class="total" colspan="7">Sub total:</td>
+    <td class="total" colspan="8">Sub total:</td>
     <td>[% account_grp.total | format('%.2f') %]</td>
 </tr>
 [% END %]
index e80e6da..9cec275 100644 (file)
@@ -211,6 +211,10 @@ function moneyFormat(textObj) {
         <!-- default to paying all -->
         <input name="paid" id="paid" value="[% total | format('%.2f') %]" onchange="moneyFormat(document.payfine.paid)"/>
     </li>
+    <li>
+        <label for="selected_accts_notes">Note: </label>
+        <textarea name="selected_accts_notes" id="selected_accts_notes">[% selected_accts_notes %]</textarea>
+    </li>
     </ol>
     </fieldset>
     <div class="action"><input type="submit" name="submitbutton" value="Confirm" />
index 67350b4..4efffc3 100755 (executable)
@@ -249,10 +249,12 @@ sub payselected {
     }
     $amt = '&amt=' . $amt;
     my $sel = '&selected=' . join ',', @lines_to_pay;
+    my $notes = '&notes=' . join("%0A", map { $input->param("payment_note_$_") } @lines_to_pay );
     my $redirect =
         "/cgi-bin/koha/members/paycollect.pl?borrowernumber=$borrowernumber"
       . $amt
-      . $sel;
+      . $sel
+      . $notes;
 
     print $input->redirect($redirect);
     return;
index 5ed6b86..5edb644 100755 (executable)
@@ -93,7 +93,8 @@ if ( $individual || $writeoff ) {
     $total_due = $input->param('amt');
     $template->param(
         selected_accts => $select_lines,
-        amt            => $total_due
+        amt            => $total_due,
+        selected_accts_notes => $input->param('notes'),
     );
 }
 
@@ -120,8 +121,8 @@ if ( $total_paid and $total_paid ne '0.00' ) {
                     $select = $1;    # ensure passing no junk
                 }
                 my @acc = split /,/, $select;
-                recordpayment_selectaccts( $borrowernumber, $total_paid,
-                    \@acc );
+                my $note = $input->param('selected_accts_notes');
+                recordpayment_selectaccts( $borrowernumber, $total_paid, \@acc, $note );
             } else {
                 recordpayment( $borrowernumber, $total_paid );
             }