(bug #3825) improve waiting holds

[cherry-pick from 3.0.x]

This patch :
 * fix indentation
 * Separate waiting holds from holds over with tabs
 * Select only holds for librarian library

Signed-off-by: Galen Charlton <gmcharlt@gmail.com>
This commit is contained in:
Nahuel ANGELINETTI 2009-12-02 11:44:43 +01:00 committed by Galen Charlton
parent 9074faee25
commit 631a875de1
2 changed files with 96 additions and 34 deletions

View file

@ -91,10 +91,11 @@ if ($item) {
}
}
my @reservloop;
my @getreserves = C4::Context->preference('IndependantBranches') ? GetReservesForBranch($default) : GetReservesForBranch();
my (@reservloop, @overloop);
my ($reservcount, $overcount);
my @getreserves = $default ? GetReservesForBranch($default) : GetReservesForBranch();
# get reserves for the branch we are logged into, or for all branches
my $today = Date_to_Days(&Today);
foreach my $num (@getreserves) {
next unless ($num->{'waitingdate'} && $num->{'waitingdate'} ne '0000-00-00');
@ -106,21 +107,18 @@ foreach my $num (@getreserves) {
my $itemtypeinfo = getitemtypeinfo( $gettitle->{'itemtype'} ); # using the fixed up itype/itemtype
$getreserv{'waitingdate'} = format_date( $num->{'waitingdate'} );
my ( $waiting_year, $waiting_month, $waiting_day ) = split /-/, $num->{'waitingdate'};
my ( $waiting_year, $waiting_month, $waiting_day ) = split (/-/, $num->{'waitingdate'});
( $waiting_year, $waiting_month, $waiting_day ) =
Add_Delta_Days( $waiting_year, $waiting_month, $waiting_day,
C4::Context->preference('ReservesMaxPickUpDelay'));
my $calcDate = Date_to_Days( $waiting_year, $waiting_month, $waiting_day );
if ($today > $calcDate) {
$getreserv{'messcompa'} = 1;
}
$getreserv{'itemtype'} = $itemtypeinfo->{'description'};
$getreserv{'title'} = $gettitle->{'title'};
$getreserv{'itemnumber'} = $gettitle->{'itemnumber'};
$getreserv{'biblionumber'} = $gettitle->{'biblionumber'};
$getreserv{'barcode'} = $gettitle->{'barcode'};
$getreserv{'homebranch'} = $gettitle->{'homebranch'};
$getreserv{'homebranch'} = GetBranchName($gettitle->{'homebranch'});
$getreserv{'holdingbranch'} = $gettitle->{'holdingbranch'};
$getreserv{'itemcallnumber'} = $gettitle->{'itemcallnumber'};
if ( $gettitle->{'homebranch'} ne $gettitle->{'holdingbranch'} ) {
@ -133,11 +131,22 @@ foreach my $num (@getreserves) {
if ( $getborrower->{'emailaddress'} ) {
$getreserv{'borrowermail'} = $getborrower->{'emailaddress'};
}
push @reservloop, \%getreserv;
if ($today > $calcDate) {
push @overloop, \%getreserv;
$overcount++;
}else{
push @reservloop, \%getreserv;
$reservcount++;
}
}
$template->param(
reserveloop => \@reservloop,
reservecount => $reservcount,
overloop => \@overloop,
overcount => $overcount,
show_date => format_date(C4::Dates->today('iso')),
dateformat => C4::Context->preference("dateformat"),
);

View file

@ -10,15 +10,16 @@ $.tablesorter.addParser({
format: function(s) { return s.toLowerCase().replace(/^(the|an|a) /,''); },
type: 'text'
});
$(document).ready(function() {
$("th a").hide();
$.tablesorter.defaults.widgets = ['zebra'];
$("#holdst").tablesorter({<!-- TMPL_IF EXPR="dateformat eq 'metric'" -->
dateFormat: 'uk',<!-- /TMPL_IF -->
sortList: [[3,0]],
headers: { 1:{sorter:'articles'},3: { sorter: 'articles' },4:{sorter:false}}
});
});
$(document).ready(function() {
$('#resultlist > ul').tabs();
$("th a").hide();
$.tablesorter.defaults.widgets = ['zebra'];
$("#holdst").tablesorter({<!-- TMPL_IF EXPR="dateformat eq 'metric'" -->
dateFormat: 'uk',<!-- /TMPL_IF -->
sortList: [[3,0]],
headers: { 1:{sorter:'articles'},3: { sorter: 'articles' },4:{sorter:false}}
});
});
//]]>
</script>
</head>
@ -34,8 +35,8 @@ $.tablesorter.addParser({
<div id="doc" class="yui-t7">
<div id="bd">
<div id="yui-main">
<div class="yui-g">
<div id="yui-main">
<div class="yui-g">
<h2>Holds awaiting pickup for your library on: <!-- TMPL_VAR NAME="show_date" --></h2>
<!-- TMPL_IF NAME="messagetransfert" -->
@ -60,7 +61,12 @@ $.tablesorter.addParser({
</div>
<!-- /TMPL_IF -->
<!-- TMPL_UNLESS NAME="message" -->
<div id="resultlist">
<div id="resultlist" class="toptabs">
<ul>
<li><a href="/cgi-bin/koha/circ/waitingreserves.pl#holdswaiting"><!-- TMPL_VAR NAME="reservecount" --> Hold(s) waiting</a></li>
<li><a href="/cgi-bin/koha/circ/waitingreserves.pl#holdsover"><!-- TMPL_VAR NAME="overcount" --> Hold(s) over</a></li>
</ul>
<div id="holdswaiting">
<!-- TMPL_IF NAME="reserveloop" -->
<table id="holdst">
<thead><tr>
@ -71,21 +77,67 @@ $.tablesorter.addParser({
<th>Action</th>
</tr></thead>
<tbody><!-- TMPL_LOOP NAME="reserveloop" -->
<!-- TMPL_IF NAME="messcompa" --><tr class="problem"><!-- TMPL_ELSE --><tr><!-- /TMPL_IF -->
<td><p><!-- TMPL_VAR NAME="waitingdate" --></p>
<!-- TMPL_IF NAME="messcompa" -->Hold Over<!-- /TMPL_IF -->
<tr>
<td><p><!-- TMPL_VAR NAME="waitingdate" --></p></td>
<td>
<!-- TMPL_IF name="BiblioDefaultViewmarc" -->
<a href="/cgi-bin/koha/catalogue/MARCdetail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" ESCAPE="URL" -->">
<!-- TMPL_ELSIF NAME="BiblioDefaultViewisbd" -->
<a href="/cgi-bin/koha/catalogue/ISBDdetail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" ESCAPE="URL" -->">
<!-- TMPL_ELSE -->
<a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" ESCAPE="URL" -->">
<!-- /TMPL_IF -->
<!-- TMPL_VAR NAME="title" escape="html" --> <!-- TMPL_VAR NAME="subtitle" ESCAPE="html" -->
</a>
&nbsp; (<b><!-- TMPL_VAR NAME="itemtype" --></b>)
<br />Barcode: <!-- TMPL_VAR NAME="barcode" -->
</td>
<td>
<!-- TMPL_IF name="BiblioDefaultViewmarc" -->
<a href="/cgi-bin/koha/catalogue/MARCdetail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" ESCAPE="URL" -->">
<!-- TMPL_ELSIF NAME="BiblioDefaultViewisbd" -->
<a href="/cgi-bin/koha/catalogue/ISBDdetail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" ESCAPE="URL" -->">
<!-- TMPL_ELSE -->
<a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" ESCAPE="URL" -->">
<!-- /TMPL_IF -->
<!-- TMPL_VAR NAME="title" escape="html" --> <!-- TMPL_VAR NAME="subtitle" ESCAPE="html" -->
</a>
&nbsp; (<b><!-- TMPL_VAR NAME="itemtype" --></b>)
<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=<!--TMPL_VAR Name="borrowernum"-->"><!-- TMPL_VAR NAME="borrowername" -->, <!-- TMPL_VAR NAME="borrowerfirstname" --></a><br /><!-- TMPL_VAR NAME="borrowerphone" --><br />
<!-- TMPL_IF NAME="borrowermail" --><a href="mailto:<!-- TMPL_VAR NAME="email" -->?subject=Reservation: <!-- TMPL_VAR NAME="title" -->">
<!-- TMPL_VAR NAME="borrowermail" --></a><!--/TMPL_IF-->
</td>
<td><!-- TMPL_VAR NAME="homebranch" --><br /><!-- TMPL_VAR NAME="itemcallnumber" --></td>
<td>
<form name="cancelReserve" action="waitingreserves.pl" method="post">
<input type="hidden" name="borrowernumber" value="<!-- TMPL_VAR NAME="borrowernum" -->" />
<input type="hidden" name="itemnumber" value="<!-- TMPL_VAR NAME="itemnumber" -->" />
<input type="hidden" name="fbr" value="<!-- TMPL_VAR NAME="holdingbranch" -->" />
<input type="hidden" name="tbr" value="<!-- TMPL_VAR NAME="homebranch" -->" />
<!-- TMPL_IF NAME="dotransfer" -->
<input type="submit" value="Cancel hold and return to : <!-- TMPL_VAR NAME="homebranch" -->" />
<!-- TMPL_ELSE -->
<input type="submit" value="Cancel hold" />
<!-- /TMPL_IF -->
</form>
</td>
</tr>
<!-- /TMPL_LOOP --></tbody>
</table>
</div>
<div id="holdsover">
<table id="holdso">
<thead><tr>
<th>Available since</th>
<th>Title</th>
<th>Patron</th>
<th>Location</th>
<th>Action</th>
</tr></thead>
<tbody><!-- TMPL_LOOP NAME="overloop" -->
<tr>
<td><p><!-- TMPL_VAR NAME="waitingdate" --></p></td>
<td>
<!-- TMPL_IF name="BiblioDefaultViewmarc" -->
<a href="/cgi-bin/koha/catalogue/MARCdetail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" ESCAPE="URL" -->">
<!-- TMPL_ELSIF NAME="BiblioDefaultViewisbd" -->
<a href="/cgi-bin/koha/catalogue/ISBDdetail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" ESCAPE="URL" -->">
<!-- TMPL_ELSE -->
<a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" ESCAPE="URL" -->">
<!-- /TMPL_IF -->
<!-- TMPL_VAR NAME="title" escape="html" --> <!-- TMPL_VAR NAME="subtitle" ESCAPE="html" -->
</a>
&nbsp; (<b><!-- TMPL_VAR NAME="itemtype" --></b>)
<br />Barcode: <!-- TMPL_VAR NAME="barcode" -->
</td>
<td>
@ -110,6 +162,7 @@ $.tablesorter.addParser({
</tr>
<!-- /TMPL_LOOP --></tbody>
</table>
</div>
<!-- TMPL_ELSE -->
<div class="dialog message">No holds found.</div>
<!-- /TMPL_IF -->