From 8de7332a35bba62f55f406727ae8a87b6e270984 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Wed, 16 Sep 2020 15:19:41 +0000 Subject: [PATCH] Bug 26473: Get items for editing using only itemnumber This patch modifies additem.pl so that it can accept an itemnumber as a single parameter. To test, apply the patch edit items on a bibliographic record which has one or more items. - In the location bar, modify the URL so that it uses only the itemnumber parameter, e.g. /cgi-bin/koha/cataloguing/additem.pl?itemnumber=12345 The page should load the correct record's items. - If you add the "op" parameter it should load the item for editing in the form: /cgi-bin/koha/cataloguing/additem.pl?itemnumber=12345&op=edititem Signed-off-by: David Nind Signed-off-by: Katrin Fischer Signed-off-by: Jonathan Druart --- cataloguing/additem.pl | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl index 9f6d59a5fc..bb578a1bf3 100755 --- a/cataloguing/additem.pl +++ b/cataloguing/additem.pl @@ -397,8 +397,18 @@ sub removeFieldsForPrefill { my $input = new CGI; my $error = $input->param('error'); -my $biblionumber = $input->param('biblionumber'); -my $itemnumber = $input->param('itemnumber'); + +my $biblionumber; +my $itemnumber; +if( $input->param('itemnumber') && !$input->param('biblionumber') ){ + $itemnumber = $input->param('itemnumber'); + my $item = Koha::Items->find( $itemnumber ); + $biblionumber = $item->biblionumber; +} else { + $biblionumber = $input->param('biblionumber'); + $itemnumber = $input->param('itemnumber'); +} + my $op = $input->param('op') || q{}; my $hostitemnumber = $input->param('hostitemnumber'); my $marcflavour = C4::Context->preference("marcflavour"); -- 2.39.5