diff --git a/dev/tools/phan/baseline.txt b/dev/tools/phan/baseline.txt index 7bb605829a6..a0811521ad8 100644 --- a/dev/tools/phan/baseline.txt +++ b/dev/tools/phan/baseline.txt @@ -9,13 +9,13 @@ */ return [ // # Issue statistics: - // PhanPluginUnknownPropertyType : 1070+ occurrences + // PhanPluginUnknownPropertyType : 1000+ occurrences // PhanUndeclaredProperty : 840+ occurrences - // PhanPossiblyUndeclaredGlobalVariable : 640+ occurrences - // PhanTypeMismatchArgumentProbablyReal : 480+ occurrences - // PhanUndeclaredGlobalVariable : 420+ occurrences - // PhanPluginUnknownArrayMethodReturnType : 400+ occurrences - // PhanPluginUnknownArrayMethodParamType : 300+ occurrences + // PhanPossiblyUndeclaredGlobalVariable : 630+ occurrences + // PhanTypeMismatchArgumentProbablyReal : 470+ occurrences + // PhanUndeclaredGlobalVariable : 410+ occurrences + // PhanPluginUnknownArrayMethodReturnType : 380+ occurrences + // PhanPluginUnknownArrayMethodParamType : 290+ occurrences // PhanPossiblyUndeclaredVariable : 260+ occurrences // PhanTypeMismatchProperty : 180+ occurrences // PhanPluginUnknownArrayFunctionReturnType : 140+ occurrences @@ -26,9 +26,9 @@ return [ // PhanPluginEmptyStatementIf : 50+ occurrences // PhanRedefineFunction : 50+ occurrences // PhanTypeSuspiciousNonTraversableForeach : 50+ occurrences - // PhanPluginUnknownObjectMethodCall : 35+ occurrences // PhanTypeInvalidDimOffset : 35+ occurrences // PhanTypeMismatchDimFetch : 30+ occurrences + // PhanPluginUnknownObjectMethodCall : 25+ occurrences // PhanTypeExpectedObjectPropAccess : 25+ occurrences // PhanTypeComparisonFromArray : 15+ occurrences // PhanUndeclaredConstant : 15+ occurrences @@ -41,12 +41,11 @@ return [ // PhanPluginBothLiteralsBinaryOp : 8 occurrences // PhanPluginDuplicateExpressionBinaryOp : 7 occurrences // PhanParamTooMany : 5 occurrences - // PhanTypeExpectedObjectPropAccessButGotNull : 5 occurrences // PhanPluginDuplicateArrayKey : 4 occurrences + // PhanTypeExpectedObjectPropAccessButGotNull : 4 occurrences // PhanEmptyFQSENInClasslike : 3 occurrences // PhanInvalidFQSENInClasslike : 3 occurrences // PhanAccessMethodProtected : 1 occurrence - // PhanTypeMismatchArgumentInternal : 1 occurrence // Currently, file_suppressions and directory_suppressions are the only supported suppressions 'file_suppressions' => [ @@ -379,7 +378,6 @@ return [ 'htdocs/core/lib/product.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType', 'PhanPossiblyUndeclaredVariable'], 'htdocs/core/lib/project.lib.php' => ['PhanUndeclaredProperty'], 'htdocs/core/lib/receiptprinter.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], - 'htdocs/core/lib/reception.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], 'htdocs/core/lib/report.lib.php' => ['PhanPluginUnknownArrayFunctionParamType'], 'htdocs/core/lib/resource.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], 'htdocs/core/lib/salaries.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], @@ -674,7 +672,6 @@ return [ 'htdocs/loan/payment/payment.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/loan/schedule.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/mailmanspip/class/mailmanspip.class.php' => ['PhanPluginUnknownArrayPropertyType'], - 'htdocs/main.inc.php' => ['PhanTypeMismatchArgumentInternal'], 'htdocs/margin/customerMargins.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/margin/lib/margins.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], 'htdocs/margin/productMargins.php' => ['PhanTypeMismatchArgumentProbablyReal'], @@ -807,8 +804,8 @@ return [ 'htdocs/public/payment/paymentok.php' => ['PhanPluginSuspiciousParamPosition', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeExpectedObjectPropAccess', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], 'htdocs/public/project/index.php' => ['PhanRedefineFunction', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], 'htdocs/public/project/new.php' => ['PhanRedefineFunction', 'PhanUndeclaredProperty'], - 'htdocs/public/project/suggestbooth.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanRedefineFunction', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], - 'htdocs/public/project/suggestconference.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanRedefineFunction', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], + 'htdocs/public/project/suggestbooth.php' => ['PhanRedefineFunction', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], + 'htdocs/public/project/suggestconference.php' => ['PhanRedefineFunction', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/public/project/viewandvote.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], 'htdocs/public/recruitment/view.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], 'htdocs/public/stripe/ipn.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredGlobalVariable'], @@ -817,43 +814,32 @@ return [ 'htdocs/public/ticket/create_ticket.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchDimFetchNullable', 'PhanTypeMismatchProperty'], 'htdocs/public/ticket/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/public/ticket/view.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/public/webportal/index.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredGlobalVariable'], - 'htdocs/public/webportal/tpl/hero-header-banner.tpl.php' => ['PhanTypeExpectedObjectPropAccessButGotNull', 'PhanUndeclaredGlobalVariable'], 'htdocs/public/webportal/tpl/menu.tpl.php' => ['PhanUndeclaredProperty'], 'htdocs/public/webportal/webportal.main.inc.php' => ['PhanPossiblyNullTypeMismatchProperty', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanRedefineFunction'], 'htdocs/public/website/index.php' => ['PhanRedefineFunction', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/public/website/javascript.js.php' => ['PhanRedefineFunction'], 'htdocs/public/website/styles.css.php' => ['PhanRedefineFunction'], 'htdocs/reception/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], - 'htdocs/reception/class/api_receptions.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], - 'htdocs/reception/class/reception.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'], - 'htdocs/reception/class/receptionlinebatch.class.php' => ['PhanPluginUnknownPropertyType'], - 'htdocs/reception/class/receptionstats.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType'], + 'htdocs/reception/class/reception.class.php' => ['PhanUndeclaredProperty'], + 'htdocs/reception/class/receptionstats.class.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/reception/contact.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/reception/dispatch.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/reception/list.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], + 'htdocs/reception/list.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/reception/note.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/reception/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'], - 'htdocs/recruitment/admin/setup.php' => ['PhanEmptyForeach', 'PhanPluginUnknownObjectMethodCall'], + 'htdocs/recruitment/admin/setup.php' => ['PhanEmptyForeach'], 'htdocs/recruitment/admin/setup_candidatures.php' => ['PhanEmptyForeach', 'PhanPluginUnknownObjectMethodCall'], - 'htdocs/recruitment/class/api_recruitments.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], - 'htdocs/recruitment/class/recruitmentcandidature.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'], - 'htdocs/recruitment/class/recruitmentjobposition.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'], + 'htdocs/recruitment/class/recruitmentcandidature.class.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredProperty'], + 'htdocs/recruitment/class/recruitmentjobposition.class.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredProperty'], 'htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php' => ['PhanPluginUnknownArrayPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], 'htdocs/recruitment/core/modules/recruitment/mod_recruitmentcandidature_advanced.php' => ['PhanUndeclaredProperty'], 'htdocs/recruitment/core/modules/recruitment/mod_recruitmentjobposition_advanced.php' => ['PhanUndeclaredProperty'], 'htdocs/recruitment/index.php' => ['PhanUndeclaredGlobalVariable'], - 'htdocs/recruitment/lib/recruitment.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], - 'htdocs/recruitment/lib/recruitment_recruitmentcandidature.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], - 'htdocs/recruitment/lib/recruitment_recruitmentjobposition.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], - 'htdocs/recruitment/recruitmentcandidature_agenda.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/recruitment/recruitmentcandidature_card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], - 'htdocs/recruitment/recruitmentcandidature_document.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/recruitment/recruitmentcandidature_list.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], - 'htdocs/recruitment/recruitmentcandidature_note.php' => ['PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/recruitment/recruitmentcandidature_list.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/recruitment/recruitmentjobposition_agenda.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredGlobalVariable'], - 'htdocs/recruitment/recruitmentjobposition_applications.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], - 'htdocs/recruitment/recruitmentjobposition_card.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], + 'htdocs/recruitment/recruitmentjobposition_applications.php' => ['PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], + 'htdocs/recruitment/recruitmentjobposition_card.php' => ['PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/recruitment/recruitmentjobposition_document.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/recruitment/recruitmentjobposition_list.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/recruitment/recruitmentjobposition_note.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], diff --git a/htdocs/core/lib/reception.lib.php b/htdocs/core/lib/reception.lib.php index d39e8dc69bd..a38793d1355 100644 --- a/htdocs/core/lib/reception.lib.php +++ b/htdocs/core/lib/reception.lib.php @@ -114,7 +114,7 @@ function reception_prepare_head(Reception $object) /** * Return array head with list of tabs to view object information. * - * @return array head array with tabs + * @return array head array with tabs */ function reception_admin_prepare_head() { diff --git a/htdocs/core/modules/reception/mod_reception_beryl.php b/htdocs/core/modules/reception/mod_reception_beryl.php index 1b0f9510e1f..ef60d5747e3 100644 --- a/htdocs/core/modules/reception/mod_reception_beryl.php +++ b/htdocs/core/modules/reception/mod_reception_beryl.php @@ -31,8 +31,14 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/reception/modules_reception.php'; class mod_reception_beryl extends ModelNumRefReception { public $version = 'dolibarr'; + /** + * @var string + */ public $prefix = 'RCP'; public $error = ''; + /** + * @var string + */ public $nom = 'Beryl'; diff --git a/htdocs/core/modules/reception/mod_reception_moonstone.php b/htdocs/core/modules/reception/mod_reception_moonstone.php index de514911410..3810da99bb1 100644 --- a/htdocs/core/modules/reception/mod_reception_moonstone.php +++ b/htdocs/core/modules/reception/mod_reception_moonstone.php @@ -33,6 +33,9 @@ class mod_reception_moonstone extends ModelNumRefReception { public $version = 'dolibarr'; public $error = ''; + /** + * @var string + */ public $nom = 'Moonstone'; /** diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index e817130a3d8..04dd9a1a2c0 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -285,6 +285,9 @@ class CommandeFournisseur extends CommonOrder * @var int Date of the purchase order payment deadline */ public $date_lim_reglement; + /** + * @var array + */ public $receptions = array(); // Multicurrency diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index ab0f8a97c40..de96aeef462 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -617,6 +617,9 @@ class Product extends CommonObject public $stats_proposal_supplier = array(); public $stats_commande_fournisseur = array(); public $stats_expedition = array(); + /** + * @var array{}|array{suppliers:int,nb:int,rows:int,qty:int|float} + */ public $stats_reception = array(); public $stats_mo = array(); public $stats_bom = array(); @@ -3765,11 +3768,11 @@ class Product extends CommonObject /** * Charge tableau des stats réception fournisseur pour le produit/service * - * @param int $socid Id thirdparty to filter on a thirdparty - * @param string $filtrestatut Id status to filter on a status - * @param int $forVirtualStock Ignore rights filter for virtual stock calculation. + * @param int $socid Id thirdparty to filter on a thirdparty + * @param string $filtrestatut Id status to filter on a status + * @param int $forVirtualStock Ignore rights filter for virtual stock calculation. * @param int $dateofvirtualstock Date of virtual stock - * @return int Array of stats in $this->stats_reception, <0 if ko or >0 if ok + * @return int Array of stats in $this->stats_reception, <0 if ko or >0 if ok */ public function load_stats_reception($socid = 0, $filtrestatut = '', $forVirtualStock = 0, $dateofvirtualstock = null) { diff --git a/htdocs/public/project/suggestbooth.php b/htdocs/public/project/suggestbooth.php index d699dffc091..eff1c46628b 100644 --- a/htdocs/public/project/suggestbooth.php +++ b/htdocs/public/project/suggestbooth.php @@ -233,10 +233,11 @@ if (empty($reshook) && $action == 'add') { // Test on permission not required he $errmsg .= $langs->trans("ErrorBadEMail", GETPOST("email"))."
\n"; } + $thirdparty = null; if (!$error) { // Getting the thirdparty or creating it $thirdparty = new Societe($db); - $resultfetchthirdparty = $thirdparty->fetch('', $societe); + $resultfetchthirdparty = $thirdparty->fetch(0, $societe); if ($resultfetchthirdparty < 0) { // If an error was found @@ -274,6 +275,7 @@ if (empty($reshook) && $action == 'add') { // Test on permission not required he } } $modCodeClient = new $module($db); + '@phan-var-force ModeleThirdPartyCode $modCodeClient'; if (empty($tmpcode) && !empty($modCodeClient->code_auto)) { $tmpcode = $modCodeClient->getNextValue($thirdparty, 0); @@ -292,7 +294,7 @@ if (empty($reshook) && $action == 'add') { // Test on permission not required he // From there we have a thirdparty, now looking for the contact if (!$error) { $contact = new Contact($db); - $resultcontact = $contact->fetch('', '', '', $email); + $resultcontact = $contact->fetch(0, null, '', $email); if ($resultcontact <= 0) { // Need to create a contact $contact->socid = $thirdparty->id; @@ -344,6 +346,7 @@ if (empty($reshook) && $action == 'add') { // Test on permission not required he } } $modCodeFournisseur = new $module($db); + '@phan-var-force ModeleThirdPartyCode $modCodeFournisseur'; if (empty($tmpcode) && !empty($modCodeFournisseur->code_auto)) { $tmpcode = $modCodeFournisseur->getNextValue($thirdparty, 1); } @@ -416,6 +419,7 @@ if (empty($reshook) && $action == 'add') { // Test on permission not required he $errmsg .= $conforbooth->error; } else { // If this is a paying booth, we have to redirect to payment page and create an invoice + $facture = null; if (!empty((float) $project->price_booth)) { $productforinvoicerow = new Product($db); $resultprod = $productforinvoicerow->fetch(getDolGlobalString('SERVICE_BOOTH_LOCATION')); @@ -451,10 +455,10 @@ if (empty($reshook) && $action == 'add') { // Test on permission not required he } } - if (!$error) { + if (!$error && is_object($facture)) { // Add line to draft invoice $vattouse = get_default_tva($mysoc, $thirdparty, $productforinvoicerow->id); - $result = $facture->addline($langs->trans("BoothLocationFee", $conforbooth->label, dol_print_date($conforbooth->datep, '%d/%m/%y %H:%M:%S'), dol_print_date($conforbooth->datep2, '%d/%m/%y %H:%M:%S')), (float) $project->price_booth, 1, $vattouse, 0, 0, $productforinvoicerow->id, 0, dol_now(), '', 0, 0, '', 'HT', 0, 1); + $result = $facture->addline($langs->trans("BoothLocationFee", $conforbooth->label, dol_print_date($conforbooth->datep, '%d/%m/%y %H:%M:%S'), dol_print_date($conforbooth->datep2, '%d/%m/%y %H:%M:%S')), (float) $project->price_booth, 1, $vattouse, 0, 0, $productforinvoicerow->id, 0, dol_now(), '', 0, 0, 0, 'HT', 0, 1); if ($result <= 0) { $contact->error = $facture->error; $contact->errors = $facture->errors; @@ -486,7 +490,7 @@ if (empty($reshook) && $action == 'add') { // Test on permission not required he } } - if (!$error) { + if (!$error && is_object($thirdparty)) { $db->commit(); // Sending mail @@ -506,6 +510,8 @@ if (empty($reshook) && $action == 'add') { // Test on permission not required he $arraydefaultmessage = $formmail->getEMailTemplate($db, 'conferenceorbooth', $user, $outputlangs, $labeltouse, 1, ''); } + $subject = ''; + $msg = ''; if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) { $subject = $arraydefaultmessage->topic; $msg = $arraydefaultmessage->content; diff --git a/htdocs/public/project/suggestconference.php b/htdocs/public/project/suggestconference.php index 17387bb8f98..ff764b1fcae 100644 --- a/htdocs/public/project/suggestconference.php +++ b/htdocs/public/project/suggestconference.php @@ -237,7 +237,7 @@ if (empty($reshook) && $action == 'add') { // Test on permission not required he if (!$error) { // Getting the thirdparty or creating it $thirdparty = new Societe($db); - $resultfetchthirdparty = $thirdparty->fetch('', $societe); + $resultfetchthirdparty = $thirdparty->fetch(0, $societe); if ($resultfetchthirdparty < 0) { // If an error was found @@ -275,6 +275,7 @@ if (empty($reshook) && $action == 'add') { // Test on permission not required he } } $modCodeClient = new $module($db); + '@phan-var-force ModeleThirdPartyCode $modCodeClient'; if (empty($tmpcode) && !empty($modCodeClient->code_auto)) { $tmpcode = $modCodeClient->getNextValue($thirdparty, 0); @@ -293,7 +294,7 @@ if (empty($reshook) && $action == 'add') { // Test on permission not required he // From there we have a thirdparty, now looking for the contact if (!$error) { $contact = new Contact($db); - $resultcontact = $contact->fetch('', '', '', $email); + $resultcontact = $contact->fetch(0, null, '', $email); if ($resultcontact <= 0) { // Need to create a contact $contact->socid = $thirdparty->id; @@ -344,6 +345,8 @@ if (empty($reshook) && $action == 'add') { // Test on permission not required he } } $modCodeFournisseur = new $module($db); + '@phan-var-force ModeleThirdPartyCode $modCodeFournisseur'; + if (empty($tmpcode) && !empty($modCodeFournisseur->code_auto)) { $tmpcode = $modCodeFournisseur->getNextValue($thirdparty, 1); } @@ -437,6 +440,8 @@ if (empty($reshook) && $action == 'add') { // Test on permission not required he $arraydefaultmessage = $formmail->getEMailTemplate($db, 'conferenceorbooth', $user, $outputlangs, $labeltouse, 1, ''); } + $subject = ''; + $msg = ''; if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) { $subject = $arraydefaultmessage->topic; $msg = $arraydefaultmessage->content; diff --git a/htdocs/public/recruitment/view.php b/htdocs/public/recruitment/view.php index 3a8e48f935e..790f28fedb9 100644 --- a/htdocs/public/recruitment/view.php +++ b/htdocs/public/recruitment/view.php @@ -1,6 +1,7 @@ * 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 @@ -87,7 +88,7 @@ if (!isModEnabled("recruitment")) { httponly_accessforbidden('Module Recruitment not enabled'); } -$object->fetch('', $ref); +$object->fetch(0, $ref); $user->loadDefaultValues(); $errmsg = ""; diff --git a/htdocs/public/webportal/index.php b/htdocs/public/webportal/index.php index b0222f55e61..900b2896804 100644 --- a/htdocs/public/webportal/index.php +++ b/htdocs/public/webportal/index.php @@ -2,6 +2,7 @@ /* Copyright (C) 2023-2024 Laurent Destailleur * Copyright (C) 2023-2024 Lionel Vessiller * 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 @@ -27,6 +28,8 @@ include 'webportal.main.inc.php'; /** @var Context $context */ +// From included file above +'@phan-var-force Context $context'; /* * Action diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index 0d2ee13eacc..904fbbf701d 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -990,7 +990,7 @@ if ($action == 'create') { $numAsked = 0; /** - * @var array $suffix2numAsked map HTTP query parameter suffixes (like '1_0') to line indices so that + * @var array $suffix2numAsked map HTTP query parameter suffixes (like '1_0') to line indices so that * extrafields from HTTP query can be assigned to the correct dispatch line */ $suffix2numAsked = array(); diff --git a/htdocs/reception/class/api_receptions.class.php b/htdocs/reception/class/api_receptions.class.php index d4f8e94e3f4..11f869d4df0 100644 --- a/htdocs/reception/class/api_receptions.class.php +++ b/htdocs/reception/class/api_receptions.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2022 Laurent Destailleur + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -30,7 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/reception/class/receptionlinebatch.class.php'; class Receptions extends DolibarrApi { /** - * @var array $FIELDS Mandatory fields, checked when create and update object + * @var string[] $FIELDS Mandatory fields, checked when create and update object */ public static $FIELDS = array( 'socid', @@ -97,6 +98,8 @@ class Receptions extends DolibarrApi * @param string $properties Restrict the data returned to these properties. Ignored if empty. Comma separated list of properties names * @param bool $pagination_data If this parameter is set to true the response will include pagination data. Default value is false. Page starts from 0* * @return array Array of reception objects + * @phan-return array> + * @phpstan-return array> * * @throws RestException */ @@ -197,6 +200,8 @@ class Receptions extends DolibarrApi * Create reception object * * @param array $request_data Request data + * @phan-param ?array $request_data + * @phpstan-param ?array $request_data * @return int ID of reception created */ public function post($request_data = null) @@ -216,7 +221,7 @@ class Receptions extends DolibarrApi $this->reception->$field = $this->_checkValForAPI($field, $value, $this->reception); } - if (isset($request_data["lines"])) { + if (isset($request_data["lines"]) && is_array($request_data['lines'])) { $lines = array(); foreach ($request_data["lines"] as $line) { $receptionline = new ReceptionLineBatch($this->db); @@ -420,6 +425,8 @@ class Receptions extends DolibarrApi * @param int $id Id of reception to update * @param int $lineid Id of line to delete * @return array + * @phan-return array{success:array{code:int,message:string}} + * @phpstan-return array{success:array{code:int,message:string}} * * @url DELETE {id}/lines/{lineid} * @@ -461,6 +468,8 @@ class Receptions extends DolibarrApi * * @param int $id Id of reception to update * @param array $request_data Datas + * @phan-param ?array $request_data + * @phpstan-param ?array $request_data * @return Object Object with cleaned properties */ public function put($id, $request_data = null) @@ -502,6 +511,8 @@ class Receptions extends DolibarrApi * * @param int $id Reception ID * @return array + * @phan-return array{success:array{code:int,message:string}} + * @phpstan-return array{success:array{code:int,message:string}} */ public function delete($id) { @@ -743,8 +754,8 @@ class Receptions extends DolibarrApi /** * Validate fields before create or update object * - * @param array $data Array with data to verify - * @return array + * @param array $data Array with data to verify + * @return array * @throws RestException */ private function _validate($data) diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index 77d1e4a4268..a4fa06b44ac 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -74,34 +74,93 @@ class Reception extends CommonObject */ public $picto = 'dollyrevert'; + /** + * @var int + */ public $socid; + /** + * @var string + */ public $ref_supplier; + /** + * @var int + */ public $entrepot_id; + /** + * @var string + */ public $tracking_number; + /** + * @var string + */ public $tracking_url; + /** + * @var int<0,1> + */ public $billed; + /** + * @var string + */ public $model_pdf; + /** + * @var int|float + */ public $weight; + /** + * @var int|float + */ public $trueWeight; + /** + * @var null|float|int + */ public $weight_units; + /** + * @var int|float + */ public $trueWidth; + /** + * @var int + */ public $width_units; + /** + * @var int|float + */ public $trueHeight; + /** + * @var int + */ public $height_units; + /** + * @var int|float + */ public $trueDepth; + /** + * @var int + */ public $depth_units; - // A denormalized value + /** + * @var string A denormalized value + */ public $trueSize; + /** + * @var int|string + */ public $size_units; + /** + * @var int + */ public $user_author_id; - public $date_delivery; // Date delivery planned + /** + * @var int|string Planned date of delivery + */ + public $date_delivery; /** * @var int|string Effective delivery date - * @deprecated + * @deprecated Use $date_reception * @see $date_reception */ public $date; @@ -116,7 +175,13 @@ class Reception extends CommonObject */ public $date_valid; + /** + * @var array + */ public $meths; + /** + * @var array + */ public $listmeths; // List of carriers /** @@ -125,8 +190,10 @@ class Reception extends CommonObject public $lines = array(); - // detail of lot and qty = array(id in receptiondet_batch, batch, qty) - // We can use this to know warehouse planned to be used for each lot. + /** + * @var stdClass[] detail of lot and qty = array(id in receptiondet_batch, batch, qty) + * // We can use this to know warehouse planned to be used for each lot. + */ public $detail_batch; const STATUS_DRAFT = 0; @@ -134,7 +201,6 @@ class Reception extends CommonObject const STATUS_CLOSED = 2; - /** * Constructor * @@ -180,8 +246,8 @@ class Reception extends CommonObject } $obj = new $classname(); + '@phan-var-force ModelNumRefReception $obj'; - $numref = ""; $numref = $obj->getNextValue($soc, $this); if ($numref != "") { @@ -810,12 +876,12 @@ class Reception extends CommonObject * @param int $entrepot_id Id of warehouse * @param int $id Id of source line (supplier order line) * @param float $qty Quantity - * @param array $array_options extrafields array + * @param array $array_options extrafields array * @param string $comment Comment for stock movement * @param int $eatby eat-by date * @param int $sellby sell-by date * @param string $batch Lot number - * @param double $cost_price Line cost + * @param float $cost_price Line cost * @return int Return integer <0 if KO, index of line if OK */ public function addline($entrepot_id, $id, $qty, $array_options = [], $comment = '', $eatby = null, $sellby = null, $batch = '', $cost_price = 0) @@ -925,7 +991,7 @@ class Reception extends CommonObject $this->ref_supplier = trim($this->ref_supplier); } if (isset($this->socid)) { - $this->socid = trim($this->socid); + $this->socid = (int) trim((string) $this->socid); } if (isset($this->fk_user_author)) { $this->fk_user_author = (int) $this->fk_user_author; @@ -943,22 +1009,22 @@ class Reception extends CommonObject $this->statut = (int) $this->statut; } if (isset($this->trueDepth)) { - $this->trueDepth = trim($this->trueDepth); + $this->trueDepth = (float) trim((string) $this->trueDepth); } if (isset($this->trueWidth)) { - $this->trueWidth = trim($this->trueWidth); + $this->trueWidth = (float) trim((string) $this->trueWidth); } if (isset($this->trueHeight)) { - $this->trueHeight = trim($this->trueHeight); + $this->trueHeight = (float) trim((string) $this->trueHeight); } if (isset($this->size_units)) { $this->size_units = trim((string) $this->size_units); } if (isset($this->weight_units)) { - $this->weight_units = trim((string) $this->weight_units); + $this->weight_units = (float) trim((string) $this->weight_units); } if (isset($this->trueWeight)) { - $this->weight = trim((string) $this->trueWeight); + $this->weight = (float) trim((string) $this->trueWeight); } if (isset($this->note_private)) { $this->note_private = trim($this->note_private); @@ -1115,12 +1181,14 @@ class Reception extends CommonObject if (!empty($this->origin) && $this->origin_id > 0) { $this->fetch_origin(); - if ($this->origin_object->statut == 4) { // If order source of reception is "partially received" + $origin_object = $this->origin_object; + '@phan-var-force CommandeFournisseur $origin_object'; + if ($origin_object->statut == 4) { // If order source of reception is "partially received" // Check if there is no more reception. If not, we can move back status of order to "validated" instead of "reception in progress" - $this->origin_object->loadReceptions(); + $origin_object->loadReceptions(); //var_dump($this->$origin->receptions);exit; - if (count($this->origin_object->receptions) <= 0) { - $this->origin_object->setStatut(3); // ordered + if (count($origin_object->receptions) <= 0) { + $origin_object->setStatut(3); // ordered } } } diff --git a/htdocs/reception/class/receptionlinebatch.class.php b/htdocs/reception/class/receptionlinebatch.class.php index 7fd0e258669..db468b220e3 100644 --- a/htdocs/reception/class/receptionlinebatch.class.php +++ b/htdocs/reception/class/receptionlinebatch.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2014 Juanjo Menent * Copyright (C) 2024 Frédéric France * Copyright (C) 2024 Christophe Battarel + * 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 * the Free Software Foundation; either version 3 of the License, or @@ -100,11 +101,29 @@ class ReceptionLineBatch extends CommonObjectLine */ public $qty_asked; + /** + * @var string + */ public $libelle; + /** + * @var string + */ public $label; + /** + * @var string + */ public $desc; + /** + * @var float + */ public $tva_tx; + /** + * @var string + */ public $vat_src_code; + /** + * @var string + */ public $ref_supplier; /** @@ -117,7 +136,13 @@ class ReceptionLineBatch extends CommonObjectLine */ public $fk_user; + /** + * @var int|string + */ public $datec = ''; + /** + * @var string + */ public $comment; /** @@ -125,9 +150,21 @@ class ReceptionLineBatch extends CommonObjectLine */ public $status; + /** + * @var string + */ public $batch; - public $eatby = ''; - public $sellby = ''; + /** + * @var ?int + */ + public $eatby = null; + /** + * @var ?int + */ + public $sellby = null; + /** + * @var int|float + */ public $cost_price = 0; @@ -234,8 +271,8 @@ class ReceptionLineBatch extends CommonObjectLine $sql .= " ".(!isset($this->comment) ? 'NULL' : "'".$this->db->escape($this->comment)."'").","; $sql .= " ".(!isset($this->status) ? 'NULL' : (int) $this->status).","; $sql .= " ".(!isset($this->batch) ? 'NULL' : "'".$this->db->escape($this->batch)."'").","; - $sql .= " ".(!isset($this->eatby) || dol_strlen($this->eatby) == 0 ? 'NULL' : "'".$this->db->idate($this->eatby)."'").","; - $sql .= " ".(!isset($this->sellby) || dol_strlen($this->sellby) == 0 ? 'NULL' : "'".$this->db->idate($this->sellby)."'").","; + $sql .= " ".(!isset($this->eatby) || dol_strlen((string) $this->eatby) == 0 ? 'NULL' : "'".$this->db->idate($this->eatby)."'").","; + $sql .= " ".(!isset($this->sellby) || dol_strlen((string) $this->sellby) == 0 ? 'NULL' : "'".$this->db->idate($this->sellby)."'").","; $sql .= " ".((int) $this->fk_reception).","; $sql .= " ".(!isset($this->cost_price) ? '0' : (float) $this->cost_price); $sql .= ")"; @@ -417,8 +454,8 @@ class ReceptionLineBatch extends CommonObjectLine $sql .= " status=".(isset($this->status) ? $this->status : "null").","; $sql .= " tms=".(dol_strlen((string) $this->tms) != 0 ? "'".$this->db->idate($this->tms)."'" : 'null').","; $sql .= " batch=".(isset($this->batch) ? "'".$this->db->escape($this->batch)."'" : "null").","; - $sql .= " eatby=".(dol_strlen($this->eatby) != 0 ? "'".$this->db->idate($this->eatby)."'" : 'null').","; - $sql .= " sellby=".(dol_strlen($this->sellby) != 0 ? "'".$this->db->idate($this->sellby)."'" : 'null'); + $sql .= " eatby=".(dol_strlen((string) $this->eatby) != 0 ? "'".$this->db->idate($this->eatby)."'" : 'null').","; + $sql .= " sellby=".(dol_strlen((string) $this->sellby) != 0 ? "'".$this->db->idate($this->sellby)."'" : 'null'); $sql .= " WHERE rowid=".((int) $this->id); $this->db->begin(); @@ -655,8 +692,8 @@ class ReceptionLineBatch extends CommonObjectLine $this->status = 0; $this->tms = dol_now(); $this->batch = ''; - $this->eatby = ''; - $this->sellby = ''; + $this->eatby = null; + $this->sellby = null; return 1; } @@ -668,7 +705,7 @@ class ReceptionLineBatch extends CommonObjectLine * @param string $sortfield Sort field * @param int $limit limit * @param int $offset offset limit - * @param string|array $filter filter array + * @param string|array $filter filter array * @param string $filtermode filter mode (AND or OR) * @return int Return integer <0 if KO, >0 if OK */ diff --git a/htdocs/reception/class/receptionstats.class.php b/htdocs/reception/class/receptionstats.class.php index bc1cc4fb1ab..fa62583f102 100644 --- a/htdocs/reception/class/receptionstats.class.php +++ b/htdocs/reception/class/receptionstats.class.php @@ -3,6 +3,7 @@ * Copyright (c) 2005-2013 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2011 Juanjo Menent + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -34,9 +35,18 @@ include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; */ class ReceptionStats extends Stats { + /** + * @var string + */ public $table_element; + /** + * @var int + */ public $socid; + /** + * @var int + */ public $userid; public $from; @@ -84,9 +94,9 @@ class ReceptionStats extends Stats /** * Return reception number by month for a year * - * @param int $year Year to scan - * @param int $format 0=Label of abscissa is a translated text, 1=Label of abscissa is month number, 2=Label of abscissa is first letter of month - * @return array Array with number by month + * @param int $year Year to scan + * @param int<0,2> $format 0=Label of abscissa is a translated text, 1=Label of abscissa is month number, 2=Label of abscissa is first letter of month + * @return array,array{0:int<1,12>,1:int}> Array with number by month */ public function getNbByMonth($year, $format = 0) { @@ -109,7 +119,7 @@ class ReceptionStats extends Stats /** * Return receptions number per year * - * @return array Array with number by year + * @return array Array with number by year * */ public function getNbByYear() @@ -132,8 +142,8 @@ class ReceptionStats extends Stats * Return the orders amount by month for a year * * @param int $year Year to scan - * @param int $format 0=Label of abscissa is a translated text, 1=Label of abscissa is month number, 2=Label of abscissa is first letter of month - * @return array Array with amount by month + * @param int<0,2> $format 0=Label of abscissa is a translated text, 1=Label of abscissa is month number, 2=Label of abscissa is first letter of month + * @return array,array{0:int<1,12>,1:int|float}> Array with amount by month */ public function getAmountByMonth($year, $format = 0) { @@ -157,7 +167,7 @@ class ReceptionStats extends Stats * Return the orders amount average by month for a year * * @param int $year year for stats - * @return array array with number by month + * @return array,array{0:int<1,12>,1:int|float}> Array of average each month array with number by month */ public function getAverageByMonth($year) { @@ -179,7 +189,7 @@ class ReceptionStats extends Stats /** * Return nb, total and average * - * @return array Array of values + * @return array Array with nb, total amount, average for each year */ public function getAllByYear() { diff --git a/htdocs/reception/list.php b/htdocs/reception/list.php index 7c7c665488c..52ff1c95590 100644 --- a/htdocs/reception/list.php +++ b/htdocs/reception/list.php @@ -226,6 +226,7 @@ if (empty($reshook)) { $TFact = array(); $TFactThird = array(); + '@phan-var FactureFournisseur[] $TFactThird'; $TFactThirdNbLines = array(); $nb_bills_created = 0; @@ -304,7 +305,8 @@ if (empty($reshook)) { } } - // try get from third-party of reception + $soc = null; + // try get from third party of reception if (!empty($rcp->thirdparty)) { $soc = $rcp->thirdparty; if (empty($cond_reglement_id) && !empty($soc->cond_reglement_supplier_id)) { @@ -331,7 +333,9 @@ if (empty($reshook)) { $objecttmp->transport_mode_id = $transport_mode_id; // if the VAT reverse-charge is activated by default in supplier card to resume the information - $objecttmp->vat_reverse_charge = $soc->vat_reverse_charge; + if (is_object($soc)) { + $objecttmp->vat_reverse_charge = $soc->vat_reverse_charge; + } $objecttmp->fk_project = $rcp->fk_project; //$objecttmp->multicurrency_code = $rcp->multicurrency_code; diff --git a/htdocs/reception/stats/index.php b/htdocs/reception/stats/index.php index e8b7d6d9394..cd115f69409 100644 --- a/htdocs/reception/stats/index.php +++ b/htdocs/reception/stats/index.php @@ -255,7 +255,7 @@ print ''; $oldyear = 0; foreach ($data as $val) { $year = $val['year']; - while (!empty($year) && $oldyear > $year + 1) { // If we have empty year + while (!empty($year) && $oldyear > (int) $year + 1) { // If we have empty year $oldyear--; diff --git a/htdocs/recruitment/admin/setup.php b/htdocs/recruitment/admin/setup.php index bdc7d8aa747..c3b1b4923da 100644 --- a/htdocs/recruitment/admin/setup.php +++ b/htdocs/recruitment/admin/setup.php @@ -418,6 +418,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { require_once $dir.'/'.$file; $module = new $classname($db); + '@phan-var-force ModelePDFRecruitmentJobPosition $module'; $modulequalified = 1; if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { @@ -432,7 +433,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { print(empty($module->name) ? $name : $module->name); print "\n"; if (method_exists($module, 'info')) { - print $module->info($langs); + print $module->info($langs); // @phan-suppress-current-line PhanUndeclaredMethod } else { print $module->description; } diff --git a/htdocs/recruitment/admin/setup_candidatures.php b/htdocs/recruitment/admin/setup_candidatures.php index b856d4dbb9a..b91a8827eb5 100644 --- a/htdocs/recruitment/admin/setup_candidatures.php +++ b/htdocs/recruitment/admin/setup_candidatures.php @@ -409,6 +409,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { require_once $dir.'/'.$file; $module = new $classname($db); + '@phan-var-force ModelePDFRecruitmentJobPosition $module'; $modulequalified = 1; if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { @@ -423,7 +424,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { print(empty($module->name) ? $name : $module->name); print "\n"; if (method_exists($module, 'info')) { - print $module->info($langs); + print $module->info($langs); // @phan-suppress-current-line PhanUndeclaredMethod } else { print $module->description; } diff --git a/htdocs/recruitment/class/api_recruitments.class.php b/htdocs/recruitment/class/api_recruitments.class.php index bfa82e27155..1aaff616496 100644 --- a/htdocs/recruitment/class/api_recruitments.class.php +++ b/htdocs/recruitment/class/api_recruitments.class.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -136,6 +137,8 @@ class Recruitments extends DolibarrApi * @param string $properties Restrict the data returned to these properties. Ignored if empty. Comma separated list of properties names * @param bool $pagination_data If this parameter is set to true the response will include pagination data. Default value is false. Page starts from 0* * @return array Array of order objects + * @phan-return array + * @phpstan-return array * * @throws RestException * @@ -248,6 +251,8 @@ class Recruitments extends DolibarrApi * @param string $properties Restrict the data returned to these properties. Ignored if empty. Comma separated list of properties names * @param bool $pagination_data If this parameter is set to true the response will include pagination data. Default value is false. Page starts from 0* * @return array Array of order objects + * @phan-return array + * @phpstan-return array * * @throws RestException * @@ -353,6 +358,8 @@ class Recruitments extends DolibarrApi * Create jobposition object * * @param array $request_data Request datas + * @phan-param ?array $request_data + * @phpstan-param ?array $request_data * @return int ID of jobposition * * @throws RestException @@ -381,7 +388,7 @@ class Recruitments extends DolibarrApi // Clean data // $this->jobposition->abc = sanitizeVal($this->jobposition->abc, 'alphanohtml'); - if ($this->jobposition->create(DolibarrApiAccess::$user)<0) { + if ($this->jobposition->create(DolibarrApiAccess::$user) < 0) { throw new RestException(500, "Error creating jobposition", array_merge(array($this->jobposition->error), $this->jobposition->errors)); } return $this->jobposition->id; @@ -391,6 +398,8 @@ class Recruitments extends DolibarrApi * Create candidature object * * @param array $request_data Request datas + * @phan-param ?array $request_data + * @phpstan-param ?array $request_data * @return int ID of candidature * * @throws RestException @@ -419,7 +428,7 @@ class Recruitments extends DolibarrApi // Clean data // $this->jobposition->abc = sanitizeVal($this->jobposition->abc, 'alphanohtml'); - if ($this->candidature->create(DolibarrApiAccess::$user)<0) { + if ($this->candidature->create(DolibarrApiAccess::$user) < 0) { throw new RestException(500, "Error creating candidature", array_merge(array($this->candidature->error), $this->candidature->errors)); } return $this->candidature->id; @@ -430,6 +439,8 @@ class Recruitments extends DolibarrApi * * @param int $id Id of jobposition to update * @param array $request_data Datas + * @phan-param ?array $request_data + * @phpstan-param ?array $request_data * @return Object Object with cleaned properties * * @throws RestException @@ -479,6 +490,8 @@ class Recruitments extends DolibarrApi * * @param int $id Id of candidature to update * @param array $request_data Datas + * @phan-param ?array $request_data + * @phpstan-param ?array $request_data * @return Object Object with cleaned properties * * @throws RestException @@ -529,6 +542,8 @@ class Recruitments extends DolibarrApi * * @param int $id jobposition ID * @return array + * @phan-return array{success:array{code:int,message:string}} + * @phpstan-return array{success:array{code:int,message:string}} * * @throws RestException * @@ -565,6 +580,8 @@ class Recruitments extends DolibarrApi * * @param int $id candidature ID * @return array + * @phan-return array{success:array{code:int,message:string}} + * @phpstan-return array{success:array{code:int,message:string}} * * @throws RestException * @@ -663,8 +680,8 @@ class Recruitments extends DolibarrApi /** * Validate fields before create or update object * - * @param array $data Array of data to validate - * @return array + * @param array $data Array of data to validate + * @return array * * @throws RestException */ diff --git a/htdocs/recruitment/class/recruitmentcandidature.class.php b/htdocs/recruitment/class/recruitmentcandidature.class.php index b30819536c3..d5293e68fae 100644 --- a/htdocs/recruitment/class/recruitmentcandidature.class.php +++ b/htdocs/recruitment/class/recruitmentcandidature.class.php @@ -126,27 +126,93 @@ class RecruitmentCandidature extends CommonObject 'status' => array('type' => 'smallint', 'label' => 'Status', 'enabled' => 1, 'position' => 1000, 'notnull' => 1, 'visible' => 2, 'index' => 1, 'default' => '0', 'arrayofkeyval' => array('0' => 'Draft', '1' => 'Received', '3' => 'ContractProposed', '5' => 'ContractSigned', '8' => 'Refused', '9' => 'Canceled')), "ip" => array("type" => "varchar(250)", "label" => "Ip", "enabled" => "1", 'position' => 700, 'notnull' => 0, "visible" => "0", "comment" => "ip used to create record (for public submission page)"), ); + /** + * @var int + */ public $rowid; + /** + * @var int + */ public $entity; + /** + * @var string + */ public $ref; + /** + * @var int + */ public $fk_recruitmentjobposition; + /** + * @var string + */ public $description; + /** + * @var int + */ public $fk_user_creat; + /** + * @var int + */ public $fk_user_modif; + /** + * @var int + */ public $fk_user; + /** + * @var string + */ public $lastname; + /** + * @var string + */ public $firstname; + /** + * @var string + */ public $email; + /** + * @var string + */ public $phone; + /** + * @var int|string + */ public $date_birth; + /** + * @var string + */ public $email_msgid; + /** + * @var int + */ public $email_date; + /** + * @var string + */ public $remuneration_requested; + /** + * @var string + */ public $remuneration_proposed; + /** + * @var int + */ public $fk_recruitment_origin; + /** + * @var string + */ public $import_key; + /** + * @var string + */ public $model_pdf; + /** + * @var int + */ public $status; + /** + * @var string + */ public $ip; // END MODULEBUILDER PROPERTIES @@ -355,7 +421,7 @@ class RecruitmentCandidature extends CommonObject * @param string $filter Filter as an Universal Search string. * Example: '((client:=:1) OR ((client:>=:2) AND (client:<=:3))) AND (client:!=:8) AND (nom:like:'a%')' * @param string $filtermode No more used - * @return array|int int <0 if KO, array of pages if OK + * @return self[]|int int <0 if KO, array of pages if OK */ public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, $filter = '', $filtermode = 'AND') { @@ -641,9 +707,9 @@ class RecruitmentCandidature extends CommonObject /** * Set back to validated status * - * @param User $user Object user that modify - * @param int $notrigger 1=Does not execute triggers, 0=Execute triggers - * @return int Return integer <0 if KO, 0=Nothing done, >0 if OK + * @param User $user Object user that modify + * @param int<0,1> $notrigger 1=Does not execute triggers, 0=Execute triggers + * @return int Return integer <0 if KO, 0=Nothing done, >0 if OK */ public function reopen($user, $notrigger = 0) { @@ -665,9 +731,9 @@ class RecruitmentCandidature extends CommonObject /** * Return full name ('name+' '+lastname) * - * @param Translate $langs Language object for translation of civility (used only if option is 1) + * @param ?Translate $langs Language object for translation of civility (used only if option is 1) * @param int $option 0=No option - * @param int $nameorder -1=Auto, 0=Lastname+Firstname, 1=Firstname+Lastname, 2=Firstname, 3=Firstname if defined else lastname, 4=Lastname, 5=Lastname if defined else firstname + * @param int<-1,5> $nameorder -1=Auto, 0=Lastname+Firstname, 1=Firstname+Lastname, 2=Firstname, 3=Firstname if defined else lastname, 4=Lastname, 5=Lastname if defined else firstname * @param int $maxlen Maximum length * @return string String with full name */ @@ -899,7 +965,7 @@ class RecruitmentCandidature extends CommonObject /** * Create an array of lines * - * @return array|int array of lines if OK, <0 if KO + * @return RecruitmentCandidatureLine[]|int array of lines if OK, <0 if KO */ public function getLinesArray() { @@ -954,6 +1020,7 @@ class RecruitmentCandidature extends CommonObject if (class_exists($classname)) { $obj = new $classname(); + '@phan-var-force ModeleNumRefRecruitmentCandidature $module'; $numref = $obj->getNextValue($this); if ($numref != '' && $numref != '-1') { @@ -978,10 +1045,10 @@ class RecruitmentCandidature extends CommonObject * * @param string $modele Force template to use ('' to not force) * @param Translate $outputlangs object lang a utiliser pour traduction - * @param int $hidedetails Hide details of lines - * @param int $hidedesc Hide description - * @param int $hideref Hide ref - * @param null|array $moreparams Array to provide more information + * @param int<0,1> $hidedetails Hide details of lines + * @param int<0,1> $hidedesc Hide description + * @param int<0,1> $hideref Hide ref + * @param ?array $moreparams Array to provide more information * @return int 0 if KO, 1 if OK */ public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null) diff --git a/htdocs/recruitment/class/recruitmentjobposition.class.php b/htdocs/recruitment/class/recruitmentjobposition.class.php index 2bcda88a25a..1d7d604aa4c 100644 --- a/htdocs/recruitment/class/recruitmentjobposition.class.php +++ b/htdocs/recruitment/class/recruitmentjobposition.class.php @@ -130,12 +130,18 @@ class RecruitmentJobPosition extends CommonObject 'model_pdf' => array('type' => 'varchar(255)', 'label' => 'Model pdf', 'enabled' => 1, 'position' => 1010, 'notnull' => -1, 'visible' => 0,), 'status' => array('type' => 'smallint', 'label' => 'Status', 'enabled' => 1, 'position' => 1000, 'notnull' => 1, 'visible' => 5, 'default' => '0', 'index' => 1, 'arrayofkeyval' => array('0' => 'Draft', '1' => 'Validated', '3' => 'Recruited', '9' => 'Canceled'),), ); + /** + * @var int + */ public $rowid; /** * @var string ref */ public $ref; + /** + * @var int + */ public $entity; /** @@ -157,6 +163,9 @@ class RecruitmentJobPosition extends CommonObject * @var int ID project */ public $fk_project; + /** + * @var int + */ public $fk_user_recruiter; /** @@ -169,17 +178,53 @@ class RecruitmentJobPosition extends CommonObject */ public $remuneration_suggested; + /** + * @var int + */ public $fk_user_supervisor; + /** + * @var int + */ public $fk_establishment; + /** + * @var int + */ public $date_planned; + /** + * @var string + */ public $description; + /** + * @var string + */ public $note_public; + /** + * @var string + */ public $note_private; + /** + * @var int + */ public $fk_user_creat; + /** + * @var int + */ public $fk_user_modif; + /** + * @var string + */ public $last_main_doc; + /** + * @var string + */ public $import_key; + /** + * @var string + */ public $model_pdf; + /** + * @var int + */ public $status; // END MODULEBUILDER PROPERTIES @@ -384,7 +429,7 @@ class RecruitmentJobPosition extends CommonObject * @param string $filter Filter as an Universal Search string. * Example: '((client:=:1) OR ((client:>=:2) AND (client:<=:3))) AND (client:!=:8) AND (nom:like:'a%')' * @param string $filtermode No more used - * @return array|int int <0 if KO, array of pages if OK + * @return self[]|int int <0 if KO, array of pages if OK */ public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, $filter = '', $filtermode = 'AND') { @@ -1025,6 +1070,7 @@ class RecruitmentJobPosition extends CommonObject if (class_exists($classname)) { $obj = new $classname(); + '@phan-var-force ModeleNumRefRecruitmentJobPosition $module'; $numref = $obj->getNextValue($this); if ($numref != '' && $numref != '-1') { @@ -1049,10 +1095,10 @@ class RecruitmentJobPosition extends CommonObject * * @param string $modele Force template to use ('' to not force) * @param Translate $outputlangs object lang a utiliser pour traduction - * @param int $hidedetails Hide details of lines - * @param int $hidedesc Hide description - * @param int $hideref Hide ref - * @param null|array $moreparams Array to provide more information + * @param int<0,1> $hidedetails Hide details of lines + * @param int<0,1> $hidedesc Hide description + * @param int<0,1> $hideref Hide ref + * @param ?array $moreparams Array to provide more information * @return int 0 if KO, 1 if OK */ public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null) diff --git a/htdocs/recruitment/core/modules/recruitment/mod_recruitmentcandidature_standard.php b/htdocs/recruitment/core/modules/recruitment/mod_recruitmentcandidature_standard.php index ee6557c1451..8a30e86e0f2 100644 --- a/htdocs/recruitment/core/modules/recruitment/mod_recruitmentcandidature_standard.php +++ b/htdocs/recruitment/core/modules/recruitment/mod_recruitmentcandidature_standard.php @@ -38,6 +38,9 @@ class mod_recruitmentcandidature_standard extends ModeleNumRefRecruitmentCandida */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' + /** + * @var string + */ public $prefix = 'JOA'; /** diff --git a/htdocs/recruitment/core/modules/recruitment/mod_recruitmentjobposition_standard.php b/htdocs/recruitment/core/modules/recruitment/mod_recruitmentjobposition_standard.php index 00211e221d8..fdfe40d948c 100644 --- a/htdocs/recruitment/core/modules/recruitment/mod_recruitmentjobposition_standard.php +++ b/htdocs/recruitment/core/modules/recruitment/mod_recruitmentjobposition_standard.php @@ -38,6 +38,9 @@ class mod_recruitmentjobposition_standard extends ModeleNumRefRecruitmentJobPosi */ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' + /** + * @var string + */ public $prefix = 'JOB'; /** diff --git a/htdocs/recruitment/lib/recruitment.lib.php b/htdocs/recruitment/lib/recruitment.lib.php index 97690d73ea7..c3bb1d819af 100644 --- a/htdocs/recruitment/lib/recruitment.lib.php +++ b/htdocs/recruitment/lib/recruitment.lib.php @@ -1,6 +1,7 @@ * Copyright (C) 2022-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 @@ -25,7 +26,7 @@ /** * Prepare admin pages header * - * @return array + * @return array */ function recruitmentAdminPrepareHead() { diff --git a/htdocs/recruitment/lib/recruitment_recruitmentcandidature.lib.php b/htdocs/recruitment/lib/recruitment_recruitmentcandidature.lib.php index b6e8ae365d6..204f0ef192c 100644 --- a/htdocs/recruitment/lib/recruitment_recruitmentcandidature.lib.php +++ b/htdocs/recruitment/lib/recruitment_recruitmentcandidature.lib.php @@ -1,6 +1,7 @@ + * 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 @@ -26,7 +27,7 @@ * Prepare array of tabs for RecruitmentCandidature * * @param RecruitmentCandidature $object RecruitmentCandidature - * @return array Array of tabs + * @return array Array of tabs */ function recruitmentCandidaturePrepareHead($object) { diff --git a/htdocs/recruitment/lib/recruitment_recruitmentjobposition.lib.php b/htdocs/recruitment/lib/recruitment_recruitmentjobposition.lib.php index f53132fd434..1c632710b1f 100644 --- a/htdocs/recruitment/lib/recruitment_recruitmentjobposition.lib.php +++ b/htdocs/recruitment/lib/recruitment_recruitmentjobposition.lib.php @@ -1,6 +1,7 @@ + * 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 @@ -26,7 +27,7 @@ * Prepare array of tabs for RecruitmentJobPosition * * @param RecruitmentJobPosition $object RecruitmentJobPosition - * @return array Array of tabs + * @return array Array of tabs */ function recruitmentjobpositionPrepareHead($object) { diff --git a/htdocs/recruitment/recruitmentcandidature_agenda.php b/htdocs/recruitment/recruitmentcandidature_agenda.php index b3f3a36de15..f46fc080835 100644 --- a/htdocs/recruitment/recruitmentcandidature_agenda.php +++ b/htdocs/recruitment/recruitmentcandidature_agenda.php @@ -1,6 +1,7 @@ * Copyright (C) ---Put here your own copyright and developer email--- + * 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 @@ -98,7 +99,7 @@ $result = restrictedArea($user, 'recruitment', $object->id, 'recruitment_recruit * Actions */ -$parameters = array('id'=>$id); +$parameters = array('id' => $id); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); @@ -144,7 +145,7 @@ if ($object->id > 0) { $linkback = ''.$langs->trans("BackToList").''; $morehtmlref = '
'; - $morehtmlref.= $object->getFullName('', 1); + $morehtmlref .= $object->getFullName(null, 1); /* // Ref customer $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); diff --git a/htdocs/recruitment/recruitmentcandidature_card.php b/htdocs/recruitment/recruitmentcandidature_card.php index 5e24742cd0c..7025b1758dd 100644 --- a/htdocs/recruitment/recruitmentcandidature_card.php +++ b/htdocs/recruitment/recruitmentcandidature_card.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -441,7 +442,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $linkback = ''.$langs->trans("BackToList").''; $morehtmlref = '
'; - $morehtmlref.= $object->getFullName('', 1); + $morehtmlref .= $object->getFullName(null, 1); /* // Ref customer $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); diff --git a/htdocs/recruitment/recruitmentcandidature_document.php b/htdocs/recruitment/recruitmentcandidature_document.php index 19aaae140d2..89c7c3abf59 100644 --- a/htdocs/recruitment/recruitmentcandidature_document.php +++ b/htdocs/recruitment/recruitmentcandidature_document.php @@ -1,6 +1,7 @@ * Copyright (C) ---Put here your own copyright and developer email--- + * 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 @@ -121,7 +122,7 @@ if ($object->id) { $linkback = ''.$langs->trans("BackToList").''; $morehtmlref = '
'; - $morehtmlref.= $object->getFullName('', 1); + $morehtmlref .= $object->getFullName(null, 1); /* // Ref customer $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); diff --git a/htdocs/recruitment/recruitmentcandidature_list.php b/htdocs/recruitment/recruitmentcandidature_list.php index 75fb5820fd1..26f5ecc6ccc 100644 --- a/htdocs/recruitment/recruitmentcandidature_list.php +++ b/htdocs/recruitment/recruitmentcandidature_list.php @@ -1,6 +1,7 @@ * 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 @@ -652,7 +653,7 @@ foreach ($object->fields as $key => $val) { } 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/recruitment/recruitmentcandidature_note.php b/htdocs/recruitment/recruitmentcandidature_note.php index 33958bd0b3f..e27cc3c8266 100644 --- a/htdocs/recruitment/recruitmentcandidature_note.php +++ b/htdocs/recruitment/recruitmentcandidature_note.php @@ -1,6 +1,7 @@ * Copyright (C) ---Put here your own copyright and developer email--- + * 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 @@ -96,7 +97,7 @@ if ($id > 0 || !empty($ref)) { $linkback = ''.$langs->trans("BackToList").''; $morehtmlref = '
'; - $morehtmlref.= $object->getFullName('', 1); + $morehtmlref .= $object->getFullName(null, 1); /* // Ref customer $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); diff --git a/htdocs/recruitment/recruitmentjobposition_applications.php b/htdocs/recruitment/recruitmentjobposition_applications.php index 9fda96d6a95..681fb80e402 100644 --- a/htdocs/recruitment/recruitmentjobposition_applications.php +++ b/htdocs/recruitment/recruitmentjobposition_applications.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -128,7 +129,7 @@ if (empty($reshook)) { include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; if ($action == 'set_thirdparty' && $permissiontoadd) { - $object->setValueFrom('fk_soc', GETPOSTINT('fk_soc'), '', '', 'date', '', $user, 'RECRUITMENTJOBPOSITION_MODIFY'); + $object->setValueFrom('fk_soc', GETPOSTINT('fk_soc'), '', null, 'date', '', $user, 'RECRUITMENTJOBPOSITION_MODIFY'); } if ($action == 'classin' && $permissiontoadd) { $object->setProject(GETPOSTINT('projectid')); diff --git a/htdocs/recruitment/recruitmentjobposition_card.php b/htdocs/recruitment/recruitmentjobposition_card.php index 68216927dad..b7030f3aad1 100644 --- a/htdocs/recruitment/recruitmentjobposition_card.php +++ b/htdocs/recruitment/recruitmentjobposition_card.php @@ -1,6 +1,7 @@ * 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 @@ -131,7 +132,7 @@ if (empty($reshook)) { include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; if ($action == 'set_thirdparty' && $permissiontoadd) { - $object->setValueFrom('fk_soc', GETPOSTINT('fk_soc'), '', '', 'date', '', $user, $triggermodname); + $object->setValueFrom('fk_soc', GETPOSTINT('fk_soc'), '', null, 'date', '', $user, $triggermodname); } if ($action == 'classin' && $permissiontoadd) { $object->setProject(GETPOSTINT('projectid')); @@ -281,7 +282,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $text = ""; //Form to close proposal (signed or not) $formquestion = array( - array('type' => 'select', 'name' => 'status', 'label' => ''.$langs->trans("CloseAs").'', 'values' => array(3=>$object->LibStatut($object::STATUS_RECRUITED), 9=>$object->LibStatut($object::STATUS_CANCELED))), + array('type' => 'select', 'name' => 'status', 'label' => ''.$langs->trans("CloseAs").'', 'values' => array(3 => $object->LibStatut($object::STATUS_RECRUITED), 9 => $object->LibStatut($object::STATUS_CANCELED))), array('type' => 'text', 'name' => 'note_private', 'label' => $langs->trans("Note"), 'value' => '') // Field to complete private note (not replace) );