Fix for bug 2191: Subfield $n (Suppress in OPAC) has no effect on OPAC

Adding missing OpacSuppression syspref
This commit is contained in:
Joshua Ferraro 2008-07-14 14:51:07 -05:00
parent 5834de1419
commit dd47f7bf7c
5 changed files with 46 additions and 34 deletions

View file

@ -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);
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('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

View file

@ -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 ?

View file

@ -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');

View file

@ -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

View file

@ -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