diff --git a/dev/tools/phan/baseline.txt b/dev/tools/phan/baseline.txt index e38b39ba2e0..5d910884652 100644 --- a/dev/tools/phan/baseline.txt +++ b/dev/tools/phan/baseline.txt @@ -10,17 +10,16 @@ return [ // # Issue statistics: // PhanUndeclaredProperty : 460+ occurrences - // PhanTypeMismatchArgument : 230+ occurrences + // PhanTypeMismatchArgument : 150+ occurrences // PhanTypeMismatchProperty : 100+ occurrences // PhanUndeclaredGlobalVariable : 100+ occurrences - // PhanTypeMismatchArgumentNullable : 70+ occurrences // PhanTypeExpectedObjectPropAccess : 20+ occurrences // PhanTypeInvalidDimOffset : 20+ occurrences // PhanTypeMismatchDimFetch : 15+ occurrences // PhanUndeclaredConstant : 15+ occurrences // PhanTypeMismatchArgumentProbablyReal : 10+ occurrences // PhanUndeclaredMethod : 9 occurrences - // PhanPossiblyUndeclaredGlobalVariable : 8 occurrences + // PhanPossiblyUndeclaredGlobalVariable : 7 occurrences // PhanTypeMismatchArgumentNullableInternal : 7 occurrences // PhanPluginDuplicateExpressionBinaryOp : 6 occurrences // PhanTypeArraySuspiciousNull : 6 occurrences @@ -47,30 +46,18 @@ return [ 'htdocs/asset/class/asset.class.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanTypeInvalidDimOffset'], 'htdocs/asset/class/assetdepreciationoptions.class.php' => ['PhanTypeInvalidDimOffset'], 'htdocs/asset/class/assetmodel.class.php' => ['PhanUndeclaredProperty'], - 'htdocs/asset/list.php' => ['PhanTypeMismatchArgument'], - 'htdocs/asset/model/list.php' => ['PhanTypeMismatchArgument'], - 'htdocs/asset/tpl/accountancy_codes_edit.tpl.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/asset/tpl/depreciation_options_edit.tpl.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], + 'htdocs/asset/tpl/depreciation_options_edit.tpl.php' => ['PhanUndeclaredProperty'], 'htdocs/asset/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'], 'htdocs/barcode/printsheet.php' => ['PhanPluginDuplicateExpressionBinaryOp'], - 'htdocs/bom/bom_card.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable', 'PhanUndeclaredProperty'], - 'htdocs/bom/bom_list.php' => ['PhanTypeMismatchArgument'], - 'htdocs/bom/class/bom.class.php' => ['PhanTypeMismatchArgumentNullable'], - 'htdocs/bom/tpl/linkedobjectblock.tpl.php' => ['PhanTypeMismatchArgument'], - 'htdocs/bom/tpl/objectline_create.tpl.php' => ['PhanTypeMismatchArgument'], - 'htdocs/bom/tpl/objectline_edit.tpl.php' => ['PhanTypeMismatchArgument', 'PhanUndeclaredProperty'], - 'htdocs/bom/tpl/objectline_view.tpl.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable', 'PhanUndeclaredProperty'], + 'htdocs/bom/bom_card.php' => ['PhanTypeMismatchArgument', 'PhanUndeclaredProperty'], + 'htdocs/bom/tpl/objectline_create.tpl.php' => ['PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/bom/tpl/objectline_edit.tpl.php' => ['PhanUndeclaredProperty'], + 'htdocs/bom/tpl/objectline_view.tpl.php' => ['PhanUndeclaredProperty'], 'htdocs/bookcal/availabilities_card.php' => ['PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], - 'htdocs/bookcal/availabilities_list.php' => ['PhanTypeMismatchArgument'], - 'htdocs/bookcal/booking_list.php' => ['PhanTypeMismatchArgument'], 'htdocs/bookcal/calendar_card.php' => ['PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], - 'htdocs/bookcal/calendar_document.php' => ['PhanTypeMismatchArgumentNullable'], - 'htdocs/bookcal/calendar_list.php' => ['PhanTypeMismatchArgument'], 'htdocs/bookcal/class/availabilities.class.php' => ['PhanUndeclaredMethod', 'PhanUndeclaredProperty'], 'htdocs/bookcal/class/calendar.class.php' => ['PhanUndeclaredMethod', 'PhanUndeclaredProperty'], - 'htdocs/categories/class/categorie.class.php' => ['PhanTypeMismatchArgument'], - 'htdocs/categories/photos.php' => ['PhanTypeMismatchArgument'], - 'htdocs/categories/viewcat.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable', 'PhanUndeclaredProperty'], + 'htdocs/categories/viewcat.php' => ['PhanUndeclaredProperty'], 'htdocs/collab/index.php' => ['PhanUndeclaredProperty'], 'htdocs/comm/action/index.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchProperty'], 'htdocs/comm/action/info.php' => ['PhanUndeclaredProperty'], @@ -89,29 +76,15 @@ return [ 'htdocs/commande/list.php' => ['PhanUndeclaredProperty'], 'htdocs/commande/list_det.php' => ['PhanTypeInvalidDimOffset'], 'htdocs/commande/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'], - 'htdocs/compta/accounting-files.php' => ['PhanTypeMismatchArgument'], 'htdocs/compta/bank/account_statement_document.php' => ['PhanUndeclaredGlobalVariable'], - 'htdocs/compta/bank/annuel.php' => ['PhanTypeMismatchArgument'], - 'htdocs/compta/bank/bankentries_list.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable'], - 'htdocs/compta/bank/categ.php' => ['PhanTypeMismatchArgument'], - 'htdocs/compta/bank/class/account.class.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable', 'PhanUndeclaredProperty'], + 'htdocs/compta/bank/class/account.class.php' => ['PhanUndeclaredProperty'], 'htdocs/compta/bank/class/paymentvarious.class.php' => ['PhanTypeMismatchArgument'], - 'htdocs/compta/bank/graph.php' => ['PhanTypeMismatchArgument'], 'htdocs/compta/bank/line.php' => ['PhanUndeclaredGlobalVariable'], - 'htdocs/compta/bank/list.php' => ['PhanTypeMismatchArgument'], - 'htdocs/compta/bank/releve.php' => ['PhanTypeMismatchArgument'], - 'htdocs/compta/bank/transfer.php' => ['PhanTypeMismatchArgument'], - 'htdocs/compta/bank/treso.php' => ['PhanTypeMismatchArgument'], 'htdocs/compta/bank/various_payment/card.php' => ['PhanUndeclaredProperty'], 'htdocs/compta/bank/various_payment/document.php' => ['PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/compta/bank/various_payment/info.php' => ['PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/compta/cashcontrol/cashcontrol_card.php' => ['PhanPluginDuplicateExpressionBinaryOp'], - 'htdocs/compta/cashcontrol/cashcontrol_list.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchProperty'], - 'htdocs/compta/charges/index.php' => ['PhanTypeMismatchArgumentNullable'], - 'htdocs/compta/clients.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullable', 'PhanUndeclaredGlobalVariable'], - 'htdocs/compta/deplacement/class/deplacement.class.php' => ['PhanTypeMismatchArgument'], - 'htdocs/compta/deplacement/class/deplacementstats.class.php' => ['PhanTypeMismatchArgument'], - 'htdocs/compta/deplacement/stats/index.php' => ['PhanTypeMismatchArgument'], + 'htdocs/compta/clients.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/compta/facture/card-rec.php' => ['PhanTypeMismatchArgument'], 'htdocs/compta/facture/card.php' => ['PhanUndeclaredProperty'], 'htdocs/compta/facture/class/api_invoices.class.php' => ['PhanTypeMismatchArgumentProbablyReal'], @@ -122,25 +95,15 @@ return [ 'htdocs/compta/localtax/clients.php' => ['PhanTypeExpectedObjectPropAccess', 'PhanTypeMismatchArgument'], 'htdocs/compta/localtax/index.php' => ['PhanTypeMismatchArgument'], 'htdocs/compta/localtax/list.php' => ['PhanUndeclaredGlobalVariable'], - 'htdocs/compta/paiement.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchDimFetch'], 'htdocs/compta/paiement/card.php' => ['PhanUndeclaredProperty'], - 'htdocs/compta/paiement/cheque/card.php' => ['PhanTypeMismatchArgument'], - 'htdocs/compta/paiement/cheque/class/remisecheque.class.php' => ['PhanTypeMismatchArgument'], - 'htdocs/compta/paiement/cheque/list.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchProperty', 'PhanUndeclaredGlobalVariable'], - 'htdocs/compta/paiement/class/paiement.class.php' => ['PhanTypeMismatchArgumentNullable'], - 'htdocs/compta/paiement/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredGlobalVariable'], + 'htdocs/compta/paiement/cheque/list.php' => ['PhanTypeMismatchProperty', 'PhanUndeclaredGlobalVariable'], + 'htdocs/compta/paiement/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredGlobalVariable'], 'htdocs/compta/paiement/rapport.php' => ['PhanTypeMismatchArgument'], 'htdocs/compta/prelevement/card.php' => ['PhanTypeMismatchArgument'], - 'htdocs/compta/prelevement/class/bonprelevement.class.php' => ['PhanTypeMismatchArgumentNullable'], - 'htdocs/compta/prelevement/class/rejetprelevement.class.php' => ['PhanTypeMismatchArgument'], - 'htdocs/compta/prelevement/demandes.php' => ['PhanTypeMismatchArgumentNullable'], - 'htdocs/compta/prelevement/line.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable'], 'htdocs/compta/resultat/clientfourn.php' => ['PhanTypeMismatchArgument'], 'htdocs/compta/resultat/index.php' => ['PhanTypeMismatchArgument'], 'htdocs/compta/resultat/projects.php' => ['PhanTypeMismatchArgument'], - 'htdocs/compta/resultat/result.php' => ['PhanTypeMismatchArgument'], 'htdocs/compta/sociales/card.php' => ['PhanUndeclaredProperty'], - 'htdocs/compta/sociales/list.php' => ['PhanTypeMismatchArgument'], 'htdocs/compta/sociales/payments.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable'], 'htdocs/compta/stats/cabyprodserv.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable'], 'htdocs/compta/stats/supplier_turnover_by_prodserv.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable'], @@ -148,7 +111,6 @@ return [ 'htdocs/compta/tva/class/paymentvat.class.php' => ['PhanUndeclaredProperty'], 'htdocs/compta/tva/clients.php' => ['PhanTypeArraySuspiciousNull', 'PhanTypeInvalidDimOffset', 'PhanTypeMismatchArgument'], 'htdocs/compta/tva/index.php' => ['PhanTypeMismatchArgument'], - 'htdocs/compta/tva/list.php' => ['PhanTypeMismatchArgument'], 'htdocs/compta/tva/payments.php' => ['PhanTypeMismatchArgumentNullable', 'PhanTypeMismatchArgumentNullableInternal'], 'htdocs/compta/tva/quadri_detail.php' => ['PhanTypeArraySuspiciousNull', 'PhanTypeInvalidDimOffset', 'PhanTypeMismatchArgument'], 'htdocs/contact/ajax/contact.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable'], @@ -279,10 +241,8 @@ return [ 'htdocs/expensereport/class/expensereportline.class.php' => ['PhanTypeMismatchArgument'], 'htdocs/expensereport/class/expensereportstats.class.php' => ['PhanTypeMismatchArgument'], 'htdocs/expensereport/class/paymentexpensereport.class.php' => ['PhanTypeMismatchArgument'], - 'htdocs/expensereport/list.php' => ['PhanTypeMismatchArgument'], 'htdocs/expensereport/payment/card.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/expensereport/payment/info.php' => ['PhanUndeclaredGlobalVariable'], - 'htdocs/expensereport/payment/list.php' => ['PhanTypeMismatchArgument'], 'htdocs/expensereport/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'], 'htdocs/exports/export.php' => ['PhanTypeMismatchArgument'], 'htdocs/externalsite/frames.php' => ['PhanUndeclaredGlobalVariable'], @@ -292,7 +252,6 @@ return [ 'htdocs/fichinter/class/fichinterrec.class.php' => ['PhanUndeclaredProperty'], 'htdocs/fichinter/contact.php' => ['PhanTypeMismatchArgument'], 'htdocs/fichinter/document.php' => ['PhanTypeMismatchArgument'], - 'htdocs/fichinter/list.php' => ['PhanTypeMismatchArgument'], 'htdocs/fichinter/note.php' => ['PhanTypeMismatchArgument'], 'htdocs/fichinter/stats/index.php' => ['PhanTypeMismatchArgument'], 'htdocs/fichinter/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'], @@ -330,7 +289,6 @@ return [ 'htdocs/mrp/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'], 'htdocs/multicurrency/class/api_multicurrencies.class.php' => ['PhanTypeMismatchArgument'], 'htdocs/multicurrency/class/multicurrency.class.php' => ['PhanTypeExpectedObjectPropAccess'], - 'htdocs/multicurrency/multicurrency_rate.php' => ['PhanTypeMismatchArgument'], 'htdocs/opensurvey/results.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/partnership/class/partnership.class.php' => ['PhanUndeclaredProperty'], 'htdocs/partnership/core/modules/partnership/mod_partnership_advanced.php' => ['PhanUndeclaredProperty'], diff --git a/htdocs/asset/list.php b/htdocs/asset/list.php index 30ceb45988b..dfdcd5d4b16 100644 --- a/htdocs/asset/list.php +++ b/htdocs/asset/list.php @@ -3,7 +3,7 @@ * Copyright (C) 2018-2024 Alexandre Spangaro * Copyright (C) 2018 Ferran Marcet * Copyright (C) 2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -680,13 +680,13 @@ while ($i < $imaxinloop) { if (!empty($arrayfields['t.'.$key]['checked'])) { print '$key) && !in_array($key, array('ref'))) { - print ' title="'.dol_escape_htmltag($object->$key).'"'; + print ' title="'.dol_escape_htmltag((string) $object->$key).'"'; } print '>'; if ($key == 'status') { print $object->getLibStatut(5); } elseif ($key == 'rowid') { - print $object->showOutputField($val, $key, $object->id, ''); + print $object->showOutputField($val, $key, (string) $object->id, ''); } else { print $object->showOutputField($val, $key, $object->$key, ''); } diff --git a/htdocs/asset/model/list.php b/htdocs/asset/model/list.php index 762a5122d75..5a5db4fe94e 100644 --- a/htdocs/asset/model/list.php +++ b/htdocs/asset/model/list.php @@ -2,7 +2,7 @@ /* Copyright (C) 2007-2017 Laurent Destailleur * Copyright (C) 2018-2024 Alexandre Spangaro * Copyright (C) 2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -605,7 +605,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) { if ($key == 'status') { print $object->getLibStatut(5); } elseif ($key == 'rowid') { - print $object->showOutputField($val, $key, $object->id, ''); + print $object->showOutputField($val, $key, (string) $object->id, ''); } else { print $object->showOutputField($val, $key, $object->$key, ''); } @@ -695,7 +695,7 @@ if (in_array('builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords $genallowed = $permissiontoread; $delallowed = $permissiontoadd; - print $formfile->showdocuments('massfilesarea_asset', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty); + print $formfile->showdocuments('massfilesarea_asset', '', $filedir, $urlsource, 0, (int) $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty); } // End of page diff --git a/htdocs/asset/tpl/accountancy_codes_edit.tpl.php b/htdocs/asset/tpl/accountancy_codes_edit.tpl.php index 8db10c80270..b1b1e33ee01 100644 --- a/htdocs/asset/tpl/accountancy_codes_edit.tpl.php +++ b/htdocs/asset/tpl/accountancy_codes_edit.tpl.php @@ -1,6 +1,7 @@ * Copyright (C) 2024 Frédéric France + * Copyright (C) 2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -67,7 +68,7 @@ if ($reshook < 0) { if (empty($reshook)) { foreach ($assetaccountancycodes->accountancy_codes_fields as $mode_key => $mode_info) { //if (empty($object->enabled_modes[$mode_key])) continue; - $width = ($mode_key == "economic")? "width50p pull-left" : "width50p"; + $width = ($mode_key == "economic") ? "width50p pull-left" : "width50p"; print ''; print ''; foreach ($mode_info['fields'] as $field_key => $field_info) { @@ -75,7 +76,7 @@ if (empty($reshook)) { print ''; echo ''; diff --git a/htdocs/bom/tpl/objectline_create.tpl.php b/htdocs/bom/tpl/objectline_create.tpl.php index 9670bef4fad..7e68da421ee 100644 --- a/htdocs/bom/tpl/objectline_create.tpl.php +++ b/htdocs/bom/tpl/objectline_create.tpl.php @@ -9,7 +9,7 @@ * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2018 Ferran Marcet * Copyright (C) 2024 Vincent Maury - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -146,9 +146,9 @@ if (isModEnabled("product") || isModEnabled("service")) { $statustoshow = -1; if (getDolGlobalString('ENTREPOT_EXTRA_STATUS')) { // hide products in closed warehouse, but show products for internal transfer - print $form->select_produits(GETPOSTINT('idprod'), (($filtertype == 1) ? 'idprodservice' : 'idprod'), $filtertype, getDolGlobalInt('PRODUIT_LIMIT_SIZE'), 0, $statustoshow, 2, '', 1, array(), 0, '1', 0, 'maxwidth500 widthcentpercentminusx', 0, 'warehouseopen,warehouseinternal', GETPOSTINT('combinations'), 1); + print $form->select_produits(GETPOSTINT('idprod'), (($filtertype == 1) ? 'idprodservice' : 'idprod'), $filtertype, getDolGlobalInt('PRODUIT_LIMIT_SIZE'), 0, $statustoshow, 2, '', 1, array(), 0, '1', 0, 'maxwidth500 widthcentpercentminusx', 0, 'warehouseopen,warehouseinternal', (string) GETPOSTINT('combinations'), 1); } else { - print $form->select_produits(GETPOSTINT('idprod'), (($filtertype == 1) ? 'idprodservice' : 'idprod'), $filtertype, getDolGlobalInt('PRODUIT_LIMIT_SIZE'), 0, $statustoshow, 2, '', 1, array(), 0, '1', 0, 'maxwidth500 widthcentpercentminusx', 0, '', GETPOSTINT('combinations'), 1); + print $form->select_produits(GETPOSTINT('idprod'), (($filtertype == 1) ? 'idprodservice' : 'idprod'), $filtertype, getDolGlobalInt('PRODUIT_LIMIT_SIZE'), 0, $statustoshow, 2, '', 1, array(), 0, '1', 0, 'maxwidth500 widthcentpercentminusx', 0, '', (string) GETPOSTINT('combinations'), 1); } $urltocreateproduct = DOL_URL_ROOT.'/product/card.php?action=create'.(($filtertype == 1) ? '&leftmenu=service&type=1' : '&leftmenu=product&type=0').'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id); print ''; @@ -157,11 +157,11 @@ if (isModEnabled("product") || isModEnabled("service")) { } if (getDolGlobalString('BOM_SUB_BOM') && $filtertype != 1) { print '
'.$langs->trans("or").'
'.$langs->trans("BOM"); - print $form->select_bom('', 'bom_id', 0, 1, 0, '1', '', 1); + print $form->select_bom('', 'bom_id', 0, 1, 0, '1', '', '1'); } if (is_object($objectline)) { - $temps = $objectline->showOptionals($extrafields, 'create', array(), '', '', 1, 'line'); + $temps = $objectline->showOptionals($extrafields, 'create', array(), '', '', '1', 'line'); if (!empty($temps)) { print '
'; diff --git a/htdocs/bom/tpl/objectline_edit.tpl.php b/htdocs/bom/tpl/objectline_edit.tpl.php index 48fa81082b1..2d478c53ede 100644 --- a/htdocs/bom/tpl/objectline_edit.tpl.php +++ b/htdocs/bom/tpl/objectline_edit.tpl.php @@ -7,7 +7,7 @@ * Copyright (C) 2013 Florian Henry * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2024 Vincent Maury - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -120,7 +120,7 @@ if (is_object($hookmanager)) { //Line extrafield if (is_object($objectline) && !empty($extrafields)) { - $temps = $line->showOptionals($extrafields, 'edit', array('class' => 'tredited'), '', '', 1, 'line'); + $temps = $line->showOptionals($extrafields, 'edit', array('class' => 'tredited'), '', '', '1', 'line'); if (!empty($temps)) { print '
'; print $temps; diff --git a/htdocs/bom/tpl/objectline_view.tpl.php b/htdocs/bom/tpl/objectline_view.tpl.php index e7be7cfef13..6f78641a60b 100644 --- a/htdocs/bom/tpl/objectline_view.tpl.php +++ b/htdocs/bom/tpl/objectline_view.tpl.php @@ -6,7 +6,7 @@ * Copyright (C) 2012-2014 Raphaël Doursenaud * Copyright (C) 2013 Florian Henry * Copyright (C) 2017 Juanjo Menent - * Copyright (C) 2024-2025 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -119,7 +119,7 @@ $coldisplay++; $tmpproduct = new Product($object->db); $tmpproduct->fetch($line->fk_product); $tmpbom = new BOM($object->db); -$res = $tmpbom->fetch($line->fk_bom_child); +$res = $tmpbom->fetch((int) $line->fk_bom_child); if ($tmpbom->id > 0) { print $tmpproduct->getNomUrl(1); print ' '.$langs->trans("or").' '; @@ -134,7 +134,7 @@ if ($tmpbom->id > 0) { // Line extrafield if (!empty($extrafields)) { - $temps = $line->showOptionals($extrafields, 'view', array(), '', '', 1, 'line'); + $temps = $line->showOptionals($extrafields, 'view', array(), '', '', '1', 'line'); if (!empty($temps)) { print '
'; print $temps; diff --git a/htdocs/bookcal/availabilities_list.php b/htdocs/bookcal/availabilities_list.php index 13d908bd363..8402ef70b03 100644 --- a/htdocs/bookcal/availabilities_list.php +++ b/htdocs/bookcal/availabilities_list.php @@ -2,7 +2,7 @@ /* Copyright (C) 2007-2017 Laurent Destailleur * Copyright (C) 2022 Alice Adminson * Copyright (C) 2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -725,13 +725,13 @@ while ($i < $imaxinloop) { if (!empty($arrayfields['t.'.$key]['checked'])) { print '$key)) { - print ' title="'.dol_escape_htmltag($object->$key).'"'; + print ' title="'.dol_escape_htmltag((string) $object->$key).'"'; } print '>'; if ($key == 'status') { print $object->getLibStatut(5); } elseif ($key == 'rowid') { - print $object->showOutputField($val, $key, $object->id, ''); + print $object->showOutputField($val, $key, (string) $object->id, ''); } else { print $object->showOutputField($val, $key, $object->$key, ''); } diff --git a/htdocs/bookcal/booking_list.php b/htdocs/bookcal/booking_list.php index 9b1d5404623..df7cdf928e5 100644 --- a/htdocs/bookcal/booking_list.php +++ b/htdocs/bookcal/booking_list.php @@ -6,7 +6,7 @@ * Copyright (C) 2010-2014 Juanjo Menent * Copyright (C) 2017 Ferran Marcet * Copyright (C) 2023-2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -236,7 +236,7 @@ if ($object->id > 0) { // Link to make payment now print '
'; print "\n"; diff --git a/htdocs/bookcal/calendar_document.php b/htdocs/bookcal/calendar_document.php index e0ca81cfe40..bf24295e13b 100644 --- a/htdocs/bookcal/calendar_document.php +++ b/htdocs/bookcal/calendar_document.php @@ -2,7 +2,7 @@ /* Copyright (C) 2007-2017 Laurent Destailleur * Copyright (C) 2023 Alice Adminson * Copyright (C) 2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -77,7 +77,7 @@ $diroutputmassaction = $conf->bookcal->dir_output.'/temp/massgeneration/'.$user- $hookmanager->initHooks(array('calendardocument', 'globalcard')); // Note that conf->hooks_modules contains array // Fetch optionals attributes and labels $extrafields->fetch_name_optionals_label($object->table_element); -$upload_dir = null; +$upload_dir = ''; // Load object include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be 'include', not 'include_once'. Include fetch and fetch_thirdparty but not fetch_optionals diff --git a/htdocs/bookcal/calendar_list.php b/htdocs/bookcal/calendar_list.php index 3aa7f6a2d89..05f1367d3b7 100644 --- a/htdocs/bookcal/calendar_list.php +++ b/htdocs/bookcal/calendar_list.php @@ -2,7 +2,7 @@ /* Copyright (C) 2007-2017 Laurent Destailleur * Copyright (C) 2023 Alice Adminson * Copyright (C) 2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -704,13 +704,13 @@ while ($i < $imaxinloop) { if (!empty($arrayfields['t.'.$key]['checked'])) { print '$key)) { - print ' title="'.dol_escape_htmltag($object->$key).'"'; + print ' title="'.dol_escape_htmltag((string) $object->$key).'"'; } print '>'; if ($key == 'status') { print $object->getLibStatut(5); } elseif ($key == 'rowid') { - print $object->showOutputField($val, $key, $object->id, ''); + print $object->showOutputField($val, $key, (string) $object->id, ''); } else { print $object->showOutputField($val, $key, $object->$key, ''); } diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 9d3e7c0d627..7a6fec64a54 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -13,7 +13,7 @@ * Copyright (C) 2018-2025 Frédéric France * Copyright (C) 2022-2023 Solution Libre SAS * Copyright (C) 2023-2024 Benjamin Falière - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2025 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify @@ -576,7 +576,7 @@ class Categorie extends CommonObject if (getDolGlobalString('CATEGORY_ASSIGNED_TO_A_CUSTOMER')) { $sql .= ($this->socid > 0 ? $this->socid : 'null').", "; } - $sql .= "'".$this->db->escape($this->visible)."', "; + $sql .= "'".$this->db->escape((string) $this->visible)."', "; $sql .= ((int) $type).", "; $sql .= (!empty($this->import_key) ? "'".$this->db->escape($this->import_key)."'" : 'null').", "; $sql .= (!empty($this->ref_ext) ? "'".$this->db->escape($this->ref_ext)."'" : 'null').", "; @@ -1543,15 +1543,15 @@ class Categorie extends CommonObject } if ($url == '') { - $link = ''; + $link = ''; $linkend = ''; $w[] = $link.(($addpicto && $i == 1) ? img_object('', 'category', 'class="paddingright"') : '').$cat->label.$linkend; } elseif ($url == 'none') { - $link = ''; + $link = ''; $linkend = ''; $w[] = $link.(($addpicto && $i == 1) ? img_object('', 'category', 'class="paddingright"') : '').$cat->label.$linkend; } else { - $w[] = ''.($addpicto ? img_object('', 'category') : '').$cat->label.''; + $w[] = ''.($addpicto ? img_object('', 'category') : '').$cat->label.''; } } $newcategwithpath = preg_replace('/colortoreplace/', $forced_color, implode(''.$sep.'', $w)); diff --git a/htdocs/categories/photos.php b/htdocs/categories/photos.php index cc27fb90073..a024348708a 100644 --- a/htdocs/categories/photos.php +++ b/htdocs/categories/photos.php @@ -6,7 +6,7 @@ * Copyright (C) 2014 Jean-François Ferry * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -202,7 +202,7 @@ if ($object->id) { if ($action == 'ajout_photo' && $user->hasRight('categorie', 'creer') && getDolGlobalString('MAIN_UPLOAD_DOC')) { // Affiche formulaire upload $formfile = new FormFile($db); - $formfile->form_attach_new_file($_SERVER['PHP_SELF'].'?id='.$object->id.'&type='.$type, $langs->trans("AddPhoto"), 1, 0, $user->hasRight('categorie', 'creer'), 50, $object, '', false, '', 0); + $formfile->form_attach_new_file($_SERVER['PHP_SELF'].'?id='.$object->id.'&type='.$type, $langs->trans("AddPhoto"), 1, 0, $user->hasRight('categorie', 'creer'), 50, $object, '', 0, '', 0); } // Affiche photos diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index 4ed6cf3cd7d..aa54f2fb4bf 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -7,7 +7,7 @@ * Copyright (C) 2020 Tobias Sekan * Copyright (C) 2020 Josep Lluís Amador * Copyright (C) 2022-2023 Solution Libre SAS - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * Copyright (C) 2024-2025 Alexandre Spangaro * Copyright (C) 2023-2024 Charlene Benke @@ -189,11 +189,15 @@ if ($id > 0 && $removeelem > 0 && $action == 'unlink') { // Test on permission n $elementtype = 'supplier_order'; } else { dol_print_error(null, "Not supported value of type = ".$type); + $result = -100; } - $result = $object->del_type($tmpobject, $elementtype); - if ($result < 0) { - dol_print_error(null, $object->error); + if ($tmpobject !== null) { + // also enter here when item was not found to report error + $result = $object->del_type($tmpobject, $elementtype); + if ($result < 0) { + dol_print_error(null, $object->error); + } } } @@ -273,8 +277,10 @@ if ($elemid && $action == 'addintocategory') { // Test on permission not require $result = $newobject->fetch($elemid); } - // Add into category - $result = $object->add_type($newobject, $elementtype); + if ($result >= 0 && $newobject !== null) { + // Add into category + $result = $object->add_type($newobject, $elementtype); + } if ($result >= 0) { setEventMessages($langs->trans("WasAddedSuccessfully", $newobject->ref), null, 'mesgs'); } else { @@ -1015,7 +1021,7 @@ if ($type == Categorie::TYPE_ACCOUNT) { print "\t".''."\n"; print '\n"; print '\n"; print '\n"; @@ -1409,7 +1415,9 @@ if ($type == Categorie::TYPE_FICHINTER) { $i = 0; foreach ($fichinters as $fichinter) { $i++; - if ($i > $limit) break; + if ($i > $limit) { + break; + } print "\t".''."\n"; print ''; } diff --git a/htdocs/compta/tva/list.php b/htdocs/compta/tva/list.php index 1157f708a8a..4fac5ae0a79 100644 --- a/htdocs/compta/tva/list.php +++ b/htdocs/compta/tva/list.php @@ -5,7 +5,7 @@ * Copyright (C) 2011-2024 Alexandre Spangaro * Copyright (C) 2020 Tobias Sekan * Copyright (C) 2021 Gauthier VERDOL - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -92,21 +92,20 @@ if (!$sortorder) { } $arrayfields = array( - 't.rowid' => array('checked' => 1, 'position' => 10, 'label' => "Ref",), - 't.label' => array('checked' => 1, 'position' => 20, 'label' => "Label"), - 't.datev' => array('checked' => 1, 'position' => 30, 'label' => "PeriodEndDate"), - 't.fk_typepayment' => array('checked' => 1, 'position' => 50, 'label' => "DefaultPaymentMode"), - 't.amount' => array('checked' => 1, 'position' => 90, 'label' => "Amount"), - 't.datec' => array('checked' => 1, 'position' => 91, 'label' => "DateCreation"), - 't.status' => array('checked' => 1, 'position' => 92, 'label' => "Status"), + 't.rowid' => array('checked' => '1', 'position' => 10, 'label' => "Ref",), + 't.label' => array('checked' => '1', 'position' => 20, 'label' => "Label"), + 't.datev' => array('checked' => '1', 'position' => 30, 'label' => "PeriodEndDate"), + 't.fk_typepayment' => array('checked' => '1', 'position' => 50, 'label' => "DefaultPaymentMode"), + 't.amount' => array('checked' => '1', 'position' => 90, 'label' => "Amount"), + 't.datec' => array('checked' => '1', 'position' => 91, 'label' => "DateCreation"), + 't.status' => array('checked' => '1', 'position' => 92, 'label' => "Status"), ); if (isModEnabled("bank")) { - $arrayfields['t.fk_account'] = array('checked' => 1, 'position' => 60, 'label' => "DefaultBankAccount"); + $arrayfields['t.fk_account'] = array('checked' => '1', 'position' => 60, 'label' => "DefaultBankAccount"); } $arrayfields = dol_sort_array($arrayfields, 'position'); -'@phan-var-force array,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan // Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context $hookmanager->initHooks(array('salestaxeslist')); diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 527449dec4a..945acc6c664 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -237,8 +237,8 @@ foreach ($object->fields as $key => $val) { $visible = (int) dol_eval((string) $val['visible'], 1); $arrayfields['p.'.$key] = array( 'label' => $val['label'], - 'checked' => (($visible < 0) ? 0 : 1), - 'enabled' => (abs($visible) != 3 && (bool) dol_eval($val['enabled'], 1)), + 'checked' => (($visible < 0) ? '0' : '1'), + 'enabled' => (string) (int) (abs($visible) != 3 && (bool) dol_eval($val['enabled'], 1)), 'position' => $val['position'], 'help' => isset($val['help']) ? $val['help'] : '' ); @@ -246,16 +246,16 @@ foreach ($object->fields as $key => $val) { } // Add none object fields to fields for list -$arrayfields['country.code_iso'] = array('label' => "Country", 'position' => 66, 'checked' => 0); +$arrayfields['country.code_iso'] = array('label' => "Country", 'position' => 66, 'checked' => '0'); if (!getDolGlobalString('SOCIETE_DISABLE_CONTACTS')) { - $arrayfields['s.nom'] = array('label' => "ThirdParty", 'position' => 113, 'checked' => 1); - $arrayfields['s.name_alias'] = array('label' => "AliasNameShort", 'position' => 114, 'checked' => 1); + $arrayfields['s.nom'] = array('label' => "ThirdParty", 'position' => 113, 'checked' => '1'); + $arrayfields['s.name_alias'] = array('label' => "AliasNameShort", 'position' => 114, 'checked' => '1'); } $arrayfields['unsubscribed'] = array( 'label' => 'No_Email', - 'checked' => 0, - 'enabled' => (isModEnabled('mailing')), + 'checked' => '0', + 'enabled' => (string) (int) (isModEnabled('mailing')), 'position' => 111); if (isModEnabled('socialnetworks')) { @@ -263,7 +263,7 @@ if (isModEnabled('socialnetworks')) { if ($value['active']) { $arrayfields['p.'.$key] = array( 'label' => $value['label'], - 'checked' => 0, + 'checked' => '0', 'position' => 299 ); } @@ -276,7 +276,6 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; $object->fields = dol_sort_array($object->fields, 'position'); //$arrayfields['anotherfield'] = array('type'=>'integer', 'label'=>'AnotherField', 'checked'=>1, 'enabled'=>1, 'position'=>90, 'csslist'=>'right'); $arrayfields = dol_sort_array($arrayfields, 'position'); -'@phan-var-force array,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan if (($id > 0 || !empty($ref)) && $action != 'add') { diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index c7a634bfe80..2c2584dbbac 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2678,7 +2678,7 @@ class Form * 'warehouseopen' = count products from open warehouses, * 'warehouseclosed' = count products from closed warehouses, * 'warehouseinternal' = count products from warehouses for internal correct/transfer only - * @param ?mixed[] $selected_combinations Selected combinations. Format: array([attrid] => attrval, [...]) + * @param ?array $selected_combinations Selected combinations. Format: array([attrid] => attrval, [...]) * @param int<0,1> $nooutput No print if 1, return the output into a string * @param int<-1,1> $status_purchase Purchase status: -1=No filter on purchase status, 0=Products not on purchase, 1=Products on purchase * @param int $warehouseId Filter by Warehouses Id where there is real stock diff --git a/htdocs/core/tpl/extrafields_list_array_fields.tpl.php b/htdocs/core/tpl/extrafields_list_array_fields.tpl.php index cecb56760c1..522eeeaecbe 100644 --- a/htdocs/core/tpl/extrafields_list_array_fields.tpl.php +++ b/htdocs/core/tpl/extrafields_list_array_fields.tpl.php @@ -7,7 +7,7 @@ // TODO: Note, supposing $arrayfields is already set ' - @phan-var-force array $arrayfields; +@phan-var-force array $arrayfields '; // Protection to avoid direct call of template @@ -36,9 +36,9 @@ if (!empty($extrafieldsobjectkey)) { // $extrafieldsobject is the $object->table $arrayfields[$extrafieldsobjectprefix.$key] = array( 'label' => $extrafields->attributes[$extrafieldsobjectkey]['label'][$key], 'type' => $extrafields->attributes[$extrafieldsobjectkey]['type'][$key], - 'checked' => (((int) dol_eval($extrafields->attributes[$extrafieldsobjectkey]['list'][$key], 1, 1, '1') <= 0) ? 0 : 1), + 'checked' => (((int) dol_eval($extrafields->attributes[$extrafieldsobjectkey]['list'][$key], 1, 1, '1') <= 0) ? '0' : '1'), 'position' => $extrafields->attributes[$extrafieldsobjectkey]['pos'][$key], - 'enabled' => (abs((int) dol_eval($extrafields->attributes[$extrafieldsobjectkey]['list'][$key], 1)) != 3 && (int) dol_eval($extrafields->attributes[$extrafieldsobjectkey]['perms'][$key], 1, 1, '1')), + 'enabled' => (string) (int) (abs((int) dol_eval($extrafields->attributes[$extrafieldsobjectkey]['list'][$key], 1)) != 3 && (int) dol_eval($extrafields->attributes[$extrafieldsobjectkey]['perms'][$key], 1, 1, '1')), 'langfile' => $extrafields->attributes[$extrafieldsobjectkey]['langfile'][$key], 'help' => $extrafields->attributes[$extrafieldsobjectkey]['help'][$key], ); diff --git a/htdocs/don/paiement/list.php b/htdocs/don/paiement/list.php index b8cfe449719..03ccaf366d2 100644 --- a/htdocs/don/paiement/list.php +++ b/htdocs/don/paiement/list.php @@ -4,7 +4,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2019 Thibault FOUCART - * Copyright (C) 2024-2025 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -104,12 +104,11 @@ $arrayfields = array( 's.nom' => array('label' => "ThirdParty", 'checked' => '1', 'position' => 30), 'c.code' => array('label' => "Type", 'checked' => '1', 'position' => 40), 'pd.num_paiement' => array('label' => "Numero", 'checked' => '1', 'position' => 50, 'tooltip' => "ChequeOrTransferNumber"), - 'transaction' => array('label' => "BankTransactionLine", 'checked' => '1', 'position' => 60, 'enabled' => (string) (isModEnabled("bank"))), - 'ba.label' => array('label' => "BankAccount", 'checked' => '1', 'position' => 70, 'enabled' => (string) (isModEnabled("bank"))), + 'transaction' => array('label' => "BankTransactionLine", 'checked' => '1', 'position' => 60, 'enabled' => (string) (int) (isModEnabled("bank"))), + 'ba.label' => array('label' => "BankAccount", 'checked' => '1', 'position' => 70, 'enabled' => (string) (int) (isModEnabled("bank"))), 'pd.amount' => array('label' => "Amount", 'checked' => '1', 'position' => 80), ); $arrayfields = dol_sort_array($arrayfields, 'position'); -'@phan-var-force array $arrayfields'; // dol_sort_array looses type for Phan $optioncss = GETPOST('optioncss', 'alpha'); $moreforfilter = GETPOST('moreforfilter', 'alpha'); diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index a9154082eb9..c1dbceae6af 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -6,7 +6,7 @@ * Copyright (C) 2019 Nicolas ZABOURI * Copyright (C) 2020 Thibault FOUCART * Copyright (C) 2023 Christophe Battarel - * Copyright (C) 2024-2025 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Benjamin Falière * Copyright (C) 2024 Vincent Maury * Copyright (C) 2024 William Mead @@ -135,30 +135,30 @@ if (empty($user->socid)) { $fieldstosearchall["e.note_private"] = "NotePrivate"; } -$checkedtypetiers = 0; +$checkedtypetiers = '0'; $arrayfields = array( - 'e.ref' => array('label' => $langs->trans("Ref"), 'checked' => 1, 'position' => 1), - 'e.ref_customer' => array('label' => $langs->trans("RefCustomer"), 'checked' => 1, 'position' => 2), - 's.nom' => array('label' => $langs->trans("ThirdParty"), 'checked' => 1, 'position' => 3), - 's.town' => array('label' => $langs->trans("Town"), 'checked' => 1, 'position' => 4), - 's.zip' => array('label' => $langs->trans("Zip"), 'checked' => -1, 'position' => 5), - 'state.nom' => array('label' => $langs->trans("StateShort"), 'checked' => 0, 'position' => 6), - 'country.code_iso' => array('label' => $langs->trans("Country"), 'checked' => 0, 'position' => 7), + 'e.ref' => array('label' => $langs->trans("Ref"), 'checked' => '1', 'position' => 1), + 'e.ref_customer' => array('label' => $langs->trans("RefCustomer"), 'checked' => '1', 'position' => 2), + 's.nom' => array('label' => $langs->trans("ThirdParty"), 'checked' => '1', 'position' => 3), + 's.town' => array('label' => $langs->trans("Town"), 'checked' => '1', 'position' => 4), + 's.zip' => array('label' => $langs->trans("Zip"), 'checked' => '-1', 'position' => 5), + 'state.nom' => array('label' => $langs->trans("StateShort"), 'checked' => '0', 'position' => 6), + 'country.code_iso' => array('label' => $langs->trans("Country"), 'checked' => '0', 'position' => 7), 'typent.code' => array('label' => $langs->trans("ThirdPartyType"), 'checked' => $checkedtypetiers, 'position' => 8), - 'e.date_delivery' => array('label' => $langs->trans("DateDeliveryPlanned"), 'checked' => 1, 'position' => 9), - 'e.date_expedition' => array('label' => $langs->trans("DateShipping"), 'checked' => 1, 'position' => 10), - 'e.fk_shipping_method' => array('label' => $langs->trans('SendingMethod'), 'checked' => 1, 'position' => 11), - 'e.tracking_number' => array('label' => $langs->trans("TrackingNumber"), 'checked' => 1, 'position' => 12), - 'e.weight' => array('label' => $langs->trans("Weight"), 'checked' => 0, 'position' => 13), - 'e.datec' => array('label' => $langs->trans("DateCreation"), 'checked' => 0, 'position' => 500), - 'e.tms' => array('label' => $langs->trans("DateModificationShort"), 'checked' => 0, 'position' => 500), - 'e.fk_statut' => array('label' => $langs->trans("Status"), 'checked' => 1, 'position' => 1000), - 'e.signed_status' => array('label' => 'Signed status', 'checked' => 0, 'position' => 1001), - 'l.ref' => array('label' => $langs->trans("DeliveryRef"), 'checked' => 1, 'position' => 1010, 'enabled' => (getDolGlobalInt('MAIN_SUBMODULE_DELIVERY') ? 1 : 0)), - 'l.date_delivery' => array('label' => $langs->trans("DateReceived"), 'position' => 1020, 'checked' => 1, 'enabled' => (getDolGlobalInt('MAIN_SUBMODULE_DELIVERY') ? 1 : 0)), - 'e.billed' => array('label' => $langs->trans("Billed"), 'checked' => 1, 'position' => 1100, 'enabled' => 'getDolGlobalString("WORKFLOW_BILL_ON_SHIPMENT") !== "0"'), - 'e.note_public' => array('label' => 'NotePublic', 'checked' => 0, 'enabled' => (empty($conf->global->MAIN_LIST_ALLOW_PUBLIC_NOTES)), 'position' => 135), - 'e.note_private' => array('label' => 'NotePrivate', 'checked' => 0, 'enabled' => (empty($conf->global->MAIN_LIST_ALLOW_PRIVATE_NOTES)), 'position' => 140), + 'e.date_delivery' => array('label' => $langs->trans("DateDeliveryPlanned"), 'checked' => '1', 'position' => 9), + 'e.date_expedition' => array('label' => $langs->trans("DateShipping"), 'checked' => '1', 'position' => 10), + 'e.fk_shipping_method' => array('label' => $langs->trans('SendingMethod'), 'checked' => '1', 'position' => 11), + 'e.tracking_number' => array('label' => $langs->trans("TrackingNumber"), 'checked' => '1', 'position' => 12), + 'e.weight' => array('label' => $langs->trans("Weight"), 'checked' => '0', 'position' => 13), + 'e.datec' => array('label' => $langs->trans("DateCreation"), 'checked' => '0', 'position' => 500), + 'e.tms' => array('label' => $langs->trans("DateModificationShort"), 'checked' => '0', 'position' => 500), + 'e.fk_statut' => array('label' => $langs->trans("Status"), 'checked' => '1', 'position' => 1000), + 'e.signed_status' => array('label' => 'Signed status', 'checked' => '0', 'position' => 1001), + 'l.ref' => array('label' => $langs->trans("DeliveryRef"), 'checked' => '1', 'position' => 1010, 'enabled' => (getDolGlobalInt('MAIN_SUBMODULE_DELIVERY') ? '1' : '0')), + 'l.date_delivery' => array('label' => $langs->trans("DateReceived"), 'position' => 1020, 'checked' => '1', 'enabled' => (getDolGlobalInt('MAIN_SUBMODULE_DELIVERY') ? '1' : '0')), + 'e.billed' => array('label' => $langs->trans("Billed"), 'checked' => '1', 'position' => 1100, 'enabled' => 'getDolGlobalString("WORKFLOW_BILL_ON_SHIPMENT") !== "0"'), + 'e.note_public' => array('label' => 'NotePublic', 'checked' => '0', 'enabled' => (string) (int) (empty($conf->global->MAIN_LIST_ALLOW_PUBLIC_NOTES)), 'position' => 135), + 'e.note_private' => array('label' => 'NotePrivate', 'checked' => '0', 'enabled' => (string) (int) (empty($conf->global->MAIN_LIST_ALLOW_PRIVATE_NOTES)), 'position' => 140), ); // Extra fields @@ -166,7 +166,6 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); -'@phan-var-force array,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan // Security check $expeditionid = GETPOSTINT('id'); diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index f389ba87e5e..3f5db2fe886 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -170,18 +170,18 @@ if (empty($user->socid)) { } $arrayfields = array( - 'd.ref' => array('label' => $langs->trans("Ref"), 'checked' => 1), - 'user' => array('label' => $langs->trans("User"), 'checked' => 1), - 'd.date_debut' => array('label' => $langs->trans("DateStart"), 'checked' => 1), - 'd.date_fin' => array('label' => $langs->trans("DateEnd"), 'checked' => 1), - 'd.date_valid' => array('label' => $langs->trans("DateValidation"), 'checked' => 1), - 'd.date_approve' => array('label' => $langs->trans("DateApprove"), 'checked' => 1), - 'd.total_ht' => array('label' => $langs->trans("AmountHT"), 'checked' => 1), - 'd.total_vat' => array('label' => $langs->trans("AmountVAT"), 'checked' => -1), - 'd.total_ttc' => array('label' => $langs->trans("AmountTTC"), 'checked' => 1), - 'd.date_create' => array('label' => $langs->trans("DateCreation"), 'checked' => 0, 'position' => 500), - 'd.tms' => array('label' => $langs->trans("DateModificationShort"), 'checked' => 0, 'position' => 500), - 'd.fk_statut' => array('label' => $langs->trans("Status"), 'checked' => 1, 'position' => 1000), + 'd.ref' => array('label' => $langs->trans("Ref"), 'checked' => '1'), + 'user' => array('label' => $langs->trans("User"), 'checked' => '1'), + 'd.date_debut' => array('label' => $langs->trans("DateStart"), 'checked' => '1'), + 'd.date_fin' => array('label' => $langs->trans("DateEnd"), 'checked' => '1'), + 'd.date_valid' => array('label' => $langs->trans("DateValidation"), 'checked' => '1'), + 'd.date_approve' => array('label' => $langs->trans("DateApprove"), 'checked' => '1'), + 'd.total_ht' => array('label' => $langs->trans("AmountHT"), 'checked' => '1'), + 'd.total_vat' => array('label' => $langs->trans("AmountVAT"), 'checked' => '-1'), + 'd.total_ttc' => array('label' => $langs->trans("AmountTTC"), 'checked' => '1'), + 'd.date_create' => array('label' => $langs->trans("DateCreation"), 'checked' => '0', 'position' => 500), + 'd.tms' => array('label' => $langs->trans("DateModificationShort"), 'checked' => '0', 'position' => 500), + 'd.fk_statut' => array('label' => $langs->trans("Status"), 'checked' => '1', 'position' => 1000), ); // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; diff --git a/htdocs/expensereport/payment/list.php b/htdocs/expensereport/payment/list.php index 14196f33b9e..e2de21d0653 100644 --- a/htdocs/expensereport/payment/list.php +++ b/htdocs/expensereport/payment/list.php @@ -12,7 +12,7 @@ * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2020 Tobias Sekan * Copyright (C) 2021 Ferran Marcet - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -30,7 +30,7 @@ /** * \file htdocs/expensereport/payment/list.php -* \ingroup expensereport + * \ingroup expensereport * \brief Payment list for expense reports */ @@ -111,16 +111,15 @@ $fieldstosearchall = array( ); $arrayfields = array( - 'pndf.rowid' => array('label' => "RefPayment", 'checked' => 1, 'position' => 10), - 'pndf.datep' => array('label' => "Date", 'checked' => 1, 'position' => 20), - 'u.login' => array('label' => "User", 'checked' => 1, 'position' => 30), - 'c.libelle' => array('label' => "Type", 'checked' => 1, 'position' => 40), - 'pndf.num_payment' => array('label' => "Numero", 'checked' => 1, 'position' => 50, 'tooltip' => "ChequeOrTransferNumber"), - 'ba.label' => array('label' => "BankAccount", 'checked' => 1, 'position' => 60, 'enable' => (isModEnabled("bank"))), - 'pndf.amount' => array('label' => "Amount", 'checked' => 1, 'position' => 70), + 'pndf.rowid' => array('label' => "RefPayment", 'checked' => '1', 'position' => 10), + 'pndf.datep' => array('label' => "Date", 'checked' => '1', 'position' => 20), + 'u.login' => array('label' => "User", 'checked' => '1', 'position' => 30), + 'c.libelle' => array('label' => "Type", 'checked' => '1', 'position' => 40), + 'pndf.num_payment' => array('label' => "Numero", 'checked' => '1', 'position' => 50, 'tooltip' => "ChequeOrTransferNumber"), + 'ba.label' => array('label' => "BankAccount", 'checked' => '1', 'position' => 60, 'enabled' => (string) (int) (isModEnabled("bank"))), + 'pndf.amount' => array('label' => "Amount", 'checked' => '1', 'position' => 70), ); $arrayfields = dol_sort_array($arrayfields, 'position'); -'@phan-var-force array,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan // Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context $hookmanager->initHooks(array('paymentexpensereportlist')); diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index 308af88fce9..1d00faf5f5d 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -9,7 +9,7 @@ * Copyright (C) 2021-2024 Frédéric France * Copyright (C) 2022 Charlène Benke * Copyright (C) 2024 William Mead - * Copyright (C) 2024-2025 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Benjamin Falière * * This program is free software; you can redistribute it and/or modify @@ -155,13 +155,11 @@ $arrayfields = array( 'fd.date' => array('label' => 'DateOfLine', 'checked' => '1', 'enabled' => getDolGlobalString('FICHINTER_DISABLE_DETAILS') != '1' ? '1' : '0'), 'fd.duree' => array('label' => 'DurationOfLine', 'type' => 'duration', 'checked' => '1', 'enabled' => !getDolGlobalString('FICHINTER_DISABLE_DETAILS') ? '1' : '0'), //type duration is here because in database, column 'duree' is double ); -'@phan-var-force array{label:string,type?:string,checked:string,position?:int,enabled?:string,langfile?:string,help:string} $arrayfields'; // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); -'@phan-var-force array{label:string,type?:string,checked:string,position?:int,enabled?:string,langfile?:string,help:string} $arrayfields'; // dol_sort_array looses type for Phan // Security check $id = GETPOSTINT('id'); diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index caa92273db7..dc4c78b9238 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -10,7 +10,7 @@ * Copyright (C) 2018-2022 Charlene Benke * Copyright (C) 2019 Nicolas Zabouri * Copyright (C) 2021-2023 Alexandre Spangaro - * Copyright (C) 2024-2025 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 William Mead * * This program is free software; you can redistribute it and/or modify @@ -196,21 +196,21 @@ if (empty($user->socid)) { $fieldstosearchall["cf.note_private"] = "NotePrivate"; } -$checkedtypetiers = 0; +$enabledtypetiers = 0; // Definition of array of fields for columns $arrayfields = array( - 'u.login' => array('label' => "AuthorRequest", 'enabled' => 1, 'position' => 41), - 's.name_alias' => array('label' => "AliasNameShort", 'position' => 51, 'checked' => 0), - 's.town' => array('label' => "Town", 'enabled' => 1, 'position' => 55, 'checked' => 1), - 's.zip' => array('label' => "Zip", 'enabled' => 1, 'position' => 56, 'checked' => 1), - 'state.nom' => array('label' => "StateShort", 'enabled' => 1, 'position' => 57), - 'country.code_iso' => array('label' => "Country", 'enabled' => 1, 'position' => 58), - 'typent.code' => array('label' => "ThirdPartyType", 'enabled' => $checkedtypetiers, 'position' => 59), - 'cf.total_localtax1' => array('label' => $langs->transcountry("AmountLT1", $mysoc->country_code), 'checked' => 0, 'enabled' => ($mysoc->localtax1_assuj == "1"), 'position' => 140), - 'cf.total_localtax2' => array('label' => $langs->transcountry("AmountLT2", $mysoc->country_code), 'checked' => 0, 'enabled' => ($mysoc->localtax2_assuj == "1"), 'position' => 145), - 'cf.note_public' => array('label' => 'NotePublic', 'checked' => 0, 'enabled' => (!getDolGlobalInt('MAIN_LIST_HIDE_PUBLIC_NOTES')), 'position' => 750), - 'cf.note_private' => array('label' => 'NotePrivate', 'checked' => 0, 'enabled' => (!getDolGlobalInt('MAIN_LIST_HIDE_PRIVATE_NOTES')), 'position' => 760), + 'u.login' => array('label' => "AuthorRequest", 'enabled' => '1', 'position' => 41), + 's.name_alias' => array('label' => "AliasNameShort", 'position' => 51, 'checked' => '0'), + 's.town' => array('label' => "Town", 'enabled' => '1', 'position' => 55, 'checked' => '1'), + 's.zip' => array('label' => "Zip", 'enabled' => '1', 'position' => 56, 'checked' => '1'), + 'state.nom' => array('label' => "StateShort", 'enabled' => '1', 'position' => 57), + 'country.code_iso' => array('label' => "Country", 'enabled' => '1', 'position' => 58), + 'typent.code' => array('label' => "ThirdPartyType", 'enabled' => $enabledtypetiers, 'position' => 59), + 'cf.total_localtax1' => array('label' => $langs->transcountry("AmountLT1", $mysoc->country_code), 'checked' => '0', 'enabled' => (string) (int) ($mysoc->localtax1_assuj == "1"), 'position' => 140), + 'cf.total_localtax2' => array('label' => $langs->transcountry("AmountLT2", $mysoc->country_code), 'checked' => '0', 'enabled' => (string) (int) ($mysoc->localtax2_assuj == "1"), 'position' => 145), + 'cf.note_public' => array('label' => 'NotePublic', 'checked' => '0', 'enabled' => (string) (int) (!getDolGlobalInt('MAIN_LIST_HIDE_PUBLIC_NOTES')), 'position' => 750), + 'cf.note_private' => array('label' => 'NotePrivate', 'checked' => '0', 'enabled' => (string) (int) (!getDolGlobalInt('MAIN_LIST_HIDE_PRIVATE_NOTES')), 'position' => 760), ); foreach ($object->fields as $key => $val) { // If $val['visible']==0, then we never show the field @@ -219,7 +219,7 @@ foreach ($object->fields as $key => $val) { $arrayfields['cf.'.$key] = array( 'label' => $val['label'], 'checked' => (($visible < 0) ? '0' : '1'), - 'enabled' => (abs($visible) != 3 && (bool) dol_eval($val['enabled'], 1)), + 'enabled' => (string) (int) (abs($visible) != 3 && (bool) dol_eval((string) $val['enabled'], 1)), 'position' => $val['position'], 'help' => isset($val['help']) ? $val['help'] : '' ); @@ -230,7 +230,6 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); -'@phan-var-force array $arrayfields'; // dol_sort_array looses type for Phan $error = 0; diff --git a/htdocs/fourn/facture/list-rec.php b/htdocs/fourn/facture/list-rec.php index 5362aa4bd42..b3fe81d8969 100644 --- a/htdocs/fourn/facture/list-rec.php +++ b/htdocs/fourn/facture/list-rec.php @@ -170,7 +170,6 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); -'@phan-var-force array $arrayfields'; // dol_sort_array looses type for Phan if ($socid > 0) { $tmpthirdparty = new Societe($db); diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index db05fdde929..64deb435293 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -177,7 +177,7 @@ if (empty($user->socid)) { $fieldstosearchall["f.note_private"] = "NotePrivate"; } -$checkedtypetiers = 0; +$checkedtypetiers = '0'; $arrayfields = array( 'f.ref' => array('label' => "Ref", 'checked' => '1', 'position' => 5), 'f.ref_supplier' => array('label' => "RefSupplier", 'checked' => '1', 'position' => 7), @@ -198,18 +198,18 @@ $arrayfields = array( 'f.fk_cond_reglement' => array('label' => "PaymentConditionsShort", 'checked' => '1', 'position' => 50), 'f.total_ht' => array('label' => "AmountHT", 'checked' => '1', 'position' => 105), 'f.total_vat' => array('label' => "AmountVAT", 'checked' => '0', 'position' => 110), - 'f.total_localtax1' => array('label' => $langs->transcountry("AmountLT1", $mysoc->country_code), 'checked' => '0', 'enabled' => $mysoc->localtax1_assuj == "1", 'position' => 95), - 'f.total_localtax2' => array('label' => $langs->transcountry("AmountLT2", $mysoc->country_code), 'checked' => '0', 'enabled' => $mysoc->localtax2_assuj == "1", 'position' => 100), + 'f.total_localtax1' => array('label' => $langs->transcountry("AmountLT1", $mysoc->country_code), 'checked' => '0', 'enabled' => (string) (int) ($mysoc->localtax1_assuj == "1"), 'position' => 95), + 'f.total_localtax2' => array('label' => $langs->transcountry("AmountLT2", $mysoc->country_code), 'checked' => '0', 'enabled' => (string) (int) ($mysoc->localtax2_assuj == "1"), 'position' => 100), 'f.total_ttc' => array('label' => "AmountTTC", 'checked' => '1', 'position' => 115), 'dynamount_payed' => array('label' => "Paid", 'checked' => '0', 'position' => 116), 'rtp' => array('label' => "Rest", 'checked' => '0', 'position' => 117), - 'f.multicurrency_code' => array('label' => 'Currency', 'checked' => '0', 'position' => 205, 'enabled' => (!isModEnabled("multicurrency") ? 0 : 1)), - 'f.multicurrency_tx' => array('label' => 'CurrencyRate', 'checked' => '0', 'position' => 206, 'enabled' => (!isModEnabled("multicurrency") ? 0 : 1)), - 'f.multicurrency_total_ht' => array('label' => 'MulticurrencyAmountHT', 'position' => 207, 'checked' => '0', 'enabled' => (!isModEnabled("multicurrency") ? 0 : 1)), - 'f.multicurrency_total_vat' => array('label' => 'MulticurrencyAmountVAT', 'position' => 208, 'checked' => '0', 'enabled' => (!isModEnabled("multicurrency") ? 0 : 1)), - 'f.multicurrency_total_ttc' => array('label' => 'MulticurrencyAmountTTC', 'position' => 209, 'checked' => '0', 'enabled' => (!isModEnabled("multicurrency") ? 0 : 1)), - 'multicurrency_dynamount_payed' => array('label' => 'MulticurrencyAlreadyPaid', 'position' => 210, 'checked' => '0', 'enabled' => (!isModEnabled("multicurrency") ? 0 : 1)), - 'multicurrency_rtp' => array('label' => 'MulticurrencyRemainderToPay', 'checked' => '0', 'position' => 211, 'enabled' => (!isModEnabled("multicurrency") ? 0 : 1)), // Not enabled by default because slow + 'f.multicurrency_code' => array('label' => 'Currency', 'checked' => '0', 'position' => 205, 'enabled' => (!isModEnabled("multicurrency") ? '0' : '1')), + 'f.multicurrency_tx' => array('label' => 'CurrencyRate', 'checked' => '0', 'position' => 206, 'enabled' => (!isModEnabled("multicurrency") ? '0' : '1')), + 'f.multicurrency_total_ht' => array('label' => 'MulticurrencyAmountHT', 'position' => 207, 'checked' => '0', 'enabled' => (!isModEnabled("multicurrency") ? '0' : '1')), + 'f.multicurrency_total_vat' => array('label' => 'MulticurrencyAmountVAT', 'position' => 208, 'checked' => '0', 'enabled' => (!isModEnabled("multicurrency") ? '0' : '1')), + 'f.multicurrency_total_ttc' => array('label' => 'MulticurrencyAmountTTC', 'position' => 209, 'checked' => '0', 'enabled' => (!isModEnabled("multicurrency") ? '0' : '1')), + 'multicurrency_dynamount_payed' => array('label' => 'MulticurrencyAlreadyPaid', 'position' => 210, 'checked' => '0', 'enabled' => (!isModEnabled("multicurrency") ? '0' : '1')), + 'multicurrency_rtp' => array('label' => 'MulticurrencyRemainderToPay', 'checked' => '0', 'position' => 211, 'enabled' => (!isModEnabled("multicurrency") ? '0' : '1')), // Not enabled by default because slow 'u.login' => array('label' => "Author", 'checked' => '-1', 'position' => 500), 'f.datec' => array('label' => "DateCreation", 'checked' => '0', 'position' => 501), 'f.tms' => array('label' => "DateModificationShort", 'checked' => '0', 'position' => 502), @@ -226,7 +226,6 @@ if (empty($subtypearray)) { $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); -'@phan-var-force array $arrayfields'; // dol_sort_array looses type for Phan if (!isModEnabled('supplier_invoice')) { accessforbidden(); diff --git a/htdocs/fourn/paiement/list.php b/htdocs/fourn/paiement/list.php index 7920a8145ab..fe46430413c 100644 --- a/htdocs/fourn/paiement/list.php +++ b/htdocs/fourn/paiement/list.php @@ -112,11 +112,10 @@ $arrayfields = array( 's.nom' => array('label' => "ThirdParty", 'checked' => '1', 'position' => 30), 'c.libelle' => array('label' => "Type", 'checked' => '1', 'position' => 40), 'p.num_paiement' => array('label' => "Numero", 'checked' => '1', 'position' => 50, 'tooltip' => "ChequeOrTransferNumber"), - 'ba.label' => array('label' => "BankAccount", 'checked' => '1', 'position' => 60, 'enable' => (isModEnabled("bank"))), + 'ba.label' => array('label' => "BankAccount", 'checked' => '1', 'position' => 60, 'enabled' => (string) (int) (isModEnabled("bank"))), 'p.amount' => array('label' => "Amount", 'checked' => '1', 'position' => 70), ); $arrayfields = dol_sort_array($arrayfields, 'position'); -'@phan-var-force array $arrayfields'; // dol_sort_array looses type for Phan // Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context $hookmanager->initHooks(array('paymentsupplierlist')); diff --git a/htdocs/multicurrency/multicurrency_rate.php b/htdocs/multicurrency/multicurrency_rate.php index bd0dfdacadb..711ad23dcbf 100644 --- a/htdocs/multicurrency/multicurrency_rate.php +++ b/htdocs/multicurrency/multicurrency_rate.php @@ -121,7 +121,6 @@ $arrayfields = array( $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); -'@phan-var-force array,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan // Access control // TODO Open this page to a given permission so a sale representative can modify change rates. Permission should be added into module multicurrency. diff --git a/htdocs/product/list.php b/htdocs/product/list.php index aba29201e96..15c801446d9 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -239,67 +239,67 @@ $alias_product_perentity = !getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED') $arraypricelevel = array(); // Definition of array of fields for columns $arrayfields = array( - 'p.rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -2, 'noteditable' => 1, 'notnull' => 1, 'index' => 1, 'position' => 1, 'comment' => 'Id', 'css' => 'left'), - 'p.ref' => array('label' => 'ProductRef', 'checked' => 1, 'position' => 5), - 'p.ref_ext' => array('label' => 'RefExt', 'checked' => 1, 'position' => 6, 'visible' => getDolGlobalInt('MAIN_LIST_SHOW_REF_EXT')), + 'p.rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => '1', 'visible' => -2, 'noteditable' => 1, 'notnull' => 1, 'index' => 1, 'position' => 1, 'comment' => 'Id', 'css' => 'left'), + 'p.ref' => array('label' => 'ProductRef', 'checked' => '1', 'position' => 5), + 'p.ref_ext' => array('label' => 'RefExt', 'checked' => '1', 'position' => 6, 'visible' => getDolGlobalInt('MAIN_LIST_SHOW_REF_EXT')), //'pfp.ref_fourn'=>array('label'=>$langs->trans("RefSupplier"), 'checked'=>1, 'enabled'=>(isModEnabled('barcode'))), - 'thumbnail' => array('label' => 'Photo', 'checked' => 0, 'position' => 10), - 'p.description' => array('label' => 'Description', 'checked' => 0, 'position' => 10), - 'p.label' => array('label' => "Label", 'checked' => 1, 'position' => 10), - 'p.fk_product_type' => array('label' => "Type", 'checked' => 0, 'enabled' => (isModEnabled("product") && isModEnabled("service")), 'position' => 11), - 'p.barcode' => array('label' => "Gencod", 'checked' => 1, 'enabled' => (isModEnabled('barcode')), 'position' => 12), - 'p.duration' => array('label' => "Duration", 'checked' => ($contextpage != 'productlist'), 'enabled' => (isModEnabled("service") && (string) $type == '1'), 'position' => 13), - 'pac.fk_product_parent' => array('label' => "ParentProductOfVariant", 'checked' => -1, 'enabled' => (isModEnabled('variants')), 'position' => 14), - 'p.finished' => array('label' => "Nature", 'checked' => 0, 'enabled' => (isModEnabled("product") && $type != '1'), 'position' => 19), - 'p.weight' => array('label' => 'Weight', 'checked' => 0, 'enabled' => (isModEnabled("product") && $type != '1'), 'position' => 20), - 'p.weight_units' => array('label' => 'WeightUnits', 'checked' => 0, 'enabled' => (isModEnabled("product") && $type != '1'), 'position' => 21), - 'p.length' => array('label' => 'Length', 'checked' => 0, 'enabled' => (isModEnabled("product") && !getDolGlobalString('PRODUCT_DISABLE_SIZE') && $type != '1'), 'position' => 22), - 'p.length_units' => array('label' => 'LengthUnits', 'checked' => 0, 'enabled' => (isModEnabled("product") && !getDolGlobalString('PRODUCT_DISABLE_SIZE') && $type != '1'), 'position' => 23), - 'p.width' => array('label' => 'Width', 'checked' => 0, 'enabled' => (isModEnabled("product") && !getDolGlobalString('PRODUCT_DISABLE_SIZE') && $type != '1'), 'position' => 24), - 'p.width_units' => array('label' => 'WidthUnits', 'checked' => 0, 'enabled' => (isModEnabled("product") && !getDolGlobalString('PRODUCT_DISABLE_SIZE') && $type != '1'), 'position' => 25), - 'p.height' => array('label' => 'Height', 'checked' => 0, 'enabled' => (isModEnabled("product") && !getDolGlobalString('PRODUCT_DISABLE_SIZE') && $type != '1'), 'position' => 26), - 'p.height_units' => array('label' => 'HeightUnits', 'checked' => 0, 'enabled' => (isModEnabled("product") && !getDolGlobalString('PRODUCT_DISABLE_SIZE') && $type != '1'), 'position' => 27), - 'p.surface' => array('label' => 'Surface', 'checked' => 0, 'enabled' => (isModEnabled("product") && !getDolGlobalString('PRODUCT_DISABLE_SURFACE') && $type != '1'), 'position' => 28), - 'p.surface_units' => array('label' => 'SurfaceUnits', 'checked' => 0, 'enabled' => (isModEnabled("product") && !getDolGlobalString('PRODUCT_DISABLE_SURFACE') && $type != '1'), 'position' => 29), - 'p.volume' => array('label' => 'Volume', 'checked' => 0, 'enabled' => (isModEnabled("product") && !getDolGlobalString('PRODUCT_DISABLE_VOLUME') && $type != '1'), 'position' => 30), - 'p.volume_units' => array('label' => 'VolumeUnits', 'checked' => 0, 'enabled' => (isModEnabled("product") && !getDolGlobalString('PRODUCT_DISABLE_VOLUME') && $type != '1'), 'position' => 31), - 'cu.label' => array('label' => "DefaultUnitToShow", 'checked' => 0, 'enabled' => (isModEnabled("product") && getDolGlobalString('PRODUCT_USE_UNITS')), 'position' => 32), - 'p.fk_default_workstation' => array('label' => 'DefaultWorkstation', 'checked' => 0, 'enabled' => isModEnabled('workstation') && $type == 1, 'position' => 33), - 'p.sellprice' => array('label' => "SellingPrice", 'checked' => 1, 'enabled' => !getDolGlobalString('PRODUIT_MULTIPRICES'), 'position' => 40), - 'p.tva_tx' => array('label' => "VATRate", 'checked' => 0, 'enabled' => !getDolGlobalString('PRODUIT_MULTIPRICES'), 'position' => 41), - 'p.minbuyprice' => array('label' => "BuyingPriceMinShort", 'checked' => 1, 'enabled' => ($user->hasRight('fournisseur', 'lire')), 'position' => 42), - 'p.numbuyprice' => array('label' => "BuyingPriceNumShort", 'checked' => 0, 'enabled' => ($user->hasRight('fournisseur', 'lire')), 'position' => 43), - 'p.pmp' => array('label' => "PMPValueShort", 'checked' => 0, 'enabled' => ($user->hasRight('fournisseur', 'lire')), 'position' => 44), - 'p.cost_price' => array('label' => "CostPrice", 'checked' => 0, 'enabled' => ($user->hasRight('fournisseur', 'lire')), 'position' => 45), - 'p.seuil_stock_alerte' => array('label' => "StockLimit", 'checked' => 0, 'enabled' => (isModEnabled('stock') && $user->hasRight('stock', 'lire') && ($contextpage != 'servicelist' || getDolGlobalString('STOCK_SUPPORTS_SERVICES'))), 'position' => 50), - 'p.desiredstock' => array('label' => "DesiredStock", 'checked' => 1, 'enabled' => (isModEnabled('stock') && $user->hasRight('stock', 'lire') && ($contextpage != 'servicelist' || getDolGlobalString('STOCK_SUPPORTS_SERVICES'))), 'position' => 51), - 'p.stock' => array('label' => "PhysicalStock", 'checked' => 1, 'enabled' => (isModEnabled('stock') && $user->hasRight('stock', 'lire') && ($contextpage != 'servicelist' || getDolGlobalString('STOCK_SUPPORTS_SERVICES'))), 'position' => 52), - 'stock_virtual' => array('label' => "VirtualStock", 'checked' => 1, 'enabled' => (isModEnabled('stock') && $user->hasRight('stock', 'lire') && ($contextpage != 'servicelist' || getDolGlobalString('STOCK_SUPPORTS_SERVICES')) && $virtualdiffersfromphysical), 'position' => 53), - 'p.tobatch' => array('label' => "ManageLotSerial", 'checked' => 0, 'enabled' => (isModEnabled('productbatch')), 'position' => 60), - 'p.fk_country' => array('label' => "Country", 'checked' => 0, 'position' => 100), - 'p.fk_state' => array('label' => "State", 'checked' => 0, 'position' => 101), - $alias_product_perentity . '.accountancy_code_sell' => array('label' => "ProductAccountancySellCode", 'checked' => 0, 'enabled' => !getDolGlobalString('PRODUCT_DISABLE_ACCOUNTING'), 'position' => 400), - $alias_product_perentity . '.accountancy_code_sell_intra' => array('label' => "ProductAccountancySellIntraCode", 'checked' => 0, 'enabled' => $isInEEC && !getDolGlobalString('PRODUCT_DISABLE_ACCOUNTING'), 'position' => 401), - $alias_product_perentity . '.accountancy_code_sell_export' => array('label' => "ProductAccountancySellExportCode", 'checked' => 0, 'enabled' => !getDolGlobalString('PRODUCT_DISABLE_ACCOUNTING'), 'position' => 402), - $alias_product_perentity . '.accountancy_code_buy' => array('label' => "ProductAccountancyBuyCode", 'checked' => 0, 'enabled' => !getDolGlobalString('PRODUCT_DISABLE_ACCOUNTING'), 'position' => 403), - $alias_product_perentity . '.accountancy_code_buy_intra' => array('label' => "ProductAccountancyBuyIntraCode", 'checked' => 0, 'enabled' => $isInEEC && !getDolGlobalString('PRODUCT_DISABLE_ACCOUNTING'), 'position' => 404), - $alias_product_perentity . '.accountancy_code_buy_export' => array('label' => "ProductAccountancyBuyExportCode", 'checked' => 0, 'enabled' => !getDolGlobalString('PRODUCT_DISABLE_ACCOUNTING'), 'position' => 405), - 'p.datec' => array('label' => "DateCreation", 'checked' => 0, 'position' => 500), - 'p.tms' => array('label' => "DateModificationShort", 'checked' => 0, 'position' => 500), - 'p.tosell' => array('label' => $langs->transnoentitiesnoconv("Status").' ('.$langs->transnoentitiesnoconv("Sell").')', 'checked' => 1, 'position' => 1000), - 'p.tobuy' => array('label' => $langs->transnoentitiesnoconv("Status").' ('.$langs->transnoentitiesnoconv("Buy").')', 'checked' => 1, 'position' => 1000), - 'p.import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'visible' => -2, 'notnull' => -1, 'index' => 0, 'checked' => -1, 'position' => 1100), + 'thumbnail' => array('label' => 'Photo', 'checked' => '0', 'position' => 10), + 'p.description' => array('label' => 'Description', 'checked' => '0', 'position' => 10), + 'p.label' => array('label' => "Label", 'checked' => '1', 'position' => 10), + 'p.fk_product_type' => array('label' => "Type", 'checked' => '0', 'enabled' => (string) (int) (isModEnabled("product") && isModEnabled("service")), 'position' => 11), + 'p.barcode' => array('label' => "Gencod", 'checked' => '1', 'enabled' => (string) (int) (isModEnabled('barcode')), 'position' => 12), + 'p.duration' => array('label' => "Duration", 'checked' => ($contextpage != 'productlist'), 'enabled' => (string) (int) (isModEnabled("service") && (string) $type == '1'), 'position' => 13), + 'pac.fk_product_parent' => array('label' => "ParentProductOfVariant", 'checked' => '-1', 'enabled' => (string) (int) (isModEnabled('variants')), 'position' => 14), + 'p.finished' => array('label' => "Nature", 'checked' => '0', 'enabled' => (string) (int) (isModEnabled("product") && $type != '1'), 'position' => 19), + 'p.weight' => array('label' => 'Weight', 'checked' => '0', 'enabled' => (string) (int) (isModEnabled("product") && $type != '1'), 'position' => 20), + 'p.weight_units' => array('label' => 'WeightUnits', 'checked' => '0', 'enabled' => (string) (int) (isModEnabled("product") && $type != '1'), 'position' => 21), + 'p.length' => array('label' => 'Length', 'checked' => '0', 'enabled' => (string) (int) (isModEnabled("product") && !getDolGlobalString('PRODUCT_DISABLE_SIZE') && $type != '1'), 'position' => 22), + 'p.length_units' => array('label' => 'LengthUnits', 'checked' => '0', 'enabled' => (string) (int) (isModEnabled("product") && !getDolGlobalString('PRODUCT_DISABLE_SIZE') && $type != '1'), 'position' => 23), + 'p.width' => array('label' => 'Width', 'checked' => '0', 'enabled' => (string) (int) (isModEnabled("product") && !getDolGlobalString('PRODUCT_DISABLE_SIZE') && $type != '1'), 'position' => 24), + 'p.width_units' => array('label' => 'WidthUnits', 'checked' => '0', 'enabled' => (string) (int) (isModEnabled("product") && !getDolGlobalString('PRODUCT_DISABLE_SIZE') && $type != '1'), 'position' => 25), + 'p.height' => array('label' => 'Height', 'checked' => '0', 'enabled' => (string) (int) (isModEnabled("product") && !getDolGlobalString('PRODUCT_DISABLE_SIZE') && $type != '1'), 'position' => 26), + 'p.height_units' => array('label' => 'HeightUnits', 'checked' => '0', 'enabled' => (string) (int) (isModEnabled("product") && !getDolGlobalString('PRODUCT_DISABLE_SIZE') && $type != '1'), 'position' => 27), + 'p.surface' => array('label' => 'Surface', 'checked' => '0', 'enabled' => (string) (int) (isModEnabled("product") && !getDolGlobalString('PRODUCT_DISABLE_SURFACE') && $type != '1'), 'position' => 28), + 'p.surface_units' => array('label' => 'SurfaceUnits', 'checked' => '0', 'enabled' => (string) (int) (isModEnabled("product") && !getDolGlobalString('PRODUCT_DISABLE_SURFACE') && $type != '1'), 'position' => 29), + 'p.volume' => array('label' => 'Volume', 'checked' => '0', 'enabled' => (string) (int) (isModEnabled("product") && !getDolGlobalString('PRODUCT_DISABLE_VOLUME') && $type != '1'), 'position' => 30), + 'p.volume_units' => array('label' => 'VolumeUnits', 'checked' => '0', 'enabled' => (string) (int) (isModEnabled("product") && !getDolGlobalString('PRODUCT_DISABLE_VOLUME') && $type != '1'), 'position' => 31), + 'cu.label' => array('label' => "DefaultUnitToShow", 'checked' => '0', 'enabled' => (string) (int) (isModEnabled("product") && getDolGlobalString('PRODUCT_USE_UNITS')), 'position' => 32), + 'p.fk_default_workstation' => array('label' => 'DefaultWorkstation', 'checked' => '0', 'enabled' => (string) (int) (isModEnabled('workstation') && $type == 1), 'position' => 33), + 'p.sellprice' => array('label' => "SellingPrice", 'checked' => '1', 'enabled' => (string) (int) !getDolGlobalString('PRODUIT_MULTIPRICES'), 'position' => 40), + 'p.tva_tx' => array('label' => "VATRate", 'checked' => '0', 'enabled' => (string) (int) !getDolGlobalString('PRODUIT_MULTIPRICES'), 'position' => 41), + 'p.minbuyprice' => array('label' => "BuyingPriceMinShort", 'checked' => '1', 'enabled' => (string) (int) ($user->hasRight('fournisseur', 'lire')), 'position' => 42), + 'p.numbuyprice' => array('label' => "BuyingPriceNumShort", 'checked' => '0', 'enabled' => (string) (int) ($user->hasRight('fournisseur', 'lire')), 'position' => 43), + 'p.pmp' => array('label' => "PMPValueShort", 'checked' => '0', 'enabled' => (string) (int) ($user->hasRight('fournisseur', 'lire')), 'position' => 44), + 'p.cost_price' => array('label' => "CostPrice", 'checked' => '0', 'enabled' => (string) (int) ($user->hasRight('fournisseur', 'lire')), 'position' => 45), + 'p.seuil_stock_alerte' => array('label' => "StockLimit", 'checked' => '0', 'enabled' => (string) (int) (isModEnabled('stock') && $user->hasRight('stock', 'lire') && ($contextpage != 'servicelist' || getDolGlobalString('STOCK_SUPPORTS_SERVICES'))), 'position' => 50), + 'p.desiredstock' => array('label' => "DesiredStock", 'checked' => '1', 'enabled' => (string) (int) (isModEnabled('stock') && $user->hasRight('stock', 'lire') && ($contextpage != 'servicelist' || getDolGlobalString('STOCK_SUPPORTS_SERVICES'))), 'position' => 51), + 'p.stock' => array('label' => "PhysicalStock", 'checked' => '1', 'enabled' => (string) (int) (isModEnabled('stock') && $user->hasRight('stock', 'lire') && ($contextpage != 'servicelist' || getDolGlobalString('STOCK_SUPPORTS_SERVICES'))), 'position' => 52), + 'stock_virtual' => array('label' => "VirtualStock", 'checked' => '1', 'enabled' => (string) (int) (isModEnabled('stock') && $user->hasRight('stock', 'lire') && ($contextpage != 'servicelist' || getDolGlobalString('STOCK_SUPPORTS_SERVICES')) && $virtualdiffersfromphysical), 'position' => 53), + 'p.tobatch' => array('label' => "ManageLotSerial", 'checked' => '0', 'enabled' => (string) (int) (isModEnabled('productbatch')), 'position' => 60), + 'p.fk_country' => array('label' => "Country", 'checked' => '0', 'position' => 100), + 'p.fk_state' => array('label' => "State", 'checked' => '0', 'position' => 101), + $alias_product_perentity . '.accountancy_code_sell' => array('label' => "ProductAccountancySellCode", 'checked' => '0', 'enabled' => (string) (int) !getDolGlobalString('PRODUCT_DISABLE_ACCOUNTING'), 'position' => 400), + $alias_product_perentity . '.accountancy_code_sell_intra' => array('label' => "ProductAccountancySellIntraCode", 'checked' => '0', 'enabled' => (string) (int) ($isInEEC && !getDolGlobalString('PRODUCT_DISABLE_ACCOUNTING')), 'position' => 401), + $alias_product_perentity . '.accountancy_code_sell_export' => array('label' => "ProductAccountancySellExportCode", 'checked' => '0', 'enabled' => (string) (int) !getDolGlobalString('PRODUCT_DISABLE_ACCOUNTING'), 'position' => 402), + $alias_product_perentity . '.accountancy_code_buy' => array('label' => "ProductAccountancyBuyCode", 'checked' => '0', 'enabled' => (string) (int) !getDolGlobalString('PRODUCT_DISABLE_ACCOUNTING'), 'position' => 403), + $alias_product_perentity . '.accountancy_code_buy_intra' => array('label' => "ProductAccountancyBuyIntraCode", 'checked' => '0', 'enabled' => (string) (int) ($isInEEC && !getDolGlobalString('PRODUCT_DISABLE_ACCOUNTING')), 'position' => 404), + $alias_product_perentity . '.accountancy_code_buy_export' => array('label' => "ProductAccountancyBuyExportCode", 'checked' => '0', 'enabled' => (string) (int) !getDolGlobalString('PRODUCT_DISABLE_ACCOUNTING'), 'position' => 405), + 'p.datec' => array('label' => "DateCreation", 'checked' => '0', 'position' => 500), + 'p.tms' => array('label' => "DateModificationShort", 'checked' => '0', 'position' => 500), + 'p.tosell' => array('label' => $langs->transnoentitiesnoconv("Status").' ('.$langs->transnoentitiesnoconv("Sell").')', 'checked' => '1', 'position' => 1000), + 'p.tobuy' => array('label' => $langs->transnoentitiesnoconv("Status").' ('.$langs->transnoentitiesnoconv("Buy").')', 'checked' => '1', 'position' => 1000), + 'p.import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => '1', 'visible' => -2, 'notnull' => -1, 'index' => 0, 'checked' => '-1', 'position' => 1100), ); if (! empty($conf->stock->enabled)) { // service if ($type == 1) { if (! empty($conf->global->STOCK_SUPPORTS_SERVICES)) { - $arrayfields['p.stockable_product'] = array('label' => $langs->trans('StockableProduct'), 'checked' => 0, 'position' => 1001); + $arrayfields['p.stockable_product'] = array('label' => $langs->trans('StockableProduct'), 'checked' => '0', 'position' => 1001); } } else { //product - $arrayfields['p.stockable_product'] = array('label' => $langs->trans('StockableProduct'), 'checked' => 0, 'position' => 1001); + $arrayfields['p.stockable_product'] = array('label' => $langs->trans('StockableProduct'), 'checked' => '0', 'position' => 1001); } } /*foreach ($object->fields as $key => $val) { @@ -308,7 +308,7 @@ if (! empty($conf->stock->enabled)) { $visible = dol_eval($val['visible'], 1, 1, '1'); $arrayfields['p.'.$key] = array( 'label'=>$val['label'], - 'checked'=>(($visible < 0) ? 0 : 1), + 'checked'=>(($visible < 0) ? '0' : '1'), 'enabled'=>(abs($visible) != 3 && (bool) dol_eval($val['enabled'], 1)), 'position'=>$val['position'] ); @@ -337,7 +337,6 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); // Note: forcing int for position, but in reality it is a float here. -'@phan-var-force array $arrayfields'; // dol_sort_array looses type for Phan // Security check if ($search_type == '0') { @@ -1231,7 +1230,7 @@ if (!empty($arrayfields['p.seuil_stock_alerte']['checked'])) { print ''; } // Managed_in_stock -$array = array('-1'=>' ', '0'=>$langs->trans('No'), '1'=>$langs->trans('Yes')); +$array = array('-1' => ' ', '0' => $langs->trans('No'), '1' => $langs->trans('Yes')); if (!empty($arrayfields['p.stockable_product']['checked'])) { print ''; } diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 7a2b1dd6e0d..9b5415d4bb1 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -247,7 +247,7 @@ foreach ($object->fields as $key => $val) { $arrayfields['p.'.$key] = array( 'label' => $val['label'], 'checked' => (($visible < 0) ? '0' : '1'), - 'enabled' => (string) (int) (abs($visible) != 3 && (bool) dol_eval($val['enabled'], 1)), + 'enabled' => (string) (int) (abs($visible) != 3 && (bool) dol_eval((string) $val['enabled'], 1)), 'position' => $val['position'], 'help' => isset($val['help']) ? $val['help'] : '' ); @@ -298,7 +298,6 @@ if ($contextpage == 'lead') { $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); -// '@phan-var-force array $arrayfields'; // dol_sort_array looses type for Phan // Add a groupby field. Set $groupby and $groupbyvalues. // TODO Move this into a inc file diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index f2db5d2593f..785db5723d3 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -199,7 +199,6 @@ $extrafieldsobjectprefix = 'efpt.'; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; $arrayfields = dol_sort_array($arrayfields, 'position'); -// '@phan-var-force array,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index 6fcb3e45e71..64f423c0fd1 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -194,7 +194,6 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); -// '@phan-var-force array,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan $permissiontoread = $user->hasRight('projet', 'lire'); $permissiontocreate = $user->hasRight('projet', 'creer'); diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index e40c0f3a432..c3aabdbf27f 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -1304,7 +1304,6 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_array_fields.tpl.php'; $arrayfields = dol_sort_array($arrayfields, 'position'); - // '@phan-var-force array,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan $param = ''; if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { diff --git a/htdocs/reception/list.php b/htdocs/reception/list.php index e9b77506b5c..e727567be33 100644 --- a/htdocs/reception/list.php +++ b/htdocs/reception/list.php @@ -152,7 +152,6 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); -// '@phan-var-force array,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan $error = 0;
'.$langs->trans($mode_info['label']).'
' . $langs->trans($field_info['label']) . ''; $accountancy_code = GETPOSTISSET($html_name) ? GETPOST($html_name, 'aZ09') : (!empty($assetaccountancycodes->accountancy_codes[$mode_key][$field_key]) ? $assetaccountancycodes->accountancy_codes[$mode_key][$field_key] : ''); if (isModEnabled('accounting')) { - print $formaccounting->select_account($accountancy_code, $html_name, 1, null, 1, 1, 'minwidth100 maxwidth300 maxwidthonsmartphone', 1); + print $formaccounting->select_account($accountancy_code, $html_name, 1, array(), 1, 1, 'minwidth100 maxwidth300 maxwidthonsmartphone', '1'); } else { print ''; } diff --git a/htdocs/asset/tpl/depreciation_options_edit.tpl.php b/htdocs/asset/tpl/depreciation_options_edit.tpl.php index e33af821779..e61443e23c3 100644 --- a/htdocs/asset/tpl/depreciation_options_edit.tpl.php +++ b/htdocs/asset/tpl/depreciation_options_edit.tpl.php @@ -2,7 +2,7 @@ /* Copyright (C) 2021 Open-Dsi * Copyright (C) 2024 Frédéric France * Copyright (C) 2024 José - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -169,7 +169,7 @@ if (empty($reshook)) { } else { if ($field_key == 'lang') { print img_picto('', 'language', 'class="pictofixedwidth"'); - print $formadmin->select_language($value, $html_name, 0, null, 1, 0, 0, 'minwidth300', 2); + print $formadmin->select_language($value, $html_name, 0, array(), 1, 0, 0, 'minwidth300', 2); } else { print $assetdepreciationoptions->showInputField($field_info, $field_key, $value, '', '', $prefix_html_name, 0); } diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index 18925764aed..8b1c6605ac4 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -235,7 +235,7 @@ if (empty($reshook)) { } } - $result = $object->addLine((int) $idprod, (float) $qty, (float) $qty_frozen, $disable_stock_change, (float) $efficiency, -1, $bom_child_id, null, $fk_unit, $array_options, $fk_default_workstation); + $result = $object->addLine((int) $idprod, (float) $qty, $qty_frozen, $disable_stock_change, (float) $efficiency, -1, $bom_child_id, null, (int) $fk_unit, $array_options, $fk_default_workstation); if ($result <= 0) { setEventMessages($object->error, $object->errors, 'errors'); diff --git a/htdocs/bom/bom_list.php b/htdocs/bom/bom_list.php index b3a67ae36e8..b5202ebdde3 100644 --- a/htdocs/bom/bom_list.php +++ b/htdocs/bom/bom_list.php @@ -1,6 +1,6 @@ - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -761,13 +761,13 @@ while ($i < $imaxinloop) { if (!empty($arrayfields['t.'.$key]['checked'])) { print '$key)) { - print ' title="'.dol_escape_htmltag($object->$key).'"'; + print ' title="'.dol_escape_htmltag((string) $object->$key).'"'; } print '>'; if ($key == 'status') { print $object->getLibStatut(5); } elseif ($key == 'rowid') { - print $object->showOutputField($val, $key, $object->id, ''); + print $object->showOutputField($val, $key, (string) $object->id, ''); } else { print $object->showOutputField($val, $key, $object->$key, ''); } diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index 7682763b23c..936e20e25d3 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -3,7 +3,7 @@ * Copyright (C) 2023 Benjamin Falière * Copyright (C) 2023 Charlene Benke * Copyright (C) 2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -432,7 +432,7 @@ class BOM extends CommonObject * Load object lines in memory from the database by type of product * * @param int<0,1> $typeproduct 0 type product, 1 type service - + * * @return int<-1,1> Return integer <0 if KO, 0 if not found, >0 if OK */ public function fetchLinesbytypeproduct($typeproduct = 0) @@ -580,7 +580,7 @@ class BOM extends CommonObject * * @param int $fk_product Id of product * @param float $qty Quantity - * @param int<0,1> $qty_frozen If the qty is Frozen + * @param int<0,1> $qty_frozen If the qty is Frozen * @param int $disable_stock_change Disable stock change on using in MO * @param float $efficiency Efficiency in MO * @param int<-1,max> $position Position of BOM-Line in BOM-Lines @@ -1455,7 +1455,7 @@ class BOM extends CommonObject $this->total_cost += $line->total_cost; } else { $bom_child = new BOM($this->db); - $res = $bom_child->fetch($line->fk_bom_child); + $res = $bom_child->fetch((int) $line->fk_bom_child); if ($res > 0) { $bom_child->calculateCosts(); $line->childBom[] = $bom_child; diff --git a/htdocs/bom/tpl/linkedobjectblock.tpl.php b/htdocs/bom/tpl/linkedobjectblock.tpl.php index aee1a6bebdb..3df8ca37d02 100644 --- a/htdocs/bom/tpl/linkedobjectblock.tpl.php +++ b/htdocs/bom/tpl/linkedobjectblock.tpl.php @@ -3,7 +3,7 @@ * Copyright (C) 2013 Juanjo Menent * Copyright (C) 2014 Marcos García * Copyright (C) 2013-2020 Charlene BENKE - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -53,7 +53,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) { echo '
'.$langs->trans("Bom"); if (!empty($showImportButton) && $conf->global->MAIN_ENABLE_IMPORT_LINKED_OBJECT_LINES) { - print ' '; echo ''.$objectlink->getNomUrl(1).''; - print $tmpcontact->getNomUrl(1, -1); + print $tmpcontact->getNomUrl(1, '-1'); print '
'; - print $account->getNomUrl(1, 0); + print $account->getNomUrl(1, '0'); print "'.$account->bank."'.$account->number."
'; @@ -1477,7 +1485,10 @@ if ($type == Categorie::TYPE_ORDER) { print ''; print '
'; - $param = '&limit='.$limit.'&id='.$id.'&type='.$type; $num = count($objects); $nbtotalofrecords = ''; $newcardbutton = ''; + $param = '&limit='.$limit.'&id='.$id.'&type='.$type; + $num = count($objects); + $nbtotalofrecords = ''; + $newcardbutton = ''; // @phan-suppress-next-line PhanPluginSuspiciousParamOrder print_barre_liste($langs->trans("Orders"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'bill', 0, $newcardbutton, '', $limit); @@ -1555,7 +1566,10 @@ if ($type == Categorie::TYPE_INVOICE) { print ''; print '
'; - $param = '&limit='.$limit.'&id='.$id.'&type='.$type; $num = count($objects); $nbtotalofrecords = ''; $newcardbutton = ''; + $param = '&limit='.$limit.'&id='.$id.'&type='.$type; + $num = count($objects); + $nbtotalofrecords = ''; + $newcardbutton = ''; // @phan-suppress-next-line PhanPluginSuspiciousParamOrder print_barre_liste($langs->trans("BillsCustomers"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'bill', 0, $newcardbutton, '', $limit); @@ -1606,7 +1620,8 @@ if ($type == Categorie::TYPE_SUPPLIER_ORDER) { dol_print_error($db, $object->error, $object->errors); } else { // Form to add record into a category - $showclassifyform = $user->hasRight('fournisseur', 'commande', 'creer');; + $showclassifyform = $user->hasRight('fournisseur', 'commande', 'creer'); + ; if ($showclassifyform) { print '
'; print '
'; @@ -1633,7 +1648,10 @@ if ($type == Categorie::TYPE_SUPPLIER_ORDER) { print ''; print '
'; - $param = '&limit='.$limit.'&id='.$id.'&type='.$type; $num = count($objects); $nbtotalofrecords = ''; $newcardbutton = ''; + $param = '&limit='.$limit.'&id='.$id.'&type='.$type; + $num = count($objects); + $nbtotalofrecords = ''; + $newcardbutton = ''; // @phan-suppress-next-line PhanPluginSuspiciousParamOrder print_barre_liste($langs->trans("SuppliersOrders"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'supplier_order', 0, $newcardbutton, '', $limit); diff --git a/htdocs/commande/list_det.php b/htdocs/commande/list_det.php index f5a41ddae21..50117cfbb7a 100644 --- a/htdocs/commande/list_det.php +++ b/htdocs/commande/list_det.php @@ -1309,7 +1309,6 @@ if ($resql) { if (!empty($arrayfields['rowid']['checked'])) { // @phan-suppress-next-line PhanTypeInvalidDimOffset print_liste_field_titre($arrayfields['rowid']['label'], $_SERVER["PHP_SELF"], 'rowid', '', $param, '', $sortfield, $sortorder); - '@phan-var-force array,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan } if (!empty($arrayfields['pr.ref']['checked'])) { print_liste_field_titre($arrayfields['pr.ref']['label'], $_SERVER["PHP_SELF"], 'pr.ref', '', $param, '', $sortfield, $sortorder); @@ -1474,8 +1473,9 @@ if ($resql) { $total = 0; $subtotal = 0; $productstat_cache = array(); - '@phan-var-force array $product_sdtat_cache'; + '@phan-var-force array $product_stat_cache'; $productstat_cachevirtual = array(); + '@phan-var-force array $product_stat_cachevirtual'; $getNomUrl_cache = array(); $generic_commande = new Commande($db); diff --git a/htdocs/compta/accounting-files.php b/htdocs/compta/accounting-files.php index 94bd781bcdd..da5d92d51ab 100644 --- a/htdocs/compta/accounting-files.php +++ b/htdocs/compta/accounting-files.php @@ -840,7 +840,7 @@ if (!empty($date_start) && !empty($date_stop)) { } elseif ($data['item'] == 'ExpenseReport') { $expensereport->id = (int) $data['id']; $expensereport->ref = $data['ref']; - print $expensereport->getNomUrl(1, 0, 0, 0, 0, 0); + print $expensereport->getNomUrl(1, '0', 0, 0, '0', 0); } elseif ($data['item'] == 'SalaryPayment') { $salary_payment->id = (int) $data['id']; $salary_payment->ref = $data['ref']; @@ -852,7 +852,7 @@ if (!empty($date_start) && !empty($date_stop)) { } elseif ($data['item'] == 'SocialContributions') { $charge_sociales->id = (int) $data['id']; $charge_sociales->ref = $data['ref']; - print $charge_sociales->getNomUrl(1, 0, 0, 0, 0); + print $charge_sociales->getNomUrl(1, '0', 0, 0, 0); } elseif ($data['item'] == 'VariousPayment') { $various_payment->id = (int) $data['id']; $various_payment->ref = $data['ref']; diff --git a/htdocs/compta/bank/annuel.php b/htdocs/compta/bank/annuel.php index 3da2f8f3671..c79519f9254 100644 --- a/htdocs/compta/bank/annuel.php +++ b/htdocs/compta/bank/annuel.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2017 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2013-2023 Charlene BENKE - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -79,7 +79,7 @@ $error = 0; // Get account information $object = new Account($db); if ($id > 0 && !preg_match('/,/', $id)) { // if for a particular account and not a list - $result = $object->fetch($id); + $result = $object->fetch((int) $id); $id = $object->id; } if (!empty($ref)) { @@ -169,7 +169,7 @@ if (!empty($id)) { $bankaccount = new Account($db); $listid = explode(',', $id); foreach ($listid as $key => $aId) { - $bankaccount->fetch($aId); + $bankaccount->fetch((int) $aId); $bankaccount->label = $bankaccount->ref; print $bankaccount->getNomUrl(1); if ($key < (count($listid) - 1)) { @@ -374,7 +374,7 @@ if ($result < 0) { $px1 = new DolGraph(); $px1->SetData($graph_datas); - $px1->SetLegend(array(($year - 2), ($year - 1), $year)); + $px1->SetLegend(array((string) ($year - 2), (string) ($year - 1), (string) $year)); $px1->SetLegendWidthMin(180); $px1->SetMaxValue($px1->GetCeilMaxValue() < 0 ? 0 : $px1->GetCeilMaxValue()); $px1->SetMinValue($px1->GetFloorMinValue() > 0 ? 0 : $px1->GetFloorMinValue()); @@ -456,7 +456,7 @@ if ($result < 0) { $px2 = new DolGraph(); $px2->SetData($graph_datas); - $px2->SetLegend(array(($year - 2), ($year - 1), $year)); + $px2->SetLegend(array((string) ($year - 2), (string) ($year - 1), (string) $year)); $px2->SetLegendWidthMin(180); $px2->SetMaxValue($px2->GetCeilMaxValue() < 0 ? 0 : $px2->GetCeilMaxValue()); $px2->SetMinValue($px2->GetFloorMinValue() > 0 ? 0 : $px2->GetFloorMinValue()); diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index b7e00c3259c..4836f907904 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -10,7 +10,7 @@ * Copyright (C) 2018 Ferran Marcet * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2021 Gauthier VERDOL - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -158,21 +158,21 @@ $extrafields->fetch_name_optionals_label($extrafieldsobjectkey); $search_array_options = $extrafields->getOptionalsFromPost($extrafieldsobjectkey, '', 'search_'); $arrayfields = array( - 'b.rowid' => array('label' => $langs->trans("Ref"), 'checked' => 1,'position' => 10), - 'b.label' => array('label' => $langs->trans("Description"), 'checked' => 1,'position' => 20), - 'b.dateo' => array('label' => $langs->trans("DateOperationShort"), 'checked' => -1,'position' => 30), - 'b.datev' => array('label' => $langs->trans("DateValueShort"), 'checked' => 1,'position' => 40), - 'type' => array('label' => $langs->trans("Type"), 'checked' => 1,'position' => 50), - 'b.num_chq' => array('label' => $langs->trans("Numero"), 'checked' => 0,'position' => 60), - 'b.fk_bordereau' => array('label' => $langs->trans("ChequeNumber"), 'checked' => 0, 'position' => 65), - 'bu.label' => array('label' => $langs->trans("ThirdParty").'/'.$langs->trans("User"), 'checked' => 1, 'position' => 70), - 'ba.ref' => array('label' => $langs->trans("BankAccount"), 'checked' => (($id > 0 || !empty($ref)) ? 0 : 1), 'position' => 80), - 'b.debit' => array('label' => $langs->trans("Debit"), 'checked' => 1, 'position' => 90), - 'b.credit' => array('label' => $langs->trans("Credit"), 'checked' => 1, 'position' => 100), - 'balancebefore' => array('label' => $langs->trans("BalanceBefore"), 'checked' => 0, 'position' => 110), - 'balance' => array('label' => $langs->trans("Balance"), 'checked' => 1, 'position' => 120), - 'b.num_releve' => array('label' => $langs->trans("AccountStatement"), 'checked' => 1, 'position' => 130), - 'b.conciliated' => array('label' => $langs->trans("BankLineReconciled"), 'enabled' => $object->rappro, 'checked' => ($action == 'reconcile' ? 1 : 0), 'position' => 140), + 'b.rowid' => array('label' => $langs->trans("Ref"), 'checked' => '1','position' => 10), + 'b.label' => array('label' => $langs->trans("Description"), 'checked' => '1','position' => 20), + 'b.dateo' => array('label' => $langs->trans("DateOperationShort"), 'checked' => '-1','position' => 30), + 'b.datev' => array('label' => $langs->trans("DateValueShort"), 'checked' => '1','position' => 40), + 'type' => array('label' => $langs->trans("Type"), 'checked' => '1','position' => 50), + 'b.num_chq' => array('label' => $langs->trans("Numero"), 'checked' => '0','position' => 60), + 'b.fk_bordereau' => array('label' => $langs->trans("ChequeNumber"), 'checked' => '0', 'position' => 65), + 'bu.label' => array('label' => $langs->trans("ThirdParty").'/'.$langs->trans("User"), 'checked' => '1', 'position' => 70), + 'ba.ref' => array('label' => $langs->trans("BankAccount"), 'checked' => (($id > 0 || !empty($ref)) ? '0' : '1'), 'position' => 80), + 'b.debit' => array('label' => $langs->trans("Debit"), 'checked' => '1', 'position' => 90), + 'b.credit' => array('label' => $langs->trans("Credit"), 'checked' => '1', 'position' => 100), + 'balancebefore' => array('label' => $langs->trans("BalanceBefore"), 'checked' => '0', 'position' => 110), + 'balance' => array('label' => $langs->trans("Balance"), 'checked' => '1', 'position' => 120), + 'b.num_releve' => array('label' => $langs->trans("AccountStatement"), 'checked' => '1', 'position' => 130), + 'b.conciliated' => array('label' => $langs->trans("BankLineReconciled"), 'enabled' => (string) (int) $object->rappro, 'checked' => ($action == 'reconcile' ? '1' : '0'), 'position' => 140), ); // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; @@ -271,7 +271,7 @@ if ((GETPOST('confirm_savestatement', 'alpha') || GETPOST('confirm_reconcile', ' if ($row > 0) { $result = $bankline->fetch($row); $bankline->num_releve = $num_releve; // GETPOST("num_releve"); - $result = $bankline->update_conciliation($user, GETPOST("cat"), GETPOST('confirm_reconcile', 'alpha') ? 1 : 0); // If we confirm_reconcile, we set flag 'rappro' to 1. + $result = $bankline->update_conciliation($user, GETPOSTINT("cat"), GETPOST('confirm_reconcile', 'alpha') ? 1 : 0); // If we confirm_reconcile, we set flag 'rappro' to 1. if ($result < 0) { setEventMessages($bankline->error, $bankline->errors, 'errors'); $error++; @@ -391,7 +391,7 @@ if (GETPOST('save') && !$cancel && $user->hasRight('banque', 'modifier')) { if (!$error && getDolGlobalString('BANK_USE_OLD_VARIOUS_PAYMENT')) { $objecttmp = new Account($db); $objecttmp->fetch($bankaccountid); - $insertid = $objecttmp->addline($dateop, $operation, $label, $amount, $num_chq, ($cat1 > 0 ? $cat1 : 0), $user, '', '', $search_accountancy_code); + $insertid = $objecttmp->addline((int) $dateop, $operation, $label, (float) $amount, $num_chq, ($cat1 > 0 ? $cat1 : 0), $user, '', '', $search_accountancy_code); if ($insertid > 0) { setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); header("Location: ".$_SERVER['PHP_SELF'].($id ? "?id=".$id : '')); diff --git a/htdocs/compta/bank/categ.php b/htdocs/compta/bank/categ.php index bbcea2eff59..4047d14d33f 100644 --- a/htdocs/compta/bank/categ.php +++ b/htdocs/compta/bank/categ.php @@ -6,6 +6,7 @@ * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2016 Marcos García * Copyright (C) 2024 Frédéric France + * Copyright (C) 2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -80,7 +81,7 @@ if (GETPOST('add')) { if ($categid) { $bankcateg = new BankCateg($db); - if ($bankcateg->fetch($categid) > 0) { + if ($bankcateg->fetch((int) $categid) > 0) { //Update category if (GETPOST('update') && $label) { $bankcateg->label = $label; diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 66b558fb005..c9feabd8c86 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -686,7 +686,7 @@ class Account extends CommonObject $sql = "INSERT INTO ".MAIN_DB_PREFIX."category_bankline("; $sql .= "lineid, fk_categ"; $sql .= ") VALUES ("; - $sql .= ((int) $accline->id).", '".$this->db->escape($categorie)."'"; + $sql .= ((int) $accline->id).", '".$this->db->escape((string) $categorie)."'"; $sql .= ")"; $result = $this->db->query($sql); @@ -2327,7 +2327,7 @@ class AccountLine extends CommonObjectLine $sql .= ", ".(empty($this->amount_main_currency) ? "NULL" : price2num($this->amount_main_currency)); $sql .= ", ".($this->fk_user_author > 0 ? ((int) $this->fk_user_author) : "null"); $sql .= ", ".($this->num_chq ? "'".$this->db->escape($this->num_chq)."'" : "null"); - $sql .= ", '".$this->db->escape($this->fk_account)."'"; + $sql .= ", '".$this->db->escape((string) $this->fk_account)."'"; $sql .= ", '".$this->db->escape($this->fk_type)."'"; $sql .= ", ".($this->emetteur ? "'".$this->db->escape($this->emetteur)."'" : "null"); $sql .= ", ".($this->bank_chq ? "'".$this->db->escape($this->bank_chq)."'" : "null"); @@ -2364,11 +2364,11 @@ class AccountLine extends CommonObjectLine /** * Delete bank transaction record * - * @param ?User $user User object that delete + * @param User $user User object that delete * @param int<0,1> $notrigger 1=Does not execute triggers, 0= execute triggers * @return int Return integer <0 if KO, >0 if OK */ - public function delete($user = null, $notrigger = 0) + public function delete($user, $notrigger = 0) { $nbko = 0; diff --git a/htdocs/compta/bank/class/paymentvarious.class.php b/htdocs/compta/bank/class/paymentvarious.class.php index 1df290cd960..9b69a519d0e 100644 --- a/htdocs/compta/bank/class/paymentvarious.class.php +++ b/htdocs/compta/bank/class/paymentvarious.class.php @@ -259,7 +259,7 @@ class PaymentVarious extends CommonObject $sql .= " note='".$this->db->escape($this->note)."',"; $sql .= " accountancy_code='".$this->db->escape($this->accountancy_code)."',"; $sql .= " subledger_account='".$this->db->escape($this->subledger_account)."',"; - $sql .= " fk_projet='".$this->db->escape($this->fk_project)."',"; + $sql .= " fk_projet='".$this->db->escape((string) $this->fk_project)."',"; $sql .= " fk_bank=".($this->fk_bank > 0 ? $this->fk_bank : "null").","; $sql .= " fk_user_author=".(int) $this->fk_user_author.","; $sql .= " fk_user_modif=".(int) $this->fk_user_modif; @@ -509,9 +509,9 @@ class PaymentVarious extends CommonObject $sql .= " VALUES ("; $sql .= "'".$this->db->idate($this->datep)."'"; $sql .= ", '".$this->db->idate($this->datev)."'"; - $sql .= ", '".$this->db->escape($this->sens)."'"; + $sql .= ", '".$this->db->escape((string) $this->sens)."'"; $sql .= ", ".price2num($this->amount); - $sql .= ", '".$this->db->escape($this->type_payment)."'"; + $sql .= ", '".$this->db->escape((string) $this->type_payment)."'"; $sql .= ", '".$this->db->escape($this->num_payment)."'"; if ($this->note) { $sql .= ", '".$this->db->escape($this->note)."'"; @@ -552,7 +552,7 @@ class PaymentVarious extends CommonObject $bank_line_id = $acc->addline( $this->datep, - $this->type_payment, + (string) $this->type_payment, $this->label, $sign * abs($this->amount), $this->num_payment, diff --git a/htdocs/compta/bank/graph.php b/htdocs/compta/bank/graph.php index 658f55fb416..b2a93aa2d4f 100644 --- a/htdocs/compta/bank/graph.php +++ b/htdocs/compta/bank/graph.php @@ -2,7 +2,7 @@ /* Copyright (C) 2005 Rodolphe Quiedeville * Copyright (C) 2004-2010 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -793,7 +793,7 @@ if ($account) { $bankaccount = new Account($db); $listid = explode(',', $account); foreach ($listid as $key => $id) { - $bankaccount->fetch($id); + $bankaccount->fetch((int) $id); $bankaccount->label = $bankaccount->ref; print $bankaccount->getNomUrl(1); if ($key < (count($listid) - 1)) { diff --git a/htdocs/compta/bank/list.php b/htdocs/compta/bank/list.php index a6c2cb95f30..e2f1fbf5462 100644 --- a/htdocs/compta/bank/list.php +++ b/htdocs/compta/bank/list.php @@ -5,7 +5,7 @@ * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2018 Ferran Marcet * Copyright (C) 2020 Tobias Sekan - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Alexandre Spangaro * Copyright (C) 2024 Frédéric France * @@ -119,25 +119,24 @@ $fieldstosearchall = array( $checkedtypetiers = 0; $arrayfields = array( - 'b.ref' => array('label' => $langs->trans("BankAccounts"), 'checked' => 1, 'position' => 10), - 'b.label' => array('label' => $langs->trans("Label"), 'checked' => 1, 'position' => 12), - 'accountype' => array('label' => $langs->trans("Type"), 'checked' => 1, 'position' => 14), - 'b.number' => array('label' => $langs->trans("AccountIdShort"), 'checked' => 1, 'position' => 16), - 'b.account_number' => array('label' => $langs->trans("AccountAccounting"), 'checked' => (isModEnabled('accounting')), 'position' => 18), - 'b.fk_accountancy_journal' => array('label' => $langs->trans("AccountancyJournal"), 'checked' => (isModEnabled('accounting')), 'position' => 20), - 'toreconcile' => array('label' => $langs->trans("TransactionsToConciliate"), 'checked' => 1, 'position' => 50), - 'b.currency_code' => array('label' => $langs->trans("Currency"), 'checked' => 0, 'position' => 22), - 'b.datec' => array('label' => $langs->trans("DateCreation"), 'checked' => 0, 'position' => 500), - 'b.tms' => array('label' => $langs->trans("DateModificationShort"), 'checked' => 0, 'position' => 500), - 'b.clos' => array('label' => $langs->trans("Status"), 'checked' => 1, 'position' => 1000), - 'balance' => array('label' => $langs->trans("Balance"), 'checked' => 1, 'position' => 1010), + 'b.ref' => array('label' => $langs->trans("BankAccounts"), 'checked' => '1', 'position' => 10), + 'b.label' => array('label' => $langs->trans("Label"), 'checked' => '1', 'position' => 12), + 'accountype' => array('label' => $langs->trans("Type"), 'checked' => '1', 'position' => 14), + 'b.number' => array('label' => $langs->trans("AccountIdShort"), 'checked' => '1', 'position' => 16), + 'b.account_number' => array('label' => $langs->trans("AccountAccounting"), 'checked' => (string) (int) (isModEnabled('accounting')), 'position' => 18), + 'b.fk_accountancy_journal' => array('label' => $langs->trans("AccountancyJournal"), 'checked' => (string) (int) (isModEnabled('accounting')), 'position' => 20), + 'toreconcile' => array('label' => $langs->trans("TransactionsToConciliate"), 'checked' => '1', 'position' => 50), + 'b.currency_code' => array('label' => $langs->trans("Currency"), 'checked' => '0', 'position' => 22), + 'b.datec' => array('label' => $langs->trans("DateCreation"), 'checked' => '0', 'position' => 500), + 'b.tms' => array('label' => $langs->trans("DateModificationShort"), 'checked' => '0', 'position' => 500), + 'b.clos' => array('label' => $langs->trans("Status"), 'checked' => '1', 'position' => 1000), + 'balance' => array('label' => $langs->trans("Balance"), 'checked' => '1', 'position' => 1010), ); // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); -'@phan-var-force array,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan $permissiontoadd = $user->hasRight('banque', 'modifier'); $permissiontodelete = $user->hasRight('banque', 'configurer'); diff --git a/htdocs/compta/bank/releve.php b/htdocs/compta/bank/releve.php index 5c0c75649f4..0cc82044b8d 100644 --- a/htdocs/compta/bank/releve.php +++ b/htdocs/compta/bank/releve.php @@ -7,7 +7,7 @@ * Copyright (C) 2019 Nicolas ZABOURI * Copyright (C) 2022 Alexandre Spangaro * Copyright (C) 2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -77,12 +77,12 @@ $hookmanager->initHooks(array('bankaccountstatement', 'globalcard')); if ($user->hasRight('banque', 'consolidate') && $action == 'dvnext' && !empty($dvid)) { $al = new AccountLine($db); - $al->datev_next($dvid); + $al->datev_next((int) $dvid); } if ($user->hasRight('banque', 'consolidate') && $action == 'dvprev' && !empty($dvid)) { $al = new AccountLine($db); - $al->datev_previous($dvid); + $al->datev_previous((int) $dvid); } diff --git a/htdocs/compta/bank/transfer.php b/htdocs/compta/bank/transfer.php index 6150abc0cf3..e848e455bb8 100644 --- a/htdocs/compta/bank/transfer.php +++ b/htdocs/compta/bank/transfer.php @@ -8,7 +8,7 @@ * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2023 Maxime Nicolas * Copyright (C) 2023 Benjamin GREMBI - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -173,13 +173,13 @@ if ($action == 'add' && $user->hasRight('banque', 'transfer')) { } if (!$error) { - $bank_line_id_from = $tmpaccountfrom->addline($dateo[$n], $typefrom, $label[$n], price2num(-1 * (float) $amount[$n]), '', 0, $user); + $bank_line_id_from = $tmpaccountfrom->addline($dateo[$n], $typefrom, $label[$n], (float) price2num(-1 * (float) $amount[$n]), '', 0, $user); } if (!($bank_line_id_from > 0)) { $error++; } if (!$error) { - $bank_line_id_to = $tmpaccountto->addline($dateo[$n], $typeto, $label[$n], $amountto[$n], '', 0, $user); + $bank_line_id_to = $tmpaccountto->addline($dateo[$n], $typeto, $label[$n], (float) $amountto[$n], '', 0, $user); } if (!($bank_line_id_to > 0)) { $error++; diff --git a/htdocs/compta/bank/treso.php b/htdocs/compta/bank/treso.php index f632fbaf2e2..44e5556a078 100644 --- a/htdocs/compta/bank/treso.php +++ b/htdocs/compta/bank/treso.php @@ -5,7 +5,7 @@ * Copyright (C) 2015 Marcos García * Copyright (C) 2022 Alexandre Spangaro - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -299,7 +299,7 @@ if (GETPOST("account") || GETPOST("ref")) { $socialcontribstatic->ref = $tmpobj->ref; $socialcontribstatic->id = $tmpobj->objid; $socialcontribstatic->label = $tmpobj->type; - $ref = $socialcontribstatic->getNomUrl(1, 24); + $ref = $socialcontribstatic->getNomUrl(1, '24'); $totalpayment = -1 * $socialcontribstatic->getSommePaiement(); // Payment already done } diff --git a/htdocs/compta/bank/various_payment/list.php b/htdocs/compta/bank/various_payment/list.php index a1b349a7867..5700e6cfcc8 100644 --- a/htdocs/compta/bank/various_payment/list.php +++ b/htdocs/compta/bank/various_payment/list.php @@ -184,7 +184,6 @@ $arrayfields = array( ); $arrayfields = dol_sort_array($arrayfields, 'position'); -// '@phan-var-force array,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan // Security check $socid = GETPOSTINT("socid"); diff --git a/htdocs/compta/cashcontrol/cashcontrol_list.php b/htdocs/compta/cashcontrol/cashcontrol_list.php index c9b3be80649..8b48105340e 100644 --- a/htdocs/compta/cashcontrol/cashcontrol_list.php +++ b/htdocs/compta/cashcontrol/cashcontrol_list.php @@ -1,6 +1,7 @@ * Copyright (C) 2024 Frédéric France + * Copyright (C) 2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -117,8 +118,8 @@ foreach ($object->fields as $key => $val) { $visible = (int) dol_eval((string) $val['visible'], 1); $arrayfields['t.'.$key] = array( 'label'=>$val['label'], - 'checked'=>(($visible < 0) ? 0 : 1), - 'enabled'=>(abs($visible) != 3 && (bool) dol_eval($val['enabled'], 1)), + 'checked'=>(($visible < 0) ? '0' : '1'), + 'enabled'=>(string) (int) (abs($visible) != 3 && (bool) dol_eval((string) $val['enabled'], 1)), 'position'=>$val['position'], 'help'=> isset($val['help']) ? $val['help'] : '' ); @@ -595,7 +596,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) { $object->posmodule = $obj->posmodule; $object->cash = $obj->cash; - $object->cheque = $obj->cheque; + $object->cheque = (float) $obj->cheque; $object->card = $obj->card; $object->opening = $obj->opening; $object->year_close = $obj->year_close; @@ -653,13 +654,13 @@ while ($i < ($limit ? min($num, $limit) : $num)) { if (!empty($arrayfields['t.'.$key]['checked'])) { print '$key)) { - print ' title="'.dol_escape_htmltag($object->$key).'"'; + print ' title="'.dol_escape_htmltag((string) $object->$key).'"'; } print '>'; if ($key == 'status') { print $object->getLibStatut(5); } elseif ($key == 'rowid') { - print $object->showOutputField($val, $key, $object->id, ''); + print $object->showOutputField($val, $key, (string) $object->id, ''); } else { print $object->showOutputField($val, $key, $object->$key, ''); } diff --git a/htdocs/compta/charges/index.php b/htdocs/compta/charges/index.php index 76dde4ff08b..9f6e34be0be 100644 --- a/htdocs/compta/charges/index.php +++ b/htdocs/compta/charges/index.php @@ -7,7 +7,7 @@ * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2019 Nicolas ZABOURI * Copyright (C) 2021 Gauthier VERDOL - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -167,7 +167,7 @@ if (isModEnabled('tax') && $user->hasRight('tax', 'charges', 'lire')) { $sql .= ")"; } if (preg_match('/^(cs?|pct?)\./', (string) $sortfield)) { - $sql .= $db->order($sortfield, $sortorder); + $sql .= $db->order((string) $sortfield, (string) $sortorder); } //$sql.= $db->plimit($limit+1,$offset); //print $sql; @@ -311,7 +311,7 @@ if (isModEnabled('tax') && $user->hasRight('tax', 'charges', 'lire')) { $sql .= " AND pv.datev between '".$db->idate(dol_get_first_day($year, 1, false))."' AND '".$db->idate(dol_get_last_day($year, 12, false))."'"; } if (preg_match('/^(pv|ptva)\./', (string) $sortfield)) { - $sql .= $db->order($sortfield, $sortorder); + $sql .= $db->order((string) $sortfield, (string) $sortorder); } $result = $db->query($sql); @@ -466,7 +466,7 @@ while ($j < $numlt) { $sql .= " AND pv.datev between '".$db->idate(dol_get_first_day($year, 1, false))."' AND '".$db->idate(dol_get_last_day($year, 12, false))."'"; } if (preg_match('/^pv/', (string) $sortfield)) { - $sql .= $db->order($sortfield, $sortorder); + $sql .= $db->order((string) $sortfield, (string) $sortorder); } $result = $db->query($sql); diff --git a/htdocs/compta/clients.php b/htdocs/compta/clients.php index 75a4c1210e0..652d3d053c4 100644 --- a/htdocs/compta/clients.php +++ b/htdocs/compta/clients.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2007 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2024 Frédéric France + * Copyright (C) 2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -71,6 +72,7 @@ if (!$sortorder) { $sortorder = "ASC"; } +$sql = null; /* * Action */ @@ -89,7 +91,7 @@ llxHeader(); $thirdpartystatic = new Societe($db); -if ($mode == 'search') { +if ($mode == 'search' && $sql !== null) { $resql = $db->query($sql); if ($resql) { if ($db->num_rows($resql) == 1) { diff --git a/htdocs/compta/deplacement/class/deplacement.class.php b/htdocs/compta/deplacement/class/deplacement.class.php index f9be0193da3..4a63e952989 100644 --- a/htdocs/compta/deplacement/class/deplacement.class.php +++ b/htdocs/compta/deplacement/class/deplacement.class.php @@ -4,7 +4,7 @@ * Copyright (C) 2009-2012 Regis Houssin * Copyright (C) 2013 Florian Henry * Copyright (C) 2019-2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -248,7 +248,7 @@ class Deplacement extends CommonObject $sql .= " SET km = ".((float) $this->km); // This is a distance or amount $sql .= " , dated = '".$this->db->idate($this->date)."'"; $sql .= " , type = '".$this->db->escape($this->type)."'"; - $sql .= " , fk_statut = '".$this->db->escape($this->statut)."'"; + $sql .= " , fk_statut = '".$this->db->escape((string) $this->statut)."'"; $sql .= " , fk_user = ".((int) $this->fk_user); $sql .= " , fk_user_modif = ".((int) $user->id); $sql .= " , fk_soc = ".($this->socid > 0 ? $this->socid : 'null'); diff --git a/htdocs/compta/deplacement/class/deplacementstats.class.php b/htdocs/compta/deplacement/class/deplacementstats.class.php index aabb1b77f38..da2f0545ddc 100644 --- a/htdocs/compta/deplacement/class/deplacementstats.class.php +++ b/htdocs/compta/deplacement/class/deplacementstats.class.php @@ -2,7 +2,7 @@ /* Copyright (C) 2003 Rodolphe Quiedeville * Copyright (c) 2005-2008 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -140,7 +140,7 @@ class DeplacementStats extends Stats { $sql = "SELECT date_format(dated,'%m') as dm, sum(".$this->field.")"; $sql .= " FROM ".$this->from; - $sql .= " WHERE date_format(dated,'%Y') = '".$this->db->escape($year)."'"; + $sql .= " WHERE date_format(dated,'%Y') = '".$this->db->escape((string) $year)."'"; $sql .= " AND ".$this->where; $sql .= " GROUP BY dm"; $sql .= $this->db->order('dm', 'DESC'); @@ -160,7 +160,7 @@ class DeplacementStats extends Stats { $sql = "SELECT date_format(dated,'%m') as dm, avg(".$this->field.")"; $sql .= " FROM ".$this->from; - $sql .= " WHERE date_format(dated,'%Y') = '".$this->db->escape($year)."'"; + $sql .= " WHERE date_format(dated,'%Y') = '".$this->db->escape((string) $year)."'"; $sql .= " AND ".$this->where; $sql .= " GROUP BY dm"; $sql .= $this->db->order('dm', 'DESC'); diff --git a/htdocs/compta/deplacement/stats/index.php b/htdocs/compta/deplacement/stats/index.php index 46516dfa2d9..159163e27f0 100644 --- a/htdocs/compta/deplacement/stats/index.php +++ b/htdocs/compta/deplacement/stats/index.php @@ -208,7 +208,7 @@ if (!$mesg) { $px3->SetLegend($legend); $px3->SetYLabel($langs->trans("AmountAverage")); $px3->SetMaxValue($px3->GetCeilMaxValue()); - $px3->SetMinValue($px3->GetFloorMinValue()); + $px3->SetMinValue((int) $px3->GetFloorMinValue()); $px3->SetWidth($WIDTH); $px3->SetHeight($HEIGHT); $px3->SetShading(3); diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index a8c593dfc24..b82d2b6216e 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -147,7 +147,7 @@ if (empty($reshook)) { $formquestion[$i++] = array('type' => 'hidden', 'name' => $key, 'value' => GETPOST($key)); } elseif (substr($key, 0, 21) == 'multicurrency_amount_') { - $cursorfacid = substr($key, 21); + $cursorfacid = (int) substr($key, 21); $multicurrency_amounts[$cursorfacid] = price2num(GETPOST($key)); $multicurrency_totalpayment += (float) $multicurrency_amounts[$cursorfacid]; if (!empty($multicurrency_amounts[$cursorfacid])) { @@ -248,7 +248,7 @@ if (empty($reshook)) { foreach ($multicurrency_amounts as $key => $value) { // How payment is dispatched $tmpinvoice = new Facture($db); - $tmpinvoice->fetch($key); + $tmpinvoice->fetch((int) $key); if ($tmpinvoice->type == Facture::TYPE_CREDIT_NOTE) { $newvalue = price2num($value, 'MT'); $multicurrency_amounts[$key] = - abs((float) $newvalue); @@ -922,10 +922,10 @@ if ($result >= 0) { print '
'; $text = ''; if (!empty($totalpayment)) { - $text = $langs->trans('ConfirmCustomerPayment', $totalpayment, $langs->transnoentitiesnoconv("Currency".$conf->currency)); + $text = $langs->trans('ConfirmCustomerPayment', (string) $totalpayment, $langs->transnoentitiesnoconv("Currency".$conf->currency)); } if (!empty($multicurrency_totalpayment)) { - $text .= '
'.$langs->trans('ConfirmCustomerPayment', $multicurrency_totalpayment, $langs->transnoentitiesnoconv("paymentInInvoiceCurrency")); + $text .= '
'.$langs->trans('ConfirmCustomerPayment', (string) $multicurrency_totalpayment, $langs->transnoentitiesnoconv("paymentInInvoiceCurrency")); } if (GETPOST('closepaidinvoices')) { $text .= '
'.$langs->trans("AllCompletelyPayedInvoiceWillBeClosed"); diff --git a/htdocs/compta/paiement/cheque/class/remisecheque.class.php b/htdocs/compta/paiement/cheque/class/remisecheque.class.php index 33a10159f33..1a75e819617 100644 --- a/htdocs/compta/paiement/cheque/class/remisecheque.class.php +++ b/htdocs/compta/paiement/cheque/class/remisecheque.class.php @@ -771,7 +771,7 @@ class RemiseCheque extends CommonObject global $db, $user; $payment = new Paiement($db); - $payment->fetch(0, 0, $bank_id); + $payment->fetch(0, '0', $bank_id); $bankline = new AccountLine($db); $bankline->fetch($bank_id); @@ -877,16 +877,16 @@ class RemiseCheque extends CommonObject /** * Set the ref of bordereau * - * @param User $user Object user - * @param int $ref ref of bordereau - * @return int Return integer <0 if KO, >0 if OK + * @param User $user Object user + * @param int|string $ref ref of bordereau + * @return int Return integer <0 if KO, >0 if OK */ public function set_number($user, $ref) { // phpcs:enable if ($user->hasRight('banque', 'cheque')) { $sql = "UPDATE ".MAIN_DB_PREFIX."bordereau_cheque"; - $sql .= " SET ref = '".$this->db->escape($ref)."'"; + $sql .= " SET ref = '".$this->db->escape((string) $ref)."'"; $sql .= " WHERE rowid = ".((int) $this->id); dol_syslog("RemiseCheque::set_number", LOG_DEBUG); diff --git a/htdocs/compta/paiement/cheque/list.php b/htdocs/compta/paiement/cheque/list.php index 4c7fd4f35da..f0184e1ec86 100644 --- a/htdocs/compta/paiement/cheque/list.php +++ b/htdocs/compta/paiement/cheque/list.php @@ -4,7 +4,7 @@ * Copyright (C) 2009-2012 Regis Houssin * Copyright (C) 2014-2024 Alexandre Spangaro * Copyright (C) 2016 Juanjo Menent - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -94,16 +94,15 @@ foreach ($arrayofpaymentmodetomanage as $key => $val) { } $arrayfields = array( - 'bc.ref' => array('label' => "Ref", 'checked' => 1, 'position' => 10), - 'bc.type' => array('label' => "Type", 'checked' => 1, 'position' => 20), - 'bc.date_bordereau' => array('label' => "DateCreation", 'checked' => 1, 'position' => 30), - 'ba.label' => array('label' => "BankAccount", 'checked' => 1, 'position' => 40), - 'bc.nbcheque' => array('label' => "NbOfCheques", 'checked' => 1, 'position' => 50), - 'bc.amount' => array('label' => "Amount", 'checked' => 1, 'position' => 60), - 'bc.statut' => array('label' => "Status", 'checked' => 1, 'position' => 70) + 'bc.ref' => array('label' => "Ref", 'checked' => '1', 'position' => 10), + 'bc.type' => array('label' => "Type", 'checked' => '1', 'position' => 20), + 'bc.date_bordereau' => array('label' => "DateCreation", 'checked' => '1', 'position' => 30), + 'ba.label' => array('label' => "BankAccount", 'checked' => '1', 'position' => 40), + 'bc.nbcheque' => array('label' => "NbOfCheques", 'checked' => '1', 'position' => 50), + 'bc.amount' => array('label' => "Amount", 'checked' => '1', 'position' => 60), + 'bc.statut' => array('label' => "Status", 'checked' => '1', 'position' => 70) ); $arrayfields = dol_sort_array($arrayfields, 'position'); -'@phan-var-force array,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan // Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context $hookmanager->initHooks(array('chequelist')); diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index f21b81f9fa0..4761663e644 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -13,7 +13,7 @@ * Copyright (C) 2021 OpenDsi * Copyright (C) 2023 Joachim Kueter * Copyright (C) 2023 Sylvain Legrand - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -74,7 +74,7 @@ class Paiement extends CommonObject public $datepaye; /** - * @var int|string same than $datepaye + * @var int|string same than `$datepaye` */ public $date; @@ -153,7 +153,7 @@ class Paiement extends CommonObject public $type_label; /** - * @var string Type of payment code (seems duplicate with $paiementcode); + * @var string Type of payment code (seems duplicate with); */ public $type_code; @@ -852,7 +852,7 @@ class Paiement extends CommonObject $accountancycode, 0, '', - $totalamount_main_currency + (float) $totalamount_main_currency ); // Mise a jour fk_bank dans llx_paiement @@ -895,7 +895,7 @@ class Paiement extends CommonObject $bank_line_id, $fac->thirdparty->id, DOL_URL_ROOT.'/comm/card.php?socid=', - $fac->thirdparty->name, + (string) $fac->thirdparty->name, 'company' ); if ($result <= 0) { @@ -913,7 +913,7 @@ class Paiement extends CommonObject $bank_line_id, $fac->thirdparty->id, DOL_URL_ROOT.'/fourn/card.php?socid=', - $fac->thirdparty->name, + (string) $fac->thirdparty->name, 'company' ); if ($result <= 0) { diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index fd5c5b20799..7e1ac51ed93 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -9,7 +9,7 @@ * Copyright (C) 2018-2021 Ferran Marcet * Copyright (C) 2018 Charlene Benke * Copyright (C) 2020 Tobias Sekan - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -111,19 +111,18 @@ $fieldstosearchall = array( ); $arrayfields = array( - 'p.ref' => array('label' => "RefPayment", 'checked' => 1, 'position' => 10), - 'p.datep' => array('label' => "Date", 'checked' => 1, 'position' => 20), - 's.nom' => array('label' => "ThirdParty", 'checked' => 1, 'position' => 30), - 'c.libelle' => array('label' => "Type", 'checked' => 1, 'position' => 40), - 'transaction' => array('label' => "BankTransactionLine", 'checked' => 1, 'position' => 50, 'enabled' => (isModEnabled("bank"))), - 'ba.label' => array('label' => "BankAccount", 'checked' => 1, 'position' => 60, 'enabled' => (isModEnabled("bank"))), - 'p.num_paiement' => array('label' => "Numero", 'checked' => 1, 'position' => 70, 'tooltip' => "ChequeOrTransferNumber"), - 'p.amount' => array('label' => "Amount", 'checked' => 1, 'position' => 80), - 'p.note' => array('label' => "Comment", 'checked' => -1, 'position' => 85), - 'p.statut' => array('label' => "Status", 'checked' => 1, 'position' => 90, 'enabled' => (getDolGlobalString('BILL_ADD_PAYMENT_VALIDATION'))), + 'p.ref' => array('label' => "RefPayment", 'checked' => '1', 'position' => 10), + 'p.datep' => array('label' => "Date", 'checked' => '1', 'position' => 20), + 's.nom' => array('label' => "ThirdParty", 'checked' => '1', 'position' => 30), + 'c.libelle' => array('label' => "Type", 'checked' => '1', 'position' => 40), + 'transaction' => array('label' => "BankTransactionLine", 'checked' => '1', 'position' => 50, 'enabled' => (string) (int) (isModEnabled("bank"))), + 'ba.label' => array('label' => "BankAccount", 'checked' => '1', 'position' => 60, 'enabled' => (string) (int) (isModEnabled("bank"))), + 'p.num_paiement' => array('label' => "Numero", 'checked' => '1', 'position' => 70, 'tooltip' => "ChequeOrTransferNumber"), + 'p.amount' => array('label' => "Amount", 'checked' => '1', 'position' => 80), + 'p.note' => array('label' => "Comment", 'checked' => '-1', 'position' => 85), + 'p.statut' => array('label' => "Status", 'checked' => '1', 'position' => 90, 'enabled' => (getDolGlobalString('BILL_ADD_PAYMENT_VALIDATION'))), ); $arrayfields = dol_sort_array($arrayfields, 'position'); -'@phan-var-force array,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan // Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context $hookmanager->initHooks(array('paymentlist')); diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index c1fd906ff66..10b15bd0653 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -1543,11 +1543,11 @@ class BonPrelevement extends CommonObject /** * Get object and lines from database * - * @param ?User $user Object user that delete + * @param User $user Object user that delete * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int >0 if OK, <0 if KO */ - public function delete($user = null, $notrigger = 0) + public function delete($user, $notrigger = 0) { $this->db->begin(); diff --git a/htdocs/compta/prelevement/class/rejetprelevement.class.php b/htdocs/compta/prelevement/class/rejetprelevement.class.php index 41c80211eb0..65210e1c0f6 100644 --- a/htdocs/compta/prelevement/class/rejetprelevement.class.php +++ b/htdocs/compta/prelevement/class/rejetprelevement.class.php @@ -4,7 +4,7 @@ * Copyright (C) 2010-2013 Juanjo Menent * Copyright (C) 2021 OpenDsi * Copyright (C) 2024 Laurent Destailleur - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -114,7 +114,7 @@ class RejetPrelevement * * @param User $user User object * @param int $id Id - * @param string $motif Motif + * @param int $motif Motif * @param int $date_rejet Date reject * @param int $bonid Bon id * @param int<0,1> $facturation 1=Bill the reject @@ -131,7 +131,7 @@ class RejetPrelevement dol_syslog("RejetPrelevement::Create id ".$id); - $bankaccount = ($this->type == 'bank-transfer' ? getDolGlobalString('PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT') : getDolGlobalString('PRELEVEMENT_ID_BANKACCOUNT')); + $bankaccount = ($this->type == 'bank-transfer' ? getDolGlobalInt('PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT') : getDolGlobalInt('PRELEVEMENT_ID_BANKACCOUNT')); $facs = $this->getListInvoices(1); require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/ligneprelevement.class.php'; @@ -317,7 +317,7 @@ class RejetPrelevement * Retrieve the list of invoices * * @param int<0,1> $amounts If you want to get the amount of the order for each invoice - + * * @return array Array List of invoices related to the withdrawal line * @todo A withdrawal line is today linked to one and only one invoice. So the function should return only one object ? */ diff --git a/htdocs/compta/prelevement/demandes.php b/htdocs/compta/prelevement/demandes.php index 3b16804da9f..5279fea4de5 100644 --- a/htdocs/compta/prelevement/demandes.php +++ b/htdocs/compta/prelevement/demandes.php @@ -4,7 +4,7 @@ * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2011-2012 Juanjo Menent * Copyright (C) 2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -315,7 +315,7 @@ $userstatic = new User($db); $salarystatic = new Salary($db); $i = 0; -while ($i < min($num, $limit)) { +while ($i < min($num, $limit) && $resql !== null) { $obj = $db->fetch_object($resql); if (empty($obj)) { break; // Should not happen diff --git a/htdocs/compta/prelevement/line.php b/htdocs/compta/prelevement/line.php index e6637617ab1..000f29b62c8 100644 --- a/htdocs/compta/prelevement/line.php +++ b/htdocs/compta/prelevement/line.php @@ -4,7 +4,7 @@ * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2010-2013 Juanjo Menent * Copyright (C) 2018-2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -118,7 +118,7 @@ if ($action == 'confirm_rejet' && $permissiontoadd) { if ($lipre->fetch($id) == 0) { $rej = new RejetPrelevement($db, $user, $type); - $result = $rej->create($user, $id, GETPOSTINT('motif'), $daterej, $lipre->bon_rowid, GETPOSTINT('facturer')); + $result = $rej->create($user, $id, GETPOSTINT('motif'), (int) $daterej, $lipre->bon_rowid, GETPOSTINT('facturer')); if ($result > 0) { header("Location: line.php?id=".urlencode((string) ($id)).'&type='.urlencode((string) ($type))); diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index f7da72fa53d..e42e7ad1a29 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -10,7 +10,7 @@ * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2020 Maxime DEMAREST * Copyright (C) 2021 Alexandre Spangaro - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -383,7 +383,7 @@ if ($modecompta == 'BOOKKEEPING') { $cpts = $AccCat->getCptsCat(0, $tmppredefinedgroupwhere); foreach ($cpts as $j => $cpt) { - $return = $AccCat->getSumDebitCredit($cpt['account_number'], $date_start, $date_end, (empty($cpt['dc']) ? 0 : $cpt['dc'])); + $return = $AccCat->getSumDebitCredit((int) $cpt['account_number'], $date_start, $date_end, (empty($cpt['dc']) ? 0 : $cpt['dc'])); if ($return < 0) { setEventMessages(null, $AccCat->errors, 'errors'); $resultN = 0; diff --git a/htdocs/compta/resultat/result.php b/htdocs/compta/resultat/result.php index 9a0c75af9f3..1c4c360289e 100644 --- a/htdocs/compta/resultat/result.php +++ b/htdocs/compta/resultat/result.php @@ -3,7 +3,7 @@ * Copyright (C) 2016-2022 Alexandre Spangaro * Copyright (C) 2018-2020 Laurent Destailleur * Copyright (C) 2018-2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -491,7 +491,7 @@ if ($modecompta == 'CREANCES-DETTES') { } // Set $cpts with array of accounts in the category/group - $cpts = $AccCat->getCptsCat($cat['rowid']); + $cpts = $AccCat->getCptsCat((int) $cat['rowid']); // We should loop over empty $cpts array, else the category _code_ is used in the formula, which leads to wrong result if the code is a number. if (empty($cpts)) { $cpts[] = array(); @@ -546,7 +546,7 @@ if ($modecompta == 'CREANCES-DETTES') { //var_dump($monthtoprocess.'_'.$yeartoprocess); if (isset($cpt['account_number'])) { - $return = $AccCat->getSumDebitCredit($cpt['account_number'], $date_start, $date_end, empty($cat['dc']) ? 0 : $cat['dc'], 'nofilter', $monthtoprocess, $yeartoprocess); + $return = $AccCat->getSumDebitCredit((int) $cpt['account_number'], $date_start, $date_end, empty($cat['dc']) ? 0 : $cat['dc'], 'nofilter', $monthtoprocess, $yeartoprocess); if ($return < 0) { setEventMessages(null, $AccCat->errors, 'errors'); $resultM = 0; diff --git a/htdocs/compta/sociales/list.php b/htdocs/compta/sociales/list.php index 486cad41f69..6d080da7143 100644 --- a/htdocs/compta/sociales/list.php +++ b/htdocs/compta/sociales/list.php @@ -7,7 +7,7 @@ * Copyright (C) 2020 Tobias Sekan * Copyright (C) 2021 Gauthier VERDOL * Copyright (C) 2021-2024 Alexandre Spangaro - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -106,16 +106,16 @@ if (!$sortorder) { $filtre = GETPOSTINT("filtre"); $arrayfields = array( - 'cs.rowid' => array('label' => "Ref", 'checked' => 1, 'position' => 10), - 'cs.libelle' => array('label' => "Label", 'checked' => 1, 'position' => 20), - 'cs.fk_type' => array('label' => "Type", 'checked' => 1, 'position' => 30), - 'cs.date_ech' => array('label' => "Date", 'checked' => 1, 'position' => 40), - 'cs.periode' => array('label' => "PeriodEndDate", 'checked' => 1, 'position' => 50), - 'p.ref' => array('label' => "ProjectRef", 'checked' => 1, 'position' => 60, 'enabled' => (isModEnabled('project'))), - 'cs.fk_user' => array('label' => "Employee", 'checked' => 1, 'position' => 70), - 'cs.fk_mode_reglement' => array('checked' => -1, 'position' => 80, 'label' => "DefaultPaymentMode"), - 'cs.amount' => array('label' => "Amount", 'checked' => 1, 'position' => 100), - 'cs.paye' => array('label' => "Status", 'checked' => 1, 'position' => 110), + 'cs.rowid' => array('label' => "Ref", 'checked' => '1', 'position' => 10), + 'cs.libelle' => array('label' => "Label", 'checked' => '1', 'position' => 20), + 'cs.fk_type' => array('label' => "Type", 'checked' => '1', 'position' => 30), + 'cs.date_ech' => array('label' => "Date", 'checked' => '1', 'position' => 40), + 'cs.periode' => array('label' => "PeriodEndDate", 'checked' => '1', 'position' => 50), + 'p.ref' => array('label' => "ProjectRef", 'checked' => '1', 'position' => 60, 'enabled' => (string) (int) (isModEnabled('project'))), + 'cs.fk_user' => array('label' => "Employee", 'checked' => '1', 'position' => 70), + 'cs.fk_mode_reglement' => array('checked' => '-1', 'position' => 80, 'label' => "DefaultPaymentMode"), + 'cs.amount' => array('label' => "Amount", 'checked' => '1', 'position' => 100), + 'cs.paye' => array('label' => "Status", 'checked' => '1', 'position' => 110), ); if (isModEnabled("bank")) { @@ -123,7 +123,6 @@ if (isModEnabled("bank")) { } $arrayfields = dol_sort_array($arrayfields, 'position'); -'@phan-var-force array,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan // Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context $hookmanager->initHooks(array('sclist')); @@ -484,7 +483,7 @@ if (!empty($arrayfields['cs.rowid']['checked'])) { // Filter: Type if (!empty($arrayfields['cs.fk_type']['checked'])) { print '
'; - $formsocialcontrib->select_type_socialcontrib($search_typeid, 'search_typeid', 1, 0, 0, 'maxwidth150', 1); + $formsocialcontrib->select_type_socialcontrib((int) $search_typeid, 'search_typeid', 1, 0, 0, 'maxwidth150', 1); print ''.Form::selectarray('search_stockable_product', $array, $search_stockable_product).'