Bug 19489: Detailed Description of charges in Patron accounting
authorNazlı Çetin <nazli@devinim.com.tr>
Mon, 18 Feb 2019 09:50:10 +0000 (09:50 +0000)
committerNick Clemens <nick@bywatersolutions.com>
Mon, 11 Mar 2019 12:45:58 +0000 (12:45 +0000)
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

admin/columns_settings.yml
koha-tmpl/intranet-tmpl/prog/en/modules/members/accountline-details.tt
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/printinvoice.tt
members/pay.pl
members/printinvoice.pl

index 6bc5c55..296103d 100644 (file)
@@ -358,6 +358,12 @@ modules:
         -
           columnname: description
         -
+          columnname: barcode
+        -
+          columnname: date_due
+        -
+          columnname: returndate
+        -
           columnname: note
         -
           columnname: amount
@@ -387,6 +393,12 @@ modules:
         -
           columnname: date
         -
+          columnname: barcode
+        -
+          columnname: date_due
+        -
+          columnname: returndate
+        -
           columnname: note
         -
           columnname: account_type
index 1e9855b..b777370 100644 (file)
@@ -42,6 +42,9 @@
                         <tr>
                             <th class="title-string">Date</th>
                             <th>Description of charges</th>
+                            <th>Barcode</th>
+                            <th>Due date</th>
+                            <th>Return date</th>
                             <th>Note</th>
                             <th>Amount</th>
                             <th>Outstanding</th>
                             </td>
 
                             <td>
+                                [% IF ( accountline.itemnumber ) %]
+                                    <a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% accountline.item.biblionumber | uri %]&amp;itemnumber=[% accountline.itemnumber | uri %]#item[% accountline.itemnumber | uri %]">[% accountline.item.barcode | html %]</a>
+                                [% END %]
+                            </td>
+
+                            <td>
+                                [% IF ( accountline.issue_id ) %]
+                                    [% accountline.issue.date_due | $KohaDates as_due_date => 1 %]
+                                [% END %]
+                            </td>
+
+                            <td>
+                                [% IF ( accountline.issue_id ) %]
+                                    [% accountline.issue.returndate | $KohaDates with_hours => 1 %]
+                                [% END %]
+                            </td>
+
+                            <td>
                                 [% accountline.note | html_line_break %]
                             </td>
 
index bd54ec7..8da8293 100644 (file)
@@ -45,6 +45,9 @@
       <tr>
           <th class="title-string">Date</th>
           <th>Description of charges</th>
+          <th>Barcode</th>
+          <th>Due date</th>
+          <th>Return date</th>
           <th>Home library</th>
           <th>Note</th>
           <th>Amount</th>
@@ -63,6 +66,9 @@
         [%- IF account.payment_type %], [% AuthorisedValues.GetByCode('PAYMENT_TYPE', account.payment_type) | html %][% END %]
         [%- IF account.description %], [% account.description | html %][% END %]
         &nbsp;[% IF ( account.itemnumber ) %]<a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% account.item.biblionumber | uri %]&amp;itemnumber=[% account.itemnumber | uri %]">[% account.item.biblio.title | html %]</a>[% END %]</td>
+      <td>[% IF ( account.itemnumber ) %]<a href="/cgi-bin/koha/catalogue/moredetail.pl?itemnumber=[% account.itemnumber | uri %]&amp;biblionumber=[% account.item.biblionumber | uri %]#item[% account.itemnumber | uri %]">[% account.item.barcode | html %]</a>[% END %]</td>
+      <td>[% IF ( account.issue_id ) %][% account.issue.date_due | $KohaDates as_due_date => 1 %][% END %]</td>
+      <td>[% IF ( account.issue_id ) %][% account.issue.returndate | $KohaDates with_hours => 1 %][% END %]</td>
       <td>[% IF account.itemnumber %][% Branches.GetName( account.item.homebranch ) | html %][% END %]</td>
       <td>[% account.note | html_line_break %]</td>
       [% IF account.amount <= 0 %]<td class="credit" style="text-align: right;">[% ELSE %]<td class="debit" style="text-align: right;">[% END %][% account.amount | $Price %]</td>
@@ -83,7 +89,7 @@
   [% END %]
 <tfoot>
   <tr>
