From 1d11b654313c29d4ee5de1976165d0a1218669c9 Mon Sep 17 00:00:00 2001 From: Jason Stephenson Date: Sun, 31 Oct 2021 16:14:10 -0400 Subject: [PATCH] LP1883171 & LP1940663: Replace circ method to update latest inventory Replace the open-ils.circ.circulation.update_latest_inventory method with open-ils.circ.circulation.update_copy_inventory. This work was sponsored by NOBLE. Signed-off-by: Jason Stephenson --- .../src/perlmods/lib/OpenILS/Application/Circ.pm | 27 +++++++--------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ.pm index bb4412b6d9..23f99d438b 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ.pm @@ -371,32 +371,21 @@ sub new_set_circ_lost { } __PACKAGE__->register_method( - method => "update_latest_inventory", - api_name => "open-ils.circ.circulation.update_latest_inventory"); + method => "update_copy_inventory", + api_name => "open-ils.circ.circulation.update_copy_inventory"); -sub update_latest_inventory { +sub update_copy_inventory { my( $self, $conn, $auth, $args ) = @_; my $e = new_editor(authtoken=>$auth, xact=>1); return $e->die_event unless $e->checkauth; my $copies = $$args{copy_list}; foreach my $copyid (@$copies) { - my $copy = $e->retrieve_asset_copy($copyid); - my $alci = $e->search_asset_latest_inventory({copy => $copyid})->[0]; - - if($alci) { - $alci->inventory_date('now'); - $alci->inventory_workstation($e->requestor->wsid); - $e->update_asset_latest_inventory($alci) or return $e->die_event; - } else { - my $alci = Fieldmapper::asset::latest_inventory->new; - $alci->inventory_date('now'); - $alci->inventory_workstation($e->requestor->wsid); - $alci->copy($copy->id); - $e->create_asset_latest_inventory($alci) or return $e->die_event; - } - - $copy->latest_inventory($alci); + my $aci = Fieldmapper::asset::copy_inventory->new; + $aci->inventory_date('now'); + $aci->inventory_workstation($e->requestor->wsid); + $aci->copy($copyid); + $e->create_asset_copy_inventory($aci) or return $e->die_event; } $e->commit; return 1; -- 2.11.0