[open-ils-commits] r15531 - in trunk/Open-ILS: examples src/perlmods/OpenILS/Application/Acq (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Fri Feb 12 15:52:58 EST 2010
Author: erickson
Date: 2010-02-12 15:52:53 -0500 (Fri, 12 Feb 2010)
New Revision: 15531
Modified:
trunk/Open-ILS/examples/fm_IDL.xml
trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq/Picklist.pm
Log:
added a virtual use_count field for distrib formulas, populating value in ranged distrib form retrieve method
Modified: trunk/Open-ILS/examples/fm_IDL.xml
===================================================================
--- trunk/Open-ILS/examples/fm_IDL.xml 2010-02-12 20:44:55 UTC (rev 15530)
+++ trunk/Open-ILS/examples/fm_IDL.xml 2010-02-12 20:52:53 UTC (rev 15531)
@@ -5532,6 +5532,7 @@
<field reporter:label="Formula Name" name="name" reporter:datatype="text"/>
<field reporter:label="Skip Count" name="skip_count" reporter:datatype="int"/>
<field reporter:label="Entries" name="entries" oils_persist:virtual="true" reporter:datatype="link"/>
+ <field reporter:label="Use Count" name="use_count" oils_persist:virtual="true" reporter:datatype="int"/>
</fields>
<links>
<link field="owner" reltype="has_a" key="id" map="" class="aou"/>
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq/Picklist.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq/Picklist.pm 2010-02-12 20:44:55 UTC (rev 15530)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq/Picklist.pm 2010-02-12 20:52:53 UTC (rev 15531)
@@ -441,10 +441,11 @@
);
sub ranged_distrib_formulas {
- my($self, $conn, $auth) = @_;
+ my($self, $conn, $auth, $org) = @_;
my $e = new_editor(authtoken=>$auth);
return $e->event unless $e->checkauth;
my $orgs = $U->user_has_work_perm_at($e, 'CREATE_PICKLIST', {descendants =>1});
+
my $forms = $e->search_acq_distribution_formula([
{owner => $orgs},
{
@@ -453,7 +454,20 @@
order_by => {acqdfe => ['position']}
}
]);
- $conn->respond($_) for @$forms;
+
+ for (@$forms) {
+
+ # how many times has this DF been used
+ my $count = $e->json_query({
+ select => {acqdfa => [{column => 'formula', aggregate => 1, transform => 'count', alias => 'count'}]},
+ from => 'acqdfa',
+ where => {formula => $_->id}
+ })->[0];
+
+ $_->use_count($count->{count});
+ $conn->respond($_);
+ }
+
return undef;
}
More information about the open-ils-commits
mailing list