[open-ils-commits] r9662 - in branches/acq-experiment/Open-ILS/web:
js/dojo/openils/acq
oilsweb/oilsweb/public/oils/media/ui_js/oils/default/acq/po
oilsweb/oilsweb/templates/oils/default/acq/po
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed May 21 22:28:11 EDT 2008
Author: erickson
Date: 2008-05-21 22:28:09 -0400 (Wed, 21 May 2008)
New Revision: 9662
Modified:
branches/acq-experiment/Open-ILS/web/js/dojo/openils/acq/Lineitems.js
branches/acq-experiment/Open-ILS/web/js/dojo/openils/acq/PO.js
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 rudimentary po creation from lineitem search.
Modified: branches/acq-experiment/Open-ILS/web/js/dojo/openils/acq/Lineitems.js
===================================================================
--- branches/acq-experiment/Open-ILS/web/js/dojo/openils/acq/Lineitems.js 2008-05-22 02:26:55 UTC (rev 9661)
+++ branches/acq-experiment/Open-ILS/web/js/dojo/openils/acq/Lineitems.js 2008-05-22 02:28:09 UTC (rev 9662)
@@ -22,6 +22,7 @@
dojo.require('dojox.grid.Grid');
dojo.require('dojox.grid._data.model');
dojo.require('fieldmapper.dojoData');
+dojo.require('openils.User');
/** Declare the Lineitems class with dojo */
dojo.declare('openils.acq.Lineitems', null, {
@@ -39,6 +40,18 @@
if (attr.attr_type() == type && attr.attr_name() == name)
return attr.attr_value();
}
+ },
+
+ update: function(oncomplete) {
+ fieldmapper.standardRequest(
+ ['open-ils.acq', 'open-ils.acq.lineitem.update'],
+ { async: true,
+ params: [openils.User.authtoken, this.lineitem],
+ oncomplete: function(r) {
+ oncomplete(r.recv().content())
+ }
+ }
+ );
}
});
Modified: branches/acq-experiment/Open-ILS/web/js/dojo/openils/acq/PO.js
===================================================================
--- branches/acq-experiment/Open-ILS/web/js/dojo/openils/acq/PO.js 2008-05-22 02:26:55 UTC (rev 9661)
+++ branches/acq-experiment/Open-ILS/web/js/dojo/openils/acq/PO.js 2008-05-22 02:28:09 UTC (rev 9662)
@@ -49,6 +49,24 @@
fieldmapper.standardRequest(req, par);
}
}
+
+ openils.acq.PO.create = function(po, oncomplete) {
+ var req = ['open-ils.acq', 'open-ils.acq.purchase_order.create'];
+ var par = [openils.User.authtoken, po];
+
+ fieldmapper.standardRequest(
+ req,
+ { params: par,
+ async: true,
+ oncomplete: function(r) {
+ var po_id = r.recv().content();
+ po.id(po_id);
+ openils.acq.PO.cache[po_id] = po;
+ oncomplete(po_id);
+ }
+ }
+ );
+ }
};
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-05-22 02:26:55 UTC (rev 9661)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/acq/po/li_search.js 2008-05-22 02:28:09 UTC (rev 9662)
@@ -3,9 +3,13 @@
dojo.require('dijit.form.Form');
dojo.require('dijit.form.TextBox');
dojo.require('dijit.form.FilteringSelect');
+dojo.require('dijit.form.Button');
+dojo.require("dijit.Dialog");
dojo.require('openils.Event');
dojo.require('openils.acq.Lineitems');
dojo.require('openils.acq.Provider');
+dojo.require('openils.acq.PO');
+dojo.require('openils.widget.OrgUnitFilteringSelect');
var recvCount = 0;
var user = new openils.User();
@@ -13,10 +17,15 @@
var lineitems = [];
function drawForm() {
+ buildProviderSelect(providerSelector);
+}
+
+function buildProviderSelect(sel, oncomplete) {
openils.acq.Provider.createStore(
function(store) {
- providerSelector.store =
- new dojo.data.ItemFileReadStore({data:store});
+ sel.store = new dojo.data.ItemFileReadStore({data:store});
+ if(oncomplete)
+ oncomplete();
},
'MANAGE_PROVIDER'
);
@@ -31,7 +40,8 @@
search[v] = val;
}
- search = [search, {limit:searchLimit, offset:searchOffset}];
+ //search = [search, {limit:searchLimit, offset:searchOffset}];
+ search = [search, {}];
options = {clear_marc:1, flesh_attrs:1};
liReceived = 0;
@@ -106,4 +116,31 @@
{lineitem:getLi(data.id)}).findAttr('price', 'lineitem_marc_attr_definition')
}
+function createPOFromLineitems() {
+ var po = new acqpo()
+ po.provider(newPOProviderSelector.getValue());
+ openils.acq.PO.create(po,
+ function(poId) {
+ updateLiList(poId);
+ }
+ );
+}
+
+function updateLiList(poId) {
+ _updateLiList(poId, 0);
+}
+
+function _updateLiList(poId, idx) {
+ if(idx >= lineitems.length)
+ return location.href = 'view/' + poId;
+ var li = lineitems[idx];
+ li.purchase_order(poId);
+ new openils.acq.Lineitems({lineitem:li}).update(
+ function(stat) {
+ _updateLiList(poId, ++idx);
+ }
+ );
+}
+
+
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-05-22 02:26:55 UTC (rev 9661)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/po/li_search.html 2008-05-22 02:28:09 UTC (rev 9662)
@@ -25,13 +25,53 @@
labalAttr='code' searchAttr='code' jsId='providerSelector'>
</select>
<div dojoType='dijit.form.Button' type='submit'>${_("Search")}</div>
- </div>
- </form>
+ </form>
+ </div>
+
<div id='oils-acq-li-search-progress'>
<div dojoType="dijit.ProgressBar" style="width:300px" jsId="searchProgress" id="searchProgress"></div>
</div>
<script>dojo.style('searchProgress', 'visibility', 'hidden');</script>
+ <div dojoType="dijit.form.DropDownButton">
+ <span>${('Create PO')}</span>
+ <div dojoType="dijit.TooltipDialog" execute="createPOFromLineitems(arguments[0]);">
+ <script type='dojo/connect' event='onOpen'>
+ buildProviderSelect(newPOProviderSelector,
+ function() {
+ newPOProviderSelector.setValue(providerSelector.getValue());
+ }
+ );
+ new openils.User().buildPermOrgSelector('CREATE_PURCHASE_ORDER', orderingAgencySelect);
+ </script>
+ <table class='dijitTooltipTable'>
+ <tr>
+ <td><label for="name">${_('Provider:')} </label></td>
+ <td>
+ <input jsId='newPOProviderSelector' name="provider"
+ dojoType="dijit.form.FilteringSelect" searchAttr='code' labelAttr='code'>
+ </td>
+ </tr>
+ <tr>
+ <td><label for="name">${_('Ordering Agency:')}</label></td>
+ <td>
+ <input dojoType="openils.widget.OrgUnitFilteringSelect" jsId='orderingAgencySelect'
+ searchAttr="shortname" name="ordering_agency" autocomplete="true" labelAttr='shortname'> </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>
+ </tr>
+ </table>
+ </div>
+ </div>
+
+
<script>
var liGridStructure = [{
cells: [[
More information about the open-ils-commits
mailing list