From a47ca1211cc5af871b1c25bba8f82e0a19665a23 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Fri, 24 Nov 2023 13:06:37 +0000 Subject: [PATCH] Bug 35398: Fix LRP support for EDI orders with single items This patch corrects a mistake in the original implementaiton of bug 20595 where we introduced support for the LRP segments being used to automatically assign items ordered via EDI to stock rotation plans. Signed-off-by: Sophie Halden Signed-off-by: Kyle M Hall Signed-off-by: Katrin Fischer (cherry picked from commit 783a58a9d3f26622450c7785182b175c71f50d5e) Signed-off-by: Fridolin Somers (cherry picked from commit d96168e38f6ed8cb74967376d8f761f3bfe47900) Signed-off-by: Lucas Gass --- Koha/EDI.pm | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Koha/EDI.pm b/Koha/EDI.pm index ceb9a2ccd4..0c71f50ede 100644 --- a/Koha/EDI.pm +++ b/Koha/EDI.pm @@ -829,6 +829,22 @@ sub quote_item { } ); ++$created; + + my $lrp = + $item->girfield( 'library_rotation_plan' ); + if ($lrp) { + my $rota = + Koha::StockRotationRotas->find( { title => $lrp }, + { key => 'stockrotationrotas_title' } ); + if ($rota) { + $rota->add_item($itemnumber); + $logger->trace("Item added to rota $rota->id"); + } + else { + $logger->error( + "No rota found matching $lrp in orderline"); + } + } } } } -- 2.39.5