[Koha-patches] [PATCH] Bug 5193 Enhancement to allow use of specialized auction indexes

Jane Wagner jwagner at ptfs.com
Wed Sep 1 16:04:07 CEST 2010


From: dev2 <dev2 at debKOHA2.corporate.ptfs.com>

Adds syspref to determine if auction indexes show in OPAC & staff advanced
search, adds 591, 592, 593 fields to default framework and to indexes
---
 admin/systempreferences.pl                         |    2 ++
 catalogue/search.pl                                |    5 +++++
 etc/zebradb/biblios/etc/bib1.att                   |    5 +++++
 etc/zebradb/ccl.properties                         |    5 +++++
 etc/zebradb/marc_defs/marc21/biblios/record.abs    |    4 ++++
 installer/data/mysql/updatedatabase.pl             |   13 +++++++++++++
 .../prog/en/includes/search_indexes.inc            |    6 ++++++
 .../en/modules/admin/preferences/searching.pref    |    8 ++++++++
 .../opac-tmpl/prog/en/modules/opac-advsearch.tmpl  |    6 ++++++
 opac/opac-search.pl                                |    5 +++++
 10 files changed, 59 insertions(+), 0 deletions(-)

diff --git a/admin/systempreferences.pl b/admin/systempreferences.pl
index 824b058..b91df9b 100755
--- a/admin/systempreferences.pl
+++ b/admin/systempreferences.pl
@@ -274,6 +274,8 @@ $tabsysprefs{QueryAutoTruncate}       = "Searching";
 $tabsysprefs{QueryRemoveStopwords}    = "Searching";
 $tabsysprefs{AdvancedSearchTypes}     = "Searching";
 $tabsysprefs{DisplayMultiPlaceHold}   = "Searching";
+$tabsysprefs{OPACAdvancedSearchTypes} = "Searching";
+$tabsysprefs{ShowAuctionSearchOptions} = "Searching";
 
 # EnhancedContent
 $tabsysprefs{AmazonEnabled}          = "EnhancedContent";
