diff --git a/dev/tools/phan/config.php b/dev/tools/phan/config.php
index 1d8a2f6f467..21d410a9665 100644
--- a/dev/tools/phan/config.php
+++ b/dev/tools/phan/config.php
@@ -497,7 +497,7 @@ return [
// 'PhanTypeMismatchDimAssignment',
// 'PhanPluginDescriptionlessCommentOnProtectedMethod',
// 'PhanPluginPrintfIncompatibleArgumentTypeWeak',
- 'PhanUndeclaredVariableAssignOp',
+ // 'PhanUndeclaredVariableAssignOp',
// 'PhanTypeExpectedObjectOrClassName',
'PhanEmptyFQSENInClasslike',
// 'PhanTypeMismatchArgumentInternalReal',
diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php
index 56d338270c5..d5604aab217 100644
--- a/htdocs/accountancy/bookkeeping/balance.php
+++ b/htdocs/accountancy/bookkeeping/balance.php
@@ -443,7 +443,7 @@ if ($action != 'export_csv') {
print_liste_field_titre("Balance", $_SERVER["PHP_SELF"], "", $param, "", 'class="right"', $sortfield, $sortorder);
// Hook fields
- $parameters = array('param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
+ $parameters = array('param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder);
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Action column
@@ -549,7 +549,7 @@ if ($action != 'export_csv') {
// Show first line of a break
print '
';
- print '| '.$root_account_number.($root_account_description ? ' - '.$root_account_description : '').' | ';
+ print ''.$root_account_number.($root_account_description ? ' - '.$root_account_description : '').' | ';
print '
';
$displayed_account = $root_account_number;
@@ -692,7 +692,7 @@ if ($action != 'export_csv') {
$accountingResult = $object->accountingResult($search_date_start, $search_date_end);
if ($accountingResult < 0) {
- $accountingResultDebit = price(price2num(abs($accountingResult), 'MT'));
+ $accountingResultDebit = price(abs(price2num($accountingResult, 'MT')));
$accountingResultClassCSS = ' error';
} else {
$accountingResultCredit = price(price2num($accountingResult, 'MT'));
diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php
index 09586c12637..601cb02bd38 100644
--- a/htdocs/accountancy/class/accountancyexport.class.php
+++ b/htdocs/accountancy/class/accountancyexport.class.php
@@ -943,7 +943,7 @@ class AccountancyExport
$tab['signe_montant'] = '+';
// The amount must be in centimes without decimal points.
- $tab['montant'] = str_pad(abs(($line->debit - $line->credit) * 100), 12, '0', STR_PAD_LEFT);
+ $tab['montant'] = str_pad((string) abs(($line->debit - $line->credit) * 100), 12, '0', STR_PAD_LEFT);
$tab['contrepartie'] = str_repeat(' ', 8);
// Force date format : %d%m%y
diff --git a/htdocs/accountancy/class/accountingjournal.class.php b/htdocs/accountancy/class/accountingjournal.class.php
index 90de07f928e..14afbbbe7d8 100644
--- a/htdocs/accountancy/class/accountingjournal.class.php
+++ b/htdocs/accountancy/class/accountingjournal.class.php
@@ -299,7 +299,7 @@ class AccountingJournal extends CommonObject
$label_link .= ' - '.($nourl ? '' : '').$langs->transnoentities($this->label).($nourl ? '' : '');
}
if ($withlabel == 2 && !empty($this->nature)) {
- $key = $langs->trans("AccountingJournalType".strtoupper($this->nature));
+ $key = $langs->trans("AccountingJournalType".$this->nature);
$transferlabel = ($this->nature && $key != "AccountingJournalType".strtoupper($langs->trans($this->nature)) ? $key : $this->label);
$label_link .= ' - '.($nourl ? '' : '').$transferlabel.($nourl ? '' : '');
}
diff --git a/htdocs/accountancy/closure/index.php b/htdocs/accountancy/closure/index.php
index 1226ae9d167..b33efc256e3 100644
--- a/htdocs/accountancy/closure/index.php
+++ b/htdocs/accountancy/closure/index.php
@@ -161,7 +161,7 @@ $formaccounting = new FormAccounting($db);
$title = $langs->trans('Closure');
-$help_url ='EN:Module_Double_Entry_Accounting|FR:Module_Comptabilité_en_Partie_Double#Cl.C3.B4ture_annuelle';
+$help_url = 'EN:Module_Double_Entry_Accounting|FR:Module_Comptabilité_en_Partie_Double#Cl.C3.B4ture_annuelle';
llxHeader('', $title, $help_url);
@@ -334,7 +334,7 @@ if (isset($current_fiscal_period)) {
print '' . $langs->trans("Year") . ' | ';
}
for ($i = 1; $i <= 12; $i++) {
- print '' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . ' | ';
+ print '' . $langs->trans('MonthShort' . str_pad((string) $i, 2, '0', STR_PAD_LEFT)) . ' | ';
}
print '' . $langs->trans("Total") . ' | ';
print '';
diff --git a/htdocs/accountancy/customer/index.php b/htdocs/accountancy/customer/index.php
index c5bd8949880..ed0e1b771d7 100644
--- a/htdocs/accountancy/customer/index.php
+++ b/htdocs/accountancy/customer/index.php
@@ -234,17 +234,17 @@ if ($action == 'validatehistory') {
$facture_static_det->desc = $objp->description;
$accountingAccountArray = array(
- 'dom'=>$objp->aarowid,
- 'intra'=>$objp->aarowid_intra,
- 'export'=>$objp->aarowid_export,
- 'thirdparty' =>$objp->aarowid_thirdparty);
+ 'dom' => $objp->aarowid,
+ 'intra' => $objp->aarowid_intra,
+ 'export' => $objp->aarowid_export,
+ 'thirdparty' => $objp->aarowid_thirdparty);
$code_sell_p_notset = '';
$code_sell_t_notset = '';
$suggestedid = 0;
- $return=$accountingAccount->getAccountingCodeToBind($thirdpartystatic, $mysoc, $product_static, $facture_static, $facture_static_det, $accountingAccountArray, 'customer');
+ $return = $accountingAccount->getAccountingCodeToBind($thirdpartystatic, $mysoc, $product_static, $facture_static, $facture_static_det, $accountingAccountArray, 'customer');
if (!is_array($return) && $return < 0) {
setEventMessage($accountingAccount->error, 'errors');
} else {
@@ -299,7 +299,7 @@ if ($action == 'validatehistory') {
/*
* View
*/
-$help_url ='EN:Module_Double_Entry_Accounting|FR:Module_Comptabilité_en_Partie_Double#Liaisons_comptables';
+$help_url = 'EN:Module_Double_Entry_Accounting|FR:Module_Comptabilité_en_Partie_Double#Liaisons_comptables';
llxHeader('', $langs->trans("CustomersVentilation"), $help_url);
@@ -347,7 +347,7 @@ for ($i = 1; $i <= 12; $i++) {
$param .= '&search_date_endday='.$tmp['mday'].'&search_date_endmonth='.$tmp['mon'].'&search_date_endyear='.$tmp['year'];
print '';
}
- print $langs->trans('MonthShort'.str_pad((int) $j, 2, '0', STR_PAD_LEFT));
+ print $langs->trans('MonthShort'.str_pad((string) $j, 2, '0', STR_PAD_LEFT));
if (!empty($tmp['mday'])) {
print '';
}
@@ -362,7 +362,7 @@ for ($i = 1; $i <= 12; $i++) {
if ($j > 12) {
$j -= 12;
}
- $sql .= " SUM(".$db->ifsql("MONTH(f.datef) = ".((int) $j), "fd.total_ht", "0").") AS month".str_pad((int) $j, 2, "0", STR_PAD_LEFT).",";
+ $sql .= " SUM(".$db->ifsql("MONTH(f.datef) = ".((string) $j), "fd.total_ht", "0").") AS month".str_pad((string) $j, 2, "0", STR_PAD_LEFT).",";
}
$sql .= " SUM(fd.total_ht) as total";
$sql .= " FROM ".MAIN_DB_PREFIX."facturedet as fd";
@@ -434,7 +434,7 @@ if ($resql) {
// Add link to make binding
if (!empty(price2num($row[$i]))) {
print '';
- print img_picto($langs->trans("ValidateHistory").' ('.$langs->trans('Month'.str_pad($cursormonth, 2, '0', STR_PAD_LEFT)).' '.$cursoryear.')', 'link', 'class="marginleft2"');
+ print img_picto($langs->trans("ValidateHistory").' ('.$langs->trans('Month'.str_pad((string) $cursormonth, 2, '0', STR_PAD_LEFT)).' '.$cursoryear.')', 'link', 'class="marginleft2"');
print '';
}
print '';
@@ -484,7 +484,7 @@ for ($i = 1; $i <= 12; $i++) {
$param .= '&search_date_endday='.$tmp['mday'].'&search_date_endmonth='.$tmp['mon'].'&search_date_endyear='.$tmp['year'];
print '';
}
- print $langs->trans('MonthShort'.str_pad((int) $j, 2, '0', STR_PAD_LEFT));
+ print $langs->trans('MonthShort'.str_pad((string) $j, 2, '0', STR_PAD_LEFT));
if (!empty($tmp['mday'])) {
print '';
}
@@ -499,7 +499,7 @@ for ($i = 1; $i <= 12; $i++) {
if ($j > 12) {
$j -= 12;
}
- $sql .= " SUM(".$db->ifsql("MONTH(f.datef) = ".((int) $j), "fd.total_ht", "0").") AS month".str_pad((int) $j, 2, "0", STR_PAD_LEFT).",";
+ $sql .= " SUM(".$db->ifsql("MONTH(f.datef) = ".((int) $j), "fd.total_ht", "0").") AS month".str_pad((string) $j, 2, "0", STR_PAD_LEFT).",";
}
$sql .= " SUM(fd.total_ht) as total";
$sql .= " FROM ".MAIN_DB_PREFIX."facturedet as fd";
@@ -595,7 +595,7 @@ if (getDolGlobalString('SHOW_TOTAL_OF_PREVIOUS_LISTS_IN_LIN_PAGE')) { // This pa
if ($j > 12) {
$j -= 12;
}
- print ''.$langs->trans('MonthShort'.str_pad((int) $j, 2, '0', STR_PAD_LEFT)).' | ';
+ print ''.$langs->trans('MonthShort'.str_pad((string) $j, 2, '0', STR_PAD_LEFT)).' | ';
}
print ''.$langs->trans("Total").' | ';
@@ -605,7 +605,7 @@ if (getDolGlobalString('SHOW_TOTAL_OF_PREVIOUS_LISTS_IN_LIN_PAGE')) { // This pa
if ($j > 12) {
$j -= 12;
}
- $sql .= " SUM(".$db->ifsql("MONTH(f.datef) = ".((int) $j), "fd.total_ht", "0").") AS month".str_pad((int) $j, 2, "0", STR_PAD_LEFT).",";
+ $sql .= " SUM(".$db->ifsql("MONTH(f.datef) = ".((int) $j), "fd.total_ht", "0").") AS month".str_pad((string) $j, 2, "0", STR_PAD_LEFT).",";
}
$sql .= " SUM(fd.total_ht) as total";
$sql .= " FROM ".MAIN_DB_PREFIX."facturedet as fd";
@@ -655,7 +655,7 @@ if (getDolGlobalString('SHOW_TOTAL_OF_PREVIOUS_LISTS_IN_LIN_PAGE')) { // This pa
if ($j > 12) {
$j -= 12;
}
- print ''.$langs->trans('MonthShort'.str_pad((int) $j, 2, '0', STR_PAD_LEFT)).' | ';
+ print ''.$langs->trans('MonthShort'.str_pad((string) $j, 2, '0', STR_PAD_LEFT)).' | ';
}
print ''.$langs->trans("Total").' | ';
@@ -670,17 +670,17 @@ if (getDolGlobalString('SHOW_TOTAL_OF_PREVIOUS_LISTS_IN_LIN_PAGE')) { // This pa
$sql .= " SUM(".$db->ifsql(
"MONTH(f.datef) = ".((int) $j),
" (".$db->ifsql(
- "fd.total_ht < 0",
- " (-1 * (abs(fd.total_ht) - (fd.buy_price_ht * fd.qty * (fd.situation_percent / 100))))", // TODO This is bugged, we must use the percent for the invoice and fd.situation_percent is cumulated percent !
- " (fd.total_ht - (fd.buy_price_ht * fd.qty * (fd.situation_percent / 100)))"
- ).")",
+ "fd.total_ht < 0",
+ " (-1 * (abs(fd.total_ht) - (fd.buy_price_ht * fd.qty * (fd.situation_percent / 100))))", // TODO This is bugged, we must use the percent for the invoice and fd.situation_percent is cumulated percent !
+ " (fd.total_ht - (fd.buy_price_ht * fd.qty * (fd.situation_percent / 100)))"
+ ).")",
0
- ).") AS month".str_pad((int) $j, 2, '0', STR_PAD_LEFT).",";
+ ).") AS month".str_pad((string) $j, 2, '0', STR_PAD_LEFT).",";
}
$sql .= " SUM(".$db->ifsql(
"fd.total_ht < 0",
" (-1 * (abs(fd.total_ht) - (fd.buy_price_ht * fd.qty * (fd.situation_percent / 100))))", // TODO This is bugged, we must use the percent for the invoice and fd.situation_percent is cumulated percent !
- " (fd.total_ht - (fd.buy_price_ht * fd.qty * (fd.situation_percent / 100)))"
+ " (fd.total_ht - (fd.buy_price_ht * fd.qty * (fd.situation_percent / 100)))"
).") as total";
} else {
$sql = "SELECT '".$db->escape($langs->trans("Vide"))."' AS marge,";
@@ -697,7 +697,7 @@ if (getDolGlobalString('SHOW_TOTAL_OF_PREVIOUS_LISTS_IN_LIN_PAGE')) { // This pa
" (fd.total_ht - (fd.buy_price_ht * fd.qty))"
).")",
0
- ).") AS month".str_pad((int) $j, 2, '0', STR_PAD_LEFT).",";
+ ).") AS month".str_pad((string) $j, 2, '0', STR_PAD_LEFT).",";
}
$sql .= " SUM(".$db->ifsql(
"fd.total_ht < 0",
diff --git a/htdocs/accountancy/expensereport/index.php b/htdocs/accountancy/expensereport/index.php
index f72ad2b3037..afe6465562f 100644
--- a/htdocs/accountancy/expensereport/index.php
+++ b/htdocs/accountancy/expensereport/index.php
@@ -177,7 +177,7 @@ if ($action == 'validatehistory') {
/*
* View
*/
-$help_url ='EN:Module_Double_Entry_Accounting|FR:Module_Comptabilité_en_Partie_Double#Liaisons_comptables';
+$help_url = 'EN:Module_Double_Entry_Accounting|FR:Module_Comptabilité_en_Partie_Double#Liaisons_comptables';
llxHeader('', $langs->trans("ExpenseReportsVentilation"), $help_url);
@@ -223,7 +223,7 @@ for ($i = 1; $i <= 12; $i++) {
$param .= '&search_month='.$tmp['mon'].'&search_year='.$tmp['year'];
print '';
}
- print $langs->trans('MonthShort'.str_pad((int) $j, 2, '0', STR_PAD_LEFT));
+ print $langs->trans('MonthShort'.str_pad((string) $j, 2, '0', STR_PAD_LEFT));
if (!empty($tmp['mday'])) {
print '';
}
@@ -238,7 +238,7 @@ for ($i = 1; $i <= 12; $i++) {
if ($j > 12) {
$j -= 12;
}
- $sql .= " SUM(".$db->ifsql("MONTH(er.date_debut) = ".((int) $j), "erd.total_ht", "0").") AS month".str_pad((int) $j, 2, "0", STR_PAD_LEFT).",";
+ $sql .= " SUM(".$db->ifsql("MONTH(er.date_debut) = ".((int) $j), "erd.total_ht", "0").") AS month".str_pad((string) $j, 2, "0", STR_PAD_LEFT).",";
}
$sql .= " SUM(erd.total_ht) as total";
$sql .= " FROM ".MAIN_DB_PREFIX."expensereport_det as erd";
@@ -300,7 +300,7 @@ if ($resql) {
// Add link to make binding
if (!empty(price2num($row[$i]))) {
print '';
- print img_picto($langs->trans("ValidateHistory").' ('.$langs->trans('Month'.str_pad($cursormonth, 2, '0', STR_PAD_LEFT)).' '.$cursoryear.')', 'link', 'class="marginleft2"');
+ print img_picto($langs->trans("ValidateHistory").' ('.$langs->trans('Month'.str_pad((string) $cursormonth, 2, '0', STR_PAD_LEFT)).' '.$cursoryear.')', 'link', 'class="marginleft2"');
print '';
}
print '';
@@ -338,7 +338,7 @@ for ($i = 1; $i <= 12; $i++) {
if ($j > 12) {
$j -= 12;
}
- print ''.$langs->trans('MonthShort'.str_pad((int) $j, 2, '0', STR_PAD_LEFT)).' | ';
+ print ''.$langs->trans('MonthShort'.str_pad((string) $j, 2, '0', STR_PAD_LEFT)).' | ';
}
print ''.$langs->trans("Total").' | ';
@@ -349,7 +349,7 @@ for ($i = 1; $i <= 12; $i++) {
if ($j > 12) {
$j -= 12;
}
- $sql .= " SUM(".$db->ifsql("MONTH(er.date_debut) = ".((int) $j), "erd.total_ht", "0").") AS month".str_pad((int) $j, 2, "0", STR_PAD_LEFT).",";
+ $sql .= " SUM(".$db->ifsql("MONTH(er.date_debut) = ".((int) $j), "erd.total_ht", "0").") AS month".str_pad((string) $j, 2, "0", STR_PAD_LEFT).",";
}
$sql .= " ROUND(SUM(erd.total_ht),2) as total";
$sql .= " FROM ".MAIN_DB_PREFIX."expensereport_det as erd";
@@ -426,7 +426,7 @@ if (getDolGlobalString('SHOW_TOTAL_OF_PREVIOUS_LISTS_IN_LIN_PAGE')) { // This pa
if ($j > 12) {
$j -= 12;
}
- print ''.$langs->trans('MonthShort'.str_pad($j, 2, '0', STR_PAD_LEFT)).' | ';
+ print ''.$langs->trans('MonthShort'.str_pad((string) $j, 2, '0', STR_PAD_LEFT)).' | ';
}
print ''.$langs->trans("Total").' | ';
@@ -436,7 +436,7 @@ if (getDolGlobalString('SHOW_TOTAL_OF_PREVIOUS_LISTS_IN_LIN_PAGE')) { // This pa
if ($j > 12) {
$j -= 12;
}
- $sql .= " SUM(".$db->ifsql("MONTH(er.date_create) = ".((int) $j), "erd.total_ht", "0").") AS month".str_pad((int) $j, 2, "0", STR_PAD_LEFT).",";
+ $sql .= " SUM(".$db->ifsql("MONTH(er.date_create) = ".((int) $j), "erd.total_ht", "0").") AS month".str_pad((string) $j, 2, "0", STR_PAD_LEFT).",";
}
$sql .= " SUM(erd.total_ht) as total";
$sql .= " FROM ".MAIN_DB_PREFIX."expensereport_det as erd";
diff --git a/htdocs/accountancy/supplier/index.php b/htdocs/accountancy/supplier/index.php
index dea3d7b875a..ab8dfe60060 100644
--- a/htdocs/accountancy/supplier/index.php
+++ b/htdocs/accountancy/supplier/index.php
@@ -232,10 +232,10 @@ if ($action == 'validatehistory') {
$facture_static_det->desc = $objp->description;
$accountingAccountArray = array(
- 'dom'=>$objp->aarowid,
- 'intra'=>$objp->aarowid_intra,
- 'export'=>$objp->aarowid_export,
- 'thirdparty' =>$objp->aarowid_thirdparty);
+ 'dom' => $objp->aarowid,
+ 'intra' => $objp->aarowid_intra,
+ 'export' => $objp->aarowid_export,
+ 'thirdparty' => $objp->aarowid_thirdparty);
$code_buy_p_notset = '';
$code_buy_t_notset = '';
@@ -243,7 +243,7 @@ if ($action == 'validatehistory') {
$suggestedid = 0;
$return = $accountingAccount->getAccountingCodeToBind($mysoc, $thirdpartystatic, $product_static, $facture_static, $facture_static_det, $accountingAccountArray, 'supplier');
- if (!is_array($return) && $return<0) {
+ if (!is_array($return) && $return < 0) {
setEventMessage($accountingAccount->error, 'errors');
} else {
$suggestedid = $return['suggestedid'];
@@ -297,7 +297,7 @@ if ($action == 'validatehistory') {
/*
* View
*/
-$help_url ='EN:Module_Double_Entry_Accounting|FR:Module_Comptabilité_en_Partie_Double#Liaisons_comptables';
+$help_url = 'EN:Module_Double_Entry_Accounting|FR:Module_Comptabilité_en_Partie_Double#Liaisons_comptables';
llxHeader('', $langs->trans("SuppliersVentilation"), $help_url);
@@ -340,7 +340,7 @@ for ($i = 1; $i <= 12; $i++) {
$param .= '&search_date_endday='.$tmp['mday'].'&search_date_endmonth='.$tmp['mon'].'&search_date_endyear='.$tmp['year'];
print '';
}
- print $langs->trans('MonthShort'.str_pad((int) $j, 2, '0', STR_PAD_LEFT));
+ print $langs->trans('MonthShort'.str_pad((string) $j, 2, '0', STR_PAD_LEFT));
if (!empty($tmp['mday'])) {
print '';
}
@@ -355,7 +355,7 @@ for ($i = 1; $i <= 12; $i++) {
if ($j > 12) {
$j -= 12;
}
- $sql .= " SUM(".$db->ifsql("MONTH(ff.datef) = ".((int) $j), "ffd.total_ht", "0").") AS month".str_pad((int) $j, 2, "0", STR_PAD_LEFT).",";
+ $sql .= " SUM(".$db->ifsql("MONTH(ff.datef) = ".((int) $j), "ffd.total_ht", "0").") AS month".str_pad((string) $j, 2, "0", STR_PAD_LEFT).",";
}
$sql .= " SUM(ffd.total_ht) as total";
$sql .= " FROM ".$db->prefix()."facture_fourn_det as ffd";
@@ -422,7 +422,7 @@ if ($resql) {
// Add link to make binding
if (!empty(price2num($row[$i]))) {
print '';
- print img_picto($langs->trans("ValidateHistory").' ('.$langs->trans('Month'.str_pad($cursormonth, 2, '0', STR_PAD_LEFT)).' '.$cursoryear.')', 'link', 'class="marginleft2"');
+ print img_picto($langs->trans("ValidateHistory").' ('.$langs->trans('Month'.str_pad((string) $cursormonth, 2, '0', STR_PAD_LEFT)).' '.$cursoryear.')', 'link', 'class="marginleft2"');
print '';
}
print '';
@@ -472,7 +472,7 @@ for ($i = 1; $i <= 12; $i++) {
$param .= '&search_date_endday='.$tmp['mday'].'&search_date_endmonth='.$tmp['mon'].'&search_date_endyear='.$tmp['year'];
print '';
}
- print $langs->trans('MonthShort'.str_pad($j, 2, '0', STR_PAD_LEFT));
+ print $langs->trans('MonthShort'.str_pad((string) $j, 2, '0', STR_PAD_LEFT));
if (!empty($tmp['mday'])) {
print '';
}
@@ -487,7 +487,7 @@ for ($i = 1; $i <= 12; $i++) {
if ($j > 12) {
$j -= 12;
}
- $sql .= " SUM(".$db->ifsql("MONTH(ff.datef) = ".((int) $j), "ffd.total_ht", "0").") AS month".str_pad((int) $j, 2, "0", STR_PAD_LEFT).",";
+ $sql .= " SUM(".$db->ifsql("MONTH(ff.datef) = ".((int) $j), "ffd.total_ht", "0").") AS month".str_pad((string) $j, 2, "0", STR_PAD_LEFT).",";
}
$sql .= " SUM(ffd.total_ht) as total";
$sql .= " FROM ".$db->prefix()."facture_fourn_det as ffd";
@@ -571,7 +571,7 @@ if (getDolGlobalString('SHOW_TOTAL_OF_PREVIOUS_LISTS_IN_LIN_PAGE')) { // This pa
if ($j > 12) {
$j -= 12;
}
- print ''.$langs->trans('MonthShort'.str_pad((int) $j, 2, '0', STR_PAD_LEFT)).' | ';
+ print ''.$langs->trans('MonthShort'.str_pad((string) $j, 2, '0', STR_PAD_LEFT)).' | ';
}
print ''.$langs->trans("Total").' | ';
@@ -581,7 +581,7 @@ if (getDolGlobalString('SHOW_TOTAL_OF_PREVIOUS_LISTS_IN_LIN_PAGE')) { // This pa
if ($j > 12) {
$j -= 12;
}
- $sql .= " SUM(".$db->ifsql("MONTH(ff.datef) = ".((int) $j), "ffd.total_ht", "0").") AS month".str_pad((int) $j, 2, "0", STR_PAD_LEFT).",";
+ $sql .= " SUM(".$db->ifsql("MONTH(ff.datef) = ".((int) $j), "ffd.total_ht", "0").") AS month".str_pad((string) $j, 2, "0", STR_PAD_LEFT).",";
}
$sql .= " SUM(ffd.total_ht) as total";
$sql .= " FROM ".$db->prefix()."facture_fourn_det as ffd";
diff --git a/htdocs/adherents/canvas/actions_adherentcard_common.class.php b/htdocs/adherents/canvas/actions_adherentcard_common.class.php
index d18ba0c335d..d4b06aa2b1f 100644
--- a/htdocs/adherents/canvas/actions_adherentcard_common.class.php
+++ b/htdocs/adherents/canvas/actions_adherentcard_common.class.php
@@ -148,7 +148,7 @@ abstract class ActionsAdherentCardCommon
// Town
$this->tpl['select_town'] = $formcompany->select_ziptown($this->object->town, 'town', array('zipcode', 'selectcountry_id', 'state_id'));
- if (dol_strlen(trim($this->object->country_id)) == 0) {
+ if ($this->object->country_id == 0) {
$this->object->country_id = $objsoc->country_id;
}
@@ -168,7 +168,7 @@ abstract class ActionsAdherentCardCommon
}
// Physical or Moral
- $selectarray = array('0'=>$langs->trans("Physical"), '1'=>$langs->trans("Moral"));
+ $selectarray = array('0' => $langs->trans("Physical"), '1' => $langs->trans("Moral"));
$this->tpl['select_morphy'] = $form->selectarray('morphy', $selectarray, $this->object->morphy, 0);
}
diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php
index e8575c36337..051e398512b 100644
--- a/htdocs/adherents/card.php
+++ b/htdocs/adherents/card.php
@@ -593,7 +593,7 @@ if (empty($reshook)) {
$rowid = $object->id;
$id = $object->id;
- $backtopage = preg_replace('/__ID__/', $id, $backtopage);
+ $backtopage = preg_replace('/__ID__/', (string) $id, $backtopage);
} else {
$db->rollback();
diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php
index df36f5c95da..1be94641271 100644
--- a/htdocs/adherents/type.php
+++ b/htdocs/adherents/type.php
@@ -145,7 +145,7 @@ if ($action == 'add' && $user->hasRight('adherent', 'configurer')) {
$object->note_public = trim($comment);
$object->note_private = '';
$object->mail_valid = trim($mail_valid);
- $object->vote = (int) $vote;
+ $object->vote = $vote; // $vote is already int
// Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost(null, $object);
@@ -201,7 +201,7 @@ if ($action == 'update' && $user->hasRight('adherent', 'configurer')) {
$object->note_public = trim($comment);
$object->note_private = '';
$object->mail_valid = trim($mail_valid);
- $object->vote = (bool) trim($vote);
+ $object->vote = $vote; // $vote is already int.
// Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET');
diff --git a/htdocs/admin/external_rss.php b/htdocs/admin/external_rss.php
index 4d1b5cc3bed..5d3228ae23a 100644
--- a/htdocs/admin/external_rss.php
+++ b/htdocs/admin/external_rss.php
@@ -347,7 +347,7 @@ $db->close();
function _isInBoxList($idrss, array $boxlist)
{
foreach ($boxlist as $box) {
- if ($box->boxcode === "lastrssinfos" && strpos($box->note, $idrss) !== false) {
+ if ($box->boxcode === "lastrssinfos" && strpos($box->note, (string) $idrss) !== false) {
return true;
}
}
diff --git a/htdocs/admin/workflow.php b/htdocs/admin/workflow.php
index 2e28dc8a6f9..d68b7c054ef 100644
--- a/htdocs/admin/workflow.php
+++ b/htdocs/admin/workflow.php
@@ -158,7 +158,7 @@ $workflowcodes = array(
'WORKFLOW_SHIPPING_CLASSIFY_CLOSED_INVOICE' => array(
'family' => 'classify_shipping',
'position' => 90,
- 'enabled' => isModEnabled("expedition") && isModEnabled("facture"),
+ 'enabled' => isModEnabled("shipping") && isModEnabled("invoice"),
'picto' => 'shipment',
'deprecated' => 1
),
@@ -217,10 +217,10 @@ $workflowcodes = array_filter(
$workflowcodes,
/**
* @param array{enabled:int<0,1>} $var
- * @return int<0,1>
+ * @return bool
*/
static function ($var) {
- return $var['enabled'];
+ return (bool) $var['enabled'];
}
);
diff --git a/htdocs/asterisk/wrapper.php b/htdocs/asterisk/wrapper.php
index f81f081f9a3..865d2754981 100644
--- a/htdocs/asterisk/wrapper.php
+++ b/htdocs/asterisk/wrapper.php
@@ -182,7 +182,7 @@ if (!empty($number)) {
$errno = 0;
$errstr = 0;
$strCallerId = "Dolibarr caller $found <".strtolower($number).">";
- $oSocket = @fsockopen($strHost, $port, $errno, $errstr, 10);
+ $oSocket = @fsockopen($strHost, (int) $port, $errno, $errstr, 10);
if (!$oSocket) {
print ''."\n";
$txt = "Failed to execute fsockopen($strHost, $port, \$errno, \$errstr, 10)
\n";
diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php
index 1e27f3d54f8..9b688ac3d3e 100644
--- a/htdocs/comm/action/card.php
+++ b/htdocs/comm/action/card.php
@@ -172,7 +172,7 @@ if (empty($reshook) && (GETPOST('removedassigned') || GETPOST('removedassigned')
$idtoremove = GETPOST('removedassigned');
if (!empty($_SESSION['assignedtouser'])) {
- $tmpassigneduserids = json_decode($_SESSION['assignedtouser'], 1);
+ $tmpassigneduserids = json_decode($_SESSION['assignedtouser'], true);
} else {
$tmpassigneduserids = array();
}
@@ -199,7 +199,7 @@ if (empty($reshook) && (GETPOST('removedassignedresource') || GETPOST('removedas
$idtoremove = GETPOST('removedassignedresource');
if (!empty($_SESSION['assignedtoresource'])) {
- $tmpassignedresourceids = json_decode($_SESSION['assignedtoresource'], 1);
+ $tmpassignedresourceids = json_decode($_SESSION['assignedtoresource'], true);
} else {
$tmpassignedresourceids = array();
}
diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php
index d0efa85599e..9c512bfc047 100644
--- a/htdocs/comm/mailing/card.php
+++ b/htdocs/comm/mailing/card.php
@@ -1491,6 +1491,7 @@ if ($action == 'create') {
print '';
// List of files
$listofpaths = dol_dir_list($upload_dir, 'all', 0, '', '', 'name', SORT_ASC, 0);
+ $out = '';
// TODO Trick to have param removedfile containing nb of image to delete. But this does not works without javascript
$out .= ''."\n";
diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php
index 7296c3dd820..86898548291 100644
--- a/htdocs/compta/facture/card.php
+++ b/htdocs/compta/facture/card.php
@@ -1573,6 +1573,7 @@ if (empty($reshook)) {
$TTotalByTva[$line->tva_tx] += $line->total_ttc;
}
+ $amount_ttc_diff = 0.;
foreach ($TTotalByTva as $tva => &$total) {
$coef = $total / $srcobject->total_ttc; // Calc coef
$am = $amount * $coef;
diff --git a/htdocs/compta/facture/invoicetemplate_list.php b/htdocs/compta/facture/invoicetemplate_list.php
index 13a119e35b5..63e01dac397 100644
--- a/htdocs/compta/facture/invoicetemplate_list.php
+++ b/htdocs/compta/facture/invoicetemplate_list.php
@@ -91,7 +91,7 @@ $search_date_when_endmonth = GETPOSTINT('search_date_when_endmonth');
$search_date_when_endyear = GETPOSTINT('search_date_when_endyear');
$search_date_when_start = dol_mktime(0, 0, 0, $search_date_when_startmonth, $search_date_when_startday, $search_date_when_startyear); // Use tzserver
$search_date_when_end = dol_mktime(23, 59, 59, $search_date_when_endmonth, $search_date_when_endday, $search_date_when_endyear);
-$search_recurring = GETPOSTINT('search_recurring');
+$search_recurring = GETPOST('search_recurring', 'intcomma');
$search_frequency = GETPOST('search_frequency', 'alpha');
$search_unit_frequency = GETPOST('search_unit_frequency', 'alpha');
$search_nb_gen_done = GETPOST('search_nb_gen_done', 'alpha');
diff --git a/htdocs/compta/paiement_vat.php b/htdocs/compta/paiement_vat.php
index af4e1463ae3..ecb946e6686 100644
--- a/htdocs/compta/paiement_vat.php
+++ b/htdocs/compta/paiement_vat.php
@@ -253,6 +253,7 @@ if ($action == 'create') {
$total = 0;
$totalrecu = 0;
+ $total_ttc = 0.;
while ($i < $num) {
$objp = $tva;
diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php
index 2cc21fb215d..e3a3eb07439 100644
--- a/htdocs/compta/prelevement/class/bonprelevement.class.php
+++ b/htdocs/compta/prelevement/class/bonprelevement.class.php
@@ -83,6 +83,9 @@ class BonPrelevement extends CommonObject
public $factures = array();
+ /**
+ * @var array
+ */
public $methodes_trans = array();
public $invoice_in_error = array();
@@ -171,6 +174,9 @@ class BonPrelevement extends CommonObject
public $credite;
public $note;
public $date_trans;
+ /**
+ * @var int Current transport method, index to $methodes_trans
+ */
public $method_trans;
public $fk_user_trans;
public $date_credit;
diff --git a/htdocs/compta/prelevement/factures.php b/htdocs/compta/prelevement/factures.php
index 1fe40efa05e..1dc1fd3d76d 100644
--- a/htdocs/compta/prelevement/factures.php
+++ b/htdocs/compta/prelevement/factures.php
@@ -274,10 +274,10 @@ if ($resql) {
$num = $db->num_rows($resql);
$i = 0;
+ $param = "&id=".((int) $id);
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.((int) $limit);
}
- $param = "&id=".urlencode((string) ($id));
// Lines of title fields
print ' |