Bugzilla – Attachment 22469 Details for
Bug 6385
All items should optionally be displayed by default in the OPAC
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 6385 - All items should optionally be displayed by default in the OPAC
Bug-6385---All-items-should-optionally-be-displaye.patch (text/plain), 8.98 KB, created by
Olli-Antti Kivilahti
on 2013-10-28 14:04:59 UTC
(
hide
)
Description:
Bug 6385 - All items should optionally be displayed by default in the OPAC
Filename:
MIME Type:
Creator:
Olli-Antti Kivilahti
Created:
2013-10-28 14:04:59 UTC
Size:
8.98 KB
patch
obsolete
>From 69841f7fa45b6bd88dcf5b67ed66e30682e708ee Mon Sep 17 00:00:00 2001 >From: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> >Date: Mon, 28 Oct 2013 15:59:00 +0200 >Subject: [PATCH] Bug 6385 - All items should optionally be displayed by > default in the OPAC > >Added a system preference "OPACmaxItemsOnDetail" to set a threshold after which only results from the >users branch are displayed, or Items from the past year if homebranch cannot be defined. > >This tightly couples with bug 11129 which provides the filtering mechanism to display smaller result sets. >Also added lots of complexity to define the warning messages based on is the filter used to override the >"OPACmaxItemsOnDetail". >--- > installer/data/mysql/sysprefs.sql | 1 + > .../prog/en/modules/admin/preferences/opac.pref | 4 ++ > koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt | 17 ++++-- > opac/opac-detail.pl | 61 +++++++++++++++------- > 4 files changed, 60 insertions(+), 23 deletions(-) > >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index 165ed01..4db2935 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -239,6 +239,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('OpacMaintenance','0','','If ON, enables maintenance warning in OPAC','YesNo'), > ('OpacMainUserBlock','Welcome to Koha...\r\n<hr>','70|10','A user-defined block of HTML in the main content area of the opac main page','Textarea'), > ('OpacMainUserBlockMobile','',NULL,'Show the following HTML in its own column on the main page of the OPAC (mobile version):','free'), >+('OPACmaxItemsOnDetail', '50', NULL, 'On the Bibliographic record details page, show only items from the users branch and prompt the user to filter the items if the record has more then this many items.', 'Integer'), > ('OPACMobileUserCSS','',NULL,'Include the following CSS for the mobile view on all pages in the OPAC:','free'), > ('OPACMySummaryHTML','','70|10','Enter the HTML that will appear in a column on the \'my summary\' and \'my reading history\' tabs when a user is logged in to the OPAC. Enter {BIBLIONUMBER}, {TITLE}, {AUTHOR}, or {ISBN} in place of their respective variables in the HTML. Leave blank to disable.','Textarea'), > ('OpacNav','Important links here.','70|10','Use HTML tags to add navigational links to the left-hand navigational bar in OPAC','Textarea'), >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >index a75c7ef..c2441c2 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >@@ -188,6 +188,10 @@ OPAC: > type: textarea > class: code > - >+ - On the Bibliographic record details page, show only items from the users branch and prompt the user to filter the items if the record has more then this many items. >+ - pref: OPACmaxItemsOnDetail >+ class: integer >+ - > - pref: OpacShowLibrariesPulldownMobile > choices: > yes: Show >diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt >index cb76413..a1a04ca 100644 >--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt >+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt >@@ -1054,7 +1054,7 @@ YAHOO.util.Event.onContentReady("furtherm", function () { > > <div id="holdings"> > >- [% IF ( lotsofitems ) %] >+ [% IF ( showFilter ) %] > [%# Display the items filtering form used to filter the shown items. See the end of this file! %] > [% INCLUDE filter_form tab="holdings" %] > [% END %] >@@ -1062,10 +1062,17 @@ YAHOO.util.Event.onContentReady("furtherm", function () { > [% IF ( itemloop.size ) %] > > [% IF ( lotsofitems ) %] >- <p>This record has many physical items. <a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblionumber %]&viewallitems=1#holdings">Click here to view them all.</a> Or use the filter above to limit your selection</p> >- [% ELSE %] >- [% INCLUDE items_table items=itemloop tab="holdings" %] >+ <p> >+ [% IF userBranchNotDefined %] >+ Limiting items to received last year.</br> >+ [% ELSE %] >+ Showing only items from your branch.</br> >+ [% END %] >+ This record has many physical items. Use the filter above to limit your selection. >+ </p> > [% END %] >+ [% INCLUDE items_table items=itemloop tab="holdings" %] >+ > [% IF holds_count.defined || priority %] > <div id="bib_holds"> > [% IF holds_count.defined %] >@@ -1638,7 +1645,7 @@ YAHOO.util.Event.onContentReady("furtherm", function () { > <div id="filterIssuesParentContainer"> > <a id="filterIssuesButton" >Limit issues</a> > [% IF filter %] >- <form id="issuesFilter" method="get" action="/cgi-bin/koha/opac-detail.pl"> >+ <form id="issuesFilterClearer" method="get" action="/cgi-bin/koha/opac-detail.pl"> > <input type="hidden" name="biblionumber" id="biblionumber" value="[% biblionumber %]"/> > <input type="submit" name="clearFilter" value="Clear filter" class="submit"/> > </form> >diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl >index 343bf2e..01fc7b5 100755 >--- a/opac/opac-detail.pl >+++ b/opac/opac-detail.pl >@@ -84,7 +84,7 @@ my $filterIssue = $query->param('filterIssue') ? $query->param('filterIssue') : > my $filterFromDate = $query->param('filterFrom') ? $query->param('filterFrom') : undef; > my $filterToDate = $query->param('filterTo') ? $query->param('filterTo') : undef; > >-my $filter; #a HASH! Collect the filters here, so they can be more conveniently moved around. >+my $filter = {}; #a HASH! Collect the filters here, so they can be more conveniently moved around. > > #We filter by the branch only if a valid branch is given. > if (defined $filterBranchLimiter && $filterBranchLimiter ne '_ShowAll') { >@@ -141,6 +141,43 @@ if (defined $filterToDate && length $filterToDate > 0) { > } > } > >+$template->param( filter => $filter ); >+ >+## >+##<< Serial issues filter parameters handled! ## >+## >+ >+# If there are a lot of items, and the user has not decided >+# to view them all yet, we first warn him >+my $itemsCount = GetItemsCount($biblionumber); >+my $lotsofitems = 0; >+if ($itemsCount > C4::Context->preference('OPACmaxItemsOnDetail') && >+ !($query->param('viewallitems')) ) { >+ >+ $lotsofitems = 1; >+ $template->param('lotsofitems' => $lotsofitems); >+} >+ >+my @all_items; >+if ($lotsofitems) { >+ #Spare the poor old DB from this possibly excruciatinly huge read operation. >+ if (! scalar(%$filter)) { #Is the $filter empty? >+ #Limit display of Items based on the users branch >+ if (C4::Context->userenv){ >+ $filter->{branch} = C4::Context->userenv->{branch}; >+ $filterBranchLimiter = $filter->{branch}; #Making the branches loop react to this! >+ } >+ #Or if branch cannot be defined, then display Items only from the past year >+ else { >+ my $now = DateTime->now(); >+ $now->set_year( ($now->year() - 1) ); >+ $filter->{fromDate} = Koha::DateUtils::output_pref({ dt => $now, dateformat => 'iso'}); >+ $template->param('userBranchNotDefined' => 1); >+ } >+ } >+} >+@all_items = GetItemsInfo($biblionumber, $filter); >+ > > ##Prepare the custom branches loop containing the _ShowAll entry to show issues from all libraries. > my $branchloop; >@@ -153,19 +190,14 @@ else { > unshift @$branchloop, { branchcode => '_ShowAll', branchname => 'Show from any library', selected => '0', value => '_ShowAll'}; > } > $template->param( branchloop => $branchloop ); >-$template->param( filter => $filter ) if defined $filter; >- >-## >-##<< Serial issues filter parameters handled! ## >-## >- > >-my @all_items = GetItemsInfo($biblionumber, $filter); > > # Now that the filter is no longer needed, we can reuse it to keep the filter modifications in the UI, >-# by reverting the dates to the same format as in the UI layer. >-$filter->{fromDate} = $filterFromDate; >-$filter->{toDate} = $filterToDate; >+# by reverting the dates and the branch to the same format as in the UI layer. >+$filter->{fromDate} = $filterFromDate if $filterFromDate; >+$filter->{toDate} = $filterToDate if $filterToDate; >+$filter->{branch} = $filterBranchLimiter if $filterBranchLimiter; >+$template->param('showFilter' => 1) if (scalar(%$filter)); > > my @hiddenitems; > if (scalar @all_items >= 1) { >@@ -731,13 +763,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('lotsofitems' => 1); >-} > > ## get notes and subjects from MARC record > my $dbh = C4::Context->dbh; >-- >1.8.1.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 6385
:
22469
|
22471
|
22510
|
22514
|
22570
|
23173
|
23207
|
23208