[open-ils-commits] SPAM: r9646 - in
branches/acq-experiment/Open-ILS: src/extras
src/perlmods/OpenILS/Application/Acq
web/oilsweb/oilsweb/controllers/acq
web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/acq/po
web/oilsweb/oilsweb/templates/oils/default/acq/po
svn at svn.open-ils.org
svn at svn.open-ils.org
Tue May 20 17:49:08 EDT 2008
Author: erickson
Date: 2008-05-20 17:49:04 -0400 (Tue, 20 May 2008)
New Revision: 9646
Added:
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
Modified:
branches/acq-experiment/Open-ILS/src/extras/ils_events.xml
branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Acq/Picklist.pm
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/po.py
Log:
initial lineitem search
Modified: branches/acq-experiment/Open-ILS/src/extras/ils_events.xml
===================================================================
--- branches/acq-experiment/Open-ILS/src/extras/ils_events.xml 2008-05-20 20:37:13 UTC (rev 9645)
+++ branches/acq-experiment/Open-ILS/src/extras/ils_events.xml 2008-05-20 21:49:04 UTC (rev 9646)
@@ -613,6 +613,9 @@
<event code='1672' textcode='ACQ_LINEITEM_PROVIDER_ATTR_DEFINITION_NOT_FOUND'>
<desc xml:lang='en-US'>The requested acq.lineitem_provider_attr_definition was not found</desc>
</event>
+ <event code='1673' textcode='ACQ_CURRENCY_TYPE_NOT_FOUND'>
+ <desc xml:lang='en-US'>The requested acq.currency_type was not found</desc>
+ </event>
<event code='1700' textcode='NON_CAT_TYPE_EXISTS'>
Modified: branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Acq/Picklist.pm
===================================================================
--- branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Acq/Picklist.pm 2008-05-20 20:37:13 UTC (rev 9645)
+++ branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Acq/Picklist.pm 2008-05-20 21:49:04 UTC (rev 9646)
@@ -733,11 +733,15 @@
my $e = new_editor(authtoken=>$auth, xact=>1);
return $e->event unless $e->checkauth;
return $e->event unless $e->allowed('CREATE_PICKLIST');
- # XXX needs serious permissions consideration!
- my $pls = $e->search_acq_lineitem($search, {idlist=>$$options{idlist}});
- for my $pl (@$pls) {
- $pl->clear_marc if $$options{clear_marc};
- $conn->respond($_) for $pl;
+ # XXX needs permissions consideration
+ my $pls = $e->search_acq_lineitem($search, {idlist=>1});
+ for my $li_id (@$pls) {
+ if($$options{idlist}) {
+ $conn->respond($li_id);
+ } else {
+ my $res = retrieve_lineitem($self, $conn, $auth, $li_id, $options);
+ $conn->respond($res) unless $U->event_code($res);
+ }
}
return undef;
}
Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/po.py
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/po.py 2008-05-20 20:37:13 UTC (rev 9645)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/po.py 2008-05-20 21:49:04 UTC (rev 9646)
@@ -33,6 +33,10 @@
r.ctx.acq.po_id.value = kwargs['id']
return r.render('acq/po/view_po.html')
+ def li_search(self):
+ r = RequestMgr()
+ return r.render('acq/po/li_search.html')
+
# Create PO from contents of picklist
def create(self, **kwargs):
r = RequestMgr()
Added: 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 (rev 0)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/acq/po/li_search.js 2008-05-20 21:49:04 UTC (rev 9646)
@@ -0,0 +1,97 @@
+dojo.require('fieldmapper.Fieldmapper');
+dojo.require('dijit.ProgressBar');
+dojo.require('dijit.form.Form');
+dojo.require('dijit.form.TextBox');
+dojo.require('dijit.form.FilteringSelect');
+dojo.require('openils.Event');
+dojo.require('openils.acq.Lineitems');
+dojo.require('openils.acq.Provider');
+
+var recvCount = 0;
+var user = new openils.User();
+
+var lineitems = [];
+
+function drawForm() {
+
+}
+
+var liReceived;
+function doSearch(values) {
+ search = {};
+ search = {state:'new'};
+ search = [search, {limit:searchLimit, offset:searchOffset}];
+ options = {clear_marc:1, flesh_attrs:1};
+
+ liReceived = 0;
+ dojo.style('searchProgress', 'visibility', 'visible');
+ fieldmapper.standardRequest(
+ ['open-ils.acq', 'open-ils.acq.lineitem.search'],
+ { async: true,
+ params: [user.authtoken, search, options],
+ onresponse: handleResult,
+ oncomplete: viewList
+ }
+ );
+}
+
+function handleResult(r) {
+ var result = r.recv().content();
+ searchProgress.update({maximum: searchLimit, progress: ++liReceived});
+ lineitems.push(result);
+}
+
+function viewList() {
+ dojo.style('searchProgress', 'visibility', 'hidden');
+ var store = new dojo.data.ItemFileReadStore({data:jub.toStoreData(lineitems)});
+ var model = new dojox.grid.data.DojoData(
+ null, store, {rowsPerPage: 20, clientSort: true, query:{id:'*'}});
+ liGrid.setModel(model);
+ liGrid.update();
+}
+
+
+function getProvider(rowIndex) {
+ data = liGrid.model.getRow(rowIndex);
+ if(!data) return;
+ if(!data.provider) return '';
+ return openils.acq.Provider.retrieve(data.provider).code();
+}
+
+function getLi(id) {
+ for(var i in lineitems) {
+ var li = lineitems[i];
+ if(li.id() == id)
+ return li;
+ }
+}
+
+function getJUBTitle(rowIndex) {
+ var data = liGrid.model.getRow(rowIndex);
+ if(!data) return '';
+ 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 '';
+ 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 '';
+ 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;
+ return new openils.acq.Lineitems(
+ {lineitem:getLi(data.id)}).findAttr('price', 'lineitem_marc_attr_definition')
+}
+
+dojo.addOnLoad(drawForm);
Added: 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 (rev 0)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/po/li_search.html 2008-05-20 21:49:04 UTC (rev 9646)
@@ -0,0 +1,46 @@
+# -*- coding: utf-8 -*-
+<%inherit file='base.html'/>
+<%def name="page_title()">${_('Lineitem Search')}</%def>
+
+<%def name="block_content()">
+ <script src='${c.oils.core.media_prefix.value}/ui_js/oils/default/acq/po/li_search.js'> </script>
+ <script>
+ var searchLimit = ${c.oils.acq.limit.value} || 10;
+ var searchOffset = ${c.oils.acq.offset.value} || 0;
+ </script>
+
+ <div id='oils-acq-li-search-block' class='container'>
+ <form dojoType='dijit.form.Form' action='' method=''>
+ <script type="dojo/method" event="onSubmit">
+ doSearch(this.getValues());
+ return false; /* don't redirect */
+ </script>
+ <select dojoType='dijit.form.FilteringSelect' name='state'>
+ <option value='new'>${_("New")}</option>
+ </select>
+ <div dojoType='dijit.form.Button' type='submit'>${_("Search")}</div>
+ </div>
+ </form>
+ <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>
+
+ <script>
+ var liGridStructure = [{
+ cells: [[
+ {name: '${_("ID")}', field: 'id'},
+ {name: '${_("Title")}', width: 'auto', get:getJUBTitle},
+ {name: '${_("ISBN")}', get:getJUBIsbn},
+ {name: '${_("Pubdate")}', get:getJUBPubdate},
+ {name: '${_("Price")}', get:getJUBPrice},
+ {name: '${_("Vendor")}', get:getProvider},
+ {name: '${_("# of Copies")}', field: 'item_count'},
+ {name: '${_("State")}', field: 'state'}
+ ]]
+ }];
+ </script>
+ <div jsId='liGrid' dojoType="dojox.Grid" structure='liGridStructure'> </div>
+</%def>
+
+
More information about the open-ils-commits
mailing list