Bugzilla – Attachment 71030 Details for
Bug 18743
Filter suggestion lists correctly for IndependentBranches
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18743 - ALTERNATE: Take IndependantBranches syspref into account
Bug-18743---ALTERNATE-Take-IndependantBranches-sys.patch (text/plain), 3.62 KB, created by
Maksim Sen
on 2018-01-29 20:20:39 UTC
(
hide
)
Description:
Bug 18743 - ALTERNATE: Take IndependantBranches syspref into account
Filename:
MIME Type:
Creator:
Maksim Sen
Created:
2018-01-29 20:20:39 UTC
Size:
3.62 KB
patch
obsolete
>From 18733a16b4b4ed865301ac9a4b365cc7da627c77 Mon Sep 17 00:00:00 2001 >From: maksim <maksim@inlibro.com> >Date: Mon, 29 Jan 2018 15:07:23 -0500 >Subject: [PATCH] Bug 18743 - ALTERNATE: Take IndependantBranches syspref into > account > >--- >THIS IS AN ALTERNATE PATCH >I am submitting it here, because it covers less than Alex's patch, but does so in a simpler fashion. >APPLY ONLY THIS PATCH, OR THE OTHER, NOT BOTH. >--- > >Displays suggestions for all libraries when IndependantBranches is set to no, or user is Super librarian by adding a missing if statement. > >TEST PLAN >[0] Apply patch >[1] Set IndependentBranches to 'Yes'. >[2] Create a suggestion with a user from branch A. >[3] As a superlibrarian, visit the suggestion page, you should see the suggestion. >[4] As staff from branch A, visit the sugg. page, you should see the suggestion. >[5] As staff from branch B, visit the sugg. pase, you should NOT see the suggestion. >[6] As staff from branch A, make sure the amount of suggestions to the left of "Suggestions pending approval: " > is the same as the amount of suggestions in the suggestions page. >[7] Set IndependentBranches to 'No'. >[8] Redo step 3-5. You should always see the suggestion. >[9] Sign-off. >[10] Have fun. >--- > C4/Suggestions.pm | 14 ++++++++------ > suggestion/suggestion.pl | 6 ++++-- > 2 files changed, 12 insertions(+), 8 deletions(-) > >diff --git a/C4/Suggestions.pm b/C4/Suggestions.pm >index 1ea2339..eff93c8 100644 >--- a/C4/Suggestions.pm >+++ b/C4/Suggestions.pm >@@ -135,12 +135,14 @@ sub SearchSuggestion { > if ( C4::Context->preference('IndependentBranches') ) { > my $userenv = C4::Context->userenv; > if ($userenv) { >- if ( !C4::Context->IsSuperLibrarian() && !$suggestion->{branchcode} ) >+ if ( !C4::Context->IsSuperLibrarian()) > { >- push @sql_params, $$userenv{branch}; >- push @query, q{ >- AND (suggestions.branchcode=? OR suggestions.branchcode='') >- }; >+ if( !$suggestion->{branchcode} || $suggestion->{branchcode} eq $userenv->{branch}){ >+ push @sql_params, $$userenv{branch}; >+ push @query, q{ >+ AND (suggestions.branchcode=? OR suggestions.branchcode='') >+ }; >+ } > } > } > } else { >@@ -405,7 +407,7 @@ sub CountSuggestion { > FROM suggestions > LEFT JOIN borrowers ON borrowers.borrowernumber=suggestions.suggestedby > WHERE STATUS=? >- AND (borrowers.branchcode='' OR borrowers.branchcode=?) >+ AND (suggestions.branchcode='' OR suggestions.branchcode=?) > }; > $sth = $dbh->prepare($query); > $sth->execute( $status, $userenv->{branch} ); >diff --git a/suggestion/suggestion.pl b/suggestion/suggestion.pl >index 94e6eab..c13f57d 100755 >--- a/suggestion/suggestion.pl >+++ b/suggestion/suggestion.pl >@@ -261,8 +261,10 @@ if ($op=~/else/) { > my @allsuggestions; > foreach my $criteriumvalue ( @criteria_dv ) { > # By default, display suggestions from current working branch >- unless ( exists $$suggestion_ref{'branchcode'} ) { >- $$suggestion_ref{'branchcode'} = C4::Context->userenv->{'branch'}; >+ if (C4::Context->preference('IndependentBranches') && !C4::Context->IsSuperLibrarian()) { >+ unless ( exists $$suggestion_ref{'branchcode'} ) { >+ $$suggestion_ref{'branchcode'} = C4::Context->userenv->{'branch'}; >+ } > } > my $definedvalue = defined $$suggestion_ref{$displayby} && $$suggestion_ref{$displayby} ne ""; > >-- >2.7.4
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 18743
:
64742
|
64763
|
64768
|
68298
|
71030
|
72637
|
72679
|
94300
|
94417
|
94418
|
94515
|
94516
|
94737
|
94738
|
94739
|
94740
|
94741
|
94742