-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Qual: Fix phan notices (recruitment)
- Loading branch information
Showing
17 changed files
with
125 additions
and
131 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<?php | ||
/* Copyright (C) 2022 Thibault FOUCART <[email protected]> | ||
* Copyright (C) 2024 MDW <[email protected]> | ||
* Copyright (C) 2024-2025 MDW <[email protected]> | ||
* | ||
* 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 @@ | |
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 @@ public function indexCandidature($sortfield = "t.rowid", $sortorder = 'ASC', $li | |
/** | ||
* 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 @@ public function postJobPosition($request_data = null) | |
} | ||
|
||
/** | ||
* 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 @@ public function postCandidature($request_data = null) | |
* 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 @@ public function putJobPosition($id, $request_data = null) | |
// 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 @@ public function putCandidature($id, $request_data = null) | |
// 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 @@ protected function _cleanObjectDatas($object) | |
/** | ||
* 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) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,7 @@ | |
* Copyright (C) 2015 Marcos García <[email protected]> | ||
* Copyright (C) 2017 Ferran Marcet <[email protected]> | ||
* Copyright (C) 2018-2024 Frédéric France <[email protected]> | ||
* Copyright (C) 2024-2025 MDW <[email protected]> | ||
* Copyright (C) 2024-2025 MDW <[email protected]> | ||
* | ||
* 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 @@ public static function liste_modeles($db, $maxfilenamelength = 0) | |
/** | ||
* 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 @@ protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $ | |
/** | ||
* 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 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $output | |
/** | ||
* 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 @@ protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) | |
* | ||
* @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) | ||
|
Oops, something went wrong.