diff --git a/htdocs/admin/security_other.php b/htdocs/admin/security_other.php index 2ba43a0aedf..2d46976428f 100644 --- a/htdocs/admin/security_other.php +++ b/htdocs/admin/security_other.php @@ -1,6 +1,6 @@ - * Copyright (C) 2005-2010 Regis Houssin + * Copyright (C) 2005-2012 Regis Houssin * * 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 @@ -24,13 +24,17 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; $langs->load("users"); $langs->load("admin"); $langs->load("other"); -if (!$user->admin) accessforbidden(); +if (! $user->admin) + accessforbidden(); + +$action=GETPOST('action','alpha'); $upload_dir=$conf->admin->dir_temp; @@ -43,65 +47,75 @@ if (GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC)) { require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - dol_add_file_process($upload_dir,0,0); + dol_add_file_process($upload_dir, 0, 0, 'userfile'); } -if ($_GET["action"] == 'activate_captcha') +if (preg_match('/set_(.*)/',$action,$reg)) { - dolibarr_set_const($db, "MAIN_SECURITY_ENABLECAPTCHA", '1','chaine',0,'',$conf->entity); - header("Location: security_other.php"); - exit; -} -else if ($_GET["action"] == 'disable_captcha') -{ - dolibarr_del_const($db, "MAIN_SECURITY_ENABLECAPTCHA",$conf->entity); - header("Location: security_other.php"); - exit; + $code=$reg[1]; + $value=(GETPOST($code) ? GETPOST($code) : 1); + if (dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity) > 0) + { + Header("Location: ".$_SERVER["PHP_SELF"]); + exit; + } + else + { + dol_print_error($db); + } } -if ($_GET["action"] == 'activate_advancedperms') +else if (preg_match('/del_(.*)/',$action,$reg)) { - dolibarr_set_const($db, "MAIN_USE_ADVANCED_PERMS", '1','chaine',0,'',$conf->entity); - header("Location: security_other.php"); - exit; -} -else if ($_GET["action"] == 'disable_advancedperms') -{ - dolibarr_del_const($db, "MAIN_USE_ADVANCED_PERMS",$conf->entity); - header("Location: security_other.php"); - exit; + $code=$reg[1]; + if (dolibarr_del_const($db, $code, $conf->entity) > 0) + { + Header("Location: ".$_SERVER["PHP_SELF"]); + exit; + } + else + { + dol_print_error($db); + } } -if ($_GET["action"] == 'MAIN_SESSION_TIMEOUT') +else if ($action == 'MAIN_SESSION_TIMEOUT') { if (! dolibarr_set_const($db, "MAIN_SESSION_TIMEOUT", $_POST["MAIN_SESSION_TIMEOUT"],'chaine',0,'',$conf->entity)) dol_print_error($db); else $mesg=$langs->trans("RecordModifiedSuccessfully"); } - -if ($_GET["action"] == 'MAIN_UPLOAD_DOC') +else if ($action == 'MAIN_UPLOAD_DOC') { if (! dolibarr_set_const($db, 'MAIN_UPLOAD_DOC',$_POST["MAIN_UPLOAD_DOC"],'chaine',0,'',$conf->entity)) dol_print_error($db); else $mesg=$langs->trans("RecordModifiedSuccessfully"); } - -if ($_GET["action"] == 'MAIN_UMASK') +else if ($action == 'MAIN_UMASK') { if (! dolibarr_set_const($db, "MAIN_UMASK", $_POST["MAIN_UMASK"],'chaine',0,'',$conf->entity)) dol_print_error($db); else $mesg=$langs->trans("RecordModifiedSuccessfully"); } - -if ($_GET["action"] == 'MAIN_ANTIVIRUS_COMMAND') +else if ($action == 'MAIN_ANTIVIRUS_COMMAND') { if (! dolibarr_set_const($db, "MAIN_ANTIVIRUS_COMMAND", $_POST["MAIN_ANTIVIRUS_COMMAND"],'chaine',0,'',$conf->entity)) dol_print_error($db); else $mesg=$langs->trans("RecordModifiedSuccessfully"); } - -if ($_GET["action"] == 'MAIN_ANTIVIRUS_PARAM') +else if ($action == 'MAIN_ANTIVIRUS_PARAM') { if (! dolibarr_set_const($db, "MAIN_ANTIVIRUS_PARAM", $_POST["MAIN_ANTIVIRUS_PARAM"],'chaine',0,'',$conf->entity)) dol_print_error($db); else $mesg=$langs->trans("RecordModifiedSuccessfully"); } +// Delete file +else if ($action == 'delete') +{ + $langs->load("other"); + $file = $conf->admin->dir_temp . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). + $ret=dol_delete_file($file); + if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); + else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); + Header('Location: '.$_SERVER["PHP_SELF"]); + exit; +} /* * View @@ -168,14 +182,21 @@ print ''.$langs->trans("UseCaptchaCode").''; print ''; if (function_exists("imagecreatefrompng")) { - if ($conf->global->MAIN_SECURITY_ENABLECAPTCHA == 0) - { - print ''.img_picto($langs->trans("Disabled"),'switch_off').''; - } - if($conf->global->MAIN_SECURITY_ENABLECAPTCHA == 1) - { - print ''.img_picto($langs->trans("Enabled"),'switch_on').''; - } + if (! empty($conf->use_javascript_ajax)) + { + print ajax_constantonoff('MAIN_SECURITY_ENABLECAPTCHA'); + } + else + { + if (empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA)) + { + print ''.img_picto($langs->trans("Disabled"),'off').''; + } + else + { + print ''.img_picto($langs->trans("Enabled"),'on').''; + } + } } else { @@ -183,35 +204,34 @@ else $desc = $form->textwithpicto('',$langs->transnoentities("EnableGDLibraryDesc"),1,'warning'); print $desc; } -print ""; - -print ""; -print ''; +print ''; // Enable advanced perms $var=!$var; print ""; print ''.$langs->trans("UseAdvancedPerms").''; print ''; -if ($conf->global->MAIN_USE_ADVANCED_PERMS == 0) +if (! empty($conf->use_javascript_ajax)) { - print ''.img_picto($langs->trans("Disabled"),'switch_off').''; + print ajax_constantonoff('MAIN_USE_ADVANCED_PERMS'); } -if($conf->global->MAIN_USE_ADVANCED_PERMS == 1) +else { - print ''.img_picto($langs->trans("Enabled"),'switch_on').''; + if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) + { + print ''.img_picto($langs->trans("Disabled"),'off').''; + } + else + { + print ''.img_picto($langs->trans("Enabled"),'on').''; + } } -print ""; - -print ""; -print ''; +print ""; print ''; - print '
'; - // Upload options $var=false; @@ -274,7 +294,7 @@ if (ini_get('safe_mode') && ! empty($conf->global->MAIN_ANTIVIRUS_COMMAND)) dol_syslog("safe_mode is on, basedir is ".$basedir.", safe_mode_exec_dir is ".ini_get('safe_mode_exec_dir'), LOG_WARNING); } } -print ''; +print ''; print ""; print ''; print ''; @@ -291,7 +311,7 @@ print ''.$langs->trans("AntiVirusParam").'
'; print $langs->trans("AntiVirusParamExample"); print ''; print ''; -print ''; +print ''; print ""; print ''; print ''; @@ -301,19 +321,16 @@ print ''; print ''; -print ''; - - // Form to test upload -dol_htmloutput_mesg($mesg); - -// Affiche formulaire upload print '
'; $formfile=new FormFile($db); -$formfile->form_attach_new_file(DOL_URL_ROOT.'/admin/security_other.php',$langs->trans("FormToTestFileUploadForm"),0,0,1); +$formfile->form_attach_new_file($_SERVER['PHP_SELF'], $langs->trans("FormToTestFileUploadForm"), 0, 0, 1); + +// List of document +$filearray=dol_dir_list($upload_dir, "files", 0, '', '', 'name', SORT_ASC, 1); +$formfile->list_of_documents($filearray, '', 'admin_temp', ''); llxFooter(); - $db->close(); ?> diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index caab3dcc3a6..0c5722ac0a7 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -120,11 +120,11 @@ class ActionComm extends CommonObject if (empty($this->punctual)) $this->punctual = 0; if ($this->percentage > 100) $this->percentage = 100; if ($this->percentage == 100 && ! $this->dateend) $this->dateend = $this->date; - if ($this->datep && $this->datef) $this->durationp=($this->datef - $this->datep); - if ($this->date && $this->dateend) $this->durationa=($this->dateend - $this->date); - if ($this->datep && $this->datef && $this->datep > $this->datef) $this->datef=$this->datep; - if ($this->date && $this->dateend && $this->date > $this->dateend) $this->dateend=$this->date; - if ($this->fk_project < 0) $this->fk_project = 0; + if (! empty($this->datep) && ! empty($this->datef)) $this->durationp=($this->datef - $this->datep); + if (! empty($this->date) && ! empty($this->dateend)) $this->durationa=($this->dateend - $this->date); + if (! empty($this->datep) && ! empty($this->datef) && $this->datep > $this->datef) $this->datef=$this->datep; + if (! empty($this->date) && ! empty($this->dateend) && $this->date > $this->dateend) $this->dateend=$this->date; + if (! isset($this->fk_project) || $this->fk_project < 0) $this->fk_project = 0; if ($this->elementtype=='facture') $this->elementtype='invoice'; if ($this->elementtype=='commande') $this->elementtype='order'; if ($this->elementtype=='contrat') $this->elementtype='contract'; @@ -186,19 +186,19 @@ class ActionComm extends CommonObject $sql.= (strval($this->datef)!=''?"'".$this->db->idate($this->datef)."'":"null").","; //$sql.= (strval($this->date)!=''?"'".$this->db->idate($this->date)."'":"null").","; //$sql.= (strval($this->dateend)!=''?"'".$this->db->idate($this->dateend)."'":"null").","; - $sql.= ($this->durationp >= 0 && $this->durationp != ''?"'".$this->durationp."'":"null").","; + $sql.= (isset($this->durationp) && $this->durationp >= 0 && $this->durationp != ''?"'".$this->durationp."'":"null").","; //$sql.= ($this->durationa >= 0 && $this->durationa != ''?"'".$this->durationa."'":"null").","; $sql.= " '".$this->type_id."',"; - $sql.= ($this->societe->id>0?" '".$this->societe->id."'":"null").","; - $sql.= ($this->fk_project>0?" '".$this->fk_project."'":"null").","; + $sql.= (isset($this->societe->id) && $this->societe->id > 0?" '".$this->societe->id."'":"null").","; + $sql.= (isset($this->fk_project) && $this->fk_project > 0?" '".$this->fk_project."'":"null").","; $sql.= " '".$this->db->escape($this->note)."',"; - $sql.= ($this->contact->id > 0?"'".$this->contact->id."'":"null").","; - $sql.= ($user->id > 0 ? "'".$user->id."'":"null").","; - $sql.= ($this->usertodo->id > 0?"'".$this->usertodo->id."'":"null").","; - $sql.= ($this->userdone->id > 0?"'".$this->userdone->id."'":"null").","; + $sql.= (isset($this->contact->id) && $this->contact->id > 0?"'".$this->contact->id."'":"null").","; + $sql.= (isset($user->id) && $user->id > 0 ? "'".$user->id."'":"null").","; + $sql.= (isset($this->usertodo->id) && $this->usertodo->id > 0?"'".$this->usertodo->id."'":"null").","; + $sql.= (isset($this->userdone->id) && $this->userdone->id > 0?"'".$this->userdone->id."'":"null").","; $sql.= "'".$this->db->escape($this->label)."','".$this->percentage."','".$this->priority."','".$this->fulldayevent."','".$this->db->escape($this->location)."','".$this->punctual."',"; - $sql.= ($this->fk_element?$this->fk_element:"null").","; - $sql.= ($this->elementtype?"'".$this->elementtype."'":"null").","; + $sql.= (! empty($this->fk_element)?$this->fk_element:"null").","; + $sql.= (! empty($this->elementtype)?"'".$this->elementtype."'":"null").","; $sql.= $conf->entity; $sql.= ")"; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 04fc64cdc6b..d14eadca5b5 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1688,7 +1688,7 @@ class Facture extends CommonInvoice $result=$this->client->set_as_client(); // Si active on decremente le produit principal et ses composants a la validation de facture - if ($this->type != 3 && $result >= 0 && $conf->stock->enabled && $conf->global->STOCK_CALCULATE_ON_BILL) + if ($this->type != 3 && $result >= 0 && ! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_BILL)) { require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php'; $langs->load("agenda"); diff --git a/htdocs/core/ajax/constantonoff.php b/htdocs/core/ajax/constantonoff.php index a79a9f5d0ff..d195df7631f 100644 --- a/htdocs/core/ajax/constantonoff.php +++ b/htdocs/core/ajax/constantonoff.php @@ -30,6 +30,8 @@ if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; +$action=GETPOST('action','alpha'); +$name=GETPOST('name','alpha'); /* * View @@ -45,17 +47,16 @@ top_httphead(); print ''."\n"; // Registering the location of boxes -if ((isset($_GET['action']) && ! empty($_GET['action'])) && (isset($_GET['name']) && ! empty($_GET['name'])) ) +if (! empty($action) && ! empty($name)) { $entity = GETPOST('entity','int'); - $action = GETPOST('action', 'alpha'); - $name = GETPOST('name', 'alpha'); + $value = (GETPOST('value')?GETPOST('value'):1); if ($user->admin) { if ($action == 'set') { - dolibarr_set_const($db, $name, 1, 'chaine', 0, '', $entity); + dolibarr_set_const($db, $name, $value, 'chaine', 0, '', $entity); } else if ($action == 'del') { diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 9a589a06fa6..4304437196a 100755 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -1,8 +1,8 @@ - * Copyright (C) 2004-2010 Laurent Destailleur - * Copyright (C) 2004 Eric Seigne - * Copyright (C) 2005-2007 Regis Houssin +/* Copyright (C) 2003-2005 Rodolphe Quiedeville + * Copyright (C) 2004-2010 Laurent Destailleur + * Copyright (C) 2004 Eric Seigne + * Copyright (C) 2005-2012 Regis Houssin * * 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 @@ -50,11 +50,11 @@ abstract class CommonDocGenerator 'myuser_lastname'=>$user->lastname, 'myuser_firstname'=>$user->firstname, 'myuser_login'=>$user->login, - 'myuser_phone'=>$user->officephone, - 'myuser_fax'=>$user->officefax, + 'myuser_phone'=>$user->office_phone, + 'myuser_fax'=>$user->office_fax, 'myuser_mobile'=>$user->user_mobile, - 'myuser_email'=>$user->user_email, - 'myuser_web'=>$user->url + 'myuser_email'=>$user->email, + //'myuser_web'=>$user->url // FIXME url not exist in $user object ); } diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index fc44cc02332..97481a4edf4 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -382,6 +382,9 @@ class Conf if (! isset($this->global->MAIN_MAX_DECIMALS_TOT)) $this->global->MAIN_MAX_DECIMALS_TOT=2; if (! isset($this->global->MAIN_MAX_DECIMALS_SHOWN)) $this->global->MAIN_MAX_DECIMALS_SHOWN=8; + // Default max file size for upload + $this->maxfilesize = (! empty($this->global->MAIN_UPLOAD_DOC) ? $this->global->MAIN_UPLOAD_DOC * 1024 : 2097152); + // Timeouts if (empty($this->global->MAIN_USE_CONNECT_TIMEOUT)) $this->global->MAIN_USE_CONNECT_TIMEOUT=10; if (empty($this->global->MAIN_USE_RESPONSE_TIMEOUT)) $this->global->MAIN_USE_RESPONSE_TIMEOUT=30; diff --git a/htdocs/core/db/mysql.class.php b/htdocs/core/db/mysql.class.php index 8d6b08d90de..7bb8b77f399 100644 --- a/htdocs/core/db/mysql.class.php +++ b/htdocs/core/db/mysql.class.php @@ -1,9 +1,9 @@ - * Copyright (C) 2002-2007 Rodolphe Quiedeville - * Copyright (C) 2004-2011 Laurent Destailleur - * Copyright (C) 2006 Andre Cianfarani - * Copyright (C) 2005-2009 Regis Houssin +/* Copyright (C) 2001 Fabien Seisen + * Copyright (C) 2002-2007 Rodolphe Quiedeville + * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2006 Andre Cianfarani + * Copyright (C) 2005-2012 Regis Houssin * * 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 @@ -714,10 +714,10 @@ class DoliDBMysql global $conf; // Type of encryption (2: AES (recommended), 1: DES , 0: no encryption) - $cryptType = ($conf->db->dolibarr_main_db_encryption?$conf->db->dolibarr_main_db_encryption:0); + $cryptType = (isset($conf->db->dolibarr_main_db_encryption)?$conf->db->dolibarr_main_db_encryption:0); //Encryption key - $cryptKey = (!empty($conf->db->dolibarr_main_db_cryptkey)?$conf->db->dolibarr_main_db_cryptkey:''); + $cryptKey = (! empty($conf->db->dolibarr_main_db_cryptkey)?$conf->db->dolibarr_main_db_cryptkey:''); $return = ($withQuotes?"'":"").$this->escape($fieldorvalue).($withQuotes?"'":""); diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index 3db424d4db2..4d4b9d9be1b 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -1,9 +1,9 @@ - * Copyright (C) 2002-2005 Rodolphe Quiedeville - * Copyright (C) 2004-2011 Laurent Destailleur - * Copyright (C) 2006 Andre Cianfarani - * Copyright (C) 2005-2009 Regis Houssin +/* Copyright (C) 2001 Fabien Seisen + * Copyright (C) 2002-2005 Rodolphe Quiedeville + * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2006 Andre Cianfarani + * Copyright (C) 2005-2012 Regis Houssin * * 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 @@ -709,10 +709,10 @@ class DoliDBMysqli global $conf; // Type of encryption (2: AES (recommended), 1: DES , 0: no encryption) - $cryptType = ($conf->db->dolibarr_main_db_encryption?$conf->db->dolibarr_main_db_encryption:0); + $cryptType = (isset($conf->db->dolibarr_main_db_encryption)?$conf->db->dolibarr_main_db_encryption:0); //Encryption key - $cryptKey = (!empty($conf->db->dolibarr_main_db_cryptkey)?$conf->db->dolibarr_main_db_cryptkey:''); + $cryptKey = (! empty($conf->db->dolibarr_main_db_cryptkey)?$conf->db->dolibarr_main_db_cryptkey:''); $return = ($withQuotes?"'":"").$this->escape($fieldorvalue).($withQuotes?"'":""); diff --git a/htdocs/core/js/lib_head.js b/htdocs/core/js/lib_head.js index aee93a8f0dc..2f9de0c6e27 100644 --- a/htdocs/core/js/lib_head.js +++ b/htdocs/core/js/lib_head.js @@ -1,5 +1,5 @@ // Copyright (C) 2005-2010 Laurent Destailleur -// Copyright (C) 2005-2009 Regis Houssin +// Copyright (C) 2005-2012 Regis Houssin // // 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 @@ -627,8 +627,134 @@ function hideMessage(fieldId,message) { if (textbox.value == message) textbox.value = ''; } +/* + * + */ +function setConstant(url, code, input, entity) { + $.get( url, { + action: "set", + name: code, + entity: entity + }, + function() { + $("#set_" + code).hide(); + $("#del_" + code).show(); + $.each(input, function(type, data) { + // Enable another element + if (type == "disabled") { + $.each(data, function(key, value) { + $("#" + value).removeAttr("disabled"); + if ($("#" + value).hasClass("butActionRefused") == true) { + $("#" + value).removeClass("butActionRefused"); + $("#" + value).addClass("butAction"); + } + }); + // Show another element + } else if (type == "showhide" || type == "show") { + $.each(data, function(key, value) { + $("#" + value).show(); + }); + // Set another constant + } else if (type == "set") { + $.each(data, function(key, value) { + $("#set_" + key).hide(); + $("#del_" + key).show(); + $.get( url, { + action: "set", + name: key, + value: value, + entity: entity + }); + }); + } + }); + }); +} +/* + * + */ +function delConstant(url, code, input, entity) { + $.get( url, { + action: "del", + name: code, + entity: entity + }, + function() { + $("#del_" + code).hide(); + $("#set_" + code).show(); + $.each(input, function(type, data) { + // Disable another element + if (type == "disabled") { + $.each(data, function(key, value) { + $("#" + value).attr("disabled", true); + if ($("#" + value).hasClass("butAction") == true) { + $("#" + value).removeClass("butAction"); + $("#" + value).addClass("butActionRefused"); + } + }); + // Hide another element + } else if (type == "showhide" || type == "hide") { + $.each(data, function(key, value) { + $("#" + value).hide(); + }); + // Delete another constant + } else if (type == "del") { + $.each(data, function(key, value) { + $("#del_" + value).hide(); + $("#set_" + value).show(); + $.get( url, { + action: "del", + name: value, + entity: entity + }); + }); + } + }); + }); +} +/* + * + */ +function confirmConstantAction(action, url, code, input, box, entity, yesButton, noButton) { + $("#confirm_" + code) + .attr("title", box.title) + .html(box.content) + .dialog({ + resizable: false, + height: 170, + width: 500, + modal: true, + buttons: [ + { + text : yesButton, + click : function() { + if (action == "set") { + setConstant(url, code, input, entity); + } else if (action == "del") { + delConstant(url, code, input, entity); + } + // Close dialog + $(this).dialog("close"); + // Execute another function + if (box.function) { + var fnName = box.function; + if (window.hasOwnProperty(fnName)) { + window[fnName](); + } + } + } + }, + { + text : noButton, + click : function() { + $(this).dialog("close"); + } + } + ] + }); +} /* This is to allow to transform all select box into ajax autocomplete box * with just one line: $(function() { $( "#listmotifcons" ).combobox(); }); diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index 2993197b660..e5b8a1d5f12 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -277,7 +277,7 @@ function ajax_dialog($title,$message,$w=350,$h=150) modal: true, buttons: { Ok: function() { - jQuery(this ).dialog(\'close\'); + jQuery(this).dialog(\'close\'); } } }); @@ -346,11 +346,11 @@ function ajax_combobox($htmlname, $event=array()) * On/off button for constant * * @param string $code Name of constant - * @param array $input Input element + * @param array $input Input element (enable/disable or show/hide another element, set/del another constant) * @param int $entity Entity to set * @return void */ -function ajax_constantonoff($code,$input=array(),$entity=false) +function ajax_constantonoff($code, $input=array(), $entity=false) { global $conf, $langs; @@ -359,65 +359,33 @@ function ajax_constantonoff($code,$input=array(),$entity=false) $out= ''; + $out.= ''; $out.= ''.img_picto($langs->trans("Disabled"),'switch_off').''; $out.= ''.img_picto($langs->trans("Enabled"),'switch_on').''; diff --git a/htdocs/core/lib/doc.lib.php b/htdocs/core/lib/doc.lib.php index d6da55569ca..bc5cd90951b 100644 --- a/htdocs/core/lib/doc.lib.php +++ b/htdocs/core/lib/doc.lib.php @@ -1,10 +1,10 @@ - * Copyright (C) 2006 Rodolphe Quiedeville - * Copyright (C) 2007 Patrick Raguin - * Copyright (C) 2010-2011 Regis Houssin - * Copyright (C) 2010 Juanjo Menent - * Copyright (C) 2012 Christophe Battarel +/* Copyright (C) 2006-2011 Laurent Destailleur + * Copyright (C) 2006 Rodolphe Quiedeville + * Copyright (C) 2007 Patrick Raguin + * Copyright (C) 2010-2012 Regis Houssin + * Copyright (C) 2010 Juanjo Menent + * Copyright (C) 2012 Christophe Battarel * * 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 @@ -43,10 +43,10 @@ function doc_getlinedesc($line,$outputlangs,$hideref=0,$hidedesc=0,$issupplierli global $db, $conf, $langs; $idprod=$line->fk_product; - $label=$line->label; if (empty($label)) $label=$line->libelle; - $desc=$line->desc; if (empty($desc)) $desc=$line->description; - $ref_supplier=$line->ref_supplier; if (empty($ref_supplier)) $ref_supplier=$line->ref_fourn; // TODO Not yet saved for supplier invoices, only supplier orders - $note=$line->note; + $label=(! empty($line->label)?$line->label:(! empty($line->libelle)?$line->libelle:'')); + $desc=(! empty($line->desc)?$line->desc:(! empty($line->description)?$line->description:'')); + $ref_supplier=(! empty($line->ref_supplier)?$line->ref_supplier:(! empty($line->ref_fourn)?$line->ref_fourn:'')); // TODO Not yet saved for supplier invoices, only supplier orders + $note=(! empty($line->note)?$line->note:''); if ($issupplierline) $prodser = new ProductFournisseur($db); else $prodser = new Product($db); @@ -55,7 +55,7 @@ function doc_getlinedesc($line,$outputlangs,$hideref=0,$hidedesc=0,$issupplierli { $prodser->fetch($idprod); // If a predefined product and multilang and on other lang, we renamed label with label translated - if ($conf->global->MAIN_MULTILANGS && ($outputlangs->defaultlang != $langs->defaultlang)) + if (! empty($conf->global->MAIN_MULTILANGS) && ($outputlangs->defaultlang != $langs->defaultlang)) { if (! empty($prodser->multilangs[$outputlangs->defaultlang]["label"]) && $label == $prodser->label) $label=$prodser->multilangs[$outputlangs->defaultlang]["label"]; if (! empty($prodser->multilangs[$outputlangs->defaultlang]["description"]) && $desc == $prodser->description) $desc=$prodser->multilangs[$outputlangs->defaultlang]["description"]; @@ -89,7 +89,8 @@ function doc_getlinedesc($line,$outputlangs,$hideref=0,$hidedesc=0,$issupplierli { if ($idprod) { - if ( empty($hidedesc) ) $libelleproduitservice.=$desc; + if (empty($hidedesc)) + $libelleproduitservice.=$desc; } else { @@ -106,9 +107,9 @@ function doc_getlinedesc($line,$outputlangs,$hideref=0,$hidedesc=0,$issupplierli { $prefix_prodserv = ""; $ref_prodserv = ""; - if ($conf->global->PRODUCT_ADD_TYPE_IN_DOCUMENTS) // In standard mode, we do not show this + if (! empty($conf->global->PRODUCT_ADD_TYPE_IN_DOCUMENTS)) // In standard mode, we do not show this { - if($prodser->isservice()) + if ($prodser->isservice()) { $prefix_prodserv = $outputlangs->transnoentitiesnoconv("Service")." "; } @@ -118,7 +119,7 @@ function doc_getlinedesc($line,$outputlangs,$hideref=0,$hidedesc=0,$issupplierli } } - if ( empty($hideref) ) + if (empty($hideref)) { if ($issupplierline) $ref_prodserv = $prodser->ref.' ('.$outputlangs->trans("SupplierRef").' '.$ref_supplier.')'; // Show local ref and supplier ref else $ref_prodserv = $prodser->ref; // Show local ref only @@ -130,7 +131,7 @@ function doc_getlinedesc($line,$outputlangs,$hideref=0,$hidedesc=0,$issupplierli } } - if ($line->date_start || $line->date_end) + if (! empty($line->date_start) || ! empty($line->date_end)) { $format='day'; // Show duration if exists diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 36851694460..4ac18c0985f 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -139,12 +139,12 @@ function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefil closedir($dir); // Obtain a list of columns - if ($sortcriteria) + if (! empty($sortcriteria)) { $myarray=array(); foreach ($file_list as $key => $row) { - $myarray[$key] = $row[$sortcriteria]; + $myarray[$key] = (isset($row[$sortcriteria])?$row[$sortcriteria]:''); } // Sort the data if ($sortorder) array_multisort($myarray, $sortorder, $file_list); diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index cccc2429817..86ad6f2a2fb 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3033,12 +3033,13 @@ function get_exdir($num,$level=3,$alpha=0,$withoutslash=0) /** * Creation of a directory (this can create recursive subdir) * - * @param string $dir Directory to create (Separator must be '/'. Example: '/mydir/mysubdir') - * @return int < 0 if KO, 0 = already exists, > 0 if OK + * @param string $dir Directory to create (Separator must be '/'. Example: '/mydir/mysubdir') + * @param string $dataroot Data root directory (to avoid having the data root in the loop) + * @return int < 0 if KO, 0 = already exists, > 0 if OK */ -function dol_mkdir($dir) +function dol_mkdir($dir, $dataroot='') { - global $conf; + global $db, $conf; dol_syslog("functions.lib::dol_mkdir: dir=".$dir,LOG_INFO); @@ -3048,8 +3049,14 @@ function dol_mkdir($dir) $nberr=0; $nbcreated=0; - $ccdir = ''; - $cdir = explode("/",$dir); + $ccdir=''; + if (! empty($dataroot)) { + // Remove data root from loop + $dir = str_replace($dataroot.'/', '', $dir); + $ccdir = $dataroot.'/'; + } + + $cdir = explode("/", $dir); $num=count($cdir); for ($i = 0; $i < $num; $i++) { diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index ab33d464c8d..0e676200fcb 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -1170,7 +1170,7 @@ abstract class DolibarrModules $err=0; - if (is_array($this->dirs)) + if (isset($this->dirs) && is_array($this->dirs) && ! empty($this->dirs)) { foreach ($this->dirs as $key => $value) { @@ -1184,19 +1184,19 @@ abstract class DolibarrModules $subname = empty($this->dirs[$key][3])?'':strtoupper($this->dirs[$key][3]); // Add submodule name (ex: $conf->module->submodule->dir_output) $forcename = empty($this->dirs[$key][4])?'':strtoupper($this->dirs[$key][4]); // Change the module name if different - if ($forcename) $constname = 'MAIN_MODULE_'.$forcename."_DIR_"; - if ($subname) $constname = $constname.$subname."_"; + if (! empty($forcename)) $constname = 'MAIN_MODULE_'.$forcename."_DIR_"; + if (! empty($subname)) $constname = $constname.$subname."_"; - $name = $constname.strtoupper($this->dirs[$key][0]); + $name = $constname.strtoupper($this->dirs[$key][0]); } // Define directory full path ($dir must start with "/") if (empty($conf->global->MAIN_MODULE_MULTICOMPANY) || $conf->entity == 1) $fulldir = DOL_DATA_ROOT.$dir; else $fulldir = DOL_DATA_ROOT."/".$conf->entity.$dir; // Create dir if it does not exists - if ($fulldir && ! file_exists($fulldir)) + if (! empty($fulldir) && ! file_exists($fulldir)) { - if (dol_mkdir($fulldir) < 0) + if (dol_mkdir($fulldir, DOL_DATA_ROOT) < 0) { $this->error = $langs->trans("ErrorCanNotCreateDir",$fulldir); dol_syslog(get_class($this)."::_init ".$this->error, LOG_ERR); @@ -1205,9 +1205,9 @@ abstract class DolibarrModules } // Define the constant in database if requested (not the default mode) - if ($addtodatabase) + if (! empty($addtodatabase)) { - $result = $this->insert_dirs($name,$dir); + $result = $this->insert_dirs($name, $dir); if ($result) $err++; } } diff --git a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php index e04c9b5c759..d796fee8441 100644 --- a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php +++ b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2010-2012 Laurent Destailleur + * Copyright (C) 2012 Regis Houssin * 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 @@ -108,12 +109,12 @@ class doc_generic_invoice_odt extends ModelePDFFactures 'object_ref'=>$object->ref, 'object_ref_ext'=>$object->ref_ext, 'object_ref_customer'=>$object->ref_client, - 'object_ref_supplier'=>$object->ref_fournisseur, + 'object_ref_supplier'=>(! empty($object->ref_fournisseur)?$object->ref_fournisseur:''), 'object_source_invoice_ref'=>$invoice_source->ref, 'object_date'=>dol_print_date($object->date,'day'), 'object_date_limit'=>dol_print_date($object->date_lim_reglement,'day'), 'object_date_creation'=>dol_print_date($object->date_creation,'day'), - 'object_date_modification'=>dol_print_date($object->date_modification,'day'), + 'object_date_modification'=>(! empty($object->date_modification)?dol_print_date($object->date_modification,'day'):''), 'object_date_validation'=>dol_print_date($object->date_validation,'dayhour'), 'object_payment_mode_code'=>$object->mode_reglement_code, 'object_payment_mode'=>($outputlangs->transnoentitiesnoconv('PaymentType'.$object->mode_reglement_code)!='PaymentType'.$object->mode_reglement_code?$outputlangs->transnoentitiesnoconv('PaymentType'.$object->mode_reglement_code):$object->mode_reglement), @@ -122,7 +123,7 @@ class doc_generic_invoice_odt extends ModelePDFFactures 'object_total_ht'=>price($object->total_ht,0,$outputlangs), 'object_total_vat'=>price($object->total_tva,0,$outputlangs), 'object_total_ttc'=>price($object->total_ttc,0,$outputlangs), - 'object_vatrate'=>vatrate($object->tva), + 'object_vatrate'=>(isset($object->tva)?vatrate($object->tva):''), 'object_note_private'=>$object->note, 'object_note'=>$object->note_public, // Payments @@ -339,7 +340,7 @@ class doc_generic_invoice_odt extends ModelePDFFactures '__FROM_EMAIL__' => $this->emetteur->email, '__TOTAL_TTC__' => $object->total_ttc, '__TOTAL_HT__' => $object->total_ht, - '__TOTAL_VAT__' => $object->total_vat + '__TOTAL_VAT__' => $object->total_tva ); complete_substitutions_array($substitutionarray, $langs, $object); diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index 783f9f053dd..dce9949a47c 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -1,6 +1,6 @@ - * Copyright (C) 2009-2010 Regis Houssin +/* Copyright (C) 2006-2012 Laurent Destailleur + * Copyright (C) 2009-2012 Regis Houssin * * 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 @@ -95,21 +95,23 @@ class ImportCsv extends ModeleImports } /** - * getDriverLabel + * getDriverLabel * - * @return string Label + * @param string $key Key + * @return string Label */ - function getDriverLabel() + function getDriverLabel($key='') { return $this->label; } /** - * getDriverDesc + * getDriverDesc * - * @return string Description + * @param string $key Key + * @return string Description */ - function getDriverDesc() + function getDriverDesc($key='') { return $this->desc; } @@ -125,21 +127,23 @@ class ImportCsv extends ModeleImports } /** - * getDriverVersion + * getDriverVersion * - * @return string Driver version + * @param string $key Key + * @return string Driver version */ - function getDriverVersion() + function getDriverVersion($key='') { return $this->version; } /** - * getDriverLabel + * getDriverLabel * - * @return string Label of external lib + * @param string $key Key + * @return string Label of external lib */ - function getLibLabel() + function getLibLabel($key='') { return $this->label_lib; } @@ -147,9 +151,10 @@ class ImportCsv extends ModeleImports /** * getLibVersion * - * @return string Version of external lib + * @param string $key Key + * @return string Version of external lib */ - function getLibVersion() + function getLibVersion($key='') { return $this->version_lib; } diff --git a/htdocs/core/modules/import/modules_import.php b/htdocs/core/modules/import/modules_import.php index eda1702da5b..ba4c61555a4 100644 --- a/htdocs/core/modules/import/modules_import.php +++ b/htdocs/core/modules/import/modules_import.php @@ -1,6 +1,6 @@ - * Copyright (C) 2005-2007 Regis Houssin +/* Copyright (C) 2005-2012 Laurent Destailleur + * Copyright (C) 2005-2012 Regis Houssin * * 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 diff --git a/htdocs/ecm/class/ecmdirectory.class.php b/htdocs/ecm/class/ecmdirectory.class.php index e0519073386..a684be57701 100644 --- a/htdocs/ecm/class/ecmdirectory.class.php +++ b/htdocs/ecm/class/ecmdirectory.class.php @@ -567,9 +567,9 @@ class EcmDirectory // extends CommonObject $this->cats[$obj->rowid]['fk_user_c'] = $obj->fk_user_c; $this->cats[$obj->rowid]['login_c'] = $obj->login_c; - if ($obj->rowid_fille) + if (! empty($obj->rowid_fille)) { - if (is_array($this->cats[$obj->rowid]['id_children'])) + if (isset($this->cats[$obj->rowid]['id_children']) && is_array($this->cats[$obj->rowid]['id_children'])) { $newelempos=count($this->cats[$obj->rowid]['id_children']); //print "this->cats[$i]['id_children'] est deja un tableau de $newelem elements
"; diff --git a/htdocs/ecm/search.php b/htdocs/ecm/search.php index 16ca5d56a36..8870d50c639 100644 --- a/htdocs/ecm/search.php +++ b/htdocs/ecm/search.php @@ -48,9 +48,9 @@ $result = restrictedArea($user, 'ecm',''); $user->getrights('ecm'); // Get parameters -$socid = isset($_GET["socid"])?$_GET["socid"]:''; -$action = isset($_GET["action"])?$_GET["action"]:$_POST['action']; -$section=isset($_GET["section"])?$_GET["section"]:$_POST['section']; +$socid = GETPOST('socid','int'); +$action = GETPOST('action','alpha'); +$section=GETPOST('section'); if (! $section) $section=0; $upload_dir = $conf->ecm->dir_output.'/'.$section; @@ -66,9 +66,9 @@ if (! $sortorder) $sortorder="ASC"; if (! $sortfield) $sortfield="label"; $ecmdir = new EcmDirectory($db); -if (! empty($_REQUEST["section"])) +if (! empty($section)) { - $result=$ecmdir->fetch($_REQUEST["section"]); + $result=$ecmdir->fetch($section); if (! $result > 0) { dol_print_error($db,$ecmdir->error); @@ -123,10 +123,8 @@ print_fiche_titre($langs->trans("ECMArea").' - '.$langs->trans("Search")); //print "
\n"; print $langs->trans("FeatureNotYetAvailable").'.

'; -if ($mesg) { print $mesg."
"; } - // Tool bar -$head = ecm_prepare_head_fm($fac); +$head = ecm_prepare_head_fm($ecmdir); //dol_fiche_head($head, 'search_form', '', 1); @@ -210,7 +208,6 @@ print ''; print '
'; // End of page -$db->close(); - llxFooter(); +$db->close(); ?> diff --git a/htdocs/imports/class/import.class.php b/htdocs/imports/class/import.class.php index 40ec8d6a274..e3949eafd2e 100644 --- a/htdocs/imports/class/import.class.php +++ b/htdocs/imports/class/import.class.php @@ -96,7 +96,7 @@ class Import require_once $file; $module = new $classname($this->db); - if (is_array($module->import_code)) + if (isset($module->import_code) && is_array($module->import_code)) { foreach($module->import_code as $r => $value) { @@ -138,7 +138,7 @@ class Import // Array of tables to import (key=alias, value=tablename) $this->array_import_tables[$i]=$module->import_tables_array[$r]; // Array of tables creator field to import (key=alias, value=creator field) - $this->array_import_tables_creator[$i]=$module->import_tables_creator_array[$r]; + $this->array_import_tables_creator[$i]=(isset($module->import_tables_creator_array[$r])?$module->import_tables_creator_array[$r]:''); // Array of fields to import (key=field, value=label) $this->array_import_fields[$i]=$module->import_fields_array[$r]; // Array of hidden fields to import (key=field, value=label) @@ -150,7 +150,7 @@ class Import // Tableau des alias a exporter (cle=champ, valeur=exemple) $this->array_import_examplevalues[$i]=$module->import_examplevalues_array[$r]; // Tableau des regles de conversion d'une valeur depuis une autre source (cle=champ, valeur=tableau des regles) - $this->array_import_convertvalue[$i]=$module->import_convertvalue_array[$r]; + $this->array_import_convertvalue[$i]=(isset($module->import_convertvalue_array[$r])?$module->import_convertvalue_array[$r]:''); // Module $this->array_import_module[$i]=$module; diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php index c9bd77bacb6..5b28b54af5a 100644 --- a/htdocs/imports/import.php +++ b/htdocs/imports/import.php @@ -35,8 +35,8 @@ $langs->load("exports"); $langs->load("errors"); // Security check -if ($user->societe_id) $socid=$user->societe_id; -$result=restrictedArea($user,'import',$origin_id,''); +if (! empty($user->societe_id)) $socid=$user->societe_id; +$result=restrictedArea($user, 'import'); $entitytoicon=array( 'invoice'=>'bill','invoice_line'=>'bill', @@ -68,7 +68,8 @@ $entitytolang=array( // Translation code $datatoimport = GETPOST('datatoimport'); $format = GETPOST('format'); $filetoimport = GETPOST('filetoimport'); -$action = GETPOST('action'); +$action = GETPOST('action','alpha'); +$confirm = GETPOST('confirm','alpha'); $step = (GETPOST('step') ? GETPOST('step') : 1); $import_name = GETPOST('import_name'); $hexa = GETPOST('hexa'); @@ -92,7 +93,7 @@ foreach($fieldsarray as $elem) { $tabelem=explode('=',$elem,2); $key=$tabelem[0]; - $val=$tabelem[1]; + $val=(isset($tabelem[1])?$tabelem[1]:''); if ($key && $val) { $array_match_file_to_database[$key]=$val; @@ -192,7 +193,7 @@ if ($action == 'add_import_model') if ($step == 3 && $datatoimport) { - if ( $_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC)) + if (GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC)) { dol_mkdir($conf->import->dir_temp); $nowyearmonth=dol_print_date(dol_now(),'%Y%m%d%H%M%S'); @@ -451,6 +452,14 @@ if ($step == 3 && $datatoimport) dol_fiche_head($head, 'step3', $langs->trans("NewImport")); + /* + * Confirm delete file + */ + if ($action == 'delete') + { + $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?urlfile='.urlencode(GETPOST('urlfile')).'&step=3'.$param, $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', 0, 1); + if ($ret == 'html') print '
'; + } print ''; @@ -511,7 +520,7 @@ if ($step == 3 && $datatoimport) print "\n"; // Search available imports - $filearray=dol_dir_list($conf->import->dir_temp,'files',0,'','','name',SORT_DESC); + $filearray=dol_dir_list($conf->import->dir_temp, 'files', 0, '', '', 'name', SORT_DESC); if (count($filearray) > 0) { $dir=$conf->import->dir_temp; @@ -545,8 +554,7 @@ if ($step == 3 && $datatoimport) // Affiche date fichier print ''; // Del button - print ''; // Action button print '
'.dol_print_date(dol_filemtime($dir.'/'.$file),'dayhour').''.img_delete().''; diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 06e0d7df71f..3c1b9e99493 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1000,7 +1000,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs print ''."\n"; } // jQuery File Upload - if (! empty($conf->global->MAIN_USE_JQUERY_FILEUPLOAD)) + if (! empty($conf->global->MAIN_USE_JQUERY_FILEUPLOAD) || defined('REQUIRE_JQUERY_FILEUPLOAD')) { print ''."\n"; print ''."\n"; diff --git a/htdocs/societe/canvas/actions_card_common.class.php b/htdocs/societe/canvas/actions_card_common.class.php index 0e22c08b86d..3faba3cf2d8 100644 --- a/htdocs/societe/canvas/actions_card_common.class.php +++ b/htdocs/societe/canvas/actions_card_common.class.php @@ -436,7 +436,7 @@ abstract class ActionsCardCommon $res=dol_include_once($dirroot.$module.'.php'); if ($res) break; } - $modCodeClient = new $module; + $modCodeClient = new $module($db); $this->tpl['auto_customercode'] = $modCodeClient->code_auto; // We verified if the tag prefix is used if ($modCodeClient->code_auto) $this->tpl['prefix_customercode'] = $modCodeClient->verif_prefixIsUsed(); @@ -714,4 +714,4 @@ abstract class ActionsCardCommon } -?> \ No newline at end of file +?> diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index b08667613af..156133c9252 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -1013,7 +1013,7 @@ else $res=dol_include_once($dirroot.$module.'.php'); if ($res) break; } - $modCodeClient = new $module; + $modCodeClient = new $module($db); // We verified if the tag prefix is used if ($modCodeClient->code_auto) { @@ -1031,7 +1031,7 @@ else $res=dol_include_once($dirroot.$module.'.php'); if ($res) break; } - $modCodeFournisseur = new $module; + $modCodeFournisseur = new $module($db); // On verifie si la balise prefix est utilisee if ($modCodeFournisseur->code_auto) {