2
0
forked from Wavyzz/dolibarr

Fix: Corrige un paquet de warnings

This commit is contained in:
Laurent Destailleur
2007-10-23 23:28:13 +00:00
parent 207fb63fe6
commit 5e5e8bba2d
14 changed files with 231 additions and 226 deletions

View File

@@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Simon Tosser <simon@kornog-computing.com>
*
* This program is free software; you can redistribute it and/or modify
@@ -18,7 +18,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
* $Source$
*/
/**
@@ -52,6 +51,7 @@ if ( (isset($_POST["action"]) && $_POST["action"] == 'update')
dolibarr_set_const($db, "MAIN_DELAY_SUPPLIER_BILLS_TO_PAY",$_POST["SupplierBillsToPay"]);
dolibarr_set_const($db, "MAIN_DELAY_CUSTOMER_BILLS_UNPAYED",$_POST["CustomerBillsUnpayed"]);
dolibarr_set_const($db, "MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE",$_POST["TransactionsToConciliate"]);
dolibarr_set_const($db, "MAIN_DELAY_CHEQUES_TO_DEPOSIT",$_POST["ChequesToDeposit"]);
dolibarr_set_const($db, "MAIN_DELAY_MEMBERS",$_POST["Members"]);
if ($_POST['action'] != 'updateedit')
{
@@ -170,6 +170,11 @@ if ((isset($_GET["action"]) && $_GET["action"] == 'edit')
print '<td width="20px">'.img_object('','account').'</td>';
print '<td>'.$langs->trans("DelaysOfToleranceTransactionsToConciliate").'</td><td>';
print '<input size="5" name="TransactionsToConciliate" value="'. ($conf->global->MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE+0) . '"> ' . $langs->trans("days") . '</td></tr>';
$var=!$var;
print '<tr '.$bc[$var].'>';
print '<td width="20px">'.img_object('','account').'</td>';
print '<td>'.$langs->trans("DelaysOfTolerancechequesToDeposit").'</td><td>';
print '<input size="5" name="ChequesToDeposit" value="'. ($conf->global->MAIN_DELAY_CHEQUES_TO_DEPOSIT+0) . '"> ' . $langs->trans("days") . '</td></tr>';
}
if ($conf->adherent->enabled)
{
@@ -269,6 +274,10 @@ else
print '<tr '.$bc[$var].'>';
print '<td width="20px">'.img_object('','account').'</td>';
print '<td>'.$langs->trans("DelaysOfToleranceTransactionsToConciliate").'</td><td>' . ($conf->global->MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE+0) . ' ' . $langs->trans("days") . '</td></tr>';
$var=!$var;
print '<tr '.$bc[$var].'>';
print '<td width="20px">'.img_object('','account').'</td>';
print '<td>'.$langs->trans("DelaysOfToleranceChequesToDeposit").'</td><td>' . ($conf->global->MAIN_DELAY_CHEQUES_TO_DEPOSIT+0) . ' ' . $langs->trans("days") . '</td></tr>';
}
if ($conf->adherent->enabled)

View File

@@ -20,7 +20,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
* $Source$
*/
/**
@@ -124,10 +123,10 @@ class Conf
if (! $this->global->MAIN_MENUFRONT_BARRELEFT) $this->global->MAIN_MENUFRONT_BARRELEFT="default.php";
// Variable globales LDAP
if (! $this->global->LDAP_KEY_USERS) $this->global->LDAP_KEY_USERS=$this->global->LDAP_FIELD_FULLNAME;
if (! $this->global->LDAP_KEY_GROUPS) $this->global->LDAP_KEY_GROUPS=$this->global->LDAP_FIELD_FULLNAME;
if (! $this->global->LDAP_KEY_CONTACTS) $this->global->LDAP_KEY_CONTACTS=$this->global->LDAP_FIELD_FULLNAME;
if (! $this->global->LDAP_KEY_MEMBERS) $this->global->LDAP_KEY_MEMBERS=$this->global->LDAP_FIELD_FULLNAME;
if (! isset($this->global->LDAP_KEY_USERS)) $this->global->LDAP_KEY_USERS=$this->global->LDAP_FIELD_FULLNAME;
if (! isset($this->global->LDAP_KEY_GROUPS)) $this->global->LDAP_KEY_GROUPS=$this->global->LDAP_FIELD_FULLNAME;
if (! isset($this->global->LDAP_KEY_CONTACTS)) $this->global->LDAP_KEY_CONTACTS=$this->global->LDAP_FIELD_FULLNAME;
if (! isset($this->global->LDAP_KEY_MEMBERS)) $this->global->LDAP_KEY_MEMBERS=$this->global->LDAP_FIELD_FULLNAME;
/*
@@ -351,21 +350,21 @@ class Conf
// Debug Mode
$this->use_debug_mode=0;
if ($this->global->MAIN_ENABLE_DEBUG_MODE) $this->use_debug_mode=$this->global->MAIN_ENABLE_DEBUG_MODE;
if (isset($this->global->MAIN_ENABLE_DEBUG_MODE)) $this->use_debug_mode=$this->global->MAIN_ENABLE_DEBUG_MODE;
// System tools
if (! $this->global->SYSTEMTOOLS_MYSQLDUMP) $this->global->SYSTEMTOOLS_MYSQLDUMP="mysqldump";
// societe
if (! $this->global->SOCIETE_CODECLIENT_ADDON) $this->global->SOCIETE_CODECLIENT_ADDON="mod_codeclient_leopard";
if (! $this->global->SOCIETE_CODEFOURNISSEUR_ADDON) $this->global->SOCIETE_CODEFOURNISSEUR_ADDON=$this->global->SOCIETE_CODECLIENT_ADDON;
if (! $this->global->SOCIETE_CODECOMPTA_ADDON) $this->global->SOCIETE_CODECOMPTA_ADDON="mod_codecompta_panicum";
if (! isset($this->global->SOCIETE_CODEFOURNISSEUR_ADDON) || ! $this->global->SOCIETE_CODEFOURNISSEUR_ADDON) $this->global->SOCIETE_CODEFOURNISSEUR_ADDON=$this->global->SOCIETE_CODECLIENT_ADDON;
if (! isset($this->global->SOCIETE_CODECOMPTA_ADDON) || ! $this->global->SOCIETE_CODECOMPTA_ADDON) $this->global->SOCIETE_CODECOMPTA_ADDON="mod_codecompta_panicum";
// Pour compatibilite ascendante:
if ($this->global->CODECLIENT_ADDON) $this->global->SOCIETE_CODECLIENT_ADDON=$this->global->CODECLIENT_ADDON;
if ($this->global->CODEFOURNISSEUR_ADDON) $this->global->SOCIETE_CODEFOURNISSEUR_ADDON=$this->global->CODEFOURNISSEUR_ADDON;
if (isset($this->global->CODECLIENT_ADDON)) $this->global->SOCIETE_CODECLIENT_ADDON=$this->global->CODECLIENT_ADDON;
if (isset($this->global->CODEFOURNISSEUR_ADDON)) $this->global->SOCIETE_CODEFOURNISSEUR_ADDON=$this->global->CODEFOURNISSEUR_ADDON;
// securite
if (! $this->global->USER_PASSWORD_GENERATED) $this->global->USER_PASSWORD_GENERATED='standard';
if (! isset($this->global->USER_PASSWORD_GENERATED) || ! $this->global->USER_PASSWORD_GENERATED) $this->global->USER_PASSWORD_GENERATED='standard';
// conf->use_preview_tabs
$this->use_preview_tabs=1;
@@ -426,27 +425,27 @@ class Conf
// $this->email_from = email pour envoi par dolibarr des mails automatiques
$this->email_from = "dolibarr-robot@domain.com";
if ($conf->global->MAIN_MAIL_EMAIL_FROM)
if (isset($conf->global->MAIN_MAIL_EMAIL_FROM) && $conf->global->MAIN_MAIL_EMAIL_FROM)
{
$this->email_from = $conf->global->MAIN_MAIL_EMAIL_FROM;
}
// $this->notification->email_from = email pour envoi par Dolibarr des notifications
$this->notification->email_from=$conf->global->MAIN_MAIL_EMAIL_FROM;
if ($conf->global->NOTIFICATION_EMAIL_FROM)
$this->notification->email_from=$this->email_from;
if (isset($conf->global->NOTIFICATION_EMAIL_FROM) && $conf->global->NOTIFICATION_EMAIL_FROM)
{
$this->mailing->email_from=$conf->global->NOTIFICATION_EMAIL_FROM;
$this->notification->email_from=$conf->global->NOTIFICATION_EMAIL_FROM;
}
// $this->mailing->email_from = email pour envoi par Dolibarr des mailings
$this->mailing->email_from=$conf->global->MAIN_MAIL_EMAIL_FROM;
if ($conf->global->MAILING_EMAIL_FROM)
$this->mailing->email_from=$this->email_from;;
if (isset($conf->global->MAILING_EMAIL_FROM) && $conf->global->MAILING_EMAIL_FROM)
{
$this->mailing->email_from=$conf->global->MAILING_EMAIL_FROM;
}
// Defini MAIN_GRAPH_LIBRARY
if (! in_array($this->global->MAIN_GRAPH_LIBRARY, array('phplot','artichow')))
if (isset($this->global->MAIN_GRAPH_LIBRARY) && ! in_array($this->global->MAIN_GRAPH_LIBRARY, array('phplot','artichow')))
{
$this->global->MAIN_GRAPH_LIBRARY='phplot';
// $this->global->MAIN_GRAPH_LIBRARY = 'artichow';
@@ -485,7 +484,7 @@ class Conf
$this->contrat->services->expires->warning_delay=$this->global->MAIN_DELAY_RUNNING_SERVICES*24*60*60;
$this->adherent->cotisation->warning_delay=$this->global->MAIN_DELAY_MEMBERS*24*60*60;
$this->bank->rappro->warning_delay=$this->global->MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE*24*60*60;
$this->bank->cheque->warning_delay=$this->global->MAIN_DELAY_CHEQUES_TO_DEPOSIT*24*60*60;
}
}

View File

@@ -18,7 +18,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
* $Source$
*/
/**

View File

@@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
*
* This program is free software; you can redistribute it and/or modify
@@ -18,7 +18,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
* $Source$
*/
/**

View File

@@ -17,7 +17,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
* $Source$
*/
/**
@@ -67,7 +66,6 @@ class box_factures_fourn extends ModeleBoxes {
$this->info_box_head = array(
'text' => $langs->trans("BoxTitleLastSupplierBills",$max),
'limit'=> strlen($text)
);
if ($user->rights->fournisseur->facture->lire)

View File

@@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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
@@ -17,7 +17,6 @@
* or see http://www.gnu.org/
*
* $Id$
* $Source$
*/
/**
@@ -108,7 +107,8 @@ class ModeleBoxes
$bcx[1] = 'class="box_impair"';
$var = true;
$nbcol=sizeof($contents[0])+1;
$nbcol=0;
if (isset($contents[0])) $nbcol=sizeof($contents[0])+1;
$nblines=sizeof($contents);
print "\n\n<!-- Box start -->\n";
@@ -126,8 +126,8 @@ class ModeleBoxes
{
print '<table class="nobordernopadding" width="100%"><tr><td align="left">';
}
print dolibarr_trunc($head['text'],isset($head['limit'])?$head['limit']:$this->MAXLENGTHBOX);
if ($head['sublink'])
if (isset($head['text'])) print dolibarr_trunc($head['text'],isset($head['limit'])?$head['limit']:$this->MAXLENGTHBOX);
if (isset($head['sublink']) && $head['sublink'])
{
print ' <a href="'.$head['sublink'].'" target="_new">'.img_picto($head['subtext'],$head['subpicto']).'</a>';
}

View File

@@ -18,7 +18,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
* $Source$
*/
/**
@@ -205,7 +204,7 @@ if ($user->societe_id == 0)
{
$classe=$classes[$key];
// Cherche dans cache si le load_state_board deja r<>alis<69>
if (! is_object($boardloaded[$classe]))
if (! isset($boardloaded[$classe]) || ! is_object($boardloaded[$classe]))
{
include_once($includes[$key]);
@@ -248,7 +247,7 @@ $var=true;
//
// Nbre actions <20> faire (en retard)
if (($conf->commercial->enabled || $conf->compta->enabled || $conf->comptaexpert->enabled) && $user->rights->actions->lire)
if ($conf->commercial->enabled || $conf->compta->enabled || $conf->comptaexpert->enabled)
{
include_once(DOL_DOCUMENT_ROOT."/actioncomm.class.php");
$board=new ActionComm($db);

View File

@@ -23,7 +23,6 @@
* or see http://www.gnu.org/
*
* $Id$
* $Source$
*/
/**
@@ -163,26 +162,26 @@ function sanitize_string($str)
\brief Envoi des messages dolibarr dans un fichier ou dans syslog
Pour fichier: fichier d<>fini par SYSLOG_FILE
Pour syslog: facility d<>fini par SYSLOG_FACILITY
\param message Message a tracer. Ne doit pas etre traduit si level = LOG_ERROR
\param message Message a tracer. Ne doit pas etre traduit si level = LOG_ERR
\param level Niveau de l'erreur
\remarks Cette fonction n'a un effet que si le module syslog est activ<69>.
Warning, les fonctions syslog sont buggu<67>s sous Windows et g<>n<EFBFBD>rent des
fautes de protection m<>moire. Pour r<>soudre, utiliser le loggage fichier,
au lieu du loggage syslog (configuration du module).
Si SYSLOG_FILE_NO_ERROR d<>fini, on ne g<>re pas erreur ecriture log
\remarks On windows LOG_ERROR=4, LOG_WARNING=5, LOG_NOTICE=LOG_DEBUG=LOG_INFO=6
\remarks On windows LOG_ERR=4, LOG_WARNING=5, LOG_NOTICE=LOG_DEBUG=LOG_INFO=6
*/
function dolibarr_syslog($message, $level=LOG_INFO)
{
global $conf,$user,$langs;
if ($conf->syslog->enabled)
if (isset($conf->syslog->enabled) && $conf->syslog->enabled)
{
//print $level.' - '.$conf->global->SYSLOG_LEVEL.' - '.$conf->syslog->enabled." \n";
if ($level > $conf->global->SYSLOG_LEVEL) return;
// Traduction du message
if ($level == LOG_ERROR)
if ($level == LOG_ERR)
{
$langs->load("errors");
if ($message != $langs->trans($message)) $message = $langs->trans($message);

View File

@@ -21,7 +21,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
* $Source$
*/
/**
@@ -798,6 +797,7 @@ function top_menu($head, $title="", $target="")
$title.='<br><b>'.$langs->trans("ConnectedSince").'</b>: '.dolibarr_print_date($user->datelastlogin,"dayhour");
if ($dolibarr_main_authentication) $title.='<br><b>'.$langs->trans("AuthenticationMode").'</b>: '.$dolibarr_main_authentication;
$text='';
$text.='<a href="'.DOL_URL_ROOT.'/user/logout.php"';
$text.=$menutop->atarget?(' target="'.$menutop->atarget.'"'):'';
$text.='>';

View File

@@ -112,7 +112,7 @@ if (! file_exists(DOL_DOCUMENT_ROOT ."/lib/functions.inc.php"))
// on d<>code le mot de passe de la base si besoin
require_once(DOL_DOCUMENT_ROOT ."/lib/functions.inc.php");
if ($dolibarr_main_db_encrypted_pass) $dolibarr_main_db_pass = dolibarr_decode($dolibarr_main_db_encrypted_pass);
if (isset($dolibarr_main_db_encrypted_pass) && $dolibarr_main_db_encrypted_pass) $dolibarr_main_db_pass = dolibarr_decode($dolibarr_main_db_encrypted_pass);
require_once(DOL_DOCUMENT_ROOT."/conf/conf.class.php");

View File

@@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 <20>ric Seigne <erics@rycks.com>
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2004 Guillaume Delecourt <guillaume.delecourt@opensides.be>
*
@@ -20,7 +20,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
* $Source$
*/
/**
@@ -57,7 +56,7 @@ function llxHeader($head = "")
$menu->add_submenu(DOL_URL_ROOT."/contact/index.php",$langs->trans("Contacts"));
}
if ($conf->commercial->enabled && $user->rights->commercial->lire)
if ($conf->commercial->enabled && isset($user->rights->commercial->lire) && $user->rights->commercial->lire)
{
$langs->load("commercial");
$menu->add(DOL_URL_ROOT."/comm/index.php",$langs->trans("Commercial"));

View File

@@ -682,8 +682,7 @@ class Product
$sql.= " AND pfp.rowid = ".$prodfournprice;
$sql.= " AND pfp.quantity <= ".$qty;
dolibarr_syslog("Product::get_buyprice $prodfournprice,$qty sql=".$sql);
dolibarr_syslog("Product::get_buyprice sql=".$sql);
$resql = $this->db->query($sql);
if ($resql)
{
@@ -699,7 +698,7 @@ class Product
else
{
// On refait le meme select sur la ref et l'id du produit
$sql = "SELECT pfp.price as price, pfp.quantity as quantity, pf.fk_soc";
$sql = "SELECT pfp.price as price, pfp.quantity as quantity, pf.fk_soc,";
$sql.= " pf.fk_product, pf.ref_fourn";
$sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp, ".MAIN_DB_PREFIX."product_fournisseur as pf";
$sql.= " WHERE pf.rowid = pfp.fk_product_fournisseur";
@@ -709,6 +708,7 @@ class Product
$sql.= " ORDER BY pfp.quantity DESC";
$sql.= " LIMIT 1";
dolibarr_syslog("Product::get_buyprice sql=".$sql);
$resql = $this->db->query($sql);
if ($resql)
{

View File

@@ -495,22 +495,26 @@ class User
$i = 0;
while ($i < $num)
{
$row = $this->db->fetch_row($result);
$obj = $this->db->fetch_object($result);
if ($row[1])
$module=$obj->module;
$perms=$obj->perms;
$subperms=$obj->subperms;
if ($perms)
{
if ($row[2])
if ($subperms)
{
if (! $this->rights->$row[0] ||
(is_object($this->rights->$row[0]) && ! $this->rights->$row[0]->$row[1]) ||
(is_object($this->rights->$row[0]->$row[1])) )
if (! isset($this->rights->$module) ||
(is_object($this->rights->$module) && ! isset($this->rights->$module->$perms)) ||
(is_object($this->rights->$module->$perms)) )
{
$this->rights->$row[0]->$row[1]->$row[2] = 1;
$this->rights->$module->$perms->$subperms = 1;
}
}
else
{
$this->rights->$row[0]->$row[1] = 1;
$this->rights->$module->$perms = 1;
}
}