[Bug 27684] New: serial add is confused by authorized values with a code of '0'
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27684 Bug ID: 27684 Summary: serial add is confused by authorized values with a code of '0' Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: trivial Priority: P5 - low Component: Serials Assignee: didier.gautheron@biblibre.com Reporter: didier.gautheron@biblibre.com QA Contact: testopia@bugs.koha-community.org It doesn't make difference between undefined and zero and it uses default value. To test: diff --git a/C4/Items.pm b/C4/Items.pm index 5d0495b8..01f81bdf 100644 --- a/C4/Items.pm +++ b/C4/Items.pm @@ -2390,7 +2390,7 @@ sub PrepareItemrecordDisplay { if ($itemrecord) { ( $x, $defaultvalue ) = _find_value( $tag, $subfield, $itemrecord ); } - $defaultvalue = $tagslib->{$tag}->{$subfield}->{defaultvalue} unless $defaultvalue; + $defaultvalue //= $tagslib->{$tag}->{$subfield}->{defaultvalue}; if ( !defined $defaultvalue ) { $defaultvalue = q||; } else { -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27684 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jonathan.druart@bugs.koha-c | |ommunity.org --- Comment #1 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Can you provide a patch? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27684 Didier Gautheron <didier.gautheron@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |8976 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8976 [Bug 8976] Default sequence of subfields in cataloguing and item editor -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27684 Michal Denar <black23@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |black23@gmail.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27684 Didier Gautheron <didier.gautheron@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch complexity|--- |Trivial patch Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27684 --- Comment #2 from Didier Gautheron <didier.gautheron@biblibre.com> --- Created attachment 124169 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=124169&action=edit 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 are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27684 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|serial add is confused by |Serial add is confused by |authorized values with a |authorized values with a |code of '0' |code of '0' -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27684 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |martin.renvoize@ptfs-europe | |.com --- Comment #3 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Does it make sense to leave in the unless.. can you explain? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27684 --- Comment #4 from Didier Gautheron <didier.gautheron@biblibre.com> --- (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 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27684 Didier Gautheron <didier.gautheron@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #124169|0 |1 is obsolete| | --- Comment #5 from Didier Gautheron <didier.gautheron@biblibre.com> --- Created attachment 127221 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=127221&action=edit 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 are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27684 --- Comment #6 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- You need a test and certainly to modify this other place: Koha/UI/Form/Builder/Item.pm 122 $value = $subfield->{defaultvalue}; -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27684 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Failed QA CC| |david@davidnind.com --- Comment #7 from David Nind <david@davidnind.com> --- Changed status to failed QA - see comment #6. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27684 --- Comment #8 from Didier Gautheron <didier.gautheron@biblibre.com> --- (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. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27684 Jonathan Druart <jonathan.druart+koha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Failed QA |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27684 --- Comment #9 from David Nind <david@davidnind.com> --- 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?) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27684 --- Comment #10 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- 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. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27684 Magnus Enger <magnus@libriotech.no> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Failed QA CC| |magnus@libriotech.no --- Comment #11 from Magnus Enger <magnus@libriotech.no> --- Sounds to me like this is "Failed QA" until the questions in Comment 9 have been answered. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27684 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |fridolin.somers@biblibre.co | |m --- Comment #12 from Fridolin Somers <fridolin.somers@biblibre.com> --- Arg C4::Items::PrepareItemrecordDisplay has no unit test :( -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org