From f40ab59b37df0a312a58608854fc654dc70ca042 Mon Sep 17 00:00:00 2001 From: GregM Date: Tue, 19 Jul 2022 16:08:38 +0200 Subject: [PATCH 01/12] FIX contacts disabled are not returned on create invoice --- htdocs/contact/class/contact.class.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index bb3f2ae035d..ce74f82b412 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -1776,10 +1776,13 @@ class Contact extends CommonObject $sql = "SELECT sc.fk_socpeople as id, sc.fk_c_type_contact"; $sql .= " FROM ".MAIN_DB_PREFIX."c_type_contact tc"; $sql .= ", ".MAIN_DB_PREFIX."societe_contacts sc"; + $sql .= " INNER JOIN ".MAIN_DB_PREFIX."socpeople sp"; + $sql .= " ON sc.fk_socpeople = sp.rowid"; $sql .= " WHERE sc.fk_soc =".((int) $this->socid); $sql .= " AND sc.fk_c_type_contact=tc.rowid"; $sql .= " AND tc.element = '".$this->db->escape($element)."'"; $sql .= " AND tc.active = 1"; + $sql .= " AND sp.statut = 1"; dol_syslog(__METHOD__, LOG_DEBUG); $resql = $this->db->query($sql); From 8cc9d72b37a534b5d90556ba9cb1a1f846c3b18c Mon Sep 17 00:00:00 2001 From: GregM Date: Tue, 30 Aug 2022 16:53:14 +0200 Subject: [PATCH 02/12] update sql --- htdocs/contact/class/contact.class.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index ce74f82b412..3ae7e7d8645 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -1777,12 +1777,11 @@ class Contact extends CommonObject $sql .= " FROM ".MAIN_DB_PREFIX."c_type_contact tc"; $sql .= ", ".MAIN_DB_PREFIX."societe_contacts sc"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."socpeople sp"; - $sql .= " ON sc.fk_socpeople = sp.rowid"; + $sql .= " ON sc.fk_socpeople = sp.rowid AND sp.statut = 1"; $sql .= " WHERE sc.fk_soc =".((int) $this->socid); $sql .= " AND sc.fk_c_type_contact=tc.rowid"; $sql .= " AND tc.element = '".$this->db->escape($element)."'"; $sql .= " AND tc.active = 1"; - $sql .= " AND sp.statut = 1"; dol_syslog(__METHOD__, LOG_DEBUG); $resql = $this->db->query($sql); From 7c352c9cefe8e241c0dd862d9c148dff11519b33 Mon Sep 17 00:00:00 2001 From: atm-lena Date: Fri, 9 Dec 2022 17:00:11 +0100 Subject: [PATCH 03/12] BOM : calculate total cost of lines --- htdocs/bom/class/bom.class.php | 3 ++- htdocs/bom/tpl/objectline_view.tpl.php | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index 0e57bebd922..4dfb47a3887 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -1073,7 +1073,8 @@ class BOM extends CommonObject if ($res>0) { $bom_child->calculateCosts(); $line->childBom[] = $bom_child; - $this->total_cost += $bom_child->total_cost * $line->qty; + $line->total_cost = price2num( $bom_child->total_cost * $line->qty, 'MT'); + $this->total_cost += $line->total_cost; } else { $this->error = $bom_child->error; return -2; diff --git a/htdocs/bom/tpl/objectline_view.tpl.php b/htdocs/bom/tpl/objectline_view.tpl.php index 61b394a3b0f..3897b875652 100644 --- a/htdocs/bom/tpl/objectline_view.tpl.php +++ b/htdocs/bom/tpl/objectline_view.tpl.php @@ -239,13 +239,13 @@ if ($resql) { // Cost if (!empty($sub_bom->id)) { $sub_bom->calculateCosts(); - print ''.price($sub_bom->total_cost * $sub_bom_line->qty * $line->qty).''; + print ''.price2num($sub_bom->total_cost * $sub_bom_line->qty * $line->qty, 'MT').''; $total_cost+= $sub_bom->total_cost * $sub_bom_line->qty * $line->qty; } elseif ($sub_bom_product->cost_price > 0) { - print ''.price($sub_bom_product->cost_price * $sub_bom_line->qty * $line->qty).''; + print ''.price2num($sub_bom_product->cost_price * $sub_bom_line->qty * $line->qty, 'MT').''; $total_cost+= $sub_bom_product->cost_price * $sub_bom_line->qty * $line->qty; } elseif ($sub_bom_product->pmp > 0) { // PMP if cost price isn't defined - print ''.price($sub_bom_product->pmp * $sub_bom_line->qty * $line->qty).''; + print ''.price2num($sub_bom_product->pmp * $sub_bom_line->qty * $line->qty, 'MT').''; $total_cost.= $sub_bom_product->pmp * $sub_bom_line->qty * $line->qty; } else { // Minimum purchase price if cost price and PMP aren't defined $sql_supplier_price = 'SELECT MIN(price) AS min_price, quantity AS qty FROM '.MAIN_DB_PREFIX.'product_fournisseur_price'; @@ -255,7 +255,7 @@ if ($resql) { $obj = $object->db->fetch_object($resql_supplier_price); $line_cost = $obj->min_price/$obj->qty * $sub_bom_line->qty * $line->qty; - print ''.price($line_cost).''; + print ''.price2num($line_cost, 'MT').''; $total_cost+= $line_cost; } } From 92bff0fcfbbba88af2b422d4cefa6b4c3d38cd8f Mon Sep 17 00:00:00 2001 From: atm-lena Date: Mon, 12 Dec 2022 11:41:54 +0100 Subject: [PATCH 04/12] Missing Unit TD for sub-bom lines --- htdocs/bom/tpl/objectline_view.tpl.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/bom/tpl/objectline_view.tpl.php b/htdocs/bom/tpl/objectline_view.tpl.php index 3897b875652..bb83e62c07f 100644 --- a/htdocs/bom/tpl/objectline_view.tpl.php +++ b/htdocs/bom/tpl/objectline_view.tpl.php @@ -218,11 +218,16 @@ if ($resql) { } // Qty + $label = $sub_bom_product->getLabelOfUnit('long'); if ($sub_bom_line->qty_frozen > 0) { print ''.price($sub_bom_line->qty, 0, '', 0, 0).''; + print ''.($label !== '') ? $langs->trans($label) : '' . ''; print ''.$langs->trans('Yes').''; } else { print ''.price($sub_bom_line->qty * $line->qty, 0, '', 0, 0).''; + print ''; + print ''.($label !== '') ? $langs->trans($label) : '' . ''; + print ''; print ' '; } From b597a43b21a7488bd271f05d99da65539a3f0d96 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 14 Dec 2022 08:37:30 +0000 Subject: [PATCH 05/12] Fixing style errors. --- htdocs/bom/class/bom.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index 4dfb47a3887..7f9a1aa09c6 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -1073,7 +1073,7 @@ class BOM extends CommonObject if ($res>0) { $bom_child->calculateCosts(); $line->childBom[] = $bom_child; - $line->total_cost = price2num( $bom_child->total_cost * $line->qty, 'MT'); + $line->total_cost = price2num($bom_child->total_cost * $line->qty, 'MT'); $this->total_cost += $line->total_cost; } else { $this->error = $bom_child->error; From 1ebd2135e0f15c34fa62674ec9b19a7fcf4e6412 Mon Sep 17 00:00:00 2001 From: atm-lena Date: Thu, 15 Dec 2022 15:00:27 +0100 Subject: [PATCH 06/12] Fix stickler error --- htdocs/bom/tpl/objectline_view.tpl.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/bom/tpl/objectline_view.tpl.php b/htdocs/bom/tpl/objectline_view.tpl.php index bb83e62c07f..f9b39c517e9 100644 --- a/htdocs/bom/tpl/objectline_view.tpl.php +++ b/htdocs/bom/tpl/objectline_view.tpl.php @@ -221,12 +221,15 @@ if ($resql) { $label = $sub_bom_product->getLabelOfUnit('long'); if ($sub_bom_line->qty_frozen > 0) { print ''.price($sub_bom_line->qty, 0, '', 0, 0).''; - print ''.($label !== '') ? $langs->trans($label) : '' . ''; + print ''; + if ($label !== '') print $langs->trans($label); + print ''; print ''.$langs->trans('Yes').''; } else { print ''.price($sub_bom_line->qty * $line->qty, 0, '', 0, 0).''; print ''; - print ''.($label !== '') ? $langs->trans($label) : '' . ''; + if($label !== '') print $langs->trans($label); + print ''; print ''; print ' '; } From 48b4caaa70178498146b230b9c1fceb826502c1c Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Mon, 19 Dec 2022 09:41:39 +0000 Subject: [PATCH 07/12] Fixing style errors. --- htdocs/bom/tpl/objectline_view.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/bom/tpl/objectline_view.tpl.php b/htdocs/bom/tpl/objectline_view.tpl.php index f9b39c517e9..85bd4d6b02a 100644 --- a/htdocs/bom/tpl/objectline_view.tpl.php +++ b/htdocs/bom/tpl/objectline_view.tpl.php @@ -228,7 +228,7 @@ if ($resql) { } else { print ''.price($sub_bom_line->qty * $line->qty, 0, '', 0, 0).''; print ''; - if($label !== '') print $langs->trans($label); + if ($label !== '') print $langs->trans($label); print ''; print ''; print ' '; From 6dbffb53989f8f75f7d5b1d863c7c72328f1a3b6 Mon Sep 17 00:00:00 2001 From: atm-lena Date: Mon, 2 Jan 2023 09:48:34 +0100 Subject: [PATCH 08/12] Add price() to pricetonum() on bomline view --- htdocs/bom/tpl/objectline_view.tpl.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/bom/tpl/objectline_view.tpl.php b/htdocs/bom/tpl/objectline_view.tpl.php index 85bd4d6b02a..fc6b7709d14 100644 --- a/htdocs/bom/tpl/objectline_view.tpl.php +++ b/htdocs/bom/tpl/objectline_view.tpl.php @@ -247,13 +247,13 @@ if ($resql) { // Cost if (!empty($sub_bom->id)) { $sub_bom->calculateCosts(); - print ''.price2num($sub_bom->total_cost * $sub_bom_line->qty * $line->qty, 'MT').''; + print ''.price(price2num($sub_bom->total_cost * $sub_bom_line->qty * $line->qty, 'MT')).''; $total_cost+= $sub_bom->total_cost * $sub_bom_line->qty * $line->qty; } elseif ($sub_bom_product->cost_price > 0) { - print ''.price2num($sub_bom_product->cost_price * $sub_bom_line->qty * $line->qty, 'MT').''; + print ''.price(price2num($sub_bom_product->cost_price * $sub_bom_line->qty * $line->qty, 'MT')).''; $total_cost+= $sub_bom_product->cost_price * $sub_bom_line->qty * $line->qty; } elseif ($sub_bom_product->pmp > 0) { // PMP if cost price isn't defined - print ''.price2num($sub_bom_product->pmp * $sub_bom_line->qty * $line->qty, 'MT').''; + print ''.price(price2num($sub_bom_product->pmp * $sub_bom_line->qty * $line->qty, 'MT')).''; $total_cost.= $sub_bom_product->pmp * $sub_bom_line->qty * $line->qty; } else { // Minimum purchase price if cost price and PMP aren't defined $sql_supplier_price = 'SELECT MIN(price) AS min_price, quantity AS qty FROM '.MAIN_DB_PREFIX.'product_fournisseur_price'; From 4fdf9302694fd39fbe5d496cc6590aa4869319d2 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 12 Jan 2023 12:49:45 +0100 Subject: [PATCH 09/12] make PDF custom volume work as it work on expedition/card.php --- .../core/modules/expedition/doc/pdf_espadon.modules.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php index 97be43da689..fd5c2ee1980 100644 --- a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php @@ -846,12 +846,13 @@ class pdf_espadon extends ModelePdfExpedition $totalWeighttoshow = showDimensionInBestUnit($object->trueWeight, $object->weight_units, "weight", $outputlangs); } if ($object->trueVolume) { - $totalVolumetoshow = showDimensionInBestUnit($object->trueVolume, $object->volume_units, "volume", $outputlangs); + if ($object->volume_units < 50) { + $totalVolumetoshow = showDimensionInBestUnit($object->trueVolume, $object->volume_units, "volume", $outputlangs); + } else { + $totalVolumetoshow = price($object->trueVolume, 0, $outputlangs, 0, 0).' '.measuringUnitString(0, "volume", $object->volume_units); + } } - - - if ($this->getColumnStatus('desc')) { $this->printStdColumnContent($pdf, $tab2_top, 'desc', $outputlangs->transnoentities("Total")); } From 04ce79191fb24085c27969e5bbe60e5096340970 Mon Sep 17 00:00:00 2001 From: hystepik Date: Fri, 13 Jan 2023 12:18:58 +0100 Subject: [PATCH 10/12] Fix #23531 : fix update bom line --- htdocs/core/modules/modBom.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/modBom.class.php b/htdocs/core/modules/modBom.class.php index 2e92d3baeaf..d6b9e7a6ff3 100644 --- a/htdocs/core/modules/modBom.class.php +++ b/htdocs/core/modules/modBom.class.php @@ -422,7 +422,7 @@ class modBom extends DolibarrModules $this->import_fieldshidden_array[$r] = array('extra.fk_object' => 'lastrowid-'.MAIN_DB_PREFIX.'bom_bomline'); $this->import_regex_array[$r] = array(); - $this->import_updatekeys_array[$r] = array('bd.fk_bom' => 'BOM Id'); + $this->import_updatekeys_array[$r] = array('bd.fk_bom' => 'BOM Id', 'bd.fk_product' => 'ProductRef'); $this->import_convertvalue_array[$r] = array( 'bd.fk_bom' => array( 'rule' => 'fetchidfromref', From 90137268a126be6e29adbe24d461ecb45f9d4be1 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Mon, 16 Jan 2023 22:15:02 +0100 Subject: [PATCH 11/12] FIX: missing tokan on Supplier proposal links --- htdocs/supplier_proposal/card.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index 399d1271037..d09b6793dd0 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -1968,30 +1968,30 @@ if ($action == 'create') { // Create an order if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled)) && $object->statut == SupplierProposal::STATUS_SIGNED) { if ($usercancreateorder) { - print ''; + print ''; } } // Set accepted/refused if ($object->statut == SupplierProposal::STATUS_VALIDATED && $usercanclose) { - print '
global->MAIN_JUMP_TAG) ? '' : '#acceptedrefused').'"'; + print ''; } // Close if ($object->statut == SupplierProposal::STATUS_SIGNED && $usercanclose) { - print '
global->MAIN_JUMP_TAG) ? '' : '#close').'"'; + print ''; } // Clone if ($usercancreate) { - print ''; + print ''; } // Delete if (($object->statut == SupplierProposal::STATUS_DRAFT && $usercancreate) || $usercandelete) { - print ''; } } From dbc9ca981628577dea9245ff7d6823c3e48b5142 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Mon, 16 Jan 2023 22:17:22 +0100 Subject: [PATCH 12/12] FIX: missing token on Supplier proposal links --- htdocs/supplier_proposal/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index d09b6793dd0..d4bb56b3304 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -1986,7 +1986,7 @@ if ($action == 'create') { // Clone if ($usercancreate) { - print ''; + print ''; } // Delete