Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix checkFunctionArgumentTypes #30249

Merged
merged 11 commits into from
Jul 4, 2024
4 changes: 2 additions & 2 deletions htdocs/contrat/class/contrat.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -2796,9 +2796,9 @@ public function doAutoRenewContracts($thirdparty_id = 0, $delayindaysshort = 0)
if ($expirationdate && $expirationdate < $enddatetoscan) {
dol_syslog("Define the newdate of end of services from expirationdate=".$expirationdate);
$newdate = $expirationdate;
$protecti = 0; //$protecti is to avoid infinite loop
$protecti = 0; // $protecti is to avoid infinite loop
while ($newdate < $enddatetoscan && $protecti < 1000) {
$newdate = dol_time_plus_duree($newdate, $duration_value, $duration_unit);
$newdate = dol_time_plus_duree($newdate, (int) $duration_value, $duration_unit);
$protecti++;
}

Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/lib/functions2.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -893,7 +893,7 @@ function array2table($data, $tableMarkup = 1, $tableoptions = '', $troptions = '
* @param string $table Table containing field with counter
* @param string $field Field containing already used values of counter
* @param string $where To add a filter on selection (for example to filter on invoice types)
* @param Societe|string $objsoc The company that own the object we need a counter for
* @param Societe|'' $objsoc The company that own the object we need a counter for
* @param string $date Date to use for the {y},{m},{d} tags.
* @param string $mode 'next' for next value or 'last' for last value
* @param bool $bentityon Activate the entity filter. Default is true (for modules not compatible with multicompany)
Expand Down
6 changes: 3 additions & 3 deletions htdocs/core/modules/asset/mod_asset_advanced.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
* Copyright (C) 2019-2022 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2019-2024 Frédéric France <frederic.france@free.fr>
*
* 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
Expand Down Expand Up @@ -98,7 +98,7 @@ public function info($langs)
*/
public function getExample()
{
global $conf, $db, $langs, $mysoc;
global $db, $langs;

$object = new Asset($db);
$object->initAsSpecimen();
Expand Down Expand Up @@ -133,7 +133,7 @@ public function getNextValue($object)

$date = $object->date;

$numFinal = get_next_value($db, $mask, 'asset', 'ref', '', null, $date);
$numFinal = get_next_value($db, $mask, 'asset', 'ref', '', '', $date);

return $numFinal;
}
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/modules/bom/mod_bom_advanced.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public function getNextValue($objprod, $object)

$date = ($object->date_bom ? $object->date_bom : $object->date);

$numFinal = get_next_value($db, $mask, 'bom_bom', 'ref', '', null, $date);
$numFinal = get_next_value($db, $mask, 'bom_bom', 'ref', '', '', $date);

return $numFinal;
}
Expand Down
16 changes: 11 additions & 5 deletions htdocs/core/modules/cheque/mod_chequereceipt_thyme.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,16 +93,22 @@ public function info($langs)
*/
public function getExample()
{
global $conf, $langs, $mysoc;
global $db, $langs;

$old_code_client = $mysoc->code_client;
$mysoc->code_client = 'CCCCCCCCCC';
$numExample = $this->getNextValue($mysoc, '');
$mysoc->code_client = $old_code_client;
require_once DOL_DOCUMENT_ROOT . '/compta/paiement/cheque/class/remisecheque.class.php';
require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';

$remise = new RemiseCheque($db);
$remise->initAsSpecimen();
$thirdparty = new Societe($db);
$thirdparty->initAsSpecimen();

$numExample = $this->getNextValue($thirdparty, $remise);

if (!$numExample) {
$numExample = $langs->trans('NotConfigured');
}

return $numExample;
}

Expand Down
16 changes: 11 additions & 5 deletions htdocs/core/modules/contract/mod_contract_magre.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,18 @@ public function info($langs)
*/
public function getExample()
{
global $langs, $mysoc;
global $db, $langs;

require_once DOL_DOCUMENT_ROOT . '/contrat/class/contrat.class.php';
require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';

$contract = new Contrat($db);
$contract->initAsSpecimen();
$thirdparty = new Societe($db);
$thirdparty->initAsSpecimen();

$numExample = $this->getNextValue($thirdparty, $contract);

$old_code_client = $mysoc->code_client;
$mysoc->code_client = 'CCCCCCCCCC';
$numExample = $this->getNextValue($mysoc, '');
$mysoc->code_client = $old_code_client;

if (!$numExample) {
$numExample = $langs->trans('NotConfigured');
Expand Down
12 changes: 8 additions & 4 deletions htdocs/core/modules/holiday/mod_holiday_immaculate.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2011-2019 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2018 Charlene Benke <charlie@patas-monkey.com>
/* Copyright (C) 2011-2019 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2018 Charlene Benke <charlie@patas-monkey.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* This program is free software; you can redistribute it and/or modify
Expand Down Expand Up @@ -88,11 +88,15 @@ public function info($langs)
*/
public function getExample()
{
global $conf, $langs, $user;
global $db, $langs, $user;
require_once DOL_DOCUMENT_ROOT . '/holiday/class/holiday.class.php';

$holiday = new Holiday($db);
$holiday->initAsSpecimen();

$old_login = $user->login;
$user->login = 'UUUUUUU';
$numExample = $this->getNextValue($user, '');
$numExample = $this->getNextValue($user, $holiday);
$user->login = $old_login;

if (!$numExample) {
Expand Down
19 changes: 9 additions & 10 deletions htdocs/core/modules/product_batch/mod_sn_advanced.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2019-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2021 Christophe Battarel <christophe@altairis.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
Expand Down Expand Up @@ -114,15 +114,14 @@ public function info($langs)
*/
public function getExample()
{
global $conf, $langs, $mysoc;

$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;
global $db, $langs;

require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';

$thirdparty = new Societe($db);
$thirdparty->initAsSpecimen();

$numExample = $this->getNextValue($thirdparty, '');

if (!$numExample) {
$numExample = $langs->trans('NotConfigured');
Expand Down
9 changes: 8 additions & 1 deletion htdocs/core/modules/product_batch/mod_sn_free.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,14 @@ public function info($langs)
*/
public function getExample()
{
return $this->getNextValue(null, null);
global $db;

require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';

$thirdparty = new Societe($db);
$thirdparty->initAsSpecimen();

return $this->getNextValue($thirdparty, null);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/modules/stock/doc/pdf_standard.modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -838,7 +838,7 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlek
* Show footer of page. Need this->emetteur object
*
* @param TCPDF $pdf PDF
* @param Object $object Object to show
* @param Entrepot $object Object to show
* @param Translate $outputlangs Object lang for output
* @param int $hidefreetext 1=Hide free text
* @return int Return height of bottom margin including footer text
Expand Down
4 changes: 2 additions & 2 deletions htdocs/ecm/class/ecmfiles.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,12 @@ class EcmFiles extends CommonObject
public $extraparams;

/**
* @var int|string date create
* @var int|'' date create
*/
public $date_c = '';

/**
* @var int|string date modify
* @var int|'' date modify
*/
public $date_m = '';

Expand Down
2 changes: 1 addition & 1 deletion htdocs/emailcollector/class/emailcollector.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -2665,7 +2665,7 @@ public function doCollectOneCollector($mode = 0)
// Search country by name or code
if (!empty($contactstatic->country)) {
require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
$result = getCountry('', 3, $this->db, '', 1, $contactstatic->country);
$result = getCountry('', 3, $this->db, null, 1, $contactstatic->country);
if ($result == 'NotDefined') {
$errorforactions++;
$this->error = "Error country not found by this name '" . $contactstatic->country . "'";
Expand Down
6 changes: 3 additions & 3 deletions htdocs/expedition/card.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
* Copyright (C) 2015 Claudio Aschieri <c.aschieri@19.coop>
* Copyright (C) 2016-2018 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2016 Yasser Carreón <yacasia@gmail.com>
* Copyright (C) 2018-2022 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2020 Lenin Rivas <lenin@leninrivas.com>
* Copyright (C) 2022 Josep Lluís Amador <joseplluis@lliuretic.cat>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -2082,7 +2082,7 @@
if ($volumeUnit < 50) {
print showDimensionInBestUnit($calculatedVolume, $volumeUnit, "volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND) ? $conf->global->MAIN_VOLUME_DEFAULT_ROUND : -1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT) ? $conf->global->MAIN_VOLUME_DEFAULT_UNIT : 'no');
} else {
print $calculatedVolume.' '.measuringUnitString(0, "volume", $volumeUnit);
print $calculatedVolume.' '.measuringUnitString(0, "volume", (string) $volumeUnit);
}
}
if ($totalVolume > 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
* Copyright (C) 2019-2021 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2019-2024 Frédéric France <frederic.france@free.fr>
*
* 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
Expand Down Expand Up @@ -141,7 +141,7 @@ public function getNextValue($object)

$date = $object->date;

$numFinal = get_next_value($db, $mask, 'knowledgemanagement_knowledgerecord', 'ref', '', null, $date);
$numFinal = get_next_value($db, $mask, 'knowledgemanagement_knowledgerecord', 'ref', '', '', $date);

return $numFinal;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2019-2024 Frédéric France <frederic.france@free.fr>
*
* 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
Expand Down Expand Up @@ -140,7 +140,7 @@ public function getNextValue($object)

$date = $object->date;

$numFinal = get_next_value($db, $mask, 'mymodule_myobject', 'ref', '', null, $date);
$numFinal = get_next_value($db, $mask, 'mymodule_myobject', 'ref', '', '', $date);

return $numFinal;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
* Copyright (C) 2019-2023 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2019-2024 Frédéric France <frederic.france@free.fr>
*
* 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
Expand Down Expand Up @@ -142,7 +142,7 @@ public function getNextValue($object)

$date = $object->date;

$numFinal = get_next_value($db, $mask, 'partnership', 'ref', '', null, $date);
$numFinal = get_next_value($db, $mask, 'partnership', 'ref', '', '', $date);

return $numFinal;
}
Expand Down
5 changes: 3 additions & 2 deletions htdocs/reception/card.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2016 Yasser Carreón <yacasia@gmail.com>
* Copyright (C) 2018 Quentin Vial-Gouteyron <quentin.vial-gouteyron@atm-consulting.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 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
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -1613,7 +1614,7 @@
if ($volumeUnit < 50) {
print showDimensionInBestUnit($calculatedVolume, $volumeUnit, "volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND) ? $conf->global->MAIN_VOLUME_DEFAULT_ROUND : -1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT) ? $conf->global->MAIN_VOLUME_DEFAULT_UNIT : 'no');
} else {
print $calculatedVolume.' '.measuringUnitString(0, "volume", $volumeUnit);
print $calculatedVolume.' '.measuringUnitString(0, "volume", (string) $volumeUnit);
}
}
if ($totalVolume > 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public function getNextValue($object)

$date = $object->date ?? '';

$numFinal = get_next_value($db, $mask, 'recruitment_recruitmentcandidature', 'ref', '', null, $date);
$numFinal = get_next_value($db, $mask, 'recruitment_recruitmentcandidature', 'ref', '', '', $date);

return $numFinal;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public function getNextValue($object)

$date = $object->date ?? '';

$numFinal = get_next_value($db, $mask, 'recruitment_recruitmentjobposition', 'ref', '', null, $date);
$numFinal = get_next_value($db, $mask, 'recruitment_recruitmentjobposition', 'ref', '', '', $date);

return $numFinal;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
/**
* Prepare array of tabs for RecruitmentCandidature
*
* @param RecruitmentJobPosition $object RecruitmentCandidature
* @param RecruitmentCandidature $object RecruitmentCandidature
* @return array Array of tabs
*/
function recruitmentCandidaturePrepareHead($object)
Expand Down
4 changes: 2 additions & 2 deletions htdocs/user/group/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright (C) 2004-2018 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2024 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2011 Herve Prot <herve.prot@symeos.com>
* Copyright (C) 2019-2021 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2019-2024 Frédéric France <frederic.france@free.fr>
*
* 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
Expand Down Expand Up @@ -300,7 +300,7 @@

if ($caneditperms) {
$newcardbutton .= dolGetButtonTitleSeparator();
$newcardbutton .= dolGetButtonTitle($langs->trans('NewGroup'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/user/group/card.php?action=create&leftmenu=', '', $caneditperms);
$newcardbutton .= dolGetButtonTitle($langs->trans('NewGroup'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/user/group/card.php?action=create&leftmenu=', '', $caneditperms ? 1 : 0);
}

print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_'.$object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
Expand Down
Loading
Loading