[Koha-patches] [PATCH] bug_7398: Take in account OPACShowHoldsCount syspref on opac-reserves.pl
Srdjan
srdjan at catalyst.net.nz
Fri Mar 23 07:02:32 CET 2012
---
.../opac-tmpl/prog/en/modules/opac-reserve.tt | 44 ++++++++---------
opac/opac-reserve.pl | 51 ++++++++++----------
2 files changed, 46 insertions(+), 49 deletions(-)
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..5ed0e5b 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt
@@ -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-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, at 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, at 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
More information about the Koha-patches
mailing list