Bugzilla – Attachment 117220 Details for
Bug 21249
Syspref to choose whether to search homebranch, holding branch or both for library groups in advanced search
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21249: New syspref controlling branch fields queried against selected library group value in advanced search
Bug-21249-New-syspref-controlling-branch-fields-qu.patch (text/plain), 9.35 KB, created by
Aleisha Amohia
on 2021-02-23 22:04:17 UTC
(
hide
)
Description:
Bug 21249: New syspref controlling branch fields queried against selected library group value in advanced search
Filename:
MIME Type:
Creator:
Aleisha Amohia
Created:
2021-02-23 22:04:17 UTC
Size:
9.35 KB
patch
obsolete
>From 77d46b7f1a48dda24e9f4f238fc6eda44311b92a Mon Sep 17 00:00:00 2001 >From: Alex Buckley <alexbuckley@catalyst.net.nz> >Date: Mon, 20 Aug 2018 21:49:43 +1200 >Subject: [PATCH] Bug 21249: New syspref controlling branch fields queried > against selected library group value in advanced search > >This commit allows librarians to choose whether they want to query the >homebranch, holdingbranch or homebranch AND holdingbranch when they set >a library or library group search condition in the staff client and OPAC >advanced searches. > >Test plan: >1. Apply patches, update database, restart services >2. Set up a record with one item. Edit the item so that: >home branch = Branch A >holding/current branch = Branch B. >Note the barcode of your item. >3. Go to Administration -> Library Groups. Create a library group that >only contains Branch A. > >= homebranch and holdingbranch = > >4. Go to Administration -> System preferences and find the new >SearchLimitLibrary syspref. Confirm it is set to 'homebranch and >holdingbranch' by default. Keep this tab open. >5. Go to Advanced Search in the staff client in another tab. Under 'location and >availability', select your library group from the dropdown. Under >'search for', select the barcode option and enter your item's barcode. >6. Submit the search and confirm you are taken to your item as expected. >7. Go back to Advanced Search. Under 'location and availability', select >Branch A from the individual libraries dropdown. Under 'search for', >select the barcode option and enter your item's barcode. >8. Submit the search and confirm you are taken to your item as expected. >9. Go back to Advanced Search. Under 'location and availability', select >Branch B from the individual libraries dropdown. Under 'search for', >select the barcode option and enter your item's barcode. >10. Submit the search and confirm you are taken to your item as expected. > >= homebranch only = > >11. Go back to your System preferences tab. Set the SearchLimitLibrary >syspref to 'homebranch'. keep this tab open. >12. Go to Advanced Search in the staff client in another tab. Under 'location and >availability', select your library group from the dropdown. Under >'search for', select the barcode option and enter your item's barcode. >13. Submit the search and confirm you are taken to your item as expected, >because the syspref is set to homebranch and the library group contains our item's >homebranch. >14. Go back to Advanced Search. Under 'location and availability', select >Branch A from the individual libraries dropdown. Under 'search for', >select the barcode option and enter your item's barcode. >15. Submit the search and confirm you are taken to your item as expected. >16. Go back to Advanced Search. Under 'location and availability', select >Branch B from the individual libraries dropdown. Under 'search for', >select the barcode option and enter your item's barcode. >17. Submit the search and confirm you are NOT taken to your item and your item >does not show in the search results. > >= holdingbranch only = > >18. Go back to your System preferences tab. Set the SearchLimitLibrary >syspref to 'holdingbranch'. keep this tab open. >19. Go to Advanced Search in the staff client in another tab. Under 'location and >availability', select your library group from the dropdown. Under >'search for', select the barcode option and enter your item's barcode. >20. Submit the search and confirm you are NOT taken to your item and your >item does not show in the search results, because the syspref is set to >holdingbranch and the library group does not contain our item's holdingbranch. >21. Go back to Advanced Search. Under 'location and availability', select >Branch B from the individual libraries dropdown. Under 'search for', >select the barcode option and enter your item's barcode. >22. Submit the search and confirm you are taken to your item as expected. >23. Go back to Advanced Search. Under 'location and availability', select >Branch A from the individual libraries dropdown. Under 'search for', >select the barcode option and enter your item's barcode. >24. Submit the search and confirm you are NOT taken to your item and your item >does not show in the search results. > >25. Repeat the above test plan but do your searching with the OPAC >advanced search. > >Sponsored-By: Brimbank Library > >Signed-off-by: Amandine Zocca <azocca@ville-montauban.fr> > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > catalogue/search.pl | 15 +++++++++++++-- > .../bug_21249-Branch_to_limit_advanced_search_results.sql | 1 + > .../prog/en/modules/admin/preferences/searching.pref | 8 ++++++++ > opac/opac-search.pl | 15 +++++++++++++-- > 4 files changed, 35 insertions(+), 4 deletions(-) > create mode 100644 installer/data/mysql/atomicupdate/bug_21249-Branch_to_limit_advanced_search_results.sql > >diff --git a/catalogue/search.pl b/catalogue/search.pl >index 1419759c85..806eb04143 100755 >--- a/catalogue/search.pl >+++ b/catalogue/search.pl >@@ -375,11 +375,22 @@ my @nolimits = map uri_unescape($_), $cgi->multi_param('nolimit'); > my %is_nolimit = map { $_ => 1 } @nolimits; > @limits = grep { not $is_nolimit{$_} } @limits; > >+my $branchfield = C4::Context->preference('AdvancedSearchBranchFieldToUse'); >+ > if($params->{'multibranchlimit'}) { > my $search_group = Koha::Library::Groups->find( $params->{multibranchlimit} ); > my @libraries = $search_group->all_libraries; >- my $multibranch = '('.join( " OR ", map { '(homebranch: ' . $_->branchcode .')' } @libraries ) .')'; >- push @limits, $multibranch if ($multibranch ne '()'); >+ >+ if ( $branchfield eq "homebranch") { >+ my $multihomebranch = '('.join( " OR ", map { 'homebranch: ' . $_->branchcode } @libraries ) .')'; >+ push @limits, $multihomebranch if ( $multihomebranch ne '()'); >+ } elsif ( $branchfield eq "holdingbranch") { >+ my $multiholdingbranch = '('.join( " OR ", map { 'holdingbranch: ' . $_->branchcode } @libraries ) .')'; >+ push @limits, $multiholdingbranch if ( $multiholdingbranch ne '()'); >+ } else { >+ my $multihomeandholdingbranch = '('.join( " OR ", map { 'homebranch: ' . $_->branchcode, 'holdingbranch: ' . $_->branchcode} @libraries ) .')'; >+ push @limits, $multihomeandholdingbranch if ($multihomeandholdingbranch ne '()'); >+ } > } > > my $available; >diff --git a/installer/data/mysql/atomicupdate/bug_21249-Branch_to_limit_advanced_search_results.sql b/installer/data/mysql/atomicupdate/bug_21249-Branch_to_limit_advanced_search_results.sql >new file mode 100644 >index 0000000000..08e6e38e01 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_21249-Branch_to_limit_advanced_search_results.sql >@@ -0,0 +1 @@ >+INSERT INTO systempreferences (variable, value, options, explanation, type) VALUES ('AdvancedSearchBranchFieldToUse', 'homebranch and holdingbranch', 'homebranch|holdingbranch|homebranch and holdingbranch', 'When a library or group of libraries is selected from the advanced search compare the selected branch value against this branch field(s) selected', 'choice'); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref >index eaaf56344b..fa8252ddf9 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref >@@ -168,6 +168,14 @@ Searching: > az: from A to Z. > za: from Z to A. > - >+ - pref: AdvancedSearchBranchFieldToUse >+ default: homebranch and holdingbranch >+ choices: >+ homebranch: homebranch >+ holdingbranch: holdingbranch >+ homebranch and holdingbranch: homebranch and holdingbranch >+ - When a library or group of libraries is selected from the advanced search compare the selected branch value against this branch field(s) selected >+ - > - pref: displayFacetCount > type: boolean > default: no >diff --git a/opac/opac-search.pl b/opac/opac-search.pl >index dd0d4884dc..8246c34493 100755 >--- a/opac/opac-search.pl >+++ b/opac/opac-search.pl >@@ -495,11 +495,22 @@ if (@searchCategories > 0) { > > @limits = map { uri_unescape($_) } @limits; > >+my $branchfield = C4::Context->preference('AdvancedSearchBranchFieldToUse'); >+ > if($params->{'multibranchlimit'}) { > my $search_group = Koha::Library::Groups->find( $params->{multibranchlimit} ); > my @libraries = $search_group->all_libraries; >- my $multibranch = '('.join( " OR ", map { 'homebranch: ' . $_->branchcode } @libraries ) .')'; >- push @limits, $multibranch if ($multibranch ne '()'); >+ >+ if ( $branchfield eq "homebranch" ) { >+ my $multihomebranch = '('.join( " OR ", map { 'homebranch: ' . $_->branchcode } @libraries ) .')'; >+ push @limits, $multihomebranch if ( $multihomebranch ne '()'); >+ } elsif ( $branchfield eq "holdingbranch") { >+ my $multiholdingbranch = '('.join( " OR ", map { 'holdingbranch: ' . $_->branchcode } @libraries ) .')'; >+ push @limits, $multiholdingbranch if ( $multiholdingbranch ne '()'); >+ } else { >+ my $multihomeandholdingbranch = '('.join( " OR ", map { 'homebranch: ' . $_->branchcode, 'holdingbranch: ' . $_->branchcode} @libraries ) .')'; >+ push @limits, $multihomeandholdingbranch if ($multihomeandholdingbranch ne '()'); >+ } > } > > my $available; >-- >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 21249
:
78013
|
78014
|
78921
|
82138
|
83518
|
93345
|
93346
|
95099
|
95100
|
95101
|
103618
|
103619
|
103620
|
103621
|
103622
|
117220
|
117221
|
117222
|
117223
|
117224
|
120481
|
120567
|
120568
|
120569
|
120570
|
120571
|
120572
|
120575
|
120576
|
120577
|
120578
|
120579
|
120580