diff --git a/htdocs/admin/website.php b/htdocs/admin/website.php index d8fb57b49f5..47066900c04 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 @@ -596,7 +596,9 @@ if ($id) { print ' '; print ''; - print ' '; + print ' '; + print ''; + print ''; } else { $tmpaction = 'view'; $parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]); diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index a512b5ab2f1..36ac63e06f2 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -831,7 +831,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/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); diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index a6069634243..c92c3f0ada9 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -1132,9 +1132,10 @@ 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 .= " t.civility as civility_id, t.address, t.zip, t.town, t.birthday"; - $sql .= ", t.note_private"; + $sql = "SELECT t.rowid, t.entity, t.lastname, t.firstname, t.fk_pays as country_id, t.civility, t.poste,"; + $sql .= " 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, t.birthday,"; + $sql .= " t.note_private"; $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as t"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople_extrafields as ef on (t.rowid = ef.fk_object)"; $sql .= " WHERE t.fk_soc = ".((int) $object->id); @@ -1300,6 +1301,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);