Null statcats break copy templates

Bug #1788680 reported by Jeff Davis on 2018-08-23
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Evergreen
Undecided
Unassigned
3.1
Undecided
Unassigned

Bug Description

EG 3.0+

In the web client, copy templates do not apply properly when the template has null statcat values but a non-null statcat_filter value. For example, a copy template like the following will not work:

"Adult fiction":{"mint_condition":"t","statcats":{"223":null},"circ_lib":10,"ref":"f","circ_modifier":"book","loan_duration":2,"location":586,"holdable":"t","opac_visible":"t","circulate":"t","statcat_filter":10}

This issue was originally reported in bug 1772062 and a fix was provided:

http://git.evergreen-ils.org/?p=working/Evergreen.git;a=shortlog;h=refs/heads/user/jeffdavis/lp1772062-copy-templates-null-stat-cats

Since this is only a partial fix (the original bug has several other possible causes), we are breaking it out into a separate bug report.

tags: added: pullrequest
Changed in evergreen:
milestone: none → 3.1.5
Jeff Davis (jdavis-sitka) wrote :

Testing the fix is a little cumbersome. Here's a contrived example; adjust as needed for your environment, or try it with an existing copy template that has null statcat values but a non-null statcat_filter value.

1. Create a copy stat cat at BR1:

INSERT INTO asset.stat_cat (id, owner, name) VALUES (1, 4, 'test stat cat');

2. Create a copy template for your test user with a non-null statcat_filter value and some null values for statcats, referencing the stat cat you just created:

INSERT INTO actor.usr_setting (usr, name, value) VALUES (1, 'webstaff.cat.copy.templates', '{"Science fiction":{"mint_condition":"t","statcats":{"1":null},"circ_lib":4,"ref":"f","circ_modifier":null,"loan_duration":2,"location":123,"holdable":"t","opac_visible":"t","circulate":"t","statcat_filter":4}}');

3. Login to the web client as your test user at BR1.

4. Go to the copy editor, select your copy template and click Apply. You'll see a console error and the copy attributes (shelving location, etc) are not correctly populated from your template.

5. Apply the bugfix.

6. Clear cache (and possibly local storage?) and repeat step #4. This time, clicking Apply should set your copy attributes correctly based on your template.

Changed in evergreen:
milestone: 3.1.5 → 3.1.6
Changed in evergreen:
milestone: 3.1.6 → 3.2.1
Changed in evergreen:
milestone: 3.2.1 → 3.2.2
Changed in evergreen:
milestone: 3.2.2 → 3.2.3
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers