Bug 27512 - Block creation of invalid authorised values for LOST, NOTFORLOAN, DAMAGED, RESTRICTED, and WITHDRAWN
Summary: Block creation of invalid authorised values for LOST, NOTFORLOAN, DAMAGED, RE...
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: System Administration (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-01-21 16:40 UTC by Andrew Fuerste-Henry
Modified: 2024-02-22 20:05 UTC (History)
5 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Fuerste-Henry 2021-01-21 16:40:58 UTC
Several authorised value categories have inherent limits on what values can be used. Bug 24288 adds text to the screen to tell you about these limits, but doesn't enforce them. It'd be good to just stop a user from saving a value that won't work.
Comment 1 Barbara Johnson 2021-01-21 16:55:12 UTC
+1
Comment 2 Marcel de Rooy 2022-09-15 09:09:17 UTC
(In reply to Andrew Fuerste-Henry from comment #0)
> Several authorised value categories have inherent limits on what values can
> be used. Bug 24288 adds text to the screen to tell you about these limits,
> but doesn't enforce them. It'd be good to just stop a user from saving a
> value that won't work.

It might be good to give specific cases here. On which form are you able to save values outside the range of an AV category?
Comment 3 Katrin Fischer 2022-09-15 11:36:39 UTC
You can create the authorised values without issue, but you cannot use them in items. items.damaged linked to DAMAGED only takes numerical AV codes. (datatype)
Comment 4 Andrew Fuerste-Henry 2022-09-15 13:43:59 UTC
(In reply to Katrin Fischer from comment #3)
> You can create the authorised values without issue, but you cannot use them
> in items. items.damaged linked to DAMAGED only takes numerical AV codes.
> (datatype)

Correct. I can create an authorized value in the DAMAGED category that has the value "TORN". Koha allows the creation of that authorized value, and then will show TORN as an option when editing items. However, it will never actually save TORN on an item and will never explain why it's failed to do so. The answer to that lies over in the schema, which tells us items.damaged only holds a bit.
Comment 5 Marcel de Rooy 2022-09-15 14:07:43 UTC
(In reply to Andrew Fuerste-Henry from comment #4)
> (In reply to Katrin Fischer from comment #3)
> > You can create the authorised values without issue, but you cannot use them
> > in items. items.damaged linked to DAMAGED only takes numerical AV codes.
> > (datatype)
> 
> Correct. I can create an authorized value in the DAMAGED category that has
> the value "TORN". Koha allows the creation of that authorized value, and
> then will show TORN as an option when editing items. However, it will never
> actually save TORN on an item and will never explain why it's failed to do
> so. The answer to that lies over in the schema, which tells us items.damaged
> only holds a bit.

Okay. How to proceed?
We could move damaged to varchar() as expected by Authorised Values?
Or we could intercept this in storing the item?
Or even before building the combo, but that could be quite generic code, so a bit harder? Or when loading the form in javascript (hide options with a non-numeric value)?
Another idea?
Comment 6 Katrin Fischer 2022-09-16 07:19:07 UTC
The code for NOT_LOAN checks for < > etc. and I think we do this for those other values too. So maybe it makes more sense to keep them numeric and make the differences clear in the GUI
Comment 7 Andrew Fuerste-Henry 2022-09-16 13:45:59 UTC
(In reply to Katrin Fischer from comment #6)
> The code for NOT_LOAN checks for < > etc. and I think we do this for those
> other values too. So maybe it makes more sense to keep them numeric and make
> the differences clear in the GUI

Agreed.