From: erickson Date: Mon, 23 Jun 2008 02:58:50 +0000 (+0000) Subject: changed PO create button to only create POs on selected titles X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=5259838adbff7b52a8226a86018e4dee03bdd3e9;p=Evergreen.git changed PO create button to only create POs on selected titles git-svn-id: svn://svn.open-ils.org/ILS/branches/acq-experiment@9911 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/acq/po/li_search.js b/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/acq/po/li_search.js index 1393960bc6..20238aaca3 100644 --- a/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/acq/po/li_search.js +++ b/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/acq/po/li_search.js @@ -80,25 +80,40 @@ function viewList() { function createPOFromLineitems() { var po = new acqpo() po.provider(newPOProviderSelector.getValue()); + + // find the selected lineitems + var selected = liGrid.selection.getSelected(); + var selList = []; + for(var idx = 0; idx < selected.length; idx++) { + var rowIdx = selected[idx]; + var id = liGrid.model.getRow(rowIdx).id; + for(var i = 0; i < lineitems.length; i++) { + if(lineitems[i].id() == id) + selList.push(lineitems[i]); + } + } + openils.acq.PO.create(po, function(poId) { - updateLiList(poId); + updateLiList(poId, selList); } ); } -function updateLiList(poId) { - _updateLiList(poId, 0); +function updateLiList(poId, selList) { + _updateLiList(poId, selList, 0); } -function _updateLiList(poId, idx) { - if(idx >= lineitems.length) +function _updateLiList(poId, selList, idx) { + if(idx >= selList.length) return location.href = 'view/' + poId; - var li = lineitems[idx]; + var li = selList[idx]; + if(li.purchase_order()) + return _updateLiList(poId, selList, ++idx); li.purchase_order(poId); new openils.acq.Lineitems({lineitem:li}).update( function(stat) { - _updateLiList(poId, ++idx); + _updateLiList(poId, selList, ++idx); } ); } diff --git a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/po/li_search.html b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/po/li_search.html index e5ca85ae81..340a3039f4 100644 --- a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/po/li_search.html +++ b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/po/li_search.html @@ -50,7 +50,7 @@
- ${('Create PO')} + ${('Create PO From Selected Titles')}