diff --git a/htdocs/core/ajax/ajaxdirpreview.php b/htdocs/core/ajax/ajaxdirpreview.php index 6a826b5a126..4270065266f 100644 --- a/htdocs/core/ajax/ajaxdirpreview.php +++ b/htdocs/core/ajax/ajaxdirpreview.php @@ -6,7 +6,8 @@ * Copyright (C) 2010 Pierre Morin * Copyright (C) 2013 Marcos García * Copyright (C) 2024 MDW - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 Frédéric France + * Copyright (C) 2025 Joachim Kueter * * 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 @@ -240,7 +241,11 @@ if ($type == 'directory') { $parameters = array('modulepart' => $module); $reshook = $hookmanager->executeHooks('addSectionECMAuto', $parameters); if ($reshook > 0 && is_array($hookmanager->resArray) && count($hookmanager->resArray) > 0) { - $automodules[] = $hookmanager->resArray['module']; + if (is_array($hookmanager->resArray['module'])) { + $automodules = array_merge($automodules, $hookmanager->resArray['module']); + } else { + $automodules[] = $hookmanager->resArray['module']; + } } // TODO change for multicompany sharing diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 0db953ae342..48afd79db8c 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -8143,9 +8143,9 @@ abstract class CommonObject if (strpos($InfoFieldList[4], 'extra') !== false) { $sql .= ' as main, ' . $this->db->sanitize($this->db->prefix() . $InfoFieldList[0]) . '_extrafields as extra'; $sqlwhere .= " WHERE extra.fk_object = main." . $this->db->sanitize($InfoFieldList[2]); - $sqlwhere .= " AND " . $InfoFieldList[4]; + $sqlwhere .= " AND " . forgeSQLFromUniversalSearchCriteria($InfoFieldList[4], $errstr, 1); } else { - $sqlwhere .= " WHERE " . $InfoFieldList[4]; + $sqlwhere .= " WHERE " . forgeSQLFromUniversalSearchCriteria($InfoFieldList[4], $errstr, 1); } } else { $sqlwhere .= ' WHERE 1=1'; diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index e629e0c34ed..61854a1b697 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -1753,24 +1753,31 @@ class pdf_sponge extends ModelePDFFactures if ($line->total_ht < 0) { $total_line_remise += -$line->total_ht; } + $usemc = (isModEnabled("multicurrency") && $object->multicurrency_tx != 1); + $total_line_remise_print = $total_line_remise; + if ($usemc) { + $ratio = (!empty($object->total_ht) ? (float) $object->multicurrency_total_ht / (float) $object->total_ht : 0); + if (!empty($ratio)) $total_line_remise_print = price2num($total_line_remise * $ratio, 'MT'); + } } if ($total_line_remise > 0) { - $pdf->SetFillColor(255, 255, 255); - $pdf->SetXY($col1x, $tab2_top + $tab2_hl); - $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalDiscount").(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transnoentities("TotalDiscount") : ''), 0, 'L', 1); - $pdf->SetXY($col2x, $tab2_top + $tab2_hl); - $pdf->MultiCell($largcol2, $tab2_hl, price($total_line_remise, 0, $outputlangs), 0, 'R', 1); - - $index++; - + if (!getDolGlobalString('MAIN_HIDE_AMOUNT_DISCOUNT')) { + $pdf->SetFillColor(255, 255, 255); + $pdf->SetXY($col1x, $tab2_top + $tab2_hl); + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalDiscount").(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transnoentities("TotalDiscount") : ''), 0, 'L', 1); + $pdf->SetXY($col2x, $tab2_top + $tab2_hl); + $pdf->MultiCell($largcol2, $tab2_hl, price($total_line_remise_print, 0, $outputlangs), 0, 'R', 1); + $index++; + } // Show total NET before discount - $pdf->SetFillColor(255, 255, 255); - $pdf->SetXY($col1x, $tab2_top); - $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalHTBeforeDiscount").(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transnoentities("TotalHTBeforeDiscount") : ''), 0, 'L', 1); - $pdf->SetXY($col2x, $tab2_top); - $pdf->MultiCell($largcol2, $tab2_hl, price($total_line_remise + $total_ht, 0, $outputlangs), 0, 'R', 1); - - $index++; + if (!getDolGlobalString('MAIN_HIDE_AMOUNT_BEFORE_DISCOUNT')) { + $pdf->SetFillColor(255, 255, 255); + $pdf->SetXY($col1x, $tab2_top); + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalHTBeforeDiscount").(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transnoentities("TotalHTBeforeDiscount") : ''), 0, 'L', 1); + $pdf->SetXY($col2x, $tab2_top); + $pdf->MultiCell($largcol2, $tab2_hl, price($total_line_remise_print + $total_ht, 0, $outputlangs), 0, 'R', 1); + $index++; + } } // Total HT diff --git a/htdocs/ecm/index_auto.php b/htdocs/ecm/index_auto.php index b7b30ba4d1e..cd624116884 100644 --- a/htdocs/ecm/index_auto.php +++ b/htdocs/ecm/index_auto.php @@ -2,8 +2,9 @@ /* Copyright (C) 2008-2014 Laurent Destailleur * Copyright (C) 2008-2010 Regis Houssin * Copyright (C) 2016 Alexandre Spangaro - * Copyright (C) 2024 MDW - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW + * Copyright (C) 2025 Joachim Kueter * * 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 @@ -412,8 +413,14 @@ if (!getDolGlobalString('ECM_AUTO_TREE_HIDEN')) { $parameters = array(); $reshook = $hookmanager->executeHooks('addSectionECMAuto', $parameters); if ($reshook > 0 && is_array($hookmanager->resArray) && count($hookmanager->resArray) > 0) { - $sectionauto[] = $hookmanager->resArray; - $rowspan += count($hookmanager->resArray); + $res = $hookmanager->resArray[0]; + if (is_array($hookmanager->resArray[0])) { + $sectionauto = array_merge($sectionauto, $hookmanager->resArray); + $rowspan += count($hookmanager->resArray); + } else { + $sectionauto[] = $hookmanager->resArray; + $rowspan++; + } } } diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index 316ce045fa9..17708778c3b 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -227,7 +227,7 @@ if (empty($reshook)) { } } - $formquestion[$i++] = array('type' => 'hidden', 'name' => $key, 'value' => GETPOSTINT($key)); + $formquestion[$i++] = array('type' => 'hidden', 'name' => $key, 'value' => GETPOSTFLOAT($key)); } }