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

This commit is contained in:
Laurent Destailleur 2026-02-16 21:23:48 +01:00
commit 125d97cf5d
14 changed files with 48 additions and 28 deletions

View file

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2025 Alexandre Spangaro <alexandre@inovea-conseil.com>
* Copyright (C) 2013-2026 Alexandre Spangaro <alexandre@inovea-conseil.com>
* Copyright (C) 2022 Lionel Vessiller <lvessiller@open-dsi.fr>
* Copyright (C) 2016-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2018-2025 Frédéric France <frederic.france@free.fr>
@ -869,7 +869,7 @@ if ($action == 'export_file') {
);
}
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?'.$param, $langs->trans("ExportFilteredList").'...', '', 'export_fileconfirm', $form_question, '', 1, 390, 700);
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?'.$param, $langs->trans("ExportFilteredList").'...', $langs->trans('ConfirmExportFile'), 'export_fileconfirm', $form_question, '', 1, 500, 700);
}
// Print form confirm

View file

@ -1161,7 +1161,7 @@ class BlockedLog
{
$aaa = null;
try {
$aaa = (object) jsonOrUnserialize($data);
$aaa = (object) jsonOrUnserialize($data, false);
} catch (Exception $e) {
// print $e->getErrs);
}

View file

@ -54,7 +54,7 @@ $date_endyear = GETPOSTINT('date_endyear');
$nbofyear = 4;
// Change this to test different cases of setup
// Change this to test different cases of setup.
//$conf->global->SOCIETE_FISCAL_MONTH_START = 7;

View file

@ -4943,6 +4943,8 @@ abstract class CommonObject
$this->context = array_merge($this->context, array('newstatus' => $status));
if ($trigkey && $trigkey != 'none') {
$this->oldcopy = dol_clone($this);
// Call trigger
$result = $this->call_trigger($trigkey, $user);
if ($result < 0) {

View file

@ -15,7 +15,7 @@
* Copyright (C) 2012-2016 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2012-2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2014-2023 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2014-2026 Alexandre Spangaro <alexandre@inovea-conseil.com>
* Copyright (C) 2018-2022 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018-2026 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
@ -7387,7 +7387,7 @@ class Form
if (!empty($user) && $user->admin && preg_match('/\'(..)\'/', $country_code, $reg)) {
$langs->load("errors");
$new_country_code = $reg[1];
$country_id = dol_getIdFromCode($this->db, $new_country_code, 'c_pays', 'code', 'rowid');
$country_id = dol_getIdFromCode($this->db, $new_country_code, 'c_country', 'code', 'rowid');
$this->error .= '<br>'.$langs->trans("ErrorFixThisHere", DOL_URL_ROOT.'/admin/dict.php?id=10'.($country_id > 0 ? '&countryidforinsert='.$country_id : ''));
}
$this->error .= '</span>';

View file

@ -1937,11 +1937,12 @@ function dol_size($size, $type = '')
* @param string $newstr String to replace bad chars with.
* @param int $unaccent 1=Remove also accent (default), 0 do not remove them
* @param int $includequotes 1=Include simple quotes (double is already included by default)
* @param int $allowdash 1=Allow dash char after a space and before a string, 0 do not allow
* @return string String cleaned
*
* @see dol_string_nospecial(), dol_string_unaccent(), dol_sanitizePathName()
*/
function dol_sanitizeFileName($str, $newstr = '_', $unaccent = 1, $includequotes = 0)
function dol_sanitizeFileName($str, $newstr = '_', $unaccent = 1, $includequotes = 0, $allowdash = 0)
{
$str = (string) $str;
@ -1955,9 +1956,13 @@ function dol_sanitizeFileName($str, $newstr = '_', $unaccent = 1, $includequotes
}
$tmp = dol_string_nospecial($unaccent ? dol_string_unaccent($str) : $str, $newstr, $filesystem_forbidden_chars);
$tmp = preg_replace('/\-\-+/', '_', $tmp);
$tmp = preg_replace('/\s+\-([^\s])/', ' _$1', $tmp);
$tmp = preg_replace('/\s+\-$/', '', $tmp);
if (empty($allowdash)) {
$tmp = preg_replace('/\s+\-([^\s])/', ' _$1', $tmp);
$tmp = preg_replace('/\s+\-$/', '', $tmp);
}
$tmp = str_replace('..', '', $tmp);
$tmp = str_replace('~', $newstr, $tmp);
$tmp = preg_replace('/\s{2,}/', ' ', $tmp);
return $tmp;
}
@ -1998,6 +2003,8 @@ function dol_sanitizePathName($str, $newstr = '_', $unaccent = 0, $allowdash = 0
}
$tmp = str_replace('..', $newstr, $tmp);
$tmp = str_replace('~', $newstr, $tmp);
$tmp = preg_replace('/\s{2,}/', ' ', $tmp);
return $tmp;
}
@ -15703,11 +15710,12 @@ function showValueWithClipboardCPButton($valuetocopy, $showonlyonhover = 1, $tex
* Decode an encoded string. The string can be encoded in json format (recommended) or with serialize (avoid this)
*
* @param string $stringtodecode String to decode (json or serialize coded)
* @param boolean $assoc true=Return is converted into associative array
* @return mixed The decoded object.
*/
function jsonOrUnserialize($stringtodecode)
function jsonOrUnserialize($stringtodecode, $assoc = true)
{
$result = json_decode($stringtodecode);
$result = json_decode($stringtodecode, $assoc);
if ($result === null) {
$result = unserialize($stringtodecode); // For backward compatibility. Is no more used in recent versions.
}

View file

@ -3214,13 +3214,7 @@ class CommandeFournisseur extends CommonOrder
if ($qty < $this->line->packaging) {
$qty = $this->line->packaging;
} else {
// Ensure packaging is numeric, positive, and use fmod instead of %, to prevent error with decimal packaging values (resulting in division by zero)
if (
!empty($this->line->packaging)
&& is_numeric($this->line->packaging)
&& (float) $this->line->packaging > 0
&& fmod((float) $qty, (float) $this->line->packaging) > 0
) {
if (!empty($this->line->packaging) && is_numeric($this->line->packaging) && (float) $this->line->packaging > 0 && (fmod((float) $qty, (float) $this->line->packaging) > 0)) {
$coeff = intval($qty / $this->line->packaging) + 1;
$qty = $this->line->packaging * $coeff;
setEventMessage($langs->trans('QtyRecalculatedWithPackaging'), 'mesgs');

View file

@ -1598,6 +1598,11 @@ if (empty($reshook)) {
dol_syslog("Try to find source object origin=".$object->origin_type." originid=".$object->origin_id." to add lines");
$result = $srcobject->fetch($object->origin_id);
if ($result > 0) {
if (empty($object->delivery_date)) {
$tmpdate = $srcobject->delivery_date;
$object->setDeliveryDate($user, $tmpdate);
}
$object->set_id_projet($user, $srcobject->fk_project);
$lines = $srcobject->lines;

View file

@ -207,7 +207,7 @@ insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (1
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (140, '14','0','VAT rate - intermediary',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (140, '8','0','VAT rate - reduced', 1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (140, '3','0','VAT rate - super-reduced', 1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (140, '16','0','VAT rate - standard',1,__ENTITY__);
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (140, '17','0','VAT rate - standard',1,__ENTITY__);
-- MALI (id country=147)
insert into llx_c_tva(fk_pays,taux,recuperableonly,note,active,entity) values (147, '0','0','VAT rate 0', 1,__ENTITY__);

View file

@ -1135,8 +1135,9 @@ class Thirdparties extends DolibarrApi
$sql = '';
if ($mode === 'customer') {
$sql = "SELECT f.ref, f.type as factype, re.fk_facture_source, re.rowid, re.amount_ht, re.amount_tva, re.amount_ttc, re.description, re.fk_facture, re.fk_facture_line";
$sql .= " FROM ".MAIN_DB_PREFIX."societe_remise_except as re, ".MAIN_DB_PREFIX."facture as f";
$sql .= " WHERE f.rowid = re.fk_facture_source AND re.fk_soc = ".((int) $id);
$sql .= " FROM ".MAIN_DB_PREFIX."societe_remise_except as re";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture as f ON f.rowid = re.fk_facture_source";
$sql .= " WHERE re.fk_soc = ".((int) $id);
if ($filter == "available") {
$sql .= " AND re.fk_facture IS NULL AND re.fk_facture_line IS NULL";
}
@ -1145,7 +1146,8 @@ class Thirdparties extends DolibarrApi
}
} elseif ($mode === 'supplier') {
$sql = "SELECT f.ref, f.type as factype, re.fk_invoice_supplier_source, re.rowid, re.amount_ht, re.amount_tva, re.amount_ttc, re.description, re.fk_invoice_supplier, re.fk_invoice_supplier_line";
$sql .= " FROM ".MAIN_DB_PREFIX."societe_remise_except as re, ".MAIN_DB_PREFIX."facture_fourn as f";
$sql .= " FROM ".MAIN_DB_PREFIX."societe_remise_except as re";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture_fourn as f ON f.rowid = re.fk_invoice_supplier_source";
$sql .= " WHERE f.rowid = re.fk_invoice_supplier_source AND re.fk_soc = ".((int) $id);
if ($filter == "available") {
$sql .= " AND re.fk_invoice_supplier IS NULL AND re.fk_invoice_supplier_line IS NULL";

View file

@ -1506,9 +1506,9 @@ class Societe extends CommonObject
$this->order_min_amount = price2num($this->order_min_amount);
$this->supplier_order_min_amount = price2num($this->supplier_order_min_amount);
$this->tva_assuj = (is_numeric($this->tva_assuj)) ? (int) trim((string) $this->tva_assuj) : 0;
$this->tva_intra = dol_sanitizeFileName($this->tva_intra ?? '', '');
$this->vat_reverse_charge = empty($this->vat_reverse_charge) ? 0 : 1;
$this->tva_assuj = (is_numeric($this->tva_assuj)) ? (int) trim((string) $this->tva_assuj) : 0;
$this->tva_intra = trim($this->tva_intra);
$this->vat_reverse_charge = empty($this->vat_reverse_charge) ? 0 : 1;
if (empty($this->status)) {
$this->status = 0;
}

View file

@ -634,7 +634,7 @@ if (empty($reshook)) {
// Reopen ticket
if ($object->fetch(GETPOSTINT('id'), GETPOST('track_id', 'alpha')) >= 0) {
$new_status = GETPOSTINT('new_status');
//$old_status = $object->status;
$res = $object->setStatut($new_status, null, '', $triggermodname);
if ($res) {
$url = 'card.php?track_id=' . $object->track_id;

View file

@ -1717,7 +1717,7 @@ class Ticket extends CommonObject
$this->status = Ticket::STATUS_READ;
$sql = "UPDATE ".MAIN_DB_PREFIX."ticket";
$sql .= " SET fk_statut = ".Ticket::STATUS_READ.", date_read = '".$this->db->idate(dol_now())."'";
$sql .= " SET fk_statut = ".((int) $this->status) .", date_read = '".$this->db->idate(dol_now())."'";
$sql .= " WHERE rowid = ".((int) $this->id);
dol_syslog(get_class($this)."::markAsRead");
@ -1742,7 +1742,9 @@ class Ticket extends CommonObject
$this->status = $this->oldcopy->status;
$this->db->rollback();
$this->error = implode(',', $this->errors);
dol_syslog(get_class($this)."::markAsRead ".$this->error, LOG_ERR);
return -1;
}
@ -2009,8 +2011,11 @@ class Ticket extends CommonObject
if ($this->status != Ticket::STATUS_CLOSED && $this->status != Ticket::STATUS_CANCELED) { // not closed
$this->db->begin();
$this->oldcopy = dol_clone($this);
$this->status = ($mode ? Ticket::STATUS_CANCELED : Ticket::STATUS_CLOSED);
$sql = "UPDATE ".MAIN_DB_PREFIX."ticket";
$sql .= " SET fk_statut=".($mode ? Ticket::STATUS_CANCELED : Ticket::STATUS_CLOSED).", progress=100, date_close='".$this->db->idate(dol_now())."'";
$sql .= " SET fk_statut = ".((int) $this->status).", progress=100, date_close='".$this->db->idate(dol_now())."'";
$sql .= " WHERE rowid = ".((int) $this->id);
dol_syslog(get_class($this)."::close mode=".$mode);
@ -3068,8 +3073,10 @@ class Ticket extends CommonObject
if ((getDolGlobalInt('TICKET_SET_STATUS_ON_ANSWER', -1) < 0
&& ($object->status < self::STATUS_IN_PROGRESS && !$user->socid && !$private))
|| ($object->status > self::STATUS_IN_PROGRESS && $public_area)) {
// Set status
$object->setStatut($object::STATUS_IN_PROGRESS, null, '', 'TICKET_MODIFY');
} elseif (getDolGlobalInt('TICKET_SET_STATUS_ON_ANSWER', -1) >= 0 && empty($user->socid) && empty($private)) {
// Set status
$object->setStatut(getDolGlobalInt('TICKET_SET_STATUS_ON_ANSWER'), null, '', 'TICKET_MODIFY');
}

View file

@ -298,7 +298,9 @@ if (empty($reshook)) {
$result = $objecttmp->fetch($toselectid);
if ($result > 0) {
if ($objecttmp->status == Ticket::STATUS_CLOSED || $objecttmp->status == Ticket::STATUS_CANCELED) {
// Set status
$result = $objecttmp->setStatut(Ticket::STATUS_ASSIGNED, null, '', 'TICKET_MODIFY');
if ($result < 0) {
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
$error++;