From 0e47418b2ae6fd1db29216bd4032bbff693e43d3 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Fri, 26 Apr 2019 10:59:17 -0400 Subject: [PATCH] Bug 20256: (QA follow-up) Redirect to record details page if user cannot edit this item Signed-off-by: Bob Bennhoff - CLiC Signed-off-by: Martin Renvoize --- cataloguing/additem.pl | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl index 70ba5ec083..0431f07c0b 100755 --- a/cataloguing/additem.pl +++ b/cataloguing/additem.pl @@ -156,6 +156,13 @@ my ($template, $loggedinuser, $cookie) # Does the user have a restricted item editing permission? my $patron = Koha::Patrons->find( $loggedinuser ); + +my $item = $itemnumber ? Koha::Items->find( $itemnumber ) : undef; +if ( $item && !$patron->can_edit_item( $item ) ) { + print $input->redirect("/cgi-bin/koha/catalogue/detail.pl?biblionumber=$biblionumber"); + exit; +} + my $uid = $patron->userid; my $restrictededition = $uid ? haspermission($uid, {'editcatalogue' => 'edit_items_restricted'}) : undef; # In case user is a superlibrarian, editing is not restricted @@ -509,7 +516,14 @@ if ($op eq "additem") { push @errors,"barcode_not_unique"; $current_item = $item->unblessed; # Restore edit form for the same item } else { +<<<<<<< HEAD my $newitemlost = $item->itemlost; +======= + my $newitem = ModItemFromMarc($itemtosave, $biblionumber, $itemnumber); + $itemnumber = q{}; + my $olditemlost = $item->itemlost; + my $newitemlost = $newitem->{itemlost}; +>>>>>>> 5b37193b6fe (Bug 20256: (QA follow-up) Redirect to record details page if user cannot edit this item) if ( $newitemlost && $newitemlost ge '1' && !$olditemlost ) { LostItem( $item->itemnumber, 'additem' ); } -- 2.30.2