From f74ed5ad8a3b4878f7f89e82ba0a55a019a341aa Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fr=C3=A9d=C3=A9rick=20Capovilla?= Date: Fri, 21 Oct 2011 12:04:03 -0400 Subject: [PATCH] Bug 6977: Follow-up patch : catch CloneSubfield errors A javascript error could occur if the CloneSubfield function failed for any reason. This would prevent the popup from disappearing. Example : Importing informations of a UNIF_TITLE authority with multiple $x subfields in the biblio's 440 field. 440$x isn't repeatable, so an error occurs when trying to clone it. http://bugs.koha-community.org/show_bug.cgi?id=6977 Signed-off-by: Paul Poulain (cherry picked from commit 6dac7273fbc2eff7805d2a9bda1eb9a275962c00) Signed-off-by: Chris Nighswonger --- .../authorities/blinddetail-biblio-search.tt | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/blinddetail-biblio-search.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/blinddetail-biblio-search.tt index 169728918c..77a5d5fc80 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/blinddetail-biblio-search.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/blinddetail-biblio-search.tt @@ -33,10 +33,11 @@ } // Sets the good number of form fields for the specified subfield + // Returns false if the cloning failed function SetSubfieldNumber(subfield_name, nb) { // Nothing to do if we only have one value if(nb <= 1) { - return; + return true; } // Find the subfield we want to clone @@ -45,10 +46,16 @@ return this.id.match(re); }); - // Add as many clones as needed - for(var i=0; i