diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index 2252487db5785..48e5c9f8c08bf 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -2050,11 +2050,6 @@ parameters: count: 1 path: ../../htdocs/blockedlog/admin/blockedlog_list.php - - - message: "#^Parameter \\#1 \\$objtoshow of function formatObject expects object, array given\\.$#" - count: 1 - path: ../../htdocs/blockedlog/ajax/block-info.php - - message: "#^Dead catch \\- Exception is never thrown in the try block\\.$#" count: 1 @@ -2355,6 +2350,11 @@ parameters: count: 1 path: ../../htdocs/bookcal/availabilities_document.php + - + message: "#^Empty array passed to foreach\\.$#" + count: 1 + path: ../../htdocs/bookcal/availabilities_list.php + - message: "#^If condition is always false\\.$#" count: 1 @@ -2475,6 +2475,11 @@ parameters: count: 1 path: ../../htdocs/bookcal/calendar_document.php + - + message: "#^Empty array passed to foreach\\.$#" + count: 1 + path: ../../htdocs/bookcal/calendar_list.php + - message: "#^If condition is always false\\.$#" count: 1 @@ -3130,11 +3135,6 @@ parameters: count: 1 path: ../../htdocs/comm/mailing/cibles.php - - - message: "#^Variable \\$mesgs might not be defined\\.$#" - count: 1 - path: ../../htdocs/comm/mailing/cibles.php - - message: "#^Negated boolean expression is always true\\.$#" count: 2 @@ -3835,36 +3835,16 @@ parameters: count: 1 path: ../../htdocs/commande/list_det.php - - - message: "#^Variable \\$oldref might not be defined\\.$#" - count: 1 - path: ../../htdocs/commande/list_det.php - - message: "#^Variable \\$permissiontoadd might not be defined\\.$#" count: 1 path: ../../htdocs/commande/list_det.php - - - message: "#^Variable \\$permissiontoread might not be defined\\.$#" - count: 1 - path: ../../htdocs/commande/list_det.php - - message: "#^Variable \\$searchCategoryProductOperator might not be defined\\.$#" count: 3 path: ../../htdocs/commande/list_det.php - - - message: "#^Variable \\$search_product_category_array might not be defined\\.$#" - count: 2 - path: ../../htdocs/commande/list_det.php - - - - message: "#^Variable \\$text_icon might not be defined\\.$#" - count: 1 - path: ../../htdocs/commande/list_det.php - - message: "#^If condition is always false\\.$#" count: 1 @@ -3910,16 +3890,6 @@ parameters: count: 2 path: ../../htdocs/compta/bank/account_statement_document.php - - - message: "#^Variable \\$max might not be defined\\.$#" - count: 1 - path: ../../htdocs/compta/bank/annuel.php - - - - message: "#^Variable \\$min might not be defined\\.$#" - count: 1 - path: ../../htdocs/compta/bank/annuel.php - - message: "#^If condition is always false\\.$#" count: 2 @@ -3945,21 +3915,6 @@ parameters: count: 1 path: ../../htdocs/compta/bank/bankentries_list.php - - - message: "#^Variable \\$numr might not be defined\\.$#" - count: 1 - path: ../../htdocs/compta/bank/bankentries_list.php - - - - message: "#^Variable \\$css might not be defined\\.$#" - count: 1 - path: ../../htdocs/compta/bank/card.php - - - - message: "#^Variable \\$name might not be defined\\.$#" - count: 4 - path: ../../htdocs/compta/bank/card.php - - message: "#^Variable \\$noback in empty\\(\\) always exists and is always falsy\\.$#" count: 1 @@ -4080,36 +4035,6 @@ parameters: count: 3 path: ../../htdocs/compta/bank/graph.php - - - message: "#^Variable \\$morehtml might not be defined\\.$#" - count: 1 - path: ../../htdocs/compta/bank/graph.php - - - - message: "#^Variable \\$show1 might not be defined\\.$#" - count: 1 - path: ../../htdocs/compta/bank/graph.php - - - - message: "#^Variable \\$show2 might not be defined\\.$#" - count: 1 - path: ../../htdocs/compta/bank/graph.php - - - - message: "#^Variable \\$show3 might not be defined\\.$#" - count: 1 - path: ../../htdocs/compta/bank/graph.php - - - - message: "#^Variable \\$show4 might not be defined\\.$#" - count: 1 - path: ../../htdocs/compta/bank/graph.php - - - - message: "#^Variable \\$show5 might not be defined\\.$#" - count: 1 - path: ../../htdocs/compta/bank/graph.php - - message: "#^Right side of && is always true\\.$#" count: 2 @@ -4170,11 +4095,6 @@ parameters: count: 1 path: ../../htdocs/compta/bank/releve.php - - - message: "#^Variable \\$total might not be defined\\.$#" - count: 3 - path: ../../htdocs/compta/bank/releve.php - - message: "#^Negated boolean expression is always true\\.$#" count: 1 @@ -4215,11 +4135,6 @@ parameters: count: 1 path: ../../htdocs/compta/bank/various_payment/card.php - - - message: "#^Variable \\$formproject might not be defined\\.$#" - count: 1 - path: ../../htdocs/compta/bank/various_payment/card.php - - message: "#^Variable \\$ref might not be defined\\.$#" count: 1 diff --git a/dev/tools/phan/baseline.txt b/dev/tools/phan/baseline.txt index eec86c9aaf528..17ec6e02e8b60 100644 --- a/dev/tools/phan/baseline.txt +++ b/dev/tools/phan/baseline.txt @@ -10,11 +10,11 @@ return [ // # Issue statistics: // PhanUndeclaredProperty : 560+ occurrences - // PhanPossiblyUndeclaredGlobalVariable : 520+ occurrences - // PhanUndeclaredGlobalVariable : 350+ occurrences - // PhanTypeMismatchArgumentProbablyReal : 310+ occurrences + // PhanPossiblyUndeclaredGlobalVariable : 500+ occurrences + // PhanUndeclaredGlobalVariable : 340+ occurrences + // PhanTypeMismatchArgumentProbablyReal : 270+ occurrences // PhanPluginUnknownArrayMethodReturnType : 180+ occurrences - // PhanTypeMismatchProperty : 160+ occurrences + // PhanTypeMismatchProperty : 140+ occurrences // PhanPluginUnknownPropertyType : 130+ occurrences // PhanPluginUnknownArrayMethodParamType : 120+ occurrences // PhanPossiblyUndeclaredVariable : 110+ occurrences @@ -22,9 +22,9 @@ return [ // PhanRedefineFunction : 45+ occurrences // PhanTypeExpectedObjectPropAccess : 45+ occurrences // PhanTypeMismatchArgumentNullableInternal : 45+ occurrences - // PhanTypeMismatchDimFetch : 40+ occurrences - // PhanPluginEmptyStatementIf : 35+ occurrences // PhanTypeInvalidDimOffset : 35+ occurrences + // PhanPluginEmptyStatementIf : 30+ occurrences + // PhanTypeMismatchDimFetch : 30+ occurrences // PhanUndeclaredConstant : 15+ occurrences // PhanEmptyForeach : 10+ occurrences // PhanPluginUnknownObjectMethodCall : 10+ occurrences @@ -62,51 +62,34 @@ return [ 'htdocs/api/class/api_login.class.php' => ['PhanPluginUnknownArrayMethodReturnType'], 'htdocs/api/class/api_setup.class.php' => ['PhanPluginUnknownArrayMethodReturnType'], 'htdocs/api/class/api_status.class.php' => ['PhanPluginUnknownArrayMethodReturnType'], - 'htdocs/asset/admin/setup.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/asset/class/asset.class.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanTypeInvalidDimOffset'], 'htdocs/asset/class/assetdepreciationoptions.class.php' => ['PhanTypeInvalidDimOffset'], 'htdocs/asset/class/assetmodel.class.php' => ['PhanUndeclaredProperty'], - 'htdocs/asset/depreciation.php' => ['PhanPluginEmptyStatementIf'], - 'htdocs/asset/disposal.php' => ['PhanPluginEmptyStatementIf'], - 'htdocs/asset/list.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/asset/model/list.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/asset/tpl/accountancy_codes_edit.tpl.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/asset/tpl/depreciation_options_edit.tpl.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], 'htdocs/asset/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'], 'htdocs/asterisk/wrapper.php' => ['PhanRedefineFunction'], - 'htdocs/barcode/printsheet.php' => ['PhanPluginDuplicateExpressionBinaryOp', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/blockedlog/ajax/block-info.php' => ['PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/barcode/printsheet.php' => ['PhanPluginDuplicateExpressionBinaryOp'], 'htdocs/bom/bom_card.php' => ['PhanUndeclaredProperty'], - 'htdocs/bom/bom_list.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/bom/class/api_boms.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], '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' => ['PhanPluginUndeclaredVariableIsset', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/bookcal/calendar_card.php' => ['PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], - 'htdocs/bookcal/calendar_list.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/bookcal/class/availabilities.class.php' => ['PhanUndeclaredMethod', 'PhanUndeclaredProperty'], 'htdocs/bookcal/class/calendar.class.php' => ['PhanUndeclaredMethod', 'PhanUndeclaredProperty'], 'htdocs/categories/class/api_categories.class.php' => ['PhanAccessMethodProtected', 'PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], - 'htdocs/categories/class/categorie.class.php' => ['PhanTypeMismatchProperty'], - 'htdocs/categories/edit.php' => ['PhanTypeMismatchDimFetch'], - 'htdocs/categories/index.php' => ['PhanTypeMismatchDimFetch'], - 'htdocs/categories/info.php' => ['PhanTypeMismatchDimFetch'], - 'htdocs/categories/photos.php' => ['PhanTypeMismatchDimFetch'], - 'htdocs/categories/traduction.php' => ['PhanTypeMismatchDimFetch'], - 'htdocs/categories/viewcat.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchDimFetch', 'PhanUndeclaredProperty'], + 'htdocs/categories/viewcat.php' => ['PhanUndeclaredProperty'], 'htdocs/collab/index.php' => ['PhanParamTooMany', 'PhanUndeclaredProperty'], - 'htdocs/comm/action/card.php' => ['PhanPluginBothLiteralsBinaryOp', 'PhanPluginEmptyStatementIf', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/comm/action/card.php' => ['PhanPluginBothLiteralsBinaryOp'], 'htdocs/comm/action/class/api_agendaevents.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanTypeMismatchProperty'], 'htdocs/comm/action/class/cactioncomm.class.php' => ['PhanPluginUnknownArrayPropertyType'], - 'htdocs/comm/action/document.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/comm/action/index.php' => ['PhanPluginEmptyStatementIf', 'PhanTypeMismatchDimFetch', 'PhanTypeMismatchProperty'], + 'htdocs/comm/action/index.php' => ['PhanTypeMismatchDimFetch', 'PhanTypeMismatchProperty'], 'htdocs/comm/action/info.php' => ['PhanUndeclaredProperty'], - 'htdocs/comm/action/list.php' => ['PhanTypeMismatchProperty'], 'htdocs/comm/action/pertype.php' => ['PhanTypeComparisonFromArray', 'PhanTypeExpectedObjectPropAccess', 'PhanTypeMismatchDimFetch'], 'htdocs/comm/action/peruser.php' => ['PhanTypeComparisonFromArray'], 'htdocs/comm/mailing/card.php' => ['PhanPluginSuspiciousParamPosition'], - 'htdocs/comm/mailing/cibles.php' => ['PhanUndeclaredGlobalVariable', 'PhanUndeclaredMethod', 'PhanUndeclaredProperty'], + 'htdocs/comm/mailing/cibles.php' => ['PhanUndeclaredProperty'], 'htdocs/comm/mailing/index.php' => ['PhanUndeclaredProperty'], 'htdocs/comm/propal/card.php' => ['PhanTypeMismatchProperty'], 'htdocs/comm/propal/class/api_proposals.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], @@ -116,21 +99,13 @@ return [ 'htdocs/commande/class/commande.class.php' => ['PhanUndeclaredProperty'], 'htdocs/commande/customer.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/commande/list.php' => ['PhanUndeclaredProperty'], - 'htdocs/commande/list_det.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeInvalidDimOffset', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/commande/list_det.php' => ['PhanTypeInvalidDimOffset'], 'htdocs/commande/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'], - 'htdocs/compta/accounting-files.php' => ['PhanTypeMismatchDimFetch', 'PhanTypeMismatchProperty'], 'htdocs/compta/bank/account_statement_document.php' => ['PhanUndeclaredGlobalVariable'], - 'htdocs/compta/bank/annuel.php' => ['PhanPossiblyUndeclaredGlobalVariable'], - 'htdocs/compta/bank/bankentries_list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/compta/bank/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/compta/bank/class/account.class.php' => ['PhanUndeclaredProperty'], 'htdocs/compta/bank/class/api_bankaccounts.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/compta/bank/graph.php' => ['PhanPossiblyUndeclaredGlobalVariable'], - 'htdocs/compta/bank/line.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], - 'htdocs/compta/bank/releve.php' => ['PhanPossiblyUndeclaredGlobalVariable'], - 'htdocs/compta/bank/transfer.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/compta/bank/treso.php' => ['PhanTypeMismatchProperty'], - 'htdocs/compta/bank/various_payment/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], + 'htdocs/compta/bank/line.php' => ['PhanUndeclaredGlobalVariable'], + 'htdocs/compta/bank/various_payment/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/compta/bank/various_payment/document.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/compta/bank/various_payment/info.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/compta/bank/various_payment/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchProperty'], @@ -374,7 +349,6 @@ return [ 'htdocs/don/payment/card.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/don/payment/payment.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/don/tpl/linkedobjectblock.tpl.php' => ['PhanPossiblyUndeclaredGlobalVariable'], - 'htdocs/ecm/class/ecmdirectory.class.php' => ['PhanTypeMismatchProperty'], 'htdocs/ecm/dir_card.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/ecm/index.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/emailcollector/class/emailcollector.class.php' => ['PhanUndeclaredProperty'], @@ -404,7 +378,7 @@ return [ 'htdocs/expensereport/tpl/expensereport_linktofile.tpl.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/expensereport/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'], 'htdocs/externalsite/frames.php' => ['PhanUndeclaredGlobalVariable'], - 'htdocs/fichinter/card-rec.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], + 'htdocs/fichinter/card-rec.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/fichinter/class/api_interventions.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanUndeclaredProperty'], 'htdocs/fichinter/class/fichinterrec.class.php' => ['PhanUndeclaredProperty'], 'htdocs/fichinter/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], @@ -637,7 +611,6 @@ return [ 'htdocs/supplier_proposal/class/api_supplier_proposals.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanUndeclaredProperty'], 'htdocs/supplier_proposal/class/supplier_proposal.class.php' => ['PhanUndeclaredProperty'], 'htdocs/supplier_proposal/list.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/takepos/admin/orderprinters.php' => ['PhanTypeMismatchDimFetch'], 'htdocs/takepos/ajax/ajax.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], 'htdocs/takepos/floors.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/takepos/freezone.php' => ['PhanTypeMismatchArgumentProbablyReal'], diff --git a/dev/tools/phan/config_extended.php b/dev/tools/phan/config_extended.php index 226ee55c444a2..0d0abaa19b8b2 100644 --- a/dev/tools/phan/config_extended.php +++ b/dev/tools/phan/config_extended.php @@ -67,7 +67,7 @@ 'PhanCompatibleNegativeStringOffset', // return false positive 'PhanPluginConstantVariableBool', // a lot of false positive, in most cases, we want to keep the code as it is // 'PhanPluginUnknownArrayPropertyType', // Helps find missing array keys or mismatches, remaining occurrences are likely unused properties - // 'PhanTypeArraySuspiciousNullable', // All fixed. + 'PhanTypeArraySuspiciousNullable', // About 400 cases // 'PhanTypeInvalidDimOffset', // Helps identify missing array indexes in types or reference to unset indexes 'PhanTypeObjectUnsetDeclaredProperty', 'PhanTypePossiblyInvalidDimOffset', // a lot of false positive, in most cases, we want to keep the code as it is diff --git a/htdocs/asset/admin/setup.php b/htdocs/asset/admin/setup.php index 42deaac7c71d2..963f783731406 100644 --- a/htdocs/asset/admin/setup.php +++ b/htdocs/asset/admin/setup.php @@ -542,7 +542,7 @@ if (isModEnabled('accounting')) { require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php'; $formaccounting = new FormAccounting($db); - print $formaccounting->select_account($selected, $constname, 1, null, 1, 1, 'minwidth150 maxwidth300', 1); + print $formaccounting->select_account($selected, $constname, 1, array(), 1, 1, 'minwidth150 maxwidth300', 1); } else { print ''; } diff --git a/htdocs/asset/depreciation.php b/htdocs/asset/depreciation.php index bc448c098e617..76e0aba71fe0b 100644 --- a/htdocs/asset/depreciation.php +++ b/htdocs/asset/depreciation.php @@ -96,8 +96,11 @@ if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } + +/* if (empty($reshook)) { } +*/ /* diff --git a/htdocs/asset/disposal.php b/htdocs/asset/disposal.php index fe6101d034f10..4d97ffc353bd0 100644 --- a/htdocs/asset/disposal.php +++ b/htdocs/asset/disposal.php @@ -2,6 +2,7 @@ /* Copyright (C) 2007-2017 Laurent Destailleur * Copyright (C) 2018 Alexandre Spangaro * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -86,8 +87,10 @@ if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } +/* if (empty($reshook)) { } +*/ /* diff --git a/htdocs/asset/list.php b/htdocs/asset/list.php index 55fc1683cc185..649f436b2e018 100644 --- a/htdocs/asset/list.php +++ b/htdocs/asset/list.php @@ -3,6 +3,7 @@ * Copyright (C) 2018-2024 Alexandre Spangaro * Copyright (C) 2018 Ferran Marcet * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -116,11 +117,11 @@ if (!empty($val['visible'])) { $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)), - 'position'=>$val['position'], - 'help'=> isset($val['help']) ? $val['help'] : '' + 'label' => $val['label'], + 'checked' => (($visible < 0) ? 0 : 1), + 'enabled' => (abs($visible) != 3 && (bool) dol_eval($val['enabled'], 1)), + 'position' => $val['position'], + 'help' => isset($val['help']) ? $val['help'] : '' ); } } @@ -143,7 +144,8 @@ if ($user->socid > 0) { accessforbidden(); } -$socid = 0; if ($user->socid > 0) { +$socid = 0; +if ($user->socid > 0) { $socid = $user->socid; } $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); @@ -498,7 +500,7 @@ } elseif ($key == 'lang') { require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; $formadmin = new FormAdmin($db); - print $formadmin->select_language($search[$key], 'search_lang', 0, null, 1, 0, 0, 'minwidth100imp maxwidth125', 2); + print $formadmin->select_language($search[$key], 'search_lang', 0, array(), 1, 0, 0, 'minwidth100imp maxwidth125', 2); } else { print ''; } @@ -509,7 +511,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; // Fields from hook -$parameters = array('arrayfields'=>$arrayfields); +$parameters = array('arrayfields' => $arrayfields); $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column @@ -541,7 +543,7 @@ // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields -$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); +$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder); $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column @@ -625,7 +627,7 @@ // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); + $parameters = array('arrayfields' => $arrayfields, 'object' => $object, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray); $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column @@ -664,7 +666,7 @@ $db->free($resql); -$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql); +$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql); $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; diff --git a/htdocs/asset/model/list.php b/htdocs/asset/model/list.php index 13c8c77331089..762a5122d7550 100644 --- a/htdocs/asset/model/list.php +++ b/htdocs/asset/model/list.php @@ -495,7 +495,7 @@ print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', 'maxwidth125', 1); } elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) { print '
'; - print $form->selectDate($search[$key.'_dtstart'] ? $search[$key.'_dtstart'] : '', "search_".$key."_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); + $form->selectDate($search[$key.'_dtstart'] ? $search[$key.'_dtstart'] : '', "search_".$key."_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); print '
'; print '
'; print $form->selectDate($search[$key.'_dtend'] ? $search[$key.'_dtend'] : '', "search_".$key."_dtend", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); @@ -503,7 +503,7 @@ } elseif ($key == 'lang') { require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; $formadmin = new FormAdmin($db); - print $formadmin->select_language($search[$key], 'search_lang', 0, null, 1, 0, 0, 'minwidth100imp maxwidth125', 2); + print $formadmin->select_language($search[$key], 'search_lang', 0, array(), 1, 0, 0, 'minwidth100imp maxwidth125', 2); } else { print ''; } diff --git a/htdocs/barcode/printsheet.php b/htdocs/barcode/printsheet.php index 541ea6fc52e04..ba3c994fcf7ce 100644 --- a/htdocs/barcode/printsheet.php +++ b/htdocs/barcode/printsheet.php @@ -441,7 +441,7 @@ function init_gendoc_button() print ''; print '
'; print '
'; - $form->select_produits(GETPOSTINT('productid'), 'productid', '', '', 0, -1, 2, '', 0, array(), 0, '1', 0, 'minwidth400imp', 1); + $form->select_produits(GETPOSTINT('productid'), 'productid', '', 0, 0, -1, 2, '', 0, array(), 0, '1', 0, 'minwidth400imp', 1); print '   '; print '
'; } diff --git a/htdocs/blockedlog/ajax/block-info.php b/htdocs/blockedlog/ajax/block-info.php index 9f32aec003c33..31394eeb53594 100644 --- a/htdocs/blockedlog/ajax/block-info.php +++ b/htdocs/blockedlog/ajax/block-info.php @@ -2,6 +2,7 @@ /* Copyright (C) 2017 Laurent Destailleur * Copyright (C) 2017 ATM Consulting * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -85,7 +86,7 @@ /** * formatObject * - * @param Object $objtoshow Object to show + * @param Object|array $objtoshow Object to show * @param string $prefix Prefix of key * @return string String formatted */ diff --git a/htdocs/bom/bom_list.php b/htdocs/bom/bom_list.php index 210a26bb9b128..a2936616224ba 100644 --- a/htdocs/bom/bom_list.php +++ b/htdocs/bom/bom_list.php @@ -596,7 +596,7 @@ } elseif ($key == 'lang') { require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; $formadmin = new FormAdmin($db); - print $formadmin->select_language($search[$key], 'search_lang', 0, null, 1, 0, 0, 'minwidth100imp maxwidth125', 2); + print $formadmin->select_language($search[$key], 'search_lang', 0, array(), 1, 0, 0, 'minwidth100imp maxwidth125', 2); } else { print ''; } diff --git a/htdocs/bookcal/availabilities_list.php b/htdocs/bookcal/availabilities_list.php index 8f80da1b2db20..f819fdf81bcda 100644 --- a/htdocs/bookcal/availabilities_list.php +++ b/htdocs/bookcal/availabilities_list.php @@ -2,6 +2,7 @@ /* Copyright (C) 2007-2017 Laurent Destailleur * Copyright (C) 2022 Alice Adminson * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -105,7 +106,7 @@ } // List of fields to search into when doing a "search in all" -// $fieldstosearchall = array(); +$fieldstosearchall = array(); // foreach ($object->fields as $key => $val) { // if (!empty($val['searchall'])) { // $fieldstosearchall['t.'.$key] = $val['label']; @@ -120,10 +121,6 @@ // } -// $fieldstosearchall is supposedly defined further below, ensure that it is. -if (!isset($fieldstosearchall) || !is_array($fieldstosearchall)) { - $fieldstosearchall = array(); -} ' @phan-var-force array $fieldstosearchall '; @@ -566,7 +563,7 @@ } elseif ($key == 'lang') { require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; $formadmin = new FormAdmin($db); - print $formadmin->select_language($search[$key], 'search_lang', 0, null, 1, 0, 0, 'minwidth100imp maxwidth125', 2); + print $formadmin->select_language($search[$key], 'search_lang', 0, array(), 1, 0, 0, 'minwidth100imp maxwidth125', 2); } else { print ''; } diff --git a/htdocs/bookcal/calendar_list.php b/htdocs/bookcal/calendar_list.php index 54cccd94510e2..3aa7f6a2d893a 100644 --- a/htdocs/bookcal/calendar_list.php +++ b/htdocs/bookcal/calendar_list.php @@ -2,6 +2,7 @@ /* Copyright (C) 2007-2017 Laurent Destailleur * Copyright (C) 2023 Alice Adminson * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -105,7 +106,7 @@ } // List of fields to search into when doing a "search in all" -// $fieldstosearchall = array(); +$fieldstosearchall = array(); // foreach ($object->fields as $key => $val) { // if (!empty($val['searchall'])) { // $fieldstosearchall['t.'.$key] = $val['label']; @@ -119,10 +120,6 @@ // $fieldstosearchall = array_merge($fieldstosearchall, empty($hookmanager->resArray['fieldstosearchall']) ? array() : $hookmanager->resArray['fieldstosearchall']); // } -// $fieldstosearchall is supposedly defined further below, ensure that it is. -if (!isset($fieldstosearchall) || !is_array($fieldstosearchall)) { - $fieldstosearchall = array(); -} ' @phan-var-force array $fieldstosearchall '; @@ -549,7 +546,7 @@ } elseif ($key == 'lang') { require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; $formadmin = new FormAdmin($db); - print $formadmin->select_language($search[$key], 'search_lang', 0, null, 1, 0, 0, 'minwidth100imp maxwidth125', 2); + print $formadmin->select_language($search[$key], 'search_lang', 0, array(), 1, 0, 0, 'minwidth100imp maxwidth125', 2); } else { print ''; } diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index 3156ccf89b28e..99e8c805056d7 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -549,7 +549,7 @@ print ''; print ''; print ''; print '
'; print $langs->trans("AddProductServiceIntoCategory").'  '; - $form->select_produits('', 'elemid', '', 0, 0, -1, 2, '', 1, array(), 0, 1, 0, '', 0, '', null); + $form->select_produits(0, 'elemid', '', 0, 0, -1, 2, '', 1, array(), 0, 1, 0, '', 0, '', null); print '
'; diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 0c4d89411c11f..5cff3073b8bc6 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -340,7 +340,7 @@ $datef = dol_mktime(GETPOSTINT("p2hour"), GETPOSTINT("p2min"), GETPOSTINT("apsec"), GETPOSTINT("p2month"), GETPOSTINT("p2day"), GETPOSTINT("p2year"), 'tzuserrel'); } //set end date to now if percentage is set to 100 and end date not set - $datef = (!$datef && $percentage == 100)?dol_now():$datef; + $datef = (!$datef && $percentage == 100) ? dol_now() : $datef; // Check parameters if (!$datef && $percentage == 100) { @@ -1463,13 +1463,16 @@ function init_repeat() if (!empty($_SESSION['assignedtouser'])) { $listofuserid = json_decode($_SESSION['assignedtouser'], true); } + if (!is_array($listofuserid)) { + $listofuserid = array(); + } $firstelem = reset($listofuserid); if (isset($listofuserid[$firstelem['id']])) { $listofuserid[$firstelem['id']]['transparency'] = (GETPOSTISSET('transparency') ? GETPOST('transparency', 'alpha') : 0); // 0 by default when refreshing } } print '
'; - print $form->select_dolusers_forevent(($action == 'create' ? 'add' : 'update'), 'assignedtouser', 1, '', 0, '', '', 0, 0, 0, 'AND u.statut != 0', 1, $listofuserid, $listofcontactid, $listofotherid); + print $form->select_dolusers_forevent(($action == 'create' ? 'add' : 'update'), 'assignedtouser', 1, array(), 0, '', array(), 0, 0, 0, 'AND u.statut != 0', 1, $listofuserid, $listofcontactid, $listofotherid); print '
'; print ''; @@ -1482,7 +1485,7 @@ function init_repeat() // Categories print ''.$langs->trans("Categories").''; $cate_arbo = $form->select_all_categories(Categorie::TYPE_ACTIONCOMM, '', 'parent', 64, 0, 3); - print img_picto('', 'category').$form->multiselectarray('categories', $cate_arbo, GETPOST('categories', 'array'), '', 0, 'minwidth300 quatrevingtpercent widthcentpercentminusx', 0, 0); + print img_picto('', 'category').$form->multiselectarray('categories', $cate_arbo, GETPOST('categories', 'array'), 0, 0, 'minwidth300 quatrevingtpercent widthcentpercentminusx', 0, 0); print ""; } @@ -1501,13 +1504,16 @@ function init_repeat() if (!empty($_SESSION['assignedtoresource'])) { $listofresourceid = json_decode($_SESSION['assignedtoresource'], true); } + if (!is_array($listofresourceid)) { + $listofresourceid = array(); + } $firstelem = reset($listofresourceid); if (isset($listofresourceid[$firstelem['id']])) { $listofresourceid[$firstelem['id']]['transparency'] = (GETPOSTISSET('transparency') ? GETPOST('transparency', 'alpha') : 0); // 0 by default when refreshing } } print '
'; - print $form->select_dolresources_forevent(($action == 'create' ? 'add' : 'update'), 'assignedtoresource', 1, '', 0, '', '', 0, 0, 0, 'AND u.statut != 0', 1, $listofresourceid); + print $form->select_dolresources_forevent(($action == 'create' ? 'add' : 'update'), 'assignedtoresource', 1, array(), 0, '', array(), 0, 0, 0, 'AND u.statut != 0', 1, $listofresourceid); print '
'; print ''; } @@ -1584,10 +1590,10 @@ function init_repeat() */ $sav = getDolGlobalString('CONTACT_USE_SEARCH_TO_SELECT'); $conf->global->CONTACT_USE_SEARCH_TO_SELECT = 0; - print $form->selectcontacts(GETPOSTISSET('socid') ? GETPOSTINT('socid') : $select_contact_default, $preselectedids, 'socpeopleassigned[]', 1, '', '', 0, 'minwidth300 widthcentpercentminusxx maxwidth500', 0, 0, array(), false, 'multiple', 'contactid'); + print $form->selectcontacts(GETPOSTISSET('socid') ? GETPOSTINT('socid') : $select_contact_default, $preselectedids, 'socpeopleassigned[]', 1, '', '', 0, 'minwidth300 widthcentpercentminusxx maxwidth500', 0, 0, 0, array(), 'multiple', 'contactid'); $conf->global->CONTACT_USE_SEARCH_TO_SELECT = $sav; } else { - print $form->selectcontacts(GETPOSTISSET('socid') ? GETPOSTINT('socid') : $select_contact_default, $preselectedids, 'socpeopleassigned[]', 1, '', '', 0, 'minwidth300 widthcentpercentminusxx maxwidth500', 0, 0, array(), false, 'multiple', 'contactid'); + print $form->selectcontacts(GETPOSTISSET('socid') ? GETPOSTINT('socid') : $select_contact_default, $preselectedids, 'socpeopleassigned[]', 1, '', '', 0, 'minwidth300 widthcentpercentminusxx maxwidth500', 0, 0, 0, array(), 'multiple', 'contactid'); } print ''; @@ -2083,7 +2089,7 @@ function setdatefields() print ''.$langs->trans("ActionAssignedTo").''; print '
'; - print $form->select_dolusers_forevent(($action == 'create' ? 'add' : 'update'), 'assignedtouser', 1, '', 0, '', '', 0, 0, 0, 'AND u.statut != 0', 1, $listofuserid, $listofcontactid, $listofotherid); + print $form->select_dolusers_forevent(($action == 'create' ? 'add' : 'update'), 'assignedtouser', 1, array(), 0, '', array(), 0, 0, 0, 'AND u.statut != 0', 1, $listofuserid, $listofcontactid, $listofotherid); print '
'; /*if (in_array($user->id,array_keys($listofuserid))) { @@ -2114,7 +2120,7 @@ function setdatefields() foreach ($cats as $cat) { $arrayselected[] = $cat->id; } - print img_picto('', 'category').$form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0); + print img_picto('', 'category').$form->multiselectarray('categories', $cate_arbo, $arrayselected, 0, 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0); print ""; } @@ -2264,9 +2270,11 @@ function setdatefields() $actionCommReminder->typeremind = 'email'; } $disabled = ''; + /* if ($object->datep < dol_now()) { //$disabled = 'disabled title="'.dol_escape_htmltag($langs->trans("EventExpired")).'"'; } + */ print '
'; @@ -2559,7 +2567,7 @@ function setdatefields() $listofcontactid = array(); // not used yet $listofotherid = array(); // not used yet print '
'; - print $form->select_dolusers_forevent('view', 'assignedtouser', 1, '', 0, '', '', 0, 0, 0, '', ($object->datep != $object->datef) ? 1 : 0, $listofuserid, $listofcontactid, $listofotherid); + print $form->select_dolusers_forevent('view', 'assignedtouser', 1, array(), 0, '', array(), 0, 0, 0, '', ($object->datep != $object->datef) ? 1 : 0, $listofuserid, $listofcontactid, $listofotherid); print '
'; /* if ($object->datep != $object->datef && in_array($user->id,array_keys($listofuserid))) diff --git a/htdocs/comm/action/class/cactioncomm.class.php b/htdocs/comm/action/class/cactioncomm.class.php index 8c2476b973946..9c28468c1c74f 100644 --- a/htdocs/comm/action/class/cactioncomm.class.php +++ b/htdocs/comm/action/class/cactioncomm.class.php @@ -82,7 +82,7 @@ class CActionComm public $picto; /** - * @var array array of type_actions + * @var array array of type_actions // TODO: Remove or explain */ public $type_actions = array(); diff --git a/htdocs/comm/action/document.php b/htdocs/comm/action/document.php index b1b37b1661d86..8eb19ae19cd74 100644 --- a/htdocs/comm/action/document.php +++ b/htdocs/comm/action/document.php @@ -6,6 +6,7 @@ * Copyright (C) 2005 Simon TOSSER * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -278,7 +279,7 @@ $listofuserid = array(); if (empty($donotclearsession)) { if ($object->userownerid > 0) { - $listofuserid[$object->userownerid] = array('id'=>$object->userownerid, 'transparency'=>$object->transparency); // Owner first + $listofuserid[$object->userownerid] = array('id' => $object->userownerid, 'transparency' => $object->transparency); // Owner first } if (!empty($object->userassigned)) { // Now concat assigned users // Restore array with key with same value than param 'id' @@ -298,7 +299,7 @@ $listofcontactid = array(); // not used yet $listofotherid = array(); // not used yet print '
'; - print $form->select_dolusers_forevent('view', 'assignedtouser', 1, '', 0, '', '', 0, 0, 0, '', ($object->datep != $object->datef) ? 1 : 0, $listofuserid, $listofcontactid, $listofotherid); + print $form->select_dolusers_forevent('view', 'assignedtouser', 1, array(), 0, '', array(), 0, 0, 0, '', ($object->datep != $object->datef) ? 1 : 0, $listofuserid, $listofcontactid, $listofotherid); print '
'; /*if (in_array($user->id,array_keys($listofuserid))) { diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 53bc33241f85d..63048fefeb938 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -2158,9 +2158,11 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa '@phan-var-force ActionComm $event'; if (empty($reshook)) { // Other calendar + /* if (empty($event->fulldayevent)) { //print $event->getNomUrl(2).' '; } + */ // Date if (empty($event->fulldayevent)) { diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index 7bce264617dde..064ca39d86dfb 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -1149,8 +1149,8 @@ print ''; if ($obj->socid > 0) { $societestatic->id = $obj->socid; - $societestatic->client = $obj->client; - $societestatic->name = $obj->societe; + $societestatic->client = (int) $obj->client; + $societestatic->name = (string) $obj->societe; $societestatic->email = $obj->socemail; print $societestatic->getNomUrl(1, '', 28); diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index 0e9b5bbbaf1a0..d5d99d1c8da3f 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -93,6 +93,7 @@ $hookmanager->initHooks(array('ciblescard', 'globalcard')); $sqlmessage = ''; +$mesgs = array(); // List of sending methods $listofmethods = array(); diff --git a/htdocs/commande/list_det.php b/htdocs/commande/list_det.php index b501d46313595..92147f8bc63c4 100644 --- a/htdocs/commande/list_det.php +++ b/htdocs/commande/list_det.php @@ -91,6 +91,7 @@ $search_datedelivery_start = dol_mktime(0, 0, 0, GETPOSTINT('search_datedelivery_start_month'), GETPOSTINT('search_datedelivery_start_day'), GETPOSTINT('search_datedelivery_start_year')); $search_datedelivery_end = dol_mktime(23, 59, 59, GETPOSTINT('search_datedelivery_end_month'), GETPOSTINT('search_datedelivery_end_day'), GETPOSTINT('search_datedelivery_end_year')); +$search_product_category_array = array(); if (isModEnabled('category')) { $search_product_category_array = GETPOST("search_category_".Categorie::TYPE_PRODUCT."_list", "array"); $searchCategoryProductOperator = 0; @@ -255,6 +256,7 @@ } $result = restrictedArea($user, 'commande', $id, ''); +$permissiontoread = false; /* * Actions @@ -1498,6 +1500,7 @@ // Détail commande $totalqty = 0; + $oldref = null; $totalarray = array(); $totalarray['nbfield'] = 0; @@ -1816,7 +1819,7 @@ // Channel if (!empty($arrayfields['c.fk_input_reason']['checked'])) { print ''; - $form->formInputReason($_SERVER['PHP_SELF'], $obj->fk_input_reason, 'none', ''); + $form->formInputReason($_SERVER['PHP_SELF'], $obj->fk_input_reason, 'none', 0); print ''; if (!$i) { $totalarray['nbfield']++; @@ -2101,6 +2104,7 @@ if (!empty($arrayfields['shippable']['checked'])) { print ''; if (!empty($show_shippable_command) && isModEnabled('stock')) { + $text_icon = ''; if (($obj->fk_statut > $generic_commande::STATUS_DRAFT) && ($obj->fk_statut < $generic_commande::STATUS_CLOSED)) { $generic_commande->loadExpeditions(); // Load array ->expeditions diff --git a/htdocs/compta/accounting-files.php b/htdocs/compta/accounting-files.php index c423ee3e42efa..2005e7d0fb2bd 100644 --- a/htdocs/compta/accounting-files.php +++ b/htdocs/compta/accounting-files.php @@ -417,11 +417,11 @@ //var_dump($files); if (count($files) < 1) { $nofile = array(); - $nofile['id'] = $objd->id; - $nofile['entity'] = $objd->entity; + $nofile['id'] = (int) $objd->id; + $nofile['entity'] = (int) $objd->entity; $nofile['date'] = $db->jdate($objd->date); $nofile['date_due'] = $db->jdate($objd->date_due); - $nofile['paid'] = $objd->paid; + $nofile['paid'] = (int) $objd->paid; $nofile['amount_ht'] = $objd->total_ht; $nofile['amount_ttc'] = $objd->total_ttc; $nofile['amount_vat'] = $objd->total_vat; @@ -444,11 +444,11 @@ $filesarray[$nofile['item'].'_'.$nofile['id']] = $nofile; } else { foreach ($files as $key => $file) { - $file['id'] = $objd->id; - $file['entity'] = $objd->entity; + $file['id'] = (int) $objd->id; + $file['entity'] = (int) $objd->entity; $file['date'] = $db->jdate($objd->date); $file['date_due'] = $db->jdate($objd->date_due); - $file['paid'] = $objd->paid; + $file['paid'] = (int) $objd->paid; $file['amount_ht'] = $objd->total_ht; $file['amount_ttc'] = $objd->total_ttc; $file['amount_vat'] = $objd->total_vat; @@ -816,7 +816,7 @@ print ''; if ($data['item'] == 'Invoice') { - $invoice->id = $data['id']; + $invoice->id = (int) $data['id']; $invoice->ref = $data['ref']; $invoice->total_ht = $data['amount_ht']; $invoice->total_ttc = $data['amount_ttc']; @@ -827,7 +827,7 @@ $invoice->multicurrency_code = $data['currency']; print $invoice->getNomUrl(1, '', 0, 0, '', 0, 0, 0); } elseif ($data['item'] == 'SupplierInvoice') { - $supplier_invoice->id = $data['id']; + $supplier_invoice->id = (int) $data['id']; $supplier_invoice->ref = $data['ref']; $supplier_invoice->total_ht = $data['amount_ht']; $supplier_invoice->total_ttc = $data['amount_ttc']; @@ -838,27 +838,27 @@ $supplier_invoice->multicurrency_code = $data['currency']; print $supplier_invoice->getNomUrl(1, '', 0, 0, '', 0, 0, 0); } elseif ($data['item'] == 'ExpenseReport') { - $expensereport->id = $data['id']; + $expensereport->id = (int) $data['id']; $expensereport->ref = $data['ref']; print $expensereport->getNomUrl(1, 0, 0, 0, 0, 0); } elseif ($data['item'] == 'SalaryPayment') { - $salary_payment->id = $data['id']; + $salary_payment->id = (int) $data['id']; $salary_payment->ref = $data['ref']; print $salary_payment->getNomUrl(1); } elseif ($data['item'] == 'Donation') { - $don->id = $data['id']; + $don->id = (int) $data['id']; $don->ref = $data['ref']; print $don->getNomUrl(1, 0, '', 0); } elseif ($data['item'] == 'SocialContributions') { - $charge_sociales->id = $data['id']; + $charge_sociales->id = (int) $data['id']; $charge_sociales->ref = $data['ref']; print $charge_sociales->getNomUrl(1, 0, 0, 0, 0); } elseif ($data['item'] == 'VariousPayment') { - $various_payment->id = $data['id']; + $various_payment->id = (int) $data['id']; $various_payment->ref = $data['ref']; print $various_payment->getNomUrl(1, '', 0, 0); } elseif ($data['item'] == 'LoanPayment') { - $payment_loan->id = $data['id']; + $payment_loan->id = (int) $data['id']; $payment_loan->ref = $data['ref']; print $payment_loan->getNomUrl(1, 0, 0, '', 0); } else { diff --git a/htdocs/compta/bank/annuel.php b/htdocs/compta/bank/annuel.php index 8299965fc17ca..8132b0729a767 100644 --- a/htdocs/compta/bank/annuel.php +++ b/htdocs/compta/bank/annuel.php @@ -305,11 +305,11 @@ $obj = $db->fetch_object($resql); $min = $db->jdate($obj->min); $max = $db->jdate($obj->max); + $log = "graph.php: min=".$min." max=".$max; + dol_syslog($log); } else { dol_print_error($db); } - $log = "graph.php: min=".$min." max=".$max; - dol_syslog($log); // CRED PART // Chargement du tableau des années diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index ea8b2bd39a478..6f4e4a946f3aa 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -974,6 +974,7 @@ $last_receipts = array(); $last_releve = ''; $last_ok = 0; + $numr = 0; $resqlr = $db->query($sql); if ($resqlr) { @@ -1101,7 +1102,7 @@ // Bank line $moreforfilter .= '
'; $tmptitle = $langs->trans('RubriquesTransactions'); - $cate_arbo = $form->select_all_categories(Categorie::TYPE_BANK_LINE, $search_bid, 'parent', null, null, 1); + $cate_arbo = $form->select_all_categories(Categorie::TYPE_BANK_LINE, $search_bid, 'parent', 0, 0, 1); $moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"').$form->selectarray('search_bid', $cate_arbo, $search_bid, $tmptitle, 0, 0, '', 0, 0, 0, '', '', 1); $moreforfilter .= '
'; } diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index f78e9d08befc6..31f7fc7ca20f1 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -505,7 +505,7 @@ $arrayselected[] = $cat->id; } } - print img_picto('', 'category').$form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0); + print img_picto('', 'category').$form->multiselectarray('categories', $cate_arbo, $arrayselected, 0, 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0); print ""; } @@ -594,6 +594,10 @@ $name = 'cle_rib'; $sizecss = 'minwidth50'; $content = $object->cle_rib; + } else { + $name = 'undefined'; + $sizecss = 'undefined'; + $content = 'undefined'; } print ''.$langs->trans($val).''; @@ -651,7 +655,7 @@ print ''.$langs->trans("AccountancyCode").''; print ''; print img_picto('', 'accounting_account', 'class="pictofixedwidth"'); - print $formaccounting->select_account($object->account_number, 'account_number', 1, '', 1, 1); + print $formaccounting->select_account($object->account_number, 'account_number', 1, array(), 1, 1); if ($formaccounting->nbaccounts == 0) { $langs->load("errors"); $htmltext = $langs->transnoentitiesnoconv("WarningGoOnAccountancySetupToAddAccounts", $langs->transnoentitiesnoconv("MenuAccountancy"), $langs->transnoentitiesnoconv("Setup"), $langs->transnoentitiesnoconv("Chartofaccounts")); @@ -1069,7 +1073,7 @@ $arrayselected[] = $cat->id; } } - print img_picto('', 'category').$form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0); + print img_picto('', 'category').$form->multiselectarray('categories', $cate_arbo, $arrayselected, 0, 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0); print ""; } @@ -1110,7 +1114,7 @@ if (isModEnabled('accounting')) { /** @var FormAccounting $formaccounting */ print img_picto('', 'accounting_account', 'class="pictofixedwidth"'); - print $formaccounting->select_account($object->account_number, 'account_number', 1, '', 1, 1); + print $formaccounting->select_account($object->account_number, 'account_number', 1, array(), 1, 1); if ($formaccounting->nbaccounts == 0) { $langs->load("errors"); $htmltext = $langs->transnoentitiesnoconv("WarningGoOnAccountancySetupToAddAccounts", $langs->transnoentitiesnoconv("MenuAccountancy"), $langs->transnoentitiesnoconv("Setup"), $langs->transnoentitiesnoconv("Chartofaccounts")); @@ -1182,6 +1186,10 @@ $name = 'cle_rib'; $css = 'width50'; $content = $object->cle_rib; + } else { + $name = 'undefined'; + $css = 'undefined'; + $content = 'undefined'; } print ''.$langs->trans($val).''; diff --git a/htdocs/compta/bank/graph.php b/htdocs/compta/bank/graph.php index 20a1be491c9ed..be7ff72baf170 100644 --- a/htdocs/compta/bank/graph.php +++ b/htdocs/compta/bank/graph.php @@ -94,6 +94,13 @@ $title = $object->ref.' - '.$langs->trans("Graph"); $helpurl = ""; +$show1 = ''; +$show2 = ''; +$show3 = ''; +$show4 = ''; +$show5 = ''; +$morehtml = ''; + llxHeader('', $title, $helpurl); $result = dol_mkdir($conf->bank->dir_temp); diff --git a/htdocs/compta/bank/line.php b/htdocs/compta/bank/line.php index 1e9a8a4080fc9..511b2b52a22c5 100644 --- a/htdocs/compta/bank/line.php +++ b/htdocs/compta/bank/line.php @@ -636,7 +636,7 @@ // Bank line print ''.$form->editfieldkey('RubriquesTransactions', 'custcats', '', $object, 0).''; - $cate_arbo = $form->select_all_categories(Categorie::TYPE_BANK_LINE, null, 'parent', null, null, 1); + $cate_arbo = $form->select_all_categories(Categorie::TYPE_BANK_LINE, '', 'parent', 0, 0, 1); $arrayselected = array(); @@ -647,7 +647,7 @@ $arrayselected[] = $cat->id; } } - print img_picto('', 'category', 'class="paddingright"').$form->multiselectarray('custcats', $cate_arbo, $arrayselected, null, null, null, null, "90%"); + print img_picto('', 'category', 'class="paddingright"').$form->multiselectarray('custcats', $cate_arbo, $arrayselected, 0, 0, '', 0, "90%"); print ""; } diff --git a/htdocs/compta/bank/releve.php b/htdocs/compta/bank/releve.php index d65c44e88373e..f1d3523c3368e 100644 --- a/htdocs/compta/bank/releve.php +++ b/htdocs/compta/bank/releve.php @@ -495,6 +495,8 @@ $obj = $db->fetch_object($resql); $total = $obj->amount; $db->free($resql); + } else { + $total = 0; } $totalc = $totald = 0; diff --git a/htdocs/compta/bank/transfer.php b/htdocs/compta/bank/transfer.php index 80101b1b9e8db..6150abc0cf3df 100644 --- a/htdocs/compta/bank/transfer.php +++ b/htdocs/compta/bank/transfer.php @@ -173,13 +173,13 @@ } if (!$error) { - $bank_line_id_from = $tmpaccountfrom->addline($dateo[$n], $typefrom, $label[$n], price2num(-1 * (float) $amount[$n]), '', '', $user); + $bank_line_id_from = $tmpaccountfrom->addline($dateo[$n], $typefrom, $label[$n], 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], '', '', $user); + $bank_line_id_to = $tmpaccountto->addline($dateo[$n], $typeto, $label[$n], $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 be77fa1b9c9c3..69c859037b29f 100644 --- a/htdocs/compta/bank/treso.php +++ b/htdocs/compta/bank/treso.php @@ -5,6 +5,7 @@ * Copyright (C) 2015 Marcos García * Copyright (C) 2022 Alexandre Spangaro + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -283,7 +284,7 @@ if ($tmpobj->family == 'invoice') { $facturestatic->ref = $tmpobj->ref; $facturestatic->id = $tmpobj->objid; - $facturestatic->type = $tmpobj->type; + $facturestatic->type = (int) $tmpobj->type; $ref = $facturestatic->getNomUrl(1, ''); $societestatic->id = $tmpobj->socid; diff --git a/htdocs/compta/bank/various_payment/card.php b/htdocs/compta/bank/various_payment/card.php index 8e5a6c41a5770..a8dfc070bd4db 100644 --- a/htdocs/compta/bank/various_payment/card.php +++ b/htdocs/compta/bank/various_payment/card.php @@ -226,6 +226,8 @@ if ($result > 0) { $result = $accountline->delete($user); // $result may be 0 if not found (when bank entry was deleted manually and fk_bank point to nothing) } + } else { + $account_line = null; } if ($result >= 0) { @@ -233,7 +235,7 @@ header("Location: ".DOL_URL_ROOT.'/compta/bank/various_payment/list.php'); exit; } else { - $object->error = $accountline->error; + $object->error = $accountline ? $accountline->error : 'No AccountLine'; $db->rollback(); setEventMessages($object->error, $object->errors, 'errors'); } @@ -356,9 +358,13 @@ $form = new Form($db); if (isModEnabled('accounting')) { $formaccounting = new FormAccounting($db); +} else { + $formaccounting = null; } if (isModEnabled('project')) { $formproject = new FormProjets($db); +} else { + $formproject = null; } if ($id) { @@ -531,7 +537,7 @@ function setPaymentType() // TODO Remove the fieldrequired and allow instead to edit a various payment to enter accounting code print ''.$langs->trans("AccountAccounting").''; print ''; - print $formaccounting->select_account($accountancy_code, 'accountancy_code', 1, null, 1, 1); + print $formaccounting->select_account($accountancy_code, 'accountancy_code', 1, array(), 1, 1); print ''; } else { // For external software print ''.$langs->trans("AccountAccounting").''; @@ -606,7 +612,7 @@ function setPaymentType() $morehtmlref = '
'; // Project - if (isModEnabled('project')) { + if (isModEnabled('project') && $formproject !== null) { $langs->load("projects"); //$morehtmlref .= '
'; if ($permissiontoadd) { diff --git a/htdocs/contrat/index.php b/htdocs/contrat/index.php index 9c5798c4a3d87..be2f81dc20ff2 100644 --- a/htdocs/contrat/index.php +++ b/htdocs/contrat/index.php @@ -334,7 +334,7 @@ $sql .= " sum(".$db->ifsql("cd.statut=4 AND (cd.date_fin_validite IS NOT NULL AND cd.date_fin_validite < '".$db->idate($now - $conf->contrat->services->expires->warning_delay)."')", 1, 0).') as nb_late,'; $sql .= " sum(".$db->ifsql("cd.statut=5", 1, 0).') as nb_closed,'; $sql .= " c.rowid as cid, c.ref, c.datec, c.tms, c.statut,"; -$sql .= " s.nom as name, s.name_alias, s.logo, s.rowid as socid, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur"; +$sql .= " s.nom as name, s.name_alias, s.logo, s.rowid as socid, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta as code_compta_client, s.code_compta_fournisseur"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s,"; if (!$user->hasRight('societe', 'client', 'voir')) { $sql .= " ".MAIN_DB_PREFIX."societe_commerciaux as sc,"; @@ -351,7 +351,7 @@ $sql .= " AND s.rowid = ".((int) $socid); } $sql .= " GROUP BY c.rowid, c.ref, c.datec, c.tms, c.statut,"; -$sql .= " s.nom, s.name_alias, s.logo, s.rowid, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta as code_compta_client, s.code_compta_fournisseur"; +$sql .= " s.nom, s.name_alias, s.logo, s.rowid, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur"; $sql .= " ORDER BY c.tms DESC"; $sql .= $db->plimit($max); diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index 4f8b20293f184..482e6af0088aa 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -769,7 +769,8 @@ function(response) { $formcontract = new FormContract($this->db); print ''; print img_picto('', 'contract', 'class="pictofixedwidth"'); - print $formcontract->select_contract(-1, GETPOSTINT('contactid'), 'contractid', 0, 1, 1, 1); + // socid is for internal users null and not 0 or -1 + print $formcontract->select_contract($user->socid ?? -1, GETPOSTINT('contactid'), 'contractid', 0, 1, 1, 1); print ''; } } diff --git a/htdocs/core/modules/mailings/modules_mailings.php b/htdocs/core/modules/mailings/modules_mailings.php index 8aa20523f7de8..e45bd655ef3f6 100644 --- a/htdocs/core/modules/mailings/modules_mailings.php +++ b/htdocs/core/modules/mailings/modules_mailings.php @@ -449,4 +449,20 @@ public function getSqlArrayForStats() dol_syslog($msg, LOG_ERR); return array(); } + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Add destinations in the targets table + * + * @param int $mailing_id Id of emailing + * @return int Return integer < 0 on error, count of added when ok + */ + public function add_to_target($mailing_id) + { + // phpcs:enable + // Needs to be implemented in child class + $msg = get_class($this)."::".__FUNCTION__." not implemented"; + dol_syslog($msg, LOG_ERR); + return -1; + } } diff --git a/htdocs/opensurvey/wizard/create_survey.php b/htdocs/opensurvey/wizard/create_survey.php index a498ab0cf67f2..6df9d1ec060b0 100644 --- a/htdocs/opensurvey/wizard/create_survey.php +++ b/htdocs/opensurvey/wizard/create_survey.php @@ -3,6 +3,7 @@ * Copyright (C) 2014 Marcos García * Copyright (C) 2015-2016 Alexandre Spangaro * Copyright (C) 2018-2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -90,9 +91,9 @@ } $testdate = false; - $champdatefin = dol_mktime(23, 59, 59, GETPOSTINT('champdatefinmonth'), GETPOSTINT('champdatefinday'), GETPOSTINT('champdatefinyear')); + $champdatefin = (int) dol_mktime(23, 59, 59, GETPOSTINT('champdatefinmonth'), GETPOSTINT('champdatefinday'), GETPOSTINT('champdatefinyear')); - if (! $error && $champdatefin && ($champdatefin > 0)) { // A date was provided + if ($champdatefin > 0) { // A date was provided, $error still 0 here // Expire date is not before today if ($champdatefin >= dol_now()) { $testdate = true;