Bugzilla – Attachment 8737 Details for
Bug 7398
Show number of holds on a title in the OPAC details
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
bug_7398: Replaced OPACDisplayRequestPriority syspref with OPACShowHoldQueueDetails
bug7398-Replaced-OPACDisplayRequestPriority-syspre.patch (text/plain), 17.88 KB, created by
Chris Cormack
on 2012-03-31 21:10:53 UTC
(
hide
)
Description:
bug_7398: Replaced OPACDisplayRequestPriority syspref with OPACShowHoldQueueDetails
Filename:
MIME Type:
Creator:
Chris Cormack
Created:
2012-03-31 21:10:53 UTC
Size:
17.88 KB
patch
obsolete
>From c8493641339a55ebf48772dd696c8c9fa3b40404 Mon Sep 17 00:00:00 2001 >From: Srdjan <srdjan@catalyst.net.nz> >Date: Fri, 30 Mar 2012 13:00:41 +1300 >Subject: [PATCH] bug_7398: Replaced OPACDisplayRequestPriority syspref with > OPACShowHoldQueueDetails > >New syspref is Choice, options being: >- None >- Holds number only >- Holds number and priority > >Show holds count on OPAC detail >--- > admin/systempreferences.pl | 2 +- > installer/data/mysql/sysprefs.sql | 2 +- > installer/data/mysql/updatedatabase.pl | 13 ++++ > .../prog/en/modules/admin/preferences/opac.pref | 9 ++- > koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt | 17 ++++++ > .../opac-tmpl/prog/en/modules/opac-reserve.tt | 52 +++++++++-------- > opac/opac-detail.pl | 21 +++++++ > opac/opac-reserve.pl | 60 +++++++++++--------- > opac/opac-user.pl | 11 ++- > 9 files changed, 125 insertions(+), 62 deletions(-) > >diff --git a/admin/systempreferences.pl b/admin/systempreferences.pl >index f4069ae..ebc52de 100755 >--- a/admin/systempreferences.pl >+++ b/admin/systempreferences.pl >@@ -348,7 +348,7 @@ $tabsysprefs{OPACViewOthersSuggestions} = "OPAC"; > $tabsysprefs{URLLinkText} = "OPAC"; > $tabsysprefs{OPACSearchForTitleIn} = "OPAC"; > $tabsysprefs{OPACShelfBrowser} = "OPAC"; >-$tabsysprefs{OPACDisplayRequestPriority} = "OPAC"; >+$tabsysprefs{OPACShowHoldQueueDetails} = "OPAC"; > $tabsysprefs{OPACAllowHoldDateInFuture} = "OPAC"; > $tabsysprefs{OPACPatronDetails} = "OPAC"; > $tabsysprefs{OPACFinesTab} = "OPAC"; >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index 34ac684..aa6affb 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -233,7 +233,7 @@ INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES > INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES ('CurrencyFormat','US','US|FR','Determines the display format of currencies. eg: \'36000\' is displayed as \'360 000,00\' in \'FR\' or \'360,000.00\' in \'US\'.','Choice'); > INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES ('AcqCreateItem','ordering','ordering|receiving|cataloguing','Define when the item is created : when ordering, when receiving, or in cataloguing module','Choice'); > INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('AllowRenewalLimitOverride', '0', 'if ON, allows renewal limits to be overridden on the circulation screen',NULL,'YesNo'); >-INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES ('OPACDisplayRequestPriority','0','','Show patrons the priority level on holds in the OPAC','YesNo'); >+INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES ('OPACShowHoldQueueDetails','none','none|holds|holds_priority','Show holds details in OPAC','Choice'); > INSERT INTO `systempreferences` ( `variable` , `value` , `options` , `explanation` , `type` ) VALUES ( 'UseBranchTransferLimits', '0', '', 'If ON, Koha will will use the rules defined in branch_transfer_limits to decide if an item transfer should be allowed.', 'YesNo'); > INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('AllowHoldPolicyOverride', '0', 'Allow staff to override hold policies when placing holds',NULL,'YesNo'); > INSERT INTO `systempreferences` ( `variable` , `value` , `options` , `explanation` , `type` ) VALUES ( 'BranchTransferLimitsType', 'ccode', 'itemtype|ccode', 'When using branch transfer limits, choose whether to limit by itemtype or collection code.', 'Choice'); >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index c297677..59c9d21 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -5136,6 +5136,19 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { > $dbh->do("UPDATE systempreferences SET type='Free', value=\"$valueOPACXSLTResultsDisplay\" WHERE variable='OPACXSLTResultsDisplay'"); > } > print "XSLT systempreference takes a path to file rather than YesNo\n"; >+} >+ >+ >+$DBversion = "3.07.00.XXX"; >+if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { >+ $dbh->do("UPDATE systempreferences SET >+ variable = 'OPACShowHoldQueueDetails', >+ value = CASE value WHEN '1' THEN 'holds_priority' ELSE 'none' END, >+ options = 'none|holds|holds_priority', >+ explanation = 'Show holds details in OPAC', >+ type = 'Choice' >+ WHERE variable = 'OPACDisplayRequestPriority'"); >+ print "Upgrade to $DBversion done (Changed system preference OPACDisplayRequestPriority -> OPACShowHoldQueueDetails)\n"; > SetVersion($DBversion); > } > >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 a871399..9976443 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 >@@ -71,11 +71,12 @@ OPAC: > no: "Don't include" > - "COinS / OpenURL / Z39.88 in OPAC search results. <br/>Warning: Enabling this feature will slow OPAC search response times." > - >- - pref: OPACDisplayRequestPriority >+ - pref: OPACShowHoldQueueDetails > choices: >- yes: Show >- no: "Don't show" >- - patrons the priority level of their holds in the OPAC. >+ none: "Don't show any hold details" >+ holds: "Show holds" >+ holds_priority: "Show holds and their priority level" >+ - to patrons in the OPAC. > - > - pref: OPACShowCheckoutName > default: 0 >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 a5be324..c72ab82 100644 >--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt >+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt >@@ -629,6 +629,9 @@ YAHOO.util.Event.onContentReady("furtherm", function () { > <th id="item_status">Status</th> > [% IF ( itemdata_itemnotes ) %]<th id="item_notes">Notes</th>[% END %] > <th id="item_datedue">Date Due</th> >+ [% IF holds_count.defined %] >+ <th>Holds</th> >+ [% END %] > </tr></thead> > <tbody>[% FOREACH ITEM_RESULT IN ITEM_RESULTS %] > <tr>[% IF ( item_level_itypes ) %]<td>[% UNLESS ( noItemTypeImages ) %][% IF ( ITEM_RESULT.imageurl ) %]<img src="[% ITEM_RESULT.imageurl %]" title="[% ITEM_RESULT.description %]" alt="[% ITEM_RESULT.description %]" />[% END %][% END %] [% ITEM_RESULT.description %]</td>[% END %] >@@ -653,10 +656,24 @@ YAHOO.util.Event.onContentReady("furtherm", function () { > <td>[% INCLUDE 'item-status.inc' item = ITEM_RESULT %]</td> > [% IF ( itemdata_itemnotes ) %]<td>[% ITEM_RESULT.itemnotes %]</td>[% END %] > <td>[% ITEM_RESULT.datedue | $KohaDates %]</td> >+ [% IF holds_count.defined %] >+ <td>[% ITEM_RESULT.holds_count %] >+ [% IF ITEM_RESULT.priority %] >+ (priority [% ITEM_RESULT.priority %]) >+ [% END %] >+ </td> >+ [% END %] > </tr> > [% END %]</tbody> > </table> > [% END %] >+ [% IF holds_count.defined %] >+ <div id="bib_holds">Holds: [% holds_count %] >+ [% IF priority %] >+ (priority [% priority %]) >+ [% END %] >+ </div> >+ [% END %] > [% ELSE %] > [% IF ( ALTERNATEHOLDINGS ) %] > [% FOREACH ALTERNATEHOLDING IN ALTERNATEHOLDINGS %] >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 7597a4a..43e4e36 100644 >--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt >+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt >@@ -242,8 +242,12 @@ > [% UNLESS ( item_level_itypes ) %] > <th>Item Type</th> > [% END %] >- [% IF ( showpriority ) %] >- <th>Priority</th> >+ [% IF ( showholds ) %] >+ <th>Holds >+ [% IF ( showpriority ) %] >+ and priority >+ [% END %] >+ </th> > [% END %] > [% IF ( reserve_in_future ) %] > <th>Hold Starts on Date</th> >@@ -297,19 +301,21 @@ > [% END %] > > </td> >- [% IF ( bibitemloo.holdable ) %][% UNLESS ( item_level_itypes ) %] >- <td> >- [% IF ( bibitemloo.imageurl ) %]<img src="[% bibitemloo.imageurl %]" alt="" />[% END %] >- [% bibitemloo.description %] >- </td> >- [% END %][% END %] > [% IF ( bibitemloo.holdable ) %] >- [% IF ( showpriority ) %] >- <td> >- [% bibitemloo.rank %] out of [% bibitemloo.reservecount %] >- </td>[% END %][% END %] >- [% IF ( reserve_in_future ) %] >- [% IF ( bibitemloo.holdable ) %]<td> >+ <!-- HOLDABLE --> >+ [% UNLESS ( item_level_itypes ) %] >+ <td> >+ [% IF ( bibitemloo.imageurl ) %]<img src="[% bibitemloo.imageurl %]" alt="" />[% END %] >+ [% bibitemloo.description %] >+ </td> >+ [% END %] >+ [% IF showholds %] >+ <td> >+ [% IF ( showpriority ) %] [% bibitemloo.rank %] out of [% END %][% bibitemloo.reservecount %] >+ </td> >+ [% END %] >+ [% IF ( reserve_in_future ) %] >+ <td> > <input name="reserve_date_[% bibitemloo.biblionumber %]" id="reserve_date_[% bibitemloo.biblionumber %]" size="10"> > <script language="JavaScript" type="text/javascript"> > //<![CDATA[ >@@ -348,10 +354,9 @@ > </script> > <p style="margin:.3em 2em;"> > <a href="#" style="font-size:85%;text-decoration:none;" onclick="document.getElementById('reserve_date_[% bibitemloo.biblionumber %]').value='';return false;">Clear Date</a></p> >- </td>[% END %] >- >- [% END %] >- [% IF ( bibitemloo.holdable ) %]<td> >+ </td> >+ [% END %] >+ <td> > <input name="expiration_date_[% bibitemloo.biblionumber %]" id="expiration_date_[% bibitemloo.biblionumber %]" size="10" readonly="readonly" /> > <img src="[% themelang %]/lib/calendar/cal.gif" alt="Show Calendar" border="0" id="CalendarExpirationDate_[% bibitemloo.biblionumber %]" style="cursor: pointer;" /> > <script language="JavaScript" type="text/javascript"> >@@ -381,13 +386,10 @@ > </script> > <p style="margin:.3em 2em;"> > <a href="#" style="font-size:85%;text-decoration:none;" onclick="document.getElementById('expiration_date_[% bibitemloo.biblionumber %]').value='';return false;">Clear Date</a></p> >- </td>[% END %] >- >- [% IF ( bibitemloo.holdable ) %] >- <!-- HOLD ABLE --> >- [% IF ( OPACItemHolds ) %] >- <!-- ITEM HOLDS --> >- <td class="place_on_type" style="display:none"> >+ </td> >+ [% IF ( OPACItemHolds ) %] >+ <!-- ITEM HOLDS --> >+ <td class="place_on_type" style="display:none"> > <ul> > <li> > [% UNLESS ( bibitemloo.holdable ) %] >diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl >index a00e976..7e155ab 100755 >--- a/opac/opac-detail.pl >+++ b/opac/opac-detail.pl >@@ -479,10 +479,31 @@ if ($dat->{'count'} >= 50 && !$viewallitems) { > > my $biblio_authorised_value_images = C4::Items::get_authorised_value_images( C4::Biblio::get_biblio_authorised_values( $biblionumber, $record ) ); > >+my (%item_reserves, %priority); >+my ($show_holds_count, $show_priority); >+for ( C4::Context->preference("OPACShowHoldQueueDetails") ) { >+ m/holds/o and $show_holds_count = 1; >+ m/priority/ and $show_priority = 1; >+} >+if ( $show_holds_count ) { >+ my ($reserve_count,$reserves) = GetReservesFromBiblionumber($biblionumber); >+ $template->param( holds_count => $reserve_count ); >+ foreach (@$reserves) { >+ $item_reserves{ $_->{itemnumber} }++ if $_->{itemnumber}; >+ if ($show_priority && $_->{borrowernumber} == $borrowernumber) { >+ $_->{itemnumber} >+ ? ($priority{ $_->{itemnumber} } = $_->{priority}) >+ : ($template->param( priority => $_->{priority} )); >+ } >+ } >+} >+ > my $norequests = 1; > my $branches = GetBranches(); > my %itemfields; > for my $itm (@items) { >+ $itm->{holds_count} = $item_reserves{ $itm->{itemnumber} }; >+ $itm->{priority} = $priority{ $itm->{itemnumber} }; > $norequests = 0 > if ( (not $itm->{'wthdrawn'} ) > && (not $itm->{'itemlost'} ) >diff --git a/opac/opac-reserve.pl b/opac/opac-reserve.pl >index 4e4d440..3844bc1 100755 >--- a/opac/opac-reserve.pl >+++ b/opac/opac-reserve.pl >@@ -47,7 +47,13 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( > debug => 1, > } > ); >-my $OPACDisplayRequestPriority = (C4::Context->preference("OPACDisplayRequestPriority")) ? 1 : 0; >+ >+my ($show_holds_count, $show_priority); >+for ( C4::Context->preference("OPACShowHoldQueueDetails") ) { >+ m/holds/o and $show_holds_count = 1; >+ m/priority/ and $show_priority = 1; >+} >+ > sub get_out ($$$) { > output_html_with_http_headers(shift,shift,shift); # $query, $cookie, $template->output; > exit; >@@ -113,12 +119,8 @@ $template->param( choose_branch => $OPACChooseBranch); > # > # > >-# Hash of biblionumber to biblio/biblioitems record. >-my %biblioDataHash; >- >-# Hash of itemnumber to item info. >-my %itemInfoHash; >- >+my %biblioDataHash; # Hash of biblionumber to biblio/biblioitems record. >+my %itemInfoHash; # Hash of itemnumber to item info. > foreach my $biblioNumber (@biblionumbers) { > > my $biblioData = GetBiblioData($biblioNumber); >@@ -128,33 +130,36 @@ foreach my $biblioNumber (@biblionumbers) { > > my $marcrecord= GetMarcBiblio($biblioNumber); > >- # flag indicating existence of at least one item linked via a host record >- my $hostitemsflag; >- # adding items linked via host biblios >- my @hostitemInfos = GetHostItemsInfo($marcrecord); >- if (@hostitemInfos){ >- $hostitemsflag =1; >- push (@itemInfos,@hostitemInfos); >- } >- >- >+ # flag indicating existence of at least one item linked via a host record >+ my $hostitemsflag; >+ # adding items linked via host biblios >+ my @hostitemInfos = GetHostItemsInfo($marcrecord); >+ if (@hostitemInfos){ >+ $hostitemsflag =1; >+ push (@itemInfos,@hostitemInfos); >+ } > > $biblioData->{itemInfos} = \@itemInfos; > foreach my $itemInfo (@itemInfos) { > $itemInfoHash{$itemInfo->{itemnumber}} = $itemInfo; > } > >- # Compute the priority rank. >- my ( $rank, $reserves ) = GetReservesFromBiblionumber($biblioNumber,1); >- $biblioData->{reservecount} = $rank; >- foreach my $res (@$reserves) { >- my $found = $res->{'found'}; >- if ( $found && ($found eq 'W') ) { >- $rank--; >+ if ($show_holds_count) { >+ # Compute the priority rank. >+ my ( $rank, $reserves ) = GetReservesFromBiblionumber($biblioNumber,1); >+ $biblioData->{reservecount} = 1; # new reserve >+ foreach my $res (@$reserves) { >+ my $found = $res->{'found'}; >+ if ( $found && ($found eq 'W') ) { >+ $rank--; >+ } >+ else { >+ $biblioData->{reservecount}++; >+ } > } >+ $rank++; >+ $biblioData->{rank} = $rank; > } >- $rank++; >- $biblioData->{rank} = $rank; > } > > # >@@ -528,7 +533,8 @@ $template->param(itemtable_colspan => $itemTableColspan); > > # display infos > $template->param(bibitemloop => $biblioLoop); >-$template->param( showpriority=>1 ) if $OPACDisplayRequestPriority; >+$template->param( showholds=>$show_holds_count); >+$template->param( showpriority=>$show_priority); > # can set reserve date in future > if ( > C4::Context->preference( 'AllowHoldDateInFuture' ) && >diff --git a/opac/opac-user.pl b/opac/opac-user.pl >index a9a6305..aba6877 100755 >--- a/opac/opac-user.pl >+++ b/opac/opac-user.pl >@@ -65,7 +65,10 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( > } > ); > >-my $OPACDisplayRequestPriority = (C4::Context->preference("OPACDisplayRequestPriority")) ? 1 : 0; >+my $show_priority; >+for ( C4::Context->preference("OPACShowHoldQueueDetails") ) { >+ m/priority/ and $show_priority = 1; >+} > my $patronupdate = $query->param('patronupdate'); > my $canrenew = 1; > >@@ -260,8 +263,8 @@ foreach my $res (@reserves) { > $res->{'branch'} = $branches->{ $res->{'branchcode'} }->{'branchname'}; > my $biblioData = GetBiblioData($res->{'biblionumber'}); > $res->{'reserves_title'} = $biblioData->{'title'}; >- if ($OPACDisplayRequestPriority) { >- $res->{'priority'} = '' if $res->{'priority'} eq '0'; >+ if ($show_priority) { >+ $res->{'priority'} ||= ''; > } > $res->{'suspend_until'} = C4::Dates->new( $res->{'suspend_until'}, "iso")->output("syspref") if ( $res->{'suspend_until'} ); > } >@@ -271,7 +274,7 @@ foreach my $res (@reserves) { > > $template->param( RESERVES => \@reserves ); > $template->param( reserves_count => $#reserves+1 ); >-$template->param( showpriority=>1 ) if $OPACDisplayRequestPriority; >+$template->param( showpriority=>$show_priority ); > > my @waiting; > my $wcount = 0; >-- >1.7.5.4
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 7398
:
8171
|
8181
|
8430
|
8441
|
8552
|
8625
|
8701
|
8737
|
9008
|
9251
|
9439
|
9733
|
14138