diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php
index 9a48d06df40..ab0c39f301b 100644
--- a/htdocs/accountancy/class/accountancyexport.class.php
+++ b/htdocs/accountancy/class/accountancyexport.class.php
@@ -226,7 +226,7 @@ class AccountancyExport
);
global $hookmanager;
- $code = $formatcode[$type];
+ $code = $formatcode[$type] ?? '';
$parameters = array('type' => $type);
$reshook = $hookmanager->executeHooks('getFormatCode', $parameters, $code);
diff --git a/htdocs/accountancy/index.php b/htdocs/accountancy/index.php
index 6206bdd5032..a7e6a5c0338 100644
--- a/htdocs/accountancy/index.php
+++ b/htdocs/accountancy/index.php
@@ -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 "
";
}
+ */
if (!$helpisexpanded && empty($resultboxes['boxlista']) && empty($resultboxes['boxlistb'])) {
print '
'.$langs->trans("ClickOnUseTutorialForHelp", $langs->transnoentities("ShowTutorial"))."
\n";
diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php
index 68a1e921bf9..25272deb1e6 100644
--- a/htdocs/compta/resultat/clientfourn.php
+++ b/htdocs/compta/resultat/clientfourn.php
@@ -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".
}
diff --git a/htdocs/core/lib/ticket.lib.php b/htdocs/core/lib/ticket.lib.php
index 2ed7811961e..7a5f4cd3c32 100644
--- a/htdocs/core/lib/ticket.lib.php
+++ b/htdocs/core/lib/ticket.lib.php
@@ -3,6 +3,7 @@
* Copyright (C) 2016 Christophe Battarel
* Copyright (C) 2019-2024 Frédéric France
* Copyright (C) 2024 MDW
+ * Copyright (C) 2025 Benjamin Falière
*
* 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 '';
}
- if (getDolGlobalInt('TICKET_IMAGE_PUBLIC_INTERFACE')) {
+ if (getDolGlobalString('TICKET_IMAGE_PUBLIC_INTERFACE')) {
print '';
print '
.')
';
print '
';
diff --git a/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php b/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php
index 27a295e61e4..d344a938ed9 100644
--- a/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php
+++ b/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php
@@ -151,7 +151,7 @@ class doc_generic_contract_odt extends ModelePDFContract
$texte .= getDolGlobalString('CONTRACT_ADDON_PDF_ODT_PATH');
$texte .= '';
$texte .= '';
- $texte .= '';
+ $texte .= '';
$texte .= '
';
// Scan directories
@@ -159,7 +159,7 @@ class doc_generic_contract_odt extends ModelePDFContract
if (getDolGlobalString('CONTRACT_ADDON_PDF_ODT_PATH')) {
$texte .= $langs->trans("NumberOfModelFilesFound").': ';
//$texte.=$nbofiles?'':'';
- $texte .= count($listoffiles);
+ $texte .= $nbofiles;
//$texte.=$nbofiles?'':'';
$texte .= '';
}
diff --git a/htdocs/core/modules/modProduct.class.php b/htdocs/core/modules/modProduct.class.php
index 51dc37ad767..48f3c49d104 100644
--- a/htdocs/core/modules/modProduct.class.php
+++ b/htdocs/core/modules/modProduct.class.php
@@ -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')
);
diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php
index d6bd0df20bb..ad28811adeb 100644
--- a/htdocs/expedition/list.php
+++ b/htdocs/expedition/list.php
@@ -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]);
diff --git a/htdocs/includes/odtphp/odf.php b/htdocs/includes/odtphp/odf.php
index d45f99395ca..aa19feac431 100644
--- a/htdocs/includes/odtphp/odf.php
+++ b/htdocs/includes/odtphp/odf.php
@@ -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."
";
}
- 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);
}
}
}
diff --git a/htdocs/index.php b/htdocs/index.php
index c09d8484342..3ba840ba7e0 100644
--- a/htdocs/index.php
+++ b/htdocs/index.php
@@ -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 "
";
}
+*/
/*
* Show security warnings
diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php
index 45668188f93..adc9af41781 100644
--- a/htdocs/product/stock/class/mouvementstock.class.php
+++ b/htdocs/product/stock/class/mouvementstock.class.php
@@ -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
diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php
index 235cfa1b08d..9e971b86c6f 100644
--- a/htdocs/reception/class/reception.class.php
+++ b/htdocs/reception/class/reception.class.php
@@ -13,6 +13,7 @@
* Copyright (C) 2018 Quentin Vial-Gouteyron
* Copyright (C) 2022-2024 Frédéric France
* Copyright (C) 2024 MDW
+ * Copyright (C) 2026 Mathieu Moulin
*
* 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
diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php
index 828059e3633..fd9bc1416a3 100644
--- a/htdocs/takepos/index.php
+++ b/htdocs/takepos/index.php
@@ -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("") > 0) {
+ socid = parseInt("");
+ }
+
// Only show products for sale (tosell=1)
- $.getJSON('/takepos/ajax/ajax.php?action=getProducts&token=&thirdpartyid=' + jQuery('#thirdpartyid').val() + '&category='+currentcat+'&tosell=1&limit='+limit+'&offset=0', function(data) {
+ $.getJSON('/takepos/ajax/ajax.php?action=getProducts&token=&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 = * pageproducts - nb_cat_shown;
+ var offset = * pageproducts - nb_cat_shown;
+
+ // Get socid
+ let socid = jQuery('#thirdpartyid').val();
+ if ((socid === undefined || socid === "") && parseInt("") > 0) {
+ socid = parseInt("");
+ }
+
// Only show products for sale (tosell=1)
- $.getJSON('/takepos/ajax/ajax.php?action=getProducts&token=&thirdpartyid=' + jQuery('#thirdpartyid').val() + '&category='+currentcat+'&tosell=1&limit='+limit+'&offset='+offset, function(data) {
+ $.getJSON('/takepos/ajax/ajax.php?action=getProducts&token=&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('/takepos/ajax/ajax.php?action=search&token=&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("") > 0) {
+ socid = parseInt("");
+ }
+
+ $.getJSON('/takepos/ajax/ajax.php?action=search&token=&term=' + search_term + '&thirdpartyid=' + socid + '&search_start=' + search_start + '&search_limit=' + search_limit, function (data) {
for (i = 0; i < ; i++) {
if (typeof (data[i]) == "undefined") {
$("#prowatermark" + i).html("");