Fix: Removed a lot of warnings

This commit is contained in:
Laurent Destailleur 2011-06-08 23:10:42 +00:00
parent 20f6615cbe
commit d4376e60a2
7 changed files with 39 additions and 31 deletions

View File

@ -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."<br>";
@ -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

View File

@ -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?'<a href="'.$_SERVER["PHP_SELF"].'?'.$paramid.'='.urlencode($object->ref_previous).$moreparam.'">'.img_previous().'</a>':'';
$next_ref = $object->ref_next?'<a href="'.$_SERVER["PHP_SELF"].'?'.$paramid.'='.urlencode($object->ref_next).$moreparam.'">'.img_next().'</a>':'';

View File

@ -1,6 +1,6 @@
<?PHP
/* Copyright (C) 2005-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
/* Copyright (C) 2005-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
*
* 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 "<input size=\"16\" name=\"sendto\" value=\"".(! is_array($this->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]='&nbsp;';

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2006-2009 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
* Copyright (C) 2010 Regis Houssin <regis@dolibarr.fr>
@ -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");

View File

@ -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]))
{

View File

@ -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)

View File

@ -1660,7 +1660,7 @@ if (! function_exists("llxFooter"))
print "\n".'</td></tr></table> <!-- end right area -->'."\n";
if ($conf->use_javascript_ajax && $conf->global->MAIN_MENU_USE_JQUERY_LAYOUT) print '</div></div> <!-- end main layout -->'."\n";
if ($conf->use_javascript_ajax && ! empty($conf->global->MAIN_MENU_USE_JQUERY_LAYOUT)) print '</div></div> <!-- end main layout -->'."\n";
print "\n";
if ($foot) print '<!-- '.$foot.' -->'."\n";