From b64dbb246c8f29ac1c5e40b88a1f26f8d207b18d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fr=C3=A9d=C3=A9ric=20Demians?= Date: Mon, 19 Sep 2011 19:53:38 +0200 Subject: [PATCH] Bug 6885 Allow superlib to delete items from any library When IndependantBranches syspref is enabled, a 'regular' user can only delete items belonging to his/her library. But a superlibrarian should have the permission to delete items from all libraries. He can't for the time being. This is fix by this patch. How to test? - On a multi-libraries Koha, activate IndependantBranches - Log in with a superlibrarian user - Find a biblio with one item from another library than the user home library - Click on Edit > Edit Items - On the list of items, all lines have Delete link - If you try to delete an item from another library than the user home library, deletion will fail. Signed-off-by: Owen Leonard Signed-off-by: Paul Poulain Signed-off-by: Chris Cormack --- C4/Items.pm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/C4/Items.pm b/C4/Items.pm index 6092feccef..328c6270cb 100644 --- a/C4/Items.pm +++ b/C4/Items.pm @@ -2198,7 +2198,11 @@ sub DelItemCheck { if ($onloan){ $error = "book_on_loan" } - elsif (C4::Context->preference("IndependantBranches") and (C4::Context->userenv->{branch} ne $item->{C4::Context->preference("HomeOrHoldingBranch")||'homebranch'})){ + elsif ( C4::Context->userenv->{flags} % 2 != 1 and + C4::Context->preference("IndependantBranches") and + (C4::Context->userenv->{branch} ne + $item->{C4::Context->preference("HomeOrHoldingBranch")||'homebranch'}) ) + { $error = "not_same_branch"; } else{ -- 2.39.5