From 2c4523d60d5b4d8c26ff3c87c5310ed2321ce6b7 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Wed, 29 Feb 2012 17:34:14 -0500 Subject: [PATCH] Acq+Vandelay : skip unneeded vandeley forms If all lineitems in question are linked to catalog records, avoid showing the unnecessary vandelay form. This was already true from the PO activation action, but this patch adds the same check to the create-po action from a selection list and PO 'load bibs and items'. Minor label change for consistency in li_table (Queue -> queue). Signed-off-by: Bill Erickson --- Open-ILS/src/templates/acq/common/li_table.tt2 | 2 +- Open-ILS/web/js/ui/default/acq/common/li_table.js | 33 ++++++++++++++++++----- Open-ILS/web/js/ui/default/acq/po/view_po.js | 14 +--------- 3 files changed, 28 insertions(+), 21 deletions(-) diff --git a/Open-ILS/src/templates/acq/common/li_table.tt2 b/Open-ILS/src/templates/acq/common/li_table.tt2 index 3a233519c3..3628b888dd 100644 --- a/Open-ILS/src/templates/acq/common/li_table.tt2 +++ b/Open-ILS/src/templates/acq/common/li_table.tt2 @@ -108,7 +108,7 @@ | requests - + 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 1f22340eb2..f29e28ed8a 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 @@ -2110,21 +2110,40 @@ function AcqLiTable() { this.showAssetCreator = function(onAssetsCreated) { if(!this.isPO) return; - this.show('asset-creator'); - if(!this.vlAgent.loaded) - this.vlAgent.init(); var self = this; - dojo.connect(assetCreatorButton, 'onClick', - function() { self.createAssets(onAssetsCreated) }); + + // first, let's see if this PO has any LI's that need to be merged/imported + self.pcrud.search('jub', {purchase_order : this.isPO, eg_bib_id : null}, { + id_list : true, + oncomplete : function(r) { + var resp = openils.Util.readResponse(r); + if (resp && resp.length) { + // PO has some non-linked jubs. + + self.show('asset-creator'); + if(!self.vlAgent.loaded) + self.vlAgent.init(); + + dojo.connect(assetCreatorButton, 'onClick', + function() { self.createAssets(onAssetsCreated) }); + + } else { + + // all jubs linked, move on to asset creation + self.createAssets(onAssetsCreated, true); + } + } + }); } - this.createAssets = function(onAssetsCreated) { + this.createAssets = function(onAssetsCreated, noVl) { this.show('acq-lit-progress-numbers'); var self = this; + var vlArgs = (noVl) ? {} : {vandelay : this.vlAgent.values()}; fieldmapper.standardRequest( ['open-ils.acq', 'open-ils.acq.purchase_order.assets.create'], { async: true, - params: [this.authtoken, this.isPO, {vandelay : this.vlAgent.values()}], + params: [this.authtoken, this.isPO, vlArgs], onresponse: function(r) { var resp = openils.Util.readResponse(r); self._updateProgressNumbers(resp, !Boolean(onAssetsCreated), onAssetsCreated); diff --git a/Open-ILS/web/js/ui/default/acq/po/view_po.js b/Open-ILS/web/js/ui/default/acq/po/view_po.js index 6c08ce1263..07c29e789c 100644 --- a/Open-ILS/web/js/ui/default/acq/po/view_po.js +++ b/Open-ILS/web/js/ui/default/acq/po/view_po.js @@ -513,19 +513,7 @@ function activatePo() { return false; } - // first, let's see if this PO has any LI's that need to be merged/imported - pcrud.search('jub', {purchase_order : poId, eg_bib_id : null}, { - id_list : true, - oncomplete : function(r) { - var resp = openils.Util.readResponse(r); - if (resp && resp.length) { - // kick off the merge/import process - liTable.showAssetCreator(activatePoStage2); - } else { - activatePoStage2(); - } - } - }); + liTable.showAssetCreator(activatePoStage2); } function activatePoStage2() { -- 2.11.0