diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 33b75246afd..3c8da38dd5b 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -45,6 +45,7 @@ class Adherent extends CommonObject var $errors=array(); var $element='member'; var $table_element='adherent'; + var $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe var $id; var $ref; diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 6fd15aa46d4..05afb692ed8 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -572,7 +572,7 @@ class CommonObject return $result; } - + /** * Update a specific field from an object * @param table Table element or element line @@ -590,7 +590,7 @@ class CommonObject $sql = "UPDATE ".MAIN_DB_PREFIX.$table." SET "; $sql.= $field." = '".$value."'"; $sql.= " WHERE rowid = ".$id; - + dol_syslog("CommonObject::updateObjectField sql=".$sql, LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) dol_print_error($this->db); @@ -619,7 +619,7 @@ class CommonObject $sql = "SELECT MAX(te.".$fieldid.")"; $sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element." as te"; - if ($this->ismultientitymanaged == 2 || ($this->element != 'societe' && !$this->isnolinkedbythird && !$user->rights->societe->client->voir)) $sql.= ", ".MAIN_DB_PREFIX."societe as s"; // If we need to link to societe to limit select to entity + if ($this->ismultientitymanaged == 2 || ($this->element != 'societe' && empty($this->isnolinkedbythird) && empty($user->rights->societe->client->voir))) $sql.= ", ".MAIN_DB_PREFIX."societe as s"; // If we need to link to societe to limit select to entity if (empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON ".$alias.".rowid = sc.fk_soc"; $sql.= " WHERE te.".$fieldid." < '".$this->db->escape($this->ref)."'"; if (empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir) $sql.= " AND sc.fk_user = " .$user->id; diff --git a/htdocs/core/class/html.formsms.class.php b/htdocs/core/class/html.formsms.class.php index 106eeee9204..bb34103b92a 100755 --- a/htdocs/core/class/html.formsms.class.php +++ b/htdocs/core/class/html.formsms.class.php @@ -96,7 +96,7 @@ class FormSms $form=new Form($this->db); $soc=new Societe($this->db); - if ($this->withtosocid > 0) + if (!empty($this->withtosocid) && $this->withtosocid > 0) { $soc->fetch($this->withtosocid); } diff --git a/htdocs/lib/member.lib.php b/htdocs/lib/member.lib.php index df1310ef34e..b67c280ec9b 100644 --- a/htdocs/lib/member.lib.php +++ b/htdocs/lib/member.lib.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2006-2011 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -42,7 +42,7 @@ function member_prepare_head($object) $head[$h][2] = 'general'; $h++; - if ($conf->ldap->enabled && $conf->global->LDAP_MEMBER_ACTIVE) + if (! empty($conf->ldap->enabled) && ! empty($conf->global->LDAP_MEMBER_ACTIVE)) { $langs->load("ldap"); @@ -52,7 +52,7 @@ function member_prepare_head($object) $h++; } - if ($user->rights->adherent->cotisation->lire) + if (! empty($user->rights->adherent->cotisation->lire)) { $head[$h][0] = DOL_URL_ROOT.'/adherents/card_subscriptions.php?rowid='.$object->id; $head[$h][1] = $langs->trans("Subscriptions"); @@ -61,7 +61,7 @@ function member_prepare_head($object) } // Show category tab - if ($conf->categorie->enabled && $user->rights->categorie->lire) + if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire)) { $head[$h][0] = DOL_URL_ROOT."/categories/categorie.php?id=".$object->id.'&type=3'; $head[$h][1] = $langs->trans('Categories');