Bugzilla – Attachment 22152 Details for
Bug 11091
limits in catalog search when creating subscription
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 11091 - limits in catalog search when creating subscription
0001-Bug-11091-limits-in-catalog-search-when-creating-sub.patch (text/plain), 7.81 KB, created by
Fridolin Somers
on 2013-10-21 10:18:59 UTC
(
hide
)
Description:
Bug 11091 - limits in catalog search when creating subscription
Filename:
MIME Type:
Creator:
Fridolin Somers
Created:
2013-10-21 10:18:59 UTC
Size:
7.81 KB
patch
obsolete
>From 0521e274b4da2143d7c4b16b141684d330cc3d97 Mon Sep 17 00:00:00 2001 >From: Fridolyn SOMERS <fridolyn.somers@biblibre.com> >Date: Mon, 21 Oct 2013 11:54:16 +0200 >Subject: [PATCH 1/2] Bug 11091 - limits in catalog search when creating > subscription > >When creating a new subscription, you can click on "Search for Bilbio" to search into catalog. >A popup opens with a text field for search terms and a combo-box to limit search. >This combo-box uses the syspref AdvancedSearchTypes to know what list of values display. >The bug is that the code acts has if AdvancedSearchTypes has always one value, but since Bug 7031, this syspref can have several values (item types, collection codes and locations). > >This patch removes the use of AdvancedSearchTypes syspref and defines search form with 2 limits : item types and collection codes (from authorised values CCODE). >One or both of this information can be on biblio. Searching by location seems to be useless because this information is always on item. >If CCODE authorised value does not exist or is empty, the collection code filter is not displayed. > >Test plan : >- Check CCODE authorised value exists with some values >- Choose a biblio indexed with both itemtype and ccode indexes >- Go to Serials module and click on "New subscription" >- In form, click on "Search for Biblio" >=> The popup "serials/subscription-bib-search.pl" appears with two limits >- Enter a word of biblio title, select its item type and select its collection code >- Click on "Search" >=> You get the biblio >--- > .../en/modules/serials/subscription-bib-search.tt | 55 +++++++++++------- > serials/subscription-bib-search.pl | 66 +++++++--------------- > 2 files changed, 53 insertions(+), 68 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-bib-search.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-bib-search.tt >index f78d5e0..6c710e8 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-bib-search.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-bib-search.tt >@@ -14,28 +14,41 @@ > <form name="f" action="/cgi-bin/koha/serials/subscription-bib-search.pl" method="get"> > <input type="hidden" name="op" value="do_search" /> > <input type="hidden" name="type" value="intranet" /> >- <fieldset class="rows"> >- <ol> >- <li><label for="q">Keyword: </label> >- <input type="text" id="q" name="q" /></li> >- >- <!-- ITEMTYPE LIMITS --> >- <li><label for="itemtypelimit">Limit type to: </label> >- <select name="itemtypelimit" id="itemtypelimit"> >- <option value="">All</option> >- [% FOREACH itemtypeloo IN itemtypeloop %] >- <option value="[% itemtypeloo.code %]"> >- [% itemtypeloo.description |html %] >- </option> >- [% END %] >- </select> >+ <fieldset class="brief"> >+ <ol> >+ <li> >+ <label for="q">Keyword: </label> >+ <input type="text" id="q" name="q" /> > </li> >- <!-- /ITEMTYPE LIMITS --> >- </ol> >-</fieldset> >-<fieldset class="action"><input type="submit" value="Search" /></fieldset> >- >- >+ <li> >+ <label for="itemtypelimit">Limit item type to: </label> >+ <select name="itemtypelimit" id="itemtypelimit"> >+ <option value="">All</option> >+ [%- FOREACH itemtypeloo IN itemtypeloop %] >+ <option value="[% itemtypeloo.code %]"> >+ [% itemtypeloo.description |html %] >+ </option> >+ [%- END %] >+ </select> >+ </li> >+ [%- IF ccodeloop %] >+ <li> >+ <label for="ccodelimit">Limit collection code to: </label> >+ <select name="ccodelimit" id="ccodelimit"> >+ <option value="">All</option> >+ [%- FOREACH ccodeloo IN ccodeloop %] >+ <option value="[% ccodeloo.code %]"> >+ [% ccodeloo.description |html %] >+ </option> >+ [%- END %] >+ </select> >+ </li> >+ [%- END %] >+ </ol> >+ </fieldset> >+ <fieldset class="action"> >+ <input type="submit" value="Search" /> >+ </fieldset> > </form> > > </div> >diff --git a/serials/subscription-bib-search.pl b/serials/subscription-bib-search.pl >index 95e4aa7..c512ac4 100755 >--- a/serials/subscription-bib-search.pl >+++ b/serials/subscription-bib-search.pl >@@ -70,7 +70,6 @@ $startfrom=0 unless $startfrom; > my ($template, $loggedinuser, $cookie); > my $resultsperpage; > >-my $advanced_search_types = C4::Context->preference("AdvancedSearchTypes"); > my $itype_or_itemtype = (C4::Context->preference("item-level_itypes"))?'itype':'itemtype'; > > my $query = $input->param('q'); >@@ -87,23 +86,12 @@ if ($op eq "do_search" && $query) { > } > ); > >- # add the itemtype limit if applicable >+ # add the limits if applicable > my $itemtypelimit = $input->param('itemtypelimit'); >- if ( $itemtypelimit ) { >- my $QParser; >- $QParser = C4::Context->queryparser if (C4::Context->preference('UseQueryParser')); >- my $op; >- if ($QParser) { >- $op = '&&'; >- } else { >- $op = 'and'; >- } >- if (!$advanced_search_types or $advanced_search_types eq 'itemtypes') { >- $query .= " $op $itype_or_itemtype:$itemtypelimit"; >- } else { >- $query .= " $op $advanced_search_types:$itemtypelimit"; >- } >- } >+ my $ccodelimit = $input->param('ccodelimit'); >+ my $op = C4::Context->preference('UseQueryParser') ? '&&' : 'and'; >+ $query .= " $op $itype_or_itemtype:$itemtypelimit" if $itemtypelimit; >+ $query .= " $op ccode:$ccodelimit" if $ccodelimit; > $debug && warn $query; > $resultsperpage= $input->param('resultsperpage'); > $resultsperpage = 20 if(!defined $resultsperpage); >@@ -200,50 +188,34 @@ else { > flagsrequired => {catalogue => 1, serials => '*'}, > debug => 1, > }); >+ > # load the itemtypes >- my $itemtypes = GetItemTypes; >+ my $itemtypes = GetItemTypes(); > my @itemtypesloop; >- if (!$advanced_search_types or $advanced_search_types eq 'itemtypes') { >- # load the itemtypes >- my $itemtypes = GetItemTypes; >- my $selected=1; >- my $cnt; > foreach my $thisitemtype ( sort {$itemtypes->{$a}->{'description'} cmp $itemtypes->{$b}->{'description'} } keys %$itemtypes ) { > my %row =( > code => $thisitemtype, >- selected => $selected, > description => $itemtypes->{$thisitemtype}->{'description'}, > ); >- $selected = 0 if ($selected) ; > push @itemtypesloop, \%row; > } > >- >- } else { >- my $advsearchtypes = GetAuthorisedValues($advanced_search_types); >- my $cnt; >- my $selected=1; >- for my $thisitemtype (sort {$a->{'lib'} cmp $b->{'lib'}} @$advsearchtypes) { >+ # load Collection Codes >+ my $authvalues = GetAuthorisedValues('CCODE'); >+ my @ccodesloop; >+ for my $thisauthvalue (sort {$a->{'lib'} cmp $b->{'lib'}} @$authvalues) { > my %row =( >- number=>$cnt++, >- ccl => $advanced_search_types, >- code => $thisitemtype->{authorised_value}, >- selected => $selected, >- description => $thisitemtype->{'lib'}, >- count5 => $cnt % 4, >- imageurl=> getitemtypeimagelocation( 'intranet', $thisitemtype->{'imageurl'} ), >+ code => $thisauthvalue->{'authorised_value'}, >+ description => $thisauthvalue->{'lib'}, > ); >- push @itemtypesloop, \%row; >+ push @ccodesloop, \%row; > } >- } >- > >- if ($op eq "do_search") { >- $template->param("no_query" => 1); >- } else { >- $template->param("no_query" => 0); >- } >- $template->param(itemtypeloop => \@itemtypesloop); >+ $template->param( >+ itemtypeloop => \@itemtypesloop, >+ ccodeloop => \@ccodesloop, >+ no_query => $op eq "do_search" ? 1 : 0, >+ ); > } > # Print the page > output_html_with_http_headers $input, $cookie, $template->output; >-- >1.8.3.2 >
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 11091
:
22152
|
22153
|
22174
|
22176
|
22177
|
22178
|
22179
|
22479
|
22480