Bugzilla – Attachment 8625 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]
patch
0001-bug7398-OPACShowHoldsCount-syspref.patch (text/plain), 12.85 KB, created by
Srdjan Jankovic
on 2012-03-26 01:52:38 UTC
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Srdjan Jankovic
Created:
2012-03-26 01:52:38 UTC
Size:
12.85 KB
patch
obsolete
>From 22b488cc1ad36f1da7695b27cf77e1da2bae6c58 Mon Sep 17 00:00:00 2001 >From: Srdjan <srdjan@catalyst.net.nz> >Date: Mon, 26 Mar 2012 14:44:21 +1300 >Subject: [PATCH] bug7398: OPACShowHoldsCount syspref > >Show holds count on OPAC detail if OPACShowHoldsCount is yes >Take in account OPACShowHoldsCount syspref on opac-reserves.pl >--- > 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 | 9 ++++ > .../opac-tmpl/prog/en/modules/opac-reserve.tt | 46 ++++++++--------- > opac/opac-detail.pl | 10 ++++ > opac/opac-reserve.pl | 51 ++++++++++---------- > 7 files changed, 80 insertions(+), 50 deletions(-) > >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index 3e850b3..47abbce 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -355,3 +355,4 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ( > INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OAI-PMH:AutoUpdateSets','0','Automatically update OAI sets when a bibliographic record is created or updated','','YesNo'); > INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacAllowPublicListCreation',1,'If set, allows opac users to create public lists',NULL,'YesNo'); > INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacAllowSharingPrivateLists',0,'If set, allows opac users to share private lists with other patrons',NULL,'YesNo'); >+INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OPACShowHoldsCount',0,'Show the total number of holds in the OPAC details',NULL,'YesNo'); >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index 8259bf2..4a1ce74 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -5036,6 +5036,13 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { > SetVersion($DBversion); > } > >+$DBversion = "3.07.00.XXX"; >+if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { >+ $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OPACShowHoldsCount',0,'Show the total number of holds in the OPAC details',NULL,'YesNo')"); >+ print "Upgrade to $DBversion done (Added system preference OPACShowHoldsCount)\n"; >+ SetVersion($DBversion); >+} >+ > =head1 FUNCTIONS > > =head2 DropAllForeignKeys($table) >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 ae6b620..7af079d 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 >@@ -343,6 +343,12 @@ OPAC: > no: "Don't allow" > - patrons to place holds on specific items in the OPAC. If this is disabled, users can only put a hold on the next available item. > - >+ - pref: OPACShowHoldsCount >+ choices: >+ yes: Show >+ no: "Don't show" >+ - the total number of holds on the details page >+ - > - pref: OpacRenewalAllowed > choices: > yes: Allow >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 5c5b885..854929e 100644 >--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt >+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt >@@ -599,6 +599,9 @@ YAHOO.util.Event.onContentReady("furtherm", function () { > <th>Status</th> > [% IF ( itemdata_itemnotes ) %]<th>Notes</th>[% END %] > <th>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 %] >@@ -623,10 +626,16 @@ 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 %]</td> >+ [% IF holds_count.defined %] >+ <td>[% ITEM_RESULT.holds_count %]</td> >+ [% END %] > </tr> > [% END %]</tbody> > </table> > [% END %] >+ [% IF holds_count.defined %] >+ <div id="bib_holds">Holds: [% holds_count %]</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..0373ff3 100644 >--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt >+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt >@@ -242,7 +242,7 @@ > [% UNLESS ( item_level_itypes ) %] > <th>Item Type</th> > [% END %] >- [% IF ( showpriority ) %] >+ [% IF ( showholds ) %] > <th>Priority</th> > [% END %] > [% IF ( reserve_in_future ) %] >@@ -297,19 +297,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 +350,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 +382,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 b45250d..0e0654c 100755 >--- a/opac/opac-detail.pl >+++ b/opac/opac-detail.pl >@@ -480,10 +480,20 @@ 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; >+if ( C4::Context->preference("OPACShowHoldsCount") ) { >+ my ($reserve_count,$reserves) = GetReservesFromBiblionumber($biblionumber); >+ $template->param( holds_count => $reserve_count ); >+ foreach (@$reserves) { >+ $item_reserves{ $_->{itemnumber} }++ if $_->{itemnumber}; >+ } >+} >+ > my $norequests = 1; > my $branches = GetBranches(); > my %itemfields; > for my $itm (@items) { >+ $itm->{holds_count} = $item_reserves{ $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..77e5b05 100755 >--- a/opac/opac-reserve.pl >+++ b/opac/opac-reserve.pl >@@ -48,6 +48,8 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( > } > ); > my $OPACDisplayRequestPriority = (C4::Context->preference("OPACDisplayRequestPriority")) ? 1 : 0; >+my $show_holds_count = C4::Context->preference("OPACShowHoldsCount"); >+ > sub get_out ($$$) { > output_html_with_http_headers(shift,shift,shift); # $query, $cookie, $template->output; > exit; >@@ -113,12 +115,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 +126,33 @@ 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} = $rank; >+ foreach my $res (@$reserves) { >+ my $found = $res->{'found'}; >+ if ( $found && ($found eq 'W') ) { >+ $rank--; >+ } > } >+ $rank++; >+ $biblioData->{rank} = $rank; > } >- $rank++; >- $biblioData->{rank} = $rank; > } > > # >@@ -528,7 +526,8 @@ $template->param(itemtable_colspan => $itemTableColspan); > > # display infos > $template->param(bibitemloop => $biblioLoop); >-$template->param( showpriority=>1 ) if $OPACDisplayRequestPriority; >+$template->param( showpriority=>$OPACDisplayRequestPriority); >+$template->param( showholds=>$show_holds_count); > # can set reserve date in future > if ( > C4::Context->preference( 'AllowHoldDateInFuture' ) && >-- >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