[open-ils-commits] r12703 - in trunk/Open-ILS/web: js/ui/default/acq/common templates/default/acq/common (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Fri Mar 27 14:37:37 EDT 2009
Author: erickson
Date: 2009-03-27 14:37:33 -0400 (Fri, 27 Mar 2009)
New Revision: 12703
Modified:
trunk/Open-ILS/web/js/ui/default/acq/common/li_table.js
trunk/Open-ILS/web/templates/default/acq/common/li_table.tt2
Log:
plugged in more streamlined PO creation. added progress meter and status updates during PO creation
Modified: trunk/Open-ILS/web/js/ui/default/acq/common/li_table.js
===================================================================
--- trunk/Open-ILS/web/js/ui/default/acq/common/li_table.js 2009-03-27 18:36:49 UTC (rev 12702)
+++ trunk/Open-ILS/web/js/ui/default/acq/common/li_table.js 2009-03-27 18:37:33 UTC (rev 12703)
@@ -77,7 +77,10 @@
case 'copies':
openils.Util.show('acq-lit-li-details');
break;
- }
+ default:
+ if(div)
+ openils.Util.show(div);
+ }
}
this.hide = function() {
@@ -136,9 +139,6 @@
};
this.removeLineitem = function(liId) {
- console.log(liId);
- console.log('[li='+liId+']');
- console.log(dojo.query('[li='+liId+']', this.tbody)[0]);
this.tbody.removeChild(dojo.query('[li='+liId+']', this.tbody)[0]);
delete this.liCache[liId];
}
@@ -424,82 +424,39 @@
}
this._createPO = function(fields) {
+ this.show('acq-lit-create-po-progress');
var po = new fieldmapper.acqpo();
po.provider(this.createPoProviderSelector.attr('value'));
var selected = this.getSelected( (fields.create_from == 'all') );
- console.log("creating PO for " + selected.length + ' items');
if(selected.length == 0) return;
- openils.acq.PO.create(po, function(poId) { po.id(poId); self.postPoCreateActions(po, selected) });
- }
+ var max = selected.length * 3;
- this.postPoCreateActions = function(po, liList) {
- var self = this;
- var count = liList.length;
- var seen = 0;
- console.log("Created PO " + po.id());
-
- // Attach the lineitems to the PO
- dojo.forEach(liList,
- function(li) {
- console.log("updatig LI " + li.id());
- li.purchase_order(po.id());
- li.provider(po.provider());
- new openils.acq.Lineitem({lineitem:li}).update(
- function(stat) {
- console.log("LI update stat " + stat);
- if(++seen == count)
- self.createPoAssets(po);
- }
- );
- }
- );
- }
-
- this.createPoAssets = function(po) {
-
- console.log("creating PO assets");
-
- /*
- searchProgress.update({progress: 0});
- dojo.style('searchProgress', 'visibility', 'visible');
- */
-
- function onresponse(r) {
- openils.Util.readResponse(r);
- //searchProgress.update({maximum: stat.total, progress: stat.progress});
- }
-
- function oncomplete(r) {
- //dojo.style('searchProgress', 'visibility', 'hidden');
- self.createPoDebits(po);
- }
-
fieldmapper.standardRequest(
- ['open-ils.acq','open-ils.acq.purchase_order.assets.create'],
+ ['open-ils.acq', 'open-ils.acq.purchase_order.create'],
{ async: true,
- params: [openils.User.authtoken, po.id()],
- onresponse : onresponse,
- oncomplete : oncomplete
- }
- );
- }
-
- this.createPoDebits = function (po) {
- console.log("Creating PO debits");
- fieldmapper.standardRequest(
- ['open-ils.acq', 'open-ils.acq.purchase_order.debits.create'],
- { async: true,
- params: [openils.User.authtoken, po.id(), {encumbrance:true}],
- oncomplete : function(r) {
- openils.Util.readResponse(r);
- location.href = oilsBasePath + '/eg/acq/po/view/' + po.id();
+ params: [
+ openils.User.authtoken,
+ po,
+ {
+ lineitems : selected.map(function(li) { return li.id() }),
+ create_assets : true,
+ create_debits : true,
+ circ_modifier : 'book', /* XXX */
+ }
+ ],
+ onresponse : function(r) {
+ var resp = openils.Util.readResponse(r);
+ openils.Util.appendClear('acq-lit-po-encumbered', document.createTextNode(resp.total_debits));
+ openils.Util.appendClear('acq-lit-po-copies', document.createTextNode(resp.total_copies));
+ litPoTotalProgress.update({maximum:max, progress:resp.progress});
+ if(resp.complete)
+ location.href = oilsBasePath + '/eg/acq/po/view/' + resp.purchase_order;
}
}
);
}
-
this._deleteLiList = function(list, idx) {
if(idx == null) idx = 0;
Modified: trunk/Open-ILS/web/templates/default/acq/common/li_table.tt2
===================================================================
--- trunk/Open-ILS/web/templates/default/acq/common/li_table.tt2 2009-03-27 18:36:49 UTC (rev 12702)
+++ trunk/Open-ILS/web/templates/default/acq/common/li_table.tt2 2009-03-27 18:37:33 UTC (rev 12703)
@@ -176,6 +176,23 @@
</table>
</div>
+ <div class='hidden' id='acq-lit-create-po-progress'>
+ <table class='oils-generic-table'>
+ <tr>
+ <td>Encumbered Funds:</td>
+ <td><span id='acq-lit-po-encumbered'></span></td>
+ </tr>
+ <tr>
+ <td>Copies Created:</td>
+ <td><span id='acq-lit-po-copies'></span></td>
+ </tr>
+ <tr>
+ <td>Total Progress: </td>
+ <td><span dojoType="dijit.ProgressBar" style="width:300px" jsId="litPoTotalProgress"></span></td>
+ </tr>
+ </table>
+ </div>
+
<div class='hidden'>
<div dojoType='dijit.Dialog' jsId='acqLitPoCreateDialog'>
<table class='oils-generic-table'>
@@ -185,11 +202,11 @@
</tr>
<tr>
<td>All Lineitems</td>
- <td><button name='create_from' value='all' dojoType='dijit.form.RadioButton'/></td>
+ <td><input checked='checked' name='create_from' value='all' dojoType='dijit.form.RadioButton'/></td>
</tr>
<tr>
<td>Selected Lineitems</td>
- <td><button name='create_from' value='selected' dojoType='dijit.form.RadioButton'/></td>
+ <td><input name='create_from' value='selected' dojoType='dijit.form.RadioButton'/></td>
</tr>
<tr>
<td colspan='2'>
More information about the open-ils-commits
mailing list