diff --git a/dev/tools/phan/baseline.txt b/dev/tools/phan/baseline.txt
index 00e50bd1205..7d482dff305 100644
--- a/dev/tools/phan/baseline.txt
+++ b/dev/tools/phan/baseline.txt
@@ -10,19 +10,19 @@
return [
// # Issue statistics:
// PhanUndeclaredProperty : 800+ occurrences
- // PhanPluginUnknownPropertyType : 740+ occurrences
+ // PhanPluginUnknownPropertyType : 710+ occurrences
// PhanPossiblyUndeclaredGlobalVariable : 600+ occurrences
- // PhanTypeMismatchArgumentProbablyReal : 430+ occurrences
+ // PhanTypeMismatchArgumentProbablyReal : 410+ occurrences
// PhanUndeclaredGlobalVariable : 380+ occurrences
- // PhanPluginUnknownArrayMethodReturnType : 320+ occurrences
- // PhanPluginUnknownArrayMethodParamType : 270+ occurrences
- // PhanPossiblyUndeclaredVariable : 260+ occurrences
+ // PhanPluginUnknownArrayMethodReturnType : 310+ occurrences
+ // PhanPluginUnknownArrayMethodParamType : 260+ occurrences
+ // PhanPossiblyUndeclaredVariable : 200+ occurrences
// PhanTypeMismatchProperty : 170+ occurrences
- // PhanPluginUnknownArrayFunctionParamType : 110+ occurrences
+ // PhanPluginUnknownArrayFunctionParamType : 95+ occurrences
// PhanTypeMismatchArgumentNullableInternal : 70+ occurrences
// PhanPluginUndeclaredVariableIsset : 65+ occurrences
// PhanPluginUnknownArrayPropertyType : 60+ occurrences
- // PhanPluginUnknownArrayFunctionReturnType : 55+ occurrences
+ // PhanPluginUnknownArrayFunctionReturnType : 50+ occurrences
// PhanRedefineFunction : 50+ occurrences
// PhanPluginEmptyStatementIf : 45+ occurrences
// PhanTypeMismatchDimFetch : 40+ occurrences
@@ -35,6 +35,7 @@ return [
// PhanEmptyForeach : 10+ occurrences
// PhanPluginConstantVariableNull : 10+ occurrences
// PhanPossiblyNullTypeMismatchProperty : 10+ occurrences
+ // PhanTypeArraySuspiciousNull : 10+ occurrences
// PhanTypeMismatchDimFetchNullable : 10+ occurrences
// PhanPluginBothLiteralsBinaryOp : 8 occurrences
// PhanPluginSuspiciousParamPosition : 8 occurrences
@@ -45,6 +46,7 @@ return [
// PhanEmptyFQSENInClasslike : 3 occurrences
// PhanInvalidFQSENInClasslike : 3 occurrences
// PhanAccessMethodProtected : 1 occurrence
+ // PhanTypeConversionFromArray : 1 occurrence
// Currently, file_suppressions and directory_suppressions are the only supported suppressions
'file_suppressions' => [
@@ -87,12 +89,12 @@ return [
'htdocs/bookcal/class/availabilities.class.php' => ['PhanUndeclaredMethod', 'PhanUndeclaredProperty'],
'htdocs/bookcal/class/calendar.class.php' => ['PhanUndeclaredMethod', 'PhanUndeclaredProperty'],
'htdocs/categories/class/api_categories.class.php' => ['PhanAccessMethodProtected', 'PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'],
- 'htdocs/categories/class/categorie.class.php' => ['PhanTypeMismatchDimFetch', 'PhanTypeMismatchProperty'],
+ 'htdocs/categories/class/categorie.class.php' => ['PhanTypeMismatchProperty'],
'htdocs/categories/edit.php' => ['PhanTypeMismatchDimFetch'],
'htdocs/categories/index.php' => ['PhanTypeMismatchDimFetch'],
'htdocs/categories/info.php' => ['PhanTypeMismatchDimFetch'],
'htdocs/categories/photos.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchDimFetch'],
- 'htdocs/categories/traduction.php' => ['PhanTypeMismatchDimFetch', 'PhanTypeMismatchProperty'],
+ 'htdocs/categories/traduction.php' => ['PhanTypeMismatchDimFetch'],
'htdocs/categories/viewcat.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchDimFetch', 'PhanUndeclaredProperty'],
'htdocs/collab/index.php' => ['PhanParamTooMany', 'PhanUndeclaredProperty'],
'htdocs/comm/action/card.php' => ['PhanPluginBothLiteralsBinaryOp', 'PhanPluginEmptyStatementIf', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty'],
@@ -164,7 +166,7 @@ return [
'htdocs/compta/journal/sellsjournal.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/compta/localtax/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'],
'htdocs/compta/localtax/class/localtax.class.php' => ['PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal'],
- 'htdocs/compta/localtax/clients.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredGlobalVariable'],
+ 'htdocs/compta/localtax/clients.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeExpectedObjectPropAccess', 'PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredGlobalVariable'],
'htdocs/compta/localtax/index.php' => ['PhanRedefineFunction'],
'htdocs/compta/localtax/list.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/compta/paiement.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchDimFetch'],
@@ -204,10 +206,11 @@ return [
'htdocs/compta/tva/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal'],
'htdocs/compta/tva/class/paymentvat.class.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'],
'htdocs/compta/tva/class/tva.class.php' => ['PhanTypeMismatchArgumentProbablyReal'],
- 'htdocs/compta/tva/clients.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchDimFetchNullable', 'PhanUndeclaredGlobalVariable'],
+ 'htdocs/compta/tva/clients.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeArraySuspiciousNull', 'PhanTypeInvalidDimOffset', 'PhanTypeMismatchDimFetchNullable', 'PhanTypeMismatchProperty', 'PhanUndeclaredGlobalVariable'],
'htdocs/compta/tva/index.php' => ['PhanRedefineFunction', 'PhanUndeclaredGlobalVariable'],
'htdocs/compta/tva/payments.php' => ['PhanTypeMismatchArgumentNullableInternal'],
- 'htdocs/contact/canvas/actions_contactcard_common.class.php' => ['PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchProperty'],
+ 'htdocs/compta/tva/quadri_detail.php' => ['PhanTypeArraySuspiciousNull', 'PhanTypeInvalidDimOffset', 'PhanTypeMismatchProperty'],
+ 'htdocs/contact/canvas/actions_contactcard_common.class.php' => ['PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchProperty', 'PhanTypeSuspiciousNonTraversableForeach'],
'htdocs/contact/card.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty'],
'htdocs/contact/class/contact.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType', 'PhanPluginUnknownPropertyType'],
'htdocs/contact/consumption.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'],
@@ -315,7 +318,7 @@ return [
'htdocs/core/extrafieldsinimport.inc.php' => ['PhanTypeMismatchArgumentNullableInternal'],
'htdocs/core/filemanagerdol/connectors/php/connector.lib.php' => ['PhanPluginConstantVariableNull', 'PhanPluginUnknownArrayFunctionParamType', 'PhanTypeInvalidDimOffset'],
'htdocs/core/lib/accounting.lib.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayFunctionReturnType'],
- 'htdocs/core/lib/admin.lib.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayFunctionReturnType', 'PhanUndeclaredProperty'],
+ 'htdocs/core/lib/admin.lib.php' => ['PhanUndeclaredProperty'],
'htdocs/core/lib/agenda.lib.php' => ['PhanPluginConstantVariableNull', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/core/lib/ajax.lib.php' => ['PhanPluginUnknownArrayFunctionParamType'],
'htdocs/core/lib/bank.lib.php' => ['PhanPluginEmptyStatementIf', 'PhanUndeclaredProperty'],
@@ -340,7 +343,6 @@ return [
'htdocs/core/lib/report.lib.php' => ['PhanPluginUnknownArrayFunctionParamType'],
'htdocs/core/lib/security.lib.php' => ['PhanPluginUnknownArrayFunctionParamType'],
'htdocs/core/lib/signature.lib.php' => ['PhanPossiblyUndeclaredVariable'],
- 'htdocs/core/lib/tax.lib.php' => ['PhanPossiblyUndeclaredVariable'],
'htdocs/core/lib/treeview.lib.php' => ['PhanPluginUnknownArrayFunctionParamType'],
'htdocs/core/lib/xcal.lib.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPossiblyUndeclaredVariable', 'PhanUndeclaredProperty'],
'htdocs/core/menus/standard/auguria.lib.php' => ['PhanTypeInvalidDimOffset'],
@@ -374,8 +376,8 @@ return [
'htdocs/core/modules/fichinter/mod_pacific.php' => ['PhanPossiblyUndeclaredVariable'],
'htdocs/core/modules/hrm/doc/pdf_standard_evaluation.modules.php' => ['PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'],
'htdocs/core/modules/hrm/mod_evaluation_advanced.php' => ['PhanUndeclaredProperty'],
- 'htdocs/core/modules/import/import_csv.modules.php' => ['PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty'],
- 'htdocs/core/modules/import/import_xlsx.modules.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty'],
+ 'htdocs/core/modules/import/import_csv.modules.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchProperty'],
+ 'htdocs/core/modules/import/import_xlsx.modules.php' => ['PhanTypeMismatchProperty'],
'htdocs/core/modules/mailings/contacts1.modules.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/core/modules/mailings/modules_mailings.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType'],
'htdocs/core/modules/mailings/thirdparties.modules.php' => ['PhanTypeMismatchArgumentProbablyReal'],
@@ -392,10 +394,9 @@ return [
'htdocs/core/modules/printsheet/doc/pdf_tcpdflabel.class.php' => ['PhanPluginUnknownArrayMethodParamType'],
'htdocs/core/modules/printsheet/modules_labels.php' => ['PhanParamTooMany'],
'htdocs/core/modules/product/doc/pdf_standard.modules.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredVariable'],
- 'htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'],
- 'htdocs/core/modules/project/doc/pdf_baleine.modules.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'],
- 'htdocs/core/modules/project/doc/pdf_beluga.modules.php' => ['PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal'],
- 'htdocs/core/modules/project/doc/pdf_timespent.modules.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'],
+ 'htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php' => ['PhanUndeclaredProperty'],
+ 'htdocs/core/modules/project/doc/pdf_baleine.modules.php' => ['PhanUndeclaredProperty'],
+ 'htdocs/core/modules/project/doc/pdf_timespent.modules.php' => ['PhanUndeclaredProperty'],
'htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPossiblyUndeclaredVariable', 'PhanUndeclaredProperty'],
'htdocs/core/modules/propale/doc/pdf_azur.modules.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'],
'htdocs/core/modules/propale/doc/pdf_cyan.modules.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'],
diff --git a/htdocs/compta/localtax/index.php b/htdocs/compta/localtax/index.php
index 010ef798602..6bf479a04e2 100644
--- a/htdocs/compta/localtax/index.php
+++ b/htdocs/compta/localtax/index.php
@@ -480,7 +480,7 @@ while ((($y < $yend) || ($y == $yend && $m <= $mend)) && $mcursor < 1000) { // $
}
}
//var_dump('type='.$type.' '.$fields['totalht'].' '.$ratiopaymentinvoice);
- $temp_ht = $fields['totalht'] * $ratiopaymentinvoice;
+ $temp_ht = (float) $fields['totalht'] * $ratiopaymentinvoice;
$temp_vat = $fields['localtax'.$localTaxType] * $ratiopaymentinvoice;
$subtot_coll_total_ht += $temp_ht;
$subtot_coll_vat += $temp_vat;
diff --git a/htdocs/compta/localtax/quadri_detail.php b/htdocs/compta/localtax/quadri_detail.php
index 7e65f5a61c6..3a1dd1cc05b 100644
--- a/htdocs/compta/localtax/quadri_detail.php
+++ b/htdocs/compta/localtax/quadri_detail.php
@@ -472,7 +472,7 @@ if (!is_array($x_coll) || !is_array($x_paye)) {
print '
';
$temp_ht = $fields['totalht'];
if ($type == 1) {
- $temp_ht = $fields['totalht'] * $ratiopaymentinvoice;
+ $temp_ht = (float) $fields['totalht'] * $ratiopaymentinvoice;
}
print price(price2num($temp_ht, 'MT'));
print ' | ';
diff --git a/htdocs/compta/tva/clients.php b/htdocs/compta/tva/clients.php
index 1f57326572b..22d9bb7daa7 100644
--- a/htdocs/compta/tva/clients.php
+++ b/htdocs/compta/tva/clients.php
@@ -229,6 +229,10 @@ if (!is_array($x_coll) || !is_array($x_paye)) {
$x_both = array();
//now, from these two arrays, get another array with one rate per line
foreach (array_keys($x_coll) as $my_coll_thirdpartyid) {
+ $x_both[$my_coll_thirdpartyid] = array(
+ 'coll' => array(),
+ 'paye' => array(),
+ );
$x_both[$my_coll_thirdpartyid]['coll']['totalht'] = $x_coll[$my_coll_thirdpartyid]['totalht'];
$x_both[$my_coll_thirdpartyid]['coll']['vat'] = $x_coll[$my_coll_thirdpartyid]['vat'];
$x_both[$my_coll_thirdpartyid]['paye']['totalht'] = 0;
@@ -245,7 +249,7 @@ if (!is_array($x_coll) || !is_array($x_paye)) {
$company_static->name = $x_coll[$my_coll_thirdpartyid]['company_name'][$id];
$company_static->name_alias = $x_coll[$my_coll_thirdpartyid]['company_alias'][$id];
$company_static->email = $x_coll[$my_coll_thirdpartyid]['company_email'][$id];
- $company_static->tva_intra = isset($x_coll[$my_coll_thirdpartyid]['tva_intra'][$id]) ? $x_coll[$my_coll_thirdpartyid]['tva_intra'][$id] : 0;
+ $company_static->tva_intra = isset($x_coll[$my_coll_thirdpartyid]['tva_intra'][$id]) ? $x_coll[$my_coll_thirdpartyid]['tva_intra'][$id] : '0';
$company_static->client = $x_coll[$my_coll_thirdpartyid]['company_client'][$id];
$company_static->fournisseur = $x_coll[$my_coll_thirdpartyid]['company_fournisseur'][$id];
$company_static->status = $x_coll[$my_coll_thirdpartyid]['company_status'][$id];
@@ -351,8 +355,8 @@ if (!is_array($x_coll) || !is_array($x_paye)) {
'pid' => $x_paye[$my_paye_thirdpartyid]['pid'][$id],
'pref' => $x_paye[$my_paye_thirdpartyid]['pref'][$id],
'ptype' => $x_paye[$my_paye_thirdpartyid]['ptype'][$id],
- 'pstatus' => $x_paye[$my_paye_thirdpartyid]['pstatus'][$id],
- 'pstatusbuy' => $x_paye[$my_paye_thirdpartyid]['pstatusbuy'][$id],
+ 'pstatus' => (int) $x_paye[$my_paye_thirdpartyid]['pstatus'][$id],
+ 'pstatusbuy' => (int) $x_paye[$my_paye_thirdpartyid]['pstatusbuy'][$id],
'payment_id' => $x_paye[$my_paye_thirdpartyid]['payment_id'][$id],
'payment_ref' => $x_paye[$my_paye_thirdpartyid]['payment_ref'][$id],
@@ -474,8 +478,8 @@ if (!is_array($x_coll) || !is_array($x_paye)) {
$product_static->id = $fields['pid'];
$product_static->ref = $fields['pref'];
$product_static->type = $fields['dtype']; // We force with the type of line to have type how line is registered
- $product_static->status = $fields['pstatus'];
- $product_static->status_buy = $fields['pstatusbuy'];
+ $product_static->status = (int) $fields['pstatus'];
+ $product_static->status_buy = (int) $fields['pstatusbuy'];
print $product_static->getNomUrl(1);
if (dol_string_nohtmltag($fields['descr'])) {
@@ -542,7 +546,7 @@ if (!is_array($x_coll) || !is_array($x_paye)) {
// Total collected
print '';
- $temp_ht = $fields['totalht'] * $ratiopaymentinvoice;
+ $temp_ht = (float) $fields['totalht'] * $ratiopaymentinvoice;
print price(price2num($temp_ht, 'MT'), 1);
print ' | ';
diff --git a/htdocs/compta/tva/index.php b/htdocs/compta/tva/index.php
index 41114c35067..4aa905bab77 100644
--- a/htdocs/compta/tva/index.php
+++ b/htdocs/compta/tva/index.php
@@ -285,6 +285,12 @@ if ($refresh === true) {
$x_both = array();
//now, from these two arrays, get another array with one rate per line
foreach (array_keys($x_coll) as $my_coll_rate) {
+ $x_both[$my_coll_rate] = array(
+ 'coll' => array(),
+ 'paye' => array(),
+ 'detail' => array(),
+ 'ptype' => array(),
+ );
$x_both[$my_coll_rate]['coll']['totalht'] = $x_coll[$my_coll_rate]['totalht'];
$x_both[$my_coll_rate]['coll']['vat'] = $x_coll[$my_coll_rate]['vat'];
$x_both[$my_coll_rate]['paye']['totalht'] = 0;
@@ -430,7 +436,7 @@ if ($refresh === true) {
}
}
//var_dump('type='.$type.' '.$fields['totalht'].' '.$ratiopaymentinvoice);
- $temp_ht = $fields['totalht'] * $ratiopaymentinvoice;
+ $temp_ht = (float) $fields['totalht'] * $ratiopaymentinvoice;
$temp_vat = $fields['vat'] * $ratiopaymentinvoice;
$subtot_coll_total_ht += $temp_ht;
$subtot_coll_vat += $temp_vat;
diff --git a/htdocs/compta/tva/quadri_detail.php b/htdocs/compta/tva/quadri_detail.php
index afea461f22a..d60e2e07855 100644
--- a/htdocs/compta/tva/quadri_detail.php
+++ b/htdocs/compta/tva/quadri_detail.php
@@ -247,6 +247,10 @@ if (!is_array($x_coll) || !is_array($x_paye)) {
$x_both = array();
//now, from these two arrays, get another array with one rate per line
foreach (array_keys($x_coll) as $my_coll_rate) {
+ $x_both[$my_coll_rate] = array(
+ 'coll' => array(),
+ 'paye' => array(),
+ );
$x_both[$my_coll_rate]['coll']['totalht'] = $x_coll[$my_coll_rate]['totalht'];
$x_both[$my_coll_rate]['coll']['vat'] = $x_coll[$my_coll_rate]['vat'];
$x_both[$my_coll_rate]['paye']['totalht'] = 0;
@@ -263,7 +267,7 @@ if (!is_array($x_coll) || !is_array($x_paye)) {
$company_static->name = $x_coll[$my_coll_rate]['company_name'][$id];
$company_static->name_alias = $x_coll[$my_coll_rate]['company_alias'][$id];
$company_static->email = $x_coll[$my_coll_rate]['company_email'][$id];
- $company_static->tva_intra = isset($x_coll[$my_coll_rate]['tva_intra'][$id]) ? $x_coll[$my_coll_rate]['tva_intra'][$id] : 0;
+ $company_static->tva_intra = isset($x_coll[$my_coll_rate]['tva_intra'][$id]) ? $x_coll[$my_coll_rate]['tva_intra'][$id] : '0';
$company_static->client = $x_coll[$my_coll_rate]['company_client'][$id];
$company_static->fournisseur = $x_coll[$my_coll_rate]['company_fournisseur'][$id];
$company_static->status = $x_coll[$my_coll_rate]['company_status'][$id];
@@ -462,7 +466,7 @@ if (!is_array($x_coll) || !is_array($x_paye)) {
}
// Total collected
- $temp_ht = $fields['totalht'] * $ratiopaymentinvoice;
+ $temp_ht = (float) $fields['totalht'] * $ratiopaymentinvoice;
// VAT
$temp_vat = $fields['vat'] * $ratiopaymentinvoice;
@@ -594,7 +598,7 @@ if (!is_array($x_coll) || !is_array($x_paye)) {
// Total collected
print '';
- $temp_ht = $fields['totalht'] * $ratiopaymentinvoice;
+ $temp_ht = (float) $fields['totalht'] * $ratiopaymentinvoice;
print price(price2num($temp_ht, 'MT'), 1);
print ' | ';
diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php
index f3e67229b67..fadbbcad13a 100644
--- a/htdocs/core/lib/admin.lib.php
+++ b/htdocs/core/lib/admin.lib.php
@@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
/**
* Renvoi une version en chaine depuis une version en tableau
*
- * @param array $versionarray Tableau de version (vermajeur,vermineur,autre)
+ * @param array,int|string> $versionarray Tableau de version (vermajeur,vermineur,autre)
* @return string Chaine version
* @see versioncompare()
*/
@@ -59,9 +59,9 @@ function versiontostring($versionarray)
* For example: if (versioncompare(versiondolibarrarray(),array(4,0,1)) >= 0) is true if version is 4.0.1 or higher.
* Alternative way to compare: if ((float) DOL_VERSION >= 4.0) is true if version is 4.0 alpha or higher (works only to compare first and second level)
*
- * @param array $versionarray1 Array of version (vermajor,verminor,patch)
- * @param array $versionarray2 Array of version (vermajor,verminor,patch)
- * @return int -4,-3,-2,-1 if versionarray1 $versionarray1 Array of version (vermajor,verminor,patch)
+ * @param array $versionarray2 Array of version (vermajor,verminor,patch)
+ * @return int<-4,4> -4,-3,-2,-1 if versionarray1versionarray2 (value depends on level of difference)
* @see versiontostring()
@@ -125,7 +125,7 @@ function versioncompare($versionarray1, $versionarray2)
/**
* Return version PHP
*
- * @return array Tableau de version (vermajeur,vermineur,autre)
+ * @return array,string> Tableau de version (vermajeur,vermineur,autre)
* @see versioncompare()
*/
function versionphparray()
@@ -136,7 +136,7 @@ function versionphparray()
/**
* Return version Dolibarr
*
- * @return array Tableau de version (vermajeur,vermineur,autre)
+ * @return array,string> Tableau de version (vermajeur,vermineur,autre)
* @see versioncompare()
*/
function versiondolibarrarray()
@@ -1369,18 +1369,18 @@ function unActivateModule($value, $requiredby = 1)
* Add external modules to list of dictionaries.
* Addition is done into var $taborder, $tabname, etc... that are passed with pointers.
*
- * @param array $taborder Taborder
- * @param array $tabname Tabname
- * @param array $tablib Tablib
- * @param array $tabsql Tabsql
- * @param array $tabsqlsort Tabsqlsort
- * @param array $tabfield Tabfield
- * @param array $tabfieldvalue Tabfieldvalue
- * @param array $tabfieldinsert Tabfieldinsert
- * @param array $tabrowid Tabrowid
- * @param array $tabcond Tabcond
- * @param array $tabhelp Tabhelp
- * @param array $tabcomplete Tab complete (will replace all other in future). Key is table name.
+ * @param int[] $taborder Taborder
+ * @param string[] $tabname Tabname
+ * @param string[] $tablib Tablib
+ * @param string[] $tabsql Tabsql
+ * @param string[] $tabsqlsort Tabsqlsort
+ * @param string[] $tabfield Tabfield
+ * @param string[] $tabfieldvalue Tabfieldvalue
+ * @param string[] $tabfieldinsert Tabfieldinsert
+ * @param string[] $tabrowid Tabrowid
+ * @param bool[] $tabcond Tabcond
+ * @param array> $tabhelp Tabhelp
+ * @param array>> $tabcomplete Tab complete (will replace all other in future). Key is table name.
* @return int 1
*/
function complete_dictionary_with_modules(&$taborder, &$tabname, &$tablib, &$tabsql, &$tabsqlsort, &$tabfield, &$tabfieldvalue, &$tabfieldinsert, &$tabrowid, &$tabcond, &$tabhelp, &$tabcomplete)
@@ -2047,7 +2047,7 @@ function delDocumentModel($name, $type)
/**
* Return the php_info into an array
*
- * @return array Array with PHP infos
+ * @return array> Array with PHP info
*/
function phpinfo_array()
{
diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php
index 115baba4bee..17ae76cba29 100644
--- a/htdocs/core/lib/functions2.lib.php
+++ b/htdocs/core/lib/functions2.lib.php
@@ -2405,7 +2405,7 @@ function colorArrayToHex($arraycolor, $colorifnotfound = '888888')
* This is the opposite function of colorArrayToHex.
* If entry is already an array, return it.
*
- * @param string $stringcolor String with hex (FFFFFF) or comma RGB ('255,255,255')
+ * @param string|array{0:int,1:int,2:int} $stringcolor String with hex (FFFFFF) or comma RGB ('255,255,255')
* @param array{0:int,1:int,2:int}|array{} $colorifnotfound Color code array to return if entry not defined
* @return array{0:int,1:int,2:int} RGB hex value (without # before). For example: FF00FF
* @see colorArrayToHex(), colorHexToRgb()
@@ -2413,7 +2413,7 @@ function colorArrayToHex($arraycolor, $colorifnotfound = '888888')
function colorStringToArray($stringcolor, $colorifnotfound = array(88, 88, 88))
{
if (is_array($stringcolor)) {
- return $stringcolor; // If already into correct output format, we return as is
+ return $stringcolor; // If already in the correct output format, we return as is
}
$reg = array();
$tmp = preg_match('/^#?([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F])$/', $stringcolor, $reg);
@@ -2831,7 +2831,7 @@ function price2fec($amount)
* Check the syntax of some PHP code.
*
* @param string $code PHP code to check.
- * @return boolean|array If false, then check was successful, otherwise an array(message,line) of errors is returned.
+ * @return false|array{0:string,1:int} If false, then check was successful, otherwise an array(message,line) of errors is returned.
*/
function phpSyntaxError($code)
{
diff --git a/htdocs/core/lib/tax.lib.php b/htdocs/core/lib/tax.lib.php
index df17149afa6..205031bed98 100644
--- a/htdocs/core/lib/tax.lib.php
+++ b/htdocs/core/lib/tax.lib.php
@@ -100,16 +100,16 @@ function tax_prepare_head(ChargeSociales $object)
/**
* Look for collectable VAT clients in the chosen year (and month)
*
- * @param string $type Tax type, either 'vat', 'localtax1' or 'localtax2'
+ * @param 'vat'|'localtax1'|'localtax2' $type Tax type, either 'vat', 'localtax1' or 'localtax2'
* @param DoliDB $db Database handle
* @param int $y Year
* @param int|'' $date_start Start date
* @param int|'' $date_end End date
* @param int $modetax Not used
* @param 'sell'|'buy' $direction 'sell' or 'buy'
- * @param int $m Month
- * @param int $q Quarter
- * @return array|int Array with details of VATs (per third parties), -1 if no accountancy module, -2 if not yet developed, -3 if error
+ * @param int<0,12> $m Month
+ * @param int<0,4> $q Quarter
+ * @return int<-3,-1>|array Array with details of VATs (per third party), -1 if no accountancy module, -2 if not yet developed, -3 if error
*/
function tax_by_thirdparty($type, $db, $y, $date_start, $date_end, $modetax, $direction, $m = 0, $q = 0)
{
@@ -141,6 +141,9 @@ function tax_by_thirdparty($type, $db, $y, $date_start, $date_end, $modetax, $di
$paymenttable = 'paiementfourn';
$paymentfacturetable = 'paiementfourn_facturefourn';
$invoicefieldref = 'ref';
+ } else {
+ dol_print_error(null, 'Invalid "direction" - must be buy or sell - found ' . $direction);
+ return -2;
}
if (strpos($type, 'localtax') === 0) {
@@ -301,51 +304,51 @@ function tax_by_thirdparty($type, $db, $y, $date_start, $date_end, $modetax, $di
if ($assoc['rowid'] != $oldrowid) { // Si rupture sur d.rowid
$oldrowid = $assoc['rowid'];
- $list[$assoc['company_id']]['totalht'] += $assoc['total_ht'];
- $list[$assoc['company_id']]['vat'] += $assoc['total_vat'];
- $list[$assoc['company_id']]['localtax1'] += $assoc['total_localtax1'];
- $list[$assoc['company_id']]['localtax2'] += $assoc['total_localtax2'];
+ $list[$assoc['company_id']]['totalht'] += (float) $assoc['total_ht'];
+ $list[$assoc['company_id']]['vat'] += (float) $assoc['total_vat'];
+ $list[$assoc['company_id']]['localtax1'] += (float) $assoc['total_localtax1'];
+ $list[$assoc['company_id']]['localtax2'] += (float) $assoc['total_localtax2'];
}
- $list[$assoc['company_id']]['dtotal_ttc'][] = $assoc['total_ttc'];
- $list[$assoc['company_id']]['dtype'][] = $assoc['dtype'];
+ $list[$assoc['company_id']]['dtotal_ttc'][] = (float) $assoc['total_ttc'];
+ $list[$assoc['company_id']]['dtype'][] = (int) $assoc['dtype'];
$list[$assoc['company_id']]['datef'][] = $db->jdate($assoc['datef']);
$list[$assoc['company_id']]['datep'][] = $db->jdate($assoc['datep']);
- $list[$assoc['company_id']]['company_name'][] = $assoc['company_name'];
- $list[$assoc['company_id']]['company_id'][] = $assoc['company_id'];
- $list[$assoc['company_id']]['company_alias'][] = $assoc['company_alias'];
- $list[$assoc['company_id']]['company_email'][] = $assoc['company_email'];
- $list[$assoc['company_id']]['company_tva_intra'][] = $assoc['company_tva_intra'];
- $list[$assoc['company_id']]['company_client'][] = $assoc['company_client'];
- $list[$assoc['company_id']]['company_fournisseur'][] = $assoc['company_fournisseur'];
- $list[$assoc['company_id']]['company_customer_code'][] = $assoc['company_customer_code'];
- $list[$assoc['company_id']]['company_supplier_code'][] = $assoc['company_supplier_code'];
- $list[$assoc['company_id']]['company_customer_accounting_code'][] = $assoc['company_customer_accounting_code'];
- $list[$assoc['company_id']]['company_supplier_accounting_code'][] = $assoc['company_supplier_accounting_code'];
- $list[$assoc['company_id']]['company_status'][] = $assoc['company_status'];
+ $list[$assoc['company_id']]['company_name'][] = (string) $assoc['company_name'];
+ $list[$assoc['company_id']]['company_id'][] = (int) $assoc['company_id'];
+ $list[$assoc['company_id']]['company_alias'][] = (string) $assoc['company_alias'];
+ $list[$assoc['company_id']]['company_email'][] = (string) $assoc['company_email'];
+ $list[$assoc['company_id']]['company_tva_intra'][] = (string) $assoc['company_tva_intra'];
+ $list[$assoc['company_id']]['company_client'][] = (int) $assoc['company_client'];
+ $list[$assoc['company_id']]['company_fournisseur'][] = (int) $assoc['company_fournisseur'];
+ $list[$assoc['company_id']]['company_customer_code'][] = (string) $assoc['company_customer_code'];
+ $list[$assoc['company_id']]['company_supplier_code'][] = (string) $assoc['company_supplier_code'];
+ $list[$assoc['company_id']]['company_customer_accounting_code'][] = (string) $assoc['company_customer_accounting_code'];
+ $list[$assoc['company_id']]['company_supplier_accounting_code'][] = (string) $assoc['company_supplier_accounting_code'];
+ $list[$assoc['company_id']]['company_status'][] = (int) $assoc['company_status'];
$list[$assoc['company_id']]['drate'][] = $assoc['rate'];
$list[$assoc['company_id']]['ddate_start'][] = $db->jdate($assoc['date_start']);
$list[$assoc['company_id']]['ddate_end'][] = $db->jdate($assoc['date_end']);
- $list[$assoc['company_id']]['facid'][] = $assoc['facid'];
- $list[$assoc['company_id']]['facnum'][] = $assoc['facnum'];
- $list[$assoc['company_id']]['type'][] = $assoc['type'];
- $list[$assoc['company_id']]['ftotal_ttc'][] = $assoc['ftotal_ttc'];
- $list[$assoc['company_id']]['descr'][] = $assoc['descr'];
+ $list[$assoc['company_id']]['facid'][] = (int) $assoc['facid'];
+ $list[$assoc['company_id']]['facnum'][] = (string) $assoc['facnum'];
+ $list[$assoc['company_id']]['type'][] = (int) $assoc['type'];
+ $list[$assoc['company_id']]['ftotal_ttc'][] = (float) $assoc['ftotal_ttc'];
+ $list[$assoc['company_id']]['descr'][] = (string) $assoc['descr'];
- $list[$assoc['company_id']]['totalht_list'][] = $assoc['total_ht'];
- $list[$assoc['company_id']]['vat_list'][] = $assoc['total_vat'];
- $list[$assoc['company_id']]['localtax1_list'][] = $assoc['total_localtax1'];
- $list[$assoc['company_id']]['localtax2_list'][] = $assoc['total_localtax2'];
+ $list[$assoc['company_id']]['totalht_list'][] = (float) $assoc['total_ht'];
+ $list[$assoc['company_id']]['vat_list'][] = (float) $assoc['total_vat'];
+ $list[$assoc['company_id']]['localtax1_list'][] = (float) $assoc['total_localtax1'];
+ $list[$assoc['company_id']]['localtax2_list'][] = (float) $assoc['total_localtax2'];
- $list[$assoc['company_id']]['pid'][] = $assoc['pid'];
- $list[$assoc['company_id']]['pref'][] = $assoc['pref'];
- $list[$assoc['company_id']]['ptype'][] = $assoc['ptype'];
+ $list[$assoc['company_id']]['pid'][] = (int) $assoc['pid'];
+ $list[$assoc['company_id']]['pref'][] = (string) $assoc['pref'];
+ $list[$assoc['company_id']]['ptype'][] = (int) $assoc['ptype'];
- $list[$assoc['company_id']]['payment_id'][] = $assoc['payment_id'];
- $list[$assoc['company_id']]['payment_amount'][] = $assoc['payment_amount'];
+ $list[$assoc['company_id']]['payment_id'][] = (int) $assoc['payment_id'];
+ $list[$assoc['company_id']]['payment_amount'][] = (float) $assoc['payment_amount'];
$company_id = $assoc['company_id'];
}
@@ -503,51 +506,51 @@ function tax_by_thirdparty($type, $db, $y, $date_start, $date_end, $modetax, $di
if ($assoc['rowid'] != $oldrowid) { // Si rupture sur d.rowid
$oldrowid = $assoc['rowid'];
- $list[$assoc['company_id']]['totalht'] += $assoc['total_ht'];
- $list[$assoc['company_id']]['vat'] += $assoc['total_vat'];
- $list[$assoc['company_id']]['localtax1'] += $assoc['total_localtax1'];
- $list[$assoc['company_id']]['localtax2'] += $assoc['total_localtax2'];
+ $list[$assoc['company_id']]['totalht'] += (float) $assoc['total_ht'];
+ $list[$assoc['company_id']]['vat'] += (float) $assoc['total_vat'];
+ $list[$assoc['company_id']]['localtax1'] += (float) $assoc['total_localtax1'];
+ $list[$assoc['company_id']]['localtax2'] += (float) $assoc['total_localtax2'];
}
- $list[$assoc['company_id']]['dtotal_ttc'][] = $assoc['total_ttc'];
+ $list[$assoc['company_id']]['dtotal_ttc'][] = (float) $assoc['total_ttc'];
$list[$assoc['company_id']]['dtype'][] = $assoc['dtype'];
$list[$assoc['company_id']]['datef'][] = $db->jdate($assoc['datef']);
$list[$assoc['company_id']]['datep'][] = $db->jdate($assoc['datep']);
- $list[$assoc['company_id']]['company_name'][] = $assoc['company_name'];
- $list[$assoc['company_id']]['company_id'][] = $assoc['company_id'];
- $list[$assoc['company_id']]['company_alias'][] = $assoc['company_alias'];
- $list[$assoc['company_id']]['company_email'][] = $assoc['company_email'];
- $list[$assoc['company_id']]['company_tva_intra'][] = $assoc['company_tva_intra'];
- $list[$assoc['company_id']]['company_client'][] = $assoc['company_client'];
- $list[$assoc['company_id']]['company_fournisseur'][] = $assoc['company_fournisseur'];
- $list[$assoc['company_id']]['company_customer_code'][] = $assoc['company_customer_code'];
- $list[$assoc['company_id']]['company_supplier_code'][] = $assoc['company_supplier_code'];
- $list[$assoc['company_id']]['company_customer_accounting_code'][] = $assoc['company_customer_accounting_code'];
- $list[$assoc['company_id']]['company_supplier_accounting_code'][] = $assoc['company_supplier_accounting_code'];
- $list[$assoc['company_id']]['company_status'][] = $assoc['company_status'];
+ $list[$assoc['company_id']]['company_name'][] = (string) $assoc['company_name'];
+ $list[$assoc['company_id']]['company_id'][] = (int) $assoc['company_id'];
+ $list[$assoc['company_id']]['company_alias'][] = (string) $assoc['company_alias'];
+ $list[$assoc['company_id']]['company_email'][] = (string) $assoc['company_email'];
+ $list[$assoc['company_id']]['company_tva_intra'][] = (string) $assoc['company_tva_intra'];
+ $list[$assoc['company_id']]['company_client'][] = (int) $assoc['company_client'];
+ $list[$assoc['company_id']]['company_fournisseur'][] = (int) $assoc['company_fournisseur'];
+ $list[$assoc['company_id']]['company_customer_code'][] = (string) $assoc['company_customer_code'];
+ $list[$assoc['company_id']]['company_supplier_code'][] = (string) $assoc['company_supplier_code'];
+ $list[$assoc['company_id']]['company_customer_accounting_code'][] = (string) $assoc['company_customer_accounting_code'];
+ $list[$assoc['company_id']]['company_supplier_accounting_code'][] = (string) $assoc['company_supplier_accounting_code'];
+ $list[$assoc['company_id']]['company_status'][] = (int) $assoc['company_status'];
$list[$assoc['company_id']]['drate'][] = $assoc['rate'];
$list[$assoc['company_id']]['ddate_start'][] = $db->jdate($assoc['date_start']);
$list[$assoc['company_id']]['ddate_end'][] = $db->jdate($assoc['date_end']);
- $list[$assoc['company_id']]['facid'][] = $assoc['facid'];
- $list[$assoc['company_id']]['facnum'][] = $assoc['facnum'];
- $list[$assoc['company_id']]['type'][] = $assoc['type'];
- $list[$assoc['company_id']]['ftotal_ttc'][] = $assoc['ftotal_ttc'];
- $list[$assoc['company_id']]['descr'][] = $assoc['descr'];
+ $list[$assoc['company_id']]['facid'][] = (int) $assoc['facid'];
+ $list[$assoc['company_id']]['facnum'][] = (string) $assoc['facnum'];
+ $list[$assoc['company_id']]['type'][] = (int) $assoc['type'];
+ $list[$assoc['company_id']]['ftotal_ttc'][] = (float) $assoc['ftotal_ttc'];
+ $list[$assoc['company_id']]['descr'][] = (string) $assoc['descr'];
- $list[$assoc['company_id']]['totalht_list'][] = $assoc['total_ht'];
- $list[$assoc['company_id']]['vat_list'][] = $assoc['total_vat'];
- $list[$assoc['company_id']]['localtax1_list'][] = $assoc['total_localtax1'];
- $list[$assoc['company_id']]['localtax2_list'][] = $assoc['total_localtax2'];
+ $list[$assoc['company_id']]['totalht_list'][] = (float) $assoc['total_ht'];
+ $list[$assoc['company_id']]['vat_list'][] = (float) $assoc['total_vat'];
+ $list[$assoc['company_id']]['localtax1_list'][] = (float) $assoc['total_localtax1'];
+ $list[$assoc['company_id']]['localtax2_list'][] = (float) $assoc['total_localtax2'];
- $list[$assoc['company_id']]['pid'][] = $assoc['pid'];
- $list[$assoc['company_id']]['pref'][] = $assoc['pref'];
- $list[$assoc['company_id']]['ptype'][] = $assoc['ptype'];
+ $list[$assoc['company_id']]['pid'][] = (int) $assoc['pid'];
+ $list[$assoc['company_id']]['pref'][] = (string) $assoc['pref'];
+ $list[$assoc['company_id']]['ptype'][] = (int) $assoc['ptype'];
- $list[$assoc['company_id']]['payment_id'][] = $assoc['payment_id'];
- $list[$assoc['company_id']]['payment_ref'][] = $assoc['payment_ref'];
- $list[$assoc['company_id']]['payment_amount'][] = $assoc['payment_amount'];
+ $list[$assoc['company_id']]['payment_id'][] = (int) $assoc['payment_id'];
+ $list[$assoc['company_id']]['payment_ref'][] = (string) $assoc['payment_ref'];
+ $list[$assoc['company_id']]['payment_amount'][] = (float) $assoc['payment_amount'];
$company_id = $assoc['company_id'];
}
@@ -625,52 +628,52 @@ function tax_by_thirdparty($type, $db, $y, $date_start, $date_end, $modetax, $di
if ($assoc['rowid'] != $oldrowid) { // Si rupture sur d.rowid
$oldrowid = $assoc['rowid'];
- $list[$assoc['company_id']]['totalht'] += $assoc['total_ht'];
- $list[$assoc['company_id']]['vat'] += $assoc['total_vat'];
- $list[$assoc['company_id']]['localtax1'] += $assoc['total_localtax1'];
- $list[$assoc['company_id']]['localtax2'] += $assoc['total_localtax2'];
+ $list[$assoc['company_id']]['totalht'] += (float) $assoc['total_ht'];
+ $list[$assoc['company_id']]['vat'] += (float) $assoc['total_vat'];
+ $list[$assoc['company_id']]['localtax1'] += (float) $assoc['total_localtax1'];
+ $list[$assoc['company_id']]['localtax2'] += (float) $assoc['total_localtax2'];
}
- $list[$assoc['company_id']]['dtotal_ttc'][] = $assoc['total_ttc'];
+ $list[$assoc['company_id']]['dtotal_ttc'][] = (float) $assoc['total_ttc'];
$list[$assoc['company_id']]['dtype'][] = 'ExpenseReportPayment';
- $list[$assoc['company_id']]['datef'][] = $assoc['datef'];
+ $list[$assoc['company_id']]['datef'][] = (int) $assoc['datef'];
$list[$assoc['company_id']]['company_name'][] = '';
- $list[$assoc['company_id']]['company_id'][] = '';
+ $list[$assoc['company_id']]['company_id'][] = 0;
$list[$assoc['company_id']]['company_alias'][] = '';
$list[$assoc['company_id']]['company_email'][] = '';
$list[$assoc['company_id']]['company_tva_intra'][] = '';
- $list[$assoc['company_id']]['company_client'][] = '';
- $list[$assoc['company_id']]['company_fournisseur'][] = '';
+ $list[$assoc['company_id']]['company_client'][] = 0;
+ $list[$assoc['company_id']]['company_fournisseur'][] = 0;
$list[$assoc['company_id']]['company_customer_code'][] = '';
$list[$assoc['company_id']]['company_supplier_code'][] = '';
$list[$assoc['company_id']]['company_customer_accounting_code'][] = '';
$list[$assoc['company_id']]['company_supplier_accounting_code'][] = '';
- $list[$assoc['company_id']]['company_status'][] = '';
+ $list[$assoc['company_id']]['company_status'][] = 0;
- $list[$assoc['company_id']]['user_id'][] = $assoc['fk_user_author'];
+ $list[$assoc['company_id']]['user_id'][] = (int) $assoc['fk_user_author'];
$list[$assoc['company_id']]['drate'][] = $assoc['rate'];
$list[$assoc['company_id']]['ddate_start'][] = $db->jdate($assoc['date_start']);
$list[$assoc['company_id']]['ddate_end'][] = $db->jdate($assoc['date_end']);
- $list[$assoc['company_id']]['facid'][] = $assoc['facid'];
- $list[$assoc['company_id']]['facnum'][] = $assoc['facnum'];
- $list[$assoc['company_id']]['type'][] = $assoc['type'];
- $list[$assoc['company_id']]['ftotal_ttc'][] = $assoc['ftotal_ttc'];
- $list[$assoc['company_id']]['descr'][] = $assoc['descr'];
+ $list[$assoc['company_id']]['facid'][] = (int) $assoc['facid'];
+ $list[$assoc['company_id']]['facnum'][] = (string) $assoc['facnum'];
+ $list[$assoc['company_id']]['type'][] = (int) $assoc['type'];
+ $list[$assoc['company_id']]['ftotal_ttc'][] = (float) $assoc['ftotal_ttc'];
+ $list[$assoc['company_id']]['descr'][] = (string) $assoc['descr'];
- $list[$assoc['company_id']]['totalht_list'][] = $assoc['total_ht'];
- $list[$assoc['company_id']]['vat_list'][] = $assoc['total_vat'];
- $list[$assoc['company_id']]['localtax1_list'][] = $assoc['total_localtax1'];
- $list[$assoc['company_id']]['localtax2_list'][] = $assoc['total_localtax2'];
+ $list[$assoc['company_id']]['totalht_list'][] = (float) $assoc['total_ht'];
+ $list[$assoc['company_id']]['vat_list'][] = (float) $assoc['total_vat'];
+ $list[$assoc['company_id']]['localtax1_list'][] = (float) $assoc['total_localtax1'];
+ $list[$assoc['company_id']]['localtax2_list'][] = (float) $assoc['total_localtax2'];
- $list[$assoc['company_id']]['pid'][] = $assoc['pid'];
- $list[$assoc['company_id']]['pref'][] = $assoc['pref'];
+ $list[$assoc['company_id']]['pid'][] = (int) $assoc['pid'];
+ $list[$assoc['company_id']]['pref'][] = (string) $assoc['pref'];
$list[$assoc['company_id']]['ptype'][] = 'ExpenseReportPayment';
- $list[$assoc['company_id']]['payment_id'][] = $assoc['payment_id'];
- $list[$assoc['company_id']]['payment_ref'][] = $assoc['payment_ref'];
- $list[$assoc['company_id']]['payment_amount'][] = $assoc['payment_amount'];
+ $list[$assoc['company_id']]['payment_id'][] = (int) $assoc['payment_id'];
+ $list[$assoc['company_id']]['payment_ref'][] = (string) $assoc['payment_ref'];
+ $list[$assoc['company_id']]['payment_amount'][] = (float) $assoc['payment_amount'];
$company_id = $assoc['company_id'];
}
@@ -684,21 +687,22 @@ function tax_by_thirdparty($type, $db, $y, $date_start, $date_end, $modetax, $di
return $list;
}
+
/**
* Gets Tax to collect for the given year (and given quarter or month)
* The function gets the Tax in split results, as the Tax declaration asks
* to report the amounts for different Tax rates as different lines.
*
- * @param string $type Tax type, either 'vat', 'localtax1' or 'localtax2'
- * @param DoliDB $db Database handler object
- * @param int $y Year
- * @param int $q Quarter
+ * @param 'vat'|'localtax1'|'localtax2' $type Tax type, either 'vat', 'localtax1' or 'localtax2'
+ * @param DoliDB $db Database handler object
+ * @param int $y Year
+ * @param int<0,4> $q Quarter
* @param int|'' $date_start Start date
* @param int|'' $date_end End date
* @param int $modetax Not used
* @param 'sell'|'buy' $direction 'sell' (customer invoice) or 'buy' (supplier invoices)
- * @param int $m Month
- * @return array|int Array with details of VATs (per rate), -1 if no accountancy module, -2 if not yet developed, -3 if error
+ * @param int<0,12> $m Month
+ * @return int<-3,-1>|array Array with details of VATs (per rate), -1 if no accountancy module, -2 if not yet developed, -3 if error
*/
function tax_by_rate($type, $db, $y, $q, $date_start, $date_end, $modetax, $direction, $m = 0)
{
@@ -891,50 +895,50 @@ function tax_by_rate($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire
if ($assoc['rowid'] != $oldrowid) { // Si rupture sur d.rowid
$oldrowid = $assoc['rowid'];
- $list[$rate_key]['totalht'] += $assoc['total_ht'];
- $list[$rate_key]['vat'] += $assoc['total_vat'];
- $list[$rate_key]['localtax1'] += $assoc['total_localtax1'];
- $list[$rate_key]['localtax2'] += $assoc['total_localtax2'];
+ $list[$rate_key]['totalht'] += (float) $assoc['total_ht'];
+ $list[$rate_key]['vat'] += (float) $assoc['total_vat'];
+ $list[$rate_key]['localtax1'] += (float) $assoc['total_localtax1'];
+ $list[$rate_key]['localtax2'] += (float) $assoc['total_localtax2'];
}
- $list[$rate_key]['dtotal_ttc'][] = $assoc['total_ttc'];
- $list[$rate_key]['dtype'][] = $assoc['dtype'];
+ $list[$rate_key]['dtotal_ttc'][] = (float) $assoc['total_ttc'];
+ $list[$rate_key]['dtype'][] = (int) $assoc['dtype'];
$list[$rate_key]['datef'][] = $db->jdate($assoc['datef']);
$list[$rate_key]['datep'][] = $db->jdate($assoc['datep']);
- $list[$rate_key]['company_name'][] = $assoc['company_name'];
- $list[$rate_key]['company_id'][] = $assoc['company_id'];
- $list[$rate_key]['company_alias'][] = $assoc['company_alias'];
- $list[$rate_key]['company_email'][] = $assoc['company_email'];
- $list[$rate_key]['company_tva_intra'][] = $assoc['company_tva_intra'];
- $list[$rate_key]['company_client'][] = $assoc['company_client'];
- $list[$rate_key]['company_fournisseur'][] = $assoc['company_fournisseur'];
- $list[$rate_key]['company_customer_code'][] = $assoc['company_customer_code'];
- $list[$rate_key]['company_supplier_code'][] = $assoc['company_supplier_code'];
- $list[$rate_key]['company_customer_accounting_code'][] = $assoc['company_customer_accounting_code'];
- $list[$rate_key]['company_supplier_accounting_code'][] = $assoc['company_supplier_accounting_code'];
- $list[$rate_key]['company_status'][] = $assoc['company_status'];
+ $list[$rate_key]['company_name'][] = (string) $assoc['company_name'];
+ $list[$rate_key]['company_id'][] = (int) $assoc['company_id'];
+ $list[$rate_key]['company_alias'][] = (string) $assoc['company_alias'];
+ $list[$rate_key]['company_email'][] = (string) $assoc['company_email'];
+ $list[$rate_key]['company_tva_intra'][] = (string) $assoc['company_tva_intra'];
+ $list[$rate_key]['company_client'][] = (int) $assoc['company_client'];
+ $list[$rate_key]['company_fournisseur'][] = (int) $assoc['company_fournisseur'];
+ $list[$rate_key]['company_customer_code'][] = (string) $assoc['company_customer_code'];
+ $list[$rate_key]['company_supplier_code'][] = (string) $assoc['company_supplier_code'];
+ $list[$rate_key]['company_customer_accounting_code'][] = (string) $assoc['company_customer_accounting_code'];
+ $list[$rate_key]['company_supplier_accounting_code'][] = (string) $assoc['company_supplier_accounting_code'];
+ $list[$rate_key]['company_status'][] = (int) $assoc['company_status'];
$list[$rate_key]['ddate_start'][] = $db->jdate($assoc['date_start']);
$list[$rate_key]['ddate_end'][] = $db->jdate($assoc['date_end']);
- $list[$rate_key]['facid'][] = $assoc['facid'];
- $list[$rate_key]['facnum'][] = $assoc['facnum'];
- $list[$rate_key]['type'][] = $assoc['type'];
- $list[$rate_key]['ftotal_ttc'][] = $assoc['ftotal_ttc'];
- $list[$rate_key]['descr'][] = $assoc['descr'];
+ $list[$rate_key]['facid'][] = (int) $assoc['facid'];
+ $list[$rate_key]['facnum'][] = (string) $assoc['facnum'];
+ $list[$rate_key]['type'][] = (int) $assoc['type'];
+ $list[$rate_key]['ftotal_ttc'][] = (float) $assoc['ftotal_ttc'];
+ $list[$rate_key]['descr'][] = (string) $assoc['descr'];
- $list[$rate_key]['totalht_list'][] = $assoc['total_ht'];
- $list[$rate_key]['vat_list'][] = $assoc['total_vat'];
- $list[$rate_key]['localtax1_list'][] = $assoc['total_localtax1'];
- $list[$rate_key]['localtax2_list'][] = $assoc['total_localtax2'];
+ $list[$rate_key]['totalht_list'][] = (float) $assoc['total_ht'];
+ $list[$rate_key]['vat_list'][] = (float) $assoc['total_vat'];
+ $list[$rate_key]['localtax1_list'][] = (float) $assoc['total_localtax1'];
+ $list[$rate_key]['localtax2_list'][] = (float) $assoc['total_localtax2'];
- $list[$rate_key]['pid'][] = $assoc['pid'];
- $list[$rate_key]['pref'][] = $assoc['pref'];
- $list[$rate_key]['ptype'][] = $assoc['ptype'];
+ $list[$rate_key]['pid'][] = (int) $assoc['pid'];
+ $list[$rate_key]['pref'][] = (string) $assoc['pref'];
+ $list[$rate_key]['ptype'][] = (int) $assoc['ptype'];
- $list[$rate_key]['payment_id'][] = $assoc['payment_id'];
- $list[$rate_key]['payment_ref'][] = $assoc['payment_ref'];
- $list[$rate_key]['payment_amount'][] = $assoc['payment_amount'];
+ $list[$rate_key]['payment_id'][] = (int) $assoc['payment_id'];
+ $list[$rate_key]['payment_ref'][] = (string) $assoc['payment_ref'];
+ $list[$rate_key]['payment_amount'][] = (float) $assoc['payment_amount'];
$rate = $assoc['rate'];
}
@@ -1092,50 +1096,50 @@ function tax_by_rate($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire
if ($assoc['rowid'] != $oldrowid) { // Si rupture sur d.rowid
$oldrowid = $assoc['rowid'];
- $list[$rate_key]['totalht'] += $assoc['total_ht'];
- $list[$rate_key]['vat'] += $assoc['total_vat'];
- $list[$rate_key]['localtax1'] += $assoc['total_localtax1'];
- $list[$rate_key]['localtax2'] += $assoc['total_localtax2'];
+ $list[$rate_key]['totalht'] += (float) $assoc['total_ht'];
+ $list[$rate_key]['vat'] += (float) $assoc['total_vat'];
+ $list[$rate_key]['localtax1'] += (float) $assoc['total_localtax1'];
+ $list[$rate_key]['localtax2'] += (float) $assoc['total_localtax2'];
}
- $list[$rate_key]['dtotal_ttc'][] = $assoc['total_ttc'];
- $list[$rate_key]['dtype'][] = $assoc['dtype'];
+ $list[$rate_key]['dtotal_ttc'][] = (float) $assoc['total_ttc'];
+ $list[$rate_key]['dtype'][] = (int) $assoc['dtype'];
$list[$rate_key]['datef'][] = $db->jdate($assoc['datef']);
$list[$rate_key]['datep'][] = $db->jdate($assoc['datep']);
$list[$rate_key]['ddate_start'][] = $db->jdate($assoc['date_start']);
$list[$rate_key]['ddate_end'][] = $db->jdate($assoc['date_end']);
- $list[$rate_key]['company_name'][] = $assoc['company_name'];
- $list[$rate_key]['company_id'][] = $assoc['company_id'];
- $list[$rate_key]['company_alias'][] = $assoc['company_alias'];
- $list[$rate_key]['company_email'][] = $assoc['company_email'];
- $list[$rate_key]['company_tva_intra'][] = $assoc['company_tva_intra'];
- $list[$rate_key]['company_client'][] = $assoc['company_client'];
- $list[$rate_key]['company_fournisseur'][] = $assoc['company_fournisseur'];
- $list[$rate_key]['company_customer_code'][] = $assoc['company_customer_code'];
- $list[$rate_key]['company_supplier_code'][] = $assoc['company_supplier_code'];
- $list[$rate_key]['company_customer_accounting_code'][] = $assoc['company_customer_accounting_code'];
- $list[$rate_key]['company_supplier_accounting_code'][] = $assoc['company_supplier_accounting_code'];
- $list[$rate_key]['company_status'][] = $assoc['company_status'];
+ $list[$rate_key]['company_name'][] = (string) $assoc['company_name'];
+ $list[$rate_key]['company_id'][] = (int) $assoc['company_id'];
+ $list[$rate_key]['company_alias'][] = (string) $assoc['company_alias'];
+ $list[$rate_key]['company_email'][] = (string) $assoc['company_email'];
+ $list[$rate_key]['company_tva_intra'][] = (string) $assoc['company_tva_intra'];
+ $list[$rate_key]['company_client'][] = (int) $assoc['company_client'];
+ $list[$rate_key]['company_fournisseur'][] = (int) $assoc['company_fournisseur'];
+ $list[$rate_key]['company_customer_code'][] = (string) $assoc['company_customer_code'];
+ $list[$rate_key]['company_supplier_code'][] = (string) $assoc['company_supplier_code'];
+ $list[$rate_key]['company_customer_accounting_code'][] = (string) $assoc['company_customer_accounting_code'];
+ $list[$rate_key]['company_supplier_accounting_code'][] = (string) $assoc['company_supplier_accounting_code'];
+ $list[$rate_key]['company_status'][] = (int) $assoc['company_status'];
- $list[$rate_key]['facid'][] = $assoc['facid'];
- $list[$rate_key]['facnum'][] = $assoc['facnum'];
- $list[$rate_key]['type'][] = $assoc['type'];
- $list[$rate_key]['ftotal_ttc'][] = $assoc['ftotal_ttc'];
- $list[$rate_key]['descr'][] = $assoc['descr'];
+ $list[$rate_key]['facid'][] = (int) $assoc['facid'];
+ $list[$rate_key]['facnum'][] = (string) $assoc['facnum'];
+ $list[$rate_key]['type'][] = (int) $assoc['type'];
+ $list[$rate_key]['ftotal_ttc'][] = (float) $assoc['ftotal_ttc'];
+ $list[$rate_key]['descr'][] = (string) $assoc['descr'];
- $list[$rate_key]['totalht_list'][] = $assoc['total_ht'];
- $list[$rate_key]['vat_list'][] = $assoc['total_vat'];
- $list[$rate_key]['localtax1_list'][] = $assoc['total_localtax1'];
- $list[$rate_key]['localtax2_list'][] = $assoc['total_localtax2'];
+ $list[$rate_key]['totalht_list'][] = (float) $assoc['total_ht'];
+ $list[$rate_key]['vat_list'][] = (float) $assoc['total_vat'];
+ $list[$rate_key]['localtax1_list'][] = (float) $assoc['total_localtax1'];
+ $list[$rate_key]['localtax2_list'][] = (float) $assoc['total_localtax2'];
- $list[$rate_key]['pid'][] = $assoc['pid'];
- $list[$rate_key]['pref'][] = $assoc['pref'];
- $list[$rate_key]['ptype'][] = $assoc['ptype'];
+ $list[$rate_key]['pid'][] = (int) $assoc['pid'];
+ $list[$rate_key]['pref'][] = (string) $assoc['pref'];
+ $list[$rate_key]['ptype'][] = (int) $assoc['ptype'];
- $list[$rate_key]['payment_id'][] = $assoc['payment_id'];
- $list[$rate_key]['payment_ref'][] = $assoc['payment_ref'];
- $list[$rate_key]['payment_amount'][] = $assoc['payment_amount'];
+ $list[$rate_key]['payment_id'][] = (int) $assoc['payment_id'];
+ $list[$rate_key]['payment_ref'][] = (string) $assoc['payment_ref'];
+ $list[$rate_key]['payment_amount'][] = (float) $assoc['payment_amount'];
$rate = $assoc['rate'];
}
@@ -1219,39 +1223,39 @@ function tax_by_rate($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire
if ($assoc['rowid'] != $oldrowid) { // Si rupture sur d.rowid
$oldrowid = $assoc['rowid'];
- $list[$rate_key]['totalht'] += $assoc['total_ht'];
- $list[$rate_key]['vat'] += $assoc['total_vat'];
- $list[$rate_key]['localtax1'] += $assoc['total_localtax1'];
- $list[$rate_key]['localtax2'] += $assoc['total_localtax2'];
+ $list[$rate_key]['totalht'] += (float) $assoc['total_ht'];
+ $list[$rate_key]['vat'] += (float) $assoc['total_vat'];
+ $list[$rate_key]['localtax1'] += (float) $assoc['total_localtax1'];
+ $list[$rate_key]['localtax2'] += (float) $assoc['total_localtax2'];
}
- $list[$rate_key]['dtotal_ttc'][] = $assoc['total_ttc'];
+ $list[$rate_key]['dtotal_ttc'][] = (float) $assoc['total_ttc'];
$list[$rate_key]['dtype'][] = 'ExpenseReportPayment';
- $list[$rate_key]['datef'][] = $assoc['datef'];
+ $list[$rate_key]['datef'][] = (int) $assoc['datef'];
$list[$rate_key]['company_name'][] = '';
- $list[$rate_key]['company_id'][] = '';
- $list[$rate_key]['user_id'][] = $assoc['fk_user_author'];
+ $list[$rate_key]['company_id'][] = 0;
+ $list[$rate_key]['user_id'][] = (int) $assoc['fk_user_author'];
$list[$rate_key]['ddate_start'][] = $db->jdate($assoc['date_start']);
$list[$rate_key]['ddate_end'][] = $db->jdate($assoc['date_end']);
- $list[$rate_key]['facid'][] = $assoc['facid'];
- $list[$rate_key]['facnum'][] = $assoc['facnum'];
- $list[$rate_key]['type'][] = $assoc['type'];
- $list[$rate_key]['ftotal_ttc'][] = $assoc['ftotal_ttc'];
- $list[$rate_key]['descr'][] = $assoc['descr'];
+ $list[$rate_key]['facid'][] = (int) $assoc['facid'];
+ $list[$rate_key]['facnum'][] = (string) $assoc['facnum'];
+ $list[$rate_key]['type'][] = (int) $assoc['type'];
+ $list[$rate_key]['ftotal_ttc'][] = (float) $assoc['ftotal_ttc'];
+ $list[$rate_key]['descr'][] = (string) $assoc['descr'];
- $list[$rate_key]['totalht_list'][] = $assoc['total_ht'];
- $list[$rate_key]['vat_list'][] = $assoc['total_vat'];
- $list[$rate_key]['localtax1_list'][] = $assoc['total_localtax1'];
- $list[$rate_key]['localtax2_list'][] = $assoc['total_localtax2'];
+ $list[$rate_key]['totalht_list'][] = (float) $assoc['total_ht'];
+ $list[$rate_key]['vat_list'][] = (float) $assoc['total_vat'];
+ $list[$rate_key]['localtax1_list'][] = (float) $assoc['total_localtax1'];
+ $list[$rate_key]['localtax2_list'][] = (float) $assoc['total_localtax2'];
- $list[$rate_key]['pid'][] = $assoc['pid'];
- $list[$rate_key]['pref'][] = $assoc['pref'];
+ $list[$rate_key]['pid'][] = (int) $assoc['pid'];
+ $list[$rate_key]['pref'][] = (string) $assoc['pref'];
$list[$rate_key]['ptype'][] = 'ExpenseReportPayment';
- $list[$rate_key]['payment_id'][] = $assoc['payment_id'];
- $list[$rate_key]['payment_ref'][] = $assoc['payment_ref'];
- $list[$rate_key]['payment_amount'][] = $assoc['payment_amount'];
+ $list[$rate_key]['payment_id'][] = (int) $assoc['payment_id'];
+ $list[$rate_key]['payment_ref'][] = (string) $assoc['payment_ref'];
+ $list[$rate_key]['payment_amount'][] = (float) $assoc['payment_amount'];
$rate = $assoc['rate'];
}
diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php
index 4fe9d75f1c1..10b889aa345 100644
--- a/htdocs/core/modules/import/import_csv.modules.php
+++ b/htdocs/core/modules/import/import_csv.modules.php
@@ -86,6 +86,9 @@ class ImportCsv extends ModeleImports
public $charset = '';
+ /**
+ * @var int
+ */
public $col;
@@ -268,6 +271,8 @@ class ImportCsv extends ModeleImports
//var_dump($this->handle);
//var_dump($arrayres);exit;
$newarrayres = array();
+ $key = 1; // Default value to ensure $key is declared
+
if ($arrayres && is_array($arrayres)) {
foreach ($arrayres as $key => $val) {
if (getDolGlobalString('IMPORT_CSV_FORCE_CHARSET')) { // Forced charset
@@ -585,7 +590,7 @@ class ImportCsv extends ModeleImports
}
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'getcustomercodeifauto') {
if (strtolower($newval) == 'auto') {
- $this->thirdpartyobject->get_codeclient(0, 0);
+ $this->thirdpartyobject->get_codeclient(null, 0);
$newval = $this->thirdpartyobject->code_client;
//print 'code_client='.$newval;
}
@@ -594,7 +599,7 @@ class ImportCsv extends ModeleImports
}
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'getsuppliercodeifauto') {
if (strtolower($newval) == 'auto') {
- $this->thirdpartyobject->get_codefournisseur(0, 1);
+ $this->thirdpartyobject->get_codefournisseur(null, 1);
$newval = $this->thirdpartyobject->code_fournisseur;
//print 'code_fournisseur='.$newval;
}
diff --git a/htdocs/core/modules/import/import_xlsx.modules.php b/htdocs/core/modules/import/import_xlsx.modules.php
index 33ab2608e6a..b09466ff427 100644
--- a/htdocs/core/modules/import/import_xlsx.modules.php
+++ b/htdocs/core/modules/import/import_xlsx.modules.php
@@ -650,7 +650,7 @@ class ImportXlsx extends ModeleImports
}
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'getcustomercodeifauto') {
if (strtolower($newval) == 'auto') {
- $this->thirdpartyobject->get_codeclient(0, 0);
+ $this->thirdpartyobject->get_codeclient(null, 0);
$newval = $this->thirdpartyobject->code_client;
//print 'code_client='.$newval;
}
@@ -659,7 +659,7 @@ class ImportXlsx extends ModeleImports
}
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'getsuppliercodeifauto') {
if (strtolower($newval) == 'auto') {
- $this->thirdpartyobject->get_codefournisseur(0, 1);
+ $this->thirdpartyobject->get_codefournisseur(null, 1);
$newval = $this->thirdpartyobject->code_fournisseur;
//print 'code_fournisseur='.$newval;
}
@@ -894,6 +894,7 @@ class ImportXlsx extends ModeleImports
$listvalues[] = "'".$this->db->escape($tmp[1])."'";
} elseif (preg_match('/^rule-/', $val)) {
$fieldname = $key;
+ $classinstance = null;
if (!empty($objimport->array_import_convertvalue[0][$fieldname])) {
if ($objimport->array_import_convertvalue[0][$fieldname]['rule'] == 'compute') {
$file = (empty($objimport->array_import_convertvalue[0][$fieldname]['classfile']) ? $objimport->array_import_convertvalue[0][$fieldname]['file'] : $objimport->array_import_convertvalue[0][$fieldname]['classfile']);
@@ -923,7 +924,7 @@ class ImportXlsx extends ModeleImports
}
} else {
$this->errors[$error]['type'] = 'CLASSERROR';
- if (is_object($classinstance)) {
+ if (is_object($classinstance)) { // @phpstan-ignore-line
$this->errors[$error]['lib'] = implode(
"\n",
array_merge([$classinstance->error], $classinstance->errors)
diff --git a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php
index 43b5df77027..63f17a6a644 100644
--- a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php
+++ b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php
@@ -141,7 +141,7 @@ class doc_generic_project_odt extends ModelePDFProjects
* @param CommonObject $object Main object to use as data source
* @param Translate $outputlangs Lang object to use for output
* @param string $array_key Name of the key for return array
- * @return array Array of substitution
+ * @return array Array of substitution
*/
public function get_substitutionarray_object($object, $outputlangs, $array_key = 'object')
{
@@ -182,7 +182,8 @@ class doc_generic_project_odt extends ModelePDFProjects
*
* @param Task $task Task Object
* @param Translate $outputlangs Lang object to use for output
- * @return array Return a substitution array
+ * @return array{task_ref:string,task_fk_project:string,task_projectref:string,task_projectlabel:string,task_label:string,task_description:string,task_fk_parent:string,task_duration:string,task_duration_hour:string,task_planned_workload:string,task_planned_workload_hour:string,task_progress:string,task_public:string,task_date_start:string,task_date_end:string,task_note_private:string,task_note_public:string} Return a substitution array + extrafields
+
*/
public function get_substitutionarray_tasks(Task $task, $outputlangs)
{
@@ -221,9 +222,9 @@ class doc_generic_project_odt extends ModelePDFProjects
/**
* Define array with couple substitution key => substitution value
*
- * @param array $contact Contact array
+ * @param array{id:int,rowid:int,libelle:string,lastname:string,firstname:string,civility:string,fullname:string,socname:string,email:string,source:string} $contact Contact array
* @param Translate $outputlangs Lang object to use for output
- * @return array Return a substitution array
+ * @return array{projcontacts_id:int,projcontacts_rowid:int,projcontacts_role:string,projcontacts_lastname:string,projcontacts_firstname:string,projcontacts_civility:string,projcontacts_fullcivname:string,projcontacts_socname:string,projcontacts_email:string,projcontacts_isInternal:''|'0'|'1',projcontacts_phone_pro:string,projcontacts_phone_perso:string,projcontacts_phone_mobile:string} Return a substitution array (+ extrafields)
*/
public function get_substitutionarray_project_contacts($contact, $outputlangs)
{
@@ -278,9 +279,9 @@ class doc_generic_project_odt extends ModelePDFProjects
/**
* Define array with couple substitution key => substitution value
*
- * @param array $file file array
+ * @param array{name:string,path:string,level1name:string,relativename:string,fullname:string,date:string,size:int,perm:int,type:string} $file file array
* @param Translate $outputlangs Lang object to use for output
- * @return array Return a substitution array
+ * @return array{projfile_name:string,projfile_date:string,projfile_size:int} Return a substitution array
*/
public function get_substitutionarray_project_file($file, $outputlangs)
{
@@ -296,9 +297,9 @@ class doc_generic_project_odt extends ModelePDFProjects
/**
* Define array with couple substitution key => substitution value
*
- * @param array $refdetail Reference array
+ * @param array{type:string,ref:string,date:string,socname:string,amountht:float|'',amountttc:float|'',status:string} $refdetail Reference array
* @param Translate $outputlangs Lang object to use for output
- * @return array Return a substitution array
+ * @return array{projref_type:string,projref_ref:string,projref_date:string,projref_socname:string,projref_amountht:string,projref_amountttc:string,projref_status:string} Return a substitution array
*/
public function get_substitutionarray_project_reference($refdetail, $outputlangs)
{
@@ -320,9 +321,9 @@ class doc_generic_project_odt extends ModelePDFProjects
/**
* Define array with couple substitution key => substitution value
*
- * @param array $taskresource Reference array
+ * @param array{rowid:int,libelle:string,lastname:string,firstname:string,fullname:string,socname:string,email:string} $taskresource Reference array
* @param Translate $outputlangs Lang object to use for output
- * @return array Return a substitution array
+ * @return array{taskressource_rowid:int,taskressource_role:string,taskressource_lastname:string,taskressource_firstname:string,taskressource_fullcivname:string,taskressource_socname:string,taskressource_email:string} Return a substitution array
*/
public function get_substitutionarray_tasksressource($taskresource, $outputlangs)
{
@@ -344,9 +345,9 @@ class doc_generic_project_odt extends ModelePDFProjects
/**
* Define array with couple substitution key => substitution value
*
- * @param array $tasktime Array of times object
+ * @param array{rowid:int,task_date:int,task_duration:int,note:string,fk_user:int,name:string,firstname:string,fullcivname:string,amountht:float,amountttc:float,thm:int} $tasktime Array of times object
* @param Translate $outputlangs Lang object to use for output
- * @return array Return a substitution array
+ * @return array{tasktime_rowid:int,tasktime_task_date:string,tasktime_task_duration_sec:int,tasktime_task_duration:string,tasktime_note:string,tasktime_fk_user:int,tasktime_user_name:string,tasktime_user_first:string,tasktime_fullcivname:string,tasktime_amountht:float,tasktime_amountttc:float,tasktime_thm:int} Return a substitution array
*/
public function get_substitutionarray_taskstime($tasktime, $outputlangs)
{
@@ -371,9 +372,9 @@ class doc_generic_project_odt extends ModelePDFProjects
/**
* Define array with couple substitution key => substitution value
*
- * @param array $file file array
+ * @param array{name:string,path:string,level1name:string,relativename:string,fullname:string,date:string,size:int,perm:int,type:string} $file file array
* @param Translate $outputlangs Lang object to use for output
- * @return array Return a substitution array
+ * @return array{tasksfile_name:string,tasksfile_date:string,tasksfile_size:int} Return a substitution array
*/
public function get_substitutionarray_task_file($file, $outputlangs)
{
@@ -679,7 +680,7 @@ class doc_generic_project_odt extends ModelePDFProjects
$socid = $object->fk_soc;
}
- $tasksarray = $taskstatic->getTasksArray(0, 0, $object->id, $socid, 0);
+ $tasksarray = $taskstatic->getTasksArray(null, null, $object->id, $socid, 0);
foreach ($tasksarray as $task) {
@@ -720,6 +721,9 @@ class doc_generic_project_odt extends ModelePDFProjects
$soc = new Societe($this->db);
$soc->fetch($contact['socid']);
$contact['socname'] = $soc->name;
+ } else {
+ dol_syslog(get_class().'::'.__METHOD__.' Unexpected contact source:'.$contact['source'], LOG_ERR);
+ continue;
}
$contact['fullname'] = $objectdetail->getFullName($outputlangs, 1);
@@ -754,18 +758,18 @@ class doc_generic_project_odt extends ModelePDFProjects
$row = array();
$listlinestasktime = $listlines->__get('taskstimes');
if (empty($num)) {
- $row['rowid'] = '';
- $row['task_date'] = '';
- $row['task_duration'] = '';
- $row['$tasktime'] = '';
+ $row['rowid'] = 0;
+ $row['task_date'] = 0;
+ $row['task_duration'] = 0;
+ //$row['$tasktime'] = '';
$row['note'] = '';
- $row['fk_user'] = '';
+ $row['fk_user'] = 0;
$row['name'] = '';
$row['firstname'] = '';
$row['fullcivname'] = '';
- $row['amountht'] = '';
- $row['amountttc'] = '';
- $row['thm'] = '';
+ $row['amountht'] = 0;
+ $row['amountttc'] = 0;
+ $row['thm'] = 0;
$tmparray = $this->get_substitutionarray_taskstime($row, $outputlangs);
foreach ($tmparray as $key => $val) {
try {
@@ -1046,7 +1050,7 @@ class doc_generic_project_odt extends ModelePDFProjects
$num = count($elementarray);
for ($i = 0; $i < $num; $i++) {
$ref_array = array();
- $ref_array['type'] = $langs->trans($classname);
+ $ref_array['type'] = (string) $langs->trans($classname);
$element = new $classname($this->db);
$element->fetch($elementarray[$i]);
@@ -1063,7 +1067,7 @@ class doc_generic_project_odt extends ModelePDFProjects
if (empty($dateref)) {
$dateref = $element->date_contrat;
}
- $ref_array['date'] = $dateref;
+ $ref_array['date'] = (string) $dateref;
//Soc object
if (is_object($element->thirdparty)) {
diff --git a/htdocs/core/modules/project/doc/pdf_baleine.modules.php b/htdocs/core/modules/project/doc/pdf_baleine.modules.php
index fd0a320a187..e8c066d72cd 100644
--- a/htdocs/core/modules/project/doc/pdf_baleine.modules.php
+++ b/htdocs/core/modules/project/doc/pdf_baleine.modules.php
@@ -221,7 +221,7 @@ class pdf_baleine extends ModelePDFProjects
// Complete object by loading several other information
$task = new Task($this->db);
- $tasksarray = $task->getTasksArray(0, 0, $object->id);
+ $tasksarray = $task->getTasksArray(null, null, $object->id);
if (!$object->id > 0) { // Special case when used with object = specimen, we may return all lines
$tasksarray = array_slice($tasksarray, 0, min(5, count($tasksarray)));
diff --git a/htdocs/core/modules/project/doc/pdf_beluga.modules.php b/htdocs/core/modules/project/doc/pdf_beluga.modules.php
index 1aa57b85bb8..127e07842e3 100644
--- a/htdocs/core/modules/project/doc/pdf_beluga.modules.php
+++ b/htdocs/core/modules/project/doc/pdf_beluga.modules.php
@@ -89,11 +89,29 @@ class pdf_beluga extends ModelePDFProjects
*/
private $orientation;
+ /**
+ * @var float
+ */
public $posxref;
+ /**
+ * @var int
+ */
public $posxdate;
+ /**
+ * @var int
+ */
public $posxsociety;
+ /**
+ * @var int
+ */
public $posxamountht;
+ /**
+ * @var int
+ */
public $posxamountttc;
+ /**
+ * @var int
+ */
public $posxstatut;
@@ -253,7 +271,7 @@ class pdf_beluga extends ModelePDFProjects
// Complete object by loading several other information
$task = new Task($this->db);
$tasksarray = array();
- $tasksarray = $task->getTasksArray(0, 0, $object->id);
+ $tasksarray = $task->getTasksArray(null, null, $object->id);
// Special case when used with object = specimen, we may return all lines
if (!$object->id > 0) {
@@ -430,6 +448,8 @@ class pdf_beluga extends ModelePDFProjects
$listofreferent = array_merge($listofreferent, $hookmanager->resArray);
}
+ $pageposafter = 0;
+
foreach ($listofreferent as $key => $value) {
$title = $value['title'];
$classname = $value['class'];
diff --git a/htdocs/core/modules/project/doc/pdf_timespent.modules.php b/htdocs/core/modules/project/doc/pdf_timespent.modules.php
index b7faf4885c0..dc51b62caab 100644
--- a/htdocs/core/modules/project/doc/pdf_timespent.modules.php
+++ b/htdocs/core/modules/project/doc/pdf_timespent.modules.php
@@ -216,7 +216,7 @@ class pdf_timespent extends ModelePDFProjects
// Complete object by loading several other information
$task = new Task($this->db);
- $tasksarray = $task->getTasksArray(0, 0, $object->id);
+ $tasksarray = $task->getTasksArray(null, null, $object->id);
if (!$object->id > 0) { // Special case when used with object = specimen, we may return all lines
$tasksarray = array_slice($tasksarray, 0, min(5, count($tasksarray)));
diff --git a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php
index d1679fee4a5..35a0dc44ab0 100644
--- a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php
+++ b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php
@@ -338,9 +338,9 @@ class doc_generic_task_odt extends ModelePDFTask
/**
* Define array with couple substitution key => substitution value
*
- * @param array $file file array
+ * @param array{name:string,date:string,size:int} $file file array
* @param Translate $outputlangs Lang object to use for output
- * @return array Return a substitution array
+ * @return array{tasksfile_name:string,tasksfile_date:string,tasksfile_size:int} Return a substitution array
*/
public function get_substitutionarray_task_file($file, $outputlangs)
{
diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php
index 26192dc3ce0..8bfd1a6f372 100644
--- a/htdocs/societe/class/societe.class.php
+++ b/htdocs/societe/class/societe.class.php
@@ -2646,8 +2646,8 @@ class Societe extends CommonObject
*
* @param User $user Object user (not used)
* @param int $mode 0=Array with properties, 1=Array of IDs.
- * @param string $sortfield List of sort fields, separated by comma. Example: 't1.fielda,t2.fieldb'
- * @param string $sortorder Sort order, separated by comma. Example: 'ASC,DESC';
+ * @param ?string $sortfield List of sort fields, separated by comma. Example: 't1.fielda,t2.fieldb'
+ * @param ?string $sortorder Sort order, separated by comma. Example: 'ASC,DESC';
* @return array|int Array of sales representatives of the current third party or <0 if KO
*/
public function getSalesRepresentatives(User $user, $mode = 0, $sortfield = null, $sortorder = null)
@@ -3523,7 +3523,7 @@ class Societe extends CommonObject
* Assigns a customer code from the code control module.
* Return value is stored into this->code_client
*
- * @param Societe $objsoc Object thirdparty
+ * @param ?Societe $objsoc Object thirdparty
* @param int $type Should be 0 to say customer
* @return void
*/
@@ -3557,7 +3557,7 @@ class Societe extends CommonObject
* Assigns a vendor code from the code control module.
* Return value is stored into this->code_fournisseur
*
- * @param Societe $objsoc Object thirdparty
+ * @param ?Societe $objsoc Object thirdparty
* @param int $type Should be 1 to say supplier
* @return void
*/