From c782dc7c70a3045eb3701ed1aea3acaf8c3d0016 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 --- cataloguing/additem.pl | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl index a2aea9b6ee..fd9cad5e66 100755 --- a/cataloguing/additem.pl +++ b/cataloguing/additem.pl @@ -396,8 +396,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.11.0