Bugfix 2339 - Place hold button display with AllowOnShelfHolds OFF

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
This commit is contained in:
Kyle M Hall 2009-07-29 13:05:52 +00:00 committed by Galen Charlton
parent 04db609d9e
commit 38b356da8b
9 changed files with 85 additions and 14 deletions

View file

@ -67,7 +67,7 @@ BEGIN {
GetMarcUrls
&GetUsedMarcStructure
&GetXmlBiblio
&GetCOinSBiblio
&GetCOinSBiblio
&GetAuthorisedValueDesc
&GetMarcStructure
@ -75,6 +75,8 @@ BEGIN {
&GetFrameworkCode
&GetPublisherNameFromIsbn
&TransformKohaToMarc
&CountItemsIssued
);
# To modify something
@ -2024,6 +2026,15 @@ more.
=cut
sub CountItemsIssued {
my ( $biblionumber ) = @_;
my $dbh = C4::Context->dbh;
my $sth = $dbh->prepare('SELECT COUNT(*) as issuedCount FROM items, issues WHERE items.itemnumber = issues.itemnumber AND items.biblionumber = ?');
$sth->execute( $biblionumber );
my $row = $sth->fetchrow_hashref();
return $row->{'issuedCount'};
}
sub _disambiguate {
my ($table, $column) = @_;
if ($column eq "cn_sort" or $column eq "cn_source") {

View file

@ -161,11 +161,18 @@
<!-- TMPL_UNLESS NAME="norequests" -->
<!-- TMPL_UNLESS name="bi_notforloan" -->
<!-- TMPL_IF NAME="opacuserlogin" --><!-- TMPL_IF NAME="RequestOnOpac" -->
<li><a class="reserve" href="/cgi-bin/koha/opac-reserve.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->">
Place Hold
</a></li>
<!-- /TMPL_IF --><!-- /TMPL_IF -->
<!-- TMPL_IF NAME="opacuserlogin" -->
<!-- TMPL_IF NAME="RequestOnOpac" -->
<!-- TMPL_IF NAME="AllowOnShelfHolds" -->
<li><a class="reserve" href="/cgi-bin/koha/opac-reserve.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->">Place Hold</a></li>
<!-- TMPL_ELSE -->
<!-- TMPL_IF NAME="itemsissued" -->
<li><a class="reserve" href="/cgi-bin/koha/opac-reserve.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->">Place Hold</a></li>
<!-- /TMPL_IF -->
<!-- /TMPL_IF -->
<!-- /TMPL_IF -->
<!-- /TMPL_IF -->
<!-- /TMPL_UNLESS -->
<!-- /TMPL_UNLESS -->
<li><a class="print" href="/cgi-bin/koha/opac-detailprint.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->" onclick="Dopop('opac-detailprint.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->'); return false;">

View file

@ -19,7 +19,19 @@
<div class="container"><div class="yui-g">
<div id="toolbar">
<ul>
<!-- TMPL_UNLESS NAME="norequests" --><!-- TMPL_IF NAME="opacuserlogin" --><!-- TMPL_IF NAME="RequestOnOpac" --><li><a class="link reserve" href="/cgi-bin/koha/opac-reserve.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->">Place Hold</a></li><!-- /TMPL_IF --><!-- /TMPL_IF --><!-- /TMPL_UNLESS -->
<!-- TMPL_UNLESS NAME="norequests" -->
<!-- TMPL_IF NAME="opacuserlogin" -->
<!-- TMPL_IF NAME="RequestOnOpac" -->
<!-- TMPL_IF NAME="AllowOnShelfHolds" -->
<li><a class="link reserve" href="/cgi-bin/koha/opac-reserve.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->">Place Hold</a></li>
<!-- TMPL_ELSE -->
<!-- TMPL_IF NAME="ItemsIssued" -->
<li><a class="link reserve" href="/cgi-bin/koha/opac-reserve.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->">Place Hold</a></li>
<!-- /TMPL_IF -->
<!-- /TMPL_IF -->
<!-- /TMPL_IF -->
<!-- /TMPL_IF -->
<!-- /TMPL_UNLESS -->
<li><a class="link print" href="/cgi-bin/koha/opac-detailprint.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->" onclick="Dopop('opac-detailprint.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->'); return false;">Print</a></li>
<!-- TMPL_IF name="virtualshelves" --><!-- TMPL_IF NAME="opacuserlogin" --><!-- TMPL_IF NAME="loggedinusername" --><li><a class="link addtoshelf" href="/cgi-bin/koha/opac-addbybiblionumber.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->" onclick="Dopop('opac-addbybiblionumber.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->'); return false;">Save to Your Lists</a></li><!-- /TMPL_IF --><!-- /TMPL_IF --><!-- /TMPL_IF -->
<!-- TMPL_IF NAME="opacbookbag" --><li><a class="link addtocart" href="#" onclick="addRecord('<!-- TMPL_VAR NAME="biblionumber" -->'); return false;">Add to Your Cart</a></li><!-- /TMPL_IF -->

View file

@ -736,11 +736,17 @@ YAHOO.util.Event.onContentReady("furtherm", function () {
<!-- TMPL_UNLESS NAME="norequests" -->
<!-- TMPL_UNLESS name="bi_notforloan" -->
<!-- TMPL_IF NAME="opacuserlogin" --><!-- TMPL_IF NAME="RequestOnOpac" -->
<li><a class="reserve" href="/cgi-bin/koha/opac-reserve.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->">
Place Hold
</a></li>
<!-- /TMPL_IF --><!-- /TMPL_IF -->
<!-- TMPL_IF NAME="opacuserlogin" -->
<!-- TMPL_IF NAME="RequestOnOpac" -->
<!-- TMPL_IF NAME="AllowOnShelfHolds" -->
<li><a class="reserve" href="/cgi-bin/koha/opac-reserve.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->">Place Hold</a></li>
<!-- TMPL_ELSE -->
<!-- TMPL_IF NAME="ItemsIssued" -->
<li><a class="reserve" href="/cgi-bin/koha/opac-reserve.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->">Place Hold</a></li>
<!-- /TMPL_IF -->
<!-- /TMPL_IF -->
<!-- /TMPL_IF -->
<!-- /TMPL_IF -->
<!-- /TMPL_UNLESS -->
<!-- /TMPL_UNLESS -->
<li><a class="print" href="/cgi-bin/koha/opac-detailprint.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->" onclick="Dopop('opac-detailprint.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->'); return false;">

View file

@ -224,7 +224,21 @@ $(document).ready(function(){
</span>
</p>
<p><!-- TMPL_IF name="RequestOnOpac" --><!-- TMPL_UNLESS NAME="norequests" --><!-- TMPL_IF NAME="opacuserlogin" --><a class="reserve" href="/cgi-bin/koha/opac-reserve.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->">Place Hold</a><!-- /TMPL_IF --><!-- /TMPL_UNLESS --> <!-- /TMPL_IF -->
<p>
<!-- TMPL_IF name="RequestOnOpac" -->
<!-- TMPL_UNLESS NAME="norequests" -->
<!-- TMPL_IF NAME="opacuserlogin" -->
<!-- TMPL_IF NAME="AllowOnShelfHolds" -->
<a class="hold" href="/cgi-bin/koha/opac-reserve.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->">Place Hold</a><!-- add back when available 0 holds in queue-->
<!-- TMPL_ELSE -->
<!-- TMPL_IF NAME="itemsissued" -->
<a class="hold" href="/cgi-bin/koha/opac-reserve.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->">Place Hold</a><!-- add back when available 0 holds in queue-->
<!-- /TMPL_IF -->
<!-- /TMPL_IF -->
<!-- /TMPL_IF -->
<!-- /TMPL_UNLESS -->
<!-- /TMPL_IF -->
<!--TMPL_IF EXPR="opacbookbag || virtualshelves" --><input type="checkbox" name="biblionumber" value="<!-- TMPL_VAR NAME="biblionumber" -->" title="Click to add to cart" /> <label for="bib<!-- TMPL_VAR NAME="biblionumber" -->"><!-- /TMPL_IF --><img src="<!-- TMPL_VAR NAME="themelang" -->/images/<!-- TMPL_VAR NAME="itemtype" -->.gif" alt="<!-- TMPL_VAR NAME="ccode" -->" title="<!-- TMPL_VAR NAME="ccode" -->" /><!--TMPL_IF EXPR="opacbookbag || virtualshelves" --></label><!-- /TMPL_IF --> <!-- TMPL_IF name="classification" -->
<a href="/cgi-bin/koha/opac-search.pl?q=callnum:<!-- TMPL_VAR NAME="classification" ESCAPE="URL" -->">
<!-- TMPL_VAR NAME="classification" -->

View file

@ -427,7 +427,19 @@ $(document).ready(function(){
<!-- TMPL_IF Name="searchhighlightblob" --><span class="results_summary"><span class="label">Match:</span> <!-- TMPL_VAR NAME="searchhighlightblob" --></span><!-- /TMPL_IF -->
<span class="results_summary actions"><span class="label">Actions:</span>
<!-- TMPL_IF name="RequestOnOpac" --><!-- TMPL_UNLESS NAME="norequests" --><!-- TMPL_IF NAME="opacuserlogin" --><a class="hold" href="/cgi-bin/koha/opac-reserve.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->">Place Hold</a><!-- add back when available 0 holds in queue--> <!-- /TMPL_IF --><!-- /TMPL_UNLESS --><!-- /TMPL_IF -->
<!-- TMPL_IF name="RequestOnOpac" -->
<!-- TMPL_UNLESS NAME="norequests" -->
<!-- TMPL_IF NAME="opacuserlogin" -->
<!-- TMPL_IF NAME="AllowOnShelfHolds" -->
<a class="hold" href="/cgi-bin/koha/opac-reserve.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->">Place Hold</a><!-- add back when available 0 holds in queue-->
<!-- TMPL_ELSE -->
<!-- TMPL_IF NAME="itemsissued" -->
<a class="hold" href="/cgi-bin/koha/opac-reserve.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->">Place Hold</a><!-- add back when available 0 holds in queue-->
<!-- /TMPL_IF -->
<!-- /TMPL_IF -->
<!-- /TMPL_IF -->
<!-- /TMPL_UNLESS -->
<!-- /TMPL_IF -->
<!-- TMPL_IF NAME="opacuserlogin" --><!-- TMPL_IF NAME="loggedinusername" --><!-- TMPL_IF NAME="virtualshelves" --><a class="addtolist" href="/cgi-bin/koha/opac-addbybiblionumber.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->" onclick="Dopop('opac-addbybiblionumber.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->'); return false;">Save to Lists</a>

View file

@ -74,6 +74,9 @@ $template->param(
bibliotitle => $biblio->{title},
);
$template->param( 'AllowOnShelfHolds' => C4::Context->preference('AllowOnShelfHolds') );
$template->param( 'ItemsIssued' => CountItemsIssued( $biblionumber ) );
# adding the $RequestOnOpac param
my $RequestOnOpac;
if (C4::Context->preference("RequestOnOpac")) {

View file

@ -59,6 +59,10 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
);
my $biblionumber = $query->param('biblionumber') || $query->param('bib');
$template->param( 'AllowOnShelfHolds' => C4::Context->preference('AllowOnShelfHolds') );
$template->param( 'ItemsIssued' => CountItemsIssued( $biblionumber ) );
my $record = GetMarcBiblio($biblionumber);
$template->param( biblionumber => $biblionumber );
# XSLT processing of some stuff

View file

@ -73,6 +73,7 @@ if (C4::Context->preference("marcflavour") eq "UNIMARC" ) {
elsif (C4::Context->preference("marcflavour") eq "MARC21" ) {
$template->param('usmarc' => 1);
}
$template->param( 'AllowOnShelfHolds' => C4::Context->preference('AllowOnShelfHolds') );
if (C4::Context->preference('BakerTaylorEnabled')) {
$template->param(
@ -423,6 +424,7 @@ for (my $i=0;$i<=@servers;$i++) {
$tag_quantity = C4::Context->preference('TagsShowOnList')) {
foreach (@newresults) {
my $bibnum = $_->{biblionumber} or next;
$_->{itemsissued} = CountItemsIssued( $bibnum );
$_ ->{'TagLoop'} = get_tags({biblionumber=>$bibnum, approved=>1, 'sort'=>'-weight',
limit=>$tag_quantity });
}