View | Details | Raw Unified | Return to bug 12630
Collapse All | Expand All

(-)a/C4/Reserves.pm (-5 / +4 lines)
Lines 163-169 sub AddReserve { Link Here
163
    }
163
    }
164
    if ( C4::Context->preference( 'AllowHoldDateInFuture' ) ) {
164
    if ( C4::Context->preference( 'AllowHoldDateInFuture' ) ) {
165
	# Make room in reserves for this before those of a later reserve date
165
	# Make room in reserves for this before those of a later reserve date
166
	$priority = _ShiftPriorityByDateAndPriority( $biblionumber, $resdate, $priority );
166
	$priority = _ShiftPriorityByDateAndPriority( $biblionumber, $priority );
167
    }
167
    }
168
    my $waitingdate;
168
    my $waitingdate;
169
169
Lines 1982-1993 the sub accounts for that too. Link Here
1982
=cut
1982
=cut
1983
1983
1984
sub _ShiftPriorityByDateAndPriority {
1984
sub _ShiftPriorityByDateAndPriority {
1985
    my ( $biblio, $resdate, $new_priority ) = @_;
1985
    my ( $biblio, $new_priority ) = @_;
1986
1986
1987
    my $dbh = C4::Context->dbh;
1987
    my $dbh = C4::Context->dbh;
1988
    my $query = "SELECT priority FROM reserves WHERE biblionumber = ? AND ( reservedate > ? OR priority > ? ) ORDER BY priority ASC LIMIT 1";
1988
    my $query = "SELECT priority FROM reserves WHERE biblionumber = ? AND priority > ? ORDER BY priority ASC LIMIT 1";
1989
    my $sth = $dbh->prepare( $query );
1989
    my $sth = $dbh->prepare( $query );
1990
    $sth->execute( $biblio, $resdate, $new_priority );
1990
    $sth->execute( $biblio, $new_priority );
1991
    my $min_priority = $sth->fetchrow;
1991
    my $min_priority = $sth->fetchrow;
1992
    # if no such matches are found, $new_priority remains as original value
1992
    # if no such matches are found, $new_priority remains as original value
1993
    $new_priority = $min_priority if ( $min_priority );
1993
    $new_priority = $min_priority if ( $min_priority );
1994
- 

Return to bug 12630