[open-ils-commits] r9109 - in
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb:
controllers/acq templates/oils/default/acq/picklist
svn at svn.open-ils.org
svn at svn.open-ils.org
Fri Mar 21 17:06:11 EDT 2008
Author: djfiander
Date: 2008-03-21 16:31:32 -0400 (Fri, 21 Mar 2008)
New Revision: 9109
Modified:
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/picklist.py
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/lineitem_summary.html
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/view.html
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/view_lineitem.html
Log:
Minor cosmetic tweaks, approve lineitems for purchase (lineitem.state == "approved")
Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/picklist.py
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/picklist.py 2008-03-21 19:24:22 UTC (rev 9108)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/picklist.py 2008-03-21 20:31:32 UTC (rev 9109)
@@ -160,6 +160,26 @@
return redirect_to(controller='acq/picklist', action='view_lineitem',
id=r.ctx.acq.lineitem_id.value)
+ def approve_lineitem(self):
+ r = RequestMgr()
+ ses = ClientSession(oils.const.OILS_APP_ACQ)
+ ses.connect
+
+ li = ses.request('open-ils.acq.lineitem.retrieve',
+ r.ctx.core.authtoken.value,
+ r.ctx.acq.lineitem_id.value).Recv().content()
+ li = Event.parse_and_raise(li)
+
+ li.state("approved")
+
+ li = ses.request('open-ils.acq.lineitem.update',
+ r.ctx.core.authtoken.value,
+ li).recv().content()
+ li = Event.parse_and_raise(li)
+
+ return redirect_to(controller='acq/picklist', action='view',
+ id=r.ctx.acq.picklist_id.value)
+
def _update_lineitem_count(self, r, ses):
''' Updates # of copies to order for single lineitem '''
Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/lineitem_summary.html
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/lineitem_summary.html 2008-03-21 19:24:22 UTC (rev 9108)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/lineitem_summary.html 2008-03-21 20:31:32 UTC (rev 9109)
@@ -1,6 +1,9 @@
<%namespace file='../../common/widgets.html' name='widget' />
+<%
+ from oilsweb.lib.acq.picklist import PicklistMgr
+%>
<div id='oils-acq-lineitem-header'>
- ${_('Picklist Entry')}
+ ${PicklistMgr.find_lineitem_attr(c.oils.acq.lineitem.value, 'title')}
<div class='oils-acq-lineitem-attributes'>
<%
provider_map = [(provider.id(), provider.name()) for provider in c.oils.acq.provider_list.value]
@@ -13,6 +16,8 @@
meta4 = _("Last update time %s") % c.oils.acq.lineitem.value.edit_time()
%>
<div>${meta}</div>
+ <div>${meta3}</div>
+ <div>${meta4}</div>
<div>
<form method="post"
action="${c.oils.acq.prefix.value}/picklist/update_lineitem">
@@ -25,8 +30,16 @@
</form>
</div>
- <div>${meta3}</div>
- <div>${meta4}</div>
+ <div>
+ <form method="post"
+ action="${c.oils.acq.prefix.value}/picklist/approve_lineitem">
+
+ <button name="${c.oils.acq.lineitem_id.cgi_name}"
+ value="${c.oils.acq.lineitem.value.id()}">
+ ${_("Approve for Purchase")}
+ </button>
+ </form>
+ </div>
</div>
</div>
Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/view.html
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/view.html 2008-03-21 19:24:22 UTC (rev 9108)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/view.html 2008-03-21 20:31:32 UTC (rev 9109)
@@ -57,16 +57,21 @@
${PicklistMgr.find_lineitem_attr(lineitem, "price")}
</td>
<td class="oils-acq-picklist-records-copies">
- <form method="POST"
- action="${c.oils.acq.prefix.value}/picklist/update">
- <input name="${c.oils.acq.picklist_source_id.cgi_name}"
- type="hidden"
- value="${c.oils.acq.picklist.value.id()}" />
- <input name="${c.oils.acq.lineitem_item_count.cgi_name}"
- type="text" size="3" value="${lineitem.item_count()}" />
- <button name='${c.oils.acq.lineitem_id.cgi_name}'
- value='${lineitem.id()}'>${_("Update")}</button>
- </form>
+ % if lineitem.state() == 'approved':
+ ${lineitem.item_count()} Approved
+ % else:
+ <form method="POST"
+ action="${c.oils.acq.prefix.value}/picklist/update">
+ <input name="${c.oils.acq.picklist_source_id.cgi_name}"
+ type="hidden"
+ value="${c.oils.acq.picklist.value.id()}" />
+ <input name="${c.oils.acq.lineitem_item_count.cgi_name}"
+ type="text" size="3"
+ value="${lineitem.item_count()}" />
+ <button name='${c.oils.acq.lineitem_id.cgi_name}'
+ value='${lineitem.id()}'>${_("Update")}</button>
+ </form>
+ % endif
</td>
</tr>
% endfor
Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/view_lineitem.html
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/view_lineitem.html 2008-03-21 19:24:22 UTC (rev 9108)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/view_lineitem.html 2008-03-21 20:31:32 UTC (rev 9109)
@@ -8,6 +8,8 @@
<%
fund_map = [(fund.id(), fund.name()) for fund in c.oils.acq.fund_list.value]
+ def sort_lid(a, b):
+ return cmp(a.id(), b.id())
%>
${picklist.summary(c.oils.acq.picklist.value, link=True)}
@@ -16,37 +18,43 @@
<table id='oils-acq-lineitem-summary'>
% for attr in c.oils.acq.lineitem.value.attributes():
- <tr>
- <td class='oils-acq-lineitem-attr-name'>
- ${attr.attr_name()}
- </td>
- <td class='oils-acq-lineitem-attr-value'>
- ${attr.attr_value()}
- </td>
- </tr>
+ % if attr.attr_name() != 'title':
+ <tr>
+ <td class='oils-acq-lineitem-attr-name'>
+ ${attr.attr_name()}
+ </td>
+ <td class='oils-acq-lineitem-attr-value'>
+ ${attr.attr_value()}
+ </td>
+ </tr>
+ % endif
% endfor
</table>
<table id="oils-acq-lineitem-details-table">
<thead>
- <tr><td>Fund</td><td>Home Library</td></tr>
+ <tr><td>ID</td><td>Fund</td><td>Home Library</td></tr>
</thead>
<tbody>
+ ${c.oils.acq.lineitem.value.lineitem_details().sort(sort_lid)}
% for detail in c.oils.acq.lineitem.value.lineitem_details():
- <tr>
- <td>
- <form method="post"
- action="${c.oils.acq.prefix.value}/picklist/update_lineitem">
- <input type="hidden"
- name="${c.oils.acq.lineitem_id.cgi_name}"
- value="${c.oils.acq.lineitem.value.id()}" />
+ <Form method="post"
+ action="${c.oils.acq.prefix.value}/picklist/update_lineitem">
+ <input type="hidden"
+ name="${c.oils.acq.lineitem_id.cgi_name}"
+ value="${c.oils.acq.lineitem.value.id()}" />
+ <tr>
+ <td>${detail.id()}</td>
+ <td>
+ ${widget.build_selector(c.oils.acq.fund_id.cgi_name, fund_map, detail.fund())}
+ </td>
+ <td>${detail.owning_lib() or 'None'}</td>
+ <td>
<button name='${c.oils.acq.lineitem_detail_id.cgi_name}'
value='${detail.id()}'>${_("Update")}</button>
- ${widget.build_selector(c.oils.acq.fund_id.cgi_name, fund_map, detail.fund())}
- </form>
- </td>
- <td>${detail.owning_lib() or ' '}</td>
- </tr>
+ </td>
+ </tr>
+ </form>
% endfor
</tbody>
</table>
More information about the open-ils-commits
mailing list