LP#1501516 PO lineitem 'paid' indicator
authorBill Erickson <berickxx@gmail.com>
Thu, 1 Oct 2015 15:51:43 +0000 (11:51 -0400)
committerKathy Lussier <klussier@masslnc.org>
Thu, 25 Feb 2016 05:36:16 +0000 (00:36 -0500)
Display a new "paid" label for each lineitem within a purchase
order whose items have all been invoiced (or canceled).

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Christine Burns <christine.burns@bc.libraries.coop>
Signed-off-by: Kathy Lussier <klussier@masslnc.org>
Open-ILS/src/templates/acq/common/li_table.tt2
Open-ILS/web/js/ui/default/acq/common/li_table.js
Open-ILS/web/js/ui/default/acq/po/view_po.js

index 5dbba8e..40546c8 100644 (file)
                                         <span name="claim_policy" class="hidden"> | [% l("claim policy:") %] <span name="claim_policy_name"></span></span>
                                         <span name='pro' class='hidden'> | <a title='[% l('Provider') %]' name='pro_link' href='javascript:void(0);'>&#x235F; </a></span>
                                         <span name='queue' class='hidden'> | <a title='[% l('Import Queue') %]' name='queue_link' href='javascript:void(0);'>[% l('&#x27AC; queue') %]</a></span>
+                                        <span name='paid' class='hidden'> | <span class="acq-existing-count-warn">[% l('Paid') %]</span></span>
                                     </td>
                                 </tr>
                             </tbody>
index 4eda197..68d9a67 100644 (file)
@@ -775,6 +775,20 @@ function AcqLiTable() {
         dojo.query('[name=expand_inline_copies]', row)[0].onclick = 
             function() {self.drawInlineCopies(li.id())};
 
+        var sum;
+        if (sum = li.order_summary()) { // assignment
+            // Only show the paid label if at least one copy is invoiced.
+            // In other words, a lineitem whose every copy is canceled
+            // is not "paid off"
+            if (sum.invoice_count() > 0) {
+                if (sum.item_count() == (
+                    sum.invoice_count() + sum.cancel_count())) {
+                    // Lineitem is fully paid.  Display the paid-off label
+                    openils.Util.show(nodeByName('paid', row), 'inline');
+                }
+            }
+        }
+
         this.drawOrderIdentSelector(li, row);
 
         if (!this.skipInitialEligibilityCheck)
index 10e063e..53989cc 100644 (file)
@@ -483,7 +483,12 @@ function init2() {
             params: [
                 openils.User.authtoken, 
                 [{purchase_order:poId}, {"order_by": {"jub": "id ASC"}}], 
-                {flesh_attrs:true, flesh_notes:true, flesh_cancel_reason:true, clear_marc:true}
+                {   flesh_attrs : true,
+                    flesh_notes : true,
+                    flesh_cancel_reason : true,
+                    flesh_order_summary : true,
+                    clear_marc:true
+                }
             ],
             onresponse: function(r) {
                 liTable.show('list');