From 759790c97aee0c5e7d768459f3cf7525961666ef Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Sat, 8 Jun 2019 15:34:24 -0500 Subject: [PATCH] Bug 22927: Do not check an already lost item when marked as withdrawn or damaged MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Due to how moredetail.pl was written it was hard to know which action was triggered. Test plan: - Set MarkLostItemsAsReturned to "from the items tab of the catalog module." - Check an item out to a patron - Use additem.pl to set that item to a lost status without returning it - go to moredetail.pl for that item - mark item as either damaged or withdrawn without interacting with the lost dropdown - note that item has not been returned Note for QA: Maybe we could have just tested if exists $item_changes->{'itemlost'} to call LostItem Signed-off-by: Claudie Trégouët Signed-off-by: Katrin Fischer Signed-off-by: Martin Renvoize --- catalogue/updateitem.pl | 13 +++++++------ .../prog/en/modules/catalogue/moredetail.tt | 11 +++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/catalogue/updateitem.pl b/catalogue/updateitem.pl index 7924b2b85e..6c6bd29fb4 100755 --- a/catalogue/updateitem.pl +++ b/catalogue/updateitem.pl @@ -31,6 +31,7 @@ my $cgi= new CGI; checkauth($cgi, 0, {circulate => 'circulate_remaining_permissions'}, 'intranet'); +my $op = $cgi->param('op') || ""; my $biblionumber=$cgi->param('biblionumber'); my $itemnumber=$cgi->param('itemnumber'); my $biblioitemnumber=$cgi->param('biblioitemnumber'); @@ -55,22 +56,22 @@ for ($damaged,$itemlost,$withdrawn) { # modify MARC item if input differs from items table. my $item_changes = {}; -if (defined $itemnotes_nonpublic) { # i.e., itemnotes_nonpublic parameter passed from form +if ( $op eq "set_non_public_note" ) { checkauth($cgi, 0, {editcatalogue => 'edit_items'}, 'intranet'); if ((not defined $item_data_hashref->{'itemnotes_nonpublic'}) or $itemnotes_nonpublic ne $item_data_hashref->{'itemnotes_nonpublic'}) { $item_changes->{'itemnotes_nonpublic'} = $itemnotes_nonpublic; } } -elsif (defined $itemnotes) { # i.e., itemnotes parameter passed from form +elsif ( $op eq "set_public_note" ) { # i.e., itemnotes parameter passed from form checkauth($cgi, 0, {editcatalogue => 'edit_items'}, 'intranet'); if ((not defined $item_data_hashref->{'itemnotes'}) or $itemnotes ne $item_data_hashref->{'itemnotes'}) { $item_changes->{'itemnotes'} = $itemnotes; } -} elsif ($itemlost ne $item_data_hashref->{'itemlost'}) { +} elsif ( $op eq "set_lost" && $itemlost ne $item_data_hashref->{'itemlost'}) { $item_changes->{'itemlost'} = $itemlost; -} elsif ($withdrawn ne $item_data_hashref->{'withdrawn'}) { +} elsif ( $op eq "set_withdrawn" && $withdrawn ne $item_data_hashref->{'withdrawn'}) { $item_changes->{'withdrawn'} = $withdrawn; -} elsif ($damaged ne $item_data_hashref->{'damaged'}) { +} elsif ( $op eq "set_damaged" && $damaged ne $item_data_hashref->{'damaged'}) { $item_changes->{'damaged'} = $damaged; } else { #nothings changed, so do nothing. @@ -80,6 +81,6 @@ elsif (defined $itemnotes) { # i.e., itemnotes parameter passed from form ModItem($item_changes, $biblionumber, $itemnumber); -LostItem($itemnumber, 'moredetail') if $itemlost; +LostItem($itemnumber, 'moredetail') if $op eq "set_lost"; print $cgi->redirect("moredetail.pl?biblionumber=$biblionumber&itemnumber=$itemnumber#item$itemnumber"); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt index 777f86667b..0a6d0609eb 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt @@ -113,8 +113,7 @@ [% END %] [% END %] - - + [% ELSE %] [% FOREACH itemlostloo IN itemlostloop %] @@ -146,8 +145,7 @@ [% END %] [% END %] - - + [% ELSE %] [% FOREACH itemdamagedloo IN itemdamagedloop %] @@ -180,8 +178,7 @@ [% END %] [% END %] - - + [% ELSE %] [% FOREACH itemwithdrawn IN itemwithdrawnloop %] @@ -249,6 +246,7 @@ [% IF ( CAN_user_editcatalogue_edit_items ) %]
+
[% ELSE %] @@ -262,6 +260,7 @@ [% IF ( CAN_user_editcatalogue_edit_items ) %]
+
[% ELSE %] -- 2.39.5