From 0a81fe667f42219a66201a2e4440a8b8c8336987 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?=
 <marcosgdf@gmail.com>
Date: Mon, 16 Feb 2015 10:44:10 +0100
Subject: [PATCH] Fix: [ bug #1825 ] External agenda: hide/show checkbox
 doesn't work

---
 ChangeLog                      |  1 +
 htdocs/core/lib/agenda.lib.php | 13 ++++++++++---
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 5870e55152d..afeeb932e9f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -21,6 +21,7 @@ English Dolibarr ChangeLog
 - Fix: [ bug #1812 ] SQL Error message while sending emailing with PostgreSQL datatabase
 - Fix: [ bug #1819 ] SQL error when searching for an invoice payment
 - Fix: [ bug #1827 ] Tax reports gives incorrect amounts when using external modules that create lines with special codes
+- Fix: [ bug #1825 ] External agenda: hide/show checkbox doesn't work
 
 ***** ChangeLog for 3.6.2 compared to 3.6.1 *****
 - Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice.
diff --git a/htdocs/core/lib/agenda.lib.php b/htdocs/core/lib/agenda.lib.php
index e730a1ed45b..c9773372e93 100644
--- a/htdocs/core/lib/agenda.lib.php
+++ b/htdocs/core/lib/agenda.lib.php
@@ -144,12 +144,19 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
 				foreach ($showextcals as $val)
 				{
 					$htmlname = dol_string_nospecial($val['name']);
+
 					print '<tr><td>';
 					print '<script type="text/javascript">' . "\n";
+
+					//jQuery Learning "How do I select an element by an ID that has characters used in CSS notation?"
+					//http://learn.jquery.com/using-jquery-core/faq/how-do-i-select-an-element-by-an-id-that-has-characters-used-in-css-notation/
+					print '	function jq( myid ) {
+					    return myid.replace( /(:|\.|\[|\]|,|@)/g, "\\\\$1" );
+					}';
+
 					print 'jQuery(document).ready(function () {' . "\n";
-					print '		jQuery("#check_' . $htmlname . '").click(function() {';
-					print ' 		/* alert("'.$htmlname.'"); */';
-					print ' 		jQuery(".family_' . $htmlname . '").toggle();';
+					print '		jQuery("#check_" + jq("'.$htmlname.'")).click(function() {';
+					print ' 		jQuery(".family_" + jq("'.$htmlname.'")).toggle();';
 					print '		});' . "\n";
 					print '});' . "\n";
 					print '</script>' . "\n";
-- 
GitLab