[open-ils-commits] r8833 - in
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb:
controllers/acq lib/acq templates/oils/default/acq/po
svn at svn.open-ils.org
svn at svn.open-ils.org
Sun Feb 24 21:15:57 EST 2008
Author: djfiander
Date: 2008-02-24 20:44:53 -0500 (Sun, 24 Feb 2008)
New Revision: 8833
Added:
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/lib/acq/provider_mgr.py
Modified:
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/po.py
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/provider.py
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_po_list.html
Log:
Map provider IDs to names and display them when appropriate
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-23 19:25:56 UTC (rev 8832)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/po.py 2008-02-25 01:44:53 UTC (rev 8833)
@@ -1,5 +1,6 @@
from oilsweb.lib.base import *
from oilsweb.lib.request import RequestMgr
+from oilsweb.lib.acq import provider_mgr;
import oilsweb.lib.user
import osrf.net_obj
import oils.const
@@ -19,7 +20,13 @@
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()
+ po_list = po_mgr.retrieve_po_list()
+ provider_map = dict()
+ for po in po_list:
+ if not (po.provider() in provider_map):
+ provider_map[po.provider()] = provider_mgr.retrieve(r, po.provider()).name()
+ po.provider(provider_map[po.provider()])
+ r.ctx.acq.po_list.value = po_list
return r.render('acq/po/view_po_list.html')
# Render display of individual PO: list of line items
@@ -28,6 +35,7 @@
po_mgr = oilsweb.lib.acq.po_manager.PO_Manager(r, poid=kwargs['id'])
po_mgr.retrieve()
r.ctx.acq.po.value = po_mgr.po
+ r.ctx.acq.provider.value = provider_mgr.retrieve(r, po_mgr.po.provider())
return r.render('acq/po/view_po.html')
# Render individual line item: list of detail info
Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/provider.py
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/provider.py 2008-02-23 19:25:56 UTC (rev 8832)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/provider.py 2008-02-25 01:44:53 UTC (rev 8833)
@@ -1,5 +1,6 @@
from oilsweb.lib.base import *
from oilsweb.lib.request import RequestMgr
+from oilsweb.lib.acq import provider_mgr
from osrf.ses import ClientSession
from osrf.net_obj import NetworkObject
from oils.event import Event
@@ -12,10 +13,7 @@
def view(self, **kwargs):
r = RequestMgr()
- ses = ClientSession(oils.const.OILS_APP_ACQ)
- provider = ses.request('open-ils.acq.provider.retrieve',
- r.ctx.core.authtoken.value, kwargs.get('id')).recv().content()
- Event.parse_and_raise(provider)
+ provider = provider_mgr.retrieve(r, kwargs['id'])
provider.owner(OrgUtil.get_org_unit(provider.owner()))
r.ctx.acq.provider.value = provider
return r.render('acq/financial/view_provider.html')
@@ -54,11 +52,7 @@
def list(self):
r = RequestMgr()
- ses = ClientSession(oils.const.OILS_APP_ACQ)
- providers = ses.request(
- 'open-ils.acq.provider.org.retrieve',
- r.ctx.core.authtoken.value, None, {"flesh_summary":1}).recv().content()
- Event.parse_and_raise(providers)
+ providers = provider_mgr.list(r)
for f in providers:
f.owner(OrgUtil.get_org_unit(f.owner()))
r.ctx.acq.provider_list.value = providers
Added: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/lib/acq/provider_mgr.py
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/lib/acq/provider_mgr.py (rev 0)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/lib/acq/provider_mgr.py 2008-02-25 01:44:53 UTC (rev 8833)
@@ -0,0 +1,18 @@
+import oils.const
+from oils.event import Event
+from osrf.ses import ClientSession
+
+def retrieve(r, id):
+ ses = ClientSession(oils.const.OILS_APP_ACQ)
+ provider = ses.request('open-ils.acq.provider.retrieve',
+ r.ctx.core.authtoken.value, id).recv().content()
+ Event.parse_and_raise(provider)
+ return provider
+
+def list(r):
+ ses = ClientSession(oils.const.OILS_APP_ACQ)
+ providers = ses.request('open-ils.acq.provider.org.retrieve',
+ r.ctx.core.authtoken.value, None,
+ {"flesh_summary":1}).recv().content()
+ Event.parse_and_raise(providers)
+ return providers
Modified: 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 2008-02-23 19:25:56 UTC (rev 8832)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/po/po_summary.html 2008-02-25 01:44:53 UTC (rev 8833)
@@ -10,7 +10,7 @@
<%
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()}
+ meta3 = _("Provider: %(provider)s") % {"provider":c.oils.acq.provider.value.name()}
%>
<div>${meta}</div>
<div>${meta2}</div>
Modified: 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 2008-02-23 19:25:56 UTC (rev 8832)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/po/view_po_list.html 2008-02-25 01:44:53 UTC (rev 8833)
@@ -15,6 +15,7 @@
<thead>
<tr>
<td>${_('ID')}</td>
+ <td>${_('Provider')}</td>
<td>${_('Creation Date')}</td>
<td>${_('Edit Date')}</td>
<td>${_('Number of Entries')}</td>
@@ -26,6 +27,7 @@
% 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.provider()}</td>
<td>${po.create_time()}</td>
<td>${po.edit_time()}</td>
<td>${po.lineitem_count()}</td>
More information about the open-ils-commits
mailing list