From: Bill Erickson Date: Wed, 13 Mar 2013 20:16:50 +0000 (-0400) Subject: LP 1154150 : repair formula entry retrieval X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=f4d33b5a0054e30faf8a95a73c1359353dde4023;p=evergreen%2Fequinox.git LP 1154150 : repair formula entry retrieval Repair code thinkos in distribution formula entry fleshing call / traversal. Signed-off-by: Bill Erickson Signed-off-by: Lebbeous Fogle-Weekley --- diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Lineitem/BatchUpdate.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Lineitem/BatchUpdate.pm index 620ae068b6..0a8b9a3237 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Lineitem/BatchUpdate.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Lineitem/BatchUpdate.pm @@ -410,8 +410,14 @@ sub lineitem_batch_update_api { # It's important that we NOT flesh use_count here, if that [ever] # does anything. We're going to abuse that field internally. - $dist_formula = $e->acq->retrieve_acq_distribution_formula([ - int($dist_formula), {flesh=>1, flesh_fields=>["entries","fund"]} + $dist_formula = $e->retrieve_acq_distribution_formula([ + int($dist_formula), { + flesh=>2, + flesh_fields=>{ + acqdf => ["entries"], + acqdfe => ["fund"] + } + } ]) or return $e->die_event; return $e->die_event unless @@ -419,11 +425,13 @@ sub lineitem_batch_update_api { # If the distribution formula has a fund, there's an additional perm # test to do before proceeding. - if ($dist_formula->fund) { - return $e->die_event unless $e->allowed( - ["ADMIN_FUND", "MANAGE_FUND"], - $dist_formula->fund->org, $dist_formula->fund - ); + for my $entry (@{$dist_formula->entries}) { + if ($entry->fund) { + return $e->die_event unless $e->allowed( + ["ADMIN_FUND", "MANAGE_FUND"], + $entry->fund->org, $entry->fund + ); + } } # The following sort is crucial later.