diff --git a/htdocs/admin/system/security.php b/htdocs/admin/system/security.php index b7b322ab5a2..5fd4f8de5de 100644 --- a/htdocs/admin/system/security.php +++ b/htdocs/admin/system/security.php @@ -629,7 +629,7 @@ print '
'; // File extension locked in upload by default print ''.$langs->trans("UploadExtensionRestriction").': '; -print implode(', ', explode(',', getDolGlobalString('MAIN_FILE_EXTENSION_UPLOAD_RESTRICTION'))); +print implode(', ', explode(',', getDolGlobalString('MAIN_FILE_EXTENSION_UPLOAD_RESTRICTION', implode(',', getExecutableContent())))); print '   ('.$langs->trans("Recommended").': '.implode(', ', getExecutableContent()).')'; print '
'; print '
'; diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 46190a1fa56..a4234934cde 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -689,9 +689,11 @@ if (empty($reshook)) { } if (!$error) { - $newremaintopay = $object->getRemainToPay(0); - if ($newremaintopay == 0) { - $object->setPaid($user); + if ($object->status == Facture::STATUS_VALIDATED) { + $newremaintopay = $object->getRemainToPay(0); + if ($newremaintopay == 0) { + $object->setPaid($user); + } } } } diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 1af45d16f31..41c12588368 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1363,6 +1363,9 @@ class Facture extends CommonInvoice } $object->lines[$i]->ref_ext = ''; // Do not clone ref_ext + + // Do not clone accountancy ventilation: a cloned invoice must reappear in "to dispatch" list + $object->lines[$i]->fk_code_ventilation = 0; } // Create clone diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 2804170c994..2c350245277 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -1403,7 +1403,7 @@ class FormFile // Show title of list of existing files $morehtmlright = ''; if (!empty($moreoptions['showhideaddbutton']) && $conf->use_javascript_ajax) { - $tmpurlforbutton = 'javascript:console.log("open add file form");jQuery(".divattachnewfile").toggle(); if (!jQuery(".divattachnewfile").is(":hidden")) { jQuery("input[type=\'file\']").click(); } void(0);'; + $tmpurlforbutton = 'javascript:console.log("open add file form");jQuery(".divattachnewfile").toggle(); if (!jQuery(".divattachnewfile").is(":hidden")) { jQuery(".divattachnewfile input[type=\'file\']").first().click();} void(0);'; // scope file picker click to the just-shown form to avoid triggering native file dialog twice when other input[type=file] exist on the page $morehtmlright .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', $tmpurlforbutton, '', $permtoeditline); } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index d9fb094d38d..9cf2ddabd4e 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -15569,8 +15569,7 @@ function fetchObjectByElement($element_id, $element_type, $element_ref = '', $us //var_dump($element_prop); //var_dump($element_prop['module'].' '.$ismodenabled); if (is_array($element_prop) && (empty($element_prop['module']) || $ismodenabled)) { - if ( - $useCache === 1 + if ($useCache === 1 && $element_id > 0 && !empty($conf->cache['fetchObjectByElement'][$element_type]) && !empty($conf->cache['fetchObjectByElement'][$element_type][$element_id]) && is_object($conf->cache['fetchObjectByElement'][$element_type][$element_id]) diff --git a/htdocs/core/tpl/objectline_title.tpl.php b/htdocs/core/tpl/objectline_title.tpl.php index d92ced82b4e..672ee2162b3 100644 --- a/htdocs/core/tpl/objectline_title.tpl.php +++ b/htdocs/core/tpl/objectline_title.tpl.php @@ -120,7 +120,7 @@ print ''.$langs->trans('PriceUHT').'multicurrency_code && $this->multicurrency_code != $conf->currency) { print ''.$langs->trans('PriceUHT'); - print ' ('.$langs->getCurrencySymbol($this->multicurrency_code).')'; + print ' ('.$langs->getCurrencySymbol($this->multicurrency_code).')'; } // Price TTC / incl tax @@ -222,7 +222,7 @@ print ''.$langs->trans('TotalHTShort').''; // Multicurrency if (isModEnabled("multicurrency") && $this->multicurrency_code && $this->multicurrency_code != $conf->currency) { print ''.$langs->trans('TotalHTShort'); - print ' ('.$langs->getCurrencySymbol($this->multicurrency_code).')'; + print ' ('.$langs->getCurrencySymbol($this->multicurrency_code).')'; } if ($outputalsopricetotalwithtax) { diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index 828f86d63d3..6c8908271db 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -576,7 +576,7 @@ if ($line->special_code == 3) { print $tooltiponpriceend; print ''; if (isModEnabled("multicurrency") && $this->multicurrency_code && $this->multicurrency_code != $conf->currency) { - print ''; + print ''; print $tooltiponpricemultiprice; print price($sign * $line->multicurrency_total_ht); print $tooltiponpriceendmultiprice; diff --git a/htdocs/core/tpl/subtotal_view.tpl.php b/htdocs/core/tpl/subtotal_view.tpl.php index f448a3a570c..e4f16422324 100644 --- a/htdocs/core/tpl/subtotal_view.tpl.php +++ b/htdocs/core/tpl/subtotal_view.tpl.php @@ -166,7 +166,7 @@ if ($line->qty > 0) { ?> ?> multicurrency_code && $this->multicurrency_code != $conf->currency) { ?> - + qty < 0) { // Base colspan if there is no module activated to display line correctly diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 4e6bfb1493e..8eedf2a38ed 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -17,6 +17,7 @@ * Copyright (C) 2024-2026 MDW * Copyright (C) 2024 William Mead * Copyright (C) 2025 NoĆ© Cendrier + * Copyright (C) 2026 Pierre Ardoin * * 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 @@ -1696,30 +1697,30 @@ class CommandeFournisseur extends CommonOrder // This include test on qty if option SUPPLIER_ORDER_WITH_NOPRICEDEFINED is not set $result = $this->addline( - $line->desc, - $line->subprice, - $line->qty, + (string) $line->desc, + (float) $line->subprice, + (float) $line->qty, $line->tva_tx, - $line->localtax1_tx, - $line->localtax2_tx, - $line->fk_product, + (float) $line->localtax1_tx, + (float) $line->localtax2_tx, + (int) $line->fk_product, 0, - $line->ref_supplier ? $line->ref_supplier : $line->ref_fourn, // $line->ref_fourn comes from field ref into table of lines. Value may be a ref that does not exists anymore, so we first try with value of product - $line->remise_percent, + (string) ($line->ref_supplier ? $line->ref_supplier : $line->ref_fourn), // $line->ref_fourn comes from field ref into table of lines. Value may be a ref that does not exists anymore, so we first try with value of product + (float) $line->remise_percent, 'HT', - 0, - $line->product_type, - $line->info_bits, + (float) $line->subprice_ttc, + (int) $line->product_type, + (int) $line->info_bits, 0, $line->date_start, $line->date_end, $line->array_options, $line->fk_unit, - $line->multicurrency_subprice, // pu_ht_devise - $line->origin, // origin - $line->origin_id, // origin_id - $line->rang, // rang - $line->special_code, + (float) $line->multicurrency_subprice, // pu_ht_devise + (string) $line->origin, // origin + (int) $line->origin_id, // origin_id + (int) $line->rang, // rang + (int) $line->special_code, isset($line->label) ? $line->label : '' ); if ($result < 0) { @@ -2196,12 +2197,15 @@ class CommandeFournisseur extends CommonOrder $total_localtax1 = $tabprice[9]; $total_localtax2 = $tabprice[10]; $pu = $pu_ht = $tabprice[3]; + $pu_tva = $tabprice[4]; + $pu_ttc = $tabprice[5]; // MultiCurrency $multicurrency_total_ht = $tabprice[16]; $multicurrency_total_tva = $tabprice[17]; $multicurrency_total_ttc = $tabprice[18]; $pu_ht_devise = $tabprice[19]; + $multicurrency_pu_ttc = $tabprice[21]; $localtax1_type = empty($localtaxes_type[0]) ? '' : $localtaxes_type[0]; $localtax2_type = empty($localtaxes_type[2]) ? '' : $localtaxes_type[2]; @@ -2231,6 +2235,8 @@ class CommandeFournisseur extends CommonOrder $this->line->product_type = $product_type; $this->line->remise_percent = $remise_percent; $this->line->subprice = (float) $pu_ht; + $this->line->subprice_ttc = (float) $pu_ttc; + $this->line->rang = $rang; $this->line->info_bits = $info_bits; @@ -2254,6 +2260,7 @@ class CommandeFournisseur extends CommonOrder $this->line->fk_multicurrency = $this->fk_multicurrency; $this->line->multicurrency_code = $this->multicurrency_code; $this->line->multicurrency_subprice = (float) $pu_ht_devise; + $this->line->multicurrency_subprice_ttc = (float) $multicurrency_pu_ttc; $this->line->multicurrency_total_ht = (float) $multicurrency_total_ht; $this->line->multicurrency_total_tva = (float) $multicurrency_total_tva; $this->line->multicurrency_total_ttc = (float) $multicurrency_total_ttc; @@ -3192,6 +3199,7 @@ class CommandeFournisseur extends CommonOrder $multicurrency_total_tva = $tabprice[17]; $multicurrency_total_ttc = $tabprice[18]; $pu_ht_devise = $tabprice[19]; + $multicurrency_pu_ttc = $tabprice[21]; $localtax1_type = empty($localtaxes_type[0]) ? '' : $localtaxes_type[0]; $localtax2_type = empty($localtaxes_type[2]) ? '' : $localtaxes_type[2]; @@ -3233,6 +3241,7 @@ class CommandeFournisseur extends CommonOrder $this->line->localtax2_type = empty($localtaxes_type[2]) ? '' : $localtaxes_type[2]; $this->line->remise_percent = $remise_percent; $this->line->subprice = (float) $pu_ht; + $this->line->subprice_ttc = (float) $pu_ttc; $this->line->info_bits = $info_bits; $this->line->total_ht = (float) $total_ht; $this->line->total_tva = (float) $total_tva; @@ -3252,11 +3261,13 @@ class CommandeFournisseur extends CommonOrder $this->line->fk_multicurrency = $this->fk_multicurrency; $this->line->multicurrency_code = $this->multicurrency_code; $this->line->multicurrency_subprice = (float) $pu_ht_devise; + $this->line->multicurrency_subprice_ttc = (float) $multicurrency_pu_ttc; $this->line->multicurrency_total_ht = (float) $multicurrency_total_ht; $this->line->multicurrency_total_tva = (float) $multicurrency_total_tva; $this->line->multicurrency_total_ttc = (float) $multicurrency_total_ttc; $this->line->subprice = (float) $pu_ht; + $this->line->subprice_ttc = (float) $pu_ttc; $this->line->price = $this->line->subprice; $this->line->remise_percent = $remise_percent; diff --git a/htdocs/fourn/class/fournisseur.orderline.class.php b/htdocs/fourn/class/fournisseur.orderline.class.php index 0f23543efba..10b3449fd7b 100644 --- a/htdocs/fourn/class/fournisseur.orderline.class.php +++ b/htdocs/fourn/class/fournisseur.orderline.class.php @@ -15,7 +15,8 @@ * Copyright (C) 2022 Gauthier VERDOL * Copyright (C) 2024 Solution Libre SAS * Copyright (C) 2024-2025 MDW - * Copyright (C) 2024 William Mead + * Copyright (C) 2024 William Mead + * Copyright (C) 2026 Pierre Ardoin * * 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 @@ -194,6 +195,7 @@ class CommandeFournisseurLigne extends CommonOrderLine $this->ref_fourn = $objp->ref_supplier; $this->ref_supplier = $objp->ref_supplier; $this->subprice = $objp->subprice; + $this->subprice_ttc = $objp->subprice_ttc; $this->tva_tx = $objp->tva_tx; $this->localtax1_tx = $objp->localtax1_tx; $this->localtax2_tx = $objp->localtax2_tx; @@ -252,6 +254,7 @@ class CommandeFournisseurLigne extends CommonOrderLine $this->extraparams = !empty($objp->extraparams) ? (array) json_decode($objp->extraparams, true) : array(); $this->multicurrency_subprice = $objp->multicurrency_subprice; + $this->multicurrency_subprice_ttc = $objp->multicurrency_subprice_ttc; $this->multicurrency_total_ht = $objp->multicurrency_total_ht; $this->multicurrency_total_tva = $objp->multicurrency_total_tva; $this->multicurrency_total_ttc = $objp->multicurrency_total_ttc; @@ -347,7 +350,7 @@ class CommandeFournisseurLigne extends CommonOrderLine $sql = 'INSERT INTO '.$this->db->prefix().$this->table_element; $sql .= " (fk_commande, label, description, date_start, date_end,"; $sql .= " fk_product, product_type, special_code, rang,"; - $sql .= " qty, vat_src_code, tva_tx, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type, remise_percent, subprice, ref,"; + $sql .= " qty, vat_src_code, tva_tx, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type, remise_percent, subprice, subprice_ttc, ref,"; $sql .= " total_ht, total_tva, total_localtax1, total_localtax2, total_ttc, fk_unit,"; $sql .= " fk_multicurrency, multicurrency_code, multicurrency_subprice, multicurrency_total_ht, multicurrency_total_tva, multicurrency_total_ttc,"; $sql .= " fk_parent_line)"; @@ -369,7 +372,7 @@ class CommandeFournisseurLigne extends CommonOrderLine $sql .= " ".price2num($this->localtax2_tx).","; $sql .= " '".$this->db->escape($this->localtax1_type)."',"; $sql .= " '".$this->db->escape($this->localtax2_type)."',"; - $sql .= " ".((float) $this->remise_percent).", ".price2num($this->subprice, 'MU').", '".$this->db->escape($this->ref_supplier)."',"; + $sql .= " ".((float) $this->remise_percent).", ".price2num($this->subprice, 'MU').", ".price2num($this->subprice_ttc, 'MU').", '".$this->db->escape($this->ref_supplier)."',"; $sql .= " ".price2num($this->total_ht).","; $sql .= " ".price2num($this->total_tva).","; $sql .= " ".price2num($this->total_localtax1).","; diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index 47db473ec3a..8fba4763aaa 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -911,7 +911,7 @@ if ($id && !$user->hasRight('holiday', 'readall') && !in_array($id, $childids)) } else { // Show here line of result $j = 0; - print ''; + print ''; // Action column if ($conf->main_checkbox_left_column) { print '';