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 1975-1986 the sub accounts for that too. Link Here
1975
=cut
1975
=cut
1976
1976
1977
sub _ShiftPriorityByDateAndPriority {
1977
sub _ShiftPriorityByDateAndPriority {
1978
    my ( $biblio, $resdate, $new_priority ) = @_;
1978
    my ( $biblio, $new_priority ) = @_;
1979
1979
1980
    my $dbh = C4::Context->dbh;
1980
    my $dbh = C4::Context->dbh;
1981
    my $query = "SELECT priority FROM reserves WHERE biblionumber = ? AND ( reservedate > ? OR priority > ? ) ORDER BY priority ASC LIMIT 1";
1981
    my $query = "SELECT priority FROM reserves WHERE biblionumber = ? AND priority > ? ORDER BY priority ASC LIMIT 1";
1982
    my $sth = $dbh->prepare( $query );
1982
    my $sth = $dbh->prepare( $query );
1983
    $sth->execute( $biblio, $resdate, $new_priority );
1983
    $sth->execute( $biblio, $new_priority );
1984
    my $min_priority = $sth->fetchrow;
1984
    my $min_priority = $sth->fetchrow;
1985
    # if no such matches are found, $new_priority remains as original value
1985
    # if no such matches are found, $new_priority remains as original value
1986
    $new_priority = $min_priority if ( $min_priority );
1986
    $new_priority = $min_priority if ( $min_priority );
1987
- 

Return to bug 12630