From: Chris Sharp Date: Wed, 29 Mar 2023 19:21:35 +0000 (-0400) Subject: LP1017990: Remove deprecated holds API methods, replace with internal subroutine... X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=e7bb112cc240e19e182933f5e7d39bb1aeb95ac3;p=working%2FEvergreen.git LP1017990: Remove deprecated holds API methods, replace with internal subroutine calls Signed-off-by: Chris Sharp --- 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 6e9878be21..b57749a143 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm @@ -145,11 +145,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($auth, $ahr, $oargs, $override); $res2 = { 'target' => $$params{$target_field}, 'result' => $res2 @@ -324,11 +320,7 @@ sub test_and_create_batch_hold_event { } 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($auth, $ahr, $oargs, $override); $res2 = { total => $total, count => $count, 'patronid' => $$params{patronid}, @@ -432,98 +424,13 @@ sub construct_hold_request_object { return $ahr; } -__PACKAGE__->register_method( - method => "create_hold_batch", - api_name => "open-ils.circ.holds.create.batch", - stream => 1, - signature => { - desc => q/@see open-ils.circ.holds.create.batch/, - params => [ - { desc => 'Authentication token', type => 'string' }, - { desc => 'Array of hold objects', type => 'array' } - ], - return => { - desc => 'Array of hold ID on success, -1 on missing arg, event (or ref to array of events) on error(s)', - }, - } -); - -__PACKAGE__->register_method( - method => "create_hold_batch", - api_name => "open-ils.circ.holds.create.override.batch", - stream => 1, - signature => { - desc => '@see open-ils.circ.holds.create.batch', - } -); - - -sub create_hold_batch { - my( $self, $conn, $auth, $hold_list, $oargs ) = @_; - (my $method = $self->api_name) =~ s/\.batch//og; - foreach (@$hold_list) { - my ($res) = $self->method_lookup($method)->run($auth, $_, $oargs); - $conn->respond($res); - } - return undef; -} - - -__PACKAGE__->register_method( - method => "create_hold", - api_name => "open-ils.circ.holds.create", - signature => { - desc => "Create a new hold for an item. From a permissions perspective, " . - "the login session is used as the 'requestor' of the hold. " . - "The hold recipient is determined by the 'usr' setting within the hold object. " . - 'First we verify the requestor has holds request permissions. ' . - 'Then we verify that the recipient is allowed to make the given hold. ' . - 'If not, we see if the requestor has "override" capabilities. If not, ' . - 'a permission exception is returned. If permissions allow, we cycle ' . - 'through the set of holds objects and create. ' . - 'If the recipient does not have permission to place multiple holds ' . - 'on a single title and said operation is attempted, a permission ' . - 'exception is returned', - params => [ - { desc => 'Authentication token', type => 'string' }, - { desc => 'Hold object for hold to be created', - type => 'object', class => 'ahr' } - ], - return => { - desc => 'New ahr ID on success, -1 on missing arg, event (or ref to array of events) on error(s)', - }, - } -); - -__PACKAGE__->register_method( - method => "create_hold", - api_name => "open-ils.circ.holds.create.override", - notes => '@see open-ils.circ.holds.create', - signature => { - desc => "If the recipient is not allowed to receive the requested hold, " . - "call this method to attempt the override", - params => [ - { desc => 'Authentication token', type => 'string' }, - { - desc => 'Hold object for hold to be created', - type => 'object', class => 'ahr' - } - ], - return => { - desc => 'New hold (ahr) ID on success, -1 on missing arg, event (or ref to array of events) on error(s)', - }, - } -); - sub create_hold { - my( $self, $conn, $auth, $hold, $oargs ) = @_; + my( $self, $conn, $auth, $hold, $oargs, $override) = @_; return -1 unless $hold; my $e = new_editor(authtoken=>$auth, xact=>1); return $e->die_event unless $e->checkauth; - my $override = 0; - if ($self->api_name =~ /override/) { - $override = 1; + if ($override) { $oargs = { all => 1 } unless defined $oargs; }