From 6aa2b173bff7b8cd33b85f4b5c89a51e2073722c Mon Sep 17 00:00:00 2001 From: tipaul Date: Fri, 1 Sep 2006 09:44:10 +0000 Subject: [PATCH] better behaviour of hidelostitems systempref. if it is set, items are no more hidden in librarian interface if the user has superlibrarian or editcatalogue permissions --- C4/SearchMarc.pm | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/C4/SearchMarc.pm b/C4/SearchMarc.pm index bc0152c7e0..ceb36b67c6 100644 --- a/C4/SearchMarc.pm +++ b/C4/SearchMarc.pm @@ -392,19 +392,27 @@ if (C4::Context->preference("sortbynonfiling")) { my $oldline; my ($oldbibid, $oldauthor, $oldtitle); my $sth_itemCN; - if (C4::Context->preference('hidelostitems')) { + my $userenv=C4::Context->userenv; +# warn "FLAGS : ".($userenv->{flags} & 2**9); + # hide lost items if : + # - the preference hidelostitems is set + # - the user not logged in, or is not a superlibrarian or a librarian with cataloguing permissions + # otherwise, show everything + if (!C4::Context->preference('hidelostitems') or ($userenv && ($userenv->{'flags'} eq 1 or ($userenv->{'flags'} & 2**9)) )) { + # show everything $sth_itemCN = $dbh->prepare(" SELECT items.holdingbranch, items.location, items.itemcallnumber, count(*) AS cnt, items.itemnumber, items.notforloan FROM items - WHERE biblionumber=? AND (itemlost = 0 OR itemlost IS NULL) - GROUP BY items.holdingbranch, items.location, items.itemcallnumber + WHERE biblionumber=? + GROUP BY items.holdingbranch, items.location, items.itemcallnumber ORDER BY homebranch"); } else { + # hide lost items $sth_itemCN = $dbh->prepare(" SELECT items.holdingbranch, items.location, items.itemcallnumber, count(*) AS cnt, items.itemnumber, items.notforloan FROM items - WHERE biblionumber=? - GROUP BY items.holdingbranch, items.location, items.itemcallnumber + WHERE biblionumber=? AND (itemlost = 0 OR itemlost IS NULL) + GROUP BY items.holdingbranch, items.location, items.itemcallnumber ORDER BY homebranch"); } my $sth_issue = $dbh->prepare(" -- 2.39.5