[Koha-patches] [PATCH] bug7398: OPACShowHoldsCount syspref
Srdjan Jankovic
srdjan at catalyst.net.nz
Mon Mar 12 03:33:37 CET 2012
Show holds count on OPAC detail if OPACShowHoldsCount is yes
---
installer/data/mysql/sysprefs.sql | 3 ++-
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/opac-detail.pl | 10 ++++++++++
5 files changed, 34 insertions(+), 1 deletions(-)
diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql
index d16ff81..21f6de4 100644
--- a/installer/data/mysql/sysprefs.sql
+++ b/installer/data/mysql/sysprefs.sql
@@ -347,4 +347,5 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('LinkerKeepStale',0,'If ON the authority linker will keep existing authority links for headings where it is unable to find a match.',NULL,'YesNo');
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('CatalogModuleRelink',0,'If OFF the linker will never replace the authids that are set in the cataloging module.',NULL,'YesNo');
INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('ExpireReservesMaxPickUpDelay', '0', '', 'Enabling this allows holds to expire automatically if they have not been picked by within the time period specified in ReservesMaxPickUpDelay', 'YesNo');
-INSERT INTO systempreferences` (variable,value,options,explanation,type) VALUES ('ExpireReservesMaxPickUpDelayCharge', '0', NULL , 'If ExpireReservesMaxPickUpDelay is enabled, and this field has a non-zero value, than a borrower whose waiting hold has expired will be charged this amount.', 'free')
+INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('ExpireReservesMaxPickUpDelayCharge', '0', NULL , 'If ExpireReservesMaxPickUpDelay is enabled, and this field has a non-zero value, than a borrower whose waiting hold has expired will be charged this amount.', 'free');
+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 b844560..38d19e1 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -4892,6 +4892,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 1acc414..339107e 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 7af60a0..40c5389 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt
@@ -589,6 +589,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 %]
@@ -601,10 +604,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/opac/opac-detail.pl b/opac/opac-detail.pl
index 27684d4..b07c240 100755
--- a/opac/opac-detail.pl
+++ b/opac/opac-detail.pl
@@ -479,10 +479,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'} )
--
1.6.5
More information about the Koha-patches
mailing list