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) 3. When adding/editing item, this subfield has a default value from drop-down menu and is not editable (OK). 4. Once item is saved, the subfield is empty : it should have the default value from drop-down menu.
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".
Item restricted edition dates back to Bug 7673
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.