[open-ils-commits] [GIT] Evergreen ILS branch master updated. 4e6f44ab34f1c53c7d462d6077f1073bd3ab40d1

Evergreen Git git at git.evergreen-ils.org
Tue Jul 24 13:14:00 EDT 2012


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, master has been updated
       via  4e6f44ab34f1c53c7d462d6077f1073bd3ab40d1 (commit)
       via  adcf4e7684e9953a37a4c5c0b0828e7ae0fcfca1 (commit)
       via  b32c7f26a6fef15419639c38448c0028bb8f4a60 (commit)
      from  7a100875f813b3319aec1872460a7e7261dd6b8b (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 4e6f44ab34f1c53c7d462d6077f1073bd3ab40d1
Author: Bill Erickson <berick at esilibrary.com>
Date:   Mon Jul 9 14:46:41 2012 -0400

    Batch lineitem create / link-to invoice action
    
    In the PO lineitem list page and lineitem search restuls page,  there
    are two new actions in the top-level actions selector: "Create Invoice
    from Selected Lineitems" and "Link To Invoice for Selected Lineitems".
    Both behave the same as create/link invoice for single lineitems, but
    now it's possible to select multiple lineitems for invoicing.
    
    Signed-off-by: Bill Erickson <berick at esilibrary.com>
    Signed-off-by: Mike Rylander <mrylander at gmail.com>

diff --git a/Open-ILS/src/templates/acq/common/li_table.tt2 b/Open-ILS/src/templates/acq/common/li_table.tt2
index 9eb8d35..00c2727 100644
--- a/Open-ILS/src/templates/acq/common/li_table.tt2
+++ b/Open-ILS/src/templates/acq/common/li_table.tt2
@@ -32,6 +32,8 @@
                                             <option mask='po' value='rollback_receive_po'>Un-Receive Purchase Order</option>
                                             <option mask='po' value='print_po'>Print Purchase Order</option>
                                             <option mask='po' value='po_history'>View PO History</option>
+                                            <option mask='po' value='batch_create_invoice'>[% l('Create Invoice From Selected Lineitems') %]</option>
+                                            <option mask='po' value='batch_link_invoice'>[% l('Link To Invoice for Selected Lineitems') %]</option>
                                         </select>
                                         <span id="acq-lit-export-attr-holder" class="hidden">
                                             <input dojoType="dijit.form.FilteringSelect" id="acq-lit-export-attr" jsId="acqLitExportAttrSelector" labelAttr="description" searchAttr="description" />
diff --git a/Open-ILS/web/js/ui/default/acq/common/li_table.js b/Open-ILS/web/js/ui/default/acq/common/li_table.js
index d0a9d84..6495c87 100644
--- a/Open-ILS/web/js/ui/default/acq/common/li_table.js
+++ b/Open-ILS/web/js/ui/default/acq/common/li_table.js
@@ -2121,6 +2121,14 @@ function AcqLiTable() {
                 location.href = oilsBasePath + '/acq/po/history/' + this.isPO;
                 break;
 
+            case 'batch_create_invoice':
+                this.batchCreateInvoice();
+                break;
+
+            case 'batch_link_invoice':
+                this.batchLinkInvoice();
+                break;
+
             case 'receive_po':
                 this.receivePO();
                 break;
@@ -2368,8 +2376,26 @@ function AcqLiTable() {
                 }
             }
         );
-    }
+    };
+
+    this.batchCreateInvoice = function() {
+        var liIds = this.getSelected(false, null, true /* id_list */)
+        if (!liIds.length) return;
+        var path = oilsBasePath + '/acq/invoice/view?create=1';
+        dojo.forEach(liIds, function(li, idx) { path += '&attach_li=' + li });
+        location.href = path;
+    };
 
