[open-ils-commits] r9605 - 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 14 14:48:07 EDT 2008
Author: erickson
Date: 2008-05-14 14:48:04 -0400 (Wed, 14 May 2008)
New Revision: 9605
Modified:
branches/acq-experiment/Open-ILS/web/js/dojo/openils/acq/Lineitems.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/templates/oils/default/acq/po/view_po.html
Log:
added a findAttr method directly to the lineitem class since it may be used outside of the picklist context. using new lineitem code in po lineitems render
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-14 17:55:39 UTC (rev 9604)
+++ branches/acq-experiment/Open-ILS/web/js/dojo/openils/acq/Lineitems.js 2008-05-14 18:48:04 UTC (rev 9605)
@@ -26,6 +26,20 @@
/** Declare the Lineitems class with dojo */
dojo.declare('openils.acq.Lineitems', null, {
/* add instance methods here if necessary */
+
+ constructor: function(args) {
+ this.lineitem = args.lineitem;
+ },
+
+ findAttr: function(name, type) {
+ var attrs = this.lineitem.attributes();
+ if(!attrs) return null;
+ for(var i = 0; i < attrs.length; i++) {
+ var attr = attrs[i];
+ if (attr.attr_type() == type && attr.attr_name() == name)
+ return attr.attr_value();
+ }
+ }
});
openils.acq.Lineitems.ModelCache = {};
@@ -112,4 +126,5 @@
}
};
+
}
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-05-14 17:55:39 UTC (rev 9604)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/acq/po/view_po.js 2008-05-14 18:48:04 UTC (rev 9605)
@@ -8,7 +8,7 @@
dojo.require('openils.User');
dojo.require('fieldmapper.OrgUtils');
dojo.require('openils.acq.Provider');
-dojo.require('openils.acq.Picklist');
+dojo.require('openils.acq.Lineitems');
dojo.require('dojo.date.locale');
dojo.require('dojo.date.stamp');
@@ -44,36 +44,36 @@
for(var i in lineitems) {
var li = lineitems[i];
if(li.id() == id)
- return openils.acq.Picklist.cache[id] = li;
+ return li;
}
}
function getJUBTitle(rowIndex) {
var data = liGrid.model.getRow(rowIndex);
if(!data) return '';
- getLi(data.id);
- return openils.acq.Picklist.find_attr(data.id, 'title', 'lineitem_marc_attr_definition')
+ return new openils.acq.Lineitems(
+ {lineitem:getLi(data.id)}).findAttr('title', 'lineitem_marc_attr_definition')
}
function getJUBIsbn(rowIndex) {
var data = liGrid.model.getRow(rowIndex);
if(!data) return '';
- getLi(data.id);
- return openils.acq.Picklist.find_attr(data.id, 'isbn', 'lineitem_marc_attr_definition')
+ return new openils.acq.Lineitems(
+ {lineitem:getLi(data.id)}).findAttr('isbn', 'lineitem_marc_attr_definition')
}
function getJUBPubdate(rowIndex) {
var data = liGrid.model.getRow(rowIndex);
if(!data) return '';
- getLi(data.id);
- return openils.acq.Picklist.find_attr(data.id, 'pubdate', 'lineitem_marc_attr_definition')
+ return new openils.acq.Lineitems(
+ {lineitem:getLi(data.id)}).findAttr('pubdate', 'lineitem_marc_attr_definition')
}
function getJUBPrice(rowIndex) {
var data = liGrid.model.getRow(rowIndex);
if(!data) return;
- getLi(data.id);
- return openils.acq.Picklist.find_attr(data.id, 'price', 'lineitem_marc_attr_definition')
+ return new openils.acq.Lineitems(
+ {lineitem:getLi(data.id)}).findAttr('price', 'lineitem_marc_attr_definition')
}
function loadPOGrid() {
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-05-14 17:55:39 UTC (rev 9604)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/po/view_po.html 2008-05-14 18:48:04 UTC (rev 9605)
@@ -8,6 +8,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>
<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