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

(-)a/C4/Reserves.pm (-5 / +4 lines)
Lines 166-172 sub AddReserve { Link Here
166
    }
166
    }
167
    if ( C4::Context->preference( 'AllowHoldDateInFuture' ) ) {
167
    if ( C4::Context->preference( 'AllowHoldDateInFuture' ) ) {
168
	# Make room in reserves for this before those of a later reserve date
168
	# Make room in reserves for this before those of a later reserve date
169
	$priority = _ShiftPriorityByDateAndPriority( $biblionumber, $resdate, $priority );
169
	$priority = _ShiftPriorityByDateAndPriority( $biblionumber, $priority );
170
    }
170
    }
171
    my $waitingdate;
171
    my $waitingdate;
172
172
Lines 2034-2045 the sub accounts for that too. Link Here
2034
=cut
2034
=cut
2035
2035
2036
sub _ShiftPriorityByDateAndPriority {
2036
sub _ShiftPriorityByDateAndPriority {
2037
    my ( $biblio, $resdate, $new_priority ) = @_;
2037
    my ( $biblio, $new_priority ) = @_;
2038
2038
2039
    my $dbh = C4::Context->dbh;
2039
    my $dbh = C4::Context->dbh;
2040
    my $query = "SELECT priority FROM reserves WHERE biblionumber = ? AND ( reservedate > ? OR priority > ? ) ORDER BY priority ASC LIMIT 1";
2040
    my $query = "SELECT priority FROM reserves WHERE biblionumber = ? AND priority > ? ORDER BY priority ASC LIMIT 1";
2041
    my $sth = $dbh->prepare( $query );
2041
    my $sth = $dbh->prepare( $query );
2042
    $sth->execute( $biblio, $resdate, $new_priority );
2042
    $sth->execute( $biblio, $new_priority );
2043
    my $min_priority = $sth->fetchrow;
2043
    my $min_priority = $sth->fetchrow;
2044
    # if no such matches are found, $new_priority remains as original value
2044
    # if no such matches are found, $new_priority remains as original value
2045
    $new_priority = $min_priority if ( $min_priority );
2045
    $new_priority = $min_priority if ( $min_priority );
2046
- 

Return to bug 12630