check constraint valid_fine_check in asset.copy_template DDL statement defined incorrectly at line 497 of 040.schema.asset.sql
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Evergreen |
Confirmed
|
Medium
|
Unassigned |
Bug Description
It appears that the DDL (CREATE TABLE) statement wrongly points to loan_duration, rather than to fine_level when it checks for valid values 1, 2, or 3 in the "valid_fine_level" check constraint at line 497 of 040.schema.
I do not know how this may affect functionality in Evergreen (if it does at all) since it was detected directly in the Evergreen source code (current version 2.6 and as early as 2.4--maybe earlier as well) and since it (in part) repeats the CHECK constraint for loan_duration values, but if confirmed as a bug, it should just be corrected.
At the database level (at least), the worst that could happen is that this CHECK constraint would allow any INT value assigned to fine_level column when creating/editing asset.copy_template records. I have not confirmed this behavior.
A simple fix (see the attached patch file) would be to replace line 497:
with this line:
In that recommended change, I did not alter the accepted values part. I based the accepted values for fine_level on that column's CHECK constraint defined in the asset.copy CREATE TABLE statement in the same file (line 83), as that seemed to make sense. Hope this helps!
Changed in evergreen: | |
assignee: | nobody → Jason Etheridge (phasefx) |
Changed in evergreen: | |
assignee: | Jason Etheridge (phasefx) → nobody |
tags: |
added: itemtemplates removed: copytemplates |
tags: |
added: cat-templates removed: itemtemplates |
Hi Tim,
Interesting catch! I can totally see this being something nice to have fixed in a future release for clarity.
If you can provide us with some more information on your contribution, specifically a DCO -- your name, organization, email for contribution purposes, that'd be helpful! (http:// wiki.evergreen- ils.org/ doku.php? id=contributing #developer_ s_certificate_ of_origin)
Thanks!