[open-ils-commits] r9917 - in
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb:
public/oils/media/ui_js/oils/default/acq/po
templates/oils/default/acq/po
svn at svn.open-ils.org
svn at svn.open-ils.org
Mon Jun 23 00:29:22 EDT 2008
Author: erickson
Date: 2008-06-23 00:29:20 -0400 (Mon, 23 Jun 2008)
New Revision: 9917
Modified:
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/acq/po/li_search.js
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/po/li_search.html
Log:
added option to generate bibs/volumes/copies at PO creation time. needs more error handling
also not very useful until we can add barcodes, callnumber labels, and shelving locations
via UI or automatically
fixed typo state => state()
Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/acq/po/li_search.js
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/acq/po/li_search.js 2008-06-23 03:48:41 UTC (rev 9916)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/acq/po/li_search.js 2008-06-23 04:29:20 UTC (rev 9917)
@@ -2,6 +2,7 @@
dojo.require('dijit.ProgressBar');
dojo.require('dijit.form.Form');
dojo.require('dijit.form.TextBox');
+dojo.require('dijit.form.CheckBox');
dojo.require('dijit.form.FilteringSelect');
dojo.require('dijit.form.Button');
dojo.require("dijit.Dialog");
@@ -13,6 +14,7 @@
var recvCount = 0;
var user = new openils.User();
+var createAssetsSelected = false;
var lineitems = [];
@@ -77,9 +79,10 @@
JUBGrid.populate(liGrid, model, lineitems)
}
-function createPOFromLineitems() {
+function createPOFromLineitems(fields) {
var po = new acqpo()
po.provider(newPOProviderSelector.getValue());
+ createAssetsSelected = fields.create_assets;
// find the selected lineitems
var selected = liGrid.selection.getSelected();
@@ -89,7 +92,7 @@
var id = liGrid.model.getRow(rowIdx).id;
for(var i = 0; i < lineitems.length; i++) {
var li = lineitems[i];
- if(li.id() == id && !li.purchase_order() && li.state == 'approved')
+ if(li.id() == id && !li.purchase_order() && li.state() == 'approved')
selList.push(lineitems[i]);
}
}
@@ -98,6 +101,10 @@
openils.acq.PO.create(po,
function(poId) {
+ if(e = openils.Event.parse(poId)) {
+ alert(e);
+ return;
+ }
updateLiList(poId, selList);
}
);
@@ -107,17 +114,43 @@
_updateLiList(poId, selList, 0);
}
+function viewPO(poId) {
+ location.href = 'view/' + poId;
+}
+
function _updateLiList(poId, selList, idx) {
- if(idx >= selList.length)
- return location.href = 'view/' + poId;
+ if(idx >= selList.length) {
+ if(createAssetsSelected)
+ return createAssets(poId);
+ else
+ return viewPo(poId);
+ }
var li = selList[idx];
li.purchase_order(poId);
+ li.state('in-process');
new openils.acq.Lineitems({lineitem:li}).update(
function(stat) {
_updateLiList(poId, selList, ++idx);
}
);
}
+
+function createAssets(poId) {
+ fieldmapper.standardRequest(
+ ['open-ils.acq','open-ils.acq.purchase_order.assets.create'],
+ {
+ async: true,
+ params: [user.authtoken, poId],
+ oncomplete : function(r) {
+ if(e = openils.Event.parse(r.recv().content()))
+ alert(e);
+ else
+ viewPO(poId);
+ }
+ }
+ );
+}
dojo.addOnLoad(drawForm);
+
Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/po/li_search.html
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/po/li_search.html 2008-06-23 03:48:41 UTC (rev 9916)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/po/li_search.html 2008-06-23 04:29:20 UTC (rev 9917)
@@ -76,18 +76,13 @@
searchAttr="shortname" name="ordering_agency" autocomplete="true" labelAttr='shortname'> </input>
</td>
</tr>
- <!--
<tr>
- <td><label for="name2">${_('Ordering Agency2:')}</label></td>
+ <td><label for="create_assets">${_('Generate Bib/Copy Data')}</label></td>
<td>
- <input id='treee'> </input>
+ <input name='create_assets' dojoType='dijit.form.CheckBox'> </input>
</td>
</tr>
- -->
<tr>
- <td colspan='2'>more creation options...</td>
- </tr>
- <tr>
<td colspan='2' align='center'>
<button dojoType=dijit.form.Button type="submit">${_('Create')}</button>
</td>
More information about the open-ils-commits
mailing list