diff --git a/catalogue/search.pl b/catalogue/search.pl
index 920afb7..0b67877 100755
--- a/catalogue/search.pl
+++ b/catalogue/search.pl
@@ -311,6 +311,11 @@ if ( $template_type eq 'advsearch' ) {
     my $languages_limit_loop = getAllLanguages();
     $template->param(search_languages_loop => $languages_limit_loop,);
 
+    # display the auction house indexes
+    if ( C4::Context->preference("ShowAuctionSearchOptions") == 1) {
+        $template->param( ShowAuctionSearchOptions => C4::Context->preference("ShowAuctionSearchOptions") );
+    }
+
     # use the global setting by default
     if ( C4::Context->preference("expandedSearchOption") == 1) {
         $template->param( expanded_options => C4::Context->preference("expandedSearchOption") );
diff --git a/etc/zebradb/biblios/etc/bib1.att b/etc/zebradb/biblios/etc/bib1.att
index d47b2a3..fce37b5 100644
--- a/etc/zebradb/biblios/etc/bib1.att
+++ b/etc/zebradb/biblios/etc/bib1.att
@@ -189,3 +189,8 @@ att 9903    lex
 att 9904    arl
 att 9013    arp
 att 9520    Item
+#Auction house indexes
+att 9950    auctplace
+att 9951    auctdate
+att 9952    auctcode
+
diff --git a/etc/zebradb/ccl.properties b/etc/zebradb/ccl.properties
index 231c420..c2213e1 100644
--- a/etc/zebradb/ccl.properties
+++ b/etc/zebradb/ccl.properties
@@ -1052,6 +1052,11 @@ arl 1=9904 r=r
 
 #Accelerated Reader Point
 arp 1=9013 r=r
+# auction information
+auctplace 1=9950
+auctdate  1=9951
+auctcode  1=9952
+
 
 ## Statuses
 popularity 1=issues
diff --git a/etc/zebradb/marc_defs/marc21/biblios/record.abs b/etc/zebradb/marc_defs/marc21/biblios/record.abs
index 6cf37ba..46b8cdc 100644
--- a/etc/zebradb/marc_defs/marc21/biblios/record.abs
+++ b/etc/zebradb/marc_defs/marc21/biblios/record.abs
@@ -153,6 +153,10 @@ melm 526$d      arp,arp:n
 #melm 533$d     pubdate,pubdate:s
 #melm 541$d     Date-of-acquisition,Date-of-acquisition:s
 melm 590        Note:w,Note:p
+melm 591        auctplace:w,auctplace:p
+melm 592        auctdate,auctdate:s
+melm 593        auctcode:w,auctcode:p
+
 
 melm 600$a      Name-and-title,Name,Personal-name,Subject-name-personal,Subject
 melm 600$t      Name-and-title,Title,Subject
diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl
index a0b5c4a..8d8784e 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -3698,6 +3698,19 @@ $DBversion = "3.01.00.145";
 if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
     $dbh->do("ALTER TABLE borrowers ADD KEY `guarantorid` (guarantorid);");
     print "Upgrade to $DBversion done (Add index on guarantorid)\n";
+}
+$DBversion = '3.01.00.146';
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+    $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type)VALUES('ShowAuctionSearchOptions', '0', 'If ON, includes specialized auction catalog/house/date searches in advanced search (staff and OPAC)', '', 'YesNo')");
+    $dbh->do("INSERT INTO `marc_tag_structure` (`tagfield`, `liblibrarian`, `libopac`, `repeatable`, `mandatory`, `authorised_value`, `frameworkcode`) VALUES
+                ('591', 'AUCTION HOUSE', 'AUCTION HOUSE', 1, 0, NULL, ''),
+                ('592', 'DATE OF AUCTION SALE', 'DATE OF AUCTION SALE', 1, 0, NULL, ''),
+                ('593', 'AUCTION SALES CODE', 'AUCTION SALES CODE', 1, 0, NULL, '')");
+        $dbh->do("INSERT INTO `marc_subfield_structure` (`tagfield`, `tagsubfield`, `liblibrarian`, `libopac`, `repeatable`, `mandatory`, `kohafield`, `tab`, `authorised_value` , `authtypecode`, `value_builder`, `isurl`, `hidden`, `frameworkcode`, `seealso`, `link`, `defaultvalue`) VALUES
+                ('591', 'a', 'AUCTION HOUSE', 'AUCTION HOUSE', 0, 0, NULL, 5, NULL, NULL, '', NULL, 0, '', '', '', NULL),
+                ('592', 'a', 'DATE OF AUCTION SALE', 'DATE OF AUCTION SALE', 0, 0, NULL, 5, NULL, NULL, '', NULL, 0, '', '', '', NULL),
+                ('593', 'a', 'AUCTION SALES CODE', 'AUCTION SALES CODE', 0, 0, NULL, 5, NULL, NULL, '', NULL, 0, '', '', '', NULL)");
+        print "Upgrade to $DBversion done ( Added 591, 592, 593 fields into default framework for use with auction house/date/sales code indexes )\n";
     SetVersion ($DBversion);
 }
 
diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/search_indexes.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/search_indexes.inc
index cd3226c..caaa015 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/search_indexes.inc
+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/search_indexes.inc
@@ -13,6 +13,12 @@
     <option value="se">&nbsp;&nbsp;&nbsp;&nbsp; Series Title</option>
     <option value="su">Subject</option>
     <option value="su,phr">&nbsp;&nbsp;&nbsp;&nbsp; Subject as Phrase</option>
+<!-- TMPL_IF NAME="ShowAuctionSearchOptions" -->
+    <option value="auctcode">Auction Catalog Code</option>
+    <option value="auctplace">Auction Place</option>
+    <option value="auctdate,phr">Auction Date</option>
+<!-- /TMPL_IF -->
+
     <option value="bc">Barcode</option>
     <option value="sn">Standard Number</option>
     <option value="nb">&nbsp;&nbsp;&nbsp;&nbsp; ISBN</option>
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 f817ac8..69ca7cb 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
@@ -58,6 +58,14 @@ Searching:
             - PazPar2 to group similar results on the OPAC. This requires that PazPar2 is set up and running.
     Search Form:
         -
+            - By default,
+            - pref: ShowAuctionSearchOptions
+              type: boolean
+              choices:
+                  yes: show
+                  no: "don't show"
+            - 'specialized auction indexes show in OPAC and staff advanced search.'
+        -
             - Show checkboxes to search by
             - pref: AdvancedSearchTypes
               choices:
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-advsearch.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-advsearch.tmpl
index 52b00e7..d56a357 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-advsearch.tmpl
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-advsearch.tmpl
@@ -80,6 +80,12 @@
             <option value="pn,wrdl">&nbsp;&nbsp;&nbsp;&nbsp; Personal Name</option>
             <option value="pn,phr">&nbsp;&nbsp;&nbsp;&nbsp; Personal Name Phrase</option>
 <!-- /TMPL_IF -->
+<!-- TMPL_IF NAME="ShowAuctionSearchOptions" -->
+            <option value="auctcode">Auction Catalog Code</option>
+            <option value="auctplace">Auction Place</option>
+            <option value="auctdate,phr">Auction Date</option>
+<!-- /TMPL_IF -->
+            <option value="ln">Language</option>
 <!-- TMPL_IF NAME="expanded_options" -->
             <option value="nt">Notes/Comments</option>
 <!-- /TMPL_IF -->
diff --git a/opac/opac-search.pl b/opac/opac-search.pl
index 30bc34a..b12e9f2 100755
--- a/opac/opac-search.pl
+++ b/opac/opac-search.pl
@@ -241,6 +241,11 @@ if ( $template_type && $template_type eq 'advsearch' ) {
 					  advsearch => 1,
                       search_boxes_loop => \@search_boxes_array);
 
+# display the auction house indexes
+    if ( C4::Context->preference("ShowAuctionSearchOptions") == 1) {
+        $template->param( ShowAuctionSearchOptions => C4::Context->preference("ShowAuctionSearchOptions") );
+    }
+
 # use the global setting by default
 	if ( C4::Context->preference("expandedSearchOption") == 1 ) {
 		$template->param( expanded_options => C4::Context->preference("expandedSearchOption") );
-- 
1.5.6.5



More information about the Koha-patches mailing list