Bugzilla – Attachment 94300 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: Fix suggestion listing when organized by library
Bug-18743-Fix-suggestion-listing-when-organized-by.patch (text/plain), 4.25 KB, created by
Jonathan Druart
on 2019-10-16 15:07:05 UTC
(
hide
)
Description:
Bug 18743: Fix suggestion listing when organized by library
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2019-10-16 15:07:05 UTC
Size:
4.25 KB
patch
obsolete
>From 4b52196ead6df3f3d3a47a4ba2b3dfbbabee9dce Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 16 Oct 2019 16:43:46 +0200 >Subject: [PATCH] Bug 18743: Fix suggestion listing when organized by library > >There are some weird behaviors happening when using the "Organize by: >library" dropdown along with the library filter (in the "Acquisition >information" box). > >I am suggesting the following test plan: >0. Create several suggestion from different libraries > >A. You are superlibrarian and IndependentBranches is not set >1. Hit /suggestion/suggestion.pl >=> Default view shows the suggestions from your library >2. Filter by another library >=> You see the suggestions from this library >3. Filter by "Any" libraries >=> You see all the suggestions >4. "Organize by library" >=> You see all the suggestions, organized by library >5. Filter by a specific library >=> You see the suggestion from your library, all in one tab > >B. You are not superlibrarian and IndependentBranches >Same as A. > >C. You are superlibrarian and IndependentBranches is set >Same as A. > >D. You are not superlibrarian and IndependentBranches is not set >You will never see suggestions coming from outside your library > >QA: To be clear: the whole script needs a rewrite, but here we are just >trying to fix weird behaviors. >--- > C4/Suggestions.pm | 2 +- > suggestion/suggestion.pl | 11 +++++++---- > 2 files changed, 8 insertions(+), 5 deletions(-) > >diff --git a/C4/Suggestions.pm b/C4/Suggestions.pm >index 2cc06c99e0..b1a4d8a067 100644 >--- a/C4/Suggestions.pm >+++ b/C4/Suggestions.pm >@@ -138,7 +138,7 @@ sub SearchSuggestion { > if ( C4::Context->preference('IndependentBranches') ) { > my $userenv = C4::Context->userenv; > if ($userenv) { >- if ( !C4::Context->IsSuperLibrarian() && !$suggestion->{branchcode} ) >+ if ( !C4::Context->IsSuperLibrarian() || !$suggestion->{branchcode} ) > { > push @sql_params, $$userenv{branch}; > push @query, q{ >diff --git a/suggestion/suggestion.pl b/suggestion/suggestion.pl >index ed043083bd..01311f1a9d 100755 >--- a/suggestion/suggestion.pl >+++ b/suggestion/suggestion.pl >@@ -117,6 +117,7 @@ my ( $template, $borrowernumber, $cookie, $userflags ) = get_template_and_user( > > $borrowernumber = $input->param('borrowernumber') if ( $input->param('borrowernumber') ); > $template->param('borrowernumber' => $borrowernumber); >+my $branchfilter = $input->param('branchcode') || C4::Context->userenv->{'branch'}; > > ######################################### > ## Operations >@@ -255,7 +256,6 @@ if ($op=~/else/) { > $op='else'; > > $displayby||="STATUS"; >- delete $$suggestion_ref{'branchcode'} if($displayby eq "branchcode"); > # distinct values of display by > my $criteria_list=GetDistinctValues("suggestions.".$displayby); > my (@criteria_dv, $criteria_has_empty); >@@ -269,6 +269,11 @@ if ($op=~/else/) { > # aggregate null and empty values under empty value > push @criteria_dv, '' if $criteria_has_empty; > >+ # Hack to not modify GetDistinctValues for this specific case >+ if ( $displayby eq 'branchcode' && C4::Context->preference('IndependentBranches') ) { >+ @criteria_dv = [ C4::Context->userenv->{'branch'} ]; >+ } >+ > my @allsuggestions; > foreach my $criteriumvalue ( @criteria_dv ) { > # By default, display suggestions from current working branch >@@ -277,7 +282,7 @@ if ($op=~/else/) { > } > my $definedvalue = defined $$suggestion_ref{$displayby} && $$suggestion_ref{$displayby} ne ""; > >- next if ( $definedvalue && $$suggestion_ref{$displayby} ne $criteriumvalue ); >+ next if ( $definedvalue && $$suggestion_ref{$displayby} ne $criteriumvalue ) and ($displayby ne 'branchcode' or $branchfilter ne '__ANY__' ); > $$suggestion_ref{$displayby} = $criteriumvalue; > > my $suggestions = &SearchSuggestion($suggestion_ref); >@@ -332,8 +337,6 @@ if(defined($returnsuggested) and $returnsuggested ne "noone") > print $input->redirect("/cgi-bin/koha/members/moremember.pl?borrowernumber=".$returnsuggested."#suggestions"); > } > >-my $branchfilter = ($displayby ne "branchcode") ? $input->param('branchcode') : C4::Context->userenv->{'branch'}; >- > $template->param( > branchfilter => $branchfilter, > ); >-- >2.11.0
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