diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 1f3171e2126..6a3ade87a74 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -597,11 +597,11 @@ 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->isnolinkedbythird && !$user->rights->societe->client->voir) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON ".$alias.".rowid = sc.fk_soc"; + 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 (!$this->isnolinkedbythird && !$user->rights->societe->client->voir) $sql.= " AND sc.fk_user = " .$user->id; + if (empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir) $sql.= " AND sc.fk_user = " .$user->id; if (! empty($filter)) $sql.=" AND ".$filter; - if ($this->ismultientitymanaged == 2 || ($this->element != 'societe' && !$this->isnolinkedbythird && !$user->rights->societe->client->voir)) $sql.= ' AND te.fk_soc = s.rowid'; // If we need to link to societe to limit select to entity + if ($this->ismultientitymanaged == 2 || ($this->element != 'societe' && empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir)) $sql.= ' AND te.fk_soc = s.rowid'; // If we need to link to societe to limit select to entity if ($this->ismultientitymanaged == 1) $sql.= ' AND te.entity IN (0,'.(! empty($conf->entities[$this->element]) ? $conf->entities[$this->element] : $conf->entity).')'; //print $sql."
"; @@ -617,12 +617,12 @@ class CommonObject $sql = "SELECT MIN(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->isnolinkedbythird && !$user->rights->societe->client->voir) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON ".$alias.".rowid = sc.fk_soc"; + if ($this->ismultientitymanaged == 2 || ($this->element != 'societe' && empty($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 (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 (!$this->isnolinkedbythird && !$user->rights->societe->client->voir) $sql.= " AND sc.fk_user = " .$user->id; - if (isset($filter)) $sql.=" AND ".$filter; - if ($this->ismultientitymanaged == 2 || ($this->element != 'societe' && !$this->isnolinkedbythird && !$user->rights->societe->client->voir)) $sql.= ' AND te.fk_soc = s.rowid'; // If we need to link to societe to limit select to entity + if (empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir) $sql.= " AND sc.fk_user = " .$user->id; + if (! empty($filter)) $sql.=" AND ".$filter; + if ($this->ismultientitymanaged == 2 || ($this->element != 'societe' && empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir)) $sql.= ' AND te.fk_soc = s.rowid'; // If we need to link to societe to limit select to entity if ($this->ismultientitymanaged == 1) $sql.= ' AND te.entity IN (0,'.(! empty($conf->entities[$this->element]) ? $conf->entities[$this->element] : $conf->entity).')'; // Rem: Bug in some mysql version: SELECT MIN(rowid) FROM llx_socpeople WHERE rowid > 1 when one row in database with rowid=1, returns 1 instead of null diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index fdfd89306e6..67499017d1d 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -3284,7 +3284,7 @@ class Form $ret=''; //print "$paramid,$morehtml,$shownav,$fieldid,$fieldref,$morehtmlref,$moreparam"; - $object->load_previous_next_ref($object->next_prev_filter,$fieldid); + $object->load_previous_next_ref((isset($object->next_prev_filter)?$object->next_prev_filter:''),$fieldid); $previous_ref = $object->ref_previous?''.img_previous().'':''; $next_ref = $object->ref_next?''.img_next().'':''; diff --git a/htdocs/core/class/html.formsms.class.php b/htdocs/core/class/html.formsms.class.php index bc5a6a0d19a..8eb9758cf72 100755 --- a/htdocs/core/class/html.formsms.class.php +++ b/htdocs/core/class/html.formsms.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2010 Juanjo Menent +/* Copyright (C) 2005-2011 Laurent Destailleur + * Copyright (C) 2010 Juanjo Menent * * 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 @@ -94,7 +94,7 @@ class FormSms $langs->load("mails"); $langs->load("sms"); - $form=new Form($DB); + $form=new Form($this->db); $soc=new Societe($this->db); if ($this->withtosocid > 0) { @@ -176,8 +176,15 @@ function limitChars(textarea, limit, infodiv) dol_include_once('/ovh/class/ovhsms.class.php'); try { - $sms = new OvhSms($db); - $resultsender = $sms->SmsSenderList($conf->global->OVHSMS_ACCOUNT); + $sms = new OvhSms($this->db); + if (empty($conf->global->OVHSMS_ACCOUNT)) + { + $resultsender = 'ErrorOVHSMS_ACCOUNT not defined'; + } + else + { + $resultsender = $sms->SmsSenderList($conf->global->OVHSMS_ACCOUNT); + } } catch(Exception $e) { @@ -221,7 +228,7 @@ function limitChars(textarea, limit, infodiv) else { print "withto) && $this->withto != '1'? (isset($_REQUEST["sendto"])?$_REQUEST["sendto"]:$this->withto):"+")."\">"; - if ($this->withtosocid > 0) + if (! empty($this->withtosocid) && $this->withtosocid > 0) { $liste=array(); $liste[0]=' '; diff --git a/htdocs/lib/company.lib.php b/htdocs/lib/company.lib.php index bc9586480d2..d72dc232ff4 100644 --- a/htdocs/lib/company.lib.php +++ b/htdocs/lib/company.lib.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2006-2011 Laurent Destailleur * Copyright (C) 2006 Rodolphe Quiedeville * Copyright (C) 2007 Patrick Raguin * Copyright (C) 2010 Regis Houssin @@ -45,28 +45,29 @@ function societe_prepare_head($object) $h++; // TODO Remove tests on object->object. Functions must be called with a company object directly - if (($object->client==2 || $object->client==3 || $object->object->client==2 || $object->object->client==3) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) + if (($object->client==2 || $object->client==3 + || (isset($object->object) && $object->object->client==2) || (isset($object->object) && $object->object->client==3)) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) { $head[$h][0] = DOL_URL_ROOT.'/comm/prospect/fiche.php?socid='.$object->id; $head[$h][1] = $langs->trans("Prospect"); $head[$h][2] = 'prospect'; $h++; } - if ($object->client==1 || $object->client==3 || $object->object->client==1 || $object->object->client==3) + if ($object->client==1 || $object->client==3 || (is_object($object->object) && $object->object->client==1) || (is_object($object->object) && $object->object->client==3)) { $head[$h][0] = DOL_URL_ROOT.'/comm/fiche.php?socid='.$object->id; $head[$h][1] = $langs->trans("Customer"); $head[$h][2] = 'customer'; $h++; } - if ($conf->fournisseur->enabled && ($object->fournisseur || $object->object->fournisseur)) + if (! empty($conf->fournisseur->enabled) && ($object->fournisseur || (isset($object->object) && $object->object->fournisseur))) { $head[$h][0] = DOL_URL_ROOT.'/fourn/fiche.php?socid='.$object->id; $head[$h][1] = $langs->trans("Supplier"); $head[$h][2] = 'supplier'; $h++; } - if ($conf->agenda->enabled) + if (! empty($conf->agenda->enabled)) { $head[$h][0] = DOL_URL_ROOT.'/societe/agenda.php?socid='.$object->id; $head[$h][1] = $langs->trans("Agenda"); @@ -74,7 +75,7 @@ function societe_prepare_head($object) $h++; } //show categorie tab - if ($conf->categorie->enabled) + if (! empty($conf->categorie->enabled)) { $type = 2; if ($object->fournisseur) $type = 1; @@ -107,7 +108,7 @@ function societe_prepare_head($object) $h++; } // Notifications - if ($conf->notification->enabled && $user->societe_id == 0) + if (! empty($conf->notification->enabled) && $user->societe_id == 0) { $head[$h][0] = DOL_URL_ROOT.'/societe/notify/fiche.php?socid='.$object->id; $head[$h][1] = $langs->trans("Notifications"); diff --git a/htdocs/lib/functions.lib.php b/htdocs/lib/functions.lib.php index 32ea53c2701..77cf8e0bbca 100644 --- a/htdocs/lib/functions.lib.php +++ b/htdocs/lib/functions.lib.php @@ -495,7 +495,7 @@ function dol_fiche_head($links=array(), $active='0', $title='', $notab=0, $picto // Show tabs for ($i = 0 ; $i <= $maxkey ; $i++) { - if ($links[$i][2] == 'image') + if (isset($links[$i][2]) && $links[$i][2] == 'image') { if (!empty($links[$i][0])) { diff --git a/htdocs/lib/functions2.lib.php b/htdocs/lib/functions2.lib.php index cbe0c229a8b..807a9914b00 100644 --- a/htdocs/lib/functions2.lib.php +++ b/htdocs/lib/functions2.lib.php @@ -643,7 +643,7 @@ function check_value($mask,$value) // Extract value for mask counter, mask raz and mask offset if (! preg_match('/\{(0+)([@\+][0-9]+)?([@\+][0-9]+)?\}/i',$mask,$reg)) return 'ErrorBadMask'; - $masktri=$reg[1].$reg[2].$reg[3]; + $masktri=$reg[1].(isset($reg[2])?$reg[2]:'').(isset($reg[3])?$reg[3]:''); $maskcounter=$reg[1]; $maskraz=-1; $maskoffset=0; @@ -1128,12 +1128,12 @@ function getSoapParams() global $conf; $params=array(); - $proxyuse=($conf->global->MAIN_PROXY_USE?true:false); - $proxyhost=($conf->global->MAIN_PROXY_USE?$conf->global->MAIN_PROXY_HOST:false); - $proxyport=($conf->global->MAIN_PROXY_USE?$conf->global->MAIN_PROXY_PORT:false); - $proxyuser=($conf->global->MAIN_PROXY_USE?$conf->global->MAIN_PROXY_USER:false); - $proxypass=($conf->global->MAIN_PROXY_USE?$conf->global->MAIN_PROXY_PASS:false); - $timeout=(empty($conf->global->MAIN_USE_CONNECT_TIMEOUT)?10:$conf->global->MAIN_USE_CONNECT_TIMEOUT); // Connection timeout + $proxyuse =(empty($conf->global->MAIN_PROXY_USE)?false:true); + $proxyhost=(empty($conf->global->MAIN_PROXY_USE)?false:$conf->global->MAIN_PROXY_HOST); + $proxyport=(empty($conf->global->MAIN_PROXY_USE)?false:$conf->global->MAIN_PROXY_PORT); + $proxyuser=(empty($conf->global->MAIN_PROXY_USE)?false:$conf->global->MAIN_PROXY_USER); + $proxypass=(empty($conf->global->MAIN_PROXY_USE)?false:$conf->global->MAIN_PROXY_PASS); + $timeout =(empty($conf->global->MAIN_USE_CONNECT_TIMEOUT)?10:$conf->global->MAIN_USE_CONNECT_TIMEOUT); // Connection timeout $response_timeout=(empty($conf->global->MAIN_USE_RESPONSE_TIMEOUT)?30:$conf->global->MAIN_USE_RESPONSE_TIMEOUT); // Response timeout //print extension_loaded('soap'); if ($proxyuse) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index bd93650be27..c5be8eb78cd 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1660,7 +1660,7 @@ if (! function_exists("llxFooter")) print "\n".' '."\n"; - if ($conf->use_javascript_ajax && $conf->global->MAIN_MENU_USE_JQUERY_LAYOUT) print ' '."\n"; + if ($conf->use_javascript_ajax && ! empty($conf->global->MAIN_MENU_USE_JQUERY_LAYOUT)) print ' '."\n"; print "\n"; if ($foot) print ''."\n";