[open-ils-commits] r10110 - in
branches/acq-experiment/Open-ILS/web: js/dojo/openils/acq
oilsweb/oilsweb/public/oils/media/ui_js/oils/default/acq/picklist
oilsweb/oilsweb/public/oils/media/ui_js/oils/default/acq/po
oilsweb/oilsweb/public/oils/media/ui_js/oils/default/common
oilsweb/oilsweb/templates/oils/default/acq/po
svn at svn.open-ils.org
svn at svn.open-ils.org
Thu Jul 24 10:59:59 EDT 2008
Author: erickson
Date: 2008-07-24 10:59:53 -0400 (Thu, 24 Jul 2008)
New Revision: 10110
Modified:
branches/acq-experiment/Open-ILS/web/js/dojo/openils/acq/Lineitems.js
branches/acq-experiment/Open-ILS/web/js/dojo/openils/acq/Picklist.js
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/acq/picklist/bib_search.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/public/oils/media/ui_js/oils/default/acq/po/view_po.js
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/common/jubgrid.js
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/view_po.html
Log:
changed openils.acq.Lineitems to openils.acq.Lineitem to match the object name (and singular case-ness of the other objects). added some initial fund encumberance UI code
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-07-24 14:18:31 UTC (rev 10109)
+++ branches/acq-experiment/Open-ILS/web/js/dojo/openils/acq/Lineitems.js 2008-07-24 14:59:53 UTC (rev 10110)
@@ -14,9 +14,9 @@
* ---------------------------------------------------------------------------
*/
-if(!dojo._hasResource['openils.acq.Lineitems']) {
-dojo._hasResource['openils.acq.Lineitems'] = true;
-dojo.provide('openils.acq.Lineitems');
+if(!dojo._hasResource['openils.acq.Lineitem']) {
+dojo._hasResource['openils.acq.Lineitem'] = true;
+dojo.provide('openils.acq.Lineitem');
dojo.require('dojo.data.ItemFileWriteStore');
dojo.require('dojox.grid.Grid');
@@ -25,8 +25,8 @@
dojo.require('openils.User');
dojo.require('openils.Event');
-/** Declare the Lineitems class with dojo */
-dojo.declare('openils.acq.Lineitems', null, {
+/** Declare the Lineitem class with dojo */
+dojo.declare('openils.acq.Lineitem', null, {
/* add instance methods here if necessary */
constructor: function(args) {
@@ -102,10 +102,10 @@
},
});
-openils.acq.Lineitems.ModelCache = {};
-openils.acq.Lineitems.acqlidCache = {};
+openils.acq.Lineitem.ModelCache = {};
+openils.acq.Lineitem.acqlidCache = {};
-openils.acq.Lineitems.createStore = function(li_id, onComplete) {
+openils.acq.Lineitem.createStore = function(li_id, onComplete) {
// Fetches the details of a lineitem and builds a grid
function mkStore(r) {
@@ -116,7 +116,7 @@
for (i in data.lineitem_details()) {
var lid = data.lineitem_details()[i];
items.push(lid);
- openils.acq.Lineitems.acqlidCache[lid.id()] = lid;
+ openils.acq.Lineitem.acqlidCache[lid.id()] = lid;
}
}
@@ -132,7 +132,7 @@
});
};
-openils.acq.Lineitems.alertOnLIDSet = function(griditem, attr, oldVal, newVal) {
+openils.acq.Lineitem.alertOnLIDSet = function(griditem, attr, oldVal, newVal) {
var item;
var updateDone = function(r) {
var stat = r.recv().content();
@@ -155,7 +155,7 @@
return;
}
- item = openils.acq.Lineitems.acqlidCache[griditem.id];
+ item = openils.acq.Lineitem.acqlidCache[griditem.id];
if (attr == "fund") {
item.fund(newVal);
@@ -168,7 +168,7 @@
} else if (attr == "location") {
item.location(newVal);
} else {
- alert("Unexpected attr in Lineitems.alertOnSet: '"+attr+"'");
+ alert("Unexpected attr in Lineitem.alertOnSet: '"+attr+"'");
return;
}
@@ -179,7 +179,7 @@
});
};
-openils.acq.Lineitems.deleteLID = function(id, onComplete) {
+openils.acq.Lineitem.deleteLID = function(id, onComplete) {
fieldmapper.standardRequest(
['open-ils.acq', 'open-ils.acq.lineitem_detail.delete'],
{ async: true,
@@ -192,7 +192,7 @@
});
};
-openils.acq.Lineitems.createLID = function(fields, onCreateComplete) {
+openils.acq.Lineitem.createLID = function(fields, onCreateComplete) {
var lid = new acqlid()
for (var field in fields) {
lid[field](fields[field]);
@@ -213,24 +213,24 @@
});
};
-openils.acq.Lineitems.loadGrid = function(domNode, id, layout) {
- if (!openils.acq.Lineitems.ModelCache[id]) {
- openils.acq.Lineitems.createStore(id,
+openils.acq.Lineitem.loadGrid = function(domNode, id, layout) {
+ if (!openils.acq.Lineitem.ModelCache[id]) {
+ openils.acq.Lineitem.createStore(id,
function(storeData) {
var store = new dojo.data.ItemFileWriteStore({data:storeData});
var model = new dojox.grid.data.DojoData(null, store,
{rowsPerPage: 20, clientSort:true, query:{id:'*'}});
dojo.connect(store, "onSet",
- openils.acq.Lineitems.alertOnLIDSet);
- openils.acq.Lineitems.ModelCache[id] = model;
+ openils.acq.Lineitem.alertOnLIDSet);
+ openils.acq.Lineitem.ModelCache[id] = model;
domNode.setStructure(layout);
domNode.setModel(model);
domNode.update();
});
} else {
- domNode.setModel(openils.acq.Lineitems.ModelCache[id]);
+ domNode.setModel(openils.acq.Lineitem.ModelCache[id]);
domNode.setStructure(layout);
domNode.update();
domNode.refresh();
Modified: branches/acq-experiment/Open-ILS/web/js/dojo/openils/acq/Picklist.js
===================================================================
--- branches/acq-experiment/Open-ILS/web/js/dojo/openils/acq/Picklist.js 2008-07-24 14:18:31 UTC (rev 10109)
+++ branches/acq-experiment/Open-ILS/web/js/dojo/openils/acq/Picklist.js 2008-07-24 14:59:53 UTC (rev 10110)
@@ -113,7 +113,7 @@
var res = r.recv().content();
if(e = openils.Event.parse(res))
return alert(e);
- var oldVal = new openils.acq.Lineitems(
+ var oldVal = new openils.acq.Lineitem(
{lineitem:item}).findAttr(attr, 'lineitem_local_attr_definition');
if(oldVal) {
// if this attr already exists on the object, just update the value
Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/acq/picklist/bib_search.js
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/acq/picklist/bib_search.js 2008-07-24 14:18:31 UTC (rev 10109)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/acq/picklist/bib_search.js 2008-07-24 14:59:53 UTC (rev 10110)
@@ -6,7 +6,7 @@
dojo.require('dijit.form.NumberSpinner');
dojo.require('openils.Event');
dojo.require('openils.acq.Picklist');
-dojo.require('openils.acq.Lineitems');
+dojo.require('openils.acq.Lineitem');
dojo.require('openils.User');
var searchFields = [];
@@ -194,7 +194,7 @@
return oncomplete();
var li = selectedLIs[idx];
li.picklist(pl);
- new openils.acq.Lineitems({lineitem:li}).update(
+ new openils.acq.Lineitem({lineitem:li}).update(
function(r) {
updateLiList(pl, list, ++idx, oncomplete);
}
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-07-24 14:18:31 UTC (rev 10109)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/acq/po/li_search.js 2008-07-24 14:59:53 UTC (rev 10110)
@@ -7,14 +7,14 @@
dojo.require('dijit.form.Button');
dojo.require("dijit.Dialog");
dojo.require('openils.Event');
-dojo.require('openils.acq.Lineitems');
+dojo.require('openils.acq.Lineitem');
dojo.require('openils.acq.Provider');
dojo.require('openils.acq.PO');
dojo.require('openils.widget.OrgUnitFilteringSelect');
var recvCount = 0;
-var user = new openils.User();
var createAssetsSelected = false;
+var createDebitsSelected = false;
var lineitems = [];
@@ -57,7 +57,7 @@
fieldmapper.standardRequest(
['open-ils.acq', 'open-ils.acq.lineitem.search'],
{ async: true,
- params: [user.authtoken, search, options],
+ params: [openils.User.authtoken, search, options],
onresponse: handleResult,
oncomplete: viewList
}
@@ -73,7 +73,9 @@
function viewList() {
dojo.style('searchProgress', 'visibility', 'hidden');
dojo.style('oils-acq-li-search-result-grid', 'visibility', 'visible');
- var store = new dojo.data.ItemFileReadStore({data:jub.toStoreData(lineitems)});
+ var store = new dojo.data.ItemFileReadStore(
+ {data:jub.toStoreData(lineitems, null,
+ {virtualFields:['estimated_price', 'actual_price']})});
var model = new dojox.grid.data.DojoData(
null, store, {rowsPerPage: 20, clientSort: true, query:{id:'*'}});
JUBGrid.populate(liGrid, model, lineitems)
@@ -83,6 +85,7 @@
var po = new acqpo()
po.provider(newPOProviderSelector.getValue());
createAssetsSelected = fields.create_assets;
+ createDebitsSelected = fields.create_debits;
// find the selected lineitems
var selected = liGrid.selection.getSelected();
@@ -114,6 +117,23 @@
_updateLiList(poId, selList, 0);
}
+function checkCreateDebits(poId) {
+ if(!createDebitsSelected)
+ return viewPO(poId);
+ fieldmapper.standardRequest(
+ ['open-ils.acq', 'open-ils.acq.purchase_order.debits.create'],
+ { async: true,
+ params: [openils.User.authtoken, poId, {encumbrance:1}],
+ oncomplete : function(r) {
+ var total = r.recv().content();
+ if(e = openils.Event.parse(total))
+ return alert(e);
+ viewPO(poId);
+ }
+ }
+ );
+}
+
function viewPO(poId) {
location.href = 'view/' + poId;
}
@@ -128,7 +148,7 @@
var li = selList[idx];
li.purchase_order(poId);
li.state('in-process');
- new openils.acq.Lineitems({lineitem:li}).update(
+ new openils.acq.Lineitem({lineitem:li}).update(
function(stat) {
_updateLiList(poId, selList, ++idx);
}
@@ -140,7 +160,7 @@
['open-ils.acq','open-ils.acq.purchase_order.assets.create'],
{
async: true,
- params: [user.authtoken, poId],
+ params: [openils.User.authtoken, poId],
oncomplete : function(r) {
if(e = openils.Event.parse(r.recv().content()))
alert(e);
Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/acq/po/view_po.js
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/acq/po/view_po.js 2008-07-24 14:18:31 UTC (rev 10109)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/acq/po/view_po.js 2008-07-24 14:59:53 UTC (rev 10110)
@@ -8,7 +8,7 @@
dojo.require('openils.User');
dojo.require('fieldmapper.OrgUtils');
dojo.require('openils.acq.Provider');
-dojo.require('openils.acq.Lineitems');
+dojo.require('openils.acq.Lineitem');
dojo.require('dojo.date.locale');
dojo.require('dojo.date.stamp');
Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/common/jubgrid.js
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/common/jubgrid.js 2008-07-24 14:18:31 UTC (rev 10109)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/common/jubgrid.js 2008-07-24 14:59:53 UTC (rev 10110)
@@ -7,7 +7,7 @@
dojo.require("openils.User");
dojo.require("openils.acq.Fund");
-dojo.require("openils.acq.Lineitems");
+dojo.require("openils.acq.Lineitem");
dojo.require('openils.acq.Provider');
dojo.require("openils.widget.FundSelector");
dojo.require('openils.editors');
@@ -33,7 +33,7 @@
_getMARCAttr : function(rowIndex, attr) {
var data = JUBGrid.jubGrid.model.getRow(rowIndex);
if (!data) return '';
- return new openils.acq.Lineitems(
+ return new openils.acq.Lineitem(
{lineitem:JUBGrid.getLi(data.id)}).findAttr(attr, 'lineitem_marc_attr_definition')
},
getJUBTitle : function(rowIndex) {
@@ -48,7 +48,7 @@
getJUBActualPrice : function(rowIndex) {
var data = JUBGrid.jubGrid.model.getRow(rowIndex);
if (!data) return '';
- var price = new openils.acq.Lineitems(
+ var price = new openils.acq.Lineitem(
{lineitem:JUBGrid.getLi(data.id)}).getActualPrice();
if(price) return price.price;
return ''
@@ -56,7 +56,7 @@
getJUBEstimatedPrice : function(rowIndex) {
var data = JUBGrid.jubGrid.model.getRow(rowIndex);
if (!data) return '';
- var price = new openils.acq.Lineitems(
+ var price = new openils.acq.Lineitem(
{lineitem:JUBGrid.getLi(data.id)}).getEstimatedPrice();
if(price) return price.price;
return ''
@@ -122,7 +122,7 @@
} else {
grid = JUBGrid.jubDetailGridLayout;
}
- openils.acq.Lineitems.loadGrid(
+ openils.acq.Lineitem.loadGrid(
JUBGrid.jubDetailGrid,
JUBGrid.jubGrid.model.getRow(evt.rowIndex).id, grid);
}
@@ -138,7 +138,7 @@
for (var idx = 0; idx < selected.length; idx++) {
var rowIdx = selected[idx];
var jub = JUBGrid.jubGrid.model.getRow(rowIdx);
- var li = new openils.acq.Lineitems({lineitem:JUBGrid.getLi(jub.id)});
+ var li = new openils.acq.Lineitem({lineitem:JUBGrid.getLi(jub.id)});
var approveStore = function(evt) {
if (evt) {
// something bad happened
@@ -152,7 +152,7 @@
"approved");
JUBGrid.jubGrid.update();
// Reload lineitem details, read-only
- openils.acq.Lineitems.loadGrid(
+ openils.acq.Lineitem.loadGrid(
JUBGrid.jubDetailGrid, li.id(),
JUBGrid.jubDetailGridLayoutReadOnly);
};
@@ -243,7 +243,7 @@
JUBGrid.jubDetailGrid.update();
};
- openils.acq.Lineitems.deleteLID(lid.id, deleteFromStore);
+ openils.acq.Lineitem.deleteLID(lid.id, deleteFromStore);
}
},
@@ -255,7 +255,7 @@
JUBGrid.jubGrid.update();
JUBGrid.jubGrid.refresh();
}
- openils.acq.Lineitems.createLID(fields, addToStore);
+ openils.acq.Lineitem.createLID(fields, addToStore);
},
};
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-07-24 14:18:31 UTC (rev 10109)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/po/li_search.html 2008-07-24 14:59:53 UTC (rev 10110)
@@ -83,6 +83,12 @@
</td>
</tr>
<tr>
+ <td><label for="create_debits">${_('Encumber funds')}</label></td>
+ <td>
+ <input name='create_debits' dojoType='dijit.form.CheckBox'> </input>
+ </td>
+ </tr>
+ <tr>
<td colspan='2' align='center'>
<button dojoType=dijit.form.Button type="submit">${_('Create')}</button>
</td>
Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/po/view_po.html
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/po/view_po.html 2008-07-24 14:18:31 UTC (rev 10109)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/po/view_po.html 2008-07-24 14:59:53 UTC (rev 10110)
@@ -9,7 +9,7 @@
var poId = ${c.oils.acq.po_id.value};
</script>
<script src='${c.oils.core.media_prefix.value}/ui_js/oils/default/acq/po/view_po.js'> </script>
-<script src='${c.oils.core.media_prefix.value}/js/dojo/openils/acq/Lineitems.js'> </script>
+<script src='${c.oils.core.media_prefix.value}/js/dojo/openils/acq/Lineitem.js'> </script>
<div id='oils-acq-list-header' class='container'>
<div id='oils-acq-list-header-label'>${_('PO Details')}</div>
More information about the open-ils-commits
mailing list