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

View file

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