';
print $langs->trans("Type")." ";
if ($action == 'edit' && $object->getSommePaiement() == 0) {
- $formsocialcontrib->select_type_socialcontrib(GETPOST("actioncode", 'alpha') ? GETPOST("actioncode", 'alpha') : $object->type, 'actioncode', 1);
+ $actionPostValue = GETPOSTINT('actioncode');
+ $formsocialcontrib->select_type_socialcontrib($actionPostValue ? $actionPostValue : $object->type, 'actioncode', 1);
} else {
print $object->type_label;
}
diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php
index 99169e06a0246..cb464d87482be 100644
--- a/htdocs/compta/sociales/class/chargesociales.class.php
+++ b/htdocs/compta/sociales/class/chargesociales.class.php
@@ -65,20 +65,43 @@ class ChargeSociales extends CommonObject
* @var string label
*/
public $label;
+ /**
+ * @var int
+ */
public $type;
+ /**
+ * @var string
+ */
public $type_label;
+ /**
+ * @var string
+ */
public $type_code;
+ /**
+ * @var string
+ */
public $type_accountancy_code;
+ /**
+ * @var int|string
+ */
public $amount;
+ /**
+ * @var int<0,1>
+ */
public $paye;
/**
- * @deprecated
+ * @deprecated Use $period
+ * @var int|string
*/
public $periode;
+ /**
+ * @var int|string
+ */
public $period;
/**
+ * @var string
* @deprecated Use label instead
*/
public $lib;
@@ -102,7 +125,13 @@ class ChargeSociales extends CommonObject
* @var int ID
*/
public $mode_reglement_id;
+ /**
+ * @var string
+ */
public $mode_reglement_code;
+ /**
+ * @var string
+ */
public $mode_reglement;
/**
@@ -301,7 +330,7 @@ public function delete($user)
// Get bank transaction lines for this social contributions
include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$account = new Account($this->db);
- $lines_url = $account->get_url('', $this->id, 'sc');
+ $lines_url = $account->get_url(0, $this->id, 'sc');
// Delete bank urls
foreach ($lines_url as $line_url) {
@@ -520,8 +549,8 @@ public function setUnpaid($user)
/**
* Retourne le libelle du statut d'une charge (impaye, payee)
*
- * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=Long label + picto
- * @param double $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommend to put here amount paid if you have it, 1 otherwise)
+ * @param int<0,6> $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=Long label + picto
+ * @param float $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommend to put here amount paid if you have it, 1 otherwise)
* @return string Label
*/
public function getLibStatut($mode = 0, $alreadypaid = -1)
@@ -535,7 +564,7 @@ public function getLibStatut($mode = 0, $alreadypaid = -1)
*
* @param int $status Id status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=Long label + picto
- * @param double $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommend to put here amount paid if you have it, 1 otherwise)
+ * @param float $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommend to put here amount paid if you have it, 1 otherwise)
* @return string Label
*/
public function LibStatut($status, $mode = 0, $alreadypaid = -1)
@@ -792,7 +821,7 @@ public function getKanbanView($option = '', $arraydata = null)
if (property_exists($this, 'label')) {
$return .= ' '.$this->label.'
';
}
- if (!empty($arraydata['project']) && $arraydata['project']->id > 0) {
+ if (!empty($arraydata['project']) && $arraydata['project'] instanceof Project && $arraydata['project']->id > 0) {
$return .= ''.$arraydata['project']->getNomUrl(1).' ';
}
if (property_exists($this, 'date_ech')) {
diff --git a/htdocs/compta/sociales/document.php b/htdocs/compta/sociales/document.php
index 0666335cc4dd7..bf22354189bb4 100644
--- a/htdocs/compta/sociales/document.php
+++ b/htdocs/compta/sociales/document.php
@@ -6,6 +6,7 @@
* Copyright (C) 2005 Simon TOSSER
* Copyright (C) 2011 Juanjo Menent
* Copyright (C) 2013 Cédric Salvador
+ * Copyright (C) 2024 MDW
*
* 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
@@ -90,7 +91,7 @@
if ($action == 'setlib' && $user->hasRight('tax', 'charges', 'creer')) {
$object->fetch($id);
- $result = $object->setValueFrom('libelle', GETPOST('lib'), '', '', 'text', '', $user, 'TAX_MODIFY');
+ $result = $object->setValueFrom('libelle', GETPOST('lib'), '', null, 'text', '', $user, 'TAX_MODIFY');
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
diff --git a/htdocs/compta/sociales/info.php b/htdocs/compta/sociales/info.php
index e6ad49531293a..80c4c9b291a98 100644
--- a/htdocs/compta/sociales/info.php
+++ b/htdocs/compta/sociales/info.php
@@ -1,5 +1,6 @@
+ * Copyright (C) 2024 MDW
*
* 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
@@ -56,7 +57,7 @@
if ($action == 'setlib' && $user->hasRight('tax', 'charges', 'creer')) {
$object->fetch($id);
- $result = $object->setValueFrom('libelle', GETPOST('lib'), '', '', 'text', '', $user, 'TAX_MODIFY');
+ $result = $object->setValueFrom('libelle', GETPOST('lib'), '', null, 'text', '', $user, 'TAX_MODIFY');
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
diff --git a/htdocs/compta/tva/card.php b/htdocs/compta/tva/card.php
index d5687c9f25f5d..03ac361feada0 100644
--- a/htdocs/compta/tva/card.php
+++ b/htdocs/compta/tva/card.php
@@ -5,6 +5,7 @@
* Copyright (C) 2015-2023 Alexandre Spangaro
* Copyright (C) 2018-2024 Frédéric France
* Copyright (C) 2021 Gauthier VERDOL
+ * Copyright (C) 2024 MDW
*
* 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
@@ -115,7 +116,7 @@
if ($action == 'setlib' && $user->hasRight('tax', 'charges', 'creer')) {
$object->fetch($id);
- $result = $object->setValueFrom('label', GETPOST('lib', 'alpha'), '', '', 'text', '', $user, 'TAX_MODIFY');
+ $result = $object->setValueFrom('label', GETPOST('lib', 'alpha'), '', null, 'text', '', $user, 'TAX_MODIFY');
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
diff --git a/htdocs/compta/tva/document.php b/htdocs/compta/tva/document.php
index b9cf49d5dff47..cac5f7898cd03 100644
--- a/htdocs/compta/tva/document.php
+++ b/htdocs/compta/tva/document.php
@@ -7,6 +7,7 @@
* Copyright (C) 2011 Juanjo Menent
* Copyright (C) 2013 Cédric Salvador
* Copyright (C) 2018 Philippe Grand
+ * Copyright (C) 2024 MDW
*
* 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
@@ -91,7 +92,7 @@
if ($action == 'setlib' && $permissiontoadd) {
$object->fetch($id);
- $result = $object->setValueFrom('label', GETPOST('lib', 'alpha'), '', '', 'text', '', $user, 'TAX_MODIFY');
+ $result = $object->setValueFrom('label', GETPOST('lib', 'alpha'), '', null, 'text', '', $user, 'TAX_MODIFY');
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
diff --git a/htdocs/compta/tva/info.php b/htdocs/compta/tva/info.php
index 3e02aaa8c0cf7..922c6d6dfd06b 100644
--- a/htdocs/compta/tva/info.php
+++ b/htdocs/compta/tva/info.php
@@ -1,5 +1,6 @@
+ * Copyright (C) 2024 MDW
*
* 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
@@ -49,7 +50,7 @@
if ($action == 'setlib' && $user->hasRight('tax', 'charges', 'creer')) {
$object->fetch($id);
- $result = $object->setValueFrom('label', GETPOST('lib', 'alpha'), '', '', 'text', '', $user, 'TAX_MODIFY');
+ $result = $object->setValueFrom('label', GETPOST('lib', 'alpha'), '', null, 'text', '', $user, 'TAX_MODIFY');
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php
index a3a6ba51d34c4..c08400b749ea3 100644
--- a/htdocs/contact/card.php
+++ b/htdocs/contact/card.php
@@ -896,7 +896,7 @@
if (!empty($socid)) {
print ''.$langs->trans("ContactByDefaultFor").' ';
print '';
- $contactType = $object->listeTypeContacts('external', '', 1);
+ $contactType = $object->listeTypeContacts('external', 0, 1);
print img_picto('', 'contact', 'class="pictofixedwidth"').$form->multiselectarray('roles', $contactType, array(), 0, 0, '', 0, '90%');
print ' ';
}
diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php
index 849b1ebafb24b..5fb5b3676068b 100644
--- a/htdocs/contrat/card.php
+++ b/htdocs/contrat/card.php
@@ -93,6 +93,8 @@
$object = new Contrat($db);
$extrafields = new ExtraFields($db);
$ret = 0;
+$pu_ht = null; // Init for static analysis
+$pu_ttc = null; // Init for static analysis
// Load object
if ($id > 0 || !empty($ref) && $action != 'add') {
diff --git a/htdocs/core/actions_setmoduleoptions.inc.php b/htdocs/core/actions_setmoduleoptions.inc.php
index e71f68f8ce31f..39b2826e71247 100644
--- a/htdocs/core/actions_setmoduleoptions.inc.php
+++ b/htdocs/core/actions_setmoduleoptions.inc.php
@@ -1,5 +1,6 @@
+ * Copyright (C) 2024 MDW
*
* 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
@@ -34,6 +35,11 @@
return;
}
+'
+@phan-var-force FormSetup $formSetup
+';
+
+$upload_dir = null;
if ($action == 'update' && !empty($arrayofparameters) && is_array($arrayofparameters) && !empty($user->admin)) {
$db->begin();
diff --git a/htdocs/core/ajax/saveinplace.php b/htdocs/core/ajax/saveinplace.php
index 47fd89b165912..5caa21f0cfc26 100644
--- a/htdocs/core/ajax/saveinplace.php
+++ b/htdocs/core/ajax/saveinplace.php
@@ -98,6 +98,7 @@
$savemethod = GETPOST('savemethod', 'alpha', 2);
$savemethodname = (!empty($savemethod) ? $savemethod : 'setValueFrom');
$newelement = $element;
+ $subelement = null;
$view = '';
$format = 'text';
@@ -203,6 +204,7 @@
dol_include_once('/'.$module.'/class/actions_'.$subelement.'.class.php');
$classname = 'Actions'.ucfirst($subelement);
$object = new $classname($db);
+ '@phan-var-force CommonHookActions $object';
$ret = $object->$loadmethodname();
if ($ret > 0) {
$loadcache = $object->$loadcachename;
diff --git a/htdocs/core/ajax/ziptown.php b/htdocs/core/ajax/ziptown.php
index 6ecfbb387f9b9..251ced7bab9e6 100644
--- a/htdocs/core/ajax/ziptown.php
+++ b/htdocs/core/ajax/ziptown.php
@@ -132,7 +132,7 @@
$row_array['state_id'] = $row['state_id'];
// TODO Use a cache here to avoid to make select_state in each pass (this make a SQL and lot of logs)
- $row_array['states'] = $formcompany->select_state('', $row['country_id'], '');
+ $row_array['states'] = $formcompany->select_state(0, $row['country_id'], '');
array_push($return_arr, $row_array);
}
diff --git a/htdocs/core/class/CSMSFile.class.php b/htdocs/core/class/CSMSFile.class.php
index 7fe6fb1451314..cf03bf06c78a0 100644
--- a/htdocs/core/class/CSMSFile.class.php
+++ b/htdocs/core/class/CSMSFile.class.php
@@ -65,21 +65,48 @@ class CSMSFile
* @var string address to
*/
public $addr_to;
+ /**
+ * @var int
+ */
public $deferred;
+ /**
+ * @var int
+ */
public $priority;
+ /**
+ * @var int
+ */
public $class;
+ /**
+ * @var string
+ */
public $message;
/**
* @var bool
*/
public $nostop;
+ /**
+ * @var int
+ */
public $socid;
+ /**
+ * @var int
+ */
public $contact_id;
+ /**
+ * @var int
+ */
public $member_id;
+ /**
+ * @var int
+ */
public $fk_project;
+ /**
+ * @var int
+ */
public $deliveryreceipt;
@@ -169,6 +196,7 @@ public function sendfile()
if (class_exists($classname)) {
$sms = new $classname($this->db);
+ '@phan-var-force OvhSms $sms'; // Using original for analysis
$sms->expe = $this->addr_from;
$sms->dest = $this->addr_to;
diff --git a/htdocs/core/class/canvas.class.php b/htdocs/core/class/canvas.class.php
index 372e721acda81..9c49e9071b795 100644
--- a/htdocs/core/class/canvas.class.php
+++ b/htdocs/core/class/canvas.class.php
@@ -1,6 +1,7 @@
* Copyright (C) 2011 Laurent Destailleur
+ * Copyright (C) 2024 MDW
*
* 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,14 +44,35 @@ class Canvas
*/
public $errors = array();
+ /**
+ * @var string
+ */
public $actiontype;
+ /**
+ * @var string Module directory
+ */
public $dirmodule; // Module directory
+ /**
+ * @var string
+ */
public $targetmodule; // Module concerned by canvas (ex: thirdparty, contact, ...)
+ /**
+ * @var string
+ */
public $canvas; // Name of canvas (ex: company, individual, product, service, ...)
+ /**
+ * @var string
+ */
public $card; // Tab (sub-canvas)
- public $template_dir; // Initialized by getCanvas with templates directory
+ /**
+ * @var string Initialized by getCanvas with templates directory
+ */
+ public $template_dir;
+ /**
+ * @var ActionsContactCardCommon|ActionsAdherentCardCommon|ActionsCardProduct|ActionsCardService|ActionsCardCommon
+ */
public $control; // Initialized by getCanvas with controller instance
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index 56885dfe6c8cc..6fa140f2ea8eb 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -3676,6 +3676,7 @@ public function update_ref_ext($ref_ext)
$sql = "UPDATE ".$this->db->prefix().$this->table_element;
$sql .= " SET ref_ext = '".$this->db->escape($ref_ext)."'";
+ // @phan-suppress-next-line PhanUndeclaredProperty
$sql .= " WHERE ".(isset($this->table_rowid) ? $this->table_rowid : 'rowid')." = ".((int) $this->id);
dol_syslog(get_class($this)."::update_ref_ext", LOG_DEBUG);
@@ -4036,7 +4037,9 @@ public function update_price($exclspec = 0, $roundingadjust = 'auto', $nodatabas
}
// Add revenue stamp to total
+ // @phan-suppress-next-line PhanUndeclaredProperty
$this->total_ttc += isset($this->revenuestamp) ? $this->revenuestamp : 0;
+ // @phan-suppress-next-line PhanUndeclaredProperty
$this->multicurrency_total_ttc += isset($this->revenuestamp) ? ($this->revenuestamp * $multicurrency_tx) : 0;
// Situations totals
@@ -5472,6 +5475,7 @@ public function printOriginLine($line, $var, $restrictlist = '', $defaulttpldir
//var_dump($line);
if (!empty($line->date_start)) {
+ // @phan-suppress-next-line PhanUndeclaredProperty
$date_start = $line->date_start;
} else {
$date_start = $line->date_debut_prevue;
@@ -5480,6 +5484,7 @@ public function printOriginLine($line, $var, $restrictlist = '', $defaulttpldir
}
}
if (!empty($line->date_end)) {
+ // @phan-suppress-next-line PhanUndeclaredProperty
$date_end = $line->date_end;
} else {
$date_end = $line->date_fin_prevue;
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index eda9c1292e134..c1d2f0ebe5b86 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -2097,7 +2097,7 @@ public function select_remises($selected, $htmlname, $filter, $socid, $maxvalue
* @param int<0,1> $show_empty 0=liste sans valeur nulle, 1=ajoute valeur inconnue
* @param int[] $exclude Array list of users id to exclude
* @param int<0,1> $disabled If select list must be disabled
- * @param int[]|string $include Array list of users id to include. User '' for all users or 'hierarchy' to have only supervised users or 'hierarchyme' to have supervised + me
+ * @param int[]|''|'hierarchy'|'hierarchyme' $include Array list of users id to include. User '' for all users or 'hierarchy' to have only supervised users or 'hierarchyme' to have supervised + me
* @param int[]|int $enableonly Array list of users id to be enabled. All other must be disabled
* @param string $force_entity '0' or Ids of environment to force
* @return void
@@ -2120,13 +2120,13 @@ public function select_users($selected = '', $htmlname = 'userid', $show_empty =
* @param int<0,1>|string $show_empty 0=list with no empty value, 1=add also an empty value into list
* @param int[]|null $exclude Array list of users id to exclude
* @param int $disabled If select list must be disabled
- * @param int[]|string $include Array list of users id to include. User '' for all users or 'hierarchy' to have only supervised users or 'hierarchyme' to have supervised + me
- * @param array|string $enableonly Array list of users id to be enabled. If defined, it means that others will be disabled
+ * @param int[]|''|'hierarchy'|'hierarchyme' $include Array list of users id to include. User '' for all users or 'hierarchy' to have only supervised users or 'hierarchyme' to have supervised + me
+ * @param int[]|'' $enableonly Array list of users id to be enabled. If defined, it means that others will be disabled
* @param string $force_entity '0' or list of Ids of environment to force, separated by a coma, or 'default' = do no extend to all entities allowed to superadmin.
* @param int $maxlength Maximum length of string into list (0=no limit)
* @param int<-1,1> $showstatus 0=show user status only if status is disabled, 1=always show user status into label, -1=never show user status
* @param string $morefilter Add more filters into sql request (Example: '(employee:=:1)'). This value must not come from user input.
- * @param integer $show_every 0=default list, 1=add also a value "Everybody" at beginning of list
+ * @param int<0,1> $show_every 0=default list, 1=add also a value "Everybody" at beginning of list
* @param string $enableonlytext If option $enableonlytext is set, we use this text to explain into label why record is disabled. Not used if enableonly is empty.
* @param string $morecss More css
* @param int<0,1> $notdisabled Show only active users (note: this will also happen, whatever is this option, if USER_HIDE_INACTIVE_IN_COMBOBOX is on).
diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php
index b71662f1f8849..30d7a793f7638 100644
--- a/htdocs/core/class/html.formcompany.class.php
+++ b/htdocs/core/class/html.formcompany.class.php
@@ -45,9 +45,9 @@ class FormCompany extends Form
/**
* Return list of labels (translated) of third parties type
*
- * @param int $mode 0=Return id+label, 1=Return code+label
- * @param string $filter Add a SQL filter to select. Data must not come from user input.
- * @return array Array of types
+ * @param int<0,1> $mode 0=Return id+label, 1=Return code+label
+ * @param string $filter Add a SQL filter to select. Data must not come from user input.
+ * @return array Array of types
*/
public function typent_array($mode = 0, $filter = '')
{
@@ -96,9 +96,9 @@ public function typent_array($mode = 0, $filter = '')
/**
* Return the list of entries for staff (no translation, it is number ranges)
*
- * @param int $mode 0=return id+label, 1=return code+Label
- * @param string $filter Add a SQL filter to select. Data must not come from user input.
- * @return array Array of types d'effectifs
+ * @param int<0,1> $mode 0=return id+label, 1=return code+Label
+ * @param string $filter Add a SQL filter to select. Data must not come from user input.
+ * @return array Array of types d'effectifs
*/
public function effectif_array($mode = 0, $filter = '')
{
@@ -126,13 +126,14 @@ public function effectif_array($mode = 0, $filter = '')
$key = $objp->code;
}
- $effs[$key] = $objp->label != '-' ? $objp->label : '';
+ $effs[$key] = $objp->label != '-' ? (string) $objp->label : '';
$i++;
}
$this->db->free($resql);
}
//return natural sorted list
natsort($effs);
+ '@phan-var-force array $effs';
return $effs;
}
@@ -642,7 +643,7 @@ public function select_juridicalstatus($selected = 0, $country_codeid = 0, $filt
* @param string $var_id Name of id field
* @param int $selected Pre-selected third party
* @param string $htmlname Name of HTML form
- * @param array $limitto Disable answers that are not id in this array list
+ * @param int[] $limitto Disable answers that are not id in this array list
* @param int $forceid This is to force another object id than object->id
* @param string $moreparam String with more param to add into url when noajax search is used.
* @param string $morecss More CSS on select component
@@ -768,6 +769,7 @@ function(response) {
$num = $this->db->num_rows($resql);
$i = 0;
+ $firstCompany = 0; // For static analysis
if ($num) {
while ($i < $num) {
$obj = $this->db->fetch_object($resql);
@@ -808,15 +810,15 @@ function(response) {
/**
* Return a select list with types of contacts
*
- * @param object $object Object to use to find type of contact
+ * @param Object $object Object to use to find type of contact
* @param string $selected Default selected value
* @param string $htmlname HTML select name
* @param string $source Source ('internal' or 'external')
* @param string $sortorder Sort criteria ('position', 'code', ...)
* @param int $showempty 1=Add en empty line
* @param string $morecss Add more css to select component
- * @param int $output 0=return HTML, 1= direct print
- * @param int $forcehidetooltip Force hide tooltip for admin
+ * @param int<0,1> $output 0=return HTML, 1= direct print
+ * @param int<0,1> $forcehidetooltip Force hide tooltip for admin
* @return string|void Depending on $output param, return the HTML select list (recommended method) or nothing
*/
public function selectTypeContact($object, $selected, $htmlname = 'type', $source = 'internal', $sortorder = 'position', $showempty = 0, $morecss = '', $output = 1, $forcehidetooltip = 0)
@@ -825,6 +827,7 @@ public function selectTypeContact($object, $selected, $htmlname = 'type', $sourc
$out = '';
if (is_object($object) && method_exists($object, 'liste_type_contact')) {
+ '@phan-var-force CommonObject $object'; // CommonObject has the method.
$lesTypes = $object->liste_type_contact($source, $sortorder, 0, 1); // List of types into c_type_contact for element=$object->element
$out .= '';
@@ -860,7 +863,7 @@ public function selectTypeContact($object, $selected, $htmlname = 'type', $sourc
* @param string $htmlname Html component name and id
* @param Contact $contact Contact Object
* @param string $rendermode view, edit
- * @param array $selected $key=>$val $val is selected Roles for input mode
+ * @param array $selected $key=>$val $val is selected Roles for input mode
* @param string $morecss More css
* @param string $placeholder Placeholder text (used when $rendermode is 'edit')
* @return string String with contacts roles
@@ -876,7 +879,7 @@ public function showRoles($htmlname, Contact $contact, $rendermode = 'view', $se
}
if ($rendermode === 'edit') { // A multiselect combo list
- $contactType = $contact->listeTypeContacts('external', '', 1, '', '', 'agenda'); // We exclude agenda as there is no contact on such element
+ $contactType = $contact->listeTypeContacts('external', 0, 1, '', '', 'agenda'); // We exclude agenda as there is no contact on such element
if (count($selected) > 0) {
$newselected = array();
foreach ($selected as $key => $val) {
@@ -934,12 +937,12 @@ public function select_ziptown($selected = '', $htmlname = 'zipcode', $fields =
/**
* Return HTML string to use as input of professional id into a HTML page (siren, siret, etc...)
*
- * @param int $idprof 1,2,3,4 (Example: 1=siren,2=siret,3=naf,4=rcs/rm)
- * @param string $htmlname Name of HTML select
- * @param string $preselected Default value to show
- * @param string $country_code FR, IT, ...
- * @param string $morecss More css
- * @return string HTML string with prof id
+ * @param int<1,4> $idprof 1,2,3,4 (Example: 1=siren,2=siret,3=naf,4=rcs/rm)
+ * @param string $htmlname Name of HTML select
+ * @param string $preselected Default value to show
+ * @param string $country_code FR, IT, ...
+ * @param string $morecss More css
+ * @return string HTML string with prof id
*/
public function get_input_id_prof($idprof, $htmlname, $preselected, $country_code, $morecss = 'maxwidth200')
{
@@ -1155,7 +1158,7 @@ public function formThirdpartyType($page, $selected = '', $htmlname = 'socid', $
* Output html select to select prospect status
*
* @param string $htmlname Name of HTML select
- * @param Societe|null $prospectstatic Prospect object
+ * @param Contact|null $prospectstatic Prospect object
* @param int $statusprospect status of prospect
* @param int $idprospect id of prospect
* @param string $mode select if we want activate de html part or js
diff --git a/htdocs/core/class/html.formsocialcontrib.class.php b/htdocs/core/class/html.formsocialcontrib.class.php
index ea325a4b591d4..06d0f4ae8d3a7 100644
--- a/htdocs/core/class/html.formsocialcontrib.class.php
+++ b/htdocs/core/class/html.formsocialcontrib.class.php
@@ -1,5 +1,6 @@
+ * Copyright (C) 2024 MDW
*
* 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
@@ -53,16 +54,16 @@ public function __construct($db)
* Return list of social contributions.
* Use mysoc->country_id or mysoc->country_code so they must be defined.
*
- * @param string $selected Preselected type
- * @param string $htmlname Name of field in form
- * @param int $useempty Set to 1 if we want an empty value
- * @param int $maxlen Max length of text in combo box
- * @param int $help Add or not the admin help picto
- * @param string $morecss Add more CSS on select
- * @param int $noerrorifempty No print error if list is empty for the country
+ * @param int $selected Preselected type
+ * @param string $htmlname Name of field in form
+ * @param int<0,1> $useempty Set to 1 if we want an empty value
+ * @param int $maxlen Max length of text in combo box
+ * @param int<0,1> $help Add or not the admin help picto
+ * @param string $morecss Add more CSS on select
+ * @param int<0,1> $noerrorifempty No print error if list is empty for the country
* @return void
*/
- public function select_type_socialcontrib($selected = '', $htmlname = 'actioncode', $useempty = 0, $maxlen = 40, $help = 1, $morecss = 'minwidth300', $noerrorifempty = 0)
+ public function select_type_socialcontrib($selected = 0, $htmlname = 'actioncode', $useempty = 0, $maxlen = 40, $help = 1, $morecss = 'minwidth300', $noerrorifempty = 0)
{
// phpcs:enable
global $conf, $db, $langs, $user, $mysoc;
diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php
index 7b33aed608877..20d9d1c519238 100644
--- a/htdocs/core/class/html.formticket.class.php
+++ b/htdocs/core/class/html.formticket.class.php
@@ -66,61 +66,136 @@ class FormTicket
*/
public $fk_user_create;
+ /**
+ * @var string
+ */
public $message;
+ /**
+ * @var string
+ */
public $topic_title;
+ /**
+ * @var string
+ */
public $action;
+ /**
+ * @var int<0,1>
+ */
public $withtopic;
+ /**
+ * @var int<0,1>
+ */
public $withemail;
/**
- * @var int $withsubstit Show substitution array
+ * @var int<0,1> $withsubstit Show substitution array
*/
public $withsubstit;
+ /**
+ * @var int<0,2>
+ */
public $withfile;
+ /**
+ * @var int<0,1>
+ */
public $withfilereadonly;
+ /**
+ * @var string
+ */
public $backtopage;
+ /**
+ * @var int<0,1>
+ */
public $ispublic; // to show information or not into public form
+ /**
+ * @var int<0,1>
+ */
public $withtitletopic;
+ /**
+ * @var int<0,1>
+ */
public $withtopicreadonly;
+ /**
+ * @var int<0,1>
+ */
public $withreadid;
+ /**
+ * @var int<0,1>
+ */
public $withcompany; // to show company drop-down list
+ /**
+ * @var int<0,1>
+ */
public $withfromsocid;
+ /**
+ * @var int<0,1>
+ */
public $withfromcontactid;
+ /**
+ * @var int<0,1>
+ */
public $withnotifytiersatcreate;
+ /**
+ * @var int<0,1>
+ */
public $withusercreate; // to show name of creating user in form
+ /**
+ * @var int<0,1>
+ */
public $withcreatereadonly;
/**
- * @var int withextrafields
+ * @var int<0,1> withextrafields
*/
public $withextrafields;
+ /**
+ * @var int<0,1>
+ */
public $withref; // to show ref field
+ /**
+ * @var int<0,1>
+ */
public $withcancel;
+ /**
+ * @var string
+ */
public $type_code;
+ /**
+ * @var string
+ */
public $category_code;
+ /**
+ * @var string
+ */
public $severity_code;
/**
*
- * @var array $substit Substitutions
+ * @var array $substit Substitutions
*/
public $substit = array();
+ /**
+ * @var array
+ */
public $param = array();
/**
* @var string Error code (or message)
*/
public $error;
+ /**
+ * @var string[]
+ */
public $errors = array();
@@ -137,7 +212,7 @@ public function __construct($db)
$this->action = 'add';
- $this->withcompany = !getDolGlobalInt("TICKETS_NO_COMPANY_ON_FORM") && isModEnabled("societe");
+ $this->withcompany = (int) (!getDolGlobalInt("TICKETS_NO_COMPANY_ON_FORM") && isModEnabled("societe"));
$this->withfromsocid = 0;
$this->withfromcontactid = 0;
$this->withreadid = 0;
@@ -174,12 +249,12 @@ public static function checkRequiredFields(array $fields, int &$errors)
/**
* Show the form to input ticket
*
- * @param int $withdolfichehead With dol_get_fiche_head() and dol_get_fiche_end()
- * @param string $mode Mode ('create' or 'edit')
- * @param int $public 1=If we show the form for the public interface
- * @param ?Contact $with_contact [=NULL] Contact to link to this ticket if it exists
- * @param string $action [=''] Action in card
- * @param ?Ticket $object [=NULL] Ticket object
+ * @param int $withdolfichehead With dol_get_fiche_head() and dol_get_fiche_end()
+ * @param 'create'|'edit' $mode Mode ('create' or 'edit')
+ * @param int<0,1> $public 1=If we show the form for the public interface
+ * @param ?Contact $with_contact [=NULL] Contact to link to this ticket if it exists
+ * @param string $action [=''] Action in card
+ * @param ?Ticket $object [=NULL] Ticket object
* @return void
*/
public function showForm($withdolfichehead = 0, $mode = 'edit', $public = 0, $with_contact = null, $action = '', $object = null)
@@ -371,6 +446,7 @@ function(response) {
dol_include_once('/'.$element.'/class/'.$subelement.'.class.php');
$classname = ucfirst($subelement);
$objectsrc = new $classname($this->db);
+ '@phan-var-force CommonObject $objectsrc';
$objectsrc->fetch(GETPOSTINT('originid'));
if (empty($objectsrc->lines) && method_exists($objectsrc, 'fetch_lines')) {
@@ -514,7 +590,7 @@ function groupticketchange() {
if (count($cate_arbo)) {
// Categories
print '';
- print img_picto('', 'category', 'class="pictofixedwidth"').$form->multiselectarray('categories', $cate_arbo, GETPOST('categories', 'array'), '', 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0, '', '', $langs->transnoentitiesnoconv("Categories"));
+ print img_picto('', 'category', 'class="pictofixedwidth"').$form->multiselectarray('categories', $cate_arbo, GETPOST('categories', 'array'), 0, 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0, '', '', $langs->transnoentitiesnoconv("Categories"));
print " ";
}
}
@@ -598,7 +674,7 @@ function groupticketchange() {
$events = array();
$events[] = array('method' => 'getContacts', 'url' => dol_buildpath('/core/ajax/contacts.php', 1), 'htmlname' => 'contactid', 'params' => array('add-customer-contact' => 'disabled'));
print img_picto('', 'company', 'class="paddingright"');
- print $form->select_company($this->withfromsocid, 'socid', '', 1, 1, '', $events, 0, 'minwidth200');
+ print $form->select_company($this->withfromsocid, 'socid', '', 1, 1, 0, $events, 0, 'minwidth200');
print ' ';
if (!empty($conf->use_javascript_ajax) && getDolGlobalString('COMPANY_USE_SEARCH_TO_SELECT')) {
$htmlname = 'socid';
@@ -755,7 +831,7 @@ function(response) {
/**
* Return html list of tickets type
*
- * @param string|array $selected Id of preselected field or array of Ids
+ * @param string|int[] $selected Id of preselected field or array of Ids
* @param string $htmlname Nom de la zone select
* @param string $filtertype To filter on field type in llx_c_ticket_type (array('code'=>xx,'label'=>zz))
* @param int $format 0=id+libelle, 1=code+code, 2=code+libelle, 3=id+code
@@ -1543,7 +1619,7 @@ public function showMessageForm($width = '40%')
// Zone to select its email template
if (count($modelmail_array) > 0) {
print ''."\n";
- print $langs->trans('SelectMailModel').': '.$formmail->selectarray('modelmailselected', $modelmail_array, $this->param['models_id'], 1, 0, "", "", 0, 0, 0, '', 'minwidth200');
+ print $langs->trans('SelectMailModel').': '.$formmail->selectarray('modelmailselected', $modelmail_array, $this->param['models_id'], 1, 0, 0, "", 0, 0, 0, '', 'minwidth200');
if ($user->admin) {
print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
}
diff --git a/htdocs/core/class/interfaces.class.php b/htdocs/core/class/interfaces.class.php
index 98445ef7cef75..5f413215bee06 100644
--- a/htdocs/core/class/interfaces.class.php
+++ b/htdocs/core/class/interfaces.class.php
@@ -37,6 +37,9 @@ class Interfaces
*/
public $db;
+ /**
+ * @var string
+ */
public $dir; // Directory with all core and external triggers files
/**
@@ -184,6 +187,7 @@ public function run_triggers($action, $object, $user, $langs, $conf)
}
$objMod = new $modName($this->db);
+ '@phan-var-force DolibarrTriggers $objMod';
if ($objMod) {
$dblevelbefore = $this->db->transaction_opened;
@@ -194,6 +198,7 @@ public function run_triggers($action, $object, $user, $langs, $conf)
$result = $objMod->runTrigger($action, $object, $user, $langs, $conf);
} elseif (method_exists($objMod, 'run_trigger')) { // Deprecated method
dol_syslog(get_class($this)."::run_triggers action=".$action." Launch old method run_trigger (rename your trigger into runTrigger) for file '".$files[$key]."'", LOG_WARNING);
+ // @phan-suppress-next-line PhanUndeclaredMethod
$result = $objMod->run_trigger($action, $object, $user, $langs, $conf);
} else {
dol_syslog(get_class($this)."::run_triggers action=".$action." A trigger was declared for class ".get_class($objMod)." but method runTrigger was not found", LOG_ERR);
@@ -248,8 +253,8 @@ public function run_triggers($action, $object, $user, $langs, $conf)
* Return list of triggers. Function used by admin page htdoc/admin/triggers.
* List is sorted by trigger filename so by priority to run.
*
- * @param array $forcedirtriggers null=All default directories. This parameter is used by modulebuilder module only.
- * @return array Array list of triggers
+ * @param ?array
$forcedirtriggers null=All default directories. This parameter is used by modulebuilder module only.
+ * @return array Array list of triggers
*/
public function getTriggersList($forcedirtriggers = null)
{
@@ -334,6 +339,7 @@ public function getTriggersList($forcedirtriggers = null)
try {
$objMod = new $modName($db);
+ '@phan-var-force DolibarrTriggers $objMod';
if (is_subclass_of($objMod, 'DolibarrTriggers')) {
// Define disabledbyname and disabledbymodule
@@ -395,7 +401,7 @@ public function getTriggersList($forcedirtriggers = null)
$triggers[$j]['status'] = img_picto('Error: Trigger '.$modName.' does not extends DolibarrTriggers', 'warning');
//print 'Error: Trigger '.$modName.' does not extends DolibarrTriggers ';
- $text = 'Error: Trigger '.$modName.' does not extends DolibarrTriggers';
+ $text = 'Error: Trigger '.$modName.' does not extend DolibarrTriggers';
}
} catch (Exception $e) {
print $e->getMessage();
diff --git a/htdocs/core/class/rssparser.class.php b/htdocs/core/class/rssparser.class.php
index ed3c969022b81..3ed09b6c7b54f 100644
--- a/htdocs/core/class/rssparser.class.php
+++ b/htdocs/core/class/rssparser.class.php
@@ -261,7 +261,7 @@ public function getLastFetchDate()
/**
* getItems
*
- * @return array
+ * @return array
*/
public function getItems()
{
diff --git a/htdocs/core/class/validate.class.php b/htdocs/core/class/validate.class.php
index 1c1a895aa2a6e..b0c986797a51d 100644
--- a/htdocs/core/class/validate.class.php
+++ b/htdocs/core/class/validate.class.php
@@ -1,5 +1,6 @@
+ * Copyright (C) 2024 MDW
*
* 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
@@ -261,7 +262,7 @@ public function isBool($bool)
/**
* Check for all values in db
*
- * @param array $values Boolean to validate
+ * @param string[] $values Boolean to validate
* @param string $table the db table name without $this->db->prefix()
* @param string $col the target col
* @return boolean Validity is ok or not
@@ -313,6 +314,7 @@ public function isFetchable($id, $classname, $classpath)
if ($classname && class_exists($classname)) {
/** @var CommonObject $object */
$object = new $classname($this->db);
+ '@phan-var-force CommonObject|User $object'; // User provided to propose a class with 'fetch'
if (!is_callable(array($object, 'fetch')) || !is_callable(array($object, 'isExistingObject'))) {
$this->error = $this->outputLang->trans('BadSetupOfFieldFetchNotCallable');
diff --git a/htdocs/core/class/vcard.class.php b/htdocs/core/class/vcard.class.php
index cbdad2fb2e473..b2f755e54f92d 100644
--- a/htdocs/core/class/vcard.class.php
+++ b/htdocs/core/class/vcard.class.php
@@ -67,7 +67,7 @@ function dol_quoted_printable_encode($input, $line_max = 76)
} elseif (($dec == 61) || ($dec < 32) || ($dec > 126)) { // always encode "\t", which is *not* required
$h2 = floor($dec / 16);
$h1 = floor($dec % 16);
- $c = $escape.$hex["$h2"].$hex["$h1"];
+ $c = $escape.$hex[(int) $h2].$hex[(int) $h1];
}
if ((strlen($newline) + strlen($c)) >= $line_max) { // CRLF is not counted
$output .= $newline.$escape.$eol; // soft line break; " =\r\n" is okay
@@ -90,7 +90,7 @@ function dol_quoted_printable_encode($input, $line_max = 76)
class vCard
{
/**
- * @var array array of properties
+ * @var array array of properties
*/
public $properties;
@@ -388,8 +388,8 @@ public function getFileName()
* Return a VCARD string
* See RFC https://datatracker.ietf.org/doc/html/rfc6350
*
- * @param Object $object Object (User or Contact)
- * @param Societe|null $company Company. May be null.
+ * @param User|Contact $object Object (User or Contact)
+ * @param ?Societe $company Company. May be null.
* @param Translate $langs Lang object
* @param string $urlphoto Full public URL of photo
* @param string $outdir Directory where to store the temporary file
diff --git a/htdocs/core/customreports.php b/htdocs/core/customreports.php
index 64aad1cb547b8..83d872e4f28bf 100644
--- a/htdocs/core/customreports.php
+++ b/htdocs/core/customreports.php
@@ -40,7 +40,7 @@
$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
$mode = GETPOST('mode', 'alpha');
- $objecttype = GETPOST('objecttype', 'aZ09arobase');
+ $objecttype = (string) GETPOST('objecttype', 'aZ09arobase');
$tabfamily = GETPOST('tabfamily', 'aZ09');
$search_measures = GETPOST('search_measures', 'array');
@@ -58,6 +58,8 @@
$search_groupby = array();
}
+ '@phan-var-force string[] $search_groupby';
+
$search_yaxis = GETPOST('search_yaxis', 'array');
$search_graph = GETPOST('search_graph', 'restricthtml');
@@ -77,6 +79,12 @@
$object = null;
} else {
+ // When included
+ '
+ @phan-var-force int<0,1> $SHOWLEGEND
+ @phan-var-force string customreportkey
+ ';
+
$langs->load("main");
// $search_measures, $search_xaxis or $search_yaxis may have been defined by the parent.
@@ -122,6 +130,8 @@
$title = '';
$picto = '';
+$errormessage = null;
+$keyforlabeloffield = null;
$head = array();
$ObjectClassName = '';
// Objects available by default
@@ -372,17 +382,17 @@
// Check parameters
if ($action == 'viewgraph') {
- if (!count($search_measures)) {
+ if (is_array($search_measures) && !count($search_measures)) {
setEventMessages($langs->trans("AtLeastOneMeasureIsRequired"), null, 'warnings');
- } elseif ($mode == 'graph' && count($search_xaxis) > 1) {
+ } elseif ($mode == 'graph' && is_array($search_xaxis) && count($search_xaxis) > 1) {
setEventMessages($langs->trans("OnlyOneFieldForXAxisIsPossible"), null, 'warnings');
$search_xaxis = array(0 => $search_xaxis[0]);
}
- if (count($search_groupby) >= 2) {
+ if (is_array($search_groupby) && count($search_groupby) >= 2) {
setEventMessages($langs->trans("ErrorOnlyOneFieldForGroupByIsPossible"), null, 'warnings');
$search_groupby = array(0 => $search_groupby[0]);
}
- if (!count($search_xaxis)) {
+ if (is_array($search_xaxis) && !count($search_xaxis)) {
setEventMessages($langs->trans("AtLeastOneXAxisIsRequired"), null, 'warnings');
} elseif ($mode == 'graph' && $search_graph == 'bars' && count($search_measures) > $MAXMEASURESINBARGRAPH) {
$langs->load("errors");
@@ -477,6 +487,7 @@
dol_include_once($classpath);
if (class_exists($classname)) {
$tmpobject = new $classname($db);
+ '@phan-var-force CommonObject $tmpobject';
$tmpobject->fetch($obj->val);
foreach ($tmpobject->fields as $fieldkey => $field) {
if ($field['showoncombobox']) {
diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php
index ee0506f4daaad..afd62190cda0c 100644
--- a/htdocs/core/lib/company.lib.php
+++ b/htdocs/core/lib/company.lib.php
@@ -556,13 +556,13 @@ function societe_admin_prepare_head()
* Return country label, code or id from an id, code or label
*
* @param int|string $searchkey Id or code of country to search
- * @param string $withcode '' or '0' = Return label,
- * '1'=Return code + label,
- * '2'=Return code from id,
- * '3'=Return id from code,
- * 'all'=Return array('id'=>,'code'=>,'label'=>)
- * @param DoliDB $dbtouse Database handler (using in global way may fail because of conflicts with some autoload features)
- * @param Translate $outputlangs Langs object for output translation
+ * @param ''|'0'|'1'|'2'|'3'|'all' $withcode '' or '0' = Return label,
+ * '1'=Return code + label,
+ * '2'=Return code from id,
+ * '3'=Return id from code,
+ * 'all'=Return array('id'=>,'code'=>,'label'=>)
+ * @param ?DoliDB $dbtouse Database handler (using in global way may fail because of conflicts with some autoload features)
+ * @param ?Translate $outputlangs Langs object for output translation
* @param int $entconv 0=Return value without entities and not converted to output charset, 1=Ready for html output
* @param string $searchlabel Label of country to search (warning: searching on label is not reliable)
* @return int|string|array{id:int,code:string,label:string} Integer with country id or String with country code or translated country name or Array('id','code','label') or 'NotDefined'
@@ -2202,7 +2202,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = null, $nopr
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
$out .= getTitleFieldOfList('', 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'maxwidthsearch ');
}
- if ($donetodo) {
+ if ($donetodo && $filterobj !== null) {
$tmp = '';
if (get_class($filterobj) == 'Societe') {
$tmp .= '';
diff --git a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php
index 169fa9d11d18f..0bebaf04e7271 100644
--- a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php
+++ b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php
@@ -71,7 +71,7 @@ public function runTrigger($action, $object, User $user, Translate $langs, Conf
$ret = 0;
// Proposals to order
- if ($action == 'PROPAL_CLOSE_SIGNED') {
+ if ($action == 'PROPAL_CLOSE_SIGNED' && $object instanceof Propal) {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
if (isModEnabled('order') && getDolGlobalString('WORKFLOW_PROPAL_AUTOCREATE_ORDER')) {
$object->fetchObjectLinked();
diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php
index 3c78075a1cec8..65815a286b1e6 100644
--- a/htdocs/emailcollector/class/emailcollector.class.php
+++ b/htdocs/emailcollector/class/emailcollector.class.php
@@ -192,17 +192,53 @@ class EmailCollector extends CommonObject
*/
public $import_key;
+ /**
+ * @var string
+ */
public $host;
+ /**
+ * @var string
+ */
public $port;
+ /**
+ * @var string
+ */
public $hostcharset;
+ /**
+ * @var string
+ */
public $login;
+ /**
+ * @var string
+ */
public $password;
+ /**
+ * @var int
+ */
public $acces_type;
+ /**
+ * @var string
+ */
public $oauth_service;
+ /**
+ * @var string
+ */
public $imap_encryption;
+ /**
+ * @var int<0,1>
+ */
public $norsh;
+ /**
+ * @var string
+ */
public $source_directory;
+ /**
+ * @var string
+ */
public $target_directory;
+ /**
+ * @var int
+ */
public $maxemailpercollect;
/**
@@ -210,14 +246,32 @@ class EmailCollector extends CommonObject
*/
public $datelastresult;
+ /**
+ * @var string
+ */
public $codelastresult;
+ /**
+ * @var string
+ */
public $lastresult;
+ /**
+ * @var int|string
+ */
public $datelastok;
// END MODULEBUILDER PROPERTIES
+ /**
+ * @var array
+ */
public $filters;
+ /**
+ * @var array
+ */
public $actions;
+ /**
+ * @var string
+ */
public $debuginfo;
const STATUS_DISABLED = 0;
@@ -1010,7 +1064,7 @@ private function overwritePropertiesOfObject(&$object, $actionparam, $messagetex
if (property_exists($object, $tmpproperty)) {
$valuecurrent = $object->$tmpproperty;
} else {
- // @phan-suppress-next-line PhanTypeInvalidDimOffset
+ // False positive @phan-suppress-next-line PhanTypeInvalidDimOffset
$valuecurrent = $tmp[$tmpproperty];
}
}
@@ -1105,6 +1159,10 @@ public function doCollectOneCollector($mode = 0)
$searchfilterexcludesubjectarray = array();
$operationslog = '';
$rulesreplyto = array();
+ $connectstringsource = '';
+ $connectstringtarget = '';
+ $connection = false;
+ $arrayofemail = array();
$now = dol_now();
@@ -1264,7 +1322,7 @@ public function doCollectOneCollector($mode = 0)
$this->debuginfo .= 'connectstringsource = '.$connectstringsource.', $connectstringtarget='.$connectstringtarget.' ';
$connection = imap_open($connectstringsource, $this->login, $this->password);
- if (!$connection) {
+ if ($connection === false) {
$this->error = 'Failed to open IMAP connection '.$connectstringsource.' '.imap_last_error();
return -3;
}
@@ -1279,6 +1337,7 @@ public function doCollectOneCollector($mode = 0)
//$search='ALL';
}
+ $criteria = array();
if (getDolGlobalString('MAIN_IMAP_USE_PHPIMAP')) {
// Use PHPIMAP external library
$criteria = array(array('UNDELETED')); // Seems not supported by some servers
@@ -1564,8 +1623,9 @@ public function doCollectOneCollector($mode = 0)
$nbemailok = 0;
$nbactiondone = 0;
$charset = ($this->hostcharset ? $this->hostcharset : "UTF-8");
+ $arrayofemail = array();
- if (getDolGlobalString('MAIN_IMAP_USE_PHPIMAP')) {
+ if (getDolGlobalString('MAIN_IMAP_USE_PHPIMAP') && is_object($client)) {
try {
// Uncomment this to output debug info
//$client->getConnection()->enableDebug();
@@ -1620,7 +1680,7 @@ public function doCollectOneCollector($mode = 0)
dol_syslog("EmailCollector::doCollectOneCollector ".$this->error, LOG_ERR);
return -1;
}
- } else {
+ } elseif ($connection !== false) {
// Scan IMAP dir (for native IMAP, the source dir is inside the $connection variable)
$arrayofemail = imap_search($connection, $search, SE_UID, $charset);
@@ -1638,7 +1698,7 @@ public function doCollectOneCollector($mode = 0)
$arrayofemailtodelete = array(); // Track email to delete to make the deletion at end.
// Loop on each email found
- if (!$error && !empty($arrayofemail) && count($arrayofemail) > 0) {
+ if (!$error && !empty($arrayofemail) && count($arrayofemail) > 0 && $connection !== false) {
// Loop to get part html and plain
/*
0 multipart/mixed
@@ -2620,7 +2680,7 @@ public function doCollectOneCollector($mode = 0)
// Create thirdparty
$thirdpartystatic = new Societe($db);
- $thirdpartystatic->name = $nametouseforthirdparty;
+ $thirdpartystatic->name = (string) (string) $nametouseforthirdparty;
if (!empty($namealiastouseforthirdparty)) {
if ($namealiastouseforthirdparty != $nametouseforthirdparty) {
$thirdpartystatic->name_alias = $namealiastouseforthirdparty;
@@ -2937,7 +2997,7 @@ public function doCollectOneCollector($mode = 0)
'recruitment/recruitmentcandidature' => array('table' => 'recruitment_recruitmentcandidature',
'fields' => array('ref'),
'class' => 'recruitment/class/recruitmentcandidature.class.php',
- 'object' => ' RecruitmentCandidature'),
+ 'object' => 'RecruitmentCandidature'),
'societe' => array('table' => 'societe',
'fields' => array('code_client', 'code_fournisseur'),
'class' => 'societe/class/societe.class.php',
@@ -3131,6 +3191,7 @@ public function doCollectOneCollector($mode = 0)
// Overwrite values with values extracted from source email.
// This may overwrite any $projecttocreate->xxx properties.
$errorforthisaction = $this->overwritePropertiesOfObject($projecttocreate, $operation['actionparam'], $messagetext, $subject, $header, $operationslog);
+ $modele = null;
// Set project ref if not yet defined
if (empty($projecttocreate->ref)) {
@@ -3282,6 +3343,7 @@ public function doCollectOneCollector($mode = 0)
// This may overwrite any $projecttocreate->xxx properties.
$errorforthisaction = $this->overwritePropertiesOfObject($tickettocreate, $operation['actionparam'], $messagetext, $subject, $header, $operationslog);
+ $modele = 'UNDEFINED';
// Set ticket ref if not yet defined
if (empty($tickettocreate->ref)) {
// Get next Ref
diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php
index 3f76f866abd4d..8511cdba691f3 100644
--- a/htdocs/expensereport/class/expensereport.class.php
+++ b/htdocs/expensereport/class/expensereport.class.php
@@ -109,7 +109,7 @@ class ExpenseReport extends CommonObject
* 0=draft, 2=validated (attente approb), 4=canceled, 5=approved, 6=paid, 99=denied
*
* @var int Status
- * @deprecated
+ * @deprecated Use $status
*/
public $fk_statut;
@@ -123,6 +123,9 @@ class ExpenseReport extends CommonObject
*/
public $modepaymentid;
+ /**
+ * @var int
+ */
public $paid;
// Paiement
@@ -141,6 +144,9 @@ class ExpenseReport extends CommonObject
*/
public $user_validator_infos;
+ /**
+ * @var string
+ */
public $rule_warning_message;
// ACTIONS
@@ -244,7 +250,15 @@ class ExpenseReport extends CommonObject
*/
public $fk_user_approve;
+ /**
+ * @var float|int
+ * @deprecated See $total_localtax1
+ */
public $localtax1; // for backward compatibility (real field should be total_localtax1 defined into CommonObject)
+ /**
+ * @var float|int
+ * @deprecated See $total_localtax2
+ */
public $localtax2; // for backward compatibility (real field should be total_localtax2 defined into CommonObject)
/**
@@ -1787,13 +1801,13 @@ public function getTooltipContentArray($params)
/**
* Return clickable name (with picto eventually)
*
- * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
- * @param string $option Where point the link ('', 'document', ..)
- * @param int $max Max length of shown ref
- * @param int $short 1=Return just URL
- * @param string $moretitle Add more text to title tooltip
- * @param int $notooltip 1=Disable tooltip
- * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
+ * @param int<0,2> $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
+ * @param string $option Where points the link ('', 'document', ..)
+ * @param int $max Max length of shown ref
+ * @param int<0,1> $short 1=Return just URL
+ * @param string $moretitle Add more text to title tooltip
+ * @param int<0,1> $notooltip 1=Disable tooltip
+ * @param int<-1,1> $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @return string String with URL
*/
public function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $moretitle = '', $notooltip = 0, $save_lastsearch_value = -1)
@@ -2430,7 +2444,7 @@ public function periode_existe($fuser, $date_debut, $date_fin)
* Return list of people with permission to validate expense reports.
* Search for permission "approve expense report"
*
- * @return array|int Array of user ids, <0 if KO
+ * @return int[]|int<-1,-1> Array of user ids, <0 if KO
*/
public function fetch_users_approver_expensereport()
{
@@ -2469,10 +2483,10 @@ public function fetch_users_approver_expensereport()
*
* @param string $modele Force le mnodele a utiliser ('' to not force)
* @param Translate $outputlangs object lang a utiliser pour traduction
- * @param int $hidedetails Hide details of lines
- * @param int $hidedesc Hide description
- * @param int $hideref Hide ref
- * @param ?array $moreparams Array to provide more information
+ * @param int<0,1> $hidedetails Hide details of lines
+ * @param int<0,1> $hidedesc Hide description
+ * @param int<0,1> $hideref Hide ref
+ * @param ?array $moreparams Array to provide more information
* @return int 0 if KO, 1 if OK
*/
public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null)
@@ -2499,8 +2513,8 @@ public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hided
/**
* List of types
*
- * @param int $active Active or not
- * @return array
+ * @param int<0,1> $active Active or not
+ * @return array
*/
public function listOfTypes($active = 1)
{
@@ -2786,7 +2800,7 @@ public function computeTotalKm($fk_cat, $qty, $tva)
$ranges[$i] = $obj;
}
-
+ '@phan-var-force Object[] $ranges';
for ($i = 0; $i < $num; $i++) {
if ($i < ($num - 1)) {
@@ -2838,7 +2852,7 @@ public function getKanbanView($option = '', $arraydata = null)
if ($selected >= 0) {
$return .= ' ';
}
- if (array_key_exists('userauthor', $arraydata)) {
+ if (array_key_exists('userauthor', $arraydata) && $arraydata['userauthor'] instanceof User) {
$return .= ''.$arraydata['userauthor']->getNomUrl(-1).' ';
}
if (property_exists($this, 'date_debut') && property_exists($this, 'date_fin')) {
diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php
index 64c29099b6bcf..55843f5dced41 100644
--- a/htdocs/holiday/class/holiday.class.php
+++ b/htdocs/holiday/class/holiday.class.php
@@ -59,6 +59,9 @@ class Holiday extends CommonObject
*/
public $fk_user;
+ /**
+ * @var int|string
+ */
public $date_create = '';
/**
@@ -161,9 +164,19 @@ class Holiday extends CommonObject
public $events = array();
public $logs = array();
+
+ /**
+ * @var string
+ */
public $optName = '';
+ /**
+ * @var string
+ */
public $optValue = '';
- public $optRowid = '';
+ /**
+ * @var int
+ */
+ public $optRowid = 0;
/**
* Draft status
@@ -204,7 +217,7 @@ public function __construct($db)
* Returns the reference to the following non used Order depending on the active numbering module
* defined into HOLIDAY_ADDON
*
- * @param Societe $objsoc third party object
+ * @param ?Societe $objsoc third party object
* @return string Holiday free reference
*/
public function getNextNumRef($objsoc)
@@ -1826,7 +1839,7 @@ public function getCPforUser($user_id, $fk_type = 0)
* @param boolean $stringlist If true return a string list of id. If false, return an array with detail.
* @param boolean $type If true, read Dolibarr user list, if false, return vacation balance list.
* @param string $filters Filters. Warning: This must not contains data from user input.
- * @return array{rowid:int,id:int,name:string,lastname:string,firstname:string,gender:string,status:string,employee:string,photo:string,fk_user:int,type?:int,nb_holiday?:int}|string|int<-1,-1> Return an array
+ * @return array|string|int<-1,-1> Return an array
*/
public function fetchUsers($stringlist = true, $type = true, $filters = '')
{
@@ -2037,7 +2050,7 @@ public function fetchUsers($stringlist = true, $type = true, $filters = '')
* Return list of people with permission to validate leave requests.
* Search for permission "approve leave requests"
*
- * @return array|int Array of user ids or -1 if error
+ * @return int[]|int<-1,-1> Array of user ids or -1 if error
*/
public function fetch_users_approver_holiday()
{
@@ -2266,9 +2279,9 @@ public function fetchLog($order, $filter)
/**
* Return array with list of types
*
- * @param int $active Status of type. -1 = Both
- * @param int $affect Filter on affect (a request will change sold or not). -1 = Both
- * @return array Return array with list of types
+ * @param int $active Status of type. -1 = Both
+ * @param int $affect Filter on affect (a request will change sold or not). -1 = Both
+ * @return array Return array with list of types
*/
public function getTypes($active = -1, $affect = -1)
{
diff --git a/htdocs/holiday/define_holiday.php b/htdocs/holiday/define_holiday.php
index ce154f4af629e..48a2d5eb40505 100644
--- a/htdocs/holiday/define_holiday.php
+++ b/htdocs/holiday/define_holiday.php
@@ -5,6 +5,7 @@
* Copyright (C) 2016 Regis Houssin
* Copyright (C) 2024 Frédéric France
* Copyright (C) 2024 Alexandre Spangaro
+ * Copyright (C) 2024 MDW
*
* 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
@@ -264,7 +265,7 @@
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
if ($massaction == 'preincreaseholiday') {
- $langs->load("holiday", "hrm");
+ $langs->loadLangs(array("holiday", "hrm"));
require_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php';
$staticholiday = new Holiday($db);
$arraytypeholidays = $staticholiday->getTypes(1, 1);
@@ -364,7 +365,7 @@
// Supervisor
if (!empty($arrayfields['cp.fk_user']['checked'])) {
print '';
- print $form->select_dolusers($search_supervisor, 'search_supervisor', 1, null, 0, null, null, 0, 0, 0, '', 0, '', 'maxwidth150');
+ print $form->select_dolusers($search_supervisor, 'search_supervisor', 1, null, 0, array(), '', 0, 0, 0, '', 0, '', 'maxwidth150');
print ' ';
}
// Type of leave request
diff --git a/htdocs/takepos/admin/setup.php b/htdocs/takepos/admin/setup.php
index 24a10de6b564e..2dd003cc735d5 100644
--- a/htdocs/takepos/admin/setup.php
+++ b/htdocs/takepos/admin/setup.php
@@ -214,7 +214,7 @@
$invoice = new Facture($db);
$invoice->date = $now;
$invoice->module_source = 'takepos';
- $invoice->pos_source = 1;
+ $invoice->pos_source = '1';
// Info
$htmltooltip = '';