<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"/>
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'}
}
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;
}