Bugzilla – Attachment 19412 Details for
Bug 10543
false mandatory warning in additem
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Proposed patch
0001-Bug-10543-false-mandatory-warning-in-additem.patch (text/plain), 3.73 KB, created by
Fridolin Somers
on 2013-07-05 14:00:50 UTC
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Fridolin Somers
Created:
2013-07-05 14:00:50 UTC
Size:
3.73 KB
patch
obsolete
>From 6d081730a6495e4fc42dd9909d2537b94cb02b1f Mon Sep 17 00:00:00 2001 >From: Fridolyn SOMERS <fridolyn.somers@biblibre.com> >Date: Fri, 5 Jul 2013 15:20:59 +0200 >Subject: [PATCH] Bug 10543 - false mandatory warning in additem > >When editing a item, we 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 >--- > .../intranet-tmpl/prog/en/modules/acqui/orderreceive.tt | 12 +++++------- > .../intranet-tmpl/prog/en/modules/cataloguing/additem.tt | 12 +++++------- > 2 files changed, 10 insertions(+), 14 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt >index 0f454c0..c6ae408 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt >@@ -9,13 +9,11 @@ > function Check(form) { > [% IF (AcqCreateItemReceiving) %] > var total_errors=0; >- $("input[name='mandatory'],select[name='mandatory']").each(function(i){ >- if($(this).val() == 1){ >- var mandatory_field = $("input[name='field_value'],select[name='field_value']").eq(i); >- if(mandatory_field.val() == ''){ >- mandatory_field.addClass("missing"); >- total_errors++; >- } >+ $(f).find(".subfield_line input[name='mandatory'][value='1']").each(function(i){ >+ var mandatory_field = $(this).siblings("[name='field_value']"); >+ if (mandatory_field.val() == '') { >+ mandatory_field.addClass("missing"); >+ total_errors++; > } > }); > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt >index 74b6d30..6e2fdb9 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt >@@ -41,13 +41,11 @@ function active(numlayer) > } > function Check(f) { > var total_errors=0; >- $("input[name='mandatory'],select[name='mandatory']").each(function(i){ >- if($(this).val() == 1){ >- var mandatory_field = $("input[name='field_value'],select[name='field_value']").eq(i); >- if(mandatory_field.val() == ''){ >- mandatory_field.addClass("missing"); >- total_errors++; >- } >+ $(f).find(".subfield_line input[name='mandatory'][value='1']").each(function(i){ >+ var mandatory_field = $(this).siblings("[name='field_value']"); >+ if (mandatory_field.val() == '') { >+ mandatory_field.addClass("missing"); >+ total_errors++; > } > }); > >-- >1.7.10.4 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 10543
:
19412
|
19572
|
19574
|
19576
|
19704
|
19705
|
19706
|
19980
|
19981
|
19982