Bugzilla – Attachment 22276 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]
Sponsor: Vanier college
Sponsor-Vanier-college.patch (text/plain), 10.29 KB, created by
Blou
on 2013-10-22 14:36:20 UTC
(
hide
)
Description:
Sponsor: Vanier college
Filename:
MIME Type:
Creator:
Blou
Created:
2013-10-22 14:36:20 UTC
Size:
10.29 KB
patch
obsolete
>From 2fe6cf1c3ea58a96dbf5c52fedc42f1787321875 Mon Sep 17 00:00:00 2001 >From: Blou <philippe.blouin@inlibro.com> >Date: Tue, 22 Oct 2013 10:09:52 -0400 >Subject: [PATCH] Sponsor: Vanier college > >Following David Cook's comments, I made the following modifications: > >- C4/Koha.pm : include the non-NULL but empty category in the selection >- admin/authorised_values.pl : Added the DOCTYPECAT as default. Seemed the cleanest solution. >- installer/data/mysql/kohastructure.sql : cleaned the unwelcomed whitespaces. >- koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt : fixed typo and added instruction message >- koha-tmpl/opac-tmpl/prog/en/modules/opac-advsearch.tt : minimized the diff by redoing the code. > >New testing instructions. > >SETUP >0) run updatedatabase.pl to add the two columns to itemtypes >1) You need to add a category to group your item types: > a) In Intranet/Koha Admin/Authorized values, select DOCTYPECAT in the category dropdown > b) Click button "New authorized value for DOCTYPECAT" > c) Enter > Authorized value: HARDWARE > Description : Hardware > Description (OPAC): Hardware > >NORMAL USAGE >2) 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 >3) 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. > >FINAL TESTING >4) 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. > >http://bugs.koha-community.org/show_bug.cgi?id=10937 >--- > C4/Koha.pm | 5 ++--- > admin/authorised_values.pl | 2 +- > installer/data/mysql/kohastructure.sql | 23 ++++++++++---------- > .../prog/en/modules/admin/itemtypes.tt | 4 ++-- > .../opac-tmpl/prog/en/modules/opac-advsearch.tt | 20 ++++++----------- > 5 files changed, 24 insertions(+), 30 deletions(-) > >diff --git a/C4/Koha.pm b/C4/Koha.pm >index 44f098e..c2c53f3 100644 >--- a/C4/Koha.pm >+++ b/C4/Koha.pm >@@ -274,12 +274,11 @@ sub GetItemTypes { > sub GetItemTypesCategorized { > my $dbh = C4::Context->dbh; > my $query = qq| >- SELECT itemtype, description, imageurl, hideinopac, 0 as 'iscat' FROM itemtypes WHERE ISNULL(searchcategory) >+ SELECT itemtype, description, imageurl, hideinopac, 0 as 'iscat' FROM itemtypes WHERE ISNULL(searchcategory) or length(searchcategory) = 0 > UNION > SELECT DISTINCT searchcategory AS `itemtype`, authorised_values.lib_opac AS description, authorised_values.imageurl AS imageurl, hideinopac, 1 as 'iscat' > FROM itemtypes >- LEFT JOIN authorised_values ON searchcategory = authorised_value >- WHERE searchcategory > '' >+ LEFT JOIN authorised_values ON searchcategory = authorised_value WHERE searchcategory > '' > |; > my $sth = $dbh->prepare($query); > $sth->execute; >diff --git a/admin/authorised_values.pl b/admin/authorised_values.pl >index 332f09a..47847f9 100755 >--- a/admin/authorised_values.pl >+++ b/admin/authorised_values.pl >@@ -247,7 +247,7 @@ sub default_form { > } > > # push koha system categories >- foreach (qw(Asort1 Asort2 Bsort1 Bsort2 SUGGEST DAMAGED LOST REPORT_GROUP REPORT_SUBGROUP DEPARTMENT TERM SUGGEST_STATUS)) { >+ foreach (qw(Asort1 Asort2 Bsort1 Bsort2 SUGGEST DAMAGED LOST REPORT_GROUP REPORT_SUBGROUP DEPARTMENT TERM SUGGEST_STATUS DOCTYPECAT)) { > push @category_list, $_ unless $categories{$_}; > } > >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index 3d99001..9f68549 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -2,7 +2,7 @@ > -- > -- Host: localhost Database: koha30test > -- ------------------------------------------------------ >--- Server version 4.1.22 >+-- Server version 4.1.22 > > /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; > /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; >@@ -2111,10 +2111,10 @@ CREATE TABLE `suggestions` ( -- purchase suggestions > branchcode VARCHAR(10) default NULL, -- foreign key linking the suggested branch to the branches table > collectiontitle text default NULL, -- collection name for the suggested item > itemtype VARCHAR(30) default NULL, -- suggested item type >- quantity SMALLINT(6) default NULL, -- suggested quantity to be purchased >- currency VARCHAR(3) default NULL, -- suggested currency for the suggested price >- price DECIMAL(28,6) default NULL, -- suggested price >- total DECIMAL(28,6) default NULL, -- suggested total cost (price*quantity updated for currency) >+ quantity SMALLINT(6) default NULL, -- suggested quantity to be purchased >+ currency VARCHAR(3) default NULL, -- suggested currency for the suggested price >+ price DECIMAL(28,6) default NULL, -- suggested price >+ total DECIMAL(28,6) default NULL, -- suggested total cost (price*quantity updated for currency) > PRIMARY KEY (`suggestionid`), > KEY `suggestedby` (`suggestedby`), > KEY `managedby` (`managedby`) >@@ -2412,12 +2412,12 @@ CREATE TABLE `permissions` ( > > DROP TABLE IF EXISTS `serialitems`; > CREATE TABLE `serialitems` ( >- `itemnumber` int(11) NOT NULL, >- `serialid` int(11) NOT NULL, >- UNIQUE KEY `serialitemsidx` (`itemnumber`), >- KEY `serialitems_sfk_1` (`serialid`), >- CONSTRAINT `serialitems_sfk_1` FOREIGN KEY (`serialid`) REFERENCES `serial` (`serialid`) ON DELETE CASCADE ON UPDATE CASCADE, >- CONSTRAINT `serialitems_sfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE >+ `itemnumber` int(11) NOT NULL, >+ `serialid` int(11) NOT NULL, >+ UNIQUE KEY `serialitemsidx` (`itemnumber`), >+ KEY `serialitems_sfk_1` (`serialid`), >+ CONSTRAINT `serialitems_sfk_1` FOREIGN KEY (`serialid`) REFERENCES `serial` (`serialid`) ON DELETE CASCADE ON UPDATE CASCADE, >+ CONSTRAINT `serialitems_sfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE > ) ENGINE=InnoDB DEFAULT CHARSET=utf8; > > -- >@@ -3286,3 +3286,4 @@ ALTER TABLE `patron_list_patrons` > /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; > /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; > /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; >+ >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 43ae559..97ecb18 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt >@@ -177,6 +177,7 @@ Item types administration > [% END %] > [% END %] > </select> >+ (Options are defined as the authorized values for the DOCTYPECAT category) > </li> > [% ELSE %] > <span class="label">Search category</span> >@@ -252,10 +253,9 @@ Item types administration > [% ELSE %] > <input type="checkbox" id="hideinopac" name="hideinopac" value="1" /> > [% END %] >- (if checked, items of this type will be hidden as filters in OPAC's Advanded Search) >+ (if checked, items of this type will be hidden as filters in OPAC's advanced search) > </li> > <li> >- > <label for="notforloan">Not for loan: </label> [% IF ( notforloan ) %] > <input type="checkbox" id="notforloan" name="notforloan" checked="checked" value="1" /> > [% ELSE %] >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 7f74c2b..922edfe 100644 >--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-advsearch.tt >+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-advsearch.tt >@@ -186,20 +186,14 @@ > <fieldset> > <legend>Limit to any of the following:</legend> > <table> >- <tr>[% count = 0 %] >- [% FOREACH itemtype IN advsearchloo.code_loop %] >- [% IF ((!itemtype.searchcategory) AND (itemtype.cat == 0)) OR (itemtype.cat == 1) %] >- [% count = (count + 1) %] >- <td> >- <input type="checkbox" id="[% itemtype.ccl FILTER remove(',') %]-[% itemtype.number %]" name="[% IF ( itemtype.cat == 1 ) %]searchcat[% ELSE %]limit[% END %]" value="[% IF ( itemtype.cat == 1 ) %][% itemtype.code %][% ELSE %]mc-[% itemtype.ccl %]:[% itemtype.code %][% END %]"/> >- <label for="[% itemtype.ccl FILTER remove(',') %]-[% itemtype.number %]">[% UNLESS ( noItemTypeImages ) %][% IF ( itemtype.imageurl ) %]<img border="0" src="[% itemtype.imageurl %]" alt="[% itemtype.description %]" />[% END %] [% END %] >- [% itemtype.description %]</label> >- </td> >+ <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> > [% END %] >- [% IF ( loop.last ) %]</tr> >- [% ELSE %][% UNLESS ( count % 5 ) %]</tr><tr>[% END %] >- [% END %] >- [% END %] >+ [% IF ( loop.last ) %]</tr>[% ELSE %][% UNLESS ( loop.count % 5 ) %]</tr><tr>[% END %][% END %] >+ [% END %] > </table> > </fieldset> > </div> >-- >1.7.10.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 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