[open-ils-commits] r8826 - in
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb:
controllers/acq lib/acq public/oils/media/css/skin/default
templates/oils/default/acq/po
svn at svn.open-ils.org
svn at svn.open-ils.org
Fri Feb 22 15:52:24 EST 2008
Author: djfiander
Date: 2008-02-22 15:21:40 -0500 (Fri, 22 Feb 2008)
New Revision: 8826
Modified:
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/__init__.py
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/po.py
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/lib/acq/po_manager.py
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/css/skin/default/acq.css
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/po/po_li_summary.html
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/po/view_lineitem.html
Log:
Display Line Item details
Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/__init__.py
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/__init__.py 2008-02-22 18:51:26 UTC (rev 8825)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/__init__.py 2008-02-22 20:21:40 UTC (rev 8826)
@@ -75,6 +75,7 @@
self.po_id = ContextItem(cgi_name='acq.poid')
self.po_li_id_list = ContextItem(cgi_name='acq.poliil', multi=True)
self.po_li = ContextItem()
+ self.po_li_sum = ContextItem()
# -------------------------------------------------------------
# utility functions
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-02-22 18:51:26 UTC (rev 8825)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/po.py 2008-02-22 20:21:40 UTC (rev 8826)
@@ -37,6 +37,15 @@
po_mgr.retrieve_lineitem()
r.ctx.acq.po_li.value = po_mgr.li
+ summary = dict()
+ for det in po_mgr.li.lineitem_details():
+ fund = det.fund().name()
+ try:
+ summary[fund] += 1
+ except LookupError:
+ summary[fund] = 1
+ r.ctx.acq.po_li_sum.value = summary
+
po_mgr.id = po_mgr.li.purchase_order()
po_mgr.retrieve(flesh_lineitems=0)
r.ctx.acq.po.value = po_mgr.po
Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/lib/acq/po_manager.py
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/lib/acq/po_manager.py 2008-02-22 18:51:26 UTC (rev 8825)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/lib/acq/po_manager.py 2008-02-22 20:21:40 UTC (rev 8826)
@@ -52,10 +52,10 @@
po.edit_time(mx.DateTime.ISO.ParseAny(po.edit_time()).strftime(datefmt))
self.po = po
- def retrieve_lineitem(self):
+ def retrieve_lineitem(self, **kwargs):
li = self.ses.request('open-ils.acq.po_lineitem.retrieve',
self.request_mgr.ctx.core.authtoken.value,
- self.liid, {'flesh_details':1}).recv().content()
+ self.liid, {'flesh_li_details':1}).recv().content()
datefmt = oilsweb.lib.user.User(self.request_mgr.ctx.core).get_date_format()
li.create_time(mx.DateTime.ISO.ParseAny(li.create_time()).strftime(datefmt))
li.edit_time(mx.DateTime.ISO.ParseAny(li.edit_time()).strftime(datefmt))
@@ -63,6 +63,8 @@
@staticmethod
def find_li_attr(li, attr_name, attr_type='picklist_marc_attr_definition'):
+ if not li.attributes():
+ return ''
for li_attr in li.attributes():
if li_attr.attr_type() == attr_type and li_attr.attr_name() == attr_name:
return li_attr.attr_value()
Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/css/skin/default/acq.css
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/css/skin/default/acq.css 2008-02-22 18:51:26 UTC (rev 8825)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/css/skin/default/acq.css 2008-02-22 20:21:40 UTC (rev 8826)
@@ -72,6 +72,8 @@
.oils-acq-po-li-attr-name {}
.oils-acq-po-li-attr-value {}
#oils-acq-po-li-marc-block { margin-top: 10px; padding: 6px; }
+#oils-acq-po-li-details-table { width: 100%; }
+.oils-acq-po-li-detail-row {}
/* picklist entry page */
#oils-acq-picklist-entry-header { padding: 4px; margin-bottom: 20px; }
Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/po/po_li_summary.html
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/po/po_li_summary.html 2008-02-22 18:51:26 UTC (rev 8825)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/po/po_li_summary.html 2008-02-22 20:21:40 UTC (rev 8826)
@@ -8,4 +8,35 @@
<div>${ctime}</div>
<div>${etime}</div>
</div>
+ <div>
+ <table>
+ <%
+ import oilsweb.lib.bib
+ from oilsweb.lib.acq.po_manager import PO_Manager
+
+ li = c.oils.acq.po_li.value
+%>
+
+ <tr class='oils-acq-po-records-title-row'>
+ <td rowspan='3'>
+ <img class='oils-acq-po-records-jacket'
+ src='${c.oils.core.ac_prefix.value}/jacket/small/${oilsweb.lib.bib.scrub_isbn(PO_Manager.find_li_attr(li, "isbn"))}'/>
+ </td>
+ <td>
+ </tr>
+
+ <tr class='oils-acq-po-records-author-row'>
+ <td colspan='4'>${PO_Manager.find_li_attr(li, "author")}
+ </tr>
+ <tr class='oils-acq-po-records-phys_desc-row'>
+ <td colspan='3'>
+ ${PO_Manager.find_li_attr(li, "isbn")} |
+ ${PO_Manager.find_li_attr(li, "pubdate")} |
+ ${PO_Manager.find_li_attr(li, "pagination")}
+ </td>
+ <td>${PO_Manager.find_li_attr(li, "price")}</td>
+ </tr>
+
+ </table>
+ </div>
</div>
Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/po/view_lineitem.html
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/po/view_lineitem.html 2008-02-22 18:51:26 UTC (rev 8825)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/po/view_lineitem.html 2008-02-22 20:21:40 UTC (rev 8826)
@@ -8,4 +8,21 @@
<%include file='po_summary.html' />
<%include file='po_li_summary.html' />
+<%
+ from oilsweb.lib.acq.po_manager import PO_Manager
+%>
+
+<table id="oils-acq-po-li-details-table">
+ <Thead>
+ <tr><td>Fund</td><td># of Copies</td></tr>
+ </thead>
+ <tbody>
+ % for fund, count in c.oils.acq.po_li_sum.value.iteritems():
+ <tr class="oils-acq-po-li-detail-row">
+ <td>${fund}</td><td>${count}</td>
+ </tr>
+ % endfor
+ </tbody>
+</table>
+
</%def>
More information about the open-ils-commits
mailing list