From c99bd2fc075b3f5c1bab2045ecee6b7dd93756c6 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Wed, 5 Sep 2012 14:39:36 -0400 Subject: [PATCH] Use current fiscal year for PO creation (API) When creating a PO, if no fiscal_year is specified by the caller, use the current fiscal year of the ordering agency. This change primarily affects the Open-ILS/src/support-scripts/acq_order_reader.pl script (and any other direct API callers) which does not offer the user a chance to set the fiscal year manually. Signed-off-by: Bill Erickson Signed-off-by: Mike Rylander --- .../perlmods/lib/OpenILS/Application/Acq/Order.pm | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Order.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Order.pm index 585bca0867..a5f5bfea07 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Order.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Order.pm @@ -1371,7 +1371,17 @@ sub upload_records { my $activate_po = $args->{activate_po}; my $vandelay = $args->{vandelay}; my $ordering_agency = $args->{ordering_agency} || $e->requestor->ws_ou; - my $fiscal_year = $args->{fiscal_year} || DateTime->now->year; + my $fiscal_year = $args->{fiscal_year}; + + # if the user provides no fiscal year, find the + # current fiscal year for the ordering agency. + $fiscal_year ||= $U->simplereq( + 'open-ils.acq', + 'open-ils.acq.org_unit.current_fiscal_year', + $auth, + $ordering_agency + ); + my $po; my $evt; -- 2.43.2