[Koha-bugs] [Bug 22005] System preference DecreaseLoanHighHolds incorrectly counts the number of holds

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Fri Apr 3 15:37:38 CEST 2020


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22005

--- Comment #4 from Magnus Enger <magnus at libriotech.no> ---
I really don't understand the logic of the CheckHighHolds sub:

sub checkHighHolds {
    my ( $item, $borrower ) = @_;
...
    if ( $holds->count() ) {
...
        if ( $decreaseLoanHighHoldsControl eq 'static' ) {
...
            # If the number of holds is less than the threshold, we can stop
here
            if ( $holds->count() < $decreaseLoanHighHoldsValue ) {
                return $return_data;
            }
        }
        elsif ( $decreaseLoanHighHoldsControl eq 'dynamic' ) {
...
            # If the number of holds is less than the count of items we have
            # plus the number of holds allowed above that count, we can stop
here
            if ( $holds->count() <= $threshold ) {
                return $return_data;
            }
        }
...
        if ( DateTime->compare( $reduced_datedue, $orig_due ) == -1 ) {
            $return_data->{exceeded} = 1;
            $return_data->{duration} = $decreaseLoanHighHoldsDuration;
            $return_data->{due_date} = $reduced_datedue;
        }
    }

    return $return_data;
}

As far as I can tell, it does the right thing for decreaseLoanHighHoldsControl
= static/dynamic, but then it goes and calculates the regular/original due date
and the decreased due date, and if the decreased date is less than the original
date, then the decreased date is returned? Why is this done?

-- 
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.


More information about the Koha-bugs mailing list