web client: copy templates created on XUL - Stat Cats that were unset

Bug #1861732 reported by Josh Stompro on 2020-02-03
This bug affects 1 person
Affects Status Importance Assigned to Milestone

Bug Description

EG 3.3.4

We noticed when trying to move our cataloging staff to the web client that XUL copy templates that contain a value of -1 for a stat cat (to unset/clear that entry when the template is applied) are copied over to the new template format as a value of -1.

But when trying to apply such a copy template, it isn't possible to save changes because the -1 value gets sent as the actual value to save in the database, and causes a database error because that isn't a valid option.

I think that in the Xul client, the -1 was treated as a special value, that told the interface to unset that stat cat and clear it.

So for ease of migration, it would be nice if the conversion function cleared out those entries, so that copies with those templates applied will be savable. Or it would be nice if the function that applies the template would treat a -1 as an unset/clear operation.

The conversion work was done in bug #1691269.

My question to the catalogers list about this issue:


tags: added: cataloging webstaffclient

Here is a branch that treats stat cat values of -1 just like null and blank lines. In my testing this allows the stat cats that were saved with an unset value in the XUL client to work correctly once converted to the webstaff client copy templates.

Branch at: lp1861732_copy_template_unset_statcat_values


Commit message:

LP#1861732 - Allow copy template stat cat unset value (-1)

Xul copy templates allowed the user to save an unset value for a stat_cat,
which was stored as -1 in the xul copy template. When those values are migrated
to the webstaff client copy templates, the -1 value is preserved. But that value
is passed directly to the database when saving a record, and -1 isn't a valid

This change treats -1 the same as null or a blank line when applying the template, which
allows the template to unset a stat cat value like before in the XUL client.

Testing Notes:

1. Create some copy stat cats if they don't exist.
2. Clear out actor.usr_settings for the testing user, mainly the webstaff copy template key
  of 'webstaff.cat.copy.templates'.
3. In XUL client, create a copy template that includes setting a stat cat to the "<Remove Stat Cat>"
4. In the webstaff client, edit an item and try to apply the migrated copy template.

Before fix - you won't be able to save the copy after applying the template, it will
just silently fail. If you check the postgres logs you will see an error about trying
to set the stat cat value to -1.

After fix - You will be able to save the copy after applying the template, and if a value
for that stat cat was already set, it will be unset by the template.


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

Other bug subscribers