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

(-)a/C4/Reserves.pm (-9 / +6 lines)
Lines 224-234 sub AddReserve { Link Here
224
            $found = 'W';
224
            $found = 'W';
225
        }
225
        }
226
    }
226
    }
227
227
    if ( C4::Context->preference( 'AllowHoldDateInFuture' ) ) {
228
    if ( C4::Context->preference('AllowHoldDateInFuture') ) {
228
	# Make room in reserves for this before those of a later reserve date
229
229
	$priority = _ShiftPriorityByDateAndPriority( $biblionumber, $priority );
230
        # Make room in reserves for this before those of a later reserve date
231
        $priority = _ShiftPriorityByDateAndPriority( $biblionumber, $resdate, $priority );
232
    }
230
    }
233
231
234
    my $waitingdate;
232
    my $waitingdate;
Lines 1962-1973 the sub accounts for that too. Link Here
1962
=cut
1960
=cut
1963
1961
1964
sub _ShiftPriorityByDateAndPriority {
1962
sub _ShiftPriorityByDateAndPriority {
1965
    my ( $biblio, $resdate, $new_priority ) = @_;
1963
    my ( $biblio, $new_priority ) = @_;
1966
1964
1967
    my $dbh = C4::Context->dbh;
1965
    my $dbh = C4::Context->dbh;
1968
    my $query = "SELECT priority FROM reserves WHERE biblionumber = ? AND ( reservedate > ? OR priority > ? ) ORDER BY priority ASC LIMIT 1";
1966
    my $query = "SELECT priority FROM reserves WHERE biblionumber = ? AND priority > ? ORDER BY priority ASC LIMIT 1";
1969
    my $sth = $dbh->prepare( $query );
1967
    my $sth = $dbh->prepare( $query );
1970
    $sth->execute( $biblio, $resdate, $new_priority );
1968
    $sth->execute( $biblio, $new_priority );
1971
    my $min_priority = $sth->fetchrow;
1969
    my $min_priority = $sth->fetchrow;
1972
    # if no such matches are found, $new_priority remains as original value
1970
    # if no such matches are found, $new_priority remains as original value
1973
    $new_priority = $min_priority if ( $min_priority );
1971
    $new_priority = $min_priority if ( $min_priority );
1974
- 

Return to bug 12630