From 07be59639508f0c424c95f24ffa19cb89393f23a Mon Sep 17 00:00:00 2001 From: Jeff Davis Date: Thu, 25 Feb 2016 12:07:31 -0800 Subject: [PATCH] LP#1017990: Deprecate open-ils.circ.holds.create[.override] API calls Per discussion on Launchpad, the open-ils.circ.holds.create and open-ils.circ.holds.create.override API calls are now deprecated. This commit adds a WARN-level log message about the deprecation, moves the implementation code to a separate method, and makes EG use the implementation method directly rather than invoking the deprecated API calls. Signed-off-by: Jeff Davis --- .../src/perlmods/lib/OpenILS/Application/Circ/Holds.pm | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm index 65c3a6fe97..979af40394 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm @@ -114,11 +114,7 @@ sub test_and_create_hold_batch { } my $ahr = construct_hold_request_object($params); - my ($res2) = $self->method_lookup( - $override - ? 'open-ils.circ.holds.create.override' - : 'open-ils.circ.holds.create' - )->run($auth, $ahr, $oargs); + my ($res2) = create_hold_impl($self, $auth, $ahr, $override, $oargs); $res2 = { 'target' => $$params{$target_field}, 'result' => $res2 @@ -244,14 +240,22 @@ __PACKAGE__->register_method( sub create_hold { my( $self, $conn, $auth, $hold, $oargs ) = @_; return -1 unless $hold; - my $e = new_editor(authtoken=>$auth, xact=>1); - return $e->die_event unless $e->checkauth; + + $logger->warn($self->api_name . " is deprecated and will be removed in the next release"); my $override = 0; if ($self->api_name =~ /override/) { $override = 1; $oargs = { all => 1 } unless defined $oargs; } + return create_hold_impl($self, $auth, $hold, $override, $oargs); +} + +sub create_hold_impl { + my( $self, $auth, $hold, $override, $oargs ) = @_; + return -1 unless $hold; + my $e = new_editor(authtoken=>$auth, xact=>1); + return $e->die_event unless $e->checkauth; my @events; -- 2.11.0