From: Frédéric Demians <[email protected]>

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 <[email protected]>
---
 C4/Items.pm |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/C4/Items.pm b/C4/Items.pm
index 2e85130..8781c7d 100644
--- a/C4/Items.pm
+++ b/C4/Items.pm
@@ -2103,7 +2103,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 {
-- 
1.7.3

_______________________________________________
Koha-patches mailing list
[email protected]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-patches
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to