From 921a6f313518062c2fc81c57fe82d72e0b89ef00 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 6 Aug 2023 12:26:27 +0200 Subject: [PATCH] Fix warning --- htdocs/api/class/api_documents.class.php | 44 +++++++++---------- htdocs/blockedlog/class/authority.class.php | 8 +++- htdocs/blockedlog/class/blockedlog.class.php | 13 +++--- .../action/class/api_agendaevents.class.php | 2 +- htdocs/comm/action/class/ical.class.php | 5 +++ htdocs/comm/mailing/class/mailing.class.php | 5 +++ .../comm/propal/class/propalestats.class.php | 2 - .../facture/class/facture-rec.class.php | 2 +- htdocs/core/class/commonobject.class.php | 13 +++++- htdocs/core/class/stats.class.php | 22 ++++++++++ 10 files changed, 80 insertions(+), 36 deletions(-) diff --git a/htdocs/api/class/api_documents.class.php b/htdocs/api/class/api_documents.class.php index c064db3c487..bee4530e094 100644 --- a/htdocs/api/class/api_documents.class.php +++ b/htdocs/api/class/api_documents.class.php @@ -67,7 +67,7 @@ class Documents extends DolibarrApi */ public function index($modulepart, $original_file = '') { - global $conf, $langs; + global $conf; if (empty($modulepart)) { throw new RestException(400, 'bad value for parameter modulepart'); @@ -188,66 +188,66 @@ class Documents extends DolibarrApi if ($modulepart == 'facture' || $modulepart == 'invoice') { require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; - $this->invoice = new Facture($this->db); - $result = $this->invoice->fetch(0, preg_replace('/\.[^\.]+$/', '', basename($original_file))); + $tmpobject = new Facture($this->db); + $result = $tmpobject->fetch(0, preg_replace('/\.[^\.]+$/', '', basename($original_file))); if (!$result) { throw new RestException(404, 'Invoice not found'); } - $templateused = $doctemplate ? $doctemplate : $this->invoice->model_pdf; - $result = $this->invoice->generateDocument($templateused, $outputlangs, $hidedetails, $hidedesc, $hideref); + $templateused = $doctemplate ? $doctemplate : $tmpobject->model_pdf; + $result = $tmpobject->generateDocument($templateused, $outputlangs, $hidedetails, $hidedesc, $hideref); if ($result <= 0) { throw new RestException(500, 'Error generating document'); } } elseif ($modulepart == 'facture_fournisseur' || $modulepart == 'invoice_supplier') { require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php'; - $this->supplier_invoice = new FactureFournisseur($this->db); - $result = $this->supplier_invoice->fetch(0, preg_replace('/\.[^\.]+$/', '', basename($original_file))); + $tmpobject = new FactureFournisseur($this->db); + $result = $tmpobject->fetch(0, preg_replace('/\.[^\.]+$/', '', basename($original_file))); if (!$result) { throw new RestException(404, 'Supplier invoice not found'); } - $templateused = $doctemplate ? $doctemplate : $this->supplier_invoice->model_pdf; - $result = $this->supplier_invoice->generateDocument($templateused, $outputlangs, $hidedetails, $hidedesc, $hideref); + $templateused = $doctemplate ? $doctemplate : $tmpobject->model_pdf; + $result = $tmpobject->generateDocument($templateused, $outputlangs, $hidedetails, $hidedesc, $hideref); if ($result < 0) { throw new RestException(500, 'Error generating document'); } } elseif ($modulepart == 'commande' || $modulepart == 'order') { require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; - $this->order = new Commande($this->db); - $result = $this->order->fetch(0, preg_replace('/\.[^\.]+$/', '', basename($original_file))); + $tmpobject = new Commande($this->db); + $result = $tmpobject->fetch(0, preg_replace('/\.[^\.]+$/', '', basename($original_file))); if (!$result) { throw new RestException(404, 'Order not found'); } - $templateused = $doctemplate ? $doctemplate : $this->order->model_pdf; - $result = $this->order->generateDocument($templateused, $outputlangs, $hidedetails, $hidedesc, $hideref); + $templateused = $doctemplate ? $doctemplate : $tmpobject->model_pdf; + $result = $tmpobject->generateDocument($templateused, $outputlangs, $hidedetails, $hidedesc, $hideref); if ($result <= 0) { throw new RestException(500, 'Error generating document'); } } elseif ($modulepart == 'propal' || $modulepart == 'proposal') { require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; - $this->propal = new Propal($this->db); - $result = $this->propal->fetch(0, preg_replace('/\.[^\.]+$/', '', basename($original_file))); + $tmpobject = new Propal($this->db); + $result = $tmpobject->fetch(0, preg_replace('/\.[^\.]+$/', '', basename($original_file))); if (!$result) { throw new RestException(404, 'Proposal not found'); } - $templateused = $doctemplate ? $doctemplate : $this->propal->model_pdf; - $result = $this->propal->generateDocument($templateused, $outputlangs, $hidedetails, $hidedesc, $hideref); + $templateused = $doctemplate ? $doctemplate : $tmpobject->model_pdf; + $result = $tmpobject->generateDocument($templateused, $outputlangs, $hidedetails, $hidedesc, $hideref); if ($result <= 0) { throw new RestException(500, 'Error generating document'); } } elseif ($modulepart == 'contrat' || $modulepart == 'contract') { require_once DOL_DOCUMENT_ROOT . '/contrat/class/contrat.class.php'; - $this->contract = new Contrat($this->db); - $result = $this->contract->fetch(0, preg_replace('/\.[^\.]+$/', '', basename($original_file))); + $tmpobject = new Contrat($this->db); + $result = $tmpobject->fetch(0, preg_replace('/\.[^\.]+$/', '', basename($original_file))); if (!$result) { throw new RestException(404, 'Contract not found'); } - $templateused = $doctemplate ? $doctemplate : $this->contract->model_pdf; - $result = $this->contract->generateDocument($templateused, $outputlangs, $hidedetails, $hidedesc, $hideref); + $templateused = $doctemplate ? $doctemplate : $tmpobject->model_pdf; + $result = $tmpobject->generateDocument($templateused, $outputlangs, $hidedetails, $hidedesc, $hideref); if ($result <= 0) { throw new RestException(500, 'Error generating document missing doctemplate parameter'); @@ -631,7 +631,7 @@ class Documents extends DolibarrApi */ public function post($filename, $modulepart, $ref = '', $subdir = '', $filecontent = '', $fileencoding = '', $overwriteifexists = 0, $createdirifnotexists = 1) { - global $db, $conf; + global $conf; //var_dump($modulepart); //var_dump($filename); diff --git a/htdocs/blockedlog/class/authority.class.php b/htdocs/blockedlog/class/authority.class.php index e274ff4175d..9da736d30ec 100644 --- a/htdocs/blockedlog/class/authority.class.php +++ b/htdocs/blockedlog/class/authority.class.php @@ -27,11 +27,16 @@ class BlockedLogAuthority public $db; /** - * Id of the log + * Id of the authority * @var int */ public $id; + /** + * @var string Ref of the authority + */ + public $ref; + /** * Unique fingerprint of the blockchain to store * @var string @@ -158,7 +163,6 @@ class BlockedLogAuthority */ public function fetch($id, $signature = '') { - global $langs; dol_syslog(get_class($this)."::fetch id=".((int) $id), LOG_DEBUG); diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php index be764fb2ebb..f6e4d20f71f 100644 --- a/htdocs/blockedlog/class/blockedlog.class.php +++ b/htdocs/blockedlog/class/blockedlog.class.php @@ -756,15 +756,14 @@ class BlockedLog if ($resql) { $obj = $this->db->fetch_object($resql); if ($obj) { - $this->id = $obj->rowid; - $this->entity = $obj->entity; - $this->ref = $obj->rowid; + $this->id = $obj->rowid; + $this->entity = $obj->entity; - $this->date_creation = $this->db->jdate($obj->date_creation); - $this->tms = $this->db->jdate($obj->tms); + $this->date_creation = $this->db->jdate($obj->date_creation); + $this->date_modification = $this->db->jdate($obj->tms); $this->amounts = (double) $obj->amounts; - $this->action = $obj->action; + $this->action = $obj->action; $this->element = $obj->element; $this->fk_object = $obj->fk_object; @@ -778,7 +777,7 @@ class BlockedLog $this->object_version = $obj->object_version; $this->signature = $obj->signature; - $this->signature_line = $obj->signature_line; + $this->signature_line = $obj->signature_line; $this->certified = ($obj->certified == 1); return 1; diff --git a/htdocs/comm/action/class/api_agendaevents.class.php b/htdocs/comm/action/class/api_agendaevents.class.php index 7a33d26064f..179145c4be4 100644 --- a/htdocs/comm/action/class/api_agendaevents.class.php +++ b/htdocs/comm/action/class/api_agendaevents.class.php @@ -81,7 +81,7 @@ class AgendaEvents extends DolibarrApi } if (!DolibarrApiAccess::$user->rights->agenda->allactions->read && $this->actioncomm->userownerid != DolibarrApiAccess::$user->id) { - throw new RestException(401, "Insufficient rights to read event for owner id ".$request_data['userownerid'].' Your id is '.DolibarrApiAccess::$user->id); + throw new RestException(401, 'Insufficient rights to read event of this owner id. Your id is '.DolibarrApiAccess::$user->id); } if (!DolibarrApi::_checkAccessToResource('agenda', $this->actioncomm->id, 'actioncomm', '', 'fk_soc', 'id')) { diff --git a/htdocs/comm/action/class/ical.class.php b/htdocs/comm/action/class/ical.class.php index 26db2cd5e6e..273c291d618 100644 --- a/htdocs/comm/action/class/ical.class.php +++ b/htdocs/comm/action/class/ical.class.php @@ -33,6 +33,11 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php'; */ class ICal { + /** + * @var string Name of remote HTTP file to read + */ + public $file; + // Text in file public $file_text; public $cal; // Array to save iCalendar parse data diff --git a/htdocs/comm/mailing/class/mailing.class.php b/htdocs/comm/mailing/class/mailing.class.php index 4371848c522..5e5917d2df3 100644 --- a/htdocs/comm/mailing/class/mailing.class.php +++ b/htdocs/comm/mailing/class/mailing.class.php @@ -170,6 +170,11 @@ class Mailing extends CommonObject */ public $date_validation; + /** + * @var int date sending + */ + public $date_envoi; + /** * @var array extraparams */ diff --git a/htdocs/comm/propal/class/propalestats.class.php b/htdocs/comm/propal/class/propalestats.class.php index 028c6aacc18..bc32f1c600a 100644 --- a/htdocs/comm/propal/class/propalestats.class.php +++ b/htdocs/comm/propal/class/propalestats.class.php @@ -62,8 +62,6 @@ class PropaleStats extends Stats */ public function __construct($db, $socid = 0, $userid = 0, $mode = 'customer', $typentid = 0, $categid = 0) { - global $user, $conf; - $this->db = $db; $this->socid = ($socid > 0 ? $socid : 0); $this->userid = $userid; diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 0d5d5519061..0884ac3f213 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -263,7 +263,7 @@ class FactureRec extends CommonInvoice $this->db->begin(); - // Charge facture modele + // Load invoice template $facsrc = new Facture($this->db); $result = $facsrc->fetch($facid); if ($result > 0) { diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 87f3ad7733a..a43ab55f64c 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -431,11 +431,22 @@ abstract class CommonObject * @var string multicurrency code */ public $multicurrency_code; - /** * @var string multicurrency tx */ public $multicurrency_tx; + /** + * @var string multicurrency total_ht + */ + public $multicurrency_total_ht; + /** + * @var string multicurrency total_tva + */ + public $multicurrency_total_tva; + /** + * @var string multicurrency total_ttc + */ + public $multicurrency_total_ttc; /** * @var string diff --git a/htdocs/core/class/stats.class.php b/htdocs/core/class/stats.class.php index 3636c9335bd..c13ecd05afc 100644 --- a/htdocs/core/class/stats.class.php +++ b/htdocs/core/class/stats.class.php @@ -33,6 +33,28 @@ abstract class Stats protected $lastfetchdate = array(); // Dates of cache file read by methods public $cachefilesuffix = ''; // Suffix to add to name of cache file (to avoid file name conflicts) + /** + * @var string To store the FROM part of the main table of the SQL request + */ + public $from; + /** + * @var string To store the FROM part of the line table of the SQL request + */ + public $from_line; + /** + * @var string To store the field of the date + */ + public $field_date; + /** + * @var string To store the field for total HT + */ + public $field; + /** + * @var string To store the FROM part of the line table of the SQL request + */ + public $field_line; + + /** * @param int $year number * @param int $format 0=Label of abscissa is a translated text, 1=Label of abscissa is month number, 2=Label of abscissa is first letter of month