default classification scheme OU setting not retrieved properly

Bug #825303 reported by Galen Charlton
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Evergreen
Status tracked in Main
2.0
Fix Released
Undecided
Unassigned
2.1
Fix Released
Undecided
Unassigned
2.2
Invalid
Undecided
Unassigned
Main
Fix Released
Medium
Unassigned

Bug Description

When inserting a new volume, if the label class is not supplied, the asset.label_normalizer() trigger function gets the default value from the cat.default_classification_scheme OU setting. However, this lookup does not check ancestors of the volume owning library, meaning that the wrong value could be chosen if the OU setting is not set for that particular OU.

Evergreen: master

Tags: pullrequest
Galen Charlton (gmc)
description: updated
Revision history for this message
Galen Charlton (gmc) wrote :

Patch available in the working/Evergreen.git repository at the tip of the branch user/gmcharlt/lp825303_fix_default_class_lookup

Test plan:

[1] Set the cat.default_classification OU to Dewey (i.e., value = 2) at the root OU and make sure that the setting is not set for any child OU.
[2] Insert an asset.call_number row that doesn't specify the label class explicitly, e.g.,

insert into asset.call_number(creator, editor, record, label, owning_lib) values (1,1, 1234, 'ABC', 3);

[3] Examine the label_class value of the new acn row. Without the patch, it should be 1. After the patch is applied, it should be 2.

tags: added: pullrequest
Changed in evergreen:
milestone: none → 2.1-rc2
Revision history for this message
Dan Scott (denials) wrote :

Applied this patch to our production 2.0 system, it seems to work nicely. Candidate for backport to 2.0?

Revision history for this message
Galen Charlton (gmc) wrote :

I see no reason not to backport to 2.0.

Revision history for this message
Dan Scott (denials) wrote :

Well, nicely except that it was throwing an error because actor.org_unit_setting_ancestor() was returning more than one row in a context that can only accept one row, thereby preventing any new call numbers from being added.

Bandaid fix was to add a LIMIT 1 clause to the asset.label_normalizer() function:

    IF NEW.label_class IS NULL THEN
            NEW.label_class := COALESCE(
            (
                SELECT substring(value from E'\\d+')::integer
                FROM actor.org_unit_ancestor_setting('cat.default_classification_scheme', NEW.owning_lib)
                LIMIT 1
            ), 1
        );
    END IF;

but there may be deeper issues with actor.org_unit_setting_ancestor() that need to be handled.

Revision history for this message
Galen Charlton (gmc) wrote :

I've pushed an additional patch to user/gmcharlt/lp825303_fix_default_class_lookup that corrects the return semantics of actor.org_unit_setting_ancestor().

Revision history for this message
Mike Rylander (mrylander) wrote :

Pushed into master and 2.1, thanks Dan and Galen!

Revision history for this message
Mike Rylander (mrylander) wrote :

And, 2.0 as well.

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.