From 21ef87777230a746face1119830d9b873b483511 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 Mar 2024 11:07:28 +0100 Subject: [PATCH 01/15] Remove not used email layout --- htdocs/core/class/html.formmail.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 606becf17c2..8c998f0cc50 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -1521,7 +1521,7 @@ class FormMail extends Form 'basic' => 'basic', 'news' => 'news', 'commerce' => 'commerce', - 'text' => 'text' + //'text' => 'text' ); foreach ($templates as $template => $templateFunction) { From f00d3ff6ddd9b76b4dfd83076efe044b78c6b816 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 Mar 2024 14:57:41 +0100 Subject: [PATCH 02/15] Fix route not complete --- .../template/class/api_mymodule.class.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/modulebuilder/template/class/api_mymodule.class.php b/htdocs/modulebuilder/template/class/api_mymodule.class.php index 1908a2a0b4b..e29e1a08911 100644 --- a/htdocs/modulebuilder/template/class/api_mymodule.class.php +++ b/htdocs/modulebuilder/template/class/api_mymodule.class.php @@ -64,7 +64,7 @@ class MyModuleApi extends DolibarrApi * @param int $id ID of myobject * @return Object Object with cleaned properties * - * @url GET myobjects/{id} + * @url GET mymodule/myobjects/{id} * * @throws RestException 403 Not allowed * @throws RestException 404 Not found @@ -103,7 +103,7 @@ class MyModuleApi extends DolibarrApi * @throws RestException 403 Not allowed * @throws RestException 503 System error * - * @url GET /myobjects/ + * @url GET /mymodule/myobjects/ */ public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '', $properties = '') { @@ -191,7 +191,7 @@ class MyModuleApi extends DolibarrApi * @throws RestException 403 Not allowed * @throws RestException 500 System error * - * @url POST myobjects/ + * @url POST mymodule/myobjects/ */ public function post($request_data = null) { @@ -232,7 +232,7 @@ class MyModuleApi extends DolibarrApi * @throws RestException 404 Not found * @throws RestException 500 System error * - * @url PUT myobjects/{id} + * @url PUT mymodule/myobjects/{id} */ public function put($id, $request_data = null) { @@ -282,7 +282,7 @@ class MyModuleApi extends DolibarrApi * @throws RestException 409 Nothing to do * @throws RestException 500 System error * - * @url DELETE myobjects/{id} + * @url DELETE mymodule/myobjects/{id} */ public function delete($id) { From 18cc09fae69936cf194d83a699b2dbb2563bcacd Mon Sep 17 00:00:00 2001 From: thibdrev Date: Thu, 7 Mar 2024 16:02:14 +0100 Subject: [PATCH 03/15] qual: phan for htdocs/core/lib/ajax.lib.php (#28672) 29 entries for: Argument 3 ($entity) is null of type null but \ajax_constantonoff() takes int (no real type) defined at htdocs/core/lib/ajax.lib.php:645 --- htdocs/core/lib/ajax.lib.php | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index 91f76b66cdd..81fe78a073c 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -628,19 +628,19 @@ function ajax_event($htmlname, $events) /** * On/off button for constant * - * @param string $code Name of constant - * @param array $input Array of complementary actions to do if success ("disabled"|"enabled'|'set'|'del') => CSS element to switch, 'alert' => message to show, ... Example: array('disabled'=>array(0=>'cssid')) - * @param int $entity Entity. Current entity is used if null. - * @param int $revertonoff 1=Revert on/off - * @param int $strict Use only "disabled" with delConstant and "enabled" with setConstant - * @param int $forcereload Force to reload page if we click/change value (this is supported only when there is no 'alert' option in input) - * @param int $marginleftonlyshort 1 = Add a short left margin on picto, 2 = Add a larger left margin on picto, 0 = No left margin. - * @param int $forcenoajax 1 = Force to use a ahref link instead of ajax code. - * @param int $setzeroinsteadofdel 1 = Set constantto '0' instead of deleting it - * @param string $suffix Suffix to use on the name of the switch_on picto. Example: '', '_red' - * @param string $mode Add parameter &mode= to the href link (Used for href link) - * @param string $morecss More CSS - * @return string + * @param string $code Name of constant + * @param array $input Array of complementary actions to do if success ("disabled"|"enabled'|'set'|'del') => CSS element to switch, 'alert' => message to show, ... Example: array('disabled'=>array(0=>'cssid')) + * @param int|null $entity Entity. Current entity is used if null. + * @param int $revertonoff 1=Revert on/off + * @param int $strict Use only "disabled" with delConstant and "enabled" with setConstant + * @param int $forcereload Force to reload page if we click/change value (this is supported only when there is no 'alert' option in input) + * @param int $marginleftonlyshort 1 = Add a short left margin on picto, 2 = Add a larger left margin on picto, 0 = No left margin. + * @param int $forcenoajax 1 = Force to use a ahref link instead of ajax code. + * @param int $setzeroinsteadofdel 1 = Set constantto '0' instead of deleting it + * @param string $suffix Suffix to use on the name of the switch_on picto. Example: '', '_red' + * @param string $mode Add parameter &mode= to the href link (Used for href link) + * @param string $morecss More CSS + * @return string */ function ajax_constantonoff($code, $input = array(), $entity = null, $revertonoff = 0, $strict = 0, $forcereload = 0, $marginleftonlyshort = 2, $forcenoajax = 0, $setzeroinsteadofdel = 0, $suffix = '', $mode = '', $morecss = 'inline-block') { From fcfc70e02a2145caf359b597c46cde6220bd4692 Mon Sep 17 00:00:00 2001 From: thibdrev Date: Thu, 7 Mar 2024 16:02:57 +0100 Subject: [PATCH 04/15] qual: phpstan for htdocs/loan/class/loan.class.php (#28673) htdocs/loan/class/loan.class.php 113 PHPDoc type int of property Loan::$totalpaid is not covariant with PHPDoc type float of overridden property CommonObject::$totalpaid. --- htdocs/loan/class/loan.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/loan/class/loan.class.php b/htdocs/loan/class/loan.class.php index 3eb5b1bdc45..20f51e90e78 100644 --- a/htdocs/loan/class/loan.class.php +++ b/htdocs/loan/class/loan.class.php @@ -108,7 +108,7 @@ class Loan extends CommonObject public $fk_project; /** - * @var int totalpaid + * @var float totalpaid */ public $totalpaid; From 38e69184d1a4943fb787b5502a3ce31adc688e28 Mon Sep 17 00:00:00 2001 From: MDW Date: Thu, 7 Mar 2024 16:04:39 +0100 Subject: [PATCH 05/15] Fix typing hints (#28676) --- htdocs/core/lib/functions.lib.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 8dac5976289..30f5dc3b5b4 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -6890,7 +6890,7 @@ function get_product_vat_for_country($idprod, $thirdpartytouse, $idprodfournpric if (($mysoc->country_code == $thirdpartytouse->country_code) || (in_array($mysoc->country_code, array('FR', 'MC')) && in_array($thirdpartytouse->country_code, array('FR', 'MC'))) || (in_array($mysoc->country_code, array('MQ', 'GP')) && in_array($thirdpartytouse->country_code, array('MQ', 'GP'))) - ) { + ) { // If country of thirdparty to consider is ours if ($idprodfournprice > 0) { // We want vat for product for a "supplier" object $result = $product->get_buyprice($idprodfournprice, 0, 0, 0); @@ -9756,13 +9756,13 @@ function dol_getIdFromCode($db, $key, $tablename, $fieldkey = 'code', $fieldid = } /** - * Check if a variable with name $var start with $text. + * Check if a variable with name $var startx with $text. * Can be used to forge dol_eval() conditions. * - * @param $var string Variable - * @param $regextext string Text that must be a valid regex string - * @param $matchrule int 1=Test if start with, 0=Test if equal - * @return boolean|string True or False, text if bad use. + * @param string $var Variable + * @param string $regextext Text that must be a valid regex string + * @param int $matchrule 1=Test if start with, 0=Test if equal + * @return boolean|string True or False, text if bad usage. */ function isStringVarMatching($var, $regextext, $matchrule = 1) { @@ -13078,6 +13078,8 @@ function show_actions_messaging($conf, $langs, $db, $filterobj, $objcon = '', $n } $histo = array(); + '@phan-var-force array $histo'; + $numaction = 0; $now = dol_now(); @@ -13157,7 +13159,7 @@ function show_actions_messaging($conf, $langs, $db, $filterobj, $objcon = '', $n } $sql .= " WHERE a.entity IN (".getEntity('agenda').")"; - if ($force_filter_contact === false) { + if (!$force_filter_contact) { if (is_object($filterobj) && in_array(get_class($filterobj), array('Societe', 'Client', 'Fournisseur')) && $filterobj->id) { $sql .= " AND a.fk_soc = ".((int) $filterobj->id); } elseif (is_object($filterobj) && get_class($filterobj) == 'Project' && $filterobj->id) { @@ -13285,6 +13287,7 @@ function show_actions_messaging($conf, $langs, $db, $filterobj, $objcon = '', $n while ($i < $imaxinloop) { $obj = $db->fetch_object($resql); + '@phan-var-force array{apicto:string,contact_id:string,dp:string,dp2:string,firstname:string,label:string,message:string,msg_from:string,ref:string,type:string,user_lastname:string} $obj'; if ($obj->type == 'action') { $contactaction = new ActionComm($db); $contactaction->id = $obj->id; From 5e9dfc80902eeb494fd1399ee3e7a26cc643a0c7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 Mar 2024 16:38:02 +0100 Subject: [PATCH 06/15] Fix phan --- htdocs/accountancy/class/bookkeeping.class.php | 2 +- htdocs/hrm/class/job.class.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 362728c367b..fe307fe8915 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -1231,7 +1231,7 @@ class BookKeeping extends CommonObject } elseif ($key == 't.reconciled_option') { $sqlwhere[] = 't.lettering_code IS NULL'; } else { - $sqlwhere[] = $this->db->sanitize($key)." LIKE '%".$this->escape($this->db->escapeforlike($value))."%'"; + $sqlwhere[] = $this->db->sanitize($key)." LIKE '%".$this->db->escape($this->db->escapeforlike($value))."%'"; } } } diff --git a/htdocs/hrm/class/job.class.php b/htdocs/hrm/class/job.class.php index 684bc39b3c3..dbed9cad902 100644 --- a/htdocs/hrm/class/job.class.php +++ b/htdocs/hrm/class/job.class.php @@ -365,7 +365,7 @@ class Job extends CommonObject * @param string $filtermode No more used * @return array|int int <0 if KO, array of pages if OK */ - public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND') + public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, $filter = '', $filtermode = 'AND') { dol_syslog(__METHOD__, LOG_DEBUG); From af9704acdcde8a9050b5fdd0cb4825456ec04f72 Mon Sep 17 00:00:00 2001 From: thibdrev Date: Thu, 7 Mar 2024 16:41:39 +0100 Subject: [PATCH 07/15] qual: phpdoc for htdocs/core/lib/pdf.lib.php (#28671) --- htdocs/core/lib/pdf.lib.php | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 4cfac0f4413..7d342e152a3 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -429,7 +429,7 @@ function pdfBuildThirdpartyName($thirdparty, Translate $outputlangs, $includeali * @param Contact|string|null $targetcontact Target contact object * @param int $usecontact Use contact instead of company * @param string $mode Address type ('source', 'target', 'targetwithdetails', 'targetwithdetails_xxx': target but include also phone/fax/email/url) - * @param Object $object Object we want to build document for + * @param Object|null $object Object we want to build document for * @return string|int String with full address or -1 if KO */ function pdf_build_address($outputlangs, $sourcecompany, $targetcompany = '', $targetcontact = '', $usecontact = 0, $mode = 'source', $object = null) @@ -718,7 +718,7 @@ function pdf_build_address($outputlangs, $sourcecompany, $targetcompany = '', $t /** * Show header of page for PDF generation * - * @param TCPDF $pdf Object PDF + * @param TCPDF $pdf Object PDF * @param Translate $outputlangs Object lang for output * @param int $page_height Height of page * @return void @@ -752,11 +752,11 @@ function pdf_pagehead(&$pdf, $outputlangs, $page_height) /** * Return array of possible substitutions for PDF content (without external module substitutions). * - * @param Translate $outputlangs Output language - * @param array $exclude Array of family keys we want to exclude. For example array('mycompany', 'object', 'date', 'user', ...) - * @param Object $object Object - * @param int $onlykey 1=Do not calculate some heavy values of keys (performance enhancement when we need only the keys), 2=Values are truncated and html sanitized (to use for help tooltip) - * @param array $include Array of family keys we want to include. For example array('system', 'mycompany', 'object', 'objectamount', 'date', 'user', ...) + * @param Translate $outputlangs Output language + * @param array|null $exclude Array of family keys we want to exclude. For example array('mycompany', 'object', 'date', 'user', ...) + * @param Object|null $object Object + * @param int $onlykey 1=Do not calculate some heavy values of keys (performance enhancement when we need only the keys), 2=Values are truncated and html sanitized (to use for help tooltip) + * @param array|null $include Array of family keys we want to include. For example array('system', 'mycompany', 'object', 'objectamount', 'date', 'user', ...) * @return array Array of substitutions */ function pdf_getSubstitutionArray($outputlangs, $exclude = null, $object = null, $onlykey = 0, $include = null) @@ -2296,11 +2296,11 @@ function pdf_getlineremisepercent($object, $i, $outputlangs, $hidedetails = 0) /** * Return line percent * - * @param Object $object Object - * @param int $i Current line number - * @param Translate $outputlangs Object langs for output - * @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines) - * @param HookManager $hookmanager Hook manager instance + * @param Object $object Object + * @param int $i Current line number + * @param Translate $outputlangs Object langs for output + * @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines) + * @param HookManager|null $hookmanager Hook manager instance * @return string */ function pdf_getlineprogress($object, $i, $outputlangs, $hidedetails = 0, $hookmanager = null) From 1aa0f8227f2b5d872fbe9005dc95c90fd23a8c84 Mon Sep 17 00:00:00 2001 From: Rikard Bosnjakovic Date: Thu, 7 Mar 2024 16:43:04 +0100 Subject: [PATCH 08/15] Update card.php (#28679) Fix #25130 Co-authored-by: Laurent Destailleur --- htdocs/expedition/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index f0e85472b80..4fdefef202b 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -2763,7 +2763,7 @@ if ($action == 'create') { // Presend form $modelmail = 'shipping_send'; - $defaulttopic = $langs->trans('SendShippingRef'); + $defaulttopic = 'SendShippingRef'; $diroutput = $conf->expedition->dir_output.'/sending'; $trackid = 'shi'.$object->id; From 4fcbdf15ab3acdd163cd854de3c4da330f686723 Mon Sep 17 00:00:00 2001 From: HENRY Florian Date: Thu, 7 Mar 2024 16:49:41 +0100 Subject: [PATCH 09/15] fix: better inner join than comma for hook printFieldListFrom after (#28681) * better inner jion than comme for hook after * better inner jion than comme for hook after --------- Co-authored-by: Laurent Destailleur --- htdocs/comm/propal/list.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 88cec014878..0a03d0cc1cd 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -77,6 +77,7 @@ $mode = GETPOST('mode', 'alpha'); // Search Fields $search_all = trim((GETPOST('search_all', 'alphanohtml') != '') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml')); $search_user = GETPOSTINT('search_user'); +if ($search_user==-1) $search_user=0; $search_sale = GETPOSTINT('search_sale'); $search_ref = GETPOST('sf_ref') ? GETPOST('sf_ref', 'alpha') : GETPOST('search_ref', 'alpha'); $search_refcustomer = GETPOST('search_refcustomer', 'alpha'); @@ -587,7 +588,7 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)"; -$sql .= ', '.MAIN_DB_PREFIX.'propal as p'; +$sql .= ' INNER JOIN '.MAIN_DB_PREFIX.'propal as p ON p.fk_soc = s.rowid'; if (!empty($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (p.rowid = ef.fk_object)"; } @@ -598,8 +599,10 @@ $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user as u ON p.fk_user_author = u.rowid'; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet as pr ON pr.rowid = p.fk_projet"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_availability as ava on (ava.rowid = p.fk_availability)"; if ($search_user > 0) { - $sql .= ", ".MAIN_DB_PREFIX."element_contact as c"; - $sql .= ", ".MAIN_DB_PREFIX."c_type_contact as tc"; + $sql .= " INNER JOIN ".MAIN_DB_PREFIX."element_contact as c"; + $sql .= " ON c.element_id = p.rowid AND c.fk_socpeople = ".((int) $search_user); + $sql .= " INNER JOIN ".MAIN_DB_PREFIX."c_type_contact as tc"; + $sql .= " ON c.fk_c_type_contact = tc.rowid AND tc.element='propal' AND tc.source='internal'"; } // Add table from hooks @@ -607,8 +610,8 @@ $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; -$sql .= ' WHERE p.fk_soc = s.rowid'; -$sql .= ' AND p.entity IN ('.getEntity('propal').')'; +$sql .= ' WHERE'; +$sql .= ' p.entity IN ('.getEntity('propal').')'; if ($search_town) { $sql .= natural_search('s.town', $search_town); } @@ -718,9 +721,6 @@ if ($search_date_delivery_start) { if ($search_date_delivery_end) { $sql .= " AND p.date_livraison <= '".$db->idate($search_date_delivery_end)."'"; } -if ($search_user > 0) { - $sql .= " AND c.fk_c_type_contact = tc.rowid AND tc.element='propal' AND tc.source='internal' AND c.element_id = p.rowid AND c.fk_socpeople = ".((int) $search_user); -} if ($search_date_signature_start) { $sql .= " AND p.date_signature >= '".$db->idate($search_date_signature_start)."'"; } @@ -1147,7 +1147,7 @@ if ($search_date_signature_endyear) { if ($user->hasRight('user', 'user', 'lire')) { $moreforfilter .= '
'; $tmptitle = $langs->trans('LinkedToSpecificUsers'); - $moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$form->select_dolusers($search_user, 'search_user', $tmptitle, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth250 widthcentpercentminusx'); + $moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$form->select_dolusers((empty($search_user)?-2:0), 'search_user', $tmptitle, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth250 widthcentpercentminusx'); $moreforfilter .= '
'; } // If the user can view products From 5659ba8de35a43715d1a53203a444bcb464f4a2b Mon Sep 17 00:00:00 2001 From: thibdrev Date: Thu, 7 Mar 2024 16:50:42 +0100 Subject: [PATCH 10/15] qual: phan for accountingaccount.class.php (#28669) htdocs/accountancy/admin/productaccount.php 196 TypeError PhanTypeMismatchArgumentProbablyReal Argument 2 ($account_number) is null of type null but \AccountingAccount::fetch() takes string (no real type) defined at htdocs/accountancy/class/accountingaccount.class.php:182 (the inferred real argument type has nothing in common with the parameter's phpdoc type) Co-authored-by: Laurent Destailleur --- htdocs/accountancy/class/accountingaccount.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index 057c307e1f6..500fd4a7543 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -174,7 +174,7 @@ class AccountingAccount extends CommonObject * Load record in memory * * @param int $rowid Id - * @param string $account_number Account number + * @param string|null $account_number Account number * @param int|boolean $limittocurrentchart 1 or true=Load record only if it is into current active chart of account * @param string $limittoachartaccount 'ABC'=Load record only if it is into chart account with code 'ABC' (better and faster than previous parameter if you have chart of account code). * @return int Return integer <0 if KO, 0 if not found, Id of record if OK and found From b9c843c08687c89631eb0d845ef90b5931396a85 Mon Sep 17 00:00:00 2001 From: thibdrev Date: Thu, 7 Mar 2024 16:55:12 +0100 Subject: [PATCH 11/15] qual: phan for functions.lib.php (#28653) * qual: phan for functions.lib.php 54 entries for: TypeError PhanTypeMismatchArgumentProbablyReal Argument 3 ($exclude) is null of type null but \getCommonSubstitutionArray() takes array (no real type) defined at htdocs/core/lib/functions.lib.php:8285 * phpcs --- htdocs/core/lib/functions.lib.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 30f5dc3b5b4..af156d0442f 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -8274,12 +8274,13 @@ function dol_concatdesc($text1, $text2, $forxml = false, $invert = false) /** * Return array of possible common substitutions. This includes several families like: 'system', 'mycompany', 'object', 'objectamount', 'date', 'user' * - * @param Translate $outputlangs Output language - * @param int $onlykey 1=Do not calculate some heavy values of keys (performance enhancement when we need only the keys), 2=Values are trunc and html sanitized (to use for help tooltip) - * @param array $exclude Array of family keys we want to exclude. For example array('system', 'mycompany', 'object', 'objectamount', 'date', 'user', ...) - * @param Object $object Object for keys on object - * @param array $include Array of family keys we want to include. For example array('system', 'mycompany', 'object', 'objectamount', 'date', 'user', ...) - * @return array Array of substitutions + * @param Translate $outputlangs Output language + * @param int $onlykey 1=Do not calculate some heavy values of keys (performance enhancement when we need only the keys), + * 2=Values are trunc and html sanitized (to use for help tooltip) + * @param array|null $exclude Array of family keys we want to exclude. For example array('system', 'mycompany', 'object', 'objectamount', 'date', 'user', ...) + * @param Object|null $object Object for keys on object + * @param array|null $include Array of family keys we want to include. For example array('system', 'mycompany', 'object', 'objectamount', 'date', 'user', ...) + * @return array Array of substitutions * @see setSubstitFromObject() */ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, $object = null, $include = null) From 14ffa142aa7d4e7b1b5d6787008a0472e4bd4456 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 7 Mar 2024 16:57:29 +0100 Subject: [PATCH 12/15] fix precommit and clean code (#28651) * fix precommit * fix precommit * fix missing include * fix phpstan * fix phpstan * fix phpstan * fix phpstan * fix phpstan * fix phpstan * fix phpstan * fix phpstan * fix phpstan * fix phpstan * fix phpstan * fix phpstan * fix phpstan * clean code * clean code --- htdocs/bookcal/lib/bookcal.lib.php | 7 ++- .../lib/bookcal_availabilities.lib.php | 21 +++---- htdocs/bookcal/lib/bookcal_calendar.lib.php | 23 ++++---- htdocs/comm/card.php | 1 + htdocs/core/class/html.formsms.class.php | 22 ++++++- .../doc/pdf_aurore.modules.php | 2 +- .../doc/pdf_zenith.modules.php | 2 +- .../emailcollector/lib/emailcollector.lib.php | 5 +- ...ventorganization_conferenceorbooth.lib.php | 57 ++++++++++--------- htdocs/loan/class/paymentloan.class.php | 7 ++- htdocs/mrp/ajax/interface.php | 17 ++++++ htdocs/mrp/lib/mrp.lib.php | 11 ++-- htdocs/mrp/lib/mrp_mo.lib.php | 27 ++++----- htdocs/mrp/mo_agenda.php | 6 +- htdocs/mrp/mo_document.php | 7 ++- htdocs/mrp/mo_movements.php | 5 +- htdocs/mrp/mo_note.php | 5 +- htdocs/mrp/mo_production.php | 3 +- htdocs/partnership/lib/partnership.lib.php | 31 +++++----- htdocs/product/class/product.class.php | 13 ++++- htdocs/recruitment/lib/recruitment.lib.php | 18 +++--- ...recruitment_recruitmentcandidature.lib.php | 21 +++---- ...recruitment_recruitmentjobposition.lib.php | 33 +++++------ htdocs/societe/class/client.class.php | 9 ++- htdocs/theme/eldy/flags-sprite.inc.php | 24 +++++++- htdocs/theme/eldy/global.inc.php | 22 +++++++ htdocs/theme/eldy/main_menu_fa_icons.inc.php | 30 +++++++++- htdocs/webhook/lib/webhook.lib.php | 7 ++- htdocs/webhook/lib/webhook_target.lib.php | 7 ++- htdocs/webportal/lib/webportal.lib.php | 6 +- htdocs/website/lib/websiteaccount.lib.php | 6 +- htdocs/zapier/lib/zapier.lib.php | 10 ++-- 32 files changed, 302 insertions(+), 163 deletions(-) diff --git a/htdocs/bookcal/lib/bookcal.lib.php b/htdocs/bookcal/lib/bookcal.lib.php index 3f809da08d8..049de3c6472 100644 --- a/htdocs/bookcal/lib/bookcal.lib.php +++ b/htdocs/bookcal/lib/bookcal.lib.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 Frédéric France * * 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 @@ -16,7 +17,7 @@ */ /** - * \file bookcal/lib/bookcal.lib.php + * \file htdocs/bookcal/lib/bookcal.lib.php * \ingroup bookcal * \brief Library files with common functions for BookCal */ @@ -35,13 +36,13 @@ function bookcalAdminPrepareHead() $h = 0; $head = array(); - $head[$h][0] = dol_buildpath("/bookcal/admin/setup.php", 1); + $head[$h][0] = DOL_URL_ROOT . '/bookcal/admin/setup.php'; $head[$h][1] = $langs->trans("Settings"); $head[$h][2] = 'settings'; $h++; /* - $head[$h][0] = dol_buildpath("/bookcal/admin/myobject_extrafields.php", 1); + $head[$h][0] = DOL_URL_ROOT.'/bookcal/admin/myobject_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFields"); $head[$h][2] = 'myobject_extrafields'; $h++; diff --git a/htdocs/bookcal/lib/bookcal_availabilities.lib.php b/htdocs/bookcal/lib/bookcal_availabilities.lib.php index 1fb93187f94..674c0ea70bb 100644 --- a/htdocs/bookcal/lib/bookcal_availabilities.lib.php +++ b/htdocs/bookcal/lib/bookcal_availabilities.lib.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 Frédéric France * * 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 @@ -41,13 +42,13 @@ function availabilitiesPrepareHead($object) $h = 0; $head = array(); - $head[$h][0] = dol_buildpath("/bookcal/availabilities_card.php", 1).'?id='.$object->id; + $head[$h][0] = DOL_URL_ROOT . '/bookcal/availabilities_card.php?id=' . $object->id; $head[$h][1] = $langs->trans("Card"); $head[$h][2] = 'card'; $h++; if ($showtabofpagecontact) { - $head[$h][0] = dol_buildpath("/bookcal/availabilities_contact.php", 1).'?id='.$object->id; + $head[$h][0] = DOL_URL_ROOT . '/bookcal/availabilities_contact.php?id=' . $object->id; $head[$h][1] = $langs->trans("Contacts"); $head[$h][2] = 'contact'; $h++; @@ -62,10 +63,10 @@ function availabilitiesPrepareHead($object) if (!empty($object->note_public)) { $nbNote++; } - $head[$h][0] = dol_buildpath('/bookcal/availabilities_note.php', 1).'?id='.$object->id; + $head[$h][0] = DOL_URL_ROOT . '/bookcal/availabilities_note.php?id=' . $object->id; $head[$h][1] = $langs->trans('Notes'); if ($nbNote > 0) { - $head[$h][1] .= (!getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER') ? ''.$nbNote.'' : ''); + $head[$h][1] .= (!getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER') ? '' . $nbNote . '' : ''); } $head[$h][2] = 'note'; $h++; @@ -73,22 +74,22 @@ function availabilitiesPrepareHead($object) } if ($showtabofpagedocument) { - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; - $upload_dir = $conf->bookcal->dir_output."/availabilities/".dol_sanitizeFileName($object->ref); + require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; + require_once DOL_DOCUMENT_ROOT . '/core/class/link.class.php'; + $upload_dir = $conf->bookcal->dir_output . "/availabilities/" . dol_sanitizeFileName($object->ref); $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); $nbLinks = Link::count($db, $object->element, $object->id); - $head[$h][0] = dol_buildpath("/bookcal/availabilities_document.php", 1).'?id='.$object->id; + $head[$h][0] = DOL_URL_ROOT . '/bookcal/availabilities_document.php?id=' . $object->id; $head[$h][1] = $langs->trans('Documents'); if (($nbFiles + $nbLinks) > 0) { - $head[$h][1] .= ''.($nbFiles + $nbLinks).''; + $head[$h][1] .= '' . ($nbFiles + $nbLinks) . ''; } $head[$h][2] = 'document'; $h++; } if ($showtabofpageagenda) { - $head[$h][0] = dol_buildpath("/bookcal/availabilities_agenda.php", 1).'?id='.$object->id; + $head[$h][0] = DOL_URL_ROOT . '/bookcal/availabilities_agenda.php?id=' . $object->id; $head[$h][1] = $langs->trans("Events"); $head[$h][2] = 'agenda'; $h++; diff --git a/htdocs/bookcal/lib/bookcal_calendar.lib.php b/htdocs/bookcal/lib/bookcal_calendar.lib.php index f586c8845df..d81d0f85d2e 100644 --- a/htdocs/bookcal/lib/bookcal_calendar.lib.php +++ b/htdocs/bookcal/lib/bookcal_calendar.lib.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 Frédéric France * * 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 @@ -41,13 +42,13 @@ function calendarPrepareHead($object) $h = 0; $head = array(); - $head[$h][0] = dol_buildpath("/bookcal/calendar_card.php", 1).'?id='.$object->id; + $head[$h][0] = DOL_URL_ROOT . '/bookcal/calendar_card.php?id=' . $object->id; $head[$h][1] = $langs->trans("Calendar"); $head[$h][2] = 'card'; $h++; if ($object->status == Calendar::STATUS_VALIDATED) { - $head[$h][0] = dol_buildpath("/bookcal/booking_list.php", 1).'?id='.$object->id; + $head[$h][0] = DOL_URL_ROOT . '/bookcal/booking_list.php?id=' . $object->id; $head[$h][1] = $langs->trans("Bookings"); $head[$h][2] = 'booking'; $h++; @@ -55,7 +56,7 @@ function calendarPrepareHead($object) if ($showtabofpagecontact) { - $head[$h][0] = dol_buildpath("/bookcal/calendar_contact.php", 1).'?id='.$object->id; + $head[$h][0] = DOL_URL_ROOT . '/bookcal/calendar_contact.php?id=' . $object->id; $head[$h][1] = $langs->trans("Contacts"); $head[$h][2] = 'contact'; $h++; @@ -70,10 +71,10 @@ function calendarPrepareHead($object) if (!empty($object->note_public)) { $nbNote++; } - $head[$h][0] = dol_buildpath('/bookcal/calendar_note.php', 1).'?id='.$object->id; + $head[$h][0] = DOL_URL_ROOT . '/bookcal/calendar_note.php?id=' . $object->id; $head[$h][1] = $langs->trans('Notes'); if ($nbNote > 0) { - $head[$h][1] .= (!getDolGlobalInt('MAIN_OPTIMIZEFORTEXTBROWSER') ? ''.$nbNote.'' : ''); + $head[$h][1] .= (!getDolGlobalInt('MAIN_OPTIMIZEFORTEXTBROWSER') ? '' . $nbNote . '' : ''); } $head[$h][2] = 'note'; $h++; @@ -81,22 +82,22 @@ function calendarPrepareHead($object) } if ($showtabofpagedocument) { - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; - $upload_dir = $conf->bookcal->dir_output."/calendar/".dol_sanitizeFileName($object->ref); + require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; + require_once DOL_DOCUMENT_ROOT . '/core/class/link.class.php'; + $upload_dir = $conf->bookcal->dir_output . "/calendar/" . dol_sanitizeFileName($object->ref); $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); $nbLinks = Link::count($db, $object->element, $object->id); - $head[$h][0] = dol_buildpath("/bookcal/calendar_document.php", 1).'?id='.$object->id; + $head[$h][0] = DOL_URL_ROOT . '/bookcal/calendar_document.php?id=' . $object->id; $head[$h][1] = $langs->trans('Documents'); if (($nbFiles + $nbLinks) > 0) { - $head[$h][1] .= ''.($nbFiles + $nbLinks).''; + $head[$h][1] .= '' . ($nbFiles + $nbLinks) . ''; } $head[$h][2] = 'document'; $h++; } if ($showtabofpageagenda) { - $head[$h][0] = dol_buildpath("/bookcal/calendar_agenda.php", 1).'?id='.$object->id; + $head[$h][0] = DOL_URL_ROOT . '/bookcal/calendar_agenda.php?id=' . $object->id; $head[$h][1] = $langs->trans("Events"); $head[$h][2] = 'agenda'; $h++; diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 0b07926aad8..4a20bf2dc9e 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -36,6 +36,7 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; diff --git a/htdocs/core/class/html.formsms.class.php b/htdocs/core/class/html.formsms.class.php index f9cecb96867..4aa0bd0ed61 100644 --- a/htdocs/core/class/html.formsms.class.php +++ b/htdocs/core/class/html.formsms.class.php @@ -1,7 +1,7 @@ * Copyright (C) 2010 Juanjo Menent - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018-2024 Frédéric France * * 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 @@ -41,6 +41,10 @@ class FormSms public $fromid; public $fromname; public $fromsms; + + /** + * @var string + */ public $fromtype; public $replytoname; public $replytomail; @@ -48,9 +52,25 @@ class FormSms public $tomail; public $withsubstit; // Show substitution array + + /** + * @var int + */ public $withfrom; + + /** + * @var int + */ public $withto; + + /** + * @var int + */ public $withtopic; + + /** + * @var int + */ public $withbody; /** diff --git a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php index f53f7eba871..be2c6e38937 100644 --- a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php @@ -714,7 +714,7 @@ class pdf_aurore extends ModelePDFSupplierProposal * @param Object $object Object to show * @param int|float $posy Y * @param Translate $outputlangs Langs object - * @return int + * @return int|float */ protected function _tableau_info(&$pdf, $object, $posy, $outputlangs) { diff --git a/htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php b/htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php index 2c10cdefc1c..f42c862bb9e 100644 --- a/htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php @@ -844,7 +844,7 @@ class pdf_zenith extends ModelePDFSupplierProposal * @param SupplierProposal $object Object to show * @param int|float $posy Y * @param Translate $outputlangs Langs object - * @return integer + * @return int|float */ protected function _tableau_info(&$pdf, $object, $posy, $outputlangs) { diff --git a/htdocs/emailcollector/lib/emailcollector.lib.php b/htdocs/emailcollector/lib/emailcollector.lib.php index 8bb69da5f3b..3549f20a5a5 100644 --- a/htdocs/emailcollector/lib/emailcollector.lib.php +++ b/htdocs/emailcollector/lib/emailcollector.lib.php @@ -38,13 +38,12 @@ function emailcollectorPrepareHead($object) $h = 0; $head = array(); - $head[$h][0] = dol_buildpath("/admin/emailcollector_card.php", 1).'?id='.$object->id; + $head[$h][0] = DOL_URL_ROOT . '/admin/emailcollector_card.php?id='.$object->id; $head[$h][1] = $langs->trans("EmailCollector"); $head[$h][2] = 'card'; $h++; - /*if (isset($object->fields['note_public']) || isset($object->fields['note_private'])) - { + /*if (isset($object->fields['note_public']) || isset($object->fields['note_private'])) { $nbNote = 0; if (!empty($object->note_private)) $nbNote++; if (!empty($object->note_public)) $nbNote++; diff --git a/htdocs/eventorganization/lib/eventorganization_conferenceorbooth.lib.php b/htdocs/eventorganization/lib/eventorganization_conferenceorbooth.lib.php index 1f89e43eaba..b0efb0602c5 100644 --- a/htdocs/eventorganization/lib/eventorganization_conferenceorbooth.lib.php +++ b/htdocs/eventorganization/lib/eventorganization_conferenceorbooth.lib.php @@ -1,5 +1,6 @@ * * 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 @@ -16,7 +17,7 @@ */ /** - * \file lib/eventorganization_conferenceorbooth.lib.php + * \file htdocs/eventorganization/lib/eventorganization_conferenceorbooth.lib.php * \ingroup eventorganization * \brief Library files with common functions for ConferenceOrBooth */ @@ -37,18 +38,18 @@ function conferenceorboothPrepareHead($object, $with_project = 0) $h = 0; $head = array(); - $withProjectUrl=''; - if ($with_project>0) { + $withProjectUrl = ''; + if ($with_project > 0) { $withProjectUrl = "&withproject=1"; } - $head[$h][0] = DOL_URL_ROOT.'/eventorganization/conferenceorbooth_card.php?id='.$object->id.$withProjectUrl; + $head[$h][0] = DOL_URL_ROOT . '/eventorganization/conferenceorbooth_card.php?id=' . $object->id . $withProjectUrl; $head[$h][1] = $langs->trans("Card"); $head[$h][2] = 'card'; $h++; if (getDolGlobalString('MAIN_FEATURES_LEVEL') && getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) { - $head[$h][0] = DOL_URL_ROOT.'/eventorganization/conferenceorbooth_contact.php?id='.$object->id.$withProjectUrl; + $head[$h][0] = DOL_URL_ROOT . '/eventorganization/conferenceorbooth_contact.php?id=' . $object->id . $withProjectUrl; $head[$h][1] = $langs->trans("ContactsAddresses"); $head[$h][2] = 'contact'; $h++; @@ -82,15 +83,15 @@ function conferenceorboothPrepareHead($object, $with_project = 0) $h++; */ - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; - $upload_dir = $conf->eventorganization->dir_output."/conferenceorbooth/".dol_sanitizeFileName($object->ref); + require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; + require_once DOL_DOCUMENT_ROOT . '/core/class/link.class.php'; + $upload_dir = $conf->eventorganization->dir_output . "/conferenceorbooth/" . dol_sanitizeFileName($object->ref); $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); $nbLinks = Link::count($db, $object->element, $object->id); - $head[$h][0] = dol_buildpath("/eventorganization/conferenceorbooth_document.php", 1).'?id='.$object->id.$withProjectUrl; + $head[$h][0] = DOL_URL_ROOT . '/eventorganization/conferenceorbooth_document.php?id=' . $object->id . $withProjectUrl; $head[$h][1] = $langs->trans('Documents'); if (($nbFiles + $nbLinks) > 0) { - $head[$h][1] .= ''.($nbFiles + $nbLinks).''; + $head[$h][1] .= '' . ($nbFiles + $nbLinks) . ''; } $head[$h][2] = 'document'; $h++; @@ -125,22 +126,22 @@ function conferenceorboothProjectPrepareHead($object) $h = 0; $head = array(); - $head[$h][0] = dol_buildpath("/eventorganization/conferenceorbooth_list.php", 1).'?projectid='.$object->id; + $head[$h][0] = DOL_URL_ROOT . 'eventorganization/conferenceorbooth_list.php?projectid=' . $object->id; $head[$h][1] = $langs->trans("ConferenceOrBooth"); $head[$h][2] = 'conferenceorbooth'; // Enable caching of conf or booth count attendees $nbAttendees = 0; - $nbConferenceOrBooth= 0; - require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php'; - $cachekey = 'count_conferenceorbooth_project_'.$object->id; + $nbConferenceOrBooth = 0; + require_once DOL_DOCUMENT_ROOT . '/core/lib/memory.lib.php'; + $cachekey = 'count_conferenceorbooth_project_' . $object->id; $dataretrieved = dol_getcache($cachekey); if (!is_null($dataretrieved)) { $nbAttendees = $dataretrieved; } else { - require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorbooth.class.php'; - $conforbooth=new ConferenceOrBooth($db); - $result = $conforbooth->fetchAll('', '', 0, 0, '(t.fk_project:=:'.((int) $object->id).')'); - if (!is_array($result) && $result<0) { + require_once DOL_DOCUMENT_ROOT . '/eventorganization/class/conferenceorbooth.class.php'; + $conforbooth = new ConferenceOrBooth($db); + $result = $conforbooth->fetchAll('', '', 0, 0, '(t.fk_project:=:' . ((int) $object->id) . ')'); + if (!is_array($result) && $result < 0) { setEventMessages($conforbooth->error, $conforbooth->errors, 'errors'); } else { $nbConferenceOrBooth = count($result); @@ -148,25 +149,25 @@ function conferenceorboothProjectPrepareHead($object) dol_setcache($cachekey, $nbConferenceOrBooth, 120); // If setting cache fails, this is not a problem, so we do not test result. } if ($nbConferenceOrBooth > 0) { - $head[$h][1] .= ''.$nbConferenceOrBooth.''; + $head[$h][1] .= '' . $nbConferenceOrBooth . ''; } $h++; - $head[$h][0] = dol_buildpath("/eventorganization/conferenceorboothattendee_list.php", 1).'?fk_project='.$object->id.'&withproject=1'; + $head[$h][0] = DOL_URL_ROOT . '/eventorganization/conferenceorboothattendee_list.php?fk_project=' . $object->id . '&withproject=1'; $head[$h][1] = $langs->trans("Attendees"); $head[$h][2] = 'attendees'; // Enable caching of conf or booth count attendees $nbAttendees = 0; - require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php'; - $cachekey = 'count_attendees_conferenceorbooth_project_'.$object->id; + require_once DOL_DOCUMENT_ROOT . '/core/lib/memory.lib.php'; + $cachekey = 'count_attendees_conferenceorbooth_project_' . $object->id; $dataretrieved = dol_getcache($cachekey); if (!is_null($dataretrieved)) { $nbAttendees = $dataretrieved; } else { - require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorboothattendee.class.php'; - $attendees=new ConferenceOrBoothAttendee($db); - $result = $attendees->fetchAll('', '', 0, 0, '(t.fk_project:=:'.((int) $object->id).')'); - if (!is_array($result) && $result<0) { + require_once DOL_DOCUMENT_ROOT . '/eventorganization/class/conferenceorboothattendee.class.php'; + $attendees = new ConferenceOrBoothAttendee($db); + $result = $attendees->fetchAll('', '', 0, 0, '(t.fk_project:=:' . ((int) $object->id) . ')'); + if (!is_array($result) && $result < 0) { setEventMessages($attendees->error, $attendees->errors, 'errors'); } else { $nbAttendees = count($result); @@ -174,7 +175,7 @@ function conferenceorboothProjectPrepareHead($object) dol_setcache($cachekey, $nbAttendees, 120); // If setting cache fails, this is not a problem, so we do not test result. } if ($nbAttendees > 0) { - $head[$h][1] .= ''.$nbAttendees.''; + $head[$h][1] .= '' . $nbAttendees . ''; } complete_head_from_modules($conf, $langs, $object, $head, $h, 'conferenceorboothproject@eventorganization'); @@ -200,7 +201,7 @@ function conferenceorboothAttendeePrepareHead($object) $h = 0; $head = array(); - $head[$h][0] = DOL_URL_ROOT."/eventorganization/conferenceorboothattendee_card.php?id=".((int) $object->id).($object->fk_actioncomm > 0 ? '&conforboothid='.((int) $object->fk_actioncomm) : '').($object->fk_project > 0 ? '&withproject=1&fk_project='.((int) $object->fk_project) : ''); + $head[$h][0] = DOL_URL_ROOT . "/eventorganization/conferenceorboothattendee_card.php?id=" . ((int) $object->id) . ($object->fk_actioncomm > 0 ? '&conforboothid=' . ((int) $object->fk_actioncomm) : '') . ($object->fk_project > 0 ? '&withproject=1&fk_project=' . ((int) $object->fk_project) : ''); $head[$h][1] = $langs->trans("Card"); $head[$h][2] = 'card'; $h++; diff --git a/htdocs/loan/class/paymentloan.class.php b/htdocs/loan/class/paymentloan.class.php index b0064f2a62c..3ec3fda1f0e 100644 --- a/htdocs/loan/class/paymentloan.class.php +++ b/htdocs/loan/class/paymentloan.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2015-2023 Frederic France + * Copyright (C) 2015-2024 Frédéric France * Copyright (C) 2020 Maxime DEMAREST * * This program is free software; you can redistribute it and/or modify @@ -61,7 +61,10 @@ class PaymentLoan extends CommonObject */ public $datep = ''; - public $amounts = array(); // Array of amounts + /** + * @var array Array of amounts + */ + public $amounts = array(); public $amount_capital; // Total amount of payment diff --git a/htdocs/mrp/ajax/interface.php b/htdocs/mrp/ajax/interface.php index 17000dd0207..afb2a33d7df 100644 --- a/htdocs/mrp/ajax/interface.php +++ b/htdocs/mrp/ajax/interface.php @@ -1,7 +1,24 @@ + * Copyright (C) 2024 Frédéric France + * + * 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 + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ /** * \file htdocs/mrp/ajax/interface.php + * \brief Ajax search component for Mrp. */ if (!defined('NOREQUIRESOC')) { diff --git a/htdocs/mrp/lib/mrp.lib.php b/htdocs/mrp/lib/mrp.lib.php index c650c4dd02b..20840d40e1b 100644 --- a/htdocs/mrp/lib/mrp.lib.php +++ b/htdocs/mrp/lib/mrp.lib.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 Frédéric France * * 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 @@ -16,7 +17,7 @@ */ /** - * \file mrp/lib/mrp.lib.php + * \file htdocs/mrp/lib/mrp.lib.php * \ingroup mrp * \brief Library files with common functions for Mrp */ @@ -38,21 +39,21 @@ function mrpAdminPrepareHead() $h = 0; $head = array(); - $head[$h][0] = dol_buildpath("/admin/mrp.php", 1); + $head[$h][0] = DOL_URL_ROOT . '/admin/mrp.php'; $head[$h][1] = $langs->trans("Settings"); $head[$h][2] = 'settings'; $h++; - $head[$h][0] = dol_buildpath("/admin/mrp_extrafields.php", 1); + $head[$h][0] = DOL_URL_ROOT . '/admin/mrp_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFields"); $nbExtrafields = $extrafields->attributes['mrp_mo']['count']; if ($nbExtrafields > 0) { - $head[$h][1] .= ''.$nbExtrafields.''; + $head[$h][1] .= '' . $nbExtrafields . ''; } $head[$h][2] = 'mrp_extrafields'; $h++; - $head[$h][0] = dol_buildpath("/admin/mrp_production_extrafields.php", 1); + $head[$h][0] = DOL_URL_ROOT . '/admin/mrp_production_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFieldsLines"); $head[$h][2] = 'mrp_production_extrafields'; $h++; diff --git a/htdocs/mrp/lib/mrp_mo.lib.php b/htdocs/mrp/lib/mrp_mo.lib.php index f78f5da9166..63f39445e91 100644 --- a/htdocs/mrp/lib/mrp_mo.lib.php +++ b/htdocs/mrp/lib/mrp_mo.lib.php @@ -1,5 +1,6 @@ * * 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 @@ -36,26 +37,26 @@ function moPrepareHead($object) $h = 0; $head = array(); - $head[$h][0] = DOL_URL_ROOT.'/mrp/mo_card.php?id='.$object->id; + $head[$h][0] = DOL_URL_ROOT . '/mrp/mo_card.php?id=' . $object->id; $head[$h][1] = $langs->trans("ManufacturingOrder"); $head[$h][2] = 'card'; $h++; - $head[$h][0] = DOL_URL_ROOT.'/mrp/mo_production.php?id='.$object->id; + $head[$h][0] = DOL_URL_ROOT . '/mrp/mo_production.php?id=' . $object->id; $head[$h][1] = $langs->trans("Production"); $arrayproduced = $object->fetchLinesLinked('produced', 0); $nbProduced = 0; foreach ($arrayproduced as $lineproduced) { $nbProduced += $lineproduced['qty']; } - $head[$h][1] .= ''.$nbProduced.' / '.$object->qty.''; + $head[$h][1] .= '' . $nbProduced . ' / ' . $object->qty . ''; $head[$h][2] = 'production'; $h++; - $head[$h][0] = DOL_URL_ROOT.'/mrp/mo_movements.php?id='.$object->id; + $head[$h][0] = DOL_URL_ROOT . '/mrp/mo_movements.php?id=' . $object->id; $head[$h][1] = $langs->trans("StockMovements"); $nbMove = $object->countMovements(); - $head[$h][1] .= ''.$nbMove.''; + $head[$h][1] .= '' . $nbMove . ''; $head[$h][2] = 'stockmovement'; $h++; @@ -67,29 +68,29 @@ function moPrepareHead($object) if (!empty($object->note_public)) { $nbNote++; } - $head[$h][0] = dol_buildpath('/mrp/mo_note.php', 1).'?id='.$object->id; + $head[$h][0] = DOL_URL_ROOT . '/mrp/mo_note.php?id=' . $object->id; $head[$h][1] = $langs->trans('Notes'); if ($nbNote > 0) { - $head[$h][1] .= ''.$nbNote.''; + $head[$h][1] .= '' . $nbNote . ''; } $head[$h][2] = 'note'; $h++; } - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; - $upload_dir = $conf->mrp->dir_output."/".dol_sanitizeFileName($object->ref); + require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; + require_once DOL_DOCUMENT_ROOT . '/core/class/link.class.php'; + $upload_dir = $conf->mrp->dir_output . "/" . dol_sanitizeFileName($object->ref); $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); $nbLinks = Link::count($db, $object->element, $object->id); - $head[$h][0] = dol_buildpath("/mrp/mo_document.php", 1).'?id='.$object->id; + $head[$h][0] = DOL_URL_ROOT . '/mrp/mo_document.php?id=' . $object->id; $head[$h][1] = $langs->trans('Documents'); if (($nbFiles + $nbLinks) > 0) { - $head[$h][1] .= ''.($nbFiles + $nbLinks).''; + $head[$h][1] .= '' . ($nbFiles + $nbLinks) . ''; } $head[$h][2] = 'document'; $h++; - $head[$h][0] = dol_buildpath("/mrp/mo_agenda.php", 1).'?id='.$object->id; + $head[$h][0] = DOL_URL_ROOT . '/mrp/mo_agenda.php?id=' . $object->id; $head[$h][1] = $langs->trans("Events"); $head[$h][2] = 'agenda'; $h++; diff --git a/htdocs/mrp/mo_agenda.php b/htdocs/mrp/mo_agenda.php index 86f8778e799..d4c87b7015e 100644 --- a/htdocs/mrp/mo_agenda.php +++ b/htdocs/mrp/mo_agenda.php @@ -1,6 +1,6 @@ - * Copyright (C) ---Put here your own copyright and developer email--- + * Copyright (C) 2024 Frédéric France * * 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,8 +30,8 @@ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; -dol_include_once('/mrp/class/mo.class.php'); -dol_include_once('/mrp/lib/mrp_mo.lib.php'); +require_once DOL_DOCUMENT_ROOT.'/mrp/class/mo.class.php'; +require_once DOL_DOCUMENT_ROOT.'/mrp/lib/mrp_mo.lib.php'; // Load translation files required by the page diff --git a/htdocs/mrp/mo_document.php b/htdocs/mrp/mo_document.php index c8f09b37a9b..6afe0f35686 100644 --- a/htdocs/mrp/mo_document.php +++ b/htdocs/mrp/mo_document.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 Frédéric France * * 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 @@ -16,7 +17,7 @@ */ /** - * \file mo_document.php + * \file htdocs/mrp/mo_document.php * \ingroup mrp * \brief Tab for documents linked to Mo */ @@ -30,8 +31,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; -dol_include_once('/mrp/class/mo.class.php'); -dol_include_once('/mrp/lib/mrp_mo.lib.php'); +require_once DOL_DOCUMENT_ROOT.'/mrp/class/mo.class.php'; +require_once DOL_DOCUMENT_ROOT.'/mrp/lib/mrp_mo.lib.php'; // Load translation files required by the page $langs->loadLangs(array("mrp", "companies", "other", "mails")); diff --git a/htdocs/mrp/mo_movements.php b/htdocs/mrp/mo_movements.php index deb9d39a97a..b5395b9b04b 100644 --- a/htdocs/mrp/mo_movements.php +++ b/htdocs/mrp/mo_movements.php @@ -1,6 +1,7 @@ * Copyright (C) 2022 Ferran Marcet + * Copyright (C) 2024 Frédéric France * * 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 @@ -33,8 +34,8 @@ require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/stock/class/productlot.class.php'; -dol_include_once('/mrp/class/mo.class.php'); -dol_include_once('/mrp/lib/mrp_mo.lib.php'); +require_once DOL_DOCUMENT_ROOT.'/mrp/class/mo.class.php'; +require_once DOL_DOCUMENT_ROOT.'/mrp/lib/mrp_mo.lib.php'; // Load translation files required by the page $langs->loadLangs(array("mrp", "stocks", "other")); diff --git a/htdocs/mrp/mo_note.php b/htdocs/mrp/mo_note.php index 19b630aaf53..9d24201da2e 100644 --- a/htdocs/mrp/mo_note.php +++ b/htdocs/mrp/mo_note.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 Frédéric France * * 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,8 +27,8 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; -dol_include_once('/mrp/class/mo.class.php'); -dol_include_once('/mrp/lib/mrp_mo.lib.php'); +require_once DOL_DOCUMENT_ROOT.'/mrp/class/mo.class.php'; +require_once DOL_DOCUMENT_ROOT.'/mrp/lib/mrp_mo.lib.php'; // Load translation files required by the page $langs->loadLangs(array("mrp", "companies")); diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php index 11e6ce992ce..c13813c342f 100644 --- a/htdocs/mrp/mo_production.php +++ b/htdocs/mrp/mo_production.php @@ -2,6 +2,7 @@ /* Copyright (C) 2019-2020 Laurent Destailleur * Copyright (C) 2023 Christian Humpel * Copyright (C) 2023 Vincent de Grandpré + * Copyright (C) 2024 Frédéric France * * 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 @@ $result = restrictedArea($user, 'mrp', $object->id, 'mrp_mo', '', 'fk_soc', 'row $permissionnote = $user->hasRight('mrp', 'write'); // Used by the include of actions_setnotes.inc.php $permissiondellink = $user->hasRight('mrp', 'write'); // Used by the include of actions_dellink.inc.php $permissiontoadd = $user->hasRight('mrp', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php -$permissiontodelete = $user->rights->mrp->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT); +$permissiontodelete = $user->hasRight('mrp', 'delete') || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT); $permissiontoproduce = $permissiontoadd; $permissiontoupdatecost = $user->hasRight('bom', 'read'); // User who can define cost must have knowledge of pricing diff --git a/htdocs/partnership/lib/partnership.lib.php b/htdocs/partnership/lib/partnership.lib.php index ec8f7b80987..f5822e20a16 100644 --- a/htdocs/partnership/lib/partnership.lib.php +++ b/htdocs/partnership/lib/partnership.lib.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2021 Dorian Laurent + * Copyright (C) 2024 Frédéric France * * 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 @@ -16,7 +17,7 @@ */ /** - * \file partnership/lib/partnership.lib.php + * \file htdocs/partnership/lib/partnership.lib.php * \ingroup partnership * \brief Library files with common functions for Partnership */ @@ -38,22 +39,22 @@ function partnershipAdminPrepareHead() $h = 0; $head = array(); - $head[$h][0] = dol_buildpath("/partnership/admin/setup.php", 1); + $head[$h][0] = DOL_URL_ROOT . '/partnership/admin/setup.php'; $head[$h][1] = $langs->trans("Settings"); $head[$h][2] = 'settings'; $h++; - $head[$h][0] = dol_buildpath("/partnership/admin/partnership_extrafields.php", 1); + $head[$h][0] = DOL_URL_ROOT . '/partnership/admin/partnership_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFields"); $nbExtrafields = $extrafields->attributes['partnership']['count']; if ($nbExtrafields > 0) { - $head[$h][1] .= ''.$nbExtrafields.''; + $head[$h][1] .= '' . $nbExtrafields . ''; } $head[$h][2] = 'partnership_extrafields'; $h++; - $head[$h][0] = dol_buildpath("/partnership/admin/website.php", 1); + $head[$h][0] = DOL_URL_ROOT . '/partnership/admin/website.php'; $head[$h][1] = $langs->trans("BlankSubscriptionForm"); $head[$h][2] = 'website'; $h++; @@ -88,7 +89,7 @@ function partnershipPrepareHead($object) $h = 0; $head = array(); - $head[$h][0] = dol_buildpath("/partnership/partnership_card.php", 1).'?id='.$object->id; + $head[$h][0] = DOL_URL_ROOT . '/partnership/partnership_card.php?id=' . $object->id; $head[$h][1] = $langs->trans("Card"); $head[$h][2] = 'card'; $h++; @@ -101,29 +102,29 @@ function partnershipPrepareHead($object) if (!empty($object->note_public)) { $nbNote++; } - $head[$h][0] = dol_buildpath('/partnership/partnership_note.php', 1).'?id='.$object->id; + $head[$h][0] = DOL_URL_ROOT . '/partnership/partnership_note.php?id=' . $object->id; $head[$h][1] = $langs->trans('Notes'); if ($nbNote > 0) { - $head[$h][1] .= (!getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER') ? ''.$nbNote.'' : ''); + $head[$h][1] .= (!getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER') ? '' . $nbNote . '' : ''); } $head[$h][2] = 'note'; $h++; } - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; - $upload_dir = $conf->partnership->dir_output."/partnership/".dol_sanitizeFileName($object->ref); + require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; + require_once DOL_DOCUMENT_ROOT . '/core/class/link.class.php'; + $upload_dir = $conf->partnership->dir_output . "/partnership/" . dol_sanitizeFileName($object->ref); $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); $nbLinks = Link::count($db, $object->element, $object->id); - $head[$h][0] = dol_buildpath("/partnership/partnership_document.php", 1).'?id='.$object->id; + $head[$h][0] = DOL_URL_ROOT . '/partnership/partnership_document.php?id=' . $object->id; $head[$h][1] = $langs->trans('Documents'); if (($nbFiles + $nbLinks) > 0) { - $head[$h][1] .= ''.($nbFiles + $nbLinks).''; + $head[$h][1] .= '' . ($nbFiles + $nbLinks) . ''; } $head[$h][2] = 'document'; $h++; - $head[$h][0] = dol_buildpath("/partnership/partnership_agenda.php", 1).'?id='.$object->id; + $head[$h][0] = DOL_URL_ROOT . '/partnership/partnership_agenda.php?id=' . $object->id; $head[$h][1] = $langs->trans("Events"); $head[$h][2] = 'agenda'; $h++; diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 722af2e74b2..2d664de7376 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -70,6 +70,11 @@ class Product extends CommonObject */ public $fk_element = 'fk_product'; + /** + * @var Product + */ + public $oldcopy; + /** * @var array List of child tables. To test if we can delete object. */ @@ -290,7 +295,7 @@ class Product extends CommonObject public $duration; /** - * Service Workstation + * @var int Service Workstation */ public $fk_default_workstation; @@ -487,6 +492,10 @@ class Product extends CommonObject public $fourn_qty; public $fourn_pu; public $fourn_price_base_type; + + /** + * @var int ID + */ public $fourn_socid; /** @@ -529,7 +538,7 @@ class Product extends CommonObject public $sousprods; /** - * Path of subproducts. Build from ->sousprods with get_arbo_each_prod() + * @var array Path of subproducts. Build from ->sousprods with get_arbo_each_prod() */ public $res; diff --git a/htdocs/recruitment/lib/recruitment.lib.php b/htdocs/recruitment/lib/recruitment.lib.php index 911c6abdb03..97690d73ea7 100644 --- a/htdocs/recruitment/lib/recruitment.lib.php +++ b/htdocs/recruitment/lib/recruitment.lib.php @@ -1,6 +1,6 @@ - * Copyright (C) 2022 Frédéric France + * Copyright (C) 2022-2024 Frédéric France * * 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 @@ -17,7 +17,7 @@ */ /** - * \file recruitment/lib/recruitment.lib.php + * \file htdocs/recruitment/lib/recruitment.lib.php * \ingroup recruitment * \brief Library files with common functions for Recruitment */ @@ -40,35 +40,35 @@ function recruitmentAdminPrepareHead() $h = 0; $head = array(); - $head[$h][0] = dol_buildpath("/recruitment/admin/setup.php", 1); + $head[$h][0] = DOL_URL_ROOT . '/recruitment/admin/setup.php'; $head[$h][1] = $langs->trans("JobPositions"); $head[$h][2] = 'settings'; $h++; - $head[$h][0] = dol_buildpath("/recruitment/admin/setup_candidatures.php", 1); + $head[$h][0] = DOL_URL_ROOT . '/recruitment/admin/setup_candidatures.php'; $head[$h][1] = $langs->trans("RecruitmentCandidatures"); $head[$h][2] = 'settings_candidatures'; $h++; - $head[$h][0] = dol_buildpath("/recruitment/admin/public_interface.php", 1); + $head[$h][0] = DOL_URL_ROOT . '/recruitment/admin/public_interface.php'; $head[$h][1] = $langs->trans("PublicUrl"); $head[$h][2] = 'publicurl'; $h++; - $head[$h][0] = dol_buildpath("/recruitment/admin/jobposition_extrafields.php", 1); + $head[$h][0] = DOL_URL_ROOT . '/recruitment/admin/jobposition_extrafields.php'; $head[$h][1] = $langs->trans("ExtrafieldsJobPosition"); $nbExtrafields = $extrafields->attributes['recruitment_recruitmentjobposition']['count']; if ($nbExtrafields > 0) { - $head[$h][1] .= ''.$nbExtrafields.''; + $head[$h][1] .= '' . $nbExtrafields . ''; } $head[$h][2] = 'jobposition_extrafields'; $h++; - $head[$h][0] = dol_buildpath("/recruitment/admin/candidature_extrafields.php", 1); + $head[$h][0] = DOL_URL_ROOT . '/recruitment/admin/candidature_extrafields.php'; $head[$h][1] = $langs->trans("ExtrafieldsApplication"); $nbExtrafields = $extrafields->attributes['recruitment_recruitmentcandidature']['count']; if ($nbExtrafields > 0) { - $head[$h][1] .= ''.$nbExtrafields.''; + $head[$h][1] .= '' . $nbExtrafields . ''; } $head[$h][2] = 'candidature_extrafields'; $h++; diff --git a/htdocs/recruitment/lib/recruitment_recruitmentcandidature.lib.php b/htdocs/recruitment/lib/recruitment_recruitmentcandidature.lib.php index c4ad141bca6..d6a0de449dc 100644 --- a/htdocs/recruitment/lib/recruitment_recruitmentcandidature.lib.php +++ b/htdocs/recruitment/lib/recruitment_recruitmentcandidature.lib.php @@ -1,5 +1,6 @@ * * 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 @@ -36,13 +37,13 @@ function recruitmentCandidaturePrepareHead($object) $h = 0; $head = array(); - $head[$h][0] = dol_buildpath("/recruitment/recruitmentcandidature_card.php", 1).'?id='.$object->id; + $head[$h][0] = DOL_URL_ROOT . '/recruitment/recruitmentcandidature_card.php?id=' . $object->id; $head[$h][1] = $langs->trans("RecruitmentCandidature"); $head[$h][2] = 'card'; $h++; // if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { - // $head[$h][0] = dol_buildpath("/recruitment/recruitmentrating_card.php", 1).'?id='.$object->id; + // $head[$h][0] = DOL_URL_ROOT.'/recruitment/recruitmentrating_card.php?id='.$object->id; // $head[$h][1] = $langs->trans("Rating"); // $head[$h][2] = 'rating'; // $h++; @@ -56,29 +57,29 @@ function recruitmentCandidaturePrepareHead($object) if (!empty($object->note_public)) { $nbNote++; } - $head[$h][0] = dol_buildpath('/recruitment/recruitmentcandidature_note.php', 1).'?id='.$object->id; + $head[$h][0] = DOL_URL_ROOT . '/recruitment/recruitmentcandidature_note.php?id=' . $object->id; $head[$h][1] = $langs->trans('Notes'); if ($nbNote > 0) { - $head[$h][1] .= ''.$nbNote.''; + $head[$h][1] .= '' . $nbNote . ''; } $head[$h][2] = 'note'; $h++; } - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; - $upload_dir = $conf->recruitment->dir_output."/recruitmentcandidature/".dol_sanitizeFileName($object->ref); + require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; + require_once DOL_DOCUMENT_ROOT . '/core/class/link.class.php'; + $upload_dir = $conf->recruitment->dir_output . "/recruitmentcandidature/" . dol_sanitizeFileName($object->ref); $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); $nbLinks = Link::count($db, $object->element, $object->id); - $head[$h][0] = dol_buildpath("/recruitment/recruitmentcandidature_document.php", 1).'?id='.$object->id; + $head[$h][0] = DOL_URL_ROOT . '/recruitment/recruitmentcandidature_document.php?id=' . $object->id; $head[$h][1] = $langs->trans('Documents'); if (($nbFiles + $nbLinks) > 0) { - $head[$h][1] .= ''.($nbFiles + $nbLinks).''; + $head[$h][1] .= '' . ($nbFiles + $nbLinks) . ''; } $head[$h][2] = 'document'; $h++; - $head[$h][0] = dol_buildpath("/recruitment/recruitmentcandidature_agenda.php", 1).'?id='.$object->id; + $head[$h][0] = DOL_URL_ROOT . '/recruitment/recruitmentcandidature_agenda.php?id=' . $object->id; $head[$h][1] = $langs->trans("Events"); $head[$h][2] = 'agenda'; $h++; diff --git a/htdocs/recruitment/lib/recruitment_recruitmentjobposition.lib.php b/htdocs/recruitment/lib/recruitment_recruitmentjobposition.lib.php index a269bc61683..8fafb1c3fdc 100644 --- a/htdocs/recruitment/lib/recruitment_recruitmentjobposition.lib.php +++ b/htdocs/recruitment/lib/recruitment_recruitmentjobposition.lib.php @@ -1,5 +1,6 @@ * * 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 @@ -36,21 +37,21 @@ function recruitmentjobpositionPrepareHead($object) $h = 0; $head = array(); - $head[$h][0] = dol_buildpath("/recruitment/recruitmentjobposition_card.php", 1).'?id='.$object->id; + $head[$h][0] = DOL_URL_ROOT . '/recruitment/recruitmentjobposition_card.php?id=' . $object->id; $head[$h][1] = $langs->trans("PositionToBeFilled"); $head[$h][2] = 'card'; $h++; - $head[$h][0] = dol_buildpath("/recruitment/recruitmentcandidature_list.php", 1).'?id='.$object->id; + $head[$h][0] = DOL_URL_ROOT . '/recruitment/recruitmentcandidature_list.php?id=' . $object->id; $head[$h][1] = $langs->trans("RecruitmentCandidatures"); - $sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."recruitment_recruitmentcandidature WHERE fk_recruitmentjobposition = ".((int) $object->id); + $sql = "SELECT COUNT(rowid) as nb FROM " . MAIN_DB_PREFIX . "recruitment_recruitmentcandidature WHERE fk_recruitmentjobposition = " . ((int) $object->id); $resql = $db->query($sql); if ($resql) { $obj = $db->fetch_object($resql); if ($obj) { $nCandidature = $obj->nb; if ($nCandidature > 0) { - $head[$h][1] .= ''.$nCandidature.''; + $head[$h][1] .= '' . $nCandidature . ''; } } } else { @@ -67,29 +68,29 @@ function recruitmentjobpositionPrepareHead($object) if (!empty($object->note_public)) { $nbNote++; } - $head[$h][0] = dol_buildpath('/recruitment/recruitmentjobposition_note.php', 1).'?id='.$object->id; + $head[$h][0] = DOL_URL_ROOT . '/recruitment/recruitmentjobposition_note.php?id=' . $object->id; $head[$h][1] = $langs->trans('Notes'); if ($nbNote > 0) { - $head[$h][1] .= ''.$nbNote.''; + $head[$h][1] .= '' . $nbNote . ''; } $head[$h][2] = 'note'; $h++; } - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; - $upload_dir = $conf->recruitment->dir_output."/recruitmentjobposition/".dol_sanitizeFileName($object->ref); + require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; + require_once DOL_DOCUMENT_ROOT . '/core/class/link.class.php'; + $upload_dir = $conf->recruitment->dir_output . "/recruitmentjobposition/" . dol_sanitizeFileName($object->ref); $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); $nbLinks = Link::count($db, $object->element, $object->id); - $head[$h][0] = dol_buildpath("/recruitment/recruitmentjobposition_document.php", 1).'?id='.$object->id; + $head[$h][0] = DOL_URL_ROOT . '/recruitment/recruitmentjobposition_document.php?id=' . $object->id; $head[$h][1] = $langs->trans('Documents'); if (($nbFiles + $nbLinks) > 0) { - $head[$h][1] .= ''.($nbFiles + $nbLinks).''; + $head[$h][1] .= '' . ($nbFiles + $nbLinks) . ''; } $head[$h][2] = 'document'; $h++; - $head[$h][0] = dol_buildpath("/recruitment/recruitmentjobposition_agenda.php", 1).'?id='.$object->id; + $head[$h][0] = DOL_URL_ROOT . '/recruitment/recruitmentjobposition_agenda.php?id=' . $object->id; $head[$h][1] = $langs->trans("Events"); $head[$h][2] = 'agenda'; $h++; @@ -126,8 +127,8 @@ function getPublicJobPositionUrl($mode, $ref = '', $localorexternal = 0) $out = ''; // Define $urlwithroot - $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); - $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file + $urlwithouturlroot = preg_replace('/' . preg_quote(DOL_URL_ROOT, '/') . '$/i', '', trim($dolibarr_main_url_root)); + $urlwithroot = $urlwithouturlroot . DOL_URL_ROOT; // This is to use external domain name found into config file //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current $urltouse = DOL_MAIN_URL_ROOT; @@ -135,7 +136,7 @@ function getPublicJobPositionUrl($mode, $ref = '', $localorexternal = 0) $urltouse = $urlwithroot; } - $out = $urltouse.'/public/recruitment/view.php?ref='.($mode ? '' : '').$ref.($mode ? '' : ''); + $out = $urltouse . '/public/recruitment/view.php?ref=' . ($mode ? '' : '') . $ref . ($mode ? '' : ''); /*if (!empty($conf->global->RECRUITMENT_SECURITY_TOKEN)) { if (empty($conf->global->RECRUITMENT_SECURITY_TOKEN)) $out .= '&securekey='.urlencode($conf->global->RECRUITMENT_SECURITY_TOKEN); @@ -144,7 +145,7 @@ function getPublicJobPositionUrl($mode, $ref = '', $localorexternal = 0) // For multicompany if (!empty($out) && isModEnabled('multicompany')) { - $out .= "&entity=".$conf->entity; // Check the entity because we may have the same reference in several entities + $out .= "&entity=" . $conf->entity; // Check the entity because we may have the same reference in several entities } return $out; diff --git a/htdocs/societe/class/client.class.php b/htdocs/societe/class/client.class.php index b1fad2a4be8..9c858eb6da2 100644 --- a/htdocs/societe/class/client.class.php +++ b/htdocs/societe/class/client.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2004 Rodolphe Quiedeville * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2020 Open-Dsi + * Copyright (C) 2024 Frédéric France * * 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,8 +31,14 @@ include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; */ class Client extends Societe { - public $next_prev_filter = "te.client in (1,2,3)"; // Used to add a filter in Form::showrefnav method + /** + * @var string Used to add a filter in Form::showrefnav method + */ + public $next_prev_filter = "te.client in (1,2,3)"; + /** + * @var array + */ public $cacheprospectstatus = array(); diff --git a/htdocs/theme/eldy/flags-sprite.inc.php b/htdocs/theme/eldy/flags-sprite.inc.php index 56300e37e3f..274235f844a 100644 --- a/htdocs/theme/eldy/flags-sprite.inc.php +++ b/htdocs/theme/eldy/flags-sprite.inc.php @@ -1,6 +1,28 @@ + * Copyright (C) 2024 Frédéric France + * + * 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 + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/theme/eldy/flag-sprite.inc.php + * \brief File for CSS style sheet Eldy + */ if (!defined('ISLOADEDBYSTEELSHEET')) { - die('Must be call by steelsheet'); + die('Must be call by stylesheet'); } ?> /*