From 1d275e64f044ad4eae5e29e3c410b60961d769e0 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Tue, 17 Apr 2018 17:16:58 +0100 Subject: [PATCH] Bug 20595: Add handling for LRP field in EDI * EDI.pm - Add handling of the LRP EDI field to automatically add an item to a stockrotation rota. Signed-off-by: Brendan Gallagher Signed-off-by: Katrin Fischer Signed-off-by: Martin Renvoize --- Koha/EDI.pm | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/Koha/EDI.pm b/Koha/EDI.pm index f1a844a2c4..0ab4658689 100644 --- a/Koha/EDI.pm +++ b/Koha/EDI.pm @@ -819,6 +819,22 @@ sub quote_item { itemnumber => $itemnumber, } ); + + my $lrp = + $item->girfield( 'library_rotation_plan', $occurrence ); + 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"); + } + } } ++$occurrence; @@ -872,6 +888,22 @@ sub quote_item { itemnumber => $itemnumber, } ); + + my $lrp = + $item->girfield( 'library_rotation_plan', $occurrence ); + 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"); + } + } } ++$occurrence; -- 2.39.5