diff --git a/dev/build/phpstan/phpstan-baseline.neon b/dev/build/phpstan/phpstan-baseline.neon
index 4646b322e10..b8ccf550dc6 100644
--- a/dev/build/phpstan/phpstan-baseline.neon
+++ b/dev/build/phpstan/phpstan-baseline.neon
@@ -7686,12 +7686,6 @@ parameters:
count: 1
path: ../../../htdocs/holiday/class/holiday.class.php
- -
- message: '#^Negated boolean expression is always true\.$#'
- identifier: booleanNot.alwaysTrue
- count: 2
- path: ../../../htdocs/holiday/class/holiday.class.php
-
-
message: '#^Property Holiday\:\:\$events has no type specified\.$#'
identifier: missingType.property
diff --git a/dev/tools/phan/config.php b/dev/tools/phan/config.php
index 9a41901ee1a..3d854c41e5f 100644
--- a/dev/tools/phan/config.php
+++ b/dev/tools/phan/config.php
@@ -80,6 +80,7 @@ $VALID_MODULE_MAPPING = array(
'bom' => 'Bom',
'bookcal' => 'BookCal',
'bookmark' => 'Bookmark',
+ 'captureserver' => null, // Not provided by default, no module tests
'cashdesk' => null, // TODO: fill in proper class
'category' => 'Categorie',
'clicktodial' => 'ClickToDial',
diff --git a/htdocs/ai/class/ai.class.php b/htdocs/ai/class/ai.class.php
index a6b9f7596f6..64b82e98f4b 100644
--- a/htdocs/ai/class/ai.class.php
+++ b/htdocs/ai/class/ai.class.php
@@ -60,7 +60,8 @@ class Ai
const AI_DEFAULT_PROMPT_FOR_TEXT_SUMMARIZE = 'You are a writer, make the answer in the same language than the original text to summarize.';
const AI_DEFAULT_PROMPT_FOR_TEXT_REPHRASER = 'You are a writer, give only one answer with no comment and explanation and give the answer in the same language than the original text to rephrase.';
const AI_DEFAULT_PROMPT_FOR_EXTRAFIELD_FILLER = 'Give only one answer with no comment and explanation, I want the text to be ready to copy and paste.';
- const AI_DEFAULT_PROMPT_FOR_DOC_PARSING = 'You are an assistant to anayze documents. Return your answer with a JSON string and only a JSON string, do not add any other comment.';
+ const AI_DEFAULT_PROMPT_FOR_DOC_PARSING = 'You are an assistant to analyze documents. Return your answer with a JSON string and only a JSON string, do not add any other comment.';
+ const AI_DEFAULT_PROMPT_FOR_TEXT_SPELLCHECKER = 'You are the proofreader, please write your response in the same language as the original text in order to correct spelling and grammar errors.';
/**
diff --git a/htdocs/ai/lib/ai.lib.php b/htdocs/ai/lib/ai.lib.php
index c01c77c5b1f..a041ea6d5dc 100644
--- a/htdocs/ai/lib/ai.lib.php
+++ b/htdocs/ai/lib/ai.lib.php
@@ -44,6 +44,7 @@ function getListOfAIFeatures()
'texttranslation' => array('label' => $langs->trans('TextTranslation'), 'picto' => '', 'status'=>'dolibarr', 'function' => 'TEXT', 'placeholder' => Ai::AI_DEFAULT_PROMPT_FOR_TEXT_TRANSLATION),
'textsummarize' => array('label' => $langs->trans('TextSummarize'), 'picto' => '', 'status'=>'dolibarr', 'function' => 'TEXT', 'placeholder' => Ai::AI_DEFAULT_PROMPT_FOR_TEXT_SUMMARIZE),
'textrephrase' => array('label' => $langs->trans('TextRephraser'), 'picto' => '', 'status'=>'dolibarr', 'function' => 'TEXT', 'placeholder' => Ai::AI_DEFAULT_PROMPT_FOR_TEXT_REPHRASER),
+ 'textspellchecker' => array('label' => $langs->trans('TextSpellChecker'), 'picto' => '', 'status'=>'dolibarr', 'function' => 'TEXT', 'placeholder' => Ai::AI_DEFAULT_PROMPT_FOR_TEXT_SPELLCHECKER),
'textgenerationextrafield' => array('label' => $langs->trans('TextGeneration').' ('.$langs->trans("ExtrafieldFiller").')', 'picto' => '', 'status'=>'dolibarr', 'function' => 'TEXT', 'placeholder' => Ai::AI_DEFAULT_PROMPT_FOR_EXTRAFIELD_FILLER),
@@ -392,7 +393,8 @@ function getListForAIRephraseStyle()
{
$arrayforaierephrasestyle = array(
'professional' => 'RephraseStyleProfessional',
- 'humouristic' => 'RephraseStyleHumouristic'
+ 'humouristic' => 'RephraseStyleHumouristic',
+ 'spellchecker' => 'RephraseSpellChecker'
);
return $arrayforaierephrasestyle;
diff --git a/htdocs/blockedlog/admin/blockedlog_control.php b/htdocs/blockedlog/admin/blockedlog_control.php
index 32bc3f260fa..641e0e66186 100644
--- a/htdocs/blockedlog/admin/blockedlog_control.php
+++ b/htdocs/blockedlog/admin/blockedlog_control.php
@@ -144,19 +144,12 @@ if ($action == 'control' && $user->hasRight('blockedlog', 'read')) { // read is
$form = new Form($db);
$formother = new FormOther($db);
-if ($withtab) {
- $title = $langs->trans("ModuleSetup").' '.$langs->trans('BlockedLog');
-} else {
- $title = $langs->trans("BrowseBlockedLog");
-}
+$title = $langs->trans("BrowseBlockedLog");
$help_url = "EN:Module_Unalterable_Archives_-_Logs|FR:Module_Archives_-_Logs_Inaltérable";
llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'bodyforlist mod-blockedlog page-admin_blockedlog_list');
$linkback = '';
-if ($withtab) {
- $linkback = ''.img_picto($langs->trans("BackToModuleList"), 'back', 'class="pictofixedwidth"').''.$langs->trans("BackToModuleList").'';
-}
$morehtmlcenter = '';
$texttop = '';
@@ -246,13 +239,14 @@ if ($inputregistrationnumber && strlen($inputregistrationnumber) < 8) {
*/
print '
';
}
+ if ($num == 0) {
+ print img_picto('', 'cross', 'class="pictofixedwidth error"').$langs->trans("NoRegistrationFound");
+ print '
';
+ }
} else {
dol_print_error($db);
}
- if ($num == 0) {
- print img_picto('', 'cross', 'class="pictofixedwidth error"').$langs->trans("NoRegistrationFound");
- print '
';
- }
+
print '
';
@@ -283,12 +277,13 @@ if ($inputregistrationnumber && strlen($inputregistrationnumber) < 8) {
*/
print '
';
}
+ if ($num == 0) {
+ print img_picto('', 'tick', 'class="pictofixedwidth"').$langs->trans("NoBackupRestorationOrLastLineDeletionDetected");
+ }
} else {
dol_print_error($db);
}
- if ($num == 0) {
- print img_picto('', 'tick', 'class="pictofixedwidth"').$langs->trans("NoBackupRestorationOrLastLineDeletionDetected");
- }
+
print '
';
}
}
diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php
index 9a94e973ec2..0859ebffc39 100644
--- a/htdocs/compta/paiement/class/paiement.class.php
+++ b/htdocs/compta/paiement/class/paiement.class.php
@@ -303,7 +303,7 @@ class Paiement extends CommonObject
*
* @param User $user Object user
* @param int $closepaidinvoices 1=Also close paid invoices to paid, 0=Do nothing more
- * @param Societe $thirdparty Thirdparty
+ * @param Societe|null $thirdparty Thirdparty
* @return int id of created payment, < 0 if error
*/
public function create($user, $closepaidinvoices = 0, $thirdparty = null)
diff --git a/htdocs/core/actions_linkedfiles.inc.php b/htdocs/core/actions_linkedfiles.inc.php
index 397223a421b..3444a04ee24 100644
--- a/htdocs/core/actions_linkedfiles.inc.php
+++ b/htdocs/core/actions_linkedfiles.inc.php
@@ -38,6 +38,8 @@
*/
'
@phan-var-force string $upload_dir
+@phan-var-force string $upload_dirold
+@phan-var-force string $confirm
@phan-var-force string $forceFullTextIndexation
';
diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php
index 638ee57ffe7..e8baae9ddf9 100644
--- a/htdocs/core/actions_massactions.inc.php
+++ b/htdocs/core/actions_massactions.inc.php
@@ -74,6 +74,8 @@
* @var ?array $moreparams
*/
'
+@phan-var-force int $error
+@phan-var-force ?string $permissiontoadd
@phan-var-force ?string $permissiontoread
@phan-var-force ?string $permissiontodelete
@phan-var-force ?string $permissiontoclose
@@ -83,7 +85,13 @@
@phan-var-force ?string $objectlabel
@phan-var-force ?string $option
@phan-var-force int $deliveryreceipt
+@phan-var-force string $month
+@phan-var-force string $year
@phan-var-force ?array $moreparams
+@phan-var-force ?string $search_status
+@phan-var-force ?int $hidedetails
+@phan-var-force ?int $hidedesc
+@phan-var-force ?int $hideref
';
diff --git a/htdocs/core/actions_sendmails.inc.php b/htdocs/core/actions_sendmails.inc.php
index a00b65dae72..c836259731d 100644
--- a/htdocs/core/actions_sendmails.inc.php
+++ b/htdocs/core/actions_sendmails.inc.php
@@ -226,7 +226,24 @@ if (($action == 'send' || $action == 'relance') && !GETPOST('addfile') && !GETPO
// Recipient was provided from combo list
foreach ($receiver as $key => $val) {
if ($val == 'thirdparty') { // Key selected means current third party ('thirdparty' may be used for current member or current user too)
- $tmparray[] = dol_string_nospecial($thirdparty->getFullName($langs), ' ', array(",")).' <'.$thirdparty->email.'>';
+ $thirdpartyEmail = (is_object($thirdparty) && !empty($thirdparty->email)) ? (string) $thirdparty->email : '';
+ if ($thirdpartyEmail !== '') {
+ $thirdpartyLabel = '';
+ if (is_object($thirdparty)) {
+ if (method_exists($thirdparty, 'getFullName')) {
+ $thirdpartyLabel = (string) $thirdparty->getFullName($langs);
+ } elseif (!empty($thirdparty->name)) {
+ $thirdpartyLabel = (string) $thirdparty->name;
+ } elseif (!empty($thirdparty->nom)) {
+ $thirdpartyLabel = (string) $thirdparty->nom;
+ }
+ }
+ if ($thirdpartyLabel !== '') {
+ $tmparray[] = dol_string_nospecial($thirdpartyLabel, ' ', array(",")).' <'.$thirdpartyEmail.'>';
+ } else {
+ $tmparray[] = $thirdpartyEmail;
+ }
+ }
} elseif ($val == 'contact') { // Key selected means current contact
$tmparray[] = dol_string_nospecial($contact->getFullName($langs), ' ', array(",")).' <'.$contact->email.'>';
$sendtoid[] = $contact->id;
diff --git a/htdocs/core/ajax/saveinplace.php b/htdocs/core/ajax/saveinplace.php
index 87aded9e53f..5a83a935b61 100644
--- a/htdocs/core/ajax/saveinplace.php
+++ b/htdocs/core/ajax/saveinplace.php
@@ -1,7 +1,7 @@
* Copyright (C) 2024-2025 MDW
- * Copyright (C) 2024 Frédéric France
+ * Copyright (C) 2024-2026 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
@@ -196,7 +196,7 @@ if (!empty($field) && !empty($element) && !empty($table_element) && !empty($fk_e
$newvalue = ($timestamp / 1000);
}
- if (!$error && is_object($object)) {
+ if (!$error && is_object($object)) { // @phpstan-ignore-line as object is already tested as object at the beginning
$ret = $object->setValueFrom($field, $newvalue, $object->table_element, (int) $fk_element, $format);
if ($ret > 0) {
if ($type == 'numeric') {
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 7cab4a32244..585b7d123a4 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -9633,6 +9633,10 @@ function dol_htmlwithnojs($stringtoencode, $nouseofiframesandbox = 0, $check = '
// Add a layer to remove some styles
if (getDolGlobalInt('MAIN_RESTRICTHTML_ONLY_VALID_HTML') == 2) {
foreach ($dom->getElementsByTagName('*') as $el) {
+ if (!$el instanceof DOMElement) {
+ continue;
+ }
+
// @phan-suppress-next-line PhanPluginUnknownObjectMethodCall
if ($el->hasAttribute('style')) {
// @phan-suppress-next-line PhanPluginUnknownObjectMethodCall
diff --git a/htdocs/core/tpl/card_presend.tpl.php b/htdocs/core/tpl/card_presend.tpl.php
index c4402a6a7c3..f3d6e40fa6a 100644
--- a/htdocs/core/tpl/card_presend.tpl.php
+++ b/htdocs/core/tpl/card_presend.tpl.php
@@ -44,6 +44,7 @@
@phan-var-force string $defaulttopiclang
@phan-var-force string[] $arrayoffamiliestoexclude
@phan-var-force string $file
+@phan-var-force string $modelmail
@phan-var-force CommonObject $object
';
@@ -55,6 +56,9 @@ if (empty($conf) || !is_object($conf)) {
$fileparams = array();
$file = null;
+if (!isset($modelmail)) {
+ $modelmail = '';
+}
if ($action == 'presend') {
$langs->load("mails");
@@ -86,6 +90,9 @@ if ($action == 'presend') {
$outputlangs = $langs;
$newlang = '';
if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang)) {
+ if (!is_object($object->thirdparty) && method_exists($object, 'fetch_thirdparty')) {
+ $object->fetch_thirdparty();
+ }
if (is_object($object->thirdparty)) {
$newlang = $object->thirdparty->default_lang;
}
@@ -132,22 +139,24 @@ if ($action == 'presend') {
if ($forcebuilddoc) { // If there is no default value for supplier invoice, we do not generate file, even if modelpdf was set by a manual generation
if ((!$file || !is_readable($file)) && method_exists($object, 'generateDocument')) {
- $hidedetails = $hidedetails?$hidedetails:'';
- $hidedesc = $hidedetails?$hidedetails:'';
- $hideref = $hidedetails?$hidedetails:'';
+ $hidedetails = empty($hidedetails) ? '' : $hidedetails;
+ $hidedesc = empty($hidedesc) ? '' : $hidedesc;
+ $hideref = empty($hideref) ? '' : $hideref;
$result = $object->generateDocument(GETPOST('model') ? GETPOST('model') : $object->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
if ($result < 0) {
- dol_print_error($db, $object->error, $object->errors);
- exit();
- }
- if ($object->element == 'invoice_supplier') {
- $fileparams = dol_most_recent_file($diroutput.'/'.get_exdir($object->id, 2, 0, 0, $object, $object->element).$ref, preg_quote($ref, '/').'([^\-])+');
- } else {
- $fileparams = dol_most_recent_file($diroutput.'/'.$ref, preg_quote($ref, '/').'[^\-]+');
+ dol_syslog(__FILE__.' generateDocument failed for '.$object->element.' id='.(empty($object->id) ? 0 : $object->id).' error='.$object->error, LOG_ERR);
+ setEventMessages($object->error, $object->errors, 'errors');
}
+ if ($result >= 0) {
+ if ($object->element == 'invoice_supplier') {
+ $fileparams = dol_most_recent_file($diroutput.'/'.get_exdir($object->id, 2, 0, 0, $object, $object->element).$ref, preg_quote($ref, '/').'([^\-])+');
+ } else {
+ $fileparams = dol_most_recent_file($diroutput.'/'.$ref, preg_quote($ref, '/').'[^\-]+');
+ }
- $file = isset($fileparams['fullname']) ? $fileparams['fullname'] : null;
+ $file = isset($fileparams['fullname']) ? $fileparams['fullname'] : null;
+ }
}
}
diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php
index 8df921f3e10..194dbc9b3e9 100644
--- a/htdocs/fichinter/class/fichinter.class.php
+++ b/htdocs/fichinter/class/fichinter.class.php
@@ -4,7 +4,7 @@
* Copyright (C) 2005-2012 Regis Houssin
* Copyright (C) 2011-2020 Juanjo Menent
* Copyright (C) 2015 Marcos García
- * Copyright (C) 2015-2025 Charlene Benke
+ * Copyright (C) 2015-2026 Charlene Benke
* Copyright (C) 2018 Nicolas ZABOURI
* Copyright (C) 2018-2025 Frédéric France
* Copyright (C) 2023-2024 William Mead
@@ -1368,6 +1368,7 @@ class Fichinter extends CommonObject
$this->user_validation_id = 0;
$this->date_creation = '';
$this->date_validation = '';
+ $this->signed_status = 0;
$this->ref_client = '';
diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php
index 16ff2f5a018..95305b13e77 100644
--- a/htdocs/holiday/class/holiday.class.php
+++ b/htdocs/holiday/class/holiday.class.php
@@ -97,7 +97,7 @@ class Holiday extends CommonObject
public $date_fin_gmt = '';
/**
- * @var int|string 0:Full days, 2:Start afternoon end morning, -1:Start afternoon end afternoon, 1:Start morning end morning
+ * @var int|string 0:Full days, 2:Start afternoon end morning, -1:Start afternoon end afternoon, 1:Start morning end morning (in db integer default 0)
*/
public $halfday = '';
@@ -167,7 +167,11 @@ class Holiday extends CommonObject
*/
public $fk_type;
+ /**
+ * @var array
+ */
public $holiday = array();
+
public $events = array();
/**
@@ -249,6 +253,7 @@ class Holiday extends CommonObject
$obj = new $classname();
'@phan-var-force ModelNumRefHolidays $obj';
+ /** @var ModelNumRefHolidays $obj */
$numref = $obj->getNextValue($objsoc, $this);
if ($numref != "") {
@@ -367,12 +372,9 @@ class Holiday extends CommonObject
$sql = 'UPDATE '.MAIN_DB_PREFIX."holiday SET ref='".$this->db->escape($initialref)."' WHERE rowid=".((int) $this->id);
if ($this->db->query($sql)) {
$this->ref = $initialref;
-
- if (!$error) {
- $result = $this->insertExtraFields();
- if ($result < 0) {
- $error++;
- }
+ $result = $this->insertExtraFields();
+ if ($result < 0) {
+ $error++;
}
if (!$error && !$notrigger) {
@@ -449,18 +451,18 @@ class Holiday extends CommonObject
if ($this->db->num_rows($resql)) {
$obj = $this->db->fetch_object($resql);
- $this->id = $obj->rowid;
- $this->ref = ($obj->ref ? $obj->ref : $obj->rowid);
- $this->fk_user = $obj->fk_user;
+ $this->id = (int) $obj->rowid;
+ $this->ref = (string) ($obj->ref ? $obj->ref : $obj->rowid);
+ $this->fk_user = (int) $obj->fk_user;
$this->date_create = $this->db->jdate($obj->date_create);
$this->description = $obj->description;
$this->date_debut = $this->db->jdate($obj->date_debut);
$this->date_fin = $this->db->jdate($obj->date_fin);
$this->date_debut_gmt = $this->db->jdate($obj->date_debut, 1);
$this->date_fin_gmt = $this->db->jdate($obj->date_fin, 1);
- $this->halfday = $obj->halfday;
- $this->status = $obj->status;
- $this->statut = $obj->status; // deprecated
+ $this->halfday = (int) $obj->halfday;
+ $this->status = (int) $obj->status;
+ $this->statut = (int) $obj->status; // deprecated
$this->fk_validator = $obj->fk_validator;
$this->date_valid = $this->db->jdate($obj->date_valid);
$this->fk_user_valid = $obj->fk_user_valid;
@@ -511,6 +513,7 @@ class Holiday extends CommonObject
$sql .= " cp.fk_user,";
$sql .= " cp.fk_type,";
$sql .= " cp.date_create,";
+ $sql .= " cp.tms as date_modification,";
$sql .= " cp.description,";
$sql .= " cp.date_debut,";
$sql .= " cp.date_fin,";
@@ -572,45 +575,46 @@ class Holiday extends CommonObject
while ($i < $num) {
$obj = $this->db->fetch_object($resql);
- $tab_result[$i]['rowid'] = $obj->rowid;
- $tab_result[$i]['id'] = $obj->rowid;
- $tab_result[$i]['ref'] = ($obj->ref ? $obj->ref : $obj->rowid);
+ $tab_result[$i]['rowid'] = (int) $obj->rowid;
+ $tab_result[$i]['id'] = (int) $obj->rowid;
+ $tab_result[$i]['ref'] = (string) ($obj->ref ? $obj->ref : $obj->rowid);
- $tab_result[$i]['fk_user'] = $obj->fk_user;
- $tab_result[$i]['fk_type'] = $obj->fk_type;
+ $tab_result[$i]['fk_user'] = (int) $obj->fk_user;
+ $tab_result[$i]['fk_type'] = (int) $obj->fk_type;
$tab_result[$i]['date_create'] = $this->db->jdate($obj->date_create);
- $tab_result[$i]['description'] = $obj->description;
+ $tab_result[$i]['date_modification'] = $this->db->jdate($obj->date_modification);
+ $tab_result[$i]['description'] = (string) $obj->description;
$tab_result[$i]['date_debut'] = $this->db->jdate($obj->date_debut);
$tab_result[$i]['date_fin'] = $this->db->jdate($obj->date_fin);
$tab_result[$i]['date_debut_gmt'] = $this->db->jdate($obj->date_debut, 1);
$tab_result[$i]['date_fin_gmt'] = $this->db->jdate($obj->date_fin, 1);
- $tab_result[$i]['halfday'] = $obj->halfday;
- $tab_result[$i]['statut'] = $obj->status;
- $tab_result[$i]['status'] = $obj->status;
- $tab_result[$i]['fk_validator'] = $obj->fk_validator;
+ $tab_result[$i]['halfday'] = (int) $obj->halfday;
+ $tab_result[$i]['statut'] = (int) $obj->status;
+ $tab_result[$i]['status'] = (int) $obj->status;
+ $tab_result[$i]['fk_validator'] = (int) $obj->fk_validator;
$tab_result[$i]['date_valid'] = $this->db->jdate($obj->date_valid);
- $tab_result[$i]['fk_user_valid'] = $obj->fk_user_valid;
+ $tab_result[$i]['fk_user_valid'] = (int) $obj->fk_user_valid;
$tab_result[$i]['date_approval'] = $this->db->jdate($obj->date_approval);
- $tab_result[$i]['fk_user_approve'] = $obj->fk_user_approve;
+ $tab_result[$i]['fk_user_approve'] = (int) $obj->fk_user_approve;
$tab_result[$i]['date_refuse'] = $this->db->jdate($obj->date_refuse);
- $tab_result[$i]['fk_user_refuse'] = $obj->fk_user_refuse;
+ $tab_result[$i]['fk_user_refuse'] = (int) $obj->fk_user_refuse;
$tab_result[$i]['date_cancel'] = $this->db->jdate($obj->date_cancel);
- $tab_result[$i]['fk_user_cancel'] = $obj->fk_user_cancel;
- $tab_result[$i]['detail_refuse'] = $obj->detail_refuse;
+ $tab_result[$i]['fk_user_cancel'] = (int) $obj->fk_user_cancel;
+ $tab_result[$i]['detail_refuse'] = (string) $obj->detail_refuse;
- $tab_result[$i]['user_firstname'] = $obj->user_firstname;
- $tab_result[$i]['user_lastname'] = $obj->user_lastname;
- $tab_result[$i]['user_login'] = $obj->user_login;
- $tab_result[$i]['user_statut'] = $obj->user_status;
- $tab_result[$i]['user_status'] = $obj->user_status;
- $tab_result[$i]['user_photo'] = $obj->user_photo;
+ $tab_result[$i]['user_firstname'] = (string) $obj->user_firstname;
+ $tab_result[$i]['user_lastname'] = (string) $obj->user_lastname;
+ $tab_result[$i]['user_login'] = (string) $obj->user_login;
+ $tab_result[$i]['user_statut'] = (int) $obj->user_status;
+ $tab_result[$i]['user_status'] = (int) $obj->user_status;
+ $tab_result[$i]['user_photo'] = (string) $obj->user_photo;
- $tab_result[$i]['validator_firstname'] = $obj->validator_firstname;
- $tab_result[$i]['validator_lastname'] = $obj->validator_lastname;
- $tab_result[$i]['validator_login'] = $obj->validator_login;
- $tab_result[$i]['validator_statut'] = $obj->validator_status;
- $tab_result[$i]['validator_status'] = $obj->validator_status;
- $tab_result[$i]['validator_photo'] = $obj->validator_photo;
+ $tab_result[$i]['validator_firstname'] = (string) $obj->validator_firstname;
+ $tab_result[$i]['validator_lastname'] = (string) $obj->validator_lastname;
+ $tab_result[$i]['validator_login'] = (string) $obj->validator_login;
+ $tab_result[$i]['validator_statut'] = (int) $obj->validator_status;
+ $tab_result[$i]['validator_status'] = (int) $obj->validator_status;
+ $tab_result[$i]['validator_photo'] = (string) $obj->validator_photo;
$i++;
}
@@ -701,46 +705,46 @@ class Holiday extends CommonObject
while ($i < $num) {
$obj = $this->db->fetch_object($resql);
- $tab_result[$i]['rowid'] = $obj->rowid;
- $tab_result[$i]['id'] = $obj->rowid;
- $tab_result[$i]['ref'] = ($obj->ref ? $obj->ref : $obj->rowid);
+ $tab_result[$i]['rowid'] = (int) $obj->rowid;
+ $tab_result[$i]['id'] = (int) $obj->rowid;
+ $tab_result[$i]['ref'] = (string) ($obj->ref ? $obj->ref : $obj->rowid);
- $tab_result[$i]['fk_user'] = $obj->fk_user;
- $tab_result[$i]['fk_type'] = $obj->fk_type;
+ $tab_result[$i]['fk_user'] = (int) $obj->fk_user;
+ $tab_result[$i]['fk_type'] = (int) $obj->fk_type;
$tab_result[$i]['date_create'] = $this->db->jdate($obj->date_create);
$tab_result[$i]['date_modification'] = $this->db->jdate($obj->date_modification);
- $tab_result[$i]['description'] = $obj->description;
+ $tab_result[$i]['description'] = (string) $obj->description;
$tab_result[$i]['date_debut'] = $this->db->jdate($obj->date_debut);
$tab_result[$i]['date_fin'] = $this->db->jdate($obj->date_fin);
$tab_result[$i]['date_debut_gmt'] = $this->db->jdate($obj->date_debut, 1);
$tab_result[$i]['date_fin_gmt'] = $this->db->jdate($obj->date_fin, 1);
- $tab_result[$i]['halfday'] = $obj->halfday;
- $tab_result[$i]['statut'] = $obj->status;
- $tab_result[$i]['status'] = $obj->status;
- $tab_result[$i]['fk_validator'] = $obj->fk_validator;
+ $tab_result[$i]['halfday'] = (int) $obj->halfday;
+ $tab_result[$i]['statut'] = (int) $obj->status;
+ $tab_result[$i]['status'] = (int) $obj->status;
+ $tab_result[$i]['fk_validator'] = (int) $obj->fk_validator;
$tab_result[$i]['date_valid'] = $this->db->jdate($obj->date_valid);
- $tab_result[$i]['fk_user_valid'] = $obj->fk_user_valid;
+ $tab_result[$i]['fk_user_valid'] = (int) $obj->fk_user_valid;
$tab_result[$i]['date_approval'] = $this->db->jdate($obj->date_approval);
- $tab_result[$i]['fk_user_approve'] = $obj->fk_user_approve;
- $tab_result[$i]['date_refuse'] = $obj->date_refuse;
- $tab_result[$i]['fk_user_refuse'] = $obj->fk_user_refuse;
- $tab_result[$i]['date_cancel'] = $obj->date_cancel;
- $tab_result[$i]['fk_user_cancel'] = $obj->fk_user_cancel;
- $tab_result[$i]['detail_refuse'] = $obj->detail_refuse;
+ $tab_result[$i]['fk_user_approve'] = (int) $obj->fk_user_approve;
+ $tab_result[$i]['date_refuse'] = $this->db->jdate($obj->date_refuse);
+ $tab_result[$i]['fk_user_refuse'] = (int) $obj->fk_user_refuse;
+ $tab_result[$i]['date_cancel'] = $this->db->jdate($obj->date_cancel);
+ $tab_result[$i]['fk_user_cancel'] = (int) $obj->fk_user_cancel;
+ $tab_result[$i]['detail_refuse'] = (string) $obj->detail_refuse;
- $tab_result[$i]['user_firstname'] = $obj->user_firstname;
- $tab_result[$i]['user_lastname'] = $obj->user_lastname;
- $tab_result[$i]['user_login'] = $obj->user_login;
- $tab_result[$i]['user_statut'] = $obj->user_status;
- $tab_result[$i]['user_status'] = $obj->user_status;
- $tab_result[$i]['user_photo'] = $obj->user_photo;
+ $tab_result[$i]['user_firstname'] = (string) $obj->user_firstname;
+ $tab_result[$i]['user_lastname'] = (string) $obj->user_lastname;
+ $tab_result[$i]['user_login'] = (string) $obj->user_login;
+ $tab_result[$i]['user_statut'] = (int) $obj->user_status;
+ $tab_result[$i]['user_status'] = (int) $obj->user_status;
+ $tab_result[$i]['user_photo'] = (string) $obj->user_photo;
- $tab_result[$i]['validator_firstname'] = $obj->validator_firstname;
- $tab_result[$i]['validator_lastname'] = $obj->validator_lastname;
- $tab_result[$i]['validator_login'] = $obj->validator_login;
- $tab_result[$i]['validator_statut'] = $obj->validator_status;
- $tab_result[$i]['validator_status'] = $obj->validator_status;
- $tab_result[$i]['validator_photo'] = $obj->validator_photo;
+ $tab_result[$i]['validator_firstname'] = (string) $obj->validator_firstname;
+ $tab_result[$i]['validator_lastname'] = (string) $obj->validator_lastname;
+ $tab_result[$i]['validator_login'] = (string) $obj->validator_login;
+ $tab_result[$i]['validator_statut'] = (int) $obj->validator_status;
+ $tab_result[$i]['validator_status'] = (int) $obj->validator_status;
+ $tab_result[$i]['validator_photo'] = (string) $obj->validator_photo;
$i++;
}
@@ -1801,11 +1805,7 @@ class Holiday extends CommonObject
$yearMonthLastUpdate = dol_print_date($lastUpdate, '%Y%m');
}
- if (!$error) {
- return 1;
- } else {
- return 0;
- }
+ return 1;
} else {
// Update for one user
$nbHoliday = price2num($nbHoliday, 5);
@@ -2639,7 +2639,6 @@ class Holiday extends CommonObject
{
global $conf, $langs, $user;
- $db = $this->db;
$outputlangs = $langs;
$error = 0;
@@ -2795,7 +2794,6 @@ class Holiday extends CommonObject
if (is_numeric($mailtemplate) || empty($mailtemplate->topic)) {
$this->errors[] = 'No mail template found for code "'.$templateLabel.'" or id "'.$templateId.'".';
$error++;
- return 1;
}
if (!$error) {
diff --git a/htdocs/langs/en_US/other.lang b/htdocs/langs/en_US/other.lang
index 741c20f7013..29bbf919e4f 100644
--- a/htdocs/langs/en_US/other.lang
+++ b/htdocs/langs/en_US/other.lang
@@ -377,7 +377,9 @@ TextSummarize=Text summarize
RephraserByAI=Rephrase message in
RephraseStyleProfessional=Professional style
RephraseStyleHumouristic=Humouristic style
+RephraseSpellChecker=Spell checker
TextRephraser=Text style rephraser
+TextSpellChecker=Text spell checker
AIEnhancements=AI Enhancements
TLSv1=TLSv1
TLSv1.2=TLSv1.2
diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php
index 04b1ae7e5ea..5f93b579c66 100644
--- a/htdocs/product/class/product.class.php
+++ b/htdocs/product/class/product.class.php
@@ -2346,8 +2346,12 @@ class Product extends CommonObject
$sql .= " WHERE fk_product_price = ".((int) $rowid);
$resql = $this->db->query($sql);
+ $sql = "DELETE FROM ".$this->db->prefix()."product_price_extrafields";
+ $sql .= " WHERE fk_object = ".((int) $rowid);
+ $resql = $this->db->query($sql);
+
$sql = "DELETE FROM ".$this->db->prefix()."product_price";
- $sql .= " WHERE rowid=".((int) $rowid);
+ $sql .= " WHERE rowid = ".((int) $rowid);
$resql = $this->db->query($sql);
if ($resql) {
return 1;
diff --git a/htdocs/projet/activity/permonth.php b/htdocs/projet/activity/permonth.php
index c9d94db54e4..debc0ae8e09 100644
--- a/htdocs/projet/activity/permonth.php
+++ b/htdocs/projet/activity/permonth.php
@@ -4,7 +4,7 @@
* Copyright (C) 2005-2010 Regis Houssin
* Copyright (C) 2010 François Legastelois
* Copyright (C) 2024-2025 MDW
- * Copyright (C) 2024-2025 Frédéric France
+ * Copyright (C) 2024-2026 Frédéric France
* Copyright (C) 2025 Alexandre Spangaro
*
* This program is free software; you can redistribute it and/or modify
@@ -777,7 +777,7 @@ if (count($tasksarray) > 0) {
$THolidays[$weekNb]["ids"] = array();
$THolidays[$weekNb]["days"] = 0;
foreach ($holiday->holiday as $key => $h) {
- if (!empty($THolidays[$weekNb]["ids"]) && in_array($h->rowid, $THolidays[$weekNb]["ids"])) {
+ if (!empty($THolidays[$weekNb]["ids"]) && in_array($h["id"], $THolidays[$weekNb]["ids"])) {
continue;
}
$startweekholiday = (int) (($h["date_debut"] <= $weekstart) ? $weekstart : $h["date_debut"]);
@@ -785,7 +785,7 @@ if (count($tasksarray) > 0) {
$halfdays = (int) $h["halfday"];
$nbdays = num_open_day($startweekholiday, $endweekholiday, 0, 1, $halfdays, $usertoprocess->country_id);
- $THolidays[$weekNb]["ids"][] = $h->rowid;
+ $THolidays[$weekNb]["ids"][] = $h["id"];
$THolidays[$weekNb]["days"] += $nbdays;
$totaldayholiday += $nbdays;
}
diff --git a/htdocs/projet/class/api_tasks.class.php b/htdocs/projet/class/api_tasks.class.php
index 614a661da33..4411bde8ddf 100644
--- a/htdocs/projet/class/api_tasks.class.php
+++ b/htdocs/projet/class/api_tasks.class.php
@@ -143,7 +143,7 @@ class Tasks extends DolibarrApi
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "projet AS p ON p.rowid = t.fk_projet";
$sql .= ' WHERE t.entity IN (' . getEntity('project') . ')';
if ($socids) {
- $sql .= " AND t.fk_soc IN (" . $this->db->sanitize((string) $socids) . ")";
+ $sql .= " AND p.fk_soc IN (" . $this->db->sanitize((string) $socids) . ")";
}
// Search on sale representative
if ($search_sale && $search_sale != '-1') {
diff --git a/htdocs/ticket/class/api_tickets.class.php b/htdocs/ticket/class/api_tickets.class.php
index b8bb51cfc36..6091e2c9e99 100644
--- a/htdocs/ticket/class/api_tickets.class.php
+++ b/htdocs/ticket/class/api_tickets.class.php
@@ -384,19 +384,32 @@ class Tickets extends DolibarrApi
* Add a new message to an existing ticket identified by property ->track_id into request.
*
* @param array $request_data Request data
- * @phan-param ?array $request_data
- * @phpstan-param ?array $request_data
- * @return int ID of ticket
+ * @phan-param ?array $request_data
+ * @phpstan-param ?array $request_data
+ * @return int|array ID of ticket, or ticket/action IDs when requested
+ * @phan-return int|array{ticket_id:int,action_id:int}
+ * @phpstan-return int|array{ticket_id:int,action_id:int}
*/
public function postNewMessage($request_data = null)
{
- $ticketstatic = new Ticket($this->db);
if (!DolibarrApiAccess::$user->hasRight('ticket', 'write')) {
throw new RestException(403);
}
// Check mandatory fields
$result = $this->_validateMessage($request_data);
+ $return_action_id = false;
+ if (isset($request_data['return_action_id'])) {
+ $return_action_id = !empty($request_data['return_action_id']);
+ unset($request_data['return_action_id']);
+ }
+
+ $attachments = array();
+ if (isset($request_data['attachments']) && is_array($request_data['attachments'])) {
+ $attachments = $request_data['attachments'];
+ unset($request_data['attachments']);
+ }
+
foreach ($request_data as $field => $value) {
if ($field === 'caller') {
// Add a mention of caller so on trigger called after action, we can filter to avoid a loop if we try to sync back again with the caller
@@ -412,9 +425,84 @@ class Tickets extends DolibarrApi
throw new RestException(404, 'Ticket not found');
}
$this->ticket->message = $ticketMessageText;
- if (!$this->ticket->createTicketMessage(DolibarrApiAccess::$user)) {
+
+ $filename_list = array();
+ $mimetype_list = array();
+ $mimefilename_list = array();
+ if (!empty($attachments)) {
+ global $conf;
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
+
+ $destdir = $conf->ticket->dir_output.'/'.$this->ticket->ref;
+ if (!dol_is_dir($destdir) && dol_mkdir($destdir) < 0) {
+ throw new RestException(500, 'Error while trying to create directory '.$destdir);
+ }
+
+ foreach ($attachments as $attachment) {
+ if (!is_array($attachment) || empty($attachment['filename'])) {
+ continue;
+ }
+
+ $filename = dol_sanitizeFileName($attachment['filename']);
+ if (empty($filename)) {
+ continue;
+ }
+
+ $filecontent = isset($attachment['filecontent']) ? $attachment['filecontent'] : '';
+ $fileencoding = isset($attachment['fileencoding']) ? $attachment['fileencoding'] : '';
+ $content = ($fileencoding === 'base64') ? base64_decode($filecontent) : $filecontent;
+ if ($content === false) {
+ throw new RestException(400, 'Failed to decode attachment '.$filename);
+ }
+
+ $destfile = $destdir.'/'.$filename;
+ if (is_file($destfile)) {
+ $pathinfo = pathinfo($filename);
+ $suffix = ' - '.dol_print_date(dol_now(), 'dayhourlog');
+ $extension = !empty($pathinfo['extension']) ? '.'.$pathinfo['extension'] : '';
+ $basename = !empty($pathinfo['filename']) ? $pathinfo['filename'] : preg_replace('/\.[^.]+$/', '', $filename);
+ $destfile = $destdir.'/'.$basename.$suffix.$extension;
+ }
+
+ $destfiletmp = DOL_DATA_ROOT.'/admin/temp/'.basename($destfile);
+ if (!dol_is_dir(dirname($destfiletmp))) {
+ dol_mkdir(dirname($destfiletmp));
+ }
+
+ $fhandle = @fopen($destfiletmp, 'w');
+ if (!$fhandle) {
+ throw new RestException(500, "Failed to open file '".$destfiletmp."' for write");
+ }
+ $nbofbyteswrote = fwrite($fhandle, $content);
+ fclose($fhandle);
+ if ($nbofbyteswrote === false) {
+ throw new RestException(500, "Failed to write file '".$destfiletmp."'");
+ }
+
+ $moreinfo = array(
+ 'description' => 'File uploaded using ticket API',
+ 'src_object_type' => $this->ticket->element,
+ 'src_object_id' => $this->ticket->id,
+ 'gen_or_uploaded' => 'uploaded'
+ );
+ $resultmove = dol_move($destfiletmp, $destfile, '0', 1, 0, 1, $moreinfo);
+ if (!$resultmove) {
+ throw new RestException(500, "Failed to move file into '".$destfile."'");
+ }
+
+ $filename_list[] = $destfile;
+ $mimefilename_list[] = basename($destfile);
+ $mimetype_list[] = !empty($attachment['mimetype']) ? $attachment['mimetype'] : '';
+ }
+ }
+
+ $actionid = $this->ticket->createTicketMessage(DolibarrApiAccess::$user, 0, $filename_list, $mimetype_list, $mimefilename_list);
+ if ($actionid <= 0) {
throw new RestException(500, 'Error when creating ticket');
}
+ if ($return_action_id) {
+ return array('ticket_id' => $this->ticket->id, 'action_id' => $actionid);
+ }
return $this->ticket->id;
}
diff --git a/htdocs/user/class/api_users.class.php b/htdocs/user/class/api_users.class.php
index bdff6421e4a..0ef0f5bcb8e 100644
--- a/htdocs/user/class/api_users.class.php
+++ b/htdocs/user/class/api_users.class.php
@@ -411,8 +411,21 @@ class Users extends DolibarrApi
*/
public function put($id, $request_data = null)
{
+ $isSelfUpdate = ((int) $id === (int) DolibarrApiAccess::$user->id);
+
// Check user authorization
- if (!DolibarrApiAccess::$user->hasRight('user', 'user', 'creer') && empty(DolibarrApiAccess::$user->admin)) {
+ if (
+ !DolibarrApiAccess::$user->hasRight('user', 'user', 'creer')
+ && !DolibarrApiAccess::$user->hasRight('user', 'user', 'write')
+ && !(
+ $isSelfUpdate
+ && (
+ DolibarrApiAccess::$user->hasRight('user', 'self', 'creer')
+ || DolibarrApiAccess::$user->hasRight('user', 'self', 'write')
+ )
+ )
+ && empty(DolibarrApiAccess::$user->admin)
+ ) {
throw new RestException(403, "User update not allowed");
}
diff --git a/test/hurl/api/compta/facture/10_facture.hurl b/test/hurl/api/compta/facture/10_facture.hurl
index 6ffe7b11c4f..328a2708aba 100644
--- a/test/hurl/api/compta/facture/10_facture.hurl
+++ b/test/hurl/api/compta/facture/10_facture.hurl
@@ -39,7 +39,7 @@ jsonpath "$.pagination.limit" == 100
# GET invoice with ID 0 - which should not exist
GET http://{{hostnport}}/api/index.php/invoices/0
HTTP 400
-{"error":{"code":400,"message":"Bad Request: No invoice with id=0 can exist"}}
+{"error":{"code":400,"message":"Bad Request: No invoice can be found with no criteria"}}
# POST {}
POST http://{{hostnport}}/api/index.php/invoices
diff --git a/test/hurl/gui/eventorganization/10_conferenceorbooth_list.hurl b/test/hurl/gui/eventorganization/10_conferenceorbooth_list.hurl
new file mode 100644
index 00000000000..b0d62900f47
--- /dev/null
+++ b/test/hurl/gui/eventorganization/10_conferenceorbooth_list.hurl
@@ -0,0 +1,5 @@
+# Check list of open Organized events
+GET http://{{hostnport}}/eventorganization/conferenceorbooth_list.php
+HTTP 200
+[Asserts]
+body contains "Conferences or Booths"
diff --git a/test/hurl/gui/eventorganization/10_eventorganization.hurl b/test/hurl/gui/eventorganization/10_eventorganization.hurl
new file mode 100644
index 00000000000..418e4b2e040
--- /dev/null
+++ b/test/hurl/gui/eventorganization/10_eventorganization.hurl
@@ -0,0 +1,40 @@
+# Check list of open Organized events
+GET http://{{hostnport}}/projet/list.php?search_usage_event_organization=1&search_status=1
+HTTP 200
+[Asserts]
+body contains "Leads | Projects"
+
+# Check list of draft Organized events
+GET http://{{hostnport}}/projet/list.php?search_usage_event_organization=1&search_status=0
+HTTP 200
+[Asserts]
+body contains "Leads | Projects"
+
+# Check list of closed Organized events
+GET http://{{hostnport}}/projet/list.php?search_usage_event_organization=1&search_status=2
+HTTP 200
+[Asserts]
+body contains "Leads | Projects"
+
+# GET the page that creates a new Organized event
+GET http://{{hostnport}}/projet/card.php?leftmenu=projects&action=create&usage_organize_event=1&usage_opportunity=0
+HTTP 200
+[Asserts]
+body contains "New lead or project"
+body contains "Ref."
+body contains "Label"
+body contains "Parent"
+body contains "Usage"
+body contains "Third party"
+body contains "Status"
+body contains "Budget"
+body contains "Date (Event)"
+body contains "Location"
+body contains "Description"
+body contains "Tags/categories"
+body contains "Visibility"
+body contains "Assign me as contact with the type"
+body contains "Follow opportunity"
+body contains "Follow tasks or time spent"
+body contains "Bill the time spent"
+body contains "Manage the organization of an event"
diff --git a/test/hurl/gui/eventorganization/conferenceorboothattendee_list.hurl b/test/hurl/gui/eventorganization/conferenceorboothattendee_list.hurl
new file mode 100644
index 00000000000..60ea3f69dc7
--- /dev/null
+++ b/test/hurl/gui/eventorganization/conferenceorboothattendee_list.hurl
@@ -0,0 +1,5 @@
+# Check list of open Organized events
+GET http://{{hostnport}}/eventorganization/conferenceorboothattendee_list.php
+HTTP 200
+[Asserts]
+body contains "List of attendees of event projects"