Bug 8918: (follow-up) tidy code and description of CalculatePriority()
This patch improves the formatting and the description of the new CalculatePriority() routine. Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This commit is contained in:
parent
5f8bef581d
commit
e51b441781
1 changed files with 22 additions and 13 deletions
|
@ -2253,9 +2253,15 @@ sub GetReservesControlBranch {
|
|||
|
||||
my $p = CalculatePriority($biblionumber, $resdate);
|
||||
|
||||
Calculate priority for a new reserve on biblionumber.
|
||||
The reserve date parameter is optional. Plays a role if the preference
|
||||
AllowHoldDateInFuture is set.
|
||||
Calculate priority for a new reserve on biblionumber, placing it at
|
||||
the end of the line of all holds whose start date falls before
|
||||
the current system time and that are neither on the hold shelf
|
||||
or in transit.
|
||||
|
||||
The reserve date parameter is optional; if it is supplied, the
|
||||
priority is based on the set of holds whose start date falls before
|
||||
the parameter value.
|
||||
|
||||
After calculation of this priority, it is recommended to call
|
||||
_ShiftPriorityByDateAndPriority. Note that this is currently done in
|
||||
AddReserves.
|
||||
|
@ -2265,10 +2271,11 @@ AddReserves.
|
|||
sub CalculatePriority {
|
||||
my ( $biblionumber, $resdate ) = @_;
|
||||
|
||||
my $sql = qq{
|
||||
my $sql = q{
|
||||
SELECT COUNT(*) FROM reserves
|
||||
WHERE biblionumber=? AND priority>0 AND
|
||||
(found IS NULL or found='')
|
||||
WHERE biblionumber = ?
|
||||
AND priority > 0
|
||||
AND (found IS NULL OR found = '')
|
||||
};
|
||||
#skip found==W or found==T (waiting or transit holds)
|
||||
if( $resdate ) {
|
||||
|
@ -2278,11 +2285,13 @@ sub CalculatePriority {
|
|||
$sql.= ' AND ( reservedate < NOW() )';
|
||||
}
|
||||
my $dbh = C4::Context->dbh();
|
||||
my @row= $dbh->selectrow_array( $sql, undef, $resdate?
|
||||
($biblionumber, $resdate): ($biblionumber) );
|
||||
my @row = $dbh->selectrow_array(
|
||||
$sql,
|
||||
undef,
|
||||
$resdate ? ($biblionumber, $resdate) : ($biblionumber)
|
||||
);
|
||||
|
||||
return @row ? $row[0]+1 : 1;
|
||||
#if @row does not contain anything, something went wrong..
|
||||
}
|
||||
|
||||
=head1 AUTHOR
|
||||
|
|
Loading…
Reference in a new issue