diff --git a/.github/workflows/ci-tag-check.yml.disabled b/.github/workflows/ci-tag-check.yml.disabled new file mode 100644 index 00000000000..b874c6b69e3 --- /dev/null +++ b/.github/workflows/ci-tag-check.yml.disabled @@ -0,0 +1,24 @@ +# See syntax file on https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions +name: "Check tag branch" + +on: + push: + tags: + - "18.*" + +jobs: + check: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Verify tag is on main + run: | + TAG_COMMIT=$(git rev-list -n 1 $GITHUB_REF) + if ! git branch --contains $TAG_COMMIT | grep -q "18.0"; then + echo "The tag must be on branch 18.0" + exit 1 + fi diff --git a/.github/workflows/ci-test.yaml b/.github/workflows/ci-test.yaml index 1fa60e47a5e..06b5ad8e174 100644 --- a/.github/workflows/ci-test.yaml +++ b/.github/workflows/ci-test.yaml @@ -1,4 +1,5 @@ name: Test github actions + on: workflow_dispatch: pull_request: diff --git a/dev/build/generate_filelist_xml.php b/dev/build/generate_filelist_xml.php index c99dda6d558..5dc2219cb1e 100755 --- a/dev/build/generate_filelist_xml.php +++ b/dev/build/generate_filelist_xml.php @@ -78,7 +78,7 @@ while ($i < $argc) { $tmp = explode(':', $result['includeconstant'], 3); // $includeconstant has been set with previous parse_str() if (count($tmp) != 3) { print "Error: Bad parameter includeconstant=".$result['includeconstant'] ."\n"; - exit -1; + exit(1); } $includeconstants[$tmp[0]][$tmp[1]] = $tmp[2]; } @@ -180,7 +180,7 @@ fputs($fp, ''."\n"); // Define qualified files (must be same than into generate_filelist_xml.php and in api_setup.class.php) $regextoinclude = '\.(php|php3|php4|php5|phtml|phps|phar|inc|css|scss|html|xml|js|json|tpl|jpg|jpeg|png|gif|ico|sql|lang|txt|yml|bak|md|mp3|mp4|wav|mkv|z|gz|zip|rar|tar|less|svg|eot|woff|woff2|ttf|manifest)$'; -$regextoexclude = '('.($includecustom ? '' : 'custom|').'documents|conf|install|dejavu-fonts-ttf-.*|public\/test|sabre\/sabre\/.*\/tests|Shared\/PCLZip|nusoap\/lib\/Mail|php\/example|php\/test|geoip\/sample.*\.php|ckeditor\/samples|ckeditor\/adapters)$'; // Exclude dirs +$regextoexclude = '('.($includecustom ? '' : 'custom|').'documents|escpos-php\/doc|escpos-php\/example|escpos-php\/test|conf|install|dejavu-fonts-ttf-.*|public\/test|sabre\/sabre\/.*\/tests|Shared\/PCLZip|nusoap\/lib\/Mail|php\/test|geoip\/sample.*\.php|ckeditor\/samples|ckeditor\/adapters)$'; // Exclude dirs $files = dol_dir_list(DOL_DOCUMENT_ROOT, 'files', 1, $regextoinclude, $regextoexclude, 'fullname'); $dir = ''; diff --git a/dev/build/makepack-dolibarr.pl b/dev/build/makepack-dolibarr.pl index 58fc2fee5aa..13bbc3237ad 100755 --- a/dev/build/makepack-dolibarr.pl +++ b/dev/build/makepack-dolibarr.pl @@ -446,6 +446,15 @@ if ($nboftargetok) { print 'Create xml check file with md5 checksum with command php '.$SOURCE.'/dev/build/generate_filelist_xml.php release='.$MAJOR.'.'.$MINOR.'.'.$BUILD."\n"; $ret=`php $SOURCE/dev/build/generate_filelist_xml.php release=$MAJOR.$MINOR.$BUILD`; + my $retcode=$?; + if ($retcode!=0) + { + print "Error running generate_filelist_xml.php please check\n"; + print $ret; + print "Canceled.\n"; + exit; + } + print $ret."\n"; # Copy to final dir $NEWDESTI=$DESTI; diff --git a/dev/build/phpstan/phpstan-baseline.neon b/dev/build/phpstan/phpstan-baseline.neon index b1ad19d6bc2..b04158b2db6 100644 --- a/dev/build/phpstan/phpstan-baseline.neon +++ b/dev/build/phpstan/phpstan-baseline.neon @@ -696,114 +696,6 @@ parameters: count: 1 path: ../../../htdocs/adherents/card.php - - - message: '#^Call to function is_array\(\) with array will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 2 - path: ../../../htdocs/adherents/class/adherent.class.php - - - - message: '#^Call to function method_exists\(\) with \$this\(Adherent\) and ''getLibStatut'' will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../../htdocs/adherents/class/adherent.class.php - - - - message: '#^Call to function method_exists\(\) with \$this\(Adherent\) and ''getNomUrl'' will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../../htdocs/adherents/class/adherent.class.php - - - - message: '#^Call to function property_exists\(\) with \$this\(Adherent\) and ''photo'' will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../../htdocs/adherents/class/adherent.class.php - - - - message: '#^Call to function property_exists\(\) with \$this\(Adherent\) and ''societe'' will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../../htdocs/adherents/class/adherent.class.php - - - - message: '#^If condition is always false\.$#' - identifier: if.alwaysFalse - count: 1 - path: ../../../htdocs/adherents/class/adherent.class.php - - - - message: '#^Negated boolean expression is always true\.$#' - identifier: booleanNot.alwaysTrue - count: 5 - path: ../../../htdocs/adherents/class/adherent.class.php - - - - message: '#^Property Adherent\:\:\$last_subscription_amount \(int\|string\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../../htdocs/adherents/class/adherent.class.php - - - - message: '#^Ternary operator condition is always false\.$#' - identifier: ternary.alwaysFalse - count: 1 - path: ../../../htdocs/adherents/class/adherent.class.php - - - - message: '#^Call to function method_exists\(\) with \$this\(AdherentType\) and ''getLibStatut'' will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../../htdocs/adherents/class/adherent_type.class.php - - - - message: '#^Call to function method_exists\(\) with \$this\(AdherentType\) and ''getNomUrl'' will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../../htdocs/adherents/class/adherent_type.class.php - - - - message: '#^Call to function property_exists\(\) with \$this\(AdherentType\) and ''amount'' will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../../htdocs/adherents/class/adherent_type.class.php - - - - message: '#^Call to function property_exists\(\) with \$this\(AdherentType\) and ''vote'' will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../../htdocs/adherents/class/adherent_type.class.php - - - - message: '#^Loose comparison using \!\= between '''' and ''nolink'' will always evaluate to true\.$#' - identifier: notEqual.alwaysTrue - count: 1 - path: ../../../htdocs/adherents/class/adherent_type.class.php - - - - message: '#^Negated boolean expression is always true\.$#' - identifier: booleanNot.alwaysTrue - count: 1 - path: ../../../htdocs/adherents/class/adherent_type.class.php - - - - message: '#^Property AdherentType\:\:\$duration \(string\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../../htdocs/adherents/class/adherent_type.class.php - - - - message: '#^Property AdherentType\:\:\$subscription \(int\<0, 1\>\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../../htdocs/adherents/class/adherent_type.class.php - - - - message: '#^Property AdherentType\:\:\$vote \(int\<0, 1\>\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../../htdocs/adherents/class/adherent_type.class.php - - message: '#^Call to function property_exists\(\) with \$this\(Subscription\) and ''amount'' will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -2124,12 +2016,6 @@ parameters: count: 1 path: ../../../htdocs/bookcal/availabilities_card.php - - - message: '#^Property Availabilities\:\:\$status \(int\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../../htdocs/bookcal/availabilities_card.php - - message: '#^Right side of && is always true\.$#' identifier: booleanAnd.rightAlwaysTrue @@ -2178,12 +2064,6 @@ parameters: count: 1 path: ../../../htdocs/bookcal/booking_list.php - - - message: '#^Property Calendar\:\:\$status \(int\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../../htdocs/bookcal/booking_list.php - - message: '#^Variable \$lineid might not be defined\.$#' identifier: variable.undefined @@ -2220,12 +2100,6 @@ parameters: count: 1 path: ../../../htdocs/bookcal/calendar_card.php - - - message: '#^Property Calendar\:\:\$status \(int\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../../htdocs/bookcal/calendar_card.php - - message: '#^Right side of && is always true\.$#' identifier: booleanAnd.rightAlwaysTrue @@ -10626,30 +10500,6 @@ parameters: count: 1 path: ../../../htdocs/don/document.php - - - message: '#^Variable \$badgeStatus0 might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/don/index.php - - - - message: '#^Variable \$badgeStatus1 might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/don/index.php - - - - message: '#^Variable \$badgeStatus6 might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/don/index.php - - - - message: '#^Variable \$badgeStatus9 might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/don/index.php - - message: '#^Variable \$maxlength might not be defined\.$#' identifier: variable.undefined @@ -10722,12 +10572,6 @@ parameters: count: 1 path: ../../../htdocs/ecm/search.php - - - message: '#^Variable \$langs might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/ecm/tpl/enablefiletreeajax.tpl.php - - message: '#^Variable \$param might not be defined\.$#' identifier: variable.undefined @@ -18517,7 +18361,7 @@ parameters: path: ../../../htdocs/societe/class/societe.class.php - - message: '#^Property Contact\:\:\$roles \(array\|null\) does not accept non\-empty\-list\\.$#' + message: '#^Property Contact\:\:\$roles \(array\\|null\) does not accept non\-empty\-list\\.$#' identifier: assign.propertyType count: 1 path: ../../../htdocs/societe/class/societe.class.php diff --git a/dev/initdata/generate-invoice.php b/dev/initdata/generate-invoice.php index df72494cba0..76c102dfc44 100755 --- a/dev/initdata/generate-invoice.php +++ b/dev/initdata/generate-invoice.php @@ -57,7 +57,7 @@ if (empty($argv[1])) { print "Usage: $script_file nbofrecord\n"; print "Usage: $script_file 100\n"; print "\n"; - exit(-1); + exit(1); } define('GEN_NUMBER_FACTURE', ((int) $argv[1]) ?? 1); diff --git a/dev/initdata/generate-order.php b/dev/initdata/generate-order.php index 2c8f3029368..ac939716a77 100755 --- a/dev/initdata/generate-order.php +++ b/dev/initdata/generate-order.php @@ -64,7 +64,7 @@ if (empty($argv[1])) { print "Usage: $script_file nbofrecord\n"; print "Usage: $script_file 100\n"; print "\n"; - exit(-1); + exit(1); } define('GEN_NUMBER_COMMANDE', ((int) $argv[1]) ?? 10); diff --git a/dev/initdata/generate-product.php b/dev/initdata/generate-product.php index efe665d0a6a..430ea5d4910 100755 --- a/dev/initdata/generate-product.php +++ b/dev/initdata/generate-product.php @@ -62,7 +62,7 @@ if (empty($argv[1])) { print "Usage: $script_file nbofrecord\n"; print "Usage: $script_file 100\n"; print "\n"; - exit(-1); + exit(1); } define('GEN_NUMBER_PRODUIT', ((int) $argv[1]) ?? 100); diff --git a/dev/initdata/generate-proposal.php b/dev/initdata/generate-proposal.php index eef4392e7ab..ede61ee5220 100755 --- a/dev/initdata/generate-proposal.php +++ b/dev/initdata/generate-proposal.php @@ -60,7 +60,7 @@ if (empty($argv[1])) { print "Usage: $script_file nbofrecord\n"; print "Usage: $script_file 100\n"; print "\n"; - exit(-1); + exit(1); } define('GEN_NUMBER_PROPAL', ((int) $argv[1]) ?? 10); diff --git a/dev/initdata/generate-thirdparty.php b/dev/initdata/generate-thirdparty.php index 496a944d279..daa1a7c0697 100755 --- a/dev/initdata/generate-thirdparty.php +++ b/dev/initdata/generate-thirdparty.php @@ -65,7 +65,7 @@ if (empty($argv[1])) { print "Usage: $script_file nbofrecord\n"; print "Usage: $script_file 100\n"; print "\n"; - exit(-1); + exit(1); } define('GEN_NUMBER_SOCIETE', ((int) $argv[1]) ?? 10); diff --git a/dev/initdata/import-products.php b/dev/initdata/import-products.php index 20032593de5..d6db523815f 100755 --- a/dev/initdata/import-products.php +++ b/dev/initdata/import-products.php @@ -71,12 +71,12 @@ if (empty($mode) || ! in_array($mode, array('test','confirm','confirmforced')) | print "Usage: $script_file (test|confirm|confirmforced) filepath.csv [defaultlang] [startlinenb] [endlinenb]\n"; print "Usage: $script_file test myfilepath.csv fr_FR 2 1002\n"; print "\n"; - exit(-1); + exit(1); } if (! file_exists($filepath)) { print "Error: File ".$filepath." not found.\n"; print "\n"; - exit(-1); + exit(1); } $ret = $user->fetch('', 'admin'); diff --git a/dev/initdata/import-thirdparties.php b/dev/initdata/import-thirdparties.php index fe42a047df5..d5e465bf91c 100755 --- a/dev/initdata/import-thirdparties.php +++ b/dev/initdata/import-thirdparties.php @@ -71,12 +71,12 @@ if (empty($mode) || ! in_array($mode, array('test','confirm','confirmforced')) | print "Usage: $script_file (test|confirm|confirmforced) filepath.csv [startlinenb] [endlinenb]\n"; print "Usage: $script_file test myfilepath.csv 2 1002\n"; print "\n"; - exit(-1); + exit(1); } if (! file_exists($filepath)) { print "Error: File ".$filepath." not found.\n"; print "\n"; - exit(-1); + exit(1); } $ret = $user->fetch('', 'admin'); diff --git a/dev/initdata/import-users.php b/dev/initdata/import-users.php index a698b6f99e2..a3ac0e02133 100755 --- a/dev/initdata/import-users.php +++ b/dev/initdata/import-users.php @@ -71,12 +71,12 @@ if (empty($mode) || ! in_array($mode, array('test','confirm','confirmforced')) | print "Usage: $script_file (test|confirm|confirmforced) filepath.csv [startlinenb] [endlinenb]\n"; print "Usage: $script_file test myfilepath.csv 2 1002\n"; print "\n"; - exit(-1); + exit(1); } if (! file_exists($filepath)) { print "Error: File ".$filepath." not found.\n"; print "\n"; - exit(-1); + exit(1); } $ret=$user->fetch('', 'admin'); diff --git a/dev/initdata/purge-data.php b/dev/initdata/purge-data.php index 32e68b81100..5783fbf1c6b 100755 --- a/dev/initdata/purge-data.php +++ b/dev/initdata/purge-data.php @@ -32,7 +32,7 @@ $path=__DIR__.'/'; // Test si mode batch if (substr($sapi_type, 0, 3) == 'cgi') { echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n"; - exit(-1); + exit(1); } // Recupere root dolibarr @@ -187,13 +187,13 @@ if (empty($mode) || ! in_array($mode, array('test','confirm'))) { print "Usage: $script_file (test|confirm) (all|option) (all|YYYY-MM-DD) [dbtype dbhost dbuser dbpassword dbname dbport]\n"; print "\n"; print "option can be ".implode(',', array_keys($sqls))."\n"; - exit(-1); + exit(1); } if (empty($option)) { print "Usage: $script_file (test|confirm) (all|option) (all|YYYY-MM-DD) [dbtype dbhost dbuser dbpassword dbname dbport]\n"; print "\n"; print "option must be defined with a value in list ".implode(',', array_keys($sqls))."\n"; - exit(-1); + exit(1); } if ($option != 'all') { $listofoptions=explode(',', $option); @@ -202,7 +202,7 @@ if ($option != 'all') { print "Usage: $script_file (test|confirm) (all|option) (all|YYYY-MM-DD) [dbtype dbhost dbuser dbpassword dbname dbport]\n"; print "\n"; print "option '".$cursoroption."' must be in list ".implode(',', array_keys($sqls))."\n"; - exit(-1); + exit(1); } } } @@ -211,7 +211,7 @@ if (empty($date) || (! preg_match('/\d\d\d\d\-\d\d\-\d\d$/', $date) && $date != print "Usage: $script_file (test|confirm) (all|option) (all|YYYY-MM-DD) [dbtype dbhost dbuser dbpassword dbname dbport]\n"; print "\n"; print "date can be 'all' or 'YYYY-MM-DD' to delete record before YYYY-MM-DD\n"; - exit(-1); + exit(1); } if ($date == 'all') { diff --git a/dev/initdemo/sftpget_and_loaddump.php b/dev/initdemo/sftpget_and_loaddump.php index 530afb7a3e5..b147e854b81 100755 --- a/dev/initdemo/sftpget_and_loaddump.php +++ b/dev/initdemo/sftpget_and_loaddump.php @@ -84,7 +84,7 @@ if (empty($sourceserver) || empty($server) || empty($login) || empty($sourcefile print "Usage: $script_file login@server:/src/file.(sql|gz|bz2) passssh databaseserver databasename loginbase passbase\n"; print "Return code: 0 if success, <>0 if error\n"; print "Warning, this script may take a long time.\n"; - exit(-1); + exit(1); } @@ -106,7 +106,7 @@ $connection = ssh2_connect($server, 22); if ($connection) { if (!@ssh2_auth_password($connection, $login, $password)) { dol_syslog("Could not authenticate with username ".$login." . and password ".preg_replace('/./', '*', $password), LOG_ERR); - exit(-5); + exit(5); } else { //$stream = ssh2_exec($connection, '/usr/bin/php -i'); /* @@ -143,7 +143,7 @@ if ($connection) { } } else { print 'Failed to connect to ssh2 to '.$server; - exit(-6); + exit(6); } diff --git a/dev/initdemo/updatedemo.php b/dev/initdemo/updatedemo.php index 98e33835589..d0937a5333a 100755 --- a/dev/initdemo/updatedemo.php +++ b/dev/initdemo/updatedemo.php @@ -72,7 +72,7 @@ print "Update dates to current year for database name = ".$db->database_name."\n if (empty($confirm)) { print "Usage: $script_file confirm\n"; print "Return code: 0 if success, <>0 if error\n"; - exit(-1); + exit(1); } diff --git a/dev/translation/ignore_translation_keys.lst b/dev/translation/ignore_translation_keys.lst index e496c032d2c..f725faa348c 100644 --- a/dev/translation/ignore_translation_keys.lst +++ b/dev/translation/ignore_translation_keys.lst @@ -358,7 +358,6 @@ ErrorTechnicalError ErrorThirdPartyIdIsMandatory ErrorTicketIsNotValid ErrorTitreAlreadyExists -ErrorUpdatingUsersCP ErrorUserFetch ErrorValueMustBeInteger ErrorValueTooHigh @@ -806,7 +805,6 @@ Templates TestPrinterTemplate TestTemplateToPrinter Theme -ThirdpartyHasNoDefaultBanAccount ThisIsInformationOnDocumentToSign ThisScreenAllowsYouToSignDocFrom TicketCategoryShort @@ -843,8 +841,6 @@ UpdateUser UpgradeHasBeenUnlocked Url Use of API for currency update is disabled by option MULTICURRENCY_DISABLE_SYNC_CURRENCYLAYER -UserRemovedFromGroup -UserSetInGroup VCard Vacant ValidateAndSign @@ -870,7 +866,6 @@ Widgets Windows WorkingBoard Workload -WrongAmount XDebug XmlCorrupted Y diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 272352b8793..d604a5a6deb 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -283,12 +283,12 @@ class Adherent extends CommonObject public $last_subscription_date_start; /** - * @var int|string date + * @var int|string|null date */ public $last_subscription_date_end; /** - * @var int|string date + * @var null|float|string date, null until set */ public $last_subscription_amount; @@ -901,11 +901,9 @@ class Adherent extends CommonObject $action = 'update'; // Actions on extra fields - if (!$error) { - $result = $this->insertExtraFields(); - if ($result < 0) { - $error++; - } + $result = $this->insertExtraFields(); + if ($result < 0) { + $error++; } // Update password @@ -948,7 +946,7 @@ class Adherent extends CommonObject if (!$error && $nbrowsaffected) { // If something has change in main data // Update information on linked user if it is an update - if (!$error && $this->user_id > 0 && !$nosyncuser) { + if ($this->user_id > 0 && !$nosyncuser) { require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; dol_syslog(get_class($this)."::update update linked user"); @@ -1130,7 +1128,7 @@ class Adherent extends CommonObject $this->db->begin(); - if (!$error && !$notrigger) { + if (!$notrigger) { // Call trigger $result = $this->call_trigger('MEMBER_DELETE', $user); if ($result < 0) { @@ -1633,13 +1631,13 @@ class Adherent extends CommonObject $this->last_subscription_date = $this->db->jdate($obj->datec); $this->last_subscription_date_start = $this->db->jdate($obj->dateh); $this->last_subscription_date_end = $this->db->jdate($obj->datef); - $this->last_subscription_amount = $obj->subscription; + $this->last_subscription_amount = (float) $obj->subscription; $subscription = new Subscription($this->db); $subscription->id = $obj->rowid; $subscription->fk_adherent = $obj->fk_adherent; $subscription->fk_type = $obj->fk_type; - $subscription->amount = $obj->subscription; + $subscription->amount = (float) $obj->subscription; $subscription->note = $obj->note_public; $subscription->note_public = $obj->note_public; $subscription->fk_bank = $obj->fk_bank; @@ -1742,6 +1740,8 @@ class Adherent extends CommonObject $this->last_subscription_date_start = $date; $this->last_subscription_date_end = $datefin; $this->last_subscription_amount = $amount; + } else { + $error++; } if (!$error) { @@ -1911,8 +1911,7 @@ class Adherent extends CommonObject $result = $invoice->create($user); if ($result <= 0) { - $this->error = $invoice->error; - $this->errors = $invoice->errors; + $this->setErrorsFromObject($invoice); $error++; } else { $this->invoice = $invoice; @@ -1934,8 +1933,7 @@ class Adherent extends CommonObject // @phan-suppress-next-line PhanPluginSuspiciousParamPosition $result = $invoice->addline($label, 0, 1, $vattouse, 0, 0, $idprodsubscription, 0, $datesubscription, '', 0, 0, 0, 'TTC', $amount, 1); if ($result <= 0) { - $this->error = $invoice->error; - $this->errors = $invoice->errors; + $this->setErrorsFromObject($invoice); $error++; } } @@ -1944,8 +1942,7 @@ class Adherent extends CommonObject // Validate invoice $result = $invoice->validate($user); if ($result <= 0) { - $this->error = $invoice->error; - $this->errors = $invoice->errors; + $this->setErrorsFromObject($invoice); $error++; } } @@ -1973,22 +1970,18 @@ class Adherent extends CommonObject $paiement->ext_payment_id = $ext_payment_id; $paiement->ext_payment_site = $ext_payment_site; - if (!$error) { - // Create payment line for invoice - $paiement_id = $paiement->create($user); - if (!($paiement_id > 0)) { - $this->error = $paiement->error; - $this->errors = $paiement->errors; - $error++; - } + // Create payment line for invoice + $paiement_id = $paiement->create($user); + if (!($paiement_id > 0)) { + $this->setErrorsFromObject($paiement); + $error++; } if (!$error) { // Add transaction into bank account $bank_line_id = $paiement->addPaymentToBank($user, 'payment', '(SubscriptionPayment)', $accountid, $emetteur_nom, $emetteur_banque); if (!($bank_line_id > 0)) { - $this->error = $paiement->error; - $this->errors = $paiement->errors; + $this->setErrorsFromObject($paiement); $error++; } } @@ -2441,16 +2434,15 @@ class Adherent extends CommonObject $result .= $linkstart; if ($withpictoimg) { - $paddafterimage = ''; if (abs($withpictoimg) == 1 || abs($withpictoimg) == 4) { $morecss .= ' paddingrightonly'; } // Only picto if ($withpictoimg > 0) { - $picto = ''.img_object('', 'user', $paddafterimage.' '.($notooltip ? '' : $dataparams), 0, 0, $notooltip ? 0 : 1).''; + $picto = ''.img_object('', 'user', ' '.($notooltip ? '' : $dataparams), 0, 0, $notooltip ? 0 : 1).''; } else { // Picto must be a photo - $picto = ''; + $picto = ''; $picto .= Form::showphoto('memberphoto', $this, 0, 0, 0, 'userphoto'.(($withpictoimg == -3 || $withpictoimg == -4) ? 'small' : ''), 'mini', 0, 1); $picto .= ''; } @@ -2458,7 +2450,7 @@ class Adherent extends CommonObject } if (($withpictoimg > -2 && $withpictoimg != 2) || $withpictoimg == -4) { if (!getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) { - $result .= 'status) || $this->status) ? '' : ' strikefordisabled'). ($morecss ? ' usertext'.$morecss : '').'">'; } if ($mode == 'login') { @@ -3219,9 +3211,9 @@ class Adherent extends CommonObject if ($message) { $actionmsg = $langs->transnoentities('MailFrom').': '.dol_escape_htmltag($from); $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTo').': '.dol_escape_htmltag($sendto)); - if ($sendtocc) { - $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc').": ".dol_escape_htmltag($sendtocc)); - } + // if ($sendtocc) { + // $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc').": ".dol_escape_htmltag($sendtocc)); + // } $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic').": ".$subject); $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody').":"); $actionmsg = dol_concatdesc($actionmsg, $message); @@ -3289,10 +3281,31 @@ class Adherent extends CommonObject } else { $this->output = 'Found '.($nbok + $nbko).' members to send reminder to.'; $this->output .= ' Send email successfully to '.$nbok.' members'; - if (is_array($listofmembersok)) { + $listofids = ''; + $i = 0; + foreach ($listofmembersok as $idmember) { + if ($i > 100) { + $listofids .= ', ...'; + break; + } + if (empty($listofids)) { + $listofids .= ' ['; + } else { + $listofids .= ', '; + } + $listofids .= $idmember; + $i++; + } + if ($listofids) { + $listofids .= ']'; + } + $this->output .= ($listofids ? ' ids='.$listofids : ''); + + if ($nbko) { + $this->output .= ' - Canceled for '.$nbko.' member (no email or email sending error)'; $listofids = ''; $i = 0; - foreach ($listofmembersok as $idmember) { + foreach ($listofmembersko as $idmember) { if ($i > 100) { $listofids .= ', ...'; break; @@ -3308,33 +3321,8 @@ class Adherent extends CommonObject if ($listofids) { $listofids .= ']'; } - $this->output .= ($listofids ? ' ids='.$listofids : ''); } - if ($nbko) { - $this->output .= ' - Canceled for '.$nbko.' member (no email or email sending error)'; - if (is_array($listofmembersko)) { - $listofids = ''; - $i = 0; - foreach ($listofmembersko as $idmember) { - if ($i > 100) { - $listofids .= ', ...'; - break; - } - if (empty($listofids)) { - $listofids .= ' ['; - } else { - $listofids .= ', '; - } - $listofids .= $idmember; - $i++; - } - if ($listofids) { - $listofids .= ']'; - } - $this->output .= ($listofids ? ' ids='.$listofids : ''); - } - } } return $nbko; @@ -3354,25 +3342,23 @@ class Adherent extends CommonObject $return = '
'; $return .= '
'; $return .= ''; - if (property_exists($this, 'photo') || !empty($this->photo)) { + if (!empty($this->photo)) { $return .= Form::showphoto('memberphoto', $this, 0, 60, 0, 'photokanban photowithmargin photologintooltip', 'small', 0, 1); } else { $return .= img_picto('', 'user'); } $return .= ''; $return .= '
'; - $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).''; + $return .= '' . $this->getNomUrl() . ''; if ($selected >= 0) { $return .= ''; } $return .= '
'.$this->getmorphylib('', 2).''; $return .= ''.$this->type.''; - if (method_exists($this, 'getLibStatut')) { - $return .= '
'; - $return .= $this->LibStatut($this->status, $this->need_subscription, $this->datefin, 5); - $return .= '
'; - } + $return .= '
'; + $return .= $this->LibStatut($this->status, $this->need_subscription, $this->datefin, 5); + $return .= '
'; $return .= '
'; $return .= '
'; $return .= '
'; diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index 833d814afb7..d7f49eb3cb4 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -141,7 +141,7 @@ class AdherentType extends CommonObject public $morphy; /** - * @var string + * @var ?string */ public $duration; @@ -156,7 +156,7 @@ class AdherentType extends CommonObject public $duration_unit; /** - * @var int<0,1> Subscription required (0 or 1) + * @var null|'0'|'1' Subscription required (0 or 1) default '1' in DB, null until value is fetched */ public $subscription; @@ -180,7 +180,7 @@ class AdherentType extends CommonObject public $note_public; /** - * @var int<0,1> Can vote + * @var null|int<0,1> Can vote, null until fetched */ public $vote; @@ -516,11 +516,9 @@ class AdherentType extends CommonObject } // Actions on extra fields - if (!$error) { - $result = $this->insertExtraFields(); - if ($result < 0) { - $error++; - } + $result = $this->insertExtraFields(); + if ($result < 0) { + $error++; } if (!$error && !$notrigger) { @@ -870,7 +868,7 @@ class AdherentType extends CommonObject $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("MemberType").' '.$this->getLibStatut(4); $datas['label'] = '
'.$langs->trans("Label").': '.$this->label; if (isset($this->subscription)) { - $datas['subscription'] = '
'.$langs->trans("SubscriptionRequired").': '.yn($this->subscription); + $datas['subscription'] = '
'.$langs->trans("SubscriptionRequired").': '.yn((int) $this->subscription); } if (isset($this->vote)) { $datas['vote'] = '
'.$langs->trans("VoteAllowed").': '.yn($this->vote); @@ -878,9 +876,23 @@ class AdherentType extends CommonObject if (isset($this->duration)) { $datas['duration'] = '
'.$langs->trans("Duration").': '.$this->duration_value; if ($this->duration_value > 1) { - $dur = array("i" => $langs->trans("Minutes"), "h" => $langs->trans("Hours"), "d" => $langs->trans("Days"), "w" => $langs->trans("Weeks"), "m" => $langs->trans("Months"), "y" => $langs->trans("Years")); + $dur = array( + "i" => $langs->trans("Minutes"), + "h" => $langs->trans("Hours"), + "d" => $langs->trans("Days"), + "w" => $langs->trans("Weeks"), + "m" => $langs->trans("Months"), + "y" => $langs->trans("Years") + ); } elseif ($this->duration_value > 0) { - $dur = array("i" => $langs->trans("Minute"), "h" => $langs->trans("Hour"), "d" => $langs->trans("Day"), "w" => $langs->trans("Week"), "m" => $langs->trans("Month"), "y" => $langs->trans("Year")); + $dur = array( + "i" => $langs->trans("Minute"), + "h" => $langs->trans("Hour"), + "d" => $langs->trans("Day"), + "w" => $langs->trans("Week"), + "m" => $langs->trans("Month"), + "y" => $langs->trans("Year") + ); } $datas['duration'] .= " " . (!empty($this->duration_unit) && isset($dur[$this->duration_unit]) ? $langs->trans($dur[$this->duration_unit]) : ''); } @@ -901,14 +913,12 @@ class AdherentType extends CommonObject public function getNomUrl($withpicto = 0, $maxlen = 0, $notooltip = 0, $morecss = '', $save_lastsearch_value = -1) { $result = ''; - $option = ''; $classfortooltip = 'classfortooltip'; $dataparams = ''; $params = [ 'id' => $this->id, 'objecttype' => $this->element, - 'option' => $option, 'nofetch' => 1, ]; if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { @@ -920,16 +930,15 @@ class AdherentType extends CommonObject } $url = DOL_URL_ROOT.'/adherents/type.php?rowid='.((int) $this->id); - if ($option != 'nolink') { - // Add param to save lastsearch_values or not - $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0); - if ($save_lastsearch_value == -1 && isset($_SERVER["PHP_SELF"]) && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) { - $add_save_lastsearch_values = 1; - } - if ($add_save_lastsearch_values) { - $url .= '&save_lastsearch_values=1'; - } + // Add param to save lastsearch_values or not + $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0); + if ($save_lastsearch_value == -1 && isset($_SERVER["PHP_SELF"]) && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) { + $add_save_lastsearch_values = 1; } + if ($add_save_lastsearch_values) { + $url .= '&save_lastsearch_values=1'; + } + $linkstart = ''; @@ -1074,7 +1083,7 @@ class AdherentType extends CommonObject $this->label = 'MEMBERS TYPE SPECIMEN'; $this->note_public = 'This is a public note'; $this->mail_valid = 'This is welcome email'; - $this->subscription = 1; + $this->subscription = '1'; $this->caneditamount = 0; $this->vote = 0; @@ -1167,7 +1176,7 @@ class AdherentType extends CommonObject $return .= img_picto('', $this->picto); $return .= '
'; $return .= '
'; - $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).''; + $return .= '' . $this->getNomUrl() . ''; //$return .= ''; @@ -1176,20 +1185,14 @@ class AdherentType extends CommonObject } else { $return .= ' '; } - if (property_exists($this, 'vote')) { - $return .= '
'.$langs->trans("VoteAllowed").' : '.yn($this->vote).''; - } - if (property_exists($this, 'amount')) { - if (is_null($this->amount) || $this->amount === '') { - $return .= '
'; - } else { - $return .= '
'.$langs->trans("Amount").''; - $return .= ' : '.price($this->amount).''; - } - } - if (method_exists($this, 'getLibStatut')) { - $return .= '
'.$this->getLibStatut(3).'
'; + $return .= '
'.$langs->trans("VoteAllowed").' : '.yn($this->vote).''; + if (is_null($this->amount) || $this->amount === '') { + $return .= '
'; + } else { + $return .= '
'.$langs->trans("Amount").''; + $return .= ' : '.price($this->amount).''; } + $return .= '
'.$this->getLibStatut(3).'
'; $return .= '
'; $return .= ''; $return .= ''; diff --git a/htdocs/adherents/subscription/list.php b/htdocs/adherents/subscription/list.php index 039a7e31af4..d804aa8e737 100644 --- a/htdocs/adherents/subscription/list.php +++ b/htdocs/adherents/subscription/list.php @@ -4,7 +4,7 @@ * Copyright (C) 2004-2023 Laurent Destailleur * Copyright (C) 2024 Alexandre Spangaro * Copyright (C) 2024-2025 MDW - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2025 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 @@ -637,7 +637,7 @@ while ($i < $imaxinloop) { $adht = new AdherentType($db); $adht->fetch($typeid); - $adherent->need_subscription = $adht->subscription; + $adherent->need_subscription = (int) $adht->subscription; if ($mode == 'kanban') { if ($i == 0) { diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 564cde7891a..ef20503c9e4 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -172,7 +172,7 @@ if ($action == 'add' && $user->hasRight('adherent', 'configurer')) { $object->label = trim($label); $object->morphy = trim($morphy); $object->status = (int) $status; - $object->subscription = (int) $subscription; + $object->subscription = (string) (int) $subscription; $object->amount = ($amount == '' ? '' : price2num($amount, 'MT')); $object->caneditamount = $caneditamount; $object->duration_value = $duration_value; @@ -233,7 +233,7 @@ if ($action == 'update' && $user->hasRight('adherent', 'configurer')) { $object->label = trim($label); $object->morphy = trim($morphy); $object->status = (int) $status; - $object->subscription = (int) $subscription; + $object->subscription = (string) (int) $subscription; $object->amount = ($amount == '' ? '' : price2num($amount, 'MT')); $object->caneditamount = $caneditamount; $object->duration_value = $duration_value; @@ -639,7 +639,7 @@ if ($rowid > 0) { print ''; print ''.$form->textwithpicto($langs->trans("SubscriptionRequired"), $langs->trans("SubscriptionRequiredDesc")).''; - print yn($object->subscription); + print yn((int) $object->subscription); print ''; // Amount diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index 179143c45ab..164f2134b88 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -2734,7 +2734,7 @@ class Setup extends DolibarrApi // Define qualified files (must be same than into generate_filelist_xml.php and in api_setup.class.php) $regextoinclude = '\.(php|php3|php4|php5|phtml|phps|phar|inc|css|scss|html|xml|js|json|tpl|jpg|jpeg|png|gif|ico|sql|lang|txt|yml|bak|md|mp3|mp4|wav|mkv|z|gz|zip|rar|tar|less|svg|eot|woff|woff2|ttf|manifest)$'; - $regextoexclude = '('.($includecustom ? '' : 'custom|').'documents|conf|install|dejavu-fonts-ttf-.*|public\/test|sabre\/sabre\/.*\/tests|Shared\/PCLZip|nusoap\/lib\/Mail|php\/example|php\/test|geoip\/sample.*\.php|ckeditor\/samples|ckeditor\/adapters)$'; // Exclude dirs + $regextoexclude = '('.($includecustom ? '' : 'custom|').'documents|escpos-php\/doc|escpos-php\/example|escpos-php\/test|conf|install|dejavu-fonts-ttf-.*|public\/test|sabre\/sabre\/.*\/tests|Shared\/PCLZip|nusoap\/lib\/Mail|php\/test|geoip\/sample.*\.php|ckeditor\/samples|ckeditor\/adapters)$'; // Exclude dirs $scanfiles = dol_dir_list(DOL_DOCUMENT_ROOT, 'files', 1, $regextoinclude, $regextoexclude); // Fill file_list with files in signature, new files, modified files diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 32b35022b07..ea2dae8c620 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -1832,6 +1832,7 @@ if (!$error && ($massaction == 'approveleave' || ($action == 'approveleave' && $ if (!$error && ($massaction == 'increaseholiday' || ($action == 'increaseholiday' && $confirm == 'yes')) && $permissiontoapprove && is_array($toselect)) { '@phan-var-force Holiday $holiday'; // Supposing that $holiday is set, it is needed. + /** @var Holiday $holiday */ $db->begin(); $objecttmp = new $objectclass($db); $nbok = 0; @@ -1919,6 +1920,7 @@ if (!$error && ($massaction == 'clonetasks' || ($action == 'clonetasks' && $conf require_once DOL_DOCUMENT_ROOT . "/core/modules/project/task/" . getDolGlobalString('PROJECT_TASK_ADDON') . '.php'; $modTask = new $classnamemodtask(); '@phan-var-force ModeleNumRefTask $modTask'; + /** @var ModeleNumRefTask $modTask */ $defaultref = $modTask->getNextValue(null, $clone_task); } diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index 442e1a6c5f8..dfcd6f5779c 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -1352,7 +1352,7 @@ abstract class CommonInvoice extends CommonObject $bac = new CompanyBankAccount($this->db); // Table societe_rib $result = $bac->fetch(0, '', $this->socid, 1, 'ban'); if ($result <= 0 || empty($bac->id)) { - $this->error = $langs->trans("ThirdpartyHasNoDefaultBanAccount"); + $this->error = $langs->trans("ThirdpartyHasNoDefaultBankAccount"); $this->errors[] = $this->error; dol_syslog(get_class($this)."::makeStripeSepaRequest ".$this->error); return -1; diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 322f5539ffd..26fab7f5286 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3240,7 +3240,11 @@ abstract class CommonObject if (!$notrigger) { // Call trigger $this->context = array('shippingmethodupdate' => 1); - $result = $this->call_trigger(strtoupper(get_class($this)).'_MODIFY', $userused); + $triggerPrefix = (empty($this->TRIGGER_PREFIX) ? strtoupper(get_class($this)) : $this->TRIGGER_PREFIX); + if (get_class($this) == 'Commande') { + $triggerPrefix = 'ORDER'; // TODO Remove this when TRIGGER_PREFI in order is implemented + } + $result = $this->call_trigger($triggerPrefix.'_MODIFY', $userused); if ($result < 0) { $error++; } diff --git a/htdocs/core/class/commonpeople.class.php b/htdocs/core/class/commonpeople.class.php index bb9df3b84e1..1883a88410f 100644 --- a/htdocs/core/class/commonpeople.class.php +++ b/htdocs/core/class/commonpeople.class.php @@ -112,7 +112,7 @@ trait CommonPeople $firstname = $this->firstname; if (empty($lastname)) { // societe is deprecated - @suppress-next-line PhanUndeclaredProperty - $lastname = (isset($this->lastname) ? $this->lastname : (isset($this->name) ? $this->name : (property_exists($this, 'nom') && isset($this->nom) ? $this->nom : (property_exists($this, 'societe') && isset($this->societe) ? $this->societe : (property_exists($this, 'company') && isset($this->company) ? $this->company : ''))))); + $lastname = (isset($this->lastname) ? $this->lastname : (isset($this->name) ? $this->name : (property_exists($this, 'nom') && isset($this->nom) ? $this->nom : (property_exists($this, 'societe') && isset($this->societe) ? $this->societe : (property_exists($this, 'company') && isset($this->company) ? $this->company : ''))))); // @phpstan-ignore-line } $ret = ''; diff --git a/htdocs/core/customreports.php b/htdocs/core/customreports.php index 240cc719bba..5924281305f 100644 --- a/htdocs/core/customreports.php +++ b/htdocs/core/customreports.php @@ -106,11 +106,11 @@ if (!defined('USE_CUSTOM_REPORT_AS_INCLUDE')) { if (empty($user) || empty($user->id)) { print 'Page is called as an include but $user and its permission loaded with loadRights() are not defined. We stop here.'; - exit(-1); + exit(1); } if (empty($object)) { print 'Page is called as an include but $object is not defined. We stop here.'; - exit(-1); + exit(1); } } diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 4e61a1506a0..c465d9c2213 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -1444,7 +1444,7 @@ function dolCheckOnFileName($src_file, $dest_file = '') * @param int $disablevirusscan 1=Disable virus scan * @param integer $uploaderrorcode Value of PHP upload error code ($_FILES['field']['error']) * @param int $nohook Disable all hooks - * @param string $keyforsourcefile Key for source frile in _FILES (not used) + * @param string $keyforsourcefile Key for source file in _FILES (not used) * @param string $upload_dir For information. Already included into $dest_file. * @param int $mode 0=Default mode use to move a file from default system upload dir to $upload_dir. 1=Mode to move an uploaded file from $keyforsourcefile into $upload_dir. * @return int|string 1 if OK, 2 if OK and .noexe appended, <0 or string if KO diff --git a/htdocs/core/modules/modProjet.class.php b/htdocs/core/modules/modProjet.class.php index 64c6c2e352b..9ec7906756e 100644 --- a/htdocs/core/modules/modProjet.class.php +++ b/htdocs/core/modules/modProjet.class.php @@ -304,7 +304,7 @@ class modProjet extends DolibarrModules $this->import_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into import_icon $this->import_tables_array[$r] = array('t'=>MAIN_DB_PREFIX.'projet', 'extra'=>MAIN_DB_PREFIX.'projet_extrafields'); // List of tables to insert into (insert done in same order) $this->import_fields_array[$r] = array('t.ref'=>'ProjectRef*', 't.title'=>'Label*', 't.description'=>"Description", 't.fk_soc' => 'ThirdPartyName', 't.public'=>"Public", 't.fk_statut'=>"Status"); - $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array('t.fk_opp_status'=>"OpportunityStatus", 't.opp_percent'=>"OpportunityProbability", 't.opp_amount'=>"OpportunityAmount", 't.note_public'=>"NotePublic", 't.note_private'=>"NotePrivate", 't.budget_amount'=>"Budget", 't.dateo'=>"DateStart", 't.datee'=>"DateEnd")); + $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array('t.fk_opp_status'=>"OpportunityStatus", 't.opp_percent'=>"OpportunityProbability", 't.opp_amount'=>"OpportunityAmount", 't.note_public'=>"NotePublic", 't.note_private'=>"NotePrivate", 't.budget_amount'=>"Budget", 't.dateo'=>"DateStart", 't.datee'=>"DateEnd", 't.usage_opportunity' => "UsageOpportunity", 't.usage_task' => 'UsageTasks', 't.usage_bill_time' => 'UsageBillTimeShort')); // Add extra fields $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type <> 'separate' AND elementtype = 'projet' AND entity IN (0,".$conf->entity.")"; $resql = $this->db->query($sql); @@ -329,7 +329,7 @@ class modProjet extends DolibarrModules ); //$this->import_convertvalue_array[$r]=array('s.fk_soc'=>array('rule'=>'lastrowid',table='t'); $this->import_regex_array[$r] = array('t.dateo'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$', 't.datee'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$', 't.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]( [0-9][0-9]:[0-9][0-9]:[0-9][0-9])?$'); - $this->import_examplevalues_array[$r] = array('t.fk_soc'=>'ThirdParty', 't.ref'=>"auto or PJ2010-1234", 't.title'=>"My project", 't.fk_statut'=>'0,1 or 2', 't.datec'=>'1972-10-10', 't.note_private'=>"My private note", 't.note_public'=>"My public note"); + $this->import_examplevalues_array[$r] = array('t.fk_soc'=>'ThirdParty', 't.ref'=>"auto or PJ2010-1234", 't.title'=>"My project", 't.fk_statut'=>'0,1 or 2', 't.datec'=>'1972-10-10', 't.note_private'=>"My private note", 't.note_public'=>"My public note", 't.usage_opportunity' => '0/1', 't.usage_task' => '0/1', 't.usage_bill_time' => '0/1'); // Import list of tasks if (!getDolGlobalString('PROJECT_HIDE_TASKS')) { diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php index dfbea670691..3d96ef6a4f8 100644 --- a/htdocs/fourn/card.php +++ b/htdocs/fourn/card.php @@ -218,7 +218,7 @@ if ($id > 0 && empty($object->id)) { $res = $object->fetch($id); if ($object->id <= 0) { dol_print_error($db, $object->error); - exit(-1); + exit(1); } } diff --git a/htdocs/install/doctemplates/websites/website_template-corporate/containers/wrapper.php b/htdocs/install/doctemplates/websites/website_template-corporate/containers/wrapper.php index 1ab07905b0b..c42f0ca378d 100644 --- a/htdocs/install/doctemplates/websites/website_template-corporate/containers/wrapper.php +++ b/htdocs/install/doctemplates/websites/website_template-corporate/containers/wrapper.php @@ -173,14 +173,14 @@ if ($rss) { dol_syslog("build_exportfile ".$error, LOG_ERR); dol_delete_file($outputfiletmp, 0, 1); print $error; - exit(-1); + exit(1); } } else { dol_syslog("build_exportfile build_xxxfile function fails to for format=".$format." outputfiletmp=".$outputfile, LOG_ERR); dol_delete_file($outputfiletmp, 0, 1); $langs->load("errors"); print $langs->trans("ErrorFailToCreateFile", $outputfile); - exit(-1); + exit(1); } } diff --git a/htdocs/install/doctemplates/websites/website_template-homesubmenu_dev/containers/wrapper.php b/htdocs/install/doctemplates/websites/website_template-homesubmenu_dev/containers/wrapper.php index 1ab07905b0b..c42f0ca378d 100644 --- a/htdocs/install/doctemplates/websites/website_template-homesubmenu_dev/containers/wrapper.php +++ b/htdocs/install/doctemplates/websites/website_template-homesubmenu_dev/containers/wrapper.php @@ -173,14 +173,14 @@ if ($rss) { dol_syslog("build_exportfile ".$error, LOG_ERR); dol_delete_file($outputfiletmp, 0, 1); print $error; - exit(-1); + exit(1); } } else { dol_syslog("build_exportfile build_xxxfile function fails to for format=".$format." outputfiletmp=".$outputfile, LOG_ERR); dol_delete_file($outputfiletmp, 0, 1); $langs->load("errors"); print $langs->trans("ErrorFailToCreateFile", $outputfile); - exit(-1); + exit(1); } } diff --git a/htdocs/install/doctemplates/websites/website_template-noimg_dev/containers/wrapper.php b/htdocs/install/doctemplates/websites/website_template-noimg_dev/containers/wrapper.php index 1ab07905b0b..c42f0ca378d 100644 --- a/htdocs/install/doctemplates/websites/website_template-noimg_dev/containers/wrapper.php +++ b/htdocs/install/doctemplates/websites/website_template-noimg_dev/containers/wrapper.php @@ -173,14 +173,14 @@ if ($rss) { dol_syslog("build_exportfile ".$error, LOG_ERR); dol_delete_file($outputfiletmp, 0, 1); print $error; - exit(-1); + exit(1); } } else { dol_syslog("build_exportfile build_xxxfile function fails to for format=".$format." outputfiletmp=".$outputfile, LOG_ERR); dol_delete_file($outputfiletmp, 0, 1); $langs->load("errors"); print $langs->trans("ErrorFailToCreateFile", $outputfile); - exit(-1); + exit(1); } } diff --git a/htdocs/install/doctemplates/websites/website_template-restaurant_dev/containers/wrapper.php b/htdocs/install/doctemplates/websites/website_template-restaurant_dev/containers/wrapper.php index 1ab07905b0b..c42f0ca378d 100644 --- a/htdocs/install/doctemplates/websites/website_template-restaurant_dev/containers/wrapper.php +++ b/htdocs/install/doctemplates/websites/website_template-restaurant_dev/containers/wrapper.php @@ -173,14 +173,14 @@ if ($rss) { dol_syslog("build_exportfile ".$error, LOG_ERR); dol_delete_file($outputfiletmp, 0, 1); print $error; - exit(-1); + exit(1); } } else { dol_syslog("build_exportfile build_xxxfile function fails to for format=".$format." outputfiletmp=".$outputfile, LOG_ERR); dol_delete_file($outputfiletmp, 0, 1); $langs->load("errors"); print $langs->trans("ErrorFailToCreateFile", $outputfile); - exit(-1); + exit(1); } } diff --git a/htdocs/install/doctemplates/websites/website_template-stellar/containers/wrapper.php b/htdocs/install/doctemplates/websites/website_template-stellar/containers/wrapper.php index e6f78442c1e..a555a02fef8 100644 --- a/htdocs/install/doctemplates/websites/website_template-stellar/containers/wrapper.php +++ b/htdocs/install/doctemplates/websites/website_template-stellar/containers/wrapper.php @@ -170,14 +170,14 @@ if ($rss) { dol_syslog("build_exportfile ".$error, LOG_ERR); dol_delete_file($outputfiletmp, 0, 1); print $error; - exit(-1); + exit(1); } } else { dol_syslog("build_exportfile build_xxxfile function fails to for format=".$format." outputfiletmp=".$outputfile, LOG_ERR); dol_delete_file($outputfiletmp, 0, 1); $langs->load("errors"); print $langs->trans("ErrorFailToCreateFile", $outputfile); - exit(-1); + exit(1); } } diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index 679e1cd7dbc..40fb03f8ad6 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -90,6 +90,7 @@ PaymentMode=Payment method PaymentModes=Payment methods DefaultPaymentMode=Default Payment method DefaultBankAccount=Default Bank Account +ThirdpartyHasNoDefaultBankAccount=No default bank account is set for the third party IdPaymentMode=Payment method (id) CodePaymentMode=Payment method (code) LabelPaymentMode=Payment method (label) diff --git a/htdocs/langs/en_US/holiday.lang b/htdocs/langs/en_US/holiday.lang index e75f01adbb2..1be2be1cfba 100644 --- a/htdocs/langs/en_US/holiday.lang +++ b/htdocs/langs/en_US/holiday.lang @@ -161,3 +161,5 @@ ConsumeHolidaysAtTheEndOfTheMonthTheyAreTakenAt=Consume holidays at the end of t PleaseDefineSomeTypeOfHolidayFirst=Please define first some types of holiday into the dictionary (Menu Home - Setup - dictionaries) HolidayMailSenderAdress=Email address for holiday requests HolidayMailSenderAdressHelp=If you leave this field blank, the default e-mail address will be used. +WrongAmount=Wrong amount of days +ErrorUpdatingUsersCP=Error updating users paid leaves diff --git a/htdocs/langs/en_US/users.lang b/htdocs/langs/en_US/users.lang index 42d4b4719ee..5f3120b67d1 100644 --- a/htdocs/langs/en_US/users.lang +++ b/htdocs/langs/en_US/users.lang @@ -149,3 +149,5 @@ SocialNetworksUser=Social networks for user MyTeam=My team TotalAPICall=Total API Calls TOTP=TOTP (Time-base One-Time Password) +UserRemovedFromGroup=User removed from group +UserSetInGroup=User set in group diff --git a/htdocs/modulebuilder/template/build/buildzip.php b/htdocs/modulebuilder/template/build/buildzip.php index 3508bbbec79..cd962e2988f 100644 --- a/htdocs/modulebuilder/template/build/buildzip.php +++ b/htdocs/modulebuilder/template/build/buildzip.php @@ -75,7 +75,7 @@ function detectModule() $tab = glob("core/modules/mod*.class.php"); if (count($tab) == 0) { echo "[fail] Error on auto detect data : there is no mod*.class.php file into core/modules dir\n"; - exit(-1); + exit(1); } if (count($tab) == 1) { $file = $tab[0]; @@ -87,11 +87,11 @@ function detectModule() echo "extract data from $file\n"; if (!file_exists($file) || $name == "") { echo "[fail] Error on auto detect data\n"; - exit(-2); + exit(2); } } else { echo "[fail] Error there is more than one mod*.class.php file into core/modules dir\n"; - exit(-3); + exit(3); } //extract version from file @@ -105,7 +105,7 @@ function detectModule() if (version_compare($version, '0.0.1', '>=') != 1) { echo "[fail] Error auto extract version fail\n"; - exit(-4); + exit(4); } echo "module name = $name, version = $version\n"; @@ -145,11 +145,11 @@ function secureUnlink($path) clearstatcache(); if (file_exists($path)) { // @phpstan-ignore-line echo "[fail] unlink of $path fail !\n"; - exit(-5); + exit(5); } } else { echo "[fail] unlink of $path fail !\n"; - exit(-6); + exit(6); } } return true; @@ -298,7 +298,7 @@ foreach ($listOfModuleContent as $moduleContent) { if (!rcopy($entry, $dst . '/' . $entry)) { echo "[fail] Error on copy " . $entry . " to " . $dst . "/" . $entry . "\n"; echo "Please take time to analyze the problem and fix the bug\n"; - exit(-8); + exit(8); } } } @@ -312,5 +312,5 @@ if (file_exists($outzip)) { echo "[success] module archive is ready : $outzip ...\n"; } else { echo "[fail] build zip error\n"; - exit(-9); + exit(9); } diff --git a/htdocs/modulebuilder/template/scripts/mymodule.php b/htdocs/modulebuilder/template/scripts/mymodule.php index 8b19deb0a5e..07757b46915 100644 --- a/htdocs/modulebuilder/template/scripts/mymodule.php +++ b/htdocs/modulebuilder/template/scripts/mymodule.php @@ -54,7 +54,7 @@ $path = __DIR__.'/'; // Test if batch mode if (substr($sapi_type, 0, 3) == 'cgi') { echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n"; - exit(-1); + exit(1); } // Global variables @@ -95,7 +95,7 @@ if (!$res && file_exists("../../../master.inc.php")) { } if (!$res) { print "Include of master fails"; - exit(-1); + exit(1); } // After this $db, $mysoc, $langs, $conf and $hookmanager are defined (Opened $db handler to database will be closed at end of file). // $user is created but empty. @@ -129,7 +129,7 @@ $hookmanager->initHooks(array('cli')); print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." *****\n"; if (!isset($argv[1])) { // Check parameters print "Usage: ".$script_file." param1 param2 ...\n"; - exit(-1); + exit(1); } print '--- start'."\n"; print 'Argument 1='.$argv[1]."\n"; diff --git a/htdocs/product/card.php b/htdocs/product/card.php index d5ec04b349e..541c050d462 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -496,7 +496,8 @@ if (empty($reshook)) { // Quick edit for extrafields if ($action == 'update_extras' && $permissiontoeditextra) { - $object->oldcopy = dol_clone($object, 2); // @phan-suppress-current-line PhanTypeMismatchProperty + // we may use oldcopy->hasBatch( in triggers so keep 1 + $object->oldcopy = dol_clone($object, 1); // @phan-suppress-current-line PhanTypeMismatchProperty $attribute_name = GETPOST('attribute', 'aZ09'); diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 33f7a7c7ca2..f142db94b15 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -1494,7 +1494,7 @@ class Product extends CommonObject if ($result >= 0) { // $this->oldcopy should have been set by the caller of update (here properties were already modified) if (is_null($this->oldcopy) || (is_object($this->oldcopy) && $this->oldcopy->isEmpty())) { - $this->oldcopy = dol_clone($this, 1); + $this->oldcopy = dol_clone($this, 1); // 1 to clone with methods to avoid fatal error with $this->oldcopy->hasbatch() } // Test if batch management is activated on existing product // If yes, we create missing entries into product_batch diff --git a/htdocs/projet/class/api_tasks.class.php b/htdocs/projet/class/api_tasks.class.php index 673741ee3fe..476c4d32d22 100644 --- a/htdocs/projet/class/api_tasks.class.php +++ b/htdocs/projet/class/api_tasks.class.php @@ -1,7 +1,7 @@ - * Copyright (C) 2016 Laurent Destailleur - * Copyright (C) 2024 Frédéric France +/* Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2016 Laurent Destailleur + * Copyright (C) 2024-2025 Frédéric France * Copyright (C) 2025 MDW * * This program is free software; you can redistribute it and/or modify diff --git a/htdocs/public/cron/cron_run_jobs_by_url.php b/htdocs/public/cron/cron_run_jobs_by_url.php index bb27393d688..e130a1b74d4 100644 --- a/htdocs/public/cron/cron_run_jobs_by_url.php +++ b/htdocs/public/cron/cron_run_jobs_by_url.php @@ -61,7 +61,7 @@ if (is_numeric($entity)) { // Error if CLI mode if (php_sapi_name() == "cli") { echo "Error: This page can't be used as a CLI script. For the CLI version of script, launch cron_run_job.php available into scripts/cron/ directory.\n"; - exit(-1); + exit(1); } // core library @@ -179,12 +179,12 @@ if (is_array($object->lines) && (count($object->lines) > 0)) { if ($result < 0) { echo "\nUser Error: ".$user->error."\n"; dol_syslog("cron_run_jobs.php:: User Error:".$user->error, LOG_ERR); - exit(-1); + exit(1); } else { if ($result == 0) { echo "\nUser login: ".$userlogin." does not exists for entity ".$conf->entity."\n"; dol_syslog("User login:".$userlogin." does not exists", LOG_ERR); - exit(-1); + exit(1); } } $user->loadRights(); diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index 0c0bdea5e25..825590bfadc 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -2271,7 +2271,7 @@ if ($action == 'create') { } // Presend form - $modelmail = 'shipping_send'; + $modelmail = 'reception_send'; $defaulttopic = 'SendReceptionRef'; $diroutput = $conf->reception->dir_output; $trackid = 'rec'.$object->id; diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 4af7c4fba36..d942eb4ca2a 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -952,7 +952,7 @@ if ($socid > 0 && empty($object->id)) { $result = $object->fetch($socid); if ($result <= 0) { dol_print_error(null, $object->error); - exit(-1); + exit(1); } } diff --git a/scripts/members/sync_members_ldap2dolibarr.php b/scripts/members/sync_members_ldap2dolibarr.php index 1f1bdf02e33..7c143ec7c8e 100755 --- a/scripts/members/sync_members_ldap2dolibarr.php +++ b/scripts/members/sync_members_ldap2dolibarr.php @@ -156,7 +156,7 @@ if (!getDolGlobalString('LDAP_MEMBER_DN')) { } if ($typeid <= 0) { print $langs->trans("Error").': Parameter id_member_type is not a valid ref of an existing member type'."\n"; - exit(-2); + exit(2); } if (!empty($dolibarr_main_db_readonly)) { diff --git a/test/phpunit/AccountingAccountTest.php b/test/phpunit/AccountingAccountTest.php index 053fe345558..adc080b0258 100644 --- a/test/phpunit/AccountingAccountTest.php +++ b/test/phpunit/AccountingAccountTest.php @@ -62,7 +62,7 @@ class AccountingAccountTest extends CommonClassTest if (!isModEnabled('accounting')) { print __METHOD__." module accounting must be enabled.\n"; - exit(-1); + exit(1); } print __METHOD__."\n";