selection depth sometimes not properly calculated for holds

Bug #2028015 reported by Galen Charlton
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Evergreen
New
Undecided
Unassigned

Bug Description

Consider a title-level hold request created open-ils.circ.holds.test_and_create.batch where the desired selection depth is not provided.

Depending on various permutations of boundary settings, the depth returned by the possibility check (ultimately open-ils.circ.title_hold.is_possible) may be 0.

That in turn can get passed into the logic that later creates the action.hold_request row via lines like this:

  $params->{'depth'} = $res->{'depth'} if $res->{'depth'};

However, there's a problem here: if $res->{'depth'} is 0, $params->{'depth'} is unchanged. If that key is missing, or contains an undef value, the selection_depth gets set to null.

Normally, ahr.selection_depth has a default value applied at the database layer in that case. In a stock system, that value is 0, but I've run across at least one system where that value was instead changed to 1.

IOW, depth = undef/NULL is not equivalent to depth = 0. $res->{'depth'} should be tested for existence and having a defined value, not just Perl truthiness.

Evergreen main

Tags: circ-holds
Revision history for this message
Galen Charlton (gmc) wrote :

(I grant that this is a pretty obscure bug.)

tags: added: circ-holds
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.