Bugzilla – Attachment 22571 Details for
Bug 11157
Placing a simple item-level hold for serials.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 11157 - Placing a simple item-level hold for serials in OPAC.
Bug-11157---Placing-a-simple-item-level-hold-for-s.patch (text/plain), 15.87 KB, created by
Olli-Antti Kivilahti
on 2013-10-30 09:34:37 UTC
(
hide
)
Description:
Bug 11157 - Placing a simple item-level hold for serials in OPAC.
Filename:
MIME Type:
Creator:
Olli-Antti Kivilahti
Created:
2013-10-30 09:34:37 UTC
Size:
15.87 KB
patch
obsolete
>From 5a54f634e5147627d1ce556f5c379369a188f133 Mon Sep 17 00:00:00 2001 >From: root <root@koha.(none)> >Date: Tue, 29 Oct 2013 20:04:00 +0200 >Subject: [PATCH] Bug 11157 - Placing a simple item-level hold for serials in > OPAC. > >For biblios marked as a serial or if the syspref: >-OPACShowPlaceItemLevelHold or >is enabled. >Adds a "Place hold"-link after each item in the detailed biblio view. > >Uses the template parameter 'norequest', to disable the "Place hold"-link in >the sidebar opac-detail-sidebar.inc for serials. > >Added a new parameter itemnumber to opac-reserve.pl/.tt. >This causes the reserving module to display only the desired item, preselect it >and hide unnecessary buttons. >--- > C4/Items.pm | 6 ++++++ > installer/data/mysql/sysprefs.sql | 1 + > .../prog/en/modules/admin/preferences/opac.pref | 7 +++++++ > koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt | 13 +++++++++++-- > koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt | 16 ++++++++++------ > opac/opac-detail.pl | 14 ++++++++++---- > opac/opac-reserve.pl | 14 +++++++++++--- > t/db_dependent/Items.t | 11 ++++++++++- > 8 files changed, 66 insertions(+), 16 deletions(-) > >diff --git a/C4/Items.pm b/C4/Items.pm >index bdae692..f7bfd27 100644 >--- a/C4/Items.pm >+++ b/C4/Items.pm >@@ -1219,6 +1219,7 @@ $filter->{fromDate} = '01/01/2013'; #Filters only serial issues by the serialite > $filter->{toDate} = '31/12/2014'; #Filters only serial issues by the serialitems.publisheddate > #The ending date in C4::Context->preference('dateformat') format > $filter->{limit} = 15; #Limits the returning set to this many items >+$filter->{itemnumber} = 165; #Returns the item with this itemnumber > > Filters are expected to be validated! If a filter is not defined, that filter is not present in the $filter-HASH > >@@ -1341,6 +1342,11 @@ sub GetItemsInfo { > } > push @$queryParams, $filter->{toDate}; > } >+ if (exists $filter->{itemnumber}) { >+ push @$queryParams, $filter->{itemnumber}; >+ $query .= " AND items.itemnumber = ?"; >+ } >+ > > $query .= "ORDER BY home.branchname, items.enumchron, LPAD( items.copynumber, 8, '0' ), items.dateaccessioned DESC" ; > if (exists $filter->{limit}) { >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index 4db2935..4cfd4e5 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -270,6 +270,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('OpacShowLibrariesPulldownMobile','1',NULL,'Show the libraries pulldown on the mobile version of the OPAC.','YesNo'), > ('OpacShowRecentComments','0',NULL,'If ON a link to recent comments will appear in the OPAC masthead','YesNo'), > ('OPACShowUnusedAuthorities','1','','Show authorities that are not being used in the OPAC.','YesNo'), >+('OPACShowPlaceItemLevelHold','0',NULL,'Allow placing a item-level hold from the detailed biblio view.','YesNo'), > ('opacsmallimage','','','Enter a complete URL to an image to replace the default Koha logo','free'), > ('OpacStarRatings','all','disable|all|details',NULL,'Choice'), > ('OpacSuppression','0','','Turn ON the OPAC Suppression feature, requires further setup, ask your system administrator for details','YesNo'), >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 e622253..a217e2d 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 >@@ -131,6 +131,13 @@ OPAC: > no: "Don't show" > - the item's barcode on the holdings tab. > - >+ - pref: OPACShowPlaceItemLevelHold >+ default: 0 >+ choices: >+ yes: "Allow" >+ no : "Don't allow" >+ - placing a item-level hold from the detailed biblio view. This is always enabled for serials because serials need only item-level holds. Be aware that for performance reasons the link is displayed even if a user couldn't place holds on the item. >+ - > - pref: OpacHighlightedWords > choices: > yes: Highlight >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 3e07971..8fca843 100644 >--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt >+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt >@@ -132,6 +132,7 @@ > null, > [% END %] > [% IF ( ShowCourseReservesHeader ) %]null,[% END %] >+ [% IF ( OPACShowPlaceItemLevelHold || isSerial ) %]null,[% END %] > ] > })); > >@@ -1063,7 +1064,7 @@ YAHOO.util.Event.onContentReady("furtherm", function () { > > [% IF ( lotsofitems ) %] > <p> >- [% IF noBranchItems %] >+ [% IF userBranchNotDefined %] > Limiting items to the most recent received last year.</br> > [% ELSE %] > Showing only the most recent items from your branch.</br> >@@ -1550,6 +1551,7 @@ YAHOO.util.Event.onContentReady("furtherm", function () { > <th>Item hold queue priority</th> > [% END %] > [% IF ( ShowCourseReservesHeader ) %]<th id="item_coursereserves">Course reserves</th>[% END %] >+ [% IF ( OPACShowPlaceItemLevelHold || isSerial ) %]<th id="placeItemLevelHoldTh">Reserve</th>[% END %] > </tr></thead> > <tbody>[% FOREACH ITEM_RESULT IN items %] > [% IF ITEM_RESULT.this_branch %] >@@ -1630,6 +1632,13 @@ YAHOO.util.Event.onContentReady("furtherm", function () { > [% END %] > </td> > [% END %] >+ [% IF OPACShowPlaceItemLevelHold || isSerial %] >+ <td> >+ <a href="opac-reserve.pl?biblionumber=[% biblionumber %]&itemnumber=[% ITEM_RESULT.itemnumber %]"> >+ Place hold >+ </a> >+ </td> >+ [% END %] > </tr> > [% END %]</tbody> > </table> >@@ -1732,4 +1741,4 @@ YAHOO.util.Event.onContentReady("furtherm", function () { > </form> > </div> > </div> >-[% END %][%# end of filter_form block %] >\ No newline at end of file >+[% END %][%# end of filter_form block %] >diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt >index 671e1f9..3e317af 100644 >--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt >+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt >@@ -425,6 +425,7 @@ > <!-- ITEM HOLDS --> > > <li class="radio"> >+ [% UNLESS singleItemLevelHold %] > [% UNLESS ( bibitemloo.holdable ) %] > <input type="radio" name="reqtype_[% bibitemloo.biblionumber %]" > id="reqany_[% bibitemloo.biblionumber %]" >@@ -437,11 +438,12 @@ > id="reqany_[% bibitemloo.biblionumber %]" > class="selectany" > value="Any" >- checked="checked" >+ [% UNLESS singleItemLevelHold %] checked="checked" [% END %] > /> > [% END %] > > <label for="reqany_[% bibitemloo.biblionumber %]">Next available copy</label> >+ [% END %][%# IF singleItemLevelHold %] > [% UNLESS ( bibitemloo.holdable ) %] > <input type="radio" name="reqtype_[% bibitemloo.biblionumber %]" > id="reqspecific_[% bibitemloo.biblionumber %]" >@@ -454,14 +456,15 @@ > id="reqspecific_[% bibitemloo.biblionumber %]" > class="selectspecific" > value="Specific" >+ [% IF singleItemLevelHold %] checked="checked" [% END %] > /> > [% END %] > <label for="reqspecific_[% bibitemloo.biblionumber %]">A specific copy</label> > </li> > > [% END %] >- </ul> > [% END %] >+ </ul> > [% IF ( OPACItemHolds ) %] > [% IF ( bibitemloo.holdable ) %] > >@@ -489,7 +492,9 @@ > <td class="copy"> > [% IF ( itemLoo.available ) %] > <input type="radio" class="checkitem checkitem_[% bibitemloo.biblionumber %]" name="checkitem_[% bibitemloo.biblionumber %]" >- value="[% itemLoo.itemnumber %]" /> >+ value="[% itemLoo.itemnumber %]" >+ [% IF singleItemLevelHold %] checked="checked" [% END %] >+ /> > [% ELSE %] > <input disabled="disabled" type="radio" class="checkitem" name="checkitem" value="[% itemLoo.itemnumber %]" /> > <img src="/opac-tmpl/lib/famfamfam/silk/cross.png" alt="Cannot be put on hold" title="Cannot be put on hold" /> >@@ -540,12 +545,11 @@ > </table> > </div> > >- </fieldset> >- [% END %]<!-- OPACItemHolds --> >- > [% END %]<!-- bib_available --> > >+ [% END %]<!-- OPACItemHolds --> > </div> >+ </fieldset> > [% END %] > > [% END %] <!-- if message --> >diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl >index 7c83222..f377306 100755 >--- a/opac/opac-detail.pl >+++ b/opac/opac-detail.pl >@@ -77,7 +77,7 @@ $biblionumber = int($biblionumber); > ##>> Handling the Serial issue filter parameters from the user > ## > # We can filter issues based on these five values. >-my $filterBranchLimiter = $query->param('filterBranchLimiter') ? $query->param('filterBranchLimiter') : undef; >+my $filterBranchLimiter = $query->param('filterBranchLimiter') ? $query->param('filterBranchLimiter') : '_ShowAll'; > my $filterVolume = $query->param('filterVolume') ? $query->param('filterVolume') : undef; > my $filterNumber = $query->param('filterNumber') ? $query->param('filterNumber') : undef; > my $filterIssue = $query->param('filterIssue') ? $query->param('filterIssue') : undef; >@@ -306,7 +306,6 @@ if ($session->param('busc')) { > > my $expanded_facet = $arrParamsBusc->{'expand'}; > my $branches = GetBranches(); >- my $itemtypes = GetItemTypes; > my @servers; > @servers = @{$arrParamsBusc->{'server'}} if $arrParamsBusc->{'server'}; > @servers = ("biblioserver") unless (@servers); >@@ -317,7 +316,7 @@ if ($session->param('busc')) { > $sort_by[0] = $default_sort_by if !$sort_by[0] && defined($default_sort_by); > my ($error, $results_hashref, $facets); > eval { >- ($error, $results_hashref, $facets) = getRecords($arrParamsBusc->{'query'},$arrParamsBusc->{'simple_query'},\@sort_by,\@servers,$results_per_page,$offset,$expanded_facet,$branches,$itemtypes,$arrParamsBusc->{'query_type'},$arrParamsBusc->{'scan'}); >+ ($error, $results_hashref, $facets) = getRecords($arrParamsBusc->{'query'},$arrParamsBusc->{'simple_query'},\@sort_by,\@servers,$results_per_page,$offset,$expanded_facet,$branches,$arrParamsBusc->{'query_type'},$arrParamsBusc->{'scan'}); > }; > my $hits; > my @newresults; >@@ -705,7 +704,7 @@ if ( $show_holds_count || $show_priority) { > } > $template->param( show_priority => $has_hold ) ; > >-my $norequests = 1; >+my $norequests = 1; #"No requests"-flag hides the "Place hold"-link in opac-detail-sidebar.inc > my %itemfields; > my (@itemloop, @otheritemloop); > my $currentbranch = C4::Context->userenv ? C4::Context->userenv->{branch} : undef; >@@ -770,6 +769,11 @@ for my $itm (@items) { > } > } > >+#There is no point in enabling "Place hold" for Serials. >+# Placing a title-level hold for a Serial is crazy since we don't want "any" item but instead the specific volume and number. >+# Also choosing an item-level hold from opac-reserve.pl is problematic since there could be thousands of items. >+$norequests = 1 if $template->{VARS}->{'isSerial'}; >+ > # Display only one tab if one items list is empty > if (scalar(@itemloop) == 0 || scalar(@otheritemloop) == 0) { > $template->param(SeparateHoldings => 0); >@@ -1217,4 +1221,6 @@ if ( length C4::Context->preference('NumberingFormulaParsingRegexp') < 3 ) { > } > $template->{VARS}->{useFilterIssueInput} = 1 if (C4::Context->preference('FilterSerialsByIssue')); > >+$template->param('OPACShowPlaceItemLevelHold', C4::Context->preference('OPACShowPlaceItemLevelHold')); >+ > output_html_with_http_headers $query, $cookie, $template->output; >diff --git a/opac/opac-reserve.pl b/opac/opac-reserve.pl >index 4bba9a6..9007b1a 100755 >--- a/opac/opac-reserve.pl >+++ b/opac/opac-reserve.pl >@@ -73,8 +73,10 @@ if ($borr->{reservefee} > 0){ > my $branches = GetBranches(); > my $itemTypes = GetItemTypes(); > >-# There are two ways of calling this script, with a single biblio num >-# or multiple biblio nums. >+# There are three ways of calling this script, with a single biblio num >+# or multiple biblio nums or as a itemhold, where the target item has already been chosen. >+my $targetItemnumber = $query->param('itemnumber') ? $query->param('itemnumber') : undef; >+$template->param('singleItemLevelHold' => 1); > my $biblionumbers = $query->param('biblionumbers'); > my $reserveMode = $query->param('reserve_mode'); > if ($reserveMode && ($reserveMode eq 'single')) { >@@ -127,8 +129,14 @@ foreach my $biblioNumber (@biblionumbers) { > > my $biblioData = GetBiblioData($biblioNumber); > $biblioDataHash{$biblioNumber} = $biblioData; >+ my @itemInfos; > >- my @itemInfos = GetItemsInfo($biblioNumber); >+ if ($targetItemnumber) { #We just want the one item so use the filters to find it! >+ @itemInfos = GetItemsInfo($biblioNumber, {itemnumber => $targetItemnumber}); >+ } >+ else { >+ @itemInfos = GetItemsInfo($biblioNumber); >+ } > > my $marcrecord= GetMarcBiblio($biblioNumber); > >diff --git a/t/db_dependent/Items.t b/t/db_dependent/Items.t >index 30e639b..402f00a 100755 >--- a/t/db_dependent/Items.t >+++ b/t/db_dependent/Items.t >@@ -145,7 +145,7 @@ subtest 'GetHiddenItemnumbers tests' => sub { > > subtest 'Filter items tests' => sub { > >- plan tests => 3; >+ plan tests => 4; > > # Start transaction > $dbh->{AutoCommit} = 0; >@@ -165,6 +165,11 @@ subtest 'Filter items tests' => sub { > holdingbranch => 'MPL', }, > $biblionumber > ); >+ my ($item3_bibnum, $item3_bibitemnum, $item3_itemnumber) = AddItem( >+ { homebranch => 'IPT', >+ holdingbranch => 'IPT', }, >+ $biblionumber >+ ); > > # Testing the branch filter > my @shouldBeItem2 = C4::Items::GetItemsInfo($biblionumber, {branch => 'MPL'}); >@@ -177,6 +182,10 @@ subtest 'Filter items tests' => sub { > # Testing the limit filter > @shouldBeEmpty = C4::Items::GetItemsInfo($biblionumber, {limit => 0}); > is( scalar(@shouldBeEmpty), 0, "Filtering by limit"); >+ >+ # Testing the itemnumber filter >+ my @shouldBeItem3 = C4::Items::GetItemsInfo($biblionumber, {itemnumber => $item3_itemnumber}); >+ is( $shouldBeItem3[0]->{itemnumber}, $item3_itemnumber, "Filtering by itemnumber"); > }; > > # Helper method to set up a Biblio. >-- >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 11157
:
22509
|
22512
|
22515
|
22522
|
22523
|
22525
|
22526
|
22527
|
22528
|
22529
|
22567
|
22568
|
22571
|
22572
|
23209
|
23210