-    <td colspan="5">Total due</td>
+    <td colspan="8">Total due</td>
     [% IF ( totalcredit ) %]
         <td class="credit" style="text-align: right;">[% total | $Price %]</td>
     [% ELSE %]
index 08350ab..354bab0 100644 (file)
@@ -46,6 +46,9 @@
     <th class="NoSort">Actions</th>
     <th>Description</th>
     <th class="title-string">Date</th>
+    <th>Barcode</th>
+    <th>Due date</th>
+    <th>Return date</th>
     <th class="NoSort">Payment note</th>
     <th>Account type</th>
     <th>Amount</th>
@@ -70,6 +73,7 @@
     [% END %]
     <input type="hidden" name="itemnumber[% line.accountlines_id | html %]" value="[% line.itemnumber | html %]" />
     <input type="hidden" name="description[% line.accountlines_id | html %]" value="[% line.description | html %]" />
+    <input type="hidden" name="issue_id[% line.accountlines_id | html %]" value="[% line.issue_id | html %]" />
     <input type="hidden" name="accounttype[% line.accountlines_id | html %]" value="[% line.accounttype | html %]" />
     <input type="hidden" name="amount[% line.accountlines_id | html %]" value="[% line.amount | html %]" />
     <input type="hidden" name="accountlines_id[% line.accountlines_id | html %]" value="[% line.accountlines_id | html %]" />
           [% CASE %][% line.accounttype | html %]
         [%- END -%]
         [%- IF line.description %], [% line.description | html %][% END %]
-        [% IF line.title %]([% line.title | html %])[% END %]
+        [% IF line.itemnumber %]([% line.item.biblio.title | html %])[% END %]
     </td>
     <td>
         <span title="[% line.date | html %]">[% line.date | $KohaDates %]</span>
     </td>
+    <td>
+        [% IF line.itemnumber %]
+            <a href="/cgi-bin/koha/catalogue/moredetail.pl?itemnumber=[% line.itemnumber | uri %]&amp;biblionumber=[% line.item.biblionumber | uri %]#item[% line.itemnumber | uri %]">[% line.item.barcode | html %]</a>
+        [% END %]
+    </td>
+    <td>
+        [% IF line.issue_id %]
+            [% line.issue.date_due | $KohaDates as_due_date => 1 %]
+        [% END %]
+    </td>
+    <td>
+        [% IF line.issue_id %]
+            [% line.issue.returndate | $KohaDates with_hours => 1 %]
+        [% END %]
+    </td>
     <td class="actions">
         <a href="#" class="add-note" data-accountlines_id="[% line.accountlines_id | html %]"><i class="fa fa-plus"></i> Add note</a>
         <span class="payment_note" id="payment_note_[% line.accountlines_id | html %]" style="display:none"><input type="text" size="10" name="payment_note_[% line.accountlines_id | html %]" value="" /> <a href="#" class="cancel-note"><i class="fa fa-remove"></i></a></span>
 <tfoot>
     [% IF outstanding_credits.total_outstanding < 0 %]
         <tr>
-            <td class="total" colspan="7">Outstanding credits could be applied: </td>
+            <td class="total" colspan="10">Outstanding credits could be applied: </td>
             <td class="credit" style="text-align: right;"><button type="submit" id="apply_credits" name="apply_credits" value="apply_credits" class="btn btn-default btn-sm">Apply <strong class="credit">[% outstanding_credits.total_outstanding | $Price %]</strong></button></td>
         </tr>
     [% END %]
     [% IF ( account_grp.total ) %]
         <tr>
-            <td class="total" colspan="7" style="text-align: right;">Sub total:</td>
+            <td class="total" colspan="10" style="text-align: right;">Sub total:</td>
             <td style="text-align: right;">[% account_grp.total | $Price %]</td>
         </tr>
     [% END %]
     <tr>
-        <td class="total" colspan="7">Total due:</td>
+        <td class="total" colspan="10">Total due:</td>
         [% IF outstanding_credits.total_outstanding < 0 %]
             <td style="text-align: right;">[% total + outstanding_credits.total_outstanding | $Price %]</td>
         [% ELSE %]
index a28ac03..27fc620 100644 (file)
 <table>
 [% IF ( LibraryName ) %]
   <tr>
