Qual: Fix phan notices (recruitment)

This commit is contained in:
MDW 2025-02-13 18:32:41 +01:00
parent 1910ca079f
commit c405666765
No known key found for this signature in database
22 changed files with 162 additions and 167 deletions

View file

@ -9,11 +9,11 @@
*/
return [
// # Issue statistics:
// PhanTypeMismatchArgument : 1760+ occurrences
// PhanUndeclaredProperty : 500+ occurrences
// PhanTypeMismatchArgumentNullable : 360+ occurrences
// PhanTypeMismatchArgument : 1730+ occurrences
// PhanUndeclaredProperty : 510+ occurrences
// PhanTypeMismatchArgumentNullable : 350+ occurrences
// PhanPluginUnknownArrayMethodReturnType : 170+ occurrences
// PhanUndeclaredGlobalVariable : 170+ occurrences
// PhanUndeclaredGlobalVariable : 160+ occurrences
// PhanTypeMismatchProperty : 120+ occurrences
// PhanPluginUnknownArrayMethodParamType : 110+ occurrences
// PhanTypeMismatchArgumentProbablyReal : 75+ occurrences
@ -27,7 +27,6 @@ return [
// PhanUndeclaredMethod : 10+ occurrences
// PhanTypeComparisonFromArray : 8 occurrences
// PhanPluginDuplicateExpressionBinaryOp : 6 occurrences
// PhanPluginUnknownObjectMethodCall : 6 occurrences
// PhanTypeArraySuspiciousNull : 6 occurrences
// PhanParamTooMany : 5 occurrences
// PhanPluginDuplicateArrayKey : 4 occurrences
@ -35,7 +34,6 @@ return [
// PhanEmptyFQSENInClasslike : 3 occurrences
// PhanInvalidFQSENInClasslike : 3 occurrences
// PhanPluginBothLiteralsBinaryOp : 3 occurrences
// PhanEmptyForeach : 2 occurrences
// PhanPluginEmptyStatementIf : 2 occurrences
// PhanRedefineFunction : 2 occurrences
// PhanTypeMismatchDimAssignment : 2 occurrences
@ -223,10 +221,9 @@ return [
'htdocs/compta/bank/releve.php' => ['PhanTypeMismatchArgument'],
'htdocs/compta/bank/transfer.php' => ['PhanTypeMismatchArgument'],
'htdocs/compta/bank/treso.php' => ['PhanTypeMismatchArgument'],
'htdocs/compta/bank/various_payment/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgument', 'PhanUndeclaredProperty'],
'htdocs/compta/bank/various_payment/document.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanTypeMismatchArgument', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/compta/bank/various_payment/info.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanTypeMismatchArgument', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/compta/bank/various_payment/list.php' => ['PhanTypeMismatchArgument'],
'htdocs/compta/bank/various_payment/card.php' => ['PhanUndeclaredProperty'],
'htdocs/compta/bank/various_payment/document.php' => ['PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/compta/bank/various_payment/info.php' => ['PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/compta/cashcontrol/cashcontrol_card.php' => ['PhanPluginDuplicateExpressionBinaryOp'],
'htdocs/compta/cashcontrol/cashcontrol_list.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchProperty'],
'htdocs/compta/charges/index.php' => ['PhanTypeMismatchArgumentNullable'],
@ -627,23 +624,18 @@ return [
'htdocs/reception/class/api_receptions.class.php' => ['PhanTypeMismatchArgumentNullable'],
'htdocs/reception/class/reception.class.php' => ['PhanUndeclaredProperty'],
'htdocs/reception/list.php' => ['PhanUndeclaredProperty'],
'htdocs/recruitment/admin/setup.php' => ['PhanEmptyForeach'],
'htdocs/recruitment/admin/setup_candidatures.php' => ['PhanEmptyForeach'],
'htdocs/recruitment/class/api_recruitments.class.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable'],
'htdocs/recruitment/class/recruitmentcandidature.class.php' => ['PhanUndeclaredProperty'],
'htdocs/recruitment/class/recruitmentjobposition.class.php' => ['PhanUndeclaredProperty'],
'htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php' => ['PhanTypeMismatchArgumentNullable', 'PhanUndeclaredProperty'],
'htdocs/recruitment/core/modules/recruitment/mod_recruitmentcandidature_advanced.php' => ['PhanTypeMismatchArgument', 'PhanUndeclaredProperty'],
'htdocs/recruitment/core/modules/recruitment/mod_recruitmentjobposition_advanced.php' => ['PhanTypeMismatchArgument', 'PhanUndeclaredProperty'],
'htdocs/recruitment/index.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/recruitment/recruitmentcandidature_card.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'],
'htdocs/recruitment/recruitmentcandidature_list.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanTypeMismatchArgument', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/recruitment/recruitmentjobposition_agenda.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanTypeMismatchArgument', 'PhanUndeclaredGlobalVariable'],
'htdocs/recruitment/recruitmentjobposition_applications.php' => ['PhanTypeMismatchArgument', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/recruitment/recruitmentjobposition_card.php' => ['PhanTypeMismatchArgument', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/recruitment/recruitmentjobposition_document.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanTypeMismatchArgument', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/recruitment/recruitmentjobposition_list.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/recruitment/recruitmentjobposition_note.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanTypeMismatchArgument', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php' => ['PhanUndeclaredProperty'],
'htdocs/recruitment/core/modules/recruitment/mod_recruitmentcandidature_advanced.php' => ['PhanUndeclaredProperty'],
'htdocs/recruitment/core/modules/recruitment/mod_recruitmentjobposition_advanced.php' => ['PhanUndeclaredProperty'],
'htdocs/recruitment/recruitmentcandidature_card.php' => ['PhanUndeclaredProperty'],
'htdocs/recruitment/recruitmentcandidature_list.php' => ['PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/recruitment/recruitmentjobposition_agenda.php' => ['PhanUndeclaredProperty'],
'htdocs/recruitment/recruitmentjobposition_applications.php' => ['PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/recruitment/recruitmentjobposition_card.php' => ['PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/recruitment/recruitmentjobposition_document.php' => ['PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/recruitment/recruitmentjobposition_note.php' => ['PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/resource/card.php' => ['PhanTypeMismatchArgument'],
'htdocs/resource/class/dolresource.class.php' => ['PhanTypeMismatchArgumentNullable'],
'htdocs/resource/class/html.formresource.class.php' => ['PhanTypeMismatchArgument'],

View file

@ -228,12 +228,17 @@ return [
'actioncode' => 'string',
'badgeStatus0' => 'string',
'badgeStatus1' => 'string',
'badgeStatus11' => 'string',
'badgeStatus3' => 'string',
'badgeStatus4' => 'string',
'badgeStatus5' => 'string',
'badgeStatus6' => 'string',
'badgeStatus7' => 'string',
'badgeStatus8' => 'string',
'badgeStatus9' => 'string',
'badgeStatus10' => 'string',
'badgeStatus11' => 'string',
'badgeStatus4b' => 'string',
'badgeStatus8b' => 'string',
'classname' => 'string',
'conf' => '\Conf',
'conffile' => 'string',

View file

@ -295,7 +295,7 @@ class PaymentVarious extends CommonObject
* Load object in memory from database
*
* @param int $id id object
* @param User $user User that load
* @param ?User $user User that load
* @return int Return integer <0 if KO, >0 if OK
*/
public function fetch($id, $user = null)

View file

@ -105,8 +105,8 @@ if (empty($reshook)) {
header("Location: ".$urltogo);
exit;
}
if ($id > 0 || !empty($ref)) {
$ret = $object->fetch($id, $ref);
if ($id > 0) {
$ret = $object->fetch($id);
}
$action = '';
}
@ -221,14 +221,13 @@ if (empty($reshook)) {
$ret = $object->delete($user);
if ($ret > 0) {
$accountline = null;
if ($object->fk_bank) {
$accountline = new AccountLine($db);
$result = $accountline->fetch($object->fk_bank);
if ($result > 0) {
$result = $accountline->delete($user); // $result may be 0 if not found (when bank entry was deleted manually and fk_bank point to nothing)
}
} else {
$account_line = null;
}
if ($result >= 0) {
@ -630,7 +629,7 @@ if ($id) {
$morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
$morehtmlref .= '</form>';
} else {
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, (property_exists($object, 'socid') ? $object->socid : 0), $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300');
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, (property_exists($object, 'socid') ? $object->socid : 0), (string) $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300');
}
} else {
if (!empty($object->fk_project)) {
@ -685,7 +684,7 @@ if ($id) {
if (isModEnabled('accounting')) {
/** @var FormAccounting $formaccounting */
print '<tr><td class="nowrap">';
print $form->editfieldkey('AccountAccounting', 'accountancy_code', $object->accountancy_code, $object, (!$alreadyaccounted && $permissiontoadd), 'string', '', 0);
print $form->editfieldkey('AccountAccounting', 'accountancy_code', $object->accountancy_code, $object, (int) (!$alreadyaccounted && $permissiontoadd), 'string', '', 0);
print '</td><td>';
if ($action == 'editaccountancy_code' && (!$alreadyaccounted && $permissiontoadd)) {
//print $form->editfieldval('AccountAccounting', 'accountancy_code', $object->accountancy_code, $object, (!$alreadyaccounted && $user->hasRight('banque', 'modifier')), 'string', '', 0);
@ -707,7 +706,7 @@ if ($id) {
// Subledger account
print '<tr><td class="nowrap">';
print $form->editfieldkey('SubledgerAccount', 'subledger_account', $object->subledger_account, $object, (!$alreadyaccounted && $permissiontoadd), 'string', '', 0);
print $form->editfieldkey('SubledgerAccount', 'subledger_account', $object->subledger_account, $object, (int) (!$alreadyaccounted && $permissiontoadd), 'string', '', 0);
print '</td><td>';
if ($action == 'editsubledger_account' && (!$alreadyaccounted && $permissiontoadd)) {
if (getDolGlobalString('ACCOUNTANCY_COMBO_FOR_AUX')) {

View file

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2017 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -75,7 +75,7 @@ if (!$sortfield) {
$object = new PaymentVarious($db);
$object->fetch($id, $ref);
$object->fetch($id);
$upload_dir = $conf->bank->dir_output.'/'.dol_sanitizeFileName((string) $object->id);
$modulepart = 'banque';
@ -109,6 +109,7 @@ if ($object->id) {
$morehtmlref = '<div class="refidno">';
// Project
if (isModEnabled('project')) {
$formproject = new FormProjets($db);
$langs->load("projects");
if ($user->hasRight('banque', 'modifier') && 0) {
if ($action != 'classify') {
@ -119,11 +120,11 @@ if ($object->id) {
$morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
$morehtmlref .= '<input type="hidden" name="action" value="classin">';
$morehtmlref .= '<input type="hidden" name="token" value="'.newToken().'">';
$morehtmlref .= $formproject->select_projects(0, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref .= $formproject->select_projects(0, (string) $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
$morehtmlref .= '</form>';
} else {
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1, '', 'maxwidth300');
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, (string) $object->fk_project, 'none', 0, 0, 0, 1, '', 'maxwidth300');
}
} else {
if (!empty($object->fk_project)) {

View file

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2017 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -78,6 +78,7 @@ print dol_get_fiche_head($head, 'info', $langs->trans("VariousPayment"), -1, $ob
$morehtmlref = '<div class="refidno">';
// Project
if (isModEnabled('project')) {
$formproject = new FormProjets($db);
$langs->load("projects");
if ($user->hasRight('banque', 'modifier') && 0) {
if ($action != 'classify') {
@ -88,11 +89,11 @@ if (isModEnabled('project')) {
$morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
$morehtmlref .= '<input type="hidden" name="action" value="classin">';
$morehtmlref .= '<input type="hidden" name="token" value="'.newToken().'">';
$morehtmlref .= $formproject->select_projects(0, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref .= $formproject->select_projects(0, (string) $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
$morehtmlref .= '</form>';
} else {
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1, '', 'maxwidth300');
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, (string) $object->fk_project, 'none', 0, 0, 0, 1, '', 'maxwidth300');
}
} else {
if (!empty($object->fk_project)) {

View file

@ -3,7 +3,7 @@
* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2020 Tobias Sekan <tobias.sekan@startmail.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 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
@ -169,22 +169,22 @@ $fieldstosearchall = array(
// Definition of fields for lists
$arrayfields = array(
'ref' => array('label' => "Ref", 'checked' => 1, 'position' => 100),
'label' => array('label' => "Label", 'checked' => 1, 'position' => 110),
'datep' => array('label' => "DatePayment", 'checked' => 1, 'position' => 120),
'datev' => array('label' => "DateValue", 'checked' => -1, 'position' => 130),
'type' => array('label' => "PaymentMode", 'checked' => 1, 'position' => 140),
'project' => array('label' => "Project", 'checked' => -1, 'position' => 200, "enabled" => isModEnabled('project')),
'bank' => array('label' => "BankAccount", 'checked' => 1, 'position' => 300, "enabled" => isModEnabled("bank")),
'entry' => array('label' => "BankTransactionLine", 'checked' => 1, 'position' => 310, "enabled" => isModEnabled("bank")),
'account' => array('label' => "AccountAccountingShort", 'checked' => 1, 'position' => 400, "enabled" => isModEnabled('accounting')),
'subledger' => array('label' => "SubledgerAccount", 'checked' => 1, 'position' => 410, "enabled" => isModEnabled('accounting')),
'debit' => array('label' => "Debit", 'checked' => 1, 'position' => 500),
'credit' => array('label' => "Credit", 'checked' => 1, 'position' => 510),
'ref' => array('label' => "Ref", 'checked' => '1', 'position' => 100),
'label' => array('label' => "Label", 'checked' => '1', 'position' => 110),
'datep' => array('label' => "DatePayment", 'checked' => '1', 'position' => 120),
'datev' => array('label' => "DateValue", 'checked' => '-1', 'position' => 130),
'type' => array('label' => "PaymentMode", 'checked' => '1', 'position' => 140),
'project' => array('label' => "Project", 'checked' => '-1', 'position' => 200, "enabled" => (string) (int) isModEnabled('project')),
'bank' => array('label' => "BankAccount", 'checked' => '1', 'position' => 300, "enabled" => (string) (int) isModEnabled("bank")),
'entry' => array('label' => "BankTransactionLine", 'checked' => '1', 'position' => 310, "enabled" => (string) (int) isModEnabled("bank")),
'account' => array('label' => "AccountAccountingShort", 'checked' => '1', 'position' => 400, "enabled" => (string) (int) isModEnabled('accounting')),
'subledger' => array('label' => "SubledgerAccount", 'checked' => '1', 'position' => 410, "enabled" => (string) (int) isModEnabled('accounting')),
'debit' => array('label' => "Debit", 'checked' => '1', 'position' => 500),
'credit' => array('label' => "Credit", 'checked' => '1', 'position' => 510),
);
$arrayfields = dol_sort_array($arrayfields, 'position');
'@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan
// '@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan
// Security check
$socid = GETPOSTINT("socid");

View file

@ -212,7 +212,7 @@ if ($action == 'edit') {
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
foreach ($arrayofparameters as $key => $val) {
foreach ($arrayofparameters as $key => $val) { // @phan-suppress-current-line PhanEmptyForeach
print '<tr class="oddeven"><td>';
$tooltiphelp = (($langs->trans($key.'Tooltip') != $key.'Tooltip') ? $langs->trans($key.'Tooltip') : '');
print $form->textwithpicto($langs->trans($key), $tooltiphelp);

View file

@ -204,7 +204,7 @@ if ($action == 'edit') {
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
foreach ($arrayofparameters as $key => $val) {
foreach ($arrayofparameters as $key => $val) { // @phan-suppress-current-line PhanEmptyForeach
print '<tr class="oddeven"><td>';
$tooltiphelp = (($langs->trans($key.'Tooltip') != $key.'Tooltip') ? $langs->trans($key.'Tooltip') : '');
print $form->textwithpicto($langs->trans($key), $tooltiphelp);

View file

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2022 Thibault FOUCART <support@ptibogxiv.net>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 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
@ -38,11 +38,11 @@ dol_include_once('/recruitment/class/recruitmentcandidature.class.php');
class Recruitments extends DolibarrApi
{
/**
* @var RecruitmentJobPosition $jobposition {@type RecruitmentJobPosition}
* @var RecruitmentJobPosition {@type RecruitmentJobPosition}
*/
public $jobposition;
/**
* @var RecruitmentCandidature $candidature {@type RecruitmentCandidature}
* @var RecruitmentCandidature {@type RecruitmentCandidature}
*/
public $candidature;
@ -51,7 +51,6 @@ class Recruitments extends DolibarrApi
* Constructor
*
* @url GET /
*
*/
public function __construct()
{
@ -357,9 +356,9 @@ 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
* @param array $request_data Request data
* @phan-param ?array<string,mixed> $request_data
* @phpstan-param ?array<string,mixed> $request_data
* @return int ID of jobposition
*
* @throws RestException
@ -395,17 +394,17 @@ class Recruitments extends DolibarrApi
}
/**
* Create candidature object
*
* @param array $request_data Request datas
* Create candidature object
*
* @param array $request_data Request data
* @phan-param ?array<string,string> $request_data
* @phpstan-param ?array<string,string> $request_data
* @return int ID of candidature
*
* @throws RestException
*
* @url POST candidature/
*/
* @return int ID of candidature
*
* @throws RestException
*
* @url POST candidature/
*/
public function postCandidature($request_data = null)
{
if (!DolibarrApiAccess::$user->hasRight('recruitment', 'recruitmentjobposition', 'write')) {
@ -438,9 +437,9 @@ class Recruitments extends DolibarrApi
* Update jobposition
*
* @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
* @param array $request_data Data
* @phan-param ?array<string,mixed> $request_data
* @phpstan-param ?array<string,mixed> $request_data
* @return Object Object with cleaned properties
*
* @throws RestException
@ -478,7 +477,7 @@ class Recruitments extends DolibarrApi
// Clean data
// $this->jobposition->abc = sanitizeVal($this->jobposition->abc, 'alphanohtml');
if ($this->jobposition->update(DolibarrApiAccess::$user, false) > 0) {
if ($this->jobposition->update(DolibarrApiAccess::$user, 0) > 0) {
return $this->getJobPosition($id);
} else {
throw new RestException(500, $this->jobposition->error);
@ -529,7 +528,7 @@ class Recruitments extends DolibarrApi
// Clean data
// $this->jobposition->abc = sanitizeVal($this->jobposition->abc, 'alphanohtml');
if ($this->candidature->update(DolibarrApiAccess::$user, false) > 0) {
if ($this->candidature->update(DolibarrApiAccess::$user, 0) > 0) {
return $this->getCandidature($id);
} else {
throw new RestException(500, $this->candidature->error);
@ -680,13 +679,16 @@ class Recruitments extends DolibarrApi
/**
* Validate fields before create or update object
*
* @param array<string,mixed> $data Array of data to validate
* @param ?array<string,mixed> $data Array of data to validate
* @return array<string,mixed>
*
* @throws RestException
*/
private function _validate($data)
{
if ($data === null) {
$data = array();
}
$jobposition = array();
foreach ($this->jobposition->fields as $field => $propfield) {
if (in_array($field, array('rowid', 'entity', 'date_creation', 'tms', 'fk_user_creat')) || $propfield['notnull'] != 1) {

View file

@ -707,11 +707,11 @@ class RecruitmentJobPosition extends CommonObject
/**
* Close the recruitment
*
* @param User $user Object user that close
* @param int $status Statut
* @param string $note Complete private note with this note
* @param int $notrigger 1=Does not execute triggers, 0=Execute triggers
* @return int Return integer <0 if KO, >0 if OK
* @param User $user Object user that close
* @param int $status Statut
* @param string $note Complete private note with this note
* @param int<0,1> $notrigger 1=Does not execute triggers, 0=Execute triggers
* @return int Return integer <0 if KO, >0 if OK
*/
public function cloture($user, $status, $note = "", $notrigger = 0)
{
@ -792,9 +792,9 @@ class RecruitmentJobPosition 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)
{
@ -816,12 +816,12 @@ class RecruitmentJobPosition extends CommonObject
/**
* Return a link to the object card (with optionally the picto)
*
* @param int $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto)
* @param string $option On what the link point to ('nolink', ...)
* @param int $notooltip 1=Disable tooltip
* @param string $morecss Add more css on link
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @return string String with URL
* @param int<0,2> $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto)
* @param string $option On what the link point to ('nolink', ...)
* @param int<0,1> $notooltip 1=Disable tooltip
* @param string $morecss Add more css on link
* @param int<-1,1> $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @return string String with URL
*/
public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1)
{
@ -924,8 +924,8 @@ class RecruitmentJobPosition extends CommonObject
/**
* Return label of the status
*
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
* @param int<0,6> $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function getLibStatut($mode = 0)
{
@ -936,8 +936,8 @@ class RecruitmentJobPosition extends CommonObject
/**
* Return the status
*
* @param int $status Id status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @param int $status Id status
* @param int<0,6> $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function LibStatut($status, $mode = 0)
@ -1015,7 +1015,7 @@ class RecruitmentJobPosition extends CommonObject
/**
* Create an array of lines
*
* @return array|int array of lines if OK, <0 if KO
* @return CommonObjectLine[]|int array of lines if OK, <0 if KO
*/
public function getLinesArray()
{

View file

@ -10,7 +10,7 @@
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 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
@ -666,15 +666,15 @@ class pdf_standard_recruitmentjobposition extends ModelePDFRecruitmentJobPositio
/**
* Show table for lines
*
* @param tcpdf $pdf Object PDF
* @param float|int $tab_top Top position of table
* @param float|int $tab_height Height of table (rectangle)
* @param int $nexY Y (not used)
* @param TCPDI|TCPDF $pdf Object PDF
* @param float $tab_top Top position of table
* @param float $tab_height Height of table (rectangle)
* @param float $nexY Y (not used)
* @param Translate $outputlangs Langs object
* @param int $hidetop 1=Hide top bar of array and title, 0=Hide nothing, -1=Hide only title
* @param int $hidebottom Hide bottom bar of array
* @param int<0,1> $hidetop 1=Hide top bar of array and title, 0=Hide nothing, -1=Hide only title
* @param int<0,1> $hidebottom Hide bottom bar of array
* @param string $currency Currency code
* @param Translate $outputlangsbis Langs object bis
* @param ?Translate $outputlangsbis Langs object bis
* @return void
*/
protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '', $outputlangsbis = null)
@ -718,12 +718,12 @@ class pdf_standard_recruitmentjobposition extends ModelePDFRecruitmentJobPositio
/**
* Show top header of page.
*
* @param TCPDF $pdf Object PDF
* @param TCPDI|TCPDF $pdf Object PDF
* @param RecruitmentJobPosition $object Object to show
* @param int $showaddress 0=no, 1=yes
* @param int<0,1> $showaddress 0=no, 1=yes
* @param Translate $outputlangs Object lang for output
* @param Translate $outputlangsbis Object lang for output bis
* @return float|int Return topshift value
* @param ?Translate $outputlangsbis Object lang for output bis
* @return float Return topshift value
*/
protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $outputlangsbis = null)
{
@ -960,10 +960,10 @@ class pdf_standard_recruitmentjobposition extends ModelePDFRecruitmentJobPositio
/**
* Show footer of page. Need this->emetteur object
*
* @param TCPDF $pdf PDF
* @param TCPDI|TCPDF $pdf PDF
* @param RecruitmentJobPosition $object Object to show
* @param Translate $outputlangs Object lang for output
* @param int $hidefreetext 1=Hide free text
* @param int<0,1> $hidefreetext 1=Hide free text
* @return int Return height of bottom margin including footer text
*/
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
@ -978,9 +978,9 @@ class pdf_standard_recruitmentjobposition extends ModelePDFRecruitmentJobPositio
*
* @param object $object common object
* @param Translate $outputlangs langs
* @param int $hidedetails Do not show line details
* @param int $hidedesc Do not show desc
* @param int $hideref Do not show ref
* @param int<0,1> $hidedetails Do not show line details
* @param int<0,1> $hidedesc Do not show desc
* @param int<0,1> $hideref Do not show ref
* @return void
*/
public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0)

View file

@ -4,7 +4,7 @@
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
* Copyright (C) 2019-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 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
@ -101,15 +101,10 @@ class mod_recruitmentcandidature_advanced extends ModeleNumRefRecruitmentCandida
*/
public function getExample()
{
global $langs, $mysoc;
global $langs, $db;
$old_code_client = $mysoc->code_client;
$old_code_type = $mysoc->typent_code;
$mysoc->code_client = 'CCCCCCCCCC';
$mysoc->typent_code = 'TTTTTTTTTT';
$numExample = $this->getNextValue($mysoc);
$mysoc->code_client = $old_code_client;
$mysoc->typent_code = $old_code_type;
$object = new RecruitmentCandidature($db);
$numExample = $this->getNextValue($object);
if (!$numExample) {
$numExample = $langs->trans('NotConfigured');

View file

@ -4,7 +4,7 @@
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
* Copyright (C) 2019-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 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
@ -101,15 +101,10 @@ class mod_recruitmentjobposition_advanced extends ModeleNumRefRecruitmentJobPosi
*/
public function getExample()
{
global $langs, $mysoc;
global $langs, $db;
$old_code_client = $mysoc->code_client;
$old_code_type = $mysoc->typent_code;
$mysoc->code_client = 'CCCCCCCCCC';
$mysoc->typent_code = 'TTTTTTTTTT';
$numExample = $this->getNextValue($mysoc);
$mysoc->code_client = $old_code_client;
$mysoc->typent_code = $old_code_type;
$object = new RecruitmentJobPosition($db);
$numExample = $this->getNextValue($object);
if (!$numExample) {
$numExample = $langs->trans('NotConfigured');

View file

@ -697,7 +697,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$recruiter = new User($db);
$recruiter->fetch($job->fk_user_recruiter);
$recruitername = $recruiter->getFullName('');
$recruitername = $recruiter->getFullName($langs);
$recruitermail = (!empty($job->email_recruiter) ? $job->email_recruiter : $recruiter->email);
include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';

View file

@ -1,7 +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>
* Copyright (C) 2024-2025 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
@ -443,6 +443,7 @@ if ($jobposition->id > 0 && (empty($action) || ($action != 'edit' && $action !=
*/
// Project
if (isModEnabled('project')) {
$formproject = new FormProjets($db);
$langs->load("projects");
$morehtmlref .= $langs->trans('Project').' ';
if ($permissiontoadd) {
@ -455,11 +456,11 @@ if ($jobposition->id > 0 && (empty($action) || ($action != 'edit' && $action !=
$morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
$morehtmlref .= '<input type="hidden" name="action" value="classin">';
$morehtmlref .= '<input type="hidden" name="token" value="'.newToken().'">';
$morehtmlref .= $formproject->select_projects(0, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref .= $formproject->select_projects(0, (string) $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
$morehtmlref .= '</form>';
} else {
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, !empty($object->socid) ? $object->socid : 0, $object->fk_project, 'none', 0, 0, 0, 1, '', 'maxwidth300');
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, !empty($object->socid) ? $object->socid : 0, (string) $object->fk_project, 'none', 0, 0, 0, 1, '', 'maxwidth300');
}
} else {
if (!empty($object->fk_project)) {
@ -817,13 +818,13 @@ while ($i < $imaxinloop) {
if (!empty($arrayfields['t.'.$key]['checked'])) {
print '<td'.($cssforfield ? ' class="'.$cssforfield.(preg_match('/tdoverflow/', $cssforfield) ? ' classfortooltip' : '').'"' : '');
if (preg_match('/tdoverflow/', $cssforfield) && !is_numeric($object->$key)) {
print ' title="'.dol_escape_htmltag($object->$key).'"';
print ' title="'.dol_escape_htmltag((string) $object->$key).'"';
}
print '>';
if ($key == 'status') {
print $object->getLibStatut(5);
} elseif ($key == 'rowid') {
print $object->showOutputField($val, $key, $object->id, '');
print $object->showOutputField($val, $key, (string) $object->id, '');
} else {
print $object->showOutputField($val, $key, $object->$key, '');
}

View file

@ -1,7 +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 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2025 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
@ -106,7 +106,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');
@ -161,6 +161,7 @@ if ($object->id > 0) {
*/
// Project
if (isModEnabled('project')) {
$formproject = new FormProjets($db);
$langs->load("projects");
$morehtmlref .= $langs->trans('Project').' ';
if ($permissiontoadd) {
@ -173,11 +174,11 @@ if ($object->id > 0) {
$morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
$morehtmlref .= '<input type="hidden" name="action" value="classin">';
$morehtmlref .= '<input type="hidden" name="token" value="'.newToken().'">';
$morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', 0, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref .= $formproject->select_projects($object->socid, (string) $object->fk_project, 'projectid', 0, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
$morehtmlref .= '</form>';
} else {
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, 0, $object->fk_project, 'none', 0, 0, 0, 1, '', 'maxwidth300');
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, 0, (string) $object->fk_project, 'none', 0, 0, 0, 1, '', 'maxwidth300');
}
} else {
if (!empty($object->fk_project)) {

View file

@ -249,7 +249,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
$morehtmlref .= '</form>';
} else {
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1, '', 'maxwidth300');
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, (string) $object->fk_project, 'none', 0, 0, 0, 1, '', 'maxwidth300');
}
} else {
if (!empty($object->fk_project)) {

View file

@ -154,7 +154,7 @@ if (empty($reshook)) {
if ($object->status == $object::STATUS_VALIDATED) {
$db->begin();
$result = $object->cloture($user, GETPOSTINT('status'), GETPOSTINT('note_private'));
$result = $object->cloture($user, GETPOSTINT('status'), GETPOST('note_private', 'restricthtml'));
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
$error++;
@ -349,7 +349,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
$morehtmlref .= '</form>';
} else {
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, !empty($object->socid) ? $object->socid : 0, $object->fk_project, 'none', 0, 0, 0, 1, '', 'maxwidth300');
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, !empty($object->socid) ? $object->socid : 0, (string) $object->fk_project, 'none', 0, 0, 0, 1, '', 'maxwidth300');
}
} else {
if (!empty($object->fk_project)) {

View file

@ -1,7 +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 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2025 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
@ -141,6 +141,7 @@ if ($object->id) {
*/
// Project
if (isModEnabled('project')) {
$formproject = new FormProjets($db);
$langs->load("projects");
$morehtmlref .= $langs->trans('Project').' ';
if ($permissiontoadd) {
@ -153,11 +154,11 @@ if ($object->id) {
$morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
$morehtmlref .= '<input type="hidden" name="action" value="classin">';
$morehtmlref .= '<input type="hidden" name="token" value="'.newToken().'">';
$morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref .= $formproject->select_projects($object->socid, (string) $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
$morehtmlref .= '</form>';
} else {
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, !empty($object->socid) ? $object->socid : 0, $object->fk_project, 'none', 0, 0, 0, 1, '', 'maxwidth300');
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, !empty($object->socid) ? $object->socid : 0, (string) $object->fk_project, 'none', 0, 0, 0, 1, '', 'maxwidth300');
}
} else {
if (!empty($object->fk_project)) {

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) 2025 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
@ -115,11 +116,11 @@ foreach ($object->fields as $key => $val) {
if (!empty($val['visible'])) {
$visible = (int) dol_eval((string) $val['visible'], 1, 1, '1');
$arrayfields['t.'.$key] = array(
'label'=>$val['label'],
'checked'=>(($visible < 0) ? 0 : 1),
'enabled'=>(abs($visible) != 3 && (bool) dol_eval($val['enabled'], 1)),
'position'=>$val['position'],
'help'=> isset($val['help']) ? $val['help'] : ''
'label' => $val['label'],
'checked' => (($visible < 0) ? '0' : '1'),
'enabled' => (string) (int) (abs($visible) != 3 && (bool) dol_eval($val['enabled'], 1)),
'position' => $val['position'],
'help' => isset($val['help']) ? $val['help'] : ''
);
}
}
@ -130,7 +131,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be 'include', not 'include_once'.
$object->fields = dol_sort_array($object->fields, 'position');
$arrayfields['nbapplications'] = array('type'=>'integer', 'label'=>'Applications', 'checked'=>1, 'enabled'=>1, 'position'=>90, 'csslist'=>'right');
$arrayfields['nbapplications'] = array('type' => 'integer', 'label' => 'Applications', 'checked' => 1, 'enabled' => 1, 'position' => 90, 'csslist' => 'right');
$arrayfields = dol_sort_array($arrayfields, 'position');
$permissiontoread = $user->hasRight('recruitment', 'recruitmentjobposition', 'read');
@ -414,8 +415,8 @@ print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print '<input type="hidden" name="mode" value="'.$mode.'">';
$newcardbutton = '';
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/^&mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition'));
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/^&mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition'));
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/^&mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss' => 'reposition'));
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/^&mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss' => 'reposition'));
$newcardbutton .= dolGetButtonTitleSeparator();
$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/recruitment/recruitmentjobposition_card.php', 1).'?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permissiontoadd);
@ -499,7 +500,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 maxwidth'.($val['type'] == 'integer' ? '50' : '75').'" name="search_'.$key.'" value="'.dol_escape_htmltag(isset($search[$key]) ? $search[$key] : '').'">';
}
@ -510,7 +511,7 @@ foreach ($object->fields as $key => $val) {
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields);
$parameters = array('arrayfields' => $arrayfields);
$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (!empty($arrayfields['nbapplications']['checked'])) {
@ -555,7 +556,7 @@ foreach ($object->fields as $key => $val) {
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
// Hook fields
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder, 'totalarray'=>&$totalarray);
$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder, 'totalarray' => &$totalarray);
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (!empty($arrayfields['nbapplications']['checked'])) {
@ -613,7 +614,7 @@ while ($i < $imaxinloop) {
$selected = 1;
}
}
print $object->getKanbanView('', array('nbapplications'=>$obj->nbapplications, 'selected' => $selected));
print $object->getKanbanView('', array('nbapplications' => $obj->nbapplications, 'selected' => $selected));
if ($i == ($imaxinloop - 1)) {
print '</div>';
print '</td></tr>';
@ -661,7 +662,7 @@ while ($i < $imaxinloop) {
if ($key == 'status') {
print $object->getLibStatut(5);
} elseif ($key == 'rowid') {
print $object->showOutputField($val, $key, $object->id, '');
print $object->showOutputField($val, $key, (string) $object->id, '');
} else {
print $object->showOutputField($val, $key, $object->$key, '');
}
@ -686,7 +687,7 @@ while ($i < $imaxinloop) {
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
$parameters = array('arrayfields' => $arrayfields, 'object' => $object, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (!empty($arrayfields['nbapplications']['checked'])) {
@ -734,7 +735,7 @@ if ($num == 0) {
$db->free($resql);
$parameters = array('arrayfields' => $arrayfields, 'sql'=>$sql);
$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql);
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;

View file

@ -1,7 +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 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2025 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
@ -118,6 +118,7 @@ if ($id > 0 || !empty($ref)) {
*/
// Project
if (isModEnabled('project')) {
$formproject = new FormProjets($db);
$langs->load("projects");
$morehtmlref .= $langs->trans('Project').' ';
if ($permissiontoadd) {
@ -130,11 +131,11 @@ if ($id > 0 || !empty($ref)) {
$morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
$morehtmlref .= '<input type="hidden" name="action" value="classin">';
$morehtmlref .= '<input type="hidden" name="token" value="'.newToken().'">';
$morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref .= $formproject->select_projects($object->socid, (string) $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
$morehtmlref .= '</form>';
} else {
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, !empty($object->socid) ? $object->socid : 0, $object->fk_project, 'none', 0, 0, 0, 1, '', 'maxwidth300');
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, !empty($object->socid) ? $object->socid : 0, (string) $object->fk_project, 'none', 0, 0, 0, 1, '', 'maxwidth300');
}
} else {
if (!empty($object->fk_project)) {