LP#1017990: Deprecate open-ils.circ.holds.create[.override] API calls user/jeffdavis/lp1017990-deprecate-hold-create
authorJeff Davis <jdavis@sitka.bclibraries.ca>
Thu, 25 Feb 2016 20:07:31 +0000 (12:07 -0800)
committerJeff Davis <jdavis@sitka.bclibraries.ca>
Thu, 25 Feb 2016 20:07:31 +0000 (12:07 -0800)
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 <jdavis@sitka.bclibraries.ca>
Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm

index 65c3a6f..979af40 100644 (file)
@@ -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;