[open-ils-commits] r10035 - in
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb:
public/oils/media/ui_js/oils/default/common
templates/oils/default/common
svn at svn.open-ils.org
svn at svn.open-ils.org
Mon Jul 14 20:10:52 EDT 2008
Author: djfiander
Date: 2008-07-14 20:10:52 -0400 (Mon, 14 Jul 2008)
New Revision: 10035
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/templates/oils/default/common/jubgrid.html
Log:
Can now approve JUBs and delete lineitem_details.
Also I18N'd jubgrid
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-15 00:06:59 UTC (rev 10034)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/common/jubgrid.js 2008-07-15 00:10:52 UTC (rev 10035)
@@ -83,6 +83,7 @@
if (!data || !data.owning_lib) return;
return fieldmapper.aou.findOrgUnit(data.owning_lib).shortname();
},
+
populate : function(gridWidget, model, lineitems) {
for (var i in lineitems) {
JUBGrid.lineitems[lineitems[i].id()] = lineitems[i];
@@ -119,19 +120,31 @@
var rowIdx = selected[idx];
var jub = JUBGrid.jubGrid.model.getRow(rowIdx);
var li = new openils.acq.Lineitems({lineitem:JUBGrid.getLi(jub.id)});
- var approveStore = function() {
- var approveACQLI = function(jub, rq) {
- JUBGrid.jubGrid.model.store.setValue(jub,
- "state", "approved");
- };
- JUBGrid.jubGrid.model.store.fetch({query:{id:jub.id},
- onItem: approveACQLI});
+ var approveStore = function(evt) {
+ if (evt) {
+ // something bad happened
+ console.log("jubgrid.js: approveJUB: error:");
+ console.dir(evt);
+ alert("Error: "+evt.desc);
+ } else {
+ var approveACQLI = function(jub, rq) {
+ JUBGrid.jubGrid.model.store.setValue(jub,
+ "state",
+ "approved");
+ JUBGrid.jubGrid.update();
+ // Reload lineitem details, read-only
+ openils.acq.Lineitems.loadGrid(
+ JUBGrid.jubDetailGrid, li.id(),
+ JUBGrid.jubDetailGridLayoutReadOnly);
+ };
+
+ JUBGrid.jubGrid.model.store.fetch({query:{id:jub.id},
+ onItem: approveACQLI});
+ }
};
- li.setState("approved", approveStore);
+ li.approve(approveStore);
}
-
- JUBGrid.jubGrid.update();
},
deleteLID: function(evt) {
@@ -140,25 +153,30 @@
for (var idx = 0; idx < selected.length; idx++) {
var rowIdx = selected[idx];
var lid = JUBGrid.jubDetailGrid.model.getRow(rowIdx);
- var deleteFromStore = function () {
- var deleteItem = function(item, rq) {
- JUBGrid.jubDetailGrid.model.store.deleteItem(item);
- };
- JUBGrid.jubDetailGrid.model.store.fetch({query:{id:lid.id},
- onItem: deleteItem});
- };
+ var deleteFromStore = function (evt) {
- openils.acq.Lineitems.deleteLID(lid.id, deleteFromStore);
- JUBGrid.jubDetailGrid.update();
+ if (evt) {
+ // something bad happened
+ alert("Error: "+evt.desc);
+ } else {
+ var deleteItem = function(item, rq) {
+ JUBGrid.jubDetailGrid.model.store.deleteItem(item);
+ };
+ var updateCount = function(item) {
+ var newval = JUBGrid.jubGrid.model.store.getValue(item, "item_count");
+ JUBGrid.jubGrid.model.store.setValue(item, "item_count", newval-1);
+ JUBGrid.jubGrid.update();
+ };
- var updateCount = function(item) {
- var newval = JUBGrid.jubGrid.model.store.getValue(item, "item_count");
- JUBGrid.jubGrid.model.store.setValue(item, "item_count", newval-1);
- JUBGrid.jubGrid.update();
+ JUBGrid.jubDetailGrid.model.store.fetch({query:{id:lid.id},
+ onItem: deleteItem});
+ JUBGrid.jubGrid.model.store.fetch({query:{id:JUBGrid.jubDetailGrid.lineitemID},
+ onItem: updateCount});
+ }
+ JUBGrid.jubDetailGrid.update();
};
- JUBGrid.jubGrid.model.store.fetch({query:{id:JUBGrid.jubDetailGrid.lineitemID},
- onItem: updateCount});
+ openils.acq.Lineitems.deleteLID(lid.id, deleteFromStore);
}
},
@@ -166,6 +184,7 @@
fields['lineitem'] = JUBGrid.jubDetailGrid.lineitemID;
var addToStore = function () {
JUBGrid.jubDetailGrid.model.store.newItem(fields);
+ JUBGrid.jubDetailGrid.refresh();
JUBGrid.jubGrid.update();
JUBGrid.jubGrid.refresh();
}
Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/common/jubgrid.html
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/common/jubgrid.html 2008-07-15 00:06:59 UTC (rev 10034)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/common/jubgrid.html 2008-07-15 00:10:52 UTC (rev 10035)
@@ -53,16 +53,16 @@
}
JUBGrid.jubGridLayout = [{
cells: [[
- {name: "ID", field: 'id'},
- {name: "Title", width: "auto", get:JUBGrid.getJUBTitle},
- {name: "Author", get:JUBGrid.getJUBAuthor},
- {name: "ISBN", get:JUBGrid.getJUBIsbn},
+ {name: '${_(ID)}', field: 'id'},
+ {name: '${_(Title)}', width: "auto", get:JUBGrid.getJUBTitle},
+ {name: '${_(Author)}', get:JUBGrid.getJUBAuthor},
+ {name: '${_(ISBN)}', get:JUBGrid.getJUBIsbn},
{name: '${_("Pubdate")}', get:JUBGrid.getJUBPubdate},
- {name: "Price", get:JUBGrid.getJUBPrice},
- {name: "Vendor", get:JUBGrid.getProvider},
- {name: "# Copies", field: 'item_count'},
- {name: "State", field: 'state'},
- {name: "PO", get:JUBGrid.getPO}
+ {name: '${_("Price")}', get:JUBGrid.getJUBPrice},
+ {name: '${_(Vendor)}', get:JUBGrid.getProvider},
+ {name: '${_(# Copies)}', field: 'item_count'},
+ {name: '${_(State)}', field: 'state'},
+ {name: '${_(PO)}', get:JUBGrid.getPO}
]]
}];
@@ -94,11 +94,11 @@
JUBGrid.jubDetailGridLayoutReadOnly = [{
cells: [[
- {name:"ID", field:"id"},
- {name:"Fund", field:"fund",
+ {name:'${_(ID)}', field:"id"},
+ {name:'${_(Fund)}', field:"fund",
get:JUBGrid.getLIDFundCode,
},
- {name:"Branch", field:"owning_lib",
+ {name:'${_(Branch)}', field:"owning_lib",
get:JUBGrid.getLIDLibName,
},
{name:"Barcode", field:"barcode", width:'auto'},
More information about the open-ils-commits
mailing list