Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2026-04-03 17:34:41 +02:00
commit 127dbc1d2f
24 changed files with 316 additions and 127 deletions

View file

@ -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

View file

@ -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',

View file

@ -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.';
/**

View file

@ -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;

View file

@ -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 = '<a href="'.dolBuildUrl($backtopage ? $backtopage : DOL_URL_ROOT.'/admin/modules.php', ['restore_lastsearch_values' => 1]).'">'.img_picto($langs->trans("BackToModuleList"), 'back', 'class="pictofixedwidth"').'<span class="hideonsmartphone">'.$langs->trans("BackToModuleList").'</span></a>';
}
$morehtmlcenter = '';
$texttop = '';
@ -246,13 +239,14 @@ if ($inputregistrationnumber && strlen($inputregistrationnumber) < 8) {
*/
print '<br>';
}
if ($num == 0) {
print img_picto('', 'cross', 'class="pictofixedwidth error"').$langs->trans("NoRegistrationFound");
print '<br>';
}
} else {
dol_print_error($db);
}
if ($num == 0) {
print img_picto('', 'cross', 'class="pictofixedwidth error"').$langs->trans("NoRegistrationFound");
print '<br>';
}
print '<br>';
@ -283,12 +277,13 @@ if ($inputregistrationnumber && strlen($inputregistrationnumber) < 8) {
*/
print '<br>';
}
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 '<br>';
}
}

View file

@ -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)

View file

@ -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
';

View file

@ -74,6 +74,8 @@
* @var ?array<string,mixed> $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<string,mixed> $moreparams
@phan-var-force ?string $search_status
@phan-var-force ?int $hidedetails
@phan-var-force ?int $hidedesc
@phan-var-force ?int $hideref
';

View file

@ -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;

View file

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2011-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024-2026 Frédéric France <frederic.france@free.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -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') {

View file

@ -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

View file

@ -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;
}
}
}

View file

@ -4,7 +4,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2011-2020 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015-2025 Charlene Benke <charlene@patas-monkey.com>
* Copyright (C) 2015-2026 Charlene Benke <charlene@patas-monkey.com>
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2018-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2023-2024 William Mead <william.mead@manchenumerique.fr>
@ -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 = '';

View file

@ -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<int,array{id:int,rowid:int,ref:string,fk_user:int,fk_type:int,date_create:int|'',date_modification:int|'',description:string,date_debut:string,date_fin:string,date_debut_gmt:string,date_fin_gmt:string,halfday:int,statut:int,status:int,fk_validator:int,date_valid:mixed,fk_user_valid:mixed,date_approval:int|'',fk_user_approve:int,date_refuse:int|'',fk_user_refuse:int,date_cancel:int|'',fk_user_cancel:int,detail_refuse:string,user_firstname:string,user_lastname:string,user_login:string,user_statut:int,user_status:int,user_photo:string,validator_firstname:string,validator_lastname:string,validator_login:string,validator_statut:int,validator_status:int,validator_photo:string}>
*/
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) {

View file

@ -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

View file

@ -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;

View file

@ -4,7 +4,7 @@
* Copyright (C) 2005-2010 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010 François Legastelois <flegastelois@teclib.com>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024-2026 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2025 Alexandre Spangaro <alexandre@inovea-conseil.com>
*
* 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;
}

View file

@ -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') {

View file

@ -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<string,string> $request_data
* @phpstan-param ?array<string,string> $request_data
* @return int ID of ticket
* @phan-param ?array<string,mixed> $request_data
* @phpstan-param ?array<string,mixed> $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;
}

View file

@ -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");
}

View file

@ -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

View file

@ -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"

View file

@ -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"

View file

@ -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"