Bugzilla – Attachment 23482 Details for
Bug 10277
Add C4::Context->IsSuperLibrarian()
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 10277 [Followup] - Replace all remaining userenv checks with IsSuperLibrarian()
Bug-10277-Followup---Replace-all-remaining-userenv.patch (text/plain), 8.78 KB, created by
Kyle M Hall (khall)
on 2013-12-12 13:31:03 UTC
(
hide
)
Description:
Bug 10277 [Followup] - Replace all remaining userenv checks with IsSuperLibrarian()
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2013-12-12 13:31:03 UTC
Size:
8.78 KB
patch
obsolete
>From 87f01aa226db0df9f3d135e417fed27cac159ba5 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Thu, 12 Dec 2013 08:19:37 -0500 >Subject: [PATCH] Bug 10277 [Followup] - Replace all remaining userenv checks with IsSuperLibrarian() > >--- > C4/Acquisition.pm | 15 ++++++--------- > C4/Branch.pm | 10 +++++----- > C4/Items.pm | 2 +- > acqui/basket.pl | 4 ++-- > acqui/neworderempty.pl | 9 +++++---- > cataloguing/additem.pl | 9 +++++---- > circ/ysearch.pl | 14 +++++++------- > suggestion/suggestion.pl | 9 +++++---- > tools/export.pl | 4 ++-- > 9 files changed, 38 insertions(+), 38 deletions(-) > >diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm >index dc090b8..4e6a743 100644 >--- a/C4/Acquisition.pm >+++ b/C4/Acquisition.pm >@@ -1696,7 +1696,7 @@ sub SearchOrders { > > my $userenv = C4::Context->userenv; > if ( C4::Context->preference("IndependentBranches") ) { >- if ( ( $userenv ) and ( $userenv->{flags} != 1 ) ) { >+ unless ( C4::Context->IsSuperLibrarian() ) { > $query .= q{ > AND ( > borrowers.branchcode = ? >@@ -1892,11 +1892,10 @@ sub GetParcel { > > my @query_params = ( $supplierid, $code, $datereceived ); > if ( C4::Context->preference("IndependentBranches") ) { >- my $userenv = C4::Context->userenv; >- if ( ($userenv) && ( $userenv->{flags} != 1 ) ) { >+ unless ( C4::Context->IsSuperLibrarian() ) { > $strsth .= " and (borrowers.branchcode = ? > or borrowers.branchcode = '')"; >- push @query_params, $userenv->{branch}; >+ push @query_params, C4::Context->userenv->{branch}; > } > } > $strsth .= " ORDER BY aqbasket.basketno"; >@@ -2111,8 +2110,7 @@ sub GetLateOrders { > $from .= ' AND ADDDATE(aqbasket.closedate, INTERVAL aqbooksellers.deliverytime DAY) <= CAST(now() AS date)'; > } > if (C4::Context->preference("IndependentBranches") >- && C4::Context->userenv >- && C4::Context->userenv->{flags} != 1 ) { >+ && !C4::Context->IsSuperLibrarian() ) { > $from .= ' AND borrowers.branchcode LIKE ? '; > push @query_params, C4::Context->userenv->{branch}; > } >@@ -2308,10 +2306,9 @@ sub GetHistory { > } > > if ( C4::Context->preference("IndependentBranches") ) { >- my $userenv = C4::Context->userenv; >- if ( $userenv && ($userenv->{flags} || 0) != 1 ) { >+ unless ( C4::Context->IsSuperLibrarian() ) { > $query .= " AND (borrowers.branchcode = ? OR borrowers.branchcode ='' ) "; >- push @query_params, $userenv->{branch}; >+ push @query_params, C4::Context->userenv->{branch}; > } > } > $query .= " ORDER BY id"; >diff --git a/C4/Branch.pm b/C4/Branch.pm >index bdc01dc..7513cdd 100644 >--- a/C4/Branch.pm >+++ b/C4/Branch.pm >@@ -146,11 +146,11 @@ sub GetBranches { > } > > sub onlymine { >- return >- C4::Context->preference('IndependentBranches') && >- C4::Context->userenv && >- C4::Context->userenv->{flags} %2 != 1 && >- C4::Context->userenv->{branch} ; >+ return >+ C4::Context->preference('IndependentBranches') >+ && C4::Context->userenv >+ && !C4::Context->IsSuperLibrarian() >+ && C4::Context->userenv->{branch}; > } > > # always returns a string for OK comparison via "eq" or "ne" >diff --git a/C4/Items.pm b/C4/Items.pm >index 1d8fb0b..e037268 100644 >--- a/C4/Items.pm >+++ b/C4/Items.pm >@@ -2240,7 +2240,7 @@ sub DelItemCheck { > if ($onloan){ > $error = "book_on_loan" > } >- elsif ( !( C4::Context->userenv->{flags} & 1 ) >+ elsif ( !C4::Context->IsSuperLibrarian() > and C4::Context->preference("IndependentBranches") > and ( C4::Context->userenv->{branch} ne $item->{'homebranch'} ) ) > { >diff --git a/acqui/basket.pl b/acqui/basket.pl >index 6833eb6..e546948 100755 >--- a/acqui/basket.pl >+++ b/acqui/basket.pl >@@ -154,7 +154,7 @@ if ( $op eq 'delete_confirm' ) { > $template->param( delete_confirm => 1 ); > if ( C4::Context->preference("IndependentBranches") ) { > my $userenv = C4::Context->userenv; >- unless ( $userenv->{flags} == 1 ) { >+ unless ( C4::Context->IsSuperLibrarian() ) { > my $validtest = ( $basket->{creationdate} eq '' ) > || ( $userenv->{branch} eq $basket->{branch} ) > || ( $userenv->{branch} eq '' ) >@@ -257,7 +257,7 @@ if ( $op eq 'delete_confirm' ) { > # get librarian branch... > if ( C4::Context->preference("IndependentBranches") ) { > my $userenv = C4::Context->userenv; >- unless ( $userenv->{flags} == 1 ) { >+ unless ( C4::Context->IsSuperLibrarian() ) { > my $validtest = ( $basket->{creationdate} eq '' ) > || ( $userenv->{branch} eq $basket->{branch} ) > || ( $userenv->{branch} eq '' ) >diff --git a/acqui/neworderempty.pl b/acqui/neworderempty.pl >index 9c9eed3..9fdf032 100755 >--- a/acqui/neworderempty.pl >+++ b/acqui/neworderempty.pl >@@ -229,10 +229,11 @@ for my $curr ( @rates ) { > } > > # build branches list >-my $onlymine=C4::Context->preference('IndependentBranches') && >- C4::Context->userenv && >- C4::Context->userenv->{flags}!=1 && >- C4::Context->userenv->{branch}; >+my $onlymine = >+ C4::Context->preference('IndependentBranches') >+ && C4::Context->userenv >+ && !C4::Context->IsSuperLibrarian() >+ && C4::Context->userenv->{branch}; > my $branches = GetBranches($onlymine); > my @branchloop; > foreach my $thisbranch ( sort {$branches->{$a}->{'branchname'} cmp $branches->{$b}->{'branchname'}} keys %$branches ) { >diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl >index c1eb2e2..5c63aa3 100755 >--- a/cataloguing/additem.pl >+++ b/cataloguing/additem.pl >@@ -756,10 +756,11 @@ my $i=0; > > my $pref_itemcallnumber = C4::Context->preference('itemcallnumber'); > >-my $onlymine = C4::Context->preference('IndependentBranches') && >- C4::Context->userenv && >- C4::Context->userenv->{flags}!=1 && >- C4::Context->userenv->{branch}; >+my $onlymine = >+ C4::Context->preference('IndependentBranches') >+ && C4::Context->userenv >+ && !C4::Context->IsSuperLibrarian() >+ && C4::Context->userenv->{branch}; > my $branch = $input->param('branch') || C4::Context->userenv->{branch}; > my $branches = GetBranchesLoop($branch,$onlymine); # build once ahead of time, instead of multiple times later. > >diff --git a/circ/ysearch.pl b/circ/ysearch.pl >index 7429c06..8973902 100755 >--- a/circ/ysearch.pl >+++ b/circ/ysearch.pl >@@ -51,13 +51,13 @@ my $sql = q( > OR firstname LIKE ? > OR cardnumber LIKE ? ) > ); >-if (C4::Context->preference("IndependentBranches")){ >- if ( C4::Context->userenv >- && (C4::Context->userenv->{flags} % 2) !=1 >- && C4::Context->userenv->{'branch'} >- ){ >- $sql .= " AND borrowers.branchcode =" . $dbh->quote(C4::Context->userenv->{'branch'}); >- } >+if ( C4::Context->preference("IndependentBranches") >+ && C4::Context->userenv >+ && !C4::Context->IsSuperLibrarian() >+ && C4::Context->userenv->{'branch'} ) >+{ >+ $sql .= " AND borrowers.branchcode =" >+ . $dbh->quote( C4::Context->userenv->{'branch'} ); > } > > $sql .= q( ORDER BY surname, firstname LIMIT 10); >diff --git a/suggestion/suggestion.pl b/suggestion/suggestion.pl >index 7d50447..c0327ad 100755 >--- a/suggestion/suggestion.pl >+++ b/suggestion/suggestion.pl >@@ -288,10 +288,11 @@ if(defined($returnsuggested) and $returnsuggested ne "noone") > > #branch display management > my $branchfilter = ($displayby ne "branchcode") ? $input->param('branchcode') : ''; >-my $onlymine=C4::Context->preference('IndependentBranches') && >- C4::Context->userenv && >- C4::Context->userenv->{flags}!=1 && >- C4::Context->userenv->{branch}; >+my $onlymine = >+ C4::Context->preference('IndependentBranches') >+ && C4::Context->userenv >+ && !C4::Context->IsSuperLibrarian() >+ && C4::Context->userenv->{branch}; > my $branches = GetBranches($onlymine); > my @branchloop; > >diff --git a/tools/export.pl b/tools/export.pl >index a516a6b..9bbed0b 100755 >--- a/tools/export.pl >+++ b/tools/export.pl >@@ -120,13 +120,13 @@ my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user( > my $limit_ind_branch = > ( C4::Context->preference('IndependentBranches') > && C4::Context->userenv >- && !( C4::Context->userenv->{flags} & 1 ) >+ && !C4::Context->IsSuperLibrarian() > && C4::Context->userenv->{branch} ) ? 1 : 0; > > my $branch = $query->param("branch") || ''; > if ( C4::Context->preference("IndependentBranches") > && C4::Context->userenv >- && !( C4::Context->userenv->{flags} & 1 ) ) >+ && !C4::Context->IsSuperLibrarian() ) > { > $branch = C4::Context->userenv->{'branch'}; > } >-- >1.7.2.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 10277
:
18206
|
18421
|
18422
|
18425
|
18427
|
18518
|
19229
|
20776
|
21144
|
23479
|
23480
|
23481
|
23482
|
23518
|
23523
|
23634
|
23635
|
23860
|
23861