From 238f9770025da83d3139cc73660d8f00840464c4 Mon Sep 17 00:00:00 2001 From: Ion Agorria Date: Tue, 8 Dec 2015 15:45:24 +0100 Subject: [PATCH 1/5] JS error preventing hiding of dates at object line The "if (CKEDITOR)" gives "ReferenceError: CKEDITOR is not defined" at JS console causing the next code to don't execute, is this code obsolete? --- htdocs/core/tpl/objectline_create.tpl.php | 6 ------ 1 file changed, 6 deletions(-) diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index d7949fa1d52..a2f4ebd4d69 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -517,12 +517,6 @@ jQuery(document).ready(function() { { /* focus work on a standard textarea but not if field was replaced with CKEDITOR */ jQuery('#dp_desc').focus(); - /* focus if CKEDITOR */ - if (CKEDITOR) - { - var editor = CKEDITOR.instances['dp_desc']; - if (editor) { editor.focus(); } - } } if (jQuery('#select_type').val() == '0') jQuery('#trlinefordates').hide(); else jQuery('#trlinefordates').show(); From bbfd1388960e56a7bcba1a5a2daf47fea6b2d1fb Mon Sep 17 00:00:00 2001 From: Ion Agorria Date: Wed, 9 Dec 2015 18:00:05 +0100 Subject: [PATCH 2/5] Missed another CKEDITOR ref --- htdocs/core/tpl/objectline_create.tpl.php | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index a2f4ebd4d69..6c507d55910 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -515,7 +515,7 @@ jQuery(document).ready(function() { setforfree(); if (jQuery('#select_type').val() >= 0) { - /* focus work on a standard textarea but not if field was replaced with CKEDITOR */ + /* focus work on a standard textarea */ jQuery('#dp_desc').focus(); } if (jQuery('#select_type').val() == '0') jQuery('#trlinefordates').hide(); @@ -615,14 +615,8 @@ jQuery(document).ready(function() { /* To set focus */ if (jQuery('#idprod').val() > 0 || jQuery('#idprodfournprice').val() > 0) { - /* focus work on a standard textarea but not if field was replaced with CKEDITOR */ + /* focus work on a standard textarea */ jQuery('#dp_desc').focus(); - /* focus if CKEDITOR */ - if (CKEDITOR) - { - var editor = CKEDITOR.instances['dp_desc']; - if (editor) { editor.focus(); } - } } }); From ceb2920769fa561ba5dbe08dca48d07b791fab2c Mon Sep 17 00:00:00 2001 From: Ion Agorria Date: Thu, 10 Dec 2015 14:17:08 +0100 Subject: [PATCH 3/5] Better undefined CKEDITOR fix --- htdocs/core/tpl/objectline_create.tpl.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 6c507d55910..176c70e4a5a 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -515,8 +515,14 @@ jQuery(document).ready(function() { setforfree(); if (jQuery('#select_type').val() >= 0) { - /* focus work on a standard textarea */ + /* focus work on a standard textarea but not if field was replaced with CKEDITOR */ jQuery('#dp_desc').focus(); + /* focus if CKEDITOR */ + if (typeof(CKEDITOR) !== 'undefined') + { + var editor = CKEDITOR.instances['dp_desc']; + if (editor) { editor.focus(); } + } } if (jQuery('#select_type').val() == '0') jQuery('#trlinefordates').hide(); else jQuery('#trlinefordates').show(); @@ -615,8 +621,14 @@ jQuery(document).ready(function() { /* To set focus */ if (jQuery('#idprod').val() > 0 || jQuery('#idprodfournprice').val() > 0) { - /* focus work on a standard textarea */ + /* focus work on a standard textarea but not if field was replaced with CKEDITOR */ jQuery('#dp_desc').focus(); + /* focus if CKEDITOR */ + if (typeof(CKEDITOR) !== 'undefined') + { + var editor = CKEDITOR.instances['dp_desc']; + if (editor) { editor.focus(); } + } } }); From f34fb0d82d1066bec56f9061be4955611e1aab5e Mon Sep 17 00:00:00 2001 From: Ion Agorria Date: Fri, 11 Dec 2015 03:09:09 +0100 Subject: [PATCH 4/5] More consistent check --- htdocs/core/tpl/objectline_create.tpl.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 176c70e4a5a..bb84e47ad7d 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -518,7 +518,7 @@ jQuery(document).ready(function() { /* focus work on a standard textarea but not if field was replaced with CKEDITOR */ jQuery('#dp_desc').focus(); /* focus if CKEDITOR */ - if (typeof(CKEDITOR) !== 'undefined') + if (typeof CKEDITOR == "object" && typeof CKEDITOR.instances != "undefined" && CKEDITOR.instances[key] != "undefined") { var editor = CKEDITOR.instances['dp_desc']; if (editor) { editor.focus(); } @@ -624,7 +624,7 @@ jQuery(document).ready(function() { /* focus work on a standard textarea but not if field was replaced with CKEDITOR */ jQuery('#dp_desc').focus(); /* focus if CKEDITOR */ - if (typeof(CKEDITOR) !== 'undefined') + if (typeof CKEDITOR == "object" && typeof CKEDITOR.instances != "undefined" && CKEDITOR.instances[key] != "undefined") { var editor = CKEDITOR.instances['dp_desc']; if (editor) { editor.focus(); } From 26b85d7cac82c077ec70e4f3f932e79af0794c85 Mon Sep 17 00:00:00 2001 From: Ion Agorria Date: Fri, 11 Dec 2015 18:28:55 +0100 Subject: [PATCH 5/5] Remove unnecesary variable --- htdocs/core/tpl/objectline_create.tpl.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index bb84e47ad7d..bcbcae00639 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -518,7 +518,7 @@ jQuery(document).ready(function() { /* focus work on a standard textarea but not if field was replaced with CKEDITOR */ jQuery('#dp_desc').focus(); /* focus if CKEDITOR */ - if (typeof CKEDITOR == "object" && typeof CKEDITOR.instances != "undefined" && CKEDITOR.instances[key] != "undefined") + if (typeof CKEDITOR == "object" && typeof CKEDITOR.instances != "undefined") { var editor = CKEDITOR.instances['dp_desc']; if (editor) { editor.focus(); } @@ -624,7 +624,7 @@ jQuery(document).ready(function() { /* focus work on a standard textarea but not if field was replaced with CKEDITOR */ jQuery('#dp_desc').focus(); /* focus if CKEDITOR */ - if (typeof CKEDITOR == "object" && typeof CKEDITOR.instances != "undefined" && CKEDITOR.instances[key] != "undefined") + if (typeof CKEDITOR == "object" && typeof CKEDITOR.instances != "undefined") { var editor = CKEDITOR.instances['dp_desc']; if (editor) { editor.focus(); }