Summary: | SubfieldsToAllowForRestrictedEditing : data from drop-down menu not stored | ||
---|---|---|---|
Product: | Koha | Reporter: | pierre.genty |
Component: | Cataloging | Assignee: | Fridolin Somers <fridolin.somers> |
Status: | CLOSED FIXED | QA Contact: | Kyle M Hall (khall) <kyle> |
Severity: | major | ||
Priority: | P5 - low | CC: | arthur.suzuki, fridolin.somers, kyle, lucas, m.de.rooy, victor |
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: |
22.11.00, 22.05.07, 21.11.14
|
|
Circulation function: | |||
Bug Depends on: | 28445 | ||
Bug Blocks: | |||
Attachments: |
Bug 31234: SubfieldsToAllowForRestrictedEditing - data from drop-down menu not stored
Bug 31234: SubfieldsToAllowForRestrictedEditing - data from drop-down menu not stored Bug 31234: SubfieldsToAllowForRestrictedEditing - data from drop-down menu not stored |
Description
pierre.genty
2022-07-25 09:08:20 UTC
This comes from a change by Bug 28445 in items edition form : <select name="field_value" change to : <select name="[% kohafield | html %]" This breaks the special JS code : https://git.koha-community.org/Koha-community/Koha/src/commit/fc919fc796df42c29e73cd527d3c425377fcc27a/koha-tmpl/intranet-tmpl/prog/js/cataloging_additem.js#L112 I propose we use "select.input_marceditor". Created attachment 138145 [details] [review] Bug 31234: SubfieldsToAllowForRestrictedEditing - data from drop-down menu not stored Problem with items restricted edition, restriced fields with a drop-down menu are not stored, since 21.11. This comes from a change by Bug 28445 in items edition form : <select name="field_value" change to : <select name="[% kohafield | html %]" This breaks the special JS code : https://git.koha-community.org/Koha-community/Koha/src/commit/fc919fc796df42c29e73cd527d3c425377fcc27a/koha-tmpl/intranet-tmpl/prog/js/cataloging_additem.js#L112 I propose we use "select.input_marceditor". Test plan : 1. A librarian with 'edit_items_restricted' permission set 2. Item subfield not authorized for editing (SubfieldsToAllowForRestrictedEditing). In Marc framework, this subfield is linked to an authorized value (= drop-down menu). For exemple homebranch. 3. When adding/editing item, this subfield has a default value from drop-down menu and is not editable (OK). 4. Save item => Without patch : the subfield is empty, it should have the value from drop-down menu. => With patch : the subfield is saved with the value from drop-down menu. Important /!\ : There are other places with JS calling 'field_value', we should check if there are other bugs : > git grep 'name..field_value' > git grep 'name..field_value' -- koha-tmpl/ koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt: <select name="field_value" class="input_marceditor"> koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tt: <input type="hidden" name="field_value" value="[% authid | html %]" /> koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tt: <input type="hidden" name="field_value" value="[% authtypecode | html %]" /> koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-edit.tt: if(! $(subfield_div).children("input[type='text'][name='field_value']").val() ){ koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-edit.tt: $(subfield_div).children("input[type='text'][name='field_value']").val($("#serialseq" + serialId).val()); koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-edit.tt: <select name="field_value" class="select2 input_marceditor"> koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-edit.tt: <input type="hidden" name="field_value" value="[% item.itemnumber | html %]" /> koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-edit.tt: <select name="field_value"> koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-edit.tt: <input type="hidden" name="field_value" value="[% newserialloo.itemnumber | html %]" /> koha-tmpl/intranet-tmpl/prog/en/modules/services/itemrecorddisplay.tt: <select name="field_value" class="input_marceditor"> koha-tmpl/intranet-tmpl/prog/en/modules/tools/marc_modification_templates.tt: with value <input type="text" name="field_value" id="field_value" /> koha-tmpl/intranet-tmpl/prog/js/additem.js: .prevAll("[name='field_value']")[0]; koha-tmpl/intranet-tmpl/prog/js/additem.js: $(original).find("input[name='field_value']").each(function(){ koha-tmpl/intranet-tmpl/prog/js/additem.js: $(clone).find("div[id^='"+id+"'] input[name='field_value']").val(value); koha-tmpl/intranet-tmpl/prog/js/additem.js: $(original).find("select[name='field_value']").each(function(){ koha-tmpl/intranet-tmpl/prog/js/additem.js: $(clone).find("div[id^='"+id+"'] select[name='field_value']").val(value); koha-tmpl/intranet-tmpl/prog/js/additem.js: var input = $(this).prevAll("input[name='field_value']")[0]; BTW : The system preference 'SubfieldsToAllowForRestrictedEditing' edition is quite strange, why enter itemsfield 952/995 when it is obvious. Could be simply subfields separated with a comma : a,b,c (In reply to Fridolin Somers from comment #5) > BTW : > The system preference 'SubfieldsToAllowForRestrictedEditing' edition is > quite strange, why enter itemsfield 952/995 when it is obvious. > Could be simply subfields separated with a comma : a,b,c In theory someone could have changed the item subfield and used something else... we'd never recommend to do that, but I guess it might be the case or was thought to be an option when the preference was added. Created attachment 140410 [details] [review] Bug 31234: SubfieldsToAllowForRestrictedEditing - data from drop-down menu not stored Problem with items restricted edition, restriced fields with a drop-down menu are not stored, since 21.11. This comes from a change by Bug 28445 in items edition form : <select name="field_value" change to : <select name="[% kohafield | html %]" This breaks the special JS code : https://git.koha-community.org/Koha-community/Koha/src/commit/fc919fc796df42c29e73cd527d3c425377fcc27a/koha-tmpl/intranet-tmpl/prog/js/cataloging_additem.js#L112 I propose we use "select.input_marceditor". Test plan : 1. A librarian with 'edit_items_restricted' permission set 2. Item subfield not authorized for editing (SubfieldsToAllowForRestrictedEditing). In Marc framework, this subfield is linked to an authorized value (= drop-down menu). For exemple homebranch. 3. When adding/editing item, this subfield has a default value from drop-down menu and is not editable (OK). 4. Save item => Without patch : the subfield is empty, it should have the value from drop-down menu. => With patch : the subfield is saved with the value from drop-down menu. Signed-off-by: David Nind <david@davidnind.com> Created attachment 141156 [details] [review] Bug 31234: SubfieldsToAllowForRestrictedEditing - data from drop-down menu not stored Problem with items restricted edition, restriced fields with a drop-down menu are not stored, since 21.11. This comes from a change by Bug 28445 in items edition form : <select name="field_value" change to : <select name="[% kohafield | html %]" This breaks the special JS code : https://git.koha-community.org/Koha-community/Koha/src/commit/fc919fc796df42c29e73cd527d3c425377fcc27a/koha-tmpl/intranet-tmpl/prog/js/cataloging_additem.js#L112 I propose we use "select.input_marceditor". Test plan : 1. A librarian with 'edit_items_restricted' permission set 2. Item subfield not authorized for editing (SubfieldsToAllowForRestrictedEditing). In Marc framework, this subfield is linked to an authorized value (= drop-down menu). For exemple homebranch. 3. When adding/editing item, this subfield has a default value from drop-down menu and is not editable (OK). 4. Save item => Without patch : the subfield is empty, it should have the value from drop-down menu. => With patch : the subfield is saved with the value from drop-down menu. Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Pushed to master for 22.11. Nice work everyone, thanks! This must be backported to untill 21.11.x right ? Backported to 22.05.x for upcoming 22.05.07 release applied to 21.11 for 21.11.14 Missing dependencies for 21.05.x, it shouldn't be affected, no backport. Nothing to document it seems, marking resolved. |