[open-ils-commits] r8730 - in branches/acq-experiment/Open-ILS:
src/perlmods/OpenILS/Application/Acq
web/oilsweb/oilsweb/controllers/acq web/oilsweb/oilsweb/lib/acq
web/oilsweb/oilsweb/templates/oils/default/acq/picklist
svn at svn.open-ils.org
svn at svn.open-ils.org
Tue Feb 12 10:21:27 EST 2008
Author: erickson
Date: 2008-02-12 09:52:09 -0500 (Tue, 12 Feb 2008)
New Revision: 8730
Modified:
branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Acq/Picklist.pm
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/picklist.py
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/lib/acq/picklist.py
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/view_list.html
Log:
added entry count to picklist.user.retrieve, displaying in picklist summary display
Modified: branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Acq/Picklist.pm
===================================================================
--- branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Acq/Picklist.pm 2008-02-12 14:37:19 UTC (rev 8729)
+++ branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Acq/Picklist.pm 2008-02-12 14:52:09 UTC (rev 8730)
@@ -89,21 +89,29 @@
my $picklist = $e->retrieve_acq_picklist($picklist_id)
or return $e->event;
- if($$options{flesh_entry_count}) {
- my $count = $e->json_query({
- select => {
- acqple => [{transform => 'count', column => 'id', alias => 'count'}]
- },
- from => 'acqple',
- where => {picklist => $picklist_id}}
- );
- $picklist->entry_count($count->[0]->{count});
- }
+ $picklist->entry_count(retrieve_picklist_entry_count($e, $picklist_id))
+ if $$options{flesh_entry_count};
return $BAD_PARAMS unless $e->requestor->id == $picklist->owner;
return $picklist;
}
+
+# Returns the number of entries associated with this picklist
+sub retrieve_picklist_entry_count {
+ my($e, $picklist_id) = @_;
+ my $count = $e->json_query({
+ select => {
+ acqple => [{transform => 'count', column => 'id', alias => 'count'}]
+ },
+ from => 'acqple',
+ where => {picklist => $picklist_id}}
+ );
+ return $count->[0]->{count};
+}
+
+
+
__PACKAGE__->register_method(
method => 'retrieve_picklist_name',
api_name => 'open-ils.acq.picklist.name.retrieve',
@@ -145,7 +153,18 @@
my($self, $conn, $auth, $options) = @_;
my $e = new_editor(authtoken=>$auth);
return $e->die_event unless $e->checkauth;
- return $e->search_acq_picklist({owner=>$e->requestor->id, name=>{'!='=>''}},{idlist=>$$options{idlist}});
+
+ # don't grab the PL with name == "", because that is the designated temporary picklist
+ my $list = $e->search_acq_picklist(
+ {owner=>$e->requestor->id, name=>{'!='=>''}},
+ {idlist=>$$options{idlist}}
+ );
+
+ if($$options{flesh_entry_count}) {
+ $_->entry_count(retrieve_picklist_entry_count($e, $_->id)) for @$list;
+ };
+
+ return $list;
}
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-02-12 14:37:19 UTC (rev 8729)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/picklist.py 2008-02-12 14:52:09 UTC (rev 8730)
@@ -91,19 +91,25 @@
ses.connect()
if r.ctx.acq.picklist_action == 'move_selected':
- for entry_id in r.ctx.acq.picklist_entry_id_list:
+ self._move_selected(r, ses)
- entry = ses.request(
- 'open-ils.acq.picklist_entry.retrieve',
- r.ctx.core.authtoken, entry_id).recv().content()
- entry = oils.event.Event.parse_and_raise(entry)
+ ses.disconnect()
+ return redirect_to(controller='acq/picklist', action='list')
- entry.picklist(r.ctx.acq.picklist_dest_id)
+ def _move_selected(self, r, ses):
+ ''' Moves the selected picklist entry's to the destination picklist '''
+ for entry_id in r.ctx.acq.picklist_entry_id_list:
- status = ses.request(
- 'open-ils.acq.picklist_entry.update',
- r.ctx.core.authtoken, entry).recv().content()
- status = oils.event.Event.parse_and_raise(status)
+ entry = ses.request(
+ 'open-ils.acq.picklist_entry.retrieve',
+ r.ctx.core.authtoken, entry_id).recv().content()
+ entry = oils.event.Event.parse_and_raise(entry)
- ses.disconnect()
- return redirect_to(controller='acq/picklist', action='list')
+ entry.picklist(r.ctx.acq.picklist_dest_id)
+
+ status = ses.request(
+ 'open-ils.acq.picklist_entry.update',
+ r.ctx.core.authtoken, entry).recv().content()
+ oils.event.Event.parse_and_raise(status)
+
+
Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/lib/acq/picklist.py
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/lib/acq/picklist.py 2008-02-12 14:37:19 UTC (rev 8729)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/lib/acq/picklist.py 2008-02-12 14:52:09 UTC (rev 8730)
@@ -13,7 +13,7 @@
def retrieve(self):
picklist = self.ses.request(
'open-ils.acq.picklist.retrieve',
- self.request_mgr.ctx.core.authtoken, self.id).recv().content()
+ self.request_mgr.ctx.core.authtoken, self.id, {'flesh_entry_count':1}).recv().content()
oils.event.Event.parse_and_raise(picklist)
self.picklist = picklist
@@ -74,7 +74,7 @@
''' Returns my list of picklist objects '''
list = self.ses.request(
'open-ils.acq.picklist.user.retrieve',
- self.request_mgr.ctx.core.authtoken).recv().content()
+ self.request_mgr.ctx.core.authtoken, {'flesh_entry_count':1}).recv().content()
oils.event.Event.parse_and_raise(list)
usermgr = oilsweb.lib.user.User(self.request_mgr.ctx.core)
Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/view_list.html
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/view_list.html 2008-02-12 14:37:19 UTC (rev 8729)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/view_list.html 2008-02-12 14:52:09 UTC (rev 8730)
@@ -16,6 +16,7 @@
<td>${_('Name')}</td>
<td>${_('Creation Date')}</td>
<td>${_('Edit Date')}</td>
+ <td>${_('Number of Entries')}</td>
<td/>
<td/>
</tr>
@@ -26,6 +27,7 @@
<td><a href='${c.oils.acq.prefix}/picklist/view/${picklist.id()}'>${picklist.name()}</a></td>
<td>${picklist.create_time()}</td>
<td>${picklist.edit_time()}</td>
+ <td>${picklist.entry_count()}</td>
<td><a href='${c.oils.acq.prefix}/picklist/delete/${picklist.id()}'>${_('Delete')}</a></td>
</tr>
% endfor
More information about the open-ils-commits
mailing list