[open-ils-commits] SPAM: r8929 - in
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb:
controllers/acq public/oils/media/css/skin/default
templates/oils/default/acq/picklist
svn at svn.open-ils.org
svn at svn.open-ils.org
Sat Mar 8 20:13:38 EST 2008
Author: djfiander
Date: 2008-03-08 19:40:47 -0500 (Sat, 08 Mar 2008)
New Revision: 8929
Modified:
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/__init__.py
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/picklist.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/picklist/view.html
Log:
Add support for specifying # of copies to order on picklist view
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-03-09 00:20:07 UTC (rev 8928)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/__init__.py 2008-03-09 00:40:47 UTC (rev 8929)
@@ -28,13 +28,16 @@
self.picklist = ContextItem() # picklist object
self.picklist_list = ContextItem() # list of picklist objects
self.picklist_id_list = ContextItem(cgi_name='acq.plil', multi=True) # list of picklist IDs
- self.lineitem = ContextItem() # lineitem object
self.picklist_name = ContextItem(cgi_name='acq.pln')
- self.lineitem_id_list = ContextItem(cgi_name='acq.pleil', multi=True)
self.picklist_action = ContextItem(cgi_name='acq.pla')
self.picklist_source_id = ContextItem(cgi_name='acq.plsi')
self.picklist_dest_id = ContextItem(cgi_name='acq.pldi')
+ self.lineitem = ContextItem() # lineitem object
+ self.lineitem_id = ContextItem(cgi_name='acq.liid')
+ self.lineitem_item_count = ContextItem(cgi_name='acq.pllic')
+ self.lineitem_id_list = ContextItem(cgi_name='acq.pleil', multi=True)
+
self.currency_types = ContextItem()
self.fund = ContextItem()
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-09 00:20:07 UTC (rev 8928)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/picklist.py 2008-03-09 00:40:47 UTC (rev 8929)
@@ -16,7 +16,12 @@
r = RequestMgr()
pl_manager = oilsweb.lib.acq.picklist.PicklistMgr(r, picklist_id=kwargs['id'])
pl_manager.retrieve()
- pl_manager.retrieve_lineitems(flesh_provider=True, offset=r.ctx.acq.offset.value, limit=r.ctx.acq.limit.value)
+ # sort by author suppresses lineitems that don't have an author
+ pl_manager.retrieve_lineitems(flesh_provider=True,
+ #sort_attr="author",
+ #sort_dir="asc",
+ offset=r.ctx.acq.offset.value,
+ limit=r.ctx.acq.limit.value)
r.ctx.acq.picklist.value = pl_manager.picklist
r.ctx.acq.picklist_list.value = pl_manager.retrieve_list()
return r.render('acq/picklist/view.html')
@@ -99,7 +104,9 @@
ses.connect()
page = None
- if r.ctx.acq.picklist_action.value == 'move_selected':
+ if r.ctx.acq.lineitem_id:
+ page = self._update_lineitem_count(r, ses)
+ elif r.ctx.acq.picklist_action.value == 'move_selected':
page = self._move_selected(r, ses)
if not page:
@@ -108,6 +115,41 @@
ses.disconnect()
return page
+ def _update_lineitem_count(self, r, ses):
+ ''' Updates # of copies to order for single lineitem '''
+
+ picklist_id = r.ctx.acq.picklist_source_id.value
+ lineitem_id = r.ctx.acq.lineitem_id.value
+ new_count = int(r.ctx.acq.lineitem_item_count.value)
+
+ lineitem = ses.request('open-ils.acq.lineitem.retrieve',
+ r.ctx.core.authtoken.value,
+ lineitem_id).recv().content()
+ lineitem = Event.parse_and_raise(lineitem)
+
+ # Can't remove detail records yet
+ assert (lineitem.item_count() <= new_count), "Can't delete detail records"
+
+ for i in range(new_count - lineitem.item_count()):
+ detail = osrf.net_obj.NetworkObject.acqlid()
+ detail.lineitem(lineitem.id())
+ detail = ses.request('open-ils.acq.lineitem_detail.create',
+ r.ctx.core.authtoken.value,
+ detail, dict())
+ Event.parse_and_raise(detail)
+
+ if (lineitem.item_count() != new_count):
+ # Update the number of detail records
+ lineitem.item_count(new_count)
+ lineitem = ses.request('open-ils.acq.lineitem.update',
+ r.ctx.core.authtoken.value,
+ lineitem)
+ Event.parse_and_raise(lineitem)
+
+ # fail()
+ return redirect_to(controller='acq/picklist', action='view',
+ id=picklist_id)
+
def _move_selected(self, r, ses):
''' Moves the selected picklist lineitem's to the destination picklist '''
for lineitem_id in r.ctx.acq.lineitem_id_list.value:
@@ -124,6 +166,7 @@
r.ctx.core.authtoken.value, lineitem).recv().content()
Event.parse_and_raise(status)
- return redirect_to(controller='acq/picklist', action='view', id=r.ctx.acq.picklist_dest_id.value)
+ return redirect_to(controller='acq/picklist', action='view',
+ id=r.ctx.acq.picklist_dest_id.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-03-09 00:20:07 UTC (rev 8928)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/css/skin/default/acq.css 2008-03-09 00:40:47 UTC (rev 8929)
@@ -1,3 +1,4 @@
+.spacer {clear: both}
#oils-acq-index-block { font-weight:bold; }
/*
@@ -30,16 +31,14 @@
/* a single picklist */
#oils-acq-picklist-table { width: 100%; }
#oils-acq-picklist-header { padding: 4px; margin-bottom: 20px; }
-.oils-acq-picklist-records-jacket-td { width: 46px; }
+.oils-acq-picklist-records-jacket-td { width: 46px; height: 54px; }
.oils-acq-picklist-records-jacket { width: 42px; height: 54px; padding-left: 0px; }
-.oils-acq-picklist-records-title-row {}
-.oils-acq-picklist-records-author-row td { padding-left: 30px; }
-.oils-acq-picklist-records-phys_desc-row td { padding-left: 30px; }
-.oils-acq-picklist-records-phys_desc-row {}
-
-#oils-acq-picklist-paging-block { width: 50%; text-align: left;}
-#oils-acq-picklist-actions-block { width: 50%; text-align: right;}
+.oils-acq-picklist-records-title {vertical-align: top}
+.oils-acq-picklist-records-copies {text-align: right; width: 200px}
+#oils-acq-picklist-paging-block { width: 25%; float: left; position: relative; }
+#oils-acq-picklist-actions-block { width: 75%; text-align: right; float: right; position: relative; }
#oils-acq-picklist-header-subtable { width: 100%; }
+#oils-acq-picklist-header-block { width: 100%; display: block }
/* list of pos */
#oils-acq-po-list-table {width: 100%;}
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-09 00:20:07 UTC (rev 8928)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/view.html 2008-03-09 00:40:47 UTC (rev 8929)
@@ -15,65 +15,62 @@
from oilsweb.lib.acq.picklist import PicklistMgr
%>
-<form method='POST' action='${c.oils.acq.prefix.value}/picklist/update'>
-<input type='hidden' name='${c.oils.acq.picklist_source_id.cgi_name}' value='${c.oils.acq.picklist.value.id()}'/>
-<table id='oils-acq-picklist-table'>
- <thead>
- <tr>
- <td colspan='3' id='oils-acq-picklist-header-block'>
- <table id='oils-acq-picklist-header-subtable'><tr>
- <td id='oils-acq-picklist-paging-block'>
- ${widget.paging(c.oils.acq.offset.value,
- c.oils.acq.limit.value,
- c.oils.acq.picklist.value.entry_count())}
- </td>
- <td id='oils-acq-picklist-actions-block'>
- <select name='${c.oils.acq.picklist_action.cgi_name}'>
- <option value='move_selected'>${_('Move Selected to Picklist...')}</option>
- </select>
- <select name='${c.oils.acq.picklist_dest_id.cgi_name}'>
- <option selected='selected' value=''>${_('-- Select A Picklist --')}</option>
- % for list in c.oils.acq.picklist_list.value:
- <option value='${list.id()}'>${list.name()}</option>
- % endfor
- </select>
- <input type='submit' value='${_("Submit")}'/>
- </td>
- </tr></table>
- </td>
- </tr>
- </thead>
- <tbody>
- % for lineitem in c.oils.acq.picklist.value.entries():
- <tr class='oils-acq-picklist-records-title-row'>
- <td rowspan='3'>
- <img class='oils-acq-picklist-records-jacket'
- src='${c.oils.core.ac_prefix.value}/jacket/small/${oilsweb.lib.bib.scrub_isbn(PicklistMgr.find_lineitem_attr(lineitem, "isbn"))}'/>
- </td>
- <td>
- <a href='../view_lineitem/${lineitem.id()}'>${h.util.html_escape(PicklistMgr.find_lineitem_attr(lineitem, "title"))}</a>
- </td>
- <td class='oils-acq-picklist-records-service-td'>
- % if lineitem.provider():
- ${lineitem.provider().name()}
- % endif
- </td>
- <td><input type='checkbox' name='${c.oils.acq.lineitem_id_list.cgi_name}' value='${lineitem.id()}'/></td>
+<div id='oils-acq-picklist-header-block'>
+ <div class='spacer'> </div>
+ <div id="oils-acq-picklist-paging-block">
+ ${widget.paging(c.oils.acq.offset.value, c.oils.acq.limit.value,
+ c.oils.acq.picklist.value.entry_count())}
+ </div>
+ <div id="oils-acq-picklist-actions-block">
+ <select name='${c.oils.acq.picklist_action.cgi_name}'>
+ <option value='move_selected'>${_('Move Selected to Picklist...')}</option>
+ </select>
+ <select name='${c.oils.acq.picklist_dest_id.cgi_name}'>
+ <option selected='selected' value=''>${_('-- Select A Picklist --')}</option>
+ % for list in c.oils.acq.picklist_list.value:
+ <option value='${list.id()}'>${list.name()}</option>
+ % endfor
+o </select> <input type='submit' value='${_("Submit")}'/>
+ </div>
+ <div class='spacer'> </div>
+</div>
+<div id='fred'>
+<table id="oils-acq-picklist-table">
+ <thead>
+ <tr>
+ <td colspan="2">Item Description</td>
+ <td class="oils-acq-picklist-records-copies"># of Copies</td>
</tr>
-
- <tr class='oils-acq-picklist-records-author-row'>
- <td colspan='4'>${PicklistMgr.find_lineitem_attr(lineitem, "author")}</td>
- </tr>
- <tr class='oils-acq-picklist-records-phys_desc-row'>
- <td colspan='4'>
- ${PicklistMgr.find_lineitem_attr(lineitem, "isbn")} |
- ${PicklistMgr.find_lineitem_attr(lineitem, "pubdate")} |
- ${PicklistMgr.find_lineitem_attr(lineitem, "pagination")}
- <a class='oils-acq-picklist-lineitem-delete-link' href='${c.oils.acq.prefix.value}/picklist/delete_lineitem/${lineitem.id()}'>${_('Delete')}</a>
- </td>
- </tr>
+ </thead>
+ <tbody>
+ % for lineitem in c.oils.acq.picklist.value.entries():
+ <tr class='oils-acq-picklist-records-title'>
+ <td class='oils-acq-picklist-records-jacket-td'>
+ <img class='oils-acq-picklist-records-jacket'
+ src='${c.oils.core.ac_prefix.value}/jacket/small/${oilsweb.lib.bib.scrub_isbn(PicklistMgr.find_lineitem_attr(lineitem, "isbn"))}'/>
+ </td>
+ <td><a href='../view_lineitem/${lineitem.id()}'>${h.util.html_escape(PicklistMgr.find_lineitem_attr(lineitem, "title"))}</a>
+ ${PicklistMgr.find_lineitem_attr(lineitem, "publisher")}
+ ${PicklistMgr.find_lineitem_attr(lineitem, "pubdate")}
+ ${PicklistMgr.find_lineitem_attr(lineitem, "pagination")}
+ ${PicklistMgr.find_lineitem_attr(lineitem, "isbn")}
+ ${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>
+ </td>
+ </tr>
% endfor
- </tbody>
+ </tbody>
</table>
-</form>
+</div>
</%def>
More information about the open-ils-commits
mailing list