Description
Fridolin Somers
2013-07-05 13:19:24 UTC
Created attachment 19412 [details] [review] Proposed patch See commit message. Very tricky bug :) Could you please provide a test plan for this patch? Kyle the test plan is on the patch (in the commit message as it should be) Test plan from patch: Test plan : - In a framework, make sure you have in item field : An optionnal subfield (without authorised value) then a mandatory subfield then an optional subfield next to mandatory subfield For example : $i (optional), $r (mandatory) and $s (optional) - Open a biblio record and create a new item - Enter more than 100 characters in $i, fill $r and $s - Click "Add item" - Edit this item => You get a textarea for $i - Empty $s and Save => Without patch, you get a warning and form is not saved and you see that $s is yellow while it should be $r => With patch, form is saved - Re-edit this item - Empty $r and save => You get a warning and form is not saved Maybe we should consider putting that function in a separate js while we are at it? Having it tripled does not feel right. > Maybe we should consider putting that function in a separate js while we are at it? Having it tripled does not feel right.
It is only double and it is quite short. In acquisition there is a template condition : [% IF (AcqCreateItemReceiving) %]
(In reply to Fridolyn SOMERS from comment #6) > > Maybe we should consider putting that function in a separate js while we are at it? Having it tripled does not feel right. > It is only double and it is quite short. In acquisition there is a template > condition : [% IF (AcqCreateItemReceiving) %] No, there are three: serials-edit.tt includes a version of that same check; the serials receiving form should be checked to see whether the same bug applies there as well. Created attachment 19572 [details] [review] Bug 10543 - false mandatory warning in additem Revised patch using a JS method in cataloging.js Created attachment 19574 [details] [review] Bug 10543 - Unify item mandatory subfields check Followup 1 : Use of CheckMandatorySubfields method in other item forms than additem.tt : - acqui/neworderempty.tt : was an old-fashioned code - acqui/orderreceive.tt : was the same code as additem.tt - serials/serials-edit.tt : was a code similar to CheckMandatorySubfields but yet slower because each() function loops on every subfield, not only mandatories. Also did not add "missing" class. Note that check is only performed on visible item forms. Created attachment 19576 [details] [review] Bug 10543 - add mandatory subfield check to addorderiso2709.pl addorderiso2709.tt was missing item form check. Adds it with a call to CheckMandatorySubfields of course. (In reply to Galen Charlton from comment #7) > No, there are three: serials-edit.tt includes a version of that same check; > the serials receiving form should be checked to see whether the same bug > applies there as well. Thanks for your help, you where totally right. Fridolyn, The last one, shouldn't it be just CheckMandatorySubfields()? (In reply to Srdjan Jankovic from comment #12) > Fridolyn, > The last one, shouldn't it be just CheckMandatorySubfields()? The last patch ? No, the CheckMandatorySubfields() has an argument which is the parent object to use for searching subfield lines. This is necessary for the serial edition where there are hidden subfield lines, one must not check all line of the form. Created attachment 19704 [details] [review] [SIGNED-OFF] Bug 10543 - false mandatory warning in additem When editing a item, you get a popup warning : "1 mandatory fields empty (highlighted)". But all mandatory fields are filled. This is because there is a field with a huge content (more than 100 characters), it it displayed in a textarea instead of input. This patch corrects javascript form check by using siblings(). Also adds a more precise filter to find mandatory inputs because looking in full page may bring unwanted results. Test plan : - In a framework, make sure you have in item field : An optionnal subfield (without authorised value) then a mandatory subfield then an optional subfield next to mandatory subfield For example : $i (optional), $r (mandatory) and $s (optional) - Open a biblio record and create a new item - Enter more than 100 characters in $i, fill $r and $s - Click "Add item" - Edit this item => You get a textarea for $i - Empty $s and Save => Without patch, you get a warning and form is not saved and you see that $s is yellow while it should be $r => With patch, form is saved - Re-edit this item - Empty $r and save => You get a warning and form is not saved Signed-off-by: Srdjan <srdjan@catalyst.net.nz> Created attachment 19705 [details] [review] [SIGNED-OFF] Bug 10543 - Unify item mandatory subfields check Use of CheckMandatorySubfields from cataloging.js everywhere an item cataloging form is checked for mandatories Signed-off-by: Srdjan <srdjan@catalyst.net.nz> Created attachment 19706 [details] [review] [SIGNED-OFF] Bug 10543 - add mandatory subfield check to addorderiso2709.pl When adding orders from staged file, you can create one order per record using item form in the bottom of addorderiso2709.pl. This form was missing check. Signed-off-by: Srdjan <srdjan@catalyst.net.nz> Created attachment 19980 [details] [review] [PASSED QA] Bug 10543 - false mandatory warning in additem When editing a item, you get a popup warning : "1 mandatory fields empty (highlighted)". But all mandatory fields are filled. This is because there is a field with a huge content (more than 100 characters), it it displayed in a textarea instead of input. This patch corrects javascript form check by using siblings(). Also adds a more precise filter to find mandatory inputs because looking in full page may bring unwanted results. Test plan : - In a framework, make sure you have in item field : An optionnal subfield (without authorised value) then a mandatory subfield then an optional subfield next to mandatory subfield For example : $i (optional), $r (mandatory) and $s (optional) - Open a biblio record and create a new item - Enter more than 100 characters in $i, fill $r and $s - Click "Add item" - Edit this item => You get a textarea for $i - Empty $s and Save => Without patch, you get a warning and form is not saved and you see that $s is yellow while it should be $r => With patch, form is saved - Re-edit this item - Empty $r and save => You get a warning and form is not saved Signed-off-by: Srdjan <srdjan@catalyst.net.nz> Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de> Notes on last patch. Created attachment 19981 [details] [review] [PASSED QA] Bug 10543 - Unify item mandatory subfields check Use of CheckMandatorySubfields from cataloging.js everywhere an item cataloging form is checked for mandatories Signed-off-by: Srdjan <srdjan@catalyst.net.nz> Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de> Created attachment 19982 [details] [review] [PASSED QA] Bug 10543 - add mandatory subfield check to addorderiso2709.pl When adding orders from staged file, you can create one order per record using item form in the bottom of addorderiso2709.pl. This form was missing check. Signed-off-by: Srdjan <srdjan@catalyst.net.nz> Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de> All 3 patches pass tests and QA script. Some additional notes on the test plan from the first patch: It took me a while to figure out a combination of subfields that would trigger the bug. I am not sure about the condition that transforms the input field into a textbox as it does not seem to happen for every field. What worked in the end was (MARC21): - $g cost, normal purchase price = mandatory - $h serial enumeration/chronolgy = optional, filled with text over 100 characters Checked for: - Adding items in cataloguing Was able to reproduce the problem, mandatory check works as expected. - Adding items from staged file in acq Was not able to trigger the problem, because we don't edit the item here, but mandatory check works as expected. - Addings items for serial subscriptions Was not able to trigger the problem, because we don't edit the items here, but mandatory check works better as before as missing mandatory fields are now highlighted and weren't before. Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de> Pushed to master. Thanks, Fridolyn! This patch has been pushed to 3.12.x, will be in 3.12.5. Thanks Fridolyn! Pushed to 3.10.x, will be in 3.10.11 |