[open-ils-commits] r8729 - in branches/acq-experiment/Open-ILS: examples src/perlmods/OpenILS/Application/Acq

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Feb 12 10:06:37 EST 2008


Author: erickson
Date: 2008-02-12 09:37:19 -0500 (Tue, 12 Feb 2008)
New Revision: 8729

Modified:
   branches/acq-experiment/Open-ILS/examples/fm_IDL.xml
   branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Acq/Picklist.pm
Log:
added ability to flesh picklist entry count for summary displays

Modified: branches/acq-experiment/Open-ILS/examples/fm_IDL.xml
===================================================================
--- branches/acq-experiment/Open-ILS/examples/fm_IDL.xml	2008-02-12 14:25:09 UTC (rev 8728)
+++ branches/acq-experiment/Open-ILS/examples/fm_IDL.xml	2008-02-12 14:37:19 UTC (rev 8729)
@@ -2596,6 +2596,7 @@
 			<field reporter:label="Creation Time" name="create_time" oils_obj:array_position="6" oils_persist:virtual="false" reporter:datatype="timestamp" />
 			<field reporter:label="Edit Time" name="edit_time" oils_obj:array_position="7" oils_persist:virtual="false" reporter:datatype="timestamp" />
 			<field reporter:label="Entries" name="entries" oils_obj:array_position="8" oils_persist:virtual="true" reporter:datatype="link" />
+			<field reporter:label="Entry Count" name="entry_count" oils_obj:array_position="9" oils_persist:virtual="true"/>
 		</fields>
 		<links>
 			<link field="owner" reltype="has_a" key="id" map="" class="au"/>

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:25:09 UTC (rev 8728)
+++ branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Acq/Picklist.pm	2008-02-12 14:37:19 UTC (rev 8729)
@@ -75,6 +75,7 @@
         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 @@
     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;
 }



More information about the open-ils-commits mailing list