@@ -, +, @@ biblio detail page. --- installer/data/mysql/sysprefs.sql | 1 + installer/data/mysql/updatedatabase.pl | 7 +++++++ .../prog/en/modules/admin/preferences/opac.pref | 6 ++++++ koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt | 20 +++++++----------- opac/opac-detail.pl | 22 +++++++++----------- 5 files changed, 31 insertions(+), 25 deletions(-) --- a/installer/data/mysql/sysprefs.sql +++ a/installer/data/mysql/sysprefs.sql @@ -240,6 +240,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('OpacMaintenance','0','','If ON, enables maintenance warning in OPAC','YesNo'), ('OpacMainUserBlock','Welcome to Koha...\r\n
This record has many physical items. Click here to view them all.
- [% ELSE %] - [% INCLUDE items_table items=itemloop tab="holdings" %] - [% END %] +[% IF too_many_items %] +This record has many physical items ([% items_count %]). Click here to view them all.
+[% ELSIF ( itemloop.size ) %] + [% INCLUDE items_table items=itemloop tab="holdings" %] [% IF holds_count.defined || priority %]This record has many physical items. Click here to view them all.
- [% ELSE %] - [% INCLUDE items_table items=otheritemloop tab="otherholdings" %] - [% END %] + [% IF otheritemloop.size %] + [% INCLUDE items_table items=otheritemloop tab="otherholdings" %] [% ELSE %] No other items. [% END %] --- a/opac/opac-detail.pl +++ a/opac/opac-detail.pl @@ -561,7 +561,15 @@ if ($currentbranch and C4::Context->preference('OpacSeparateHoldings')) { $template->param(SeparateHoldings => 1); } my $separatebranch = C4::Context->preference('OpacSeparateHoldingsBranch'); -for my $itm (@items) { +my $viewallitems = $query->param('viewallitems'); +my $max_items_to_display = C4::Context->preference('OpacMaxItemsToDisplay') // 50; +if ( not $viewallitems and @items > $max_items_to_display ) { + $template->param( + too_many_items => 1, + items_count => scalar( @items ), + ); +} else { + for my $itm (@items) { $itm->{holds_count} = $item_reserves{ $itm->{itemnumber} }; $itm->{priority} = $priority{ $itm->{itemnumber} }; $norequests = 0 @@ -616,6 +624,7 @@ for my $itm (@items) { } else { push @itemloop, $itm; } + } } # Display only one tab if one items list is empty @@ -626,17 +635,6 @@ if (scalar(@itemloop) == 0 || scalar(@otheritemloop) == 0) { } } -# If there is a lot of items, and the user has not decided -# to view them all yet, we first warn him -# TODO: The limit of 50 could be a syspref -my $viewallitems = $query->param('viewallitems'); -if (scalar(@itemloop) >= 50 && !$viewallitems) { - $template->param('lotsofholdingsitems' => 1); -} -if (scalar(@otheritemloop) >= 50 && !$viewallitems) { - $template->param('lotsofothersholdingsitems' => 1); -} - ## get notes and subjects from MARC record my $dbh = C4::Context->dbh; my $marcnotesarray = GetMarcNotes ($record,$marcflavour); --