-    <th colspan="5" class="centerednames">
-               <h3>[% LibraryName | html %]</h3>
+    <th colspan="8" class="centerednames">
+        <h3>[% LibraryName | html %]</h3>
        </th>
   </tr>
 [% END %]
   <tr>
-    <th colspan="5" class="centerednames">
-               <h2><u>INVOICE</u></h2>
-       </th>
+    <th colspan="8" class="centerednames">
+        <h2><u>INVOICE</u></h2>
+    </th>
   </tr>
   <tr>
-    <th colspan="5" class="centerednames">
+    <th colspan="8" class="centerednames">
         <h2>[% Branches.GetName( patron.branchcode ) | html %]</h2>
        </th>
   </tr>
   <tr>
-    <th colspan="5" >
+    <th colspan="8" >
         Bill to: [% patron.firstname | html %] [% patron.surname | html %] <br />
         Card number: [% patron.cardnumber | html %]<br />
        </th>
@@ -45,6 +45,9 @@
   <tr>
        <th>Date</th>
     <th>Description of charges</th>
+    <th>Barcode</th>
+    <th>Due date</th>
+    <th>Return date</th>
     <th>Note</th>
     <th style="text-align:right;">Amount</th>
     <th style="text-align:right;">Amount outstanding</th>
@@ -57,6 +60,9 @@
         [% PROCESS account_type_description account=account %]
         [%- IF account.description %], [% account.description | html %][% END %]
       </td>
+      <td>[% account.item.barcode | html %]</td>
+      <td>[% account.issue.date_due | $KohaDates as_due_date => 1 %]</td>
+      <td>[% account.issue.returndate | $KohaDates with_hours => 1 %]</td>
       <td>[% account.note | html %]</td>
       [% IF ( account.amountcredit ) %]<td class="credit">[% ELSE %]<td class="debit">[% END %][% account.amount | $Price %]</td>
       [% IF ( account.amountoutstandingcredit ) %]<td class="credit">[% ELSE %]<td class="debit">[% END %][% account.amountoutstanding | $Price %]</td>
@@ -65,7 +71,7 @@
   [% END %]
 <tfoot>
   <tr>
-    <td colspan="4">Total outstanding dues as on date: </td>
+    <td colspan="7">Total outstanding dues as on date: </td>
     [% IF ( totalcredit ) %]<td class="credit">[% ELSE %]<td class="debit">[% END %][% total | $Price %]</td>
   </tr>
   </tfoot>
index 8481419..e33c12c 100755 (executable)
@@ -147,13 +147,6 @@ sub add_accounts_to_template {
     my $total = $account_lines->total_outstanding;
     my @accounts;
     while ( my $account_line = $account_lines->next ) {
-        $account_line = $account_line->unblessed;
-        if ( $account_line->{itemnumber} ) {
-            my $item = Koha::Items->find( $account_line->{itemnumber} );
-            my $biblio = $item->biblio;
-            $account_line->{biblionumber} = $biblio->biblionumber;
-            $account_line->{title}        = $biblio->title;
-        }
         push @accounts, $account_line;
     }
     borrower_add_additional_fields($patron);
@@ -198,6 +191,7 @@ sub redirect_to_paycollect {
     $redirect .=
       get_for_redirect( 'amountoutstanding', "amountoutstanding$line_no", 1 );
     $redirect .= get_for_redirect( 'description', "description$line_no", 0 );
+    $redirect .= get_for_redirect( 'issue_id', "issue_id$line_no", 0 );
     $redirect .= get_for_redirect( 'title', "title$line_no", 0 );
     $redirect .= get_for_redirect( 'itemnumber',   "itemnumber$line_no",   0 );
     $redirect .= get_for_redirect( 'accountlines_id', "accountlines_id$line_no", 0 );
index a6d92f7..49e777e 100755 (executable)
@@ -55,7 +55,10 @@ output_and_exit_if_error( $input, $cookie, $template, { module => 'members', log
 
 #get account details
 my $total = $patron->account->balance;
-my $accountline = Koha::Account::Lines->find($accountlines_id)->unblessed;
+my $accountline_object = Koha::Account::Lines->find($accountlines_id);
+my $accountline = $accountline_object->unblessed;
+$accountline->{item} = $accountline_object->item || "" ;
+$accountline->{issue} = $accountline_object->issue || "";
 
 my $totalcredit;
 if ( $total <= 0 ) {