+    this.batchLinkInvoice = function(create) {
+        var liIds = this.getSelected(false, null, true /* id_list */)
+        if (!liIds.length) return;
+        if (!self.invoiceLinkDialogManager) {
+            self.invoiceLinkDialogManager =
+                new InvoiceLinkDialogManager("li");
+        }
+        self.invoiceLinkDialogManager.target = liIds;
+        acqLitLinkInvoiceDialog.show();
+    };
 
     this.receivePO = function() {
         if (!this.isPO) return;

commit adcf4e7684e9953a37a4c5c0b0828e7ae0fcfca1
Author: Bill Erickson <berick at esilibrary.com>
Date:   Mon Jul 9 14:45:15 2012 -0400

    Invoice link dialog supports multiple lineitems/POs
    
    Adds support to the invoice linking dialog for linking sets of lineitems
    or POs instead of just one.
    
    Signed-off-by: Bill Erickson <berick at esilibrary.com>
    Signed-off-by: Mike Rylander <mrylander at gmail.com>

diff --git a/Open-ILS/web/js/ui/default/acq/common/inv_dialog.js b/Open-ILS/web/js/ui/default/acq/common/inv_dialog.js
index b76aa97..7a5789e 100644
--- a/Open-ILS/web/js/ui/default/acq/common/inv_dialog.js
+++ b/Open-ILS/web/js/ui/default/acq/common/inv_dialog.js
@@ -4,8 +4,14 @@ function InvoiceLinkDialogManager(which, target) {
 
     this.linkFoundInvoice = function(r) {
         self.inv = openils.Util.readResponse(r);
-        location.href = oilsBasePath + "/acq/invoice/view/" + self.inv.id() +
-            "?attach_" + self.which + "=" + self.target.id();
+        var path = oilsBasePath + "/acq/invoice/view/" + self.inv.id();
+        if (!dojo.isArray(self.target)) self.target = [self.target];
+        dojo.forEach(self.target, function(target, idx) { 
+            id = (typeof target != 'object') ? target : target.id();
+            var join = (idx == 0) ? '?' : '&';
+            path += join + "attach_" + self.which + "=" + id;
+        });
+        location.href = path;
     };
 
     this.which = which;

commit b32c7f26a6fef15419639c38448c0028bb8f4a60
Author: Bill Erickson <berick at esilibrary.com>
Date:   Mon Jul 9 13:34:26 2012 -0400

    Attach multiple lineitems / POs to invoice
    
    Adds support to the Invoice interface for attaching multiple lineitems
    or POs via the existing attach_li and attach_po URL params.  These can
    be used by other invoice create/link UIs for batch linking.
    
    Signed-off-by: Bill Erickson <berick at esilibrary.com>
    Signed-off-by: Mike Rylander <mrylander at gmail.com>

diff --git a/Open-ILS/web/js/ui/default/acq/invoice/view.js b/Open-ILS/web/js/ui/default/acq/invoice/view.js
index 8422b8d..7f2a2dd 100644
--- a/Open-ILS/web/js/ui/default/acq/invoice/view.js
+++ b/Open-ILS/web/js/ui/default/acq/invoice/view.js
@@ -43,8 +43,14 @@ function nodeByName(name, context) {
 
 function init() {
 
-    attachLi = cgi.param('attach_li');
-    attachPo = cgi.param('attach_po');
+    attachLi = cgi.param('attach_li') || [];
+    if (!dojo.isArray(attachLi)) 
+        attachLi = [attachLi];
+
+    attachPo = cgi.param('attach_po') || [];
+    if (!dojo.isArray(attachPo)) 
+        attachPo = [attachPo];
+
     focusLineitem = new openils.CGI().param('focus_li');
 
     itemTypes = pcrud.retrieveAll('aiit');
@@ -80,7 +86,7 @@ function init() {
 function renderInvoice() {
 
     // in create mode, let the LI or PO render the invoice with seed data
-    if( !(cgi.param('create') && (attachPo || attachLi)) ) {
+    if( !(cgi.param('create') && (attachPo.length || attachLi.length)) ) {
         invoicePane = drawInvoicePane(dojo.byId('acq-view-invoice-div'), invoice);
     }
 
@@ -127,8 +133,8 @@ function renderInvoice() {
         );
     }
 
-    if(attachLi) doAttachLi();
-    if(attachPo) doAttachPo();
+    if(attachLi.length) doAttachLi();
+    if(attachPo.length) doAttachPo(0);
 }
 
 function doAttachLi() {
@@ -136,10 +142,11 @@ function doAttachLi() {
     //var invoiceArgs = {provider : lineitem.provider(), shipper : lineitem.provider()}; 
     if(cgi.param('create')) {
 
+        // use the first LI in the list to determine the default provider
         fieldmapper.standardRequest(
             ['open-ils.acq', 'open-ils.acq.lineitem.retrieve.authoritative'],
             {
-                params : [openils.User.authtoken, attachLi, {clear_marc:1}],
+                params : [openils.User.authtoken, attachLi[0], {clear_marc:1}],
                 oncomplete : function(r) {
                     var li = openils.Util.readResponse(r);
                     invoicePane = drawInvoicePane(
@@ -151,27 +158,34 @@ function doAttachLi() {
         );
     }
 
-    var entry = new fieldmapper.acqie();
-    entry.id(virtualId--);
-    entry.isnew(true);
-    entry.lineitem(attachLi);
-    addInvoiceEntry(entry);
+    dojo.forEach(attachLi,
+        function(li) {
+            var entry = new fieldmapper.acqie();
+            entry.id(virtualId--);
+            entry.isnew(true);
+            entry.lineitem(li);
+            addInvoiceEntry(entry);
+        }
+    );
 }
 
-function doAttachPo() {
+function doAttachPo(idx) {
+
+    if (idx == attachPo.length) return;
+    var poId = attachPo[idx];
 
     fieldmapper.standardRequest(
         ['open-ils.acq', 'open-ils.acq.purchase_order.retrieve'],
         {   async: true,
             params: [
-                openils.User.authtoken, attachPo, 
+                openils.User.authtoken, poId,
                 {flesh_lineitem_ids : true, flesh_po_items : true}
             ],
             oncomplete: function(r) {
                 var po = openils.Util.readResponse(r);
 
-                if(cgi.param('create')) {
-                    // render the invoice using some seed data from the PO
+                if(cgi.param('create') && idx == 0) {
+                    // render the invoice using some seed data from the first PO
                     var invoiceArgs = {provider : po.provider(), shipper : po.provider()}; 
                     invoicePane = drawInvoicePane(dojo.byId('acq-view-invoice-div'), null, invoiceArgs);
                 }
@@ -202,6 +216,8 @@ function doAttachPo() {
                         addInvoiceItem(item);
                     }
                 );
+
+                doAttachPo(++idx);
             }
         }
     );

-----------------------------------------------------------------------

Summary of changes:
 Open-ILS/src/templates/acq/common/li_table.tt2     |    2 +
 .../web/js/ui/default/acq/common/inv_dialog.js     |   10 +++-
 Open-ILS/web/js/ui/default/acq/common/li_table.js  |   28 +++++++++++-
 Open-ILS/web/js/ui/default/acq/invoice/view.js     |   46 +++++++++++++------
 4 files changed, 68 insertions(+), 18 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list