Summary: | Serial add is confused by authorized values with a code of '0' | ||
---|---|---|---|
Product: | Koha | Reporter: | Didier Gautheron <didier.gautheron> |
Component: | Serials | Assignee: | Didier Gautheron <didier.gautheron> |
Status: | Failed QA --- | QA Contact: | Testopia <testopia> |
Severity: | trivial | ||
Priority: | P5 - low | CC: | black23, david, jonathan.druart, magnus, martin.renvoize |
Version: | Main | ||
Hardware: | All | ||
OS: | All | ||
Change sponsored?: | --- | Patch complexity: | Trivial patch |
Documentation contact: | Documentation submission: | ||
Text to go in the release notes: | Version(s) released in: | ||
Bug Depends on: | 8976 | ||
Bug Blocks: | |||
Attachments: |
Bug 27684: Serial 0 is valid default value.
Bug 27684: Serial 0 is valid default value. |
Description
Didier Gautheron
2021-02-11 14:52:02 UTC
Can you provide a patch? Created attachment 124169 [details] [review] Bug 27684: Serial 0 is valid default value. To test: 1- Create a NOT_LOAN VA: code = 0 lib = available 2- Add a serial with one item 3- Check that in items modification 952$7 is on 'available' 4- Receive this serial. 5- Add item 6- check that not for loan is empty 6- Apply patch 7- redo 4,5 8- check that not for loan is on 'available' Does it make sense to leave in the unless.. can you explain? (In reply to Martin Renvoize from comment #3) > Does it make sense to leave in the unless.. can you explain? No it doesn't. Regards Didier Created attachment 127221 [details] [review] Bug 27684: Serial 0 is valid default value. To test: 1- Create a NOT_LOAN VA: code = 0 lib = available 2- Add a serial with one item 3- Check that in items modification 952$7 is on 'available' 4- Receive this serial. 5- Add item 6- check that not for loan is empty 6- Apply patch 7- redo 4,5 8- check that not for loan is on 'available' You need a test and certainly to modify this other place: Koha/UI/Form/Builder/Item.pm 122 $value = $subfield->{defaultvalue}; Changed status to failed QA - see comment #6. (In reply to Jonathan Druart from comment #6) > You need a test and certainly to modify this other place: > > Koha/UI/Form/Builder/Item.pm > 122 $value = $subfield->{defaultvalue}; No, in my understanding it's already done there : if ( $prefill_with_default_values && ( !defined($value) || $value eq '' ) ) { $value = $subfield->{defaultvalue} if !$item->{itemnumber}; # apply defaultvalue only to new items it's only set $value if it's undefined or an empty string. Unlike 0 empty string for a VA code is an issue in a lot of place. I'm not that familiar with serials, so could you clarify steps 1-6 in a bit more detail? I've: 1. Added an authorized value for NOT_LOAN: . Authorized value = 0 . Description = Available . Library limitations = All libraries 2. Created a serial, set so that it creates an item record when received. 3. Received an edition: 952$7 has no value selected by default and I set it to Available (using the authorized value setup in step 1). 4. After applying the patch and receiving another edition, the default still has no value selected by default. Am I supposed to manually create an item when I first set up the serial? (Do subsequent editions received inherit the values set up for this first item?) I think this is about the different behaviour of the add item form (cataloguing) vs. the add item form (serials). If I read the test plan right, they should preselect the 0 value in both when you open the forms. Sounds to me like this is "Failed QA" until the questions in Comment 9 have been answered. |