From 2f8c4bd083e1e8fc8c9c1e458ca7cb5b2e29d3c0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 6 Feb 2023 14:28:11 +0100 Subject: [PATCH 1/3] Fix label of var --- htdocs/core/js/lib_notification.js.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/core/js/lib_notification.js.php b/htdocs/core/js/lib_notification.js.php index 19540912049..d7e1932ca27 100644 --- a/htdocs/core/js/lib_notification.js.php +++ b/htdocs/core/js/lib_notification.js.php @@ -99,12 +99,12 @@ function first_execution() { function check_events() { if (Notification.permission === "granted") { - var newToken = 'notrequired'; + var currentToken = 'notrequired'; const allMeta = document.getElementsByTagName("meta"); for (let i = 0; i < allMeta.length; i++) { if (allMeta[i].getAttribute("name") == 'anti-csrf-currenttoken') { - newToken = allMeta[i].getAttribute('content'); - console.log("newToken in page = "+newToken); + currentToken = allMeta[i].getAttribute('content'); + console.log("currentToken in page = "+currentToken); } } time_js_next_test += time_auto_update; @@ -113,7 +113,7 @@ function check_events() { $.ajax("", { type: "post", // Usually post or get async: true, - data: { time_js_next_test: time_js_next_test, forcechecknow: 1, token: newToken }, + data: { time_js_next_test: time_js_next_test, forcechecknow: 1, token: currentToken }, dataType: "json", success: function (result) { //console.log(result); @@ -181,7 +181,7 @@ function check_events() { $.ajax(""+listofreminderids, { type: "POST", // Usually post or get async: true, - data: { time_js_next_test: time_js_next_test, token: newToken } + data: { time_js_next_test: time_js_next_test, token: currentToken } }); } else { console.log("No reminder to do found, next search at "+time_js_next_test); From 7e15ea256f5ab3f32d40667d2a501f6997cc21f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20David?= Date: Mon, 6 Feb 2023 16:35:53 +0100 Subject: [PATCH 2/3] fix: socid post param on clicktodial add event button --- htdocs/core/class/commonobject.class.php | 2 +- htdocs/core/lib/company.lib.php | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index e42748bc61d..f5d45b751b4 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -849,7 +849,7 @@ abstract class CommonObject } if ($this->element == 'contact') { $contactid = $this->id; - $thirdpartyid = empty($object->fk_soc) ? 0 : $object->fk_soc; + $thirdpartyid = empty($this->fk_soc) ? 0 : $this->fk_soc; } if ($this->element == 'user') { $contactid = $this->contact_id; diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index b1d53e452bb..05b8e98e8ed 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -1117,7 +1117,7 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl $extrafieldsobjectkey = $contactstatic->table_element; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; - $sql = "SELECT t.rowid, t.entity, t.lastname, t.firstname, t.fk_pays as country_id, t.civility, t.poste, t.phone as phone_pro, t.phone_mobile, t.phone_perso, t.fax, t.email, t.socialnetworks, t.statut, t.photo,"; + $sql = "SELECT t.rowid, t.entity, t.lastname, t.firstname, t.fk_pays as country_id, t.civility, t.poste, t.phone as phone_pro, t.phone_mobile, t.phone_perso, t.fax, t.email, t.socialnetworks, t.statut, t.photo, t.fk_soc,"; $sql .= " t.civility as civility_id, t.address, t.zip, t.town"; $sql .= ", t.note_private"; $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as t"; @@ -1272,6 +1272,7 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl $contactstatic->email = $obj->email; $contactstatic->socialnetworks = $obj->socialnetworks; $contactstatic->photo = $obj->photo; + $contactstatic->fk_soc = $obj->fk_soc; $contactstatic->entity = $obj->entity; $country_code = getCountry($obj->country_id, 2); From 6b6c39de9084661e456d41b950e23d3aa10ad998 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 6 Feb 2023 17:57:49 +0100 Subject: [PATCH 3/3] Clean code --- htdocs/admin/website.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/admin/website.php b/htdocs/admin/website.php index aa2ee58853c..5c50a57e7cc 100644 --- a/htdocs/admin/website.php +++ b/htdocs/admin/website.php @@ -43,10 +43,6 @@ $rowid = GETPOST('rowid', 'alpha'); $id = 1; -if (!$user->admin) { - accessforbidden(); -} - $acts[0] = "activate"; $acts[1] = "disable"; $actl[0] = img_picto($langs->trans("Disabled"), 'switch_off', 'class="size15x"'); @@ -125,6 +121,10 @@ $tabfieldcheck[1] = array(); $elementList = array(); $sourceList = array(); +if (!$user->admin) { + accessforbidden(); +} + /* * Actions @@ -581,8 +581,8 @@ if ($id) { fieldListWebsites($fieldlist, $obj, $tabname[$id], 'edit'); } - print ' '; - print ' '; + print ' '; + print ' '; } else { $tmpaction = 'view'; $parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);