Qual: Fix phan/phpstan notices (#31297)

# Qual: Fix phan/phpstan notices

Fix several phan and phpstan notices.
This commit is contained in:
MDW 2024-10-07 14:07:24 +02:00 committed by GitHub
parent 9b378d74af
commit f4c91d5bb6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
34 changed files with 418 additions and 124 deletions

View File

@ -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'],

View File

@ -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<array{0:string,1:string,2:string}> head array with tabs
*/
function reception_admin_prepare_head()
{

View File

@ -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';

View File

@ -33,6 +33,9 @@ class mod_reception_moonstone extends ModelNumRefReception
{
public $version = 'dolibarr';
public $error = '';
/**
* @var string
*/
public $nom = 'Moonstone';
/**

View File

@ -285,6 +285,9 @@ class CommandeFournisseur extends CommonOrder
* @var int Date of the purchase order payment deadline
*/
public $date_lim_reglement;
/**
* @var array<int,float>
*/
public $receptions = array();
// Multicurrency

View File

@ -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)
{

View File

@ -233,10 +233,11 @@ if (empty($reshook) && $action == 'add') { // Test on permission not required he
$errmsg .= $langs->trans("ErrorBadEMail", GETPOST("email"))."<br>\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;

View File

@ -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;

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2020 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* 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 = "";

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2023-2024 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2023-2024 Lionel Vessiller <lvessiller@easya.solutions>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* 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

View File

@ -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<string,int> $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();

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2022 Quatadah Nasdami <quatadah.nasdami@gmail.com>
* Copyright (C) 2022 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* 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<array<string,mixed>>
* @phpstan-return array<array<string,mixed>>
*
* @throws RestException
*/
@ -197,6 +200,8 @@ class Receptions extends DolibarrApi
* Create reception object
*
* @param array $request_data Request data
* @phan-param ?array<string,string|mixed[]> $request_data
* @phpstan-param ?array<string,string|mixed[]> $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<string,string> $request_data
* @phpstan-param ?array<string,string> $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<string,mixed> $data Array with data to verify
* @return array<string,mixed>
* @throws RestException
*/
private function _validate($data)

View File

@ -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<int,string>
*/
public $meths;
/**
* @var array<array{rowid:int,code:string,libelle:string,description:string,tracking:string,active:string}>
*/
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<string, mixed> $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
}
}
}

View File

@ -3,6 +3,7 @@
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 Christophe Battarel <christophe@altairis.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* 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<string,mixed> $filter filter array
* @param string $filtermode filter mode (AND or OR)
* @return int Return integer <0 if KO, >0 if OK
*/

View File

@ -3,6 +3,7 @@
* Copyright (c) 2005-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* 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<int<0,11>,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{0:int,1:int}> 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<int<0,11>,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<int<0,11>,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{year:string,nb:string,nb_diff:float,total_diff:float,avg_diff:float,avg_weighted:float}> Array with nb, total amount, average for each year
*/
public function getAllByYear()
{

View File

@ -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;

View File

@ -255,7 +255,7 @@ print '</tr>';
$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--;

View File

@ -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 "</td><td>\n";
if (method_exists($module, 'info')) {
print $module->info($langs);
print $module->info($langs); // @phan-suppress-current-line PhanUndeclaredMethod
} else {
print $module->description;
}

View File

@ -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 "</td><td>\n";
if (method_exists($module, 'info')) {
print $module->info($langs);
print $module->info($langs); // @phan-suppress-current-line PhanUndeclaredMethod
} else {
print $module->description;
}

View File

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2022 Thibault FOUCART <support@ptibogxiv.net>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* 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<string,mixed>
* @phpstan-return array<string,mixed>
*
* @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<string,mixed>
* @phpstan-return array<string,mixed>
*
* @throws RestException
*
@ -353,6 +358,8 @@ class Recruitments extends DolibarrApi
* Create jobposition object
*
* @param array $request_data Request datas
* @phan-param ?array<string,string> $request_data
* @phpstan-param ?array<string,string> $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<string,string> $request_data
* @phpstan-param ?array<string,string> $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<string,string> $request_data
* @phpstan-param ?array<string,string> $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<string,mixed> $request_data
* @phpstan-param ?array<string,mixed> $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<string,mixed> $data Array of data to validate
* @return array<string,mixed>
*
* @throws RestException
*/

View File

@ -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<string,mixed> $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)

View File

@ -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<string,mixed> $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)

View File

@ -38,6 +38,9 @@ class mod_recruitmentcandidature_standard extends ModeleNumRefRecruitmentCandida
*/
public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr'
/**
* @var string
*/
public $prefix = 'JOA';
/**

View File

@ -38,6 +38,9 @@ class mod_recruitmentjobposition_standard extends ModeleNumRefRecruitmentJobPosi
*/
public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr'
/**
* @var string
*/
public $prefix = 'JOB';
/**

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2019 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2022-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* 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<array{0:string,1:string,2:string}>
*/
function recruitmentAdminPrepareHead()
{

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) ---Put here your own copyright and developer email---
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* 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{0:string,1:string,2:string}> Array of tabs
*/
function recruitmentCandidaturePrepareHead($object)
{

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) ---Put here your own copyright and developer email---
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* 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{0:string,1:string,2:string}> Array of tabs
*/
function recruitmentjobpositionPrepareHead($object)
{

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) ---Put here your own copyright and developer email---
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* 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 = '<a href="'.dol_buildpath('/recruitment/recruitmentcandidature_list.php', 1).'?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
$morehtmlref = '<div class="refidno">';
$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);

View File

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2020 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* 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 = '<a href="'.dol_buildpath('/recruitment/recruitmentcandidature_list.php', 1).'?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
$morehtmlref = '<div class="refidno">';
$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);

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) ---Put here your own copyright and developer email---
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* 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 = '<a href="'.dol_buildpath('/recruitment/recruitmentcandidature_list.php', 1).'?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
$morehtmlref = '<div class="refidno">';
$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);

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* 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 '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag(isset($search[$key]) ? $search[$key] : '').'">';
}

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) ---Put here your own copyright and developer email---
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* 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 = '<a href="'.dol_buildpath('/recruitment/recruitmentjobposition_list.php', 1).'?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
$morehtmlref = '<div class="refidno">';
$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);

View File

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* 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'));

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* 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' => '<span class="fieldrequired">'.$langs->trans("CloseAs").'</span>', 'values' => array(3=>$object->LibStatut($object::STATUS_RECRUITED), 9=>$object->LibStatut($object::STATUS_CANCELED))),
array('type' => 'select', 'name' => 'status', 'label' => '<span class="fieldrequired">'.$langs->trans("CloseAs").'</span>', '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)
);