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

This commit is contained in:
Laurent Destailleur 2026-01-26 19:19:13 +01:00
commit 360718fa7b
12 changed files with 69 additions and 26 deletions

View file

@ -226,7 +226,7 @@ class AccountancyExport
);
global $hookmanager;
$code = $formatcode[$type];
$code = $formatcode[$type] ?? '';
$parameters = array('type' => $type);
$reshook = $hookmanager->executeHooks('getFormatCode', $parameters, $code);

View file

@ -131,12 +131,14 @@ if (isModEnabled('accounting')) {
print load_fiche_titre($langs->trans("AccountancyArea"), empty($resultboxes['selectboxlist']) ? '' : $resultboxes['selectboxlist'], 'accountancy', 0, '', '', $showtutorial);
/*
if (getDolGlobalInt('INVOICE_USE_SITUATION') == 1) {
$messagewarning = $langs->trans("SorryThisModuleIsNotCompatibleWithTheExperimentalFeatureOfSituationInvoices");
$messagewarning .= ' '.$langs->trans("WarningExperimentalFeatureInvoiceSituationNeedToUpgradeToProgressiveMode", 'https://partners.dolibarr.org');
print info_admin($messagewarning);
print "<br>";
}
*/
if (!$helpisexpanded && empty($resultboxes['boxlista']) && empty($resultboxes['boxlistb'])) {
print '<div class="opacitymedium idfaq2"><br>'.$langs->trans("ClickOnUseTutorialForHelp", $langs->transnoentities("ShowTutorial"))."</div>\n";

View file

@ -309,16 +309,19 @@ if ($modecompta == 'BOOKKEEPING') {
if ($showaccountdetail == 'no') {
$sql .= ", f.thirdparty_code as name";
}
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as f";
$sql .= ", ".MAIN_DB_PREFIX."accounting_account as aa";
$sql .= " WHERE f.numero_compte = aa.account_number";
$sql .= " FROM ".$db->prefix()."accounting_bookkeeping as f";
$sql .= " INNER JOIN ".$db->prefix()."accounting_account as aa";
$sql .= " ON aa.account_number = f.numero_compte";
$sql .= " AND aa.entity = f.entity"; // Security prevents duplicate.
$sql .= " WHERE 1=1";
$sql .= " AND ".$predefinedgroupwhere;
$sql .= " AND fk_pcg_version = '".$db->escape($charofaccountstring)."'";
$sql .= " AND aa.fk_pcg_version = '".$db->escape($charofaccountstring)."'";
$sql .= " AND f.entity = ".$conf->entity;
if (!empty($date_start) && !empty($date_end)) {
$sql .= " AND f.doc_date >= '".$db->idate($date_start)."' AND f.doc_date <= '".$db->idate($date_end)."'";
$sql .= " AND f.doc_date >= '".$db->idate($date_start)."'";
$sql .= " AND f.doc_date <= '".$db->idate($date_end)."'";
}
$sql .= " GROUP BY pcg_type";
$sql .= " GROUP BY aa.pcg_type";
if ($showaccountdetail == 'no') {
$sql .= ", name, socid"; // group by "accounting group" (INCOME/EXPENSE), then "customer".
}

View file

@ -3,6 +3,7 @@
* Copyright (C) 2016 Christophe Battarel <christophe@altairis.fr>
* Copyright (C) 2019-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2025 Benjamin Falière <benjamin@faliere.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -274,7 +275,7 @@ function llxHeaderTicket($title, $head = "", $disablejs = 0, $disablehead = 0, $
print '</div>';
}
if (getDolGlobalInt('TICKET_IMAGE_PUBLIC_INTERFACE')) {
if (getDolGlobalString('TICKET_IMAGE_PUBLIC_INTERFACE')) {
print '<div class="backimagepublicticket">';
print '<img id="idTICKET_IMAGE_PUBLIC_INTERFACE" src="'.getDolGlobalString('TICKET_IMAGE_PUBLIC_INTERFACE').'">';
print '</div>';

View file

@ -151,7 +151,7 @@ class doc_generic_contract_odt extends ModelePDFContract
$texte .= getDolGlobalString('CONTRACT_ADDON_PDF_ODT_PATH');
$texte .= '</textarea>';
$texte .= '</div><div style="display: inline-block; vertical-align: middle;">';
$texte .= '<input type="submit" class="button reposition smallpaddingimp" value="'.dol_escape_htmltag($langs->trans("Upload")).'" name="upload">';
$texte .= '<input type="submit" class="button reposition smallpaddingimp" name="modify" value="'.dol_escape_htmltag($langs->trans("Modify")).'">';
$texte .= '<br></div></div>';
// Scan directories
@ -159,7 +159,7 @@ class doc_generic_contract_odt extends ModelePDFContract
if (getDolGlobalString('CONTRACT_ADDON_PDF_ODT_PATH')) {
$texte .= $langs->trans("NumberOfModelFilesFound").': <b>';
//$texte.=$nbofiles?'<a id="a_'.get_class($this).'" href="#">':'';
$texte .= count($listoffiles);
$texte .= $nbofiles;
//$texte.=$nbofiles?'</a>':'';
$texte .= '</b>';
}

View file

@ -604,7 +604,8 @@ class modProduct extends DolibarrModules
'p.recuperableonly' => '^[0|1]$',
);
if (isModEnabled('stock')) {//if Stock module enabled
// Complete if Stock module enabled
if (isModEnabled('stock')) {
$this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array(
'p.fk_default_warehouse' => 'DefaultWarehouse',
'p.tobatch' => 'ManageLotSerial',
@ -931,7 +932,11 @@ class modProduct extends DolibarrModules
// End add extra fields
$this->import_fieldshidden_array[$r] = array('extra.fk_object' => 'lastrowid-'.MAIN_DB_PREFIX.'product_price'); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent)
$this->import_regex_array[$r] = array('pr.datec' => '^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$', 'pr.recuperableonly' => '^[0|1]$');
$this->import_regex_array[$r] = array(
'pr.datec' => '^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$',
'pr.recuperableonly' => '^[0|1]$'
);
$this->import_convertvalue_array[$r] = array(
'pr.fk_product' => array('rule' => 'fetchidfromref', 'classfile' => '/product/class/product.class.php', 'class' => 'Product', 'method' => 'fetch', 'element' => 'Product')
);

View file

@ -317,7 +317,7 @@ if (empty($reshook)) {
}
if ($objecttmp->id > 0) {
$res = $objecttmp->add_object_linked($objecttmp->origin, $id_sending);
$res = $objecttmp->add_object_linked($objecttmp->origin_type, $id_sending);
if ($res == 0) {
$errors[] = $expd->ref.' : '.$langs->trans($objecttmp->errors[0]);

View file

@ -844,7 +844,7 @@ IMG;
// using windows libreoffice that must be in path
// using linux/mac libreoffice that must be in path
// Note PHP Config "fastcgi.impersonate=0" must set to 0 - Default is 1
$command ='soffice --headless -env:UserInstallation=file:'.(getDolGlobalString('MAIN_ODT_ADD_SLASH_FOR_WINDOWS') ? '///' : '').'\''.$conf->user->dir_temp.'/odtaspdf\' --convert-to pdf --outdir '. escapeshellarg(dirname($name)). " ".escapeshellarg($name);
$command ='soffice --headless -env:UserInstallation=file:'.escapeshellarg((getDolGlobalString('MAIN_ODT_ADD_SLASH_FOR_WINDOWS') ? '///' : '').dol_sanitizePathName($conf->user->dir_temp).'/odtaspdf').' --convert-to pdf --outdir '. escapeshellarg(dirname($name)). " ".escapeshellarg($name);
} elseif (preg_match('/unoconv/', getDolGlobalString('MAIN_ODT_AS_PDF'))) {
// If issue with unoconv, see https://github.com/dagwieers/unoconv/issues/87
@ -870,17 +870,19 @@ IMG;
// - set shell of user to bash instead of nologin.
// - set permission to read/write to user on home directory /var/www so user can create the libreoffice , dconf and .cache dir and files then set permission back
$command = getDolGlobalString('MAIN_ODT_AS_PDF').' '.escapeshellcmd($name);
$command = getDolGlobalString('MAIN_ODT_AS_PDF').' '.escapeshellarg($name);
//$command = '/usr/bin/unoconv -vvv '.escapeshellcmd($name);
} else {
// deprecated old method using odt2pdf.sh (native, jodconverter, ...)
$tmpname=preg_replace('/\.odt/i', '', $name);
if (getDolGlobalString('MAIN_DOL_SCRIPTS_ROOT')) {
$command = getDolGlobalString('MAIN_DOL_SCRIPTS_ROOT').'/scripts/odt2pdf/odt2pdf.sh '.escapeshellcmd($tmpname).' '.(is_numeric(getDolGlobalString('MAIN_ODT_AS_PDF'))?'jodconverter':getDolGlobalString('MAIN_ODT_AS_PDF'));
$command = dol_sanitizePathName(getDolGlobalString('MAIN_DOL_SCRIPTS_ROOT')).'/scripts/odt2pdf/odt2pdf.sh '.escapeshellarg($tmpname).' '.escapeshellarg(is_numeric(getDolGlobalString('MAIN_ODT_AS_PDF')) ? 'jodconverter' : getDolGlobalString('MAIN_ODT_AS_PDF'));
} else {
dol_syslog(get_class($this).'::exportAsAttachedPDF is used but the constant MAIN_DOL_SCRIPTS_ROOT with path to script directory was not defined.', LOG_WARNING);
$command = '../../scripts/odt2pdf/odt2pdf.sh '.escapeshellcmd($tmpname).' '.(is_numeric(getDolGlobalString('MAIN_ODT_AS_PDF'))?'jodconverter':getDolGlobalString('MAIN_ODT_AS_PDF'));
$paramodt2pdf = (is_numeric(getDolGlobalString('MAIN_ODT_AS_PDF')) ? 'jodconverter' : getDolGlobalString('MAIN_ODT_AS_PDF'));
$paramodt2pdf = dol_sanitizePathName($paramodt2pdf);
$command = '../../scripts/odt2pdf/odt2pdf.sh '.escapeshellarg($tmpname).' '.escapeshellarg($paramodt2pdf);
}
}
@ -888,6 +890,7 @@ IMG;
//$command = DOL_DOCUMENT_ROOT.'/includes/odtphp/odt2pdf.sh '.$name.' '.$dirname;
dol_syslog(get_class($this).'::exportAsAttachedPDF $execmethod='.$execmethod.' Run command='.$command, LOG_DEBUG);
// TODO Use:
// $outputfile = DOL_DATA_ROOT.'/odt2pdf.log';
// $result = $utils->executeCLI($command, $outputfile); and replace test on $execmethod.
@ -895,17 +898,17 @@ IMG;
// $errorstring will be $result['output']
$retval=0; $output_arr=array();
if ($execmethod == 1) {
exec($command, $output_arr, $retval);
exec(escapeshellcmd($command), $output_arr, $retval);
}
if ($execmethod == 2) {
$outputfile = DOL_DATA_ROOT.'/odt2pdf.log';
$ok=0;
$handle = fopen($outputfile, 'w');
if ($handle) {
dol_syslog(get_class($this)."Run command ".$command, LOG_DEBUG);
dol_syslog(get_class($this)."escapeshellcmd(command) = ".escapeshellcmd($command), LOG_DEBUG);
fwrite($handle, $command."\n");
$handlein = popen($command, 'r');
$handlein = popen(escapeshellcmd($command), 'r');
while (!feof($handlein)) {
$read = fgets($handlein);
fwrite($handle, $read);
@ -948,7 +951,7 @@ IMG;
foreach ($output_arr as $line) {
$errorstring.= $line."<br>";
}
throw new OdfException('ODT to PDF convert fail (option MAIN_ODT_AS_PDF is '.$conf->global->MAIN_ODT_AS_PDF.', command was '.$command.', retval='.$retval.') : ' . $errorstring);
throw new OdfException('ODT to PDF convert fail (option MAIN_ODT_AS_PDF is '.getDolGlobalString('MAIN_ODT_AS_PDF').', command was '.$command.', retval='.$retval.') : ' . $errorstring);
}
}
}

View file

@ -129,11 +129,13 @@ if (getDolGlobalString('MAIN_MOTD')) {
*/
// Specific warning to propose to upgrade invoice situation to progressive mode
if (getDolGlobalInt('INVOICE_USE_SITUATION') == 1 && (float) DOL_VERSION >= 22.0) { // @phpstan-ignore-line
/*
if (getDolGlobalInt('INVOICE_USE_SITUATION') == 1) {
$langs->loadLangs(array("admin"));
print info_admin($langs->trans("WarningExperimentalFeatureInvoiceSituationNeedToUpgradeToProgressiveMode", 'https://partners.dolibarr.org'));
//print "<br>";
}
*/
/*
* Show security warnings

View file

@ -542,6 +542,7 @@ class MouvementStock extends CommonObject
// Test if there is already a record for couple (warehouse / product), so later we will make an update or create.
$alreadyarecord = 0;
$fk_product_stock = 0;
if (!$error) {
$sql = "SELECT rowid, reel FROM ".$this->db->prefix()."product_stock";
$sql .= " WHERE fk_entrepot = ".((int) $entrepot_id)." AND fk_product = ".((int) $fk_product); // This is a unique key

View file

@ -13,6 +13,7 @@
* Copyright (C) 2018 Quentin Vial-Gouteyron <quentin.vial-gouteyron@atm-consulting.fr>
* Copyright (C) 2022-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2026 Mathieu Moulin <mathieu@iprospective.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

View file

@ -107,6 +107,9 @@ $MAXPRODUCT = (!getDolGlobalString('TAKEPOS_NB_MAXPRODUCT') ? $maxproductbydefau
$term = empty($_SESSION['takeposterminal']) ? 1 : $_SESSION['takeposterminal'];
$socid = getDolGlobalInt('CASHDESK_ID_THIRDPARTY' . $term);
/*
$constforcompanyid = 'CASHDESK_ID_THIRDPARTY'.$_SESSION["takeposterminal"];
$soc = new Societe($db);
@ -359,8 +362,15 @@ function LoadProducts(position, issubcat) {
if (maxproduct >= 1) {
limit = maxproduct - 1;
}
// Get socid
let socid = jQuery('#thirdpartyid').val();
if ((socid === undefined || socid === "") && parseInt("<?php echo dol_escape_js($socid) ?>") > 0) {
socid = parseInt("<?php echo dol_escape_js($socid); ?>");
}
// Only show products for sale (tosell=1)
$.getJSON('<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=getProducts&token=<?php echo newToken();?>&thirdpartyid=' + jQuery('#thirdpartyid').val() + '&category='+currentcat+'&tosell=1&limit='+limit+'&offset=0', function(data) {
$.getJSON('<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=getProducts&token=<?php echo newToken();?>&thirdpartyid=' + socid + '&category='+currentcat+'&tosell=1&limit='+limit+'&offset=0', function(data) {
console.log("Call ajax.php (in LoadProducts) to get Products of category "+currentcat+" then loop on result to fill image thumbs");
console.log(data);
@ -479,10 +489,18 @@ function MoreProducts(moreorless) {
if (maxproduct >= 1) {
limit = maxproduct-1;
}
var nb_cat_shown = $('.div5 div.wrapper2[data-iscat=1]').length;
var offset = <?php echo($MAXPRODUCT - 2); ?> * pageproducts - nb_cat_shown;
var offset = <?php echo ($MAXPRODUCT - 2); ?> * pageproducts - nb_cat_shown;
// Get socid
let socid = jQuery('#thirdpartyid').val();
if ((socid === undefined || socid === "") && parseInt("<?php echo dol_escape_js($socid) ?>") > 0) {
socid = parseInt("<?php echo dol_escape_js($socid); ?>");
}
// Only show products for sale (tosell=1)
$.getJSON('<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=getProducts&token=<?php echo newToken();?>&thirdpartyid=' + jQuery('#thirdpartyid').val() + '&category='+currentcat+'&tosell=1&limit='+limit+'&offset='+offset, function(data) {
$.getJSON('<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=getProducts&token=<?php echo newToken();?>&thirdpartyid=' + socid + '&category='+currentcat+'&tosell=1&limit='+limit+'&offset='+offset, function(data) {
console.log("Call ajax.php (in MoreProducts) to get Products of category "+currentcat);
if (typeof (data[0]) == "undefined" && moreorless=="more"){ // Return if no more pages
@ -749,7 +767,14 @@ function Search2(keyCodeForEnter, moreorless) {
pageproducts = 0;
jQuery(".wrapper2 .catwatermark").hide();
var nbsearchresults = 0;
$.getJSON('<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=search&token=<?php echo newToken();?>&term=' + search_term + '&thirdpartyid=' + jQuery('#thirdpartyid').val() + '&search_start=' + search_start + '&search_limit=' + search_limit, function (data) {
// Only show products for sale (tosell=1)
let socid = jQuery('#thirdpartyid').val();
if ((socid === undefined || socid === "") && parseInt("<?php echo dol_escape_js($socid) ?>") > 0) {
socid = parseInt("<?php echo dol_escape_js($socid); ?>");
}
$.getJSON('<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=search&token=<?php echo newToken();?>&term=' + search_term + '&thirdpartyid=' + socid + '&search_start=' + search_start + '&search_limit=' + search_limit, function (data) {
for (i = 0; i < <?php echo $MAXPRODUCT ?>; i++) {
if (typeof (data[i]) == "undefined") {
$("#prowatermark" + i).html("");