INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OpacCloud',0,'If ON, enables subject cloud on OPAC',NULL,'YesNo');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('opaccolorstylesheet','colors.css','Define the color stylesheet to use in the OPAC','','free');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('opaccredits','','Define HTML Credits at the bottom of the OPAC page','70|10','Textarea');
-INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('opacSerialDefaultTab', 'serialcollection', 'Define the default tab for serials in OPAC. If set to holdings when there are no items, then serial collections are still displayed by default.', 'holdings|serialcollection', 'Choice');
+INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('opacSerialDefaultTab', 'subscriptions', 'Define the default tab for serials in OPAC.', 'holdings|serialcollection|subscriptions', 'Choice');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('opacheader','','Add HTML to be included as a custom header in the OPAC','70|10','Textarea');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('opaclayoutstylesheet','opac.css','Enter the name of the layout CSS stylesheet to use in the OPAC','','free');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OpacMaintenance',0,'If ON, enables maintenance warning in OPAC','','YesNo');
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('AllowAllMessageDeletion','0','Allow any Library to delete any message','','YesNo');
INSERT INTO systempreferences (variable,value,explanation,options,type)VALUES('ShowPatronImageInWebBasedSelfCheck', '0', 'Si activé, affiche la photo de l''adhérent lors de l''utilisation de la console de prêt auto-contrôlé', '', 'YesNo');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('EnableOpacSearchHistory', '1', 'Enable or disable opac search history', 'YesNo','')
-INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('opacSerialDefaultTab', 'serialcollection', 'Ce paramètre définit l''onglet par défaut pour l''affichage des périodiques dans l''OPAC. Si la préférence est sur holdings, mais qu''aucun exemplaire n''est présent, les états de collection seront tout de même affichés par défaut.', 'holdings|serialcollection', 'Choice');
+INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('opacSerialDefaultTab', 'serialcollection', 'Ce paramètre définit l''onglet par défaut pour l''affichage des périodiques dans l''OPAC.', 'holdings|serialcollection|subscriptions', 'Choice');
SetVersion ($DBversion);
}
+$DBversion = "3.01.00.119";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+$dbh->do("
+ UPDATE `systempreferences` SET `options` = 'holdings|serialcollection|subscriptions',
+ WHERE `systempreferences`.`variable` = 'opacSerialDefaultTab' LIMIT 1
+ ");
+
+ print "Upgrade to $DBversion done (opac-detail default tag updated)\n";
+ SetVersion ($DBversion);
+}
+
+
=item DropAllForeignKeys($table)
<div id="bibliodescriptions" class="toptabs">
<ul>
-<li> <a href="/cgi-bin/koha/opac-detail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->#holdings">Holdings
+<li<!-- TMPL_IF EXPR="defaulttab eq 'holdings'" --> class="ui-tabs-selected"<!-- /TMPL_IF -->><a href="/cgi-bin/koha/opac-detail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->#holdings">Holdings
( <!-- TMPL_VAR NAME="count" --> )</a>
</li>
<li> <a href="/cgi-bin/koha/opac-detail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->#descriptions">Title Notes</a></li>
<li> <a href="/cgi-bin/koha/opac-detail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->#LTFLTagBrowse">Tag Browser</a></li>
<!-- /TMPL_IF -->
<!-- /TMPL_IF -->
-<!-- TMPL_IF name="subscriptionsnumber" --><li>
+<!-- TMPL_IF name="subscriptionsnumber" --><li<!-- TMPL_IF EXPR="defaulttab eq 'subscriptions'" --> class="ui-tabs-selected"<!-- /TMPL_IF -->>
<a href="/cgi-bin/koha/opac-detail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->#subscriptions">Subscriptions</a>
</li><!-- /TMPL_IF -->
<!-- TMPL_IF NAME="reviewson" --><li><a href="/cgi-bin/koha/opac-detail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->#comments">Comments</a></li><!-- /TMPL_IF -->
<!-- TMPL_IF NAME="Babeltheque" --><li><a href="/cgi-bin/koha/opac-detail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->#babeltheque">Babelthèque</a></li><!-- /TMPL_IF -->
<!-- TMPL_IF NAME="serialcollection" -->
- <li<!-- TMPL_IF NAME="defaultserialcollection" --> class="ui-tabs-selected"<!-- /TMPL_IF -->><a href="/cgi-bin/koha/opac-detail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->#serialcollection">Serial Collection</a></li>
+ <li<!-- TMPL_IF EXPR="defaulttab eq 'serialcollection'" --> class="ui-tabs-selected"<!-- /TMPL_IF -->><a href="/cgi-bin/koha/opac-detail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->#serialcollection">Serial Collection</a></li>
<!-- /TMPL_IF -->
</ul>
use strict;
sub kohaversion {
- our $VERSION = '3.01.00.115';
+ our $VERSION = '3.01.00.119';
# version needs to be set this way
# so that it can be picked up by Makefile.PL
# during install
use C4::Members;
use C4::VirtualShelves;
use C4::XSLT;
+use Switch;
BEGIN {
if (C4::Context->preference('BakerTaylorEnabled')) {
$dat->{'count'} = scalar(@items);
-# If there are no items or the syspref says so, we show serial collection as default tab
-if ($dat->{'count'} == 0 || C4::Context->preference('opacSerialDefaultTab') eq 'serialcollection') {
- $dat->{'defaultserialcollection'} = 1;
-
-}
-
my $biblio_authorised_value_images = C4::Items::get_authorised_value_images( C4::Biblio::get_biblio_authorised_values( $biblionumber, $record ) );
my $norequests = 1;
$template->param('OPACSearchForTitleIn' => $search_for_title);
}
+# We try to select the best default tab to show, according to what
+# the user wants, and what's available for display
+my $defaulttab;
+switch (C4::Context->preference('opacSerialDefaultTab')) {
+
+ # If the user wants subscriptions by default
+ case "subscriptions" {
+ # And there are subscriptions, we display them
+ if ($subscriptionsnumber) {
+ $defaulttab = 'subscriptions';
+ } else {
+ # Else, we try next option
+ next;
+ }
+ }
+
+ case "serialcollection" {
+ if (scalar(@serialcollections) > 0) {
+ $defaulttab = 'serialcollection' ;
+ } else {
+ next;
+ }
+ }
+
+ case "holdings" {
+ if ($dat->{'count'} > 0) {
+ $dat->{'defaultholdings'} = 1;
+ } else {
+ # As this is the last option, we try other options if there are no items
+ if ($subscriptionsnumber) {
+ $defaulttab = 'subscriptions';
+ } elsif (scalar(@serialcollections) > 0) {
+ $defaulttab = 'serialcollection' ;
+ }
+ }
+
+ }
+
+}
+$template->param('defaulttab' => $defaulttab);
+
+
output_html_with_http_headers $query, $cookie, $template->output;