From dd47f7bf7cd3c725ac2028a48ce1fab451a131fd Mon Sep 17 00:00:00 2001 From: Joshua Ferraro Date: Mon, 14 Jul 2008 14:51:07 -0500 Subject: [PATCH] Fix for bug 2191: Subfield $n (Suppress in OPAC) has no effect on OPAC Adding missing OpacSuppression syspref --- admin/systempreferences.pl | 69 ++++++++++--------- .../data/mysql/en/mandatory/sysprefs.sql | 1 + .../unimarc_standard_systemprefs.sql | 2 + installer/data/mysql/updatedatabase.pl | 8 +++ kohaversion.pl | 2 +- 5 files changed, 47 insertions(+), 35 deletions(-) diff --git a/admin/systempreferences.pl b/admin/systempreferences.pl index c571c99068..1d6574cd45 100755 --- a/admin/systempreferences.pl +++ b/admin/systempreferences.pl @@ -56,19 +56,19 @@ use C4::Output; # FIXME, shouldnt we store this stuff in the systempreferences table? # FIXME: This uses hash in a backwards way. What we really want is: -# $tabsysprefs{key} = $array_ref; -# like -# $tabsysprefs{Cataloguing} = [qw(autoBarcode ISBD marc ...)]; +# $tabsysprefs{key} = $array_ref; +# like +# $tabsysprefs{Cataloguing} = [qw(autoBarcode ISBD marc ...)]; # -# Because some things *should* be on more than one tab. -# And the tabname is the unique part (the key). +# Because some things *should* be on more than one tab. +# And the tabname is the unique part (the key). my %tabsysprefs; # Acquisitions $tabsysprefs{acquisitions}="Acquisitions"; $tabsysprefs{gist}="Acquisitions"; $tabsysprefs{emailPurchaseSuggestions}="Acquisitions"; - $tabsysprefs{RenewSerialAddsSuggestion}="Acquisitions"; + $tabsysprefs{RenewSerialAddsSuggestion}="Acquisitions"; $tabsysprefs{serialsadditems}="Acquisitions"; # Admin @@ -119,6 +119,7 @@ my %tabsysprefs; $tabsysprefs{DefaultClassificationSource}="Cataloguing"; $tabsysprefs{RoutingSerials}="Cataloguing"; $tabsysprefs{'item-level_itypes'}="Cataloguing"; + $tabsysprefs{OpacSuppression}="Cataloguing"; # Circulation $tabsysprefs{maxoutstanding}="Circulation"; @@ -147,8 +148,8 @@ my %tabsysprefs; $tabsysprefs{previousIssuesDefaultSortOrder}="Circulation"; $tabsysprefs{todaysIssuesDefaultSortOrder}="Circulation"; $tabsysprefs{HomeOrHoldingBranch}="Circulation"; - $tabsysprefs{RandomizeHoldsQueueWeight}="Circulation"; - $tabsysprefs{StaticHoldsQueueWeight}="Circulation"; + $tabsysprefs{RandomizeHoldsQueueWeight}="Circulation"; + $tabsysprefs{StaticHoldsQueueWeight}="Circulation"; $tabsysprefs{AllowOnShelfHolds}="Circulation"; $tabsysprefs{AllowHoldsOnDamagedItems}="Circulation"; @@ -238,7 +239,7 @@ my %tabsysprefs; $tabsysprefs{TagsShowOnDetail} = 'EnhancedContent'; $tabsysprefs{TagsShowOnList} = 'EnhancedContent'; $tabsysprefs{TagsModeration} = 'EnhancedContent'; - $tabsysprefs{GoogleJackets} = 'EnhancedContent'; + $tabsysprefs{GoogleJackets} = 'EnhancedContent'; $tabsysprefs{AuthorisedValueImages} = "EnhancedContent"; # OPAC @@ -434,16 +435,16 @@ if ($op eq 'update_and_reedit') { my $sth=$dbh->prepare("update systempreferences set value=?,explanation=?,type=?,options=? where variable=?"); $sth->execute($value, $input->param('explanation'), $input->param('variable'), $input->param('preftype'), $input->param('prefoptions')); $sth->finish; - warn "logaction !! mod "; - logaction('SYSTEMPREFERENCE','MODIFY',undef, $input->param('variable') . " | " . $value ); + warn "logaction !! mod "; + logaction('SYSTEMPREFERENCE','MODIFY',undef, $input->param('variable') . " | " . $value ); } } else { unless (C4::Context->config('demo') eq 1) { my $sth=$dbh->prepare("insert into systempreferences (variable,value,explanation) values (?,?,?,?,?)"); $sth->execute($input->param('variable'), $input->param('value'), $input->param('explanation'), $input->param('preftype'), $input->param('prefoptions')); $sth->finish; - warn "logaction !! add "; - logaction('SYSTEMPREFERENCE','ADD',undef, $input->param('variable') . " | " . $input->param('value') ); + warn "logaction !! add "; + logaction('SYSTEMPREFERENCE','ADD',undef, $input->param('variable') . " | " . $input->param('value') ); } } $sth->finish; @@ -522,27 +523,27 @@ if ($op eq 'add_form') { $counter++; } } elsif ($data->{'type'} eq 'Languages') { - my $currently_selected_languages; + my $currently_selected_languages; foreach my $language (split /\s+/, $data->{'value'}) { $currently_selected_languages->{$language}=1; } - # current language + # current language my $lang = $template->param('lang'); my $theme; - my $interface; - if ($data->{'variable'} =~ /opac/) { - # this is the OPAC - $interface = 'opac'; - $theme = C4::Context->preference('opacthemes'); - } - else { - # this is the staff client - $interface = 'intranet'; - $theme = C4::Context->preference('template'); - } - my $languages_loop = getTranslatedLanguages($interface,$theme,$lang,$currently_selected_languages); - - $template->param('languages_loop' => $languages_loop); + my $interface; + if ($data->{'variable'} =~ /opac/) { + # this is the OPAC + $interface = 'opac'; + $theme = C4::Context->preference('opacthemes'); + } + else { + # this is the staff client + $interface = 'intranet'; + $theme = C4::Context->preference('template'); + } + my $languages_loop = getTranslatedLanguages($interface,$theme,$lang,$currently_selected_languages); + + $template->param('languages_loop' => $languages_loop); $template->param('type-langselector' => 1); } else { $template->param('type-free' => 1); @@ -568,7 +569,7 @@ if ($op eq 'add_form') { my $params = $input->Vars; my @values = split("\0",$params->{'value'}) if $params->{'value'}; for my $vl (@values) { - $value .= "$vl,"; + $value .= "$vl,"; } $value =~ s/,$//; if ($sth->rows) { @@ -576,14 +577,14 @@ if ($op eq 'add_form') { my $sth=$dbh->prepare("update systempreferences set value=?,explanation=?,type=?,options=? where variable=?"); $sth->execute($value, $input->param('explanation'), $input->param('preftype'), $input->param('prefoptions'), $input->param('variable')); $sth->finish; - logaction('SYSTEMPREFERENCE','MODIFY',undef, $input->param('variable') . " | " . $value ); + logaction('SYSTEMPREFERENCE','MODIFY',undef, $input->param('variable') . " | " . $value ); } } else { unless (C4::Context->config('demo') eq 1) { my $sth=$dbh->prepare("insert into systempreferences (variable,value,explanation,type,options) values (?,?,?,?,?)"); $sth->execute($input->param('variable'), $value, $input->param('explanation'), $input->param('preftype'), $input->param('prefoptions')); $sth->finish; - logaction('SYSTEMPREFERENCE','ADD',undef, $input->param('variable') . " | " . $value ); + logaction('SYSTEMPREFERENCE','ADD',undef, $input->param('variable') . " | " . $value ); } } $sth->finish; @@ -608,8 +609,8 @@ if ($op eq 'add_form') { my $dbh = C4::Context->dbh; my $sth=$dbh->prepare("delete from systempreferences where variable=?"); $sth->execute($searchfield); - my $logstring = $searchfield . " | " . $Tvalue ; - logaction('SYSTEMPREFERENCE','DELETE',undef,$logstring); + my $logstring = $searchfield . " | " . $Tvalue ; + logaction('SYSTEMPREFERENCE','DELETE',undef,$logstring); $sth->finish; # END $OP eq DELETE_CONFIRMED diff --git a/installer/data/mysql/en/mandatory/sysprefs.sql b/installer/data/mysql/en/mandatory/sysprefs.sql index 5721dec16c..43d7346d6a 100755 --- a/installer/data/mysql/en/mandatory/sysprefs.sql +++ b/installer/data/mysql/en/mandatory/sysprefs.sql @@ -209,4 +209,5 @@ INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES('AdvancedSearchTypes','itemtypes','itemtypes|ccode','Select which set of fields comprise the Type limit in the advanced search','Choice'); INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES('AllowOnShelfHolds', '0', '', 'Allow hold requests to be placed on items that are not on loan', 'YesNo'); INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES('AllowHoldsOnDamagedItems', '1', '', 'Allow hold requests to be placed on damaged items', 'YesNo'); +INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES('OpacSuppression', '0', '', 'Turn ON the OPAC Suppression feature, requires further setup, ask your system administrator for details', 'YesNo'); -- FIXME: add FrameworksLoaded, noOPACUserLogin, ReadingHistory ? diff --git a/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql b/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql index ddc1e800e1..20ec7723e4 100755 --- a/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql +++ b/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql @@ -210,3 +210,5 @@ INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES('AdvancedSearchTypes','itemtypes','itemtypes|ccode','Select which set of fields comprise the Type limit in the advanced search','Choice'); INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES('AllowOnShelfHolds', '0', '', 'Allow hold requests to be placed on items that are not on loan', 'YesNo'); INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES('AllowHoldsOnDamagedItems', '1', '', 'Allow hold requests to be placed on damaged items', 'YesNo'); +INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES('OpacSuppression', '0', '', 'Turn ON the OPAC Suppression feature, requires further setup, ask your system administrator for details', 'YesNo'); + diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index a5ccf46ccc..9e9b569d85 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -1857,6 +1857,14 @@ if ( C4::Context->preference('Version') < TransformToNum($DBversion) ) { SetVersion($DBversion); } +$DBversion = '3.00.00.099'; +if ( C4::Context->preference('Version') < TransformToNum($DBversion) ) { + $dbh->do("INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES('OpacSuppression', '0', '', 'Turn ON the OPAC Suppression feature, requires further setup, ask your system administrator for details', 'YesNo')"); + print "Upgrade to $DBversion done (Adding OpacSuppression syspref)\n"; + SetVersion($DBversion); +} + + =item DropAllForeignKeys($table) Drop all foreign keys of the table $table diff --git a/kohaversion.pl b/kohaversion.pl index 085795bda5..ca4785b11d 100644 --- a/kohaversion.pl +++ b/kohaversion.pl @@ -10,7 +10,7 @@ use strict; sub kohaversion { - our $VERSION = '3.00.00.098'; + our $VERSION = '3.00.00.099'; # version needs to be set this way # so that it can be picked up by Makefile.PL # during install -- 2.39.5