If you have a default value set for an item field in the framework it shows up on the batch item modification form. That form should be completely blank I think and ignore all defaults.
Created attachment 17498 [details] [review] Bug 9533 - batch item modification should ignore defaults This patch makes the pre-population of the fields for the batch item editor with the default values from the default framework optional and off by default. Test Plan: 1) Apply patch 2) Add default values for cost and replacement cost to the default framework. 3) Browse to Tools / Batch item modification 4) Choose a file, or entire some barcodes in the text area 5) Ensure that the 'Populate fields with default values from default framework' is *not* checked 6) Click 'Continue' 7) Observe that the fields for cost and replacement cost are blank 8) Click the 'back' button on your browser 9) Check the checkbox to enable the default value 10) Click 'Continue' 11) Observe that the fields for cost and replacement cost now contain the default values you assigned them in the default MARC framework
Created attachment 17500 [details] [review] Bug 9533 - batch item modification should ignore defaults This patch makes the pre-population of the fields for the batch item editor with the default values from the default framework optional and off by default. Test Plan: 1) Apply patch 2) Add default values for cost and replacement cost to the default framework. 3) Browse to Tools / Batch item modification 4) Choose a file, or entire some barcodes in the text area 5) Ensure that the 'Populate fields with default values from default framework' is *not* checked 6) Click 'Continue' 7) Observe that the fields for cost and replacement cost are blank 8) Click the 'back' button on your browser 9) Check the checkbox to enable the default value 10) Click 'Continue' 11) Observe that the fields for cost and replacement cost now contain the default values you assigned them in the default MARC framework
This works correctly but there is one small problem with the markup: The checkbox needs to work when you click on the accompanying text. Here's the markup I recommend: <fieldset class="rows"> <legend>Use default values</legend> <ol class="radio"> <li> <label> <input type="checkbox" name="use_default_values" id="use_default_values" /> Populate fields with default values from default framework</label> </li> </ol> </fieldset>
Created attachment 17869 [details] [review] Bug 9533 - batch item modification should ignore defaults This patch makes the pre-population of the fields for the batch item editor with the default values from the default framework optional and off by default. Test Plan: 1) Apply patch 2) Add default values for cost and replacement cost to the default framework. 3) Browse to Tools / Batch item modification 4) Choose a file, or entire some barcodes in the text area 5) Ensure that the 'Populate fields with default values from default framework' is *not* checked 6) Click 'Continue' 7) Observe that the fields for cost and replacement cost are blank 8) Click the 'back' button on your browser 9) Check the checkbox to enable the default value 10) Click 'Continue' 11) Observe that the fields for cost and replacement cost now contain the default values you assigned them in the default MARC framework
Created attachment 17870 [details] [review] Bug 9533 - batch item modification should ignore defaults This patch makes the pre-population of the fields for the batch item editor with the default values from the default framework optional and off by default. Test Plan: 1) Apply patch 2) Add default values for cost and replacement cost to the default framework. 3) Browse to Tools / Batch item modification 4) Choose a file, or entire some barcodes in the text area 5) Ensure that the 'Populate fields with default values from default framework' is *not* checked 6) Click 'Continue' 7) Observe that the fields for cost and replacement cost are blank 8) Click the 'back' button on your browser 9) Check the checkbox to enable the default value 10) Click 'Continue' 11) Observe that the fields for cost and replacement cost now contain the default values you assigned them in the default MARC framework
Created attachment 17879 [details] [review] [Signed Off] Bug 9533 - batch item modification should ignore defaults This patch makes the pre-population of the fields for the batch item editor with the default values from the default framework optional and off by default. Test Plan: 1) Apply patch 2) Add default values for cost and replacement cost to the default framework. 3) Browse to Tools / Batch item modification 4) Choose a file, or entire some barcodes in the text area 5) Ensure that the 'Populate fields with default values from default framework' is *not* checked 6) Click 'Continue' 7) Observe that the fields for cost and replacement cost are blank 8) Click the 'back' button on your browser 9) Check the checkbox to enable the default value 10) Click 'Continue' 11) Observe that the fields for cost and replacement cost now contain the default values you assigned them in the default MARC framework Signed-off-by: David Cook <dcook@prosentient.com.au>
Works as described.
Maybe should we enable the checkbox by default?
Created attachment 17931 [details] [review] Bug 9533: Use default values by default
Created attachment 17940 [details] [review] Bug 9533: Use default values by default Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Kyle, I just see you wrote in your commit message "off by default". So maybe my patch is useless? I don't want to impose this choice :)
(In reply to comment #11) > Kyle, I just see you wrote in your commit message "off by default". So maybe > my patch is useless? I don't want to impose this choice :) I personally think it should be off by default, but it can be switched by a bit of jquery either way.
I prefer someone else qa the last patch.
Hm, I think maybe having this off by default would be safer? I wonder if the field is not empty, will the default overwrite what you have in there?
Testing this I was surprised to find the option on the upload page instead of on the page where I actually define the modifications. I tend to check all checkboxes and settings I made twice before I do a change like this, with the options being spread over 2 pages, I can't do that. I think the option should go on the second step.
Thinking more about this, a possible enhancement would be to make visible which fields will be set to which default value. There is no way to tell now which changes will be done or not done when you check/uncheck the checkbox. I know that this is more complicated so it should go on a new bug as an enhancement request once have figured this out.
Ok, I think I need to take a break, because after some more testing I understand better. Ignore last 2 comments, I will try again: 1) Having the feature off by default might be better in my opinion, because it reduces the risk of unintended changes. 2) I can see that the default values for text fields show up in the form, which is good as it makes visible which changes will happen. But there is a bug here: If you use a default itemtype, the pull down will not be preselected. This seems to happen for all values with pull downs. 3) I'd still like to see the checkbox on the second page instead of the first, but it might not be as big as a problem as I initially thought.
Created attachment 18094 [details] [review] [PASSED QA] Bug 9533 - batch item modification should ignore defaults This patch makes the pre-population of the fields for the batch item editor with the default values from the default framework optional and off by default. Test Plan: 1) Apply patch 2) Add default values for cost and replacement cost to the default framework. 3) Browse to Tools / Batch item modification 4) Choose a file, or entire some barcodes in the text area 5) Ensure that the 'Populate fields with default values from default framework' is *not* checked 6) Click 'Continue' 7) Observe that the fields for cost and replacement cost are blank 8) Click the 'back' button on your browser 9) Check the checkbox to enable the default value 10) Click 'Continue' 11) Observe that the fields for cost and replacement cost now contain the default values you assigned them in the default MARC framework Signed-off-by: David Cook <dcook@prosentient.com.au> Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de> Switch works correctly, all tests and QA script pass. Note: there is a bug with default values for all non text input fields. Default values won't be applied for those fields as the pull downs are not preselected correctly with the default values defined in the framework.
Created attachment 18095 [details] [review] [PASSED QA] Bug 9533: Use default values by default Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de> Simple template change checking the checkbox by default.
Comment on attachment 18095 [details] [review] [PASSED QA] Bug 9533: Use default values by default Obsoleting second patch, but also passing QA on it. The change is alright if we want the checkbox to be checked by default.
Version back to master.
Pushed to master. Thanks, Kyle! I do, however, agree with Katrin that the ability to control which default values are presented really belongs on the item field form, not the upload form.
This patch has been pushed to 3.12.x, will be in 3.12.2. Thanks Kyle!
Pushed to 3.10.x, will be in 3.10.10
Pushed to 3.8.x, will be in 3.8.17