[open-ils-commits] SPAM: r8815 - in
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb:
controllers/acq lib/acq public/oils/media/css/skin/default
public/oils/media/css/theme/default
templates/oils/default/acq templates/oils/default/acq/po
svn at svn.open-ils.org
svn at svn.open-ils.org
Fri Feb 22 10:41:07 EST 2008
Author: djfiander
Date: 2008-02-22 10:10:25 -0500 (Fri, 22 Feb 2008)
New Revision: 8815
Added:
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/templates/oils/default/acq/po/
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/po/navigate.html
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/po/po_summary.html
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_po.html
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/po/view_po_list.html
Modified:
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/__init__.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/public/oils/media/css/theme/default/acq.css
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/navigate.html
Log:
First pass at Purchase Order support
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 15:06:15 UTC (rev 8814)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/__init__.py 2008-02-22 15:10:25 UTC (rev 8815)
@@ -70,6 +70,10 @@
self.provider_currency_type = ContextItem(cgi_name='acq.pct')
self.provider_owner = ContextItem(cgi_name='acq.po')
+ self.po = ContextItem()
+ self.po_list = ContextItem()
+ self.po_id = ContextItem(cgi_name='acq.poid')
+ self.po_li_id_list = ContextItem(cgi_name='acq.poliil', multi=True)
# -------------------------------------------------------------
# utility functions
Added: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/po.py
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/po.py (rev 0)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/po.py 2008-02-22 15:10:25 UTC (rev 8815)
@@ -0,0 +1,38 @@
+from oilsweb.lib.base import *
+from oilsweb.lib.request import RequestMgr
+import oilsweb.lib.user
+import osrf.net_obj
+import oils.const
+from osrf.ses import ClientSession
+from oils.event import Event
+from oils.org import OrgUtil
+import mx.DateTime.ISO
+import oilsweb.lib.acq.po_manager
+
+# open-ils.acq.purchase_order.retrieve "2f9697131c80e49fb9f2515781102f6a",
+# 8, {"flesh_lineitems":1,"clear_marc":1}
+
+
+class PoController(BaseController):
+
+ # Render list of Purchase Orders
+ def list(self, **kwargs):
+ r = RequestMgr()
+ po_mgr = oilsweb.lib.acq.po_manager.PO_Manager(r)
+ r.ctx.acq.po_list.value = po_mgr.retrieve_po_list()
+ return r.render('acq/po/view_po_list.html')
+
+ # Render display of individual PO: list of line items
+ def view(self, **kwargs):
+ r = RequestMgr()
+ po_mgr = oilsweb.lib.acq.po_manager.PO_Manager(r, poid=kwargs['id'])
+ po_mgr.retrieve()
+ r.ctx.acq.po.value = po_mgr.po
+ return r.render('acq/po/view_po.html')
+
+ # Render individual line item: list of detail info
+ def view_lineitem(self, **kwargs):
+ r = RequestMgr()
+ po_mgr = oilsweb.lib.acq.po_manager.PO_Manager(r, liid=kwargs['id'])
+ po_mgr.retrieve_lineitem()
+ return r.render('acq.po/view_lineitem.html')
Added: 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 (rev 0)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/lib/acq/po_manager.py 2008-02-22 15:10:25 UTC (rev 8815)
@@ -0,0 +1,63 @@
+import osrf.cache, osrf.json, osrf.ses, osrf.net_obj
+import oils.const, oils.utils.utils, oils.event
+import oilsweb.lib.user
+import mx.DateTime.ISO
+
+class PO_Manager(object):
+ def __init__(self, request_mgr, **kwargs):
+ self.request_mgr = request_mgr
+ self.id = kwargs.get('poid')
+ self.liid = kwargs.get('liid')
+ self.ses = osrf.ses.ClientSession(oils.const.OILS_APP_ACQ)
+
+ def retrieve_po_list(self):
+ ''' Returns list of POs '''
+
+ request = 'open-ils.acq.purchase_order.user.all.retrieve.atomic'
+
+ list = self.ses.request(request,
+ self.request_mgr.ctx.core.authtoken.value,
+ {'flesh_lineitem_count':1,
+ 'clear_marc':1,
+ 'order_by':'id'}).recv().content()
+ oils.event.Event.parse_and_raise(list)
+
+ usermgr = oilsweb.lib.user.User(self.request_mgr.ctx.core)
+ datefmt = usermgr.get_date_format()
+
+ for po in list:
+ ctime = mx.DateTime.ISO.ParseAny(po.create_time())
+ po.create_time(ctime.strftime(datefmt))
+
+ etime = mx.DateTime.ISO.ParseAny(po.edit_time())
+ po.edit_time(etime.strftime(datefmt))
+
+ return list
+
+ def retrieve(self):
+ po = self.ses.request('open-ils.acq.purchase_order.retrieve',
+ self.request_mgr.ctx.core.authtoken.value,
+ self.id, {'flesh_lineitems':1}).recv().content()
+
+ oils.event.Event.parse_and_raise(po)
+ datefmt = oilsweb.lib.user.User(self.request_mgr.ctx.core).get_date_format()
+
+ po.create_time(mx.DateTime.ISO.ParseAny(po.create_time()).strftime(datefmt))
+ po.edit_time(mx.DateTime.ISO.ParseAny(po.edit_time()).strftime(datefmt))
+ self.po = po
+
+ def retrieve_lineitem(self):
+ li = self.ses.request('open-ils.acq.po_lineitem.retrieve',
+ self.request_mgr.ctx.core.authtoken.value,
+ self.liid, {'flesh_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))
+ self.li = li
+
+ @staticmethod
+ def find_li_attr(li, attr_name, attr_type='picklist_marc_attr_definition'):
+ 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()
+ return ''
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 15:06:15 UTC (rev 8814)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/css/skin/default/acq.css 2008-02-22 15:10:25 UTC (rev 8815)
@@ -39,8 +39,26 @@
#oils-acq-picklist-paging-block { width: 50%; text-align: left;}
#oils-acq-picklist-actions-block { width: 50%; text-align: right;}
-#oils-acq-pikclist-header-subtable { width: 100%; }
+#oils-acq-picklist-header-subtable { width: 100%; }
+/* list of pos */
+#oils-acq-po-list-table {width: 100%;}
+#oils-acq-po-list-table td {padding: 3px;}
+
+/* a single po */
+#oils-acq-po-table { width: 100%; }
+#oils-acq-po-header { padding: 4px; margin-bottom: 20px; }
+.oils-acq-po-records-jacket-td { width: 46px; }
+.oils-acq-po-records-jacket { width: 42px; height: 54px; padding-left: 0px; }
+.oils-acq-po-records-title-row {}
+.oils-acq-po-records-author-row td { padding-left: 30px; }
+.oils-acq-po-records-phys_desc-row td { padding-left: 30px; }
+.oils-acq-po-records-phys_desc-row {}
+
+#oils-acq-po-paging-block { width: 50%; text-align: left;}
+#oils-acq-po-actions-block { width: 50%; text-align: right;}
+#oils-acq-po-header-subtable { width: 100%; }
+
#oils-acq-list-header { margin: 10px; width: 98%;}
#oils-acq-list-header-label { float: left; }
#oils-acq-list-header-actions { float: right; }
Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/css/theme/default/acq.css
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/css/theme/default/acq.css 2008-02-22 15:06:15 UTC (rev 8814)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/css/theme/default/acq.css 2008-02-22 15:10:25 UTC (rev 8815)
@@ -28,6 +28,18 @@
.oils-acq-picklist-entry-delete-link { font-size: 85%; }
#oils-acq-pikclist-header-subtable tr { border: none; }
+#oils-acq-po-table thead tr { border: 1px solid #A1A1A1; }
+#oils-acq-po-header {border: 1px solid #85C777;}
+#oils-acq-po-entry-header {border: 1px solid #85C777;}
+#oils-acq-po-name { font-weight: bold; font-style: italic; }
+.oils-acq-po-attributes { font-size: 90%; margin-left: 15px;}
+.oils-acq-po-entry-attributes { font-size: 90%; margin-left: 15px;}
+.oils-acq-po-records-phys_desc-row { border-bottom: 1px solid #6BA160; }
+.oils-acq-po-po-td { border-style: solid; border-color: #A1A1A1; border-width: 0px 1px 0px 1px; }
+.oils-acq-po-records-service-td { font-size: 85%; }
+.oils-acq-po-entry-delete-link { font-size: 85%; }
+#oils-acq-po-header-subtable tr { border: none; }
+
#oils-acq-list-header {border-bottom: 1px solid #6BA160;}
#oils-acq-list-header-label { font-weight: bold; font-size: 110%; }
#oils-acq-list-header-actions { font-weight: bold; }
Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/navigate.html
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/navigate.html 2008-02-22 15:06:15 UTC (rev 8814)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/navigate.html 2008-02-22 15:10:25 UTC (rev 8815)
@@ -18,4 +18,12 @@
<%include file='financial/navigate.html'/>
</div>
% endif
+<div class='oils-base-navigate-item'>
+ <a href='${c.oils.core.prefix.value}/acq/po/list'>${_('POs')}</a>
+</div>
+% if c.oils.core.page.value.startswith('acq/po'):
+ <div class='oils-base-navigate-sub-list'>
+ <%include file='po/navigate.html' />
+ </div>
+% endif
Added: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/po/navigate.html
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/po/navigate.html (rev 0)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/po/navigate.html 2008-02-22 15:10:25 UTC (rev 8815)
@@ -0,0 +1,4 @@
+# -*- coding: utf-8 -*-
+<div class='oils-base-navigate-item'>
+ <a href='${c.oils.core.prefix.value}/acq/po/list'>${_('Manage')}</a>
+</div>
Added: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/po/po_summary.html
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/po/po_summary.html (rev 0)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/po/po_summary.html 2008-02-22 15:10:25 UTC (rev 8815)
@@ -0,0 +1,13 @@
+<div id='oils-acq-po-header'>
+ ${_('Purchase Order')} <span id="oils-acq-po-name">${c.oils.acq.po.value.id()}</span>
+ <div class='oils-acq-po-attributes'>
+ <%
+ meta = _("Create date %(date)s") % {"date":c.oils.acq.po.value.create_time()}
+ meta2 = _("Last updated %(date)s") % {"date":c.oils.acq.po.value.edit_time()}
+ meta3 = _("Provider: %(provider)s") % {"provider":c.oils.acq.po.value.provider()}
+ %>
+ <div>${meta}</div>
+ <div>${meta2}</div>
+ <div>${meta3}</div>
+ </div>
+</div>
Added: 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 (rev 0)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/po/view_lineitem.html 2008-02-22 15:10:25 UTC (rev 8815)
@@ -0,0 +1,8 @@
+# -*- coding: utf-8 -*-
+<%inherit file='../base.html' />
+<%namespace file='../../common/widgets.html' name='widget' />
+
+<%def name='page_title()'>${_('Evergreen View Line Item)}</%def>
+<%def name='block_content()'>
+Here's a line item
+</%def>
Added: 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 (rev 0)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/po/view_po.html 2008-02-22 15:10:25 UTC (rev 8815)
@@ -0,0 +1,62 @@
+# -*- coding: utf-8 -*-
+<%inherit file='../base.html' />
+<%namespace file='../../common/widgets.html' name='widget' />
+
+<%def name='page_title()'>${_('Evergreen View PO')}</%def>
+<%def name='block_content()'>
+<%include file='po_summary.html' />
+
+<form method="POST" action="${c.oils.acq.prefix.value}/po/update">
+<input type="hidden" name="${c.oils.acq.po_id.cgi_name}"
+ value="${c.oils.acq.po.value.id()}">
+<table id="oils-acq-po-table">
+ <thead>
+ <tr>
+ <td colspan="3" id="oils-acq-po-header-block">
+ <table id="oils-acq-po-header-subtable">
+ <tr>
+ <td id="oils-acq-po-paging-block">
+ PUT PAGING HERE
+ </td>
+ <td id="oils-acq-po-actions-block">
+ PUT PO ACTIONS HERE
+ </td>
+ </tr></table>
+ </td></tr>
+ </thead>
+ <tbody>
+ <%
+ import oilsweb.lib.bib
+ from oilsweb.lib.acq.po_manager import PO_Manager
+%>
+ % for li in c.oils.acq.po.value.lineitems():
+ <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>
+ <a href='../view_lineitem/${li.id()}'>${PO_Manager.find_li_attr(li, "title")}</a>
+ </td>
+ <td><input type='checkbox' name='${c.oils.acq.po_li_id_list.cgi_name}' value='${li.id()}'/></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")}
+ <a class='oils-acq-po-li-delete-link' href='${c.oils.acq.prefix.value}/po/delete_li/${li.id()}'>${_('Delete')}</a>
+ </td>
+ <td>${PO_Manager.find_li_attr(li, "price")}</td>
+ </tr>
+ % endfor
+ </tbody>
+ <tr><th>
+</table>
+<input type="submit" value="">
+</form>
+</%def>
Added: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/po/view_po_list.html
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/po/view_po_list.html (rev 0)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/po/view_po_list.html 2008-02-22 15:10:25 UTC (rev 8815)
@@ -0,0 +1,37 @@
+# -*- coding: utf-8 -*-
+<%inherit file='../base.html'/>
+<%def name="page_title()">${_('Evergreen My Purchase Orders')}</%def>
+<%def name="block_content()">
+
+<div id='oils-acq-list-header' class='container'>
+ <div id='oils-acq-list-header-label'>${_('My Purchase Orders')}</div>
+ <div id='oils-acq-list-header-actions'>
+ <a href="${c.oils.acq.prefix.value}/po/listall">${_('View All POs')}</a>
+ <a href='${c.oils.acq.prefix.value}/po/create'>${_('New PO')}</a>
+ </div>
+</div>
+
+<table id='oils-acq-po-list-table'>
+ <thead>
+ <tr>
+ <td>${_('ID')}</td>
+ <td>${_('Creation Date')}</td>
+ <td>${_('Edit Date')}</td>
+ <td>${_('Number of Entries')}</td>
+ <td/>
+ <td/>
+ </tr>
+ </thead>
+ <tbody>
+ % for po in c.oils.acq.po_list.value:
+ <tr>
+ <td><a href='${c.oils.acq.prefix.value}/po/view/${po.id()}'>${po.id()}</a></td>
+ <td>${po.create_time()}</td>
+ <td>${po.edit_time()}</td>
+ <td>${po.lineitem_count()}</td>
+ <td><a href='${c.oils.acq.prefix.value}/po/delete/${po.id()}'>${_('Delete')}</a></td>
+ </tr>
+ % endfor
+ </tbody>
+</table>
+</%def>
More information about the open-ils-commits
mailing list