diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 1f19e5094d7..1500455068e 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -115,16 +115,16 @@ function getDoliDBInstance($type, $host, $user, $pass, $name, $port) * 'c_paiement', 'c_payment_term', ... * @param int $shared 0=Return id of current entity only, * 1=Return id of current entity + shared entities (default) - * @param int $forceentity Entity id + * @param object $currentobject Current object if needed * @return mixed Entity id(s) to use */ -function getEntity($element, $shared=1, $forceentity=null) +function getEntity($element, $shared=1, $currentobject=null) { global $conf, $mc; if (is_object($mc)) { - return $mc->getEntity($element, $shared, $forceentity); + return $mc->getEntity($element, $shared, $currentobject); } else { diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 2b343dd0074..efb5c41e300 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -4,6 +4,7 @@ * Copyright (C) 2015 Alexandre Spangaro * Copyright (C) 2016 Ferran Marcet * Copyright (C) 2018 Nicolas ZABOURI + * Copyright (c) 2018 Frédéric France * * 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 @@ -1512,7 +1513,7 @@ class ExpenseReport extends CommonObject $classname = $conf->global->EXPENSEREPORT_ADDON; // Include file with class - $dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']); + $dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $dir = dol_buildpath($reldir."core/modules/expensereport/"); @@ -1521,9 +1522,8 @@ class ExpenseReport extends CommonObject $mybool|=@include_once $dir.$file; } - if (! $mybool) - { - dol_print_error('',"Failed to include file ".$file); + if ($mybool === false) { + dol_print_error('', "Failed to include file ".$file); return ''; } diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 05a139e2a9a..70e95624c13 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -6,6 +6,7 @@ * Copyright (C) 2015 Marcos García * Copyright (C) 2015 Charlie Benke * Copyright (C) 2018 Nicolas ZABOURI + * Copyright (C) 2018 Frédéric France * * 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 @@ -805,15 +806,14 @@ class Fichinter extends CommonObject $mybool|=@include_once $dir.$file; } - if (! $mybool) - { - dol_print_error('',"Failed to include file ".$file); + if ($mybool === false) { + dol_print_error('', "Failed to include file ".$file); return ''; } $obj = new $classname(); $numref = ""; - $numref = $obj->getNextValue($soc,$this); + $numref = $obj->getNextValue($soc, $this); if ( $numref != "") { diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index ced75842606..bb0f8724907 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -9,6 +9,7 @@ * Copyright (C) 2013 Florian Henry * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2018 Nicolas ZABOURI + * Copyright (C) 2018 Frédéric France * * 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 @@ -800,8 +801,7 @@ class CommandeFournisseur extends CommonOrder $mybool|=@include_once $dir.$file; } - if (! $mybool) - { + if ($mybool === false) { dol_print_error('',"Failed to include file ".$file); return ''; } diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 58230038fcc..dd33c290f45 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -12,6 +12,7 @@ * Copyright (C) 2015 Ferran Marcet * Copyright (C) 2016 Alexandre Spangaro * Copyright (C) 2018 Nicolas ZABOURI + * Copyright (C) 2018 Frédéric France * * 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 @@ -2280,9 +2281,8 @@ class FactureFournisseur extends CommonInvoice $mybool|=@include_once $dir.$file; } - if (! $mybool) - { - dol_print_error('',"Failed to include file ".$file); + if ($mybool === false) { + dol_print_error('', "Failed to include file ".$file); return ''; } diff --git a/htdocs/fourn/class/paiementfourn.class.php b/htdocs/fourn/class/paiementfourn.class.php index a366faa0400..be3b9fbdcaa 100644 --- a/htdocs/fourn/class/paiementfourn.class.php +++ b/htdocs/fourn/class/paiementfourn.class.php @@ -6,6 +6,7 @@ * Copyright (C) 2010-2011 Juanjo Menent * Copyright (C) 2014 Marcos García * Copyright (C) 2018 Nicolas ZABOURI + * Copyright (C) 2018 Frédéric France * * 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 @@ -654,14 +655,12 @@ class PaiementFourn extends Paiement } // For compatibility - if (! $mybool) - { + if ($mybool === false) { $file = $conf->global->SUPPLIER_PAYMENT_ADDON.".php"; $classname = "mod_supplier_payment_".$conf->global->SUPPLIER_PAYMENT_ADDON; $classname = preg_replace('/\-.*$/','',$classname); // Include file with class - foreach ($conf->file->dol_document_root as $dirroot) - { + foreach ($conf->file->dol_document_root as $dirroot) { $dir = $dirroot."/core/modules/supplier_payment/"; // Load file with numbering class (if found) @@ -671,8 +670,7 @@ class PaiementFourn extends Paiement } } - if (! $mybool) - { + if ($mybool === false) { dol_print_error('',"Failed to include file ".$file); return ''; }