Bugzilla – Attachment 29383 Details for
Bug 10937
Advanced search: Hide itemtypes from search form & Group itemtypes together into one search option
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 10947 - Follow-up to: 'Review of attachment 28626'
Bug-10947---Follow-up-to-Review-of-attachment-2862.patch (text/plain), 10.96 KB, created by
Maxime Beaulieu
on 2014-06-30 18:38:10 UTC
(
hide
)
Description:
Bug 10947 - Follow-up to: 'Review of attachment 28626'
Filename:
MIME Type:
Creator:
Maxime Beaulieu
Created:
2014-06-30 18:38:10 UTC
Size:
10.96 KB
patch
obsolete
>From 418d8a074168f80432ada1009aec9f94ca2df3e0 Mon Sep 17 00:00:00 2001 >From: mbeaulieu <mbeaulieu@inlibro.com> >Date: Mon, 30 Jun 2014 14:07:41 -0400 >Subject: [PATCH] Bug 10947 - Follow-up to: 'Review of attachment 28626' > >C4/Koha.pm: Perldoc has been updated to better describe subroutine behaviour and usage. >itemtypes.tt: The 'IF/ELSE' was used to distiguish between the 'ADD' and 'MODIFY' screens. It has been removed and the same 'select' is now used for both cases. >opac-advsearch.tt (both files): I've reformatted the code to improve readability. > >CURRENT TEST PLAN >------------------ >0) Back up database, so you can reset and retest easily. ;) >1) Apply the patch >2) Run Koha QA tool. >3) prove -v t/db_dependent/Koha.t > -- all tests should pass. >4) run ./installer/data/mysql/updatedatabase.pl to add the > two columns to itemtypes > -- Does a meaningful message get printed? > Are the columns added? > "DESCRIBE itemtypes;" should list hideinopac and > searchcategory. >5) You need to add a category to group your item types: > a) In Intranet/Koha Admin/Authorized values, > select DOCTYPECAT in the 'Show category:' dropdown > i) If you do not have a DOCTYPECAT category, create one. > b) Click button "New authorized value for DOCTYPECAT" > c) Enter > Authorized value: HARDWARE > Description : Hardware > Description (OPAC): Hardware >6) Group your items under that new category > a) In Intranet/Koha Admin/Item types, choose (at least) > two item types and for each: > - Click action/Edit on the right column > - Third row (below Description) is the Search category > list box, select Hardware > - click Save changes at the bottom >7) Select at least one item to be hidden in the OPAC search > a) In Intranet/Koha Admin/Item types (again), choose a > different item type: > - Click action/Edit > - Click the checkbox "Hide in OPAC" below the list of > icons. >8) Go test your modifications > a) Go to OPAC/Adv search. > b) Validate that all items modified above (hidden or grouped) > do not appear in Item type list > c) Validate that new item type Hardware does appear instead. > d) Select item Hardware, start Search. > e) Validate returned items are the of the two types that were > grouped into the Hardware category in step 4. > >Sponsored-by: Vanier college > >http://bugs.koha-community.org/show_bug.cgi?id=10937 >--- > C4/Koha.pm | 12 +++++++----- > .../prog/en/modules/admin/itemtypes.tt | 14 -------------- > .../bootstrap/en/modules/opac-advsearch.tt | 18 ++++++++++++++++-- > .../opac-tmpl/prog/en/modules/opac-advsearch.tt | 18 ++++++++++++++++-- > 4 files changed, 39 insertions(+), 23 deletions(-) > >diff --git a/C4/Koha.pm b/C4/Koha.pm >index f577907..1b3efd6 100644 >--- a/C4/Koha.pm >+++ b/C4/Koha.pm >@@ -278,14 +278,17 @@ sub GetItemTypes { > > =head2 GetItemTypesCategorized > >-Returns item types but grouped by category if available. >+ $categories = GetItemTypesCategorized(); >+ >+Returns a hashref containing search categories. >+A search category will be put in the hash if at least one of its itemtypes is visible in OPAC. > The categories must be part of Authorized Values (DOCTYPECAT) > > =cut > > sub GetItemTypesCategorized { > my $dbh = C4::Context->dbh; >- # Order is important, so that partially hidden search >+ # Order is important, so that partially hidden (some items are not visible in OPAC) search > # categories will be visible. hideinopac=0 must be last. > my $query = qq| > SELECT itemtype, description, imageurl, hideinopac, 0 as 'iscat' FROM itemtypes WHERE ISNULL(searchcategory) or length(searchcategory) = 0 >@@ -313,15 +316,14 @@ sub GetItemTypesCategorized { > while ( my $IT = $sth->fetchrow_hashref ) { > $itemtypes{ $IT->{'itemtype'} } = $IT; > } >- > return ( \%itemtypes ); > } > > =head2 GetItemTypesByCategory > >- $category = category filter >+ @results = GetItemTypesByCategory( $searchcategory ); > >-Returns the itemtypes that are grouped into the category. >+Returns the itemtype code of all itemtypes included in a searchcategory. > > =cut > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt >index 2467902..7cce082 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt >@@ -109,7 +109,6 @@ Item types administration > [% END %] > <li> > <label for="description" class="required">Description: </label><input type="text" id="description" name="description" size="48" value="[% description |html %]" required="required" /> <span class="required">Required</span></li> >- [% IF ( itemtype ) %] > <li> > <span class="label">Search category</span> > <select id="searchcategory" name="searchcategory"> >@@ -128,19 +127,6 @@ Item types administration > </select> > (Options are defined as the authorized values for the DOCTYPECAT category) > </li> >- [% ELSE %] >- <li> >- <span class="label">Search category</span> >- <select id="searchcategory" name="searchcategory"> >- <option value="" /> >- [% FOREACH cat IN searchcategory %] >- <option value="[% cat.authorised_value %]" > >- [% cat.lib %] >- </option> >- [% END %] >- </select> >- </li> >- [% END %] > > [% IF ( noItemTypeImages ) %] > <li><span class="label">Image: </span>Item type images are disabled. To enable them, turn off the <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=noItemTypeImages">noItemTypeImages system preference</a></li></ol> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-advsearch.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-advsearch.tt >index f4f9fe0..11fde15 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-advsearch.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-advsearch.tt >@@ -142,8 +142,22 @@ > <div class="row-fluid"> > [% FOREACH itemtypeloo IN advsearchloo.code_loop %] > [% IF ((!itemtypeloo.searchcategory) AND (itemtypeloo.cat == 0)) OR (itemtypeloo.cat == 1) %] >- <div class="span3"><input type="checkbox" id="[% itemtypeloo.ccl FILTER remove(',') %]-[% itemtypeloo.number %]" name="[% IF ( itemtypeloo.cat == 1 ) %]searchcat[% ELSE %]limit[% END %]" value="[% IF ( itemtypeloo.cat == 1 ) %][% itemtypeloo.code %][% ELSE %]mc-[% itemtypeloo.ccl %]:[% itemtypeloo.code %][% END %]"/><label for="[% itemtypeloo.ccl FILTER remove(',') %]-[% itemtypeloo.number %]">[% UNLESS ( noItemTypeImages ) %][% IF ( itemtypeloo.imageurl ) %]<img border="0" src="[% itemtypeloo.imageurl %]" alt="[% itemtypeloo.description %]" />[% END %] [% END %] >- [% itemtypeloo.description %]</label></div> >+ <div class="span3"> >+ <input type="checkbox" >+ id="[% itemtypeloo.ccl FILTER remove(',') %]-[% itemtypeloo.number %]" >+ name="[% IF ( itemtypeloo.cat == 1 ) %]searchcat[% ELSE %]limit[% END %]" >+ value="[% IF ( itemtypeloo.cat == 1 ) %][% itemtypeloo.code %][% ELSE %]mc-[% itemtypeloo.ccl %]:[% itemtypeloo.code %][% END %]" >+ /> >+ <label for="[% itemtypeloo.ccl FILTER remove(',') %]-[% itemtypeloo.number %]"> >+ [% UNLESS ( noItemTypeImages ) %] >+ [% IF ( itemtypeloo.imageurl ) %] >+ <img border="0" src="[% itemtypeloo.imageurl %]" alt="[% itemtypeloo.description %]" /> >+ [% END %] >+ >+ [% END %] >+ [% itemtypeloo.description %] >+ </label> >+ </div> > [% IF ( loop.last ) %]</div>[% ELSE %][% UNLESS ( loop.count % 4 ) %]</div><div class="row-fluid">[% END %][% END %] > [% END %] > [% END %] >diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-advsearch.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-advsearch.tt >index 8bf2dc0..55dc6b3 100644 >--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-advsearch.tt >+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-advsearch.tt >@@ -188,8 +188,22 @@ > <tr> > [% FOREACH itemtypeloo IN advsearchloo.code_loop %] > [% IF ((!itemtypeloo.searchcategory) AND (itemtypeloo.cat == 0)) OR (itemtypeloo.cat == 1) %] >- <td><input type="checkbox" id="[% itemtypeloo.ccl FILTER remove(',') %]-[% itemtypeloo.number %]" name="[% IF ( itemtypeloo.cat == 1 ) %]searchcat[% ELSE %]limit[% END %]" value="[% IF ( itemtypeloo.cat == 1 ) %][% itemtypeloo.code %][% ELSE %]mc-[% itemtypeloo.ccl %]:[% itemtypeloo.code %][% END %]"/><label for="[% itemtypeloo.ccl FILTER remove(',') %]-[% itemtypeloo.number %]">[% UNLESS ( noItemTypeImages ) %][% IF ( itemtypeloo.imageurl ) %]<img border="0" src="[% itemtypeloo.imageurl %]" alt="[% itemtypeloo.description %]" />[% END %] [% END %] >- [% itemtypeloo.description %]</label></td> >+ <td> >+ <input type="checkbox" >+ id="[% itemtypeloo.ccl FILTER remove(',') %]-[% itemtypeloo.number %]" >+ name="[% IF ( itemtypeloo.cat == 1 ) %]searchcat[% ELSE %]limit[% END %]" >+ value="[% IF ( itemtypeloo.cat == 1 ) %][% itemtypeloo.code %][% ELSE %]mc-[% itemtypeloo.ccl %]:[% itemtypeloo.code %][% END %]" >+ /> >+ <label for="[% itemtypeloo.ccl FILTER remove(',') %]-[% itemtypeloo.number %]"> >+ [% UNLESS ( noItemTypeImages ) %] >+ [% IF ( itemtypeloo.imageurl ) %] >+ <img border="0" src="[% itemtypeloo.imageurl %]" alt="[% itemtypeloo.description %]"/> >+ [% END %] >+ >+ [% END %] >+ [% itemtypeloo.description %] >+ </label> >+ </td> > [% END %] > [% IF ( loop.last ) %]</tr>[% ELSE %][% UNLESS ( loop.count % 5 ) %]</tr><tr>[% END %][% END %] > [% END %] >-- >1.7.9.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 10937
:
22007
|
22276
|
24596
|
24597
|
24778
|
24779
|
24782
|
28571
|
28572
|
28573
|
28575
|
28576
|
28579
|
28624
|
28626
|
29383
|
30308
|
31896
|
34419
|
34635
|
34667
|
35452
|
36191
|
36240
|
36856
|
40884
|
42323