From: erickson Date: Tue, 12 Feb 2008 14:37:19 +0000 (+0000) Subject: added ability to flesh picklist entry count for summary displays X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=2ce2794ebda07fe4620e1503ebd926d77d514ad3;p=Evergreen.git added ability to flesh picklist entry count for summary displays git-svn-id: svn://svn.open-ils.org/ILS/branches/acq-experiment@8729 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml index 16e608351d..15480c8dab 100644 --- a/Open-ILS/examples/fm_IDL.xml +++ b/Open-ILS/examples/fm_IDL.xml @@ -2596,6 +2596,7 @@ + diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Acq/Picklist.pm b/Open-ILS/src/perlmods/OpenILS/Application/Acq/Picklist.pm index 16955de8fd..5b64eb4eed 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Acq/Picklist.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Acq/Picklist.pm @@ -75,6 +75,7 @@ __PACKAGE__->register_method( params => [ {desc => 'Authentication token', type => 'string'}, {desc => 'Picklist ID to retrieve', type => 'number'}, + {desc => 'Options hash, including "flesh_entry_count" to get the count of attached entries', type => 'hash'}, ], return => {desc => 'Picklist object on success, Event on error'} } @@ -88,6 +89,17 @@ sub retrieve_picklist { 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}); + } + return $BAD_PARAMS unless $e->requestor->id == $picklist->owner; return $picklist; }