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 <berick@esilibrary.com>
Signed-off-by: Mike Rylander <mrylander@gmail.com>
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;