Bug 27526: Fix mandatory and important checks

The input names have been changed from "field_value" to $kohafield.
Modifying this could have an impact in other area, where
CheckMandatorySubfields and CheckImportantSubfields are called.
Using .input_marceditor let us fix the additem.tt form and prevent to
break the other ones.
Note that the other ones are actually broken (!)

Also note that there is a typo in the error message
        alertString2 += "\n- " + "%s " + MSG_MANDATORY_FIELDS_EMPTY.format(total_errors);
There is an extra %s

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Jonathan Druart 2021-07-08 15:48:36 +02:00
parent 9341e74aa2
commit 6ed29bccef

View file

@ -557,7 +557,7 @@ function CloneItemSubfield(original){
function CheckMandatorySubfields(p){
var total = 0;
$(p).find(".subfield_line input[name='mandatory'][value='1']").each(function(){
var editor = $(this).siblings("[name='field_value']");
var editor = $(this).siblings(".input_marceditor");
if (!editor.val()) {
editor.addClass("missing");
total++;
@ -569,7 +569,7 @@ function CheckMandatorySubfields(p){
function CheckImportantSubfields(p){
var total = 0;
$(p).find(".subfield_line input[name='important'][value='1']").each(function(i){
var editor = $(this).siblings("[name='field_value']");
var editor = $(this).siblings(".input_marceditor");
if (!editor.val()) {
editor.addClass("missing");
total++;