From 2fdd8486c948029a6ed25477e5f29b04761624cb Mon Sep 17 00:00:00 2001 From: TuxGasy Date: Sat, 22 May 2021 06:13:16 +0200 Subject: [PATCH 01/65] No try to translate label field in dictionary for new --- htdocs/admin/dict.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index c9ada83ed15..2bd55c6c66a 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -2015,7 +2015,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '') print ''; $transfound = 0; $transkey = ''; - if (in_array($fieldlist[$field], array('label', 'libelle'))) // For label + if (in_array($fieldlist[$field], array('label', 'libelle')) and !empty($obj->code)) // For label { // Special case for labels if ($tabname == MAIN_DB_PREFIX.'c_civility') { From 3ebe6eb014d440b7602a40252fc2fbb9ffc1caa3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 27 May 2021 00:02:01 +0200 Subject: [PATCH 02/65] fix bad setup of MAIN_USE_BACKGROUND_ON_PDF --- htdocs/core/lib/pdf.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 1babc31b4c2..281e45baf51 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -623,8 +623,8 @@ function pdf_pagehead(&$pdf, $outputlangs, $page_height) { global $conf; - // Add a background image on document - if (!empty($conf->global->MAIN_USE_BACKGROUND_ON_PDF)) // Warning, this option make TCPDF generation being crazy and some content disappeared behind the image + // Add a background image on document only if good setup of const + if (!empty($conf->global->MAIN_USE_BACKGROUND_ON_PDF) && ($conf->global->MAIN_USE_BACKGROUND_ON_PDF != '-1')) // Warning, this option make TCPDF generation being crazy and some content disappeared behind the image { $pdf->SetAutoPageBreak(0, 0); // Disable auto pagebreak before adding image $pdf->Image($conf->mycompany->dir_output.'/logos/'.$conf->global->MAIN_USE_BACKGROUND_ON_PDF, (isset($conf->global->MAIN_USE_BACKGROUND_ON_PDF_X) ? $conf->global->MAIN_USE_BACKGROUND_ON_PDF_X : 0), (isset($conf->global->MAIN_USE_BACKGROUND_ON_PDF_Y) ? $conf->global->MAIN_USE_BACKGROUND_ON_PDF_Y : 0), 0, $page_height); From 89f6b66c2a8e091163a4bd8ecfe101117acbe2b0 Mon Sep 17 00:00:00 2001 From: Quentin VIAL-GOUTEYRON Date: Wed, 2 Jun 2021 10:32:30 +0200 Subject: [PATCH 03/65] wrong join, request too long --- htdocs/compta/stats/cabyprodserv.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/stats/cabyprodserv.php b/htdocs/compta/stats/cabyprodserv.php index 485a6088338..46908ac6b75 100644 --- a/htdocs/compta/stats/cabyprodserv.php +++ b/htdocs/compta/stats/cabyprodserv.php @@ -232,7 +232,7 @@ if ($modecompta == 'CREANCES-DETTES') if ($selected_cat === -2) { // Without any category $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON p.rowid = cp.fk_product"; } elseif ($selected_cat) { // Into a specific category - $sql .= ", ".MAIN_DB_PREFIX."categorie as c, ".MAIN_DB_PREFIX."categorie_product as cp"; + $sql .= " INNER JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON (cp.fk_product = p.rowid) INNER JOIN ".MAIN_DB_PREFIX."categorie as c ON (cp.fk_categorie = c.rowid)"; } $sql .= " WHERE l.fk_facture = f.rowid"; $sql .= " AND f.fk_statut in (1,2)"; From b8b30a9af6f6d3647e862c51e6eedf73698a383b Mon Sep 17 00:00:00 2001 From: Quentin VIAL-GOUTEYRON Date: Wed, 2 Jun 2021 10:53:04 +0200 Subject: [PATCH 04/65] wrong where cabyprodserv --- htdocs/compta/stats/cabyprodserv.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/stats/cabyprodserv.php b/htdocs/compta/stats/cabyprodserv.php index 46908ac6b75..7b8f1101004 100644 --- a/htdocs/compta/stats/cabyprodserv.php +++ b/htdocs/compta/stats/cabyprodserv.php @@ -263,11 +263,11 @@ if ($modecompta == 'CREANCES-DETTES') } } - $sql .= " AND (p.rowid IN "; - $sql .= " (SELECT fk_product FROM ".MAIN_DB_PREFIX."categorie_product cp WHERE "; + $sql .= " AND "; + if ($subcat) $sql .= "cp.fk_categorie IN (".$listofcatsql.")"; else $sql .= "cp.fk_categorie = ".$selected_cat; - $sql .= "))"; + } if ($selected_soc > 0) $sql .= " AND soc.rowid=".$selected_soc; $sql .= " AND f.entity IN (".getEntity('invoice').")"; From de1be814d5ff2cd60c7994579c73962c839872e9 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 2 Jun 2021 09:23:50 +0000 Subject: [PATCH 05/65] Fixing style errors. --- htdocs/compta/stats/cabyprodserv.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/compta/stats/cabyprodserv.php b/htdocs/compta/stats/cabyprodserv.php index 7b8f1101004..3b00832c1a3 100644 --- a/htdocs/compta/stats/cabyprodserv.php +++ b/htdocs/compta/stats/cabyprodserv.php @@ -267,7 +267,6 @@ if ($modecompta == 'CREANCES-DETTES') if ($subcat) $sql .= "cp.fk_categorie IN (".$listofcatsql.")"; else $sql .= "cp.fk_categorie = ".$selected_cat; - } if ($selected_soc > 0) $sql .= " AND soc.rowid=".$selected_soc; $sql .= " AND f.entity IN (".getEntity('invoice').")"; From 56bb2bbd14e788b6f2cb643cd9506de6741124f7 Mon Sep 17 00:00:00 2001 From: TuxGasy Date: Fri, 4 Jun 2021 17:10:26 +0200 Subject: [PATCH 06/65] On dict, test $obj->code if empty before translation --- htdocs/admin/dict.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 2bd55c6c66a..f0b6ab5ec2b 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -2015,13 +2015,13 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '') print ''; $transfound = 0; $transkey = ''; - if (in_array($fieldlist[$field], array('label', 'libelle')) and !empty($obj->code)) // For label + if (in_array($fieldlist[$field], array('label', 'libelle'))) // For label { // Special case for labels - if ($tabname == MAIN_DB_PREFIX.'c_civility') { + if ($tabname == MAIN_DB_PREFIX.'c_civility' && !empty($obj->code)) { $transkey = "Civility".strtoupper($obj->code); } - if ($tabname == MAIN_DB_PREFIX.'c_payment_term') { + if ($tabname == MAIN_DB_PREFIX.'c_payment_term' && !empty($obj->code)) { $langs->load("bills"); $transkey = "PaymentConditionShort".strtoupper($obj->code); } From 36accba5c96df8c726357b3ea8cb92a2aed9cb11 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sat, 5 Jun 2021 14:43:40 +0200 Subject: [PATCH 07/65] Fix date_start of last subscription --- htdocs/adherents/class/adherent.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index eeede7b3810..1d8ed358c73 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -1402,7 +1402,7 @@ class Adherent extends CommonObject $this->first_subscription_amount = $obj->subscription; } $this->last_subscription_date = $this->db->jdate($obj->datec); - $this->last_subscription_date_start = $this->db->jdate($obj->datef); + $this->last_subscription_date_start = $this->db->jdate($obj->dateh); $this->last_subscription_date_end = $this->db->jdate($obj->datef); $this->last_subscription_amount = $obj->subscription; From 1aca7efce3d739b079ed8fa0249830fe841b76d3 Mon Sep 17 00:00:00 2001 From: ATM john Date: Sun, 6 Jun 2021 13:15:03 +0200 Subject: [PATCH 08/65] Fix childtablesoncascade doc --- htdocs/core/class/commonobject.class.php | 2 +- htdocs/societe/class/societe.class.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index f2c61bc86a3..1d0509d7483 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -440,7 +440,7 @@ abstract class CommonObject /** * @var array List of child tables. To know object to delete on cascade. - * if name like with @ClassNAme:FilePathClass;ParentFkFieldName' it will + * if name like with @ClassNAme:FilePathClass:ParentFkFieldName' it will * call method deleteByParentField(parentId,ParentFkFieldName) to fetch and delete child object */ protected $childtablesoncascade = array(); diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index f10cead50fd..9687485eb10 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -84,7 +84,7 @@ class Societe extends CommonObject /** * @var array List of child tables. To know object to delete on cascade. - * if name like with @ClassNAme:FilePathClass;ParentFkFieldName' it will call method deleteByParentField (with parentId as parameters) and FieldName to fetch and delete child object + * if name like with @ClassNAme:FilePathClass:ParentFkFieldName' it will call method deleteByParentField (with parentId as parameters) and FieldName to fetch and delete child object */ protected $childtablesoncascade = array( "societe_prices", From 80af5e2216dd3a91ed20c9ca3e4a9c4a78600e4e Mon Sep 17 00:00:00 2001 From: Quentin VIAL-GOUTEYRON Date: Mon, 7 Jun 2021 10:05:24 +0200 Subject: [PATCH 09/65] keep where but remove join --- htdocs/compta/stats/cabyprodserv.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/stats/cabyprodserv.php b/htdocs/compta/stats/cabyprodserv.php index 7b8f1101004..fce5a9740a2 100644 --- a/htdocs/compta/stats/cabyprodserv.php +++ b/htdocs/compta/stats/cabyprodserv.php @@ -231,8 +231,6 @@ if ($modecompta == 'CREANCES-DETTES') $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON l.fk_product = p.rowid"; if ($selected_cat === -2) { // Without any category $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON p.rowid = cp.fk_product"; - } elseif ($selected_cat) { // Into a specific category - $sql .= " INNER JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON (cp.fk_product = p.rowid) INNER JOIN ".MAIN_DB_PREFIX."categorie as c ON (cp.fk_categorie = c.rowid)"; } $sql .= " WHERE l.fk_facture = f.rowid"; $sql .= " AND f.fk_statut in (1,2)"; @@ -263,10 +261,13 @@ if ($modecompta == 'CREANCES-DETTES') } } + $sql .= " AND (p.rowid IN "; + $sql .= " (SELECT fk_product FROM ".MAIN_DB_PREFIX."categorie_product cp WHERE "; $sql .= " AND "; if ($subcat) $sql .= "cp.fk_categorie IN (".$listofcatsql.")"; else $sql .= "cp.fk_categorie = ".$selected_cat; + $sql .= "))"; } if ($selected_soc > 0) $sql .= " AND soc.rowid=".$selected_soc; From 98aa374185cb8996d9a4194695f77db35cddbeeb Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Mon, 7 Jun 2021 08:10:05 +0000 Subject: [PATCH 10/65] Fixing style errors. --- htdocs/compta/stats/cabyprodserv.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/compta/stats/cabyprodserv.php b/htdocs/compta/stats/cabyprodserv.php index fce5a9740a2..f7c215270d4 100644 --- a/htdocs/compta/stats/cabyprodserv.php +++ b/htdocs/compta/stats/cabyprodserv.php @@ -268,7 +268,6 @@ if ($modecompta == 'CREANCES-DETTES') if ($subcat) $sql .= "cp.fk_categorie IN (".$listofcatsql.")"; else $sql .= "cp.fk_categorie = ".$selected_cat; $sql .= "))"; - } if ($selected_soc > 0) $sql .= " AND soc.rowid=".$selected_soc; $sql .= " AND f.entity IN (".getEntity('invoice').")"; From af913cd29f1412481858ca796508520bded4e414 Mon Sep 17 00:00:00 2001 From: Quentin VIAL-GOUTEYRON Date: Mon, 7 Jun 2021 10:10:42 +0200 Subject: [PATCH 11/65] remove and --- htdocs/compta/stats/cabyprodserv.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/htdocs/compta/stats/cabyprodserv.php b/htdocs/compta/stats/cabyprodserv.php index fce5a9740a2..da9927c2e20 100644 --- a/htdocs/compta/stats/cabyprodserv.php +++ b/htdocs/compta/stats/cabyprodserv.php @@ -263,8 +263,6 @@ if ($modecompta == 'CREANCES-DETTES') $sql .= " AND (p.rowid IN "; $sql .= " (SELECT fk_product FROM ".MAIN_DB_PREFIX."categorie_product cp WHERE "; - $sql .= " AND "; - if ($subcat) $sql .= "cp.fk_categorie IN (".$listofcatsql.")"; else $sql .= "cp.fk_categorie = ".$selected_cat; $sql .= "))"; From b1c3a7cf4864ff8568569c0f1926c2f6cd590c9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 8 Jun 2021 10:38:34 +0200 Subject: [PATCH 12/65] avoid fatal error --- htdocs/compta/facture/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 60e5d4eb52a..8f5ac173d7f 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -3208,7 +3208,7 @@ if ($action == 'create') $facids = $facturestatic->list_qualified_avoir_invoices($soc->id); if ($facids < 0) { - dol_print_error($db, $facturestatic); + dol_print_error($db, $facturestatic->error, $facturestatic->errors); exit; } $optionsav = ""; @@ -3656,7 +3656,7 @@ if ($action == 'create') $result = $object->fetch($id, $ref); if ($result <= 0) { - dol_print_error($db, $object->error); + dol_print_error($db, $object->error, $object->errors); exit(); } From 37433ffee7cfa54ba9d6e268e95a599635bf25c1 Mon Sep 17 00:00:00 2001 From: atm-greg Date: Tue, 8 Jun 2021 11:39:04 +0200 Subject: [PATCH 13/65] verify vat change to update multiprice --- htdocs/product/price.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/product/price.php b/htdocs/product/price.php index dd56aa42318..27d39779338 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -349,6 +349,7 @@ if (empty($reshook)) $newprice = price2num($newprice, 'MU'); $newprice_min = price2num($val['price_min'], 'MU'); + $newvattx = price2num($val['vat_tx'], 'MU'); if (!empty($conf->global->PRODUCT_MINIMUM_RECOMMENDED_PRICE) && $newprice_min < $maxpricesupplier) { setEventMessages($langs->trans("MinimumPriceLimit", price($maxpricesupplier, 0, '', 1, - 1, - 1, 'auto')), null, 'errors'); @@ -356,11 +357,10 @@ if (empty($reshook)) break; } - if ($object->multiprices[$key] != $newprice || $object->multiprices_min[$key] != $newprice_min || $object->multiprices_base_type[$key] != $val['price_base_type']) + if ($object->multiprices[$key] != $newprice || $object->multiprices_min[$key] != $newprice_min || $object->multiprices_base_type[$key] != $val['price_base_type'] || $object->multiprices_tva_tx[$key] != $newvattx) $res = $object->updatePrice($newprice, $val['price_base_type'], $user, $val['vat_tx'], $newprice_min, $key, $val['npr'], $psq, 0, $val['localtaxes_array'], $val['default_vat_code']); else $res = 0; - if ($res < 0) { $error++; setEventMessages($object->error, $object->errors, 'errors'); From 0ea0966b09c32b8605b3384b1daff44d9259f479 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 8 Jun 2021 12:01:05 +0200 Subject: [PATCH 14/65] Update card.php --- htdocs/compta/facture/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 8f5ac173d7f..54994eaf187 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -3123,7 +3123,7 @@ if ($action == 'create') // Type de facture $facids = $facturestatic->list_replacable_invoices($soc->id); if ($facids < 0) { - dol_print_error($db, $facturestatic); + dol_print_error($db, $facturestatic->error, $facturestatic->errors); exit(); } $options = ""; From 4e530c2486c7c4255c9b20a6e1ddf7816afdfd66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 8 Jun 2021 12:05:45 +0200 Subject: [PATCH 15/65] Update card.php --- htdocs/fourn/facture/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 80491d5edfe..530a0d22766 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1867,7 +1867,7 @@ if ($action == 'create') // Type invoice $facids = $facturestatic->list_replacable_supplier_invoices($societe->id); if ($facids < 0) { - dol_print_error($db, $facturestatic); + dol_print_error($db, $facturestatic->error, $facturestatic->errors); exit(); } $options = ""; @@ -1933,7 +1933,7 @@ if ($action == 'create') $facids = $facturestatic->list_qualified_avoir_supplier_invoices($societe->id); if ($facids < 0) { - dol_print_error($db, $facturestatic); + dol_print_error($db, $facturestatic->error, $facturestatic->errors); exit; } $optionsav = ""; From 5131ab5199b39605745544bae20429a98883476c Mon Sep 17 00:00:00 2001 From: John BOTELLA Date: Tue, 8 Jun 2021 12:36:08 +0200 Subject: [PATCH 16/65] Fix php 7 warning : Only variables should be passed by reference --- htdocs/core/modules/modFournisseur.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/modFournisseur.class.php b/htdocs/core/modules/modFournisseur.class.php index d39d67775f5..39b2f3d3237 100644 --- a/htdocs/core/modules/modFournisseur.class.php +++ b/htdocs/core/modules/modFournisseur.class.php @@ -489,7 +489,8 @@ class modFournisseur extends DolibarrModules case 'sellist': $tmp = ''; $tmpparam = unserialize($obj->param); // $tmp ay be array 'options' => array 'c_currencies:code_iso:code_iso' => null - if ($tmpparam['options'] && is_array($tmpparam['options'])) $tmp = array_shift(array_keys($tmpparam['options'])); + $array_keys = array_keys($tmpparam['options']); + if ($tmpparam['options'] && is_array($tmpparam['options'])) $tmp = array_shift($array_keys); if (preg_match('/[a-z0-9_]+:[a-z0-9_]+:[a-z0-9_]+/', $tmp)) $typeFilter = "List:".$tmp; break; } From a4f3792cec80c7f5bcc9d52f7f4a7fb79143239e Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Wed, 9 Jun 2021 07:42:05 +0200 Subject: [PATCH 17/65] FIX Missing link to language file --- htdocs/user/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 40ff6625163..9b747d9c713 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -92,7 +92,7 @@ $result = restrictedArea($user, 'user', $id, 'user', $feature2); if ($user->id <> $id && !$canreaduser) accessforbidden(); // Load translation files required by page -$langs->loadLangs(array('users', 'companies', 'ldap', 'admin', 'hrm', 'stocks')); +$langs->loadLangs(array('users', 'companies', 'ldap', 'admin', 'hrm', 'stocks', 'other')); $object = new User($db); $extrafields = new ExtraFields($db); From 4b6fb7dd47eec16fba08c9e0da51d3ec1a974864 Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Wed, 9 Jun 2021 12:26:28 +0200 Subject: [PATCH 18/65] FIX : auto rounding on "_FORMATED_" tags --- htdocs/core/lib/functions.lib.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 4d450768fe7..51b7442defe 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -6453,11 +6453,11 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, if ($onlykey != 2 || $mysoc->useLocalTax(1)) $substitutionarray['__AMOUNT_TAX2__'] = is_object($object) ? $object->total_localtax1 : ''; if ($onlykey != 2 || $mysoc->useLocalTax(2)) $substitutionarray['__AMOUNT_TAX3__'] = is_object($object) ? $object->total_localtax2 : ''; - $substitutionarray['__AMOUNT_FORMATED__'] = is_object($object) ? ($object->total_ttc ? price($object->total_ttc, 0, $outputlangs, 0, 0, -1, $conf->currency) : null) : ''; - $substitutionarray['__AMOUNT_EXCL_TAX_FORMATED__'] = is_object($object) ? ($object->total_ht ? price($object->total_ht, 0, $outputlangs, 0, 0, -1, $conf->currency) : null) : ''; - $substitutionarray['__AMOUNT_VAT_FORMATED__'] = is_object($object) ? ($object->total_vat ? price($object->total_vat, 0, $outputlangs, 0, 0, -1, $conf->currency) : ($object->total_tva ? price($object->total_tva, 0, $outputlangs, 0, 0, -1, $conf->currency) : null)) : ''; - if ($onlykey != 2 || $mysoc->useLocalTax(1)) $substitutionarray['__AMOUNT_TAX2_FORMATED__'] = is_object($object) ? ($object->total_localtax1 ? price($object->total_localtax1, 0, $outputlangs, 0, 0, -1, $conf->currency) : null) : ''; - if ($onlykey != 2 || $mysoc->useLocalTax(2)) $substitutionarray['__AMOUNT_TAX3_FORMATED__'] = is_object($object) ? ($object->total_localtax2 ? price($object->total_localtax2, 0, $outputlangs, 0, 0, -1, $conf->currency) : null) : ''; + $substitutionarray['__AMOUNT_FORMATED__'] = is_object($object) ? ($object->total_ttc ? price($object->total_ttc, 0, $outputlangs, 0, -1, -1, $conf->currency) : null) : ''; + $substitutionarray['__AMOUNT_EXCL_TAX_FORMATED__'] = is_object($object) ? ($object->total_ht ? price($object->total_ht, 0, $outputlangs, 0, -1, -1, $conf->currency) : null) : ''; + $substitutionarray['__AMOUNT_VAT_FORMATED__'] = is_object($object) ? ($object->total_vat ? price($object->total_vat, 0, $outputlangs, 0, -1, -1, $conf->currency) : ($object->total_tva ? price($object->total_tva, 0, $outputlangs, 0, 0, -1, $conf->currency) : null)) : ''; + if ($onlykey != 2 || $mysoc->useLocalTax(1)) $substitutionarray['__AMOUNT_TAX2_FORMATED__'] = is_object($object) ? ($object->total_localtax1 ? price($object->total_localtax1, 0, $outputlangs, 0, -1, -1, $conf->currency) : null) : ''; + if ($onlykey != 2 || $mysoc->useLocalTax(2)) $substitutionarray['__AMOUNT_TAX3_FORMATED__'] = is_object($object) ? ($object->total_localtax2 ? price($object->total_localtax2, 0, $outputlangs, 0, -1, -1, $conf->currency) : null) : ''; // TODO Add keys for foreign multicurrency From 5d9aa40065c68cb5f837570b1d229f119ffeca81 Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Wed, 9 Jun 2021 12:40:34 +0200 Subject: [PATCH 19/65] FIX: holiday list: bad right for mass deletion --- htdocs/holiday/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index 18df214f4c6..7e77ef45d35 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -381,7 +381,7 @@ if ($resql) //'builddoc'=>$langs->trans("PDFMerge"), //'presend'=>$langs->trans("SendByMail"), ); - if ($user->rights->holiday->supprimer) $arrayofmassactions['predelete'] = ''.$langs->trans("Delete"); + if ($user->rights->holiday->delete) $arrayofmassactions['predelete'] = ''.$langs->trans("Delete"); if (in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array(); $massactionbutton = $form->selectMassAction('', $arrayofmassactions); From 0a23cf029d8460dea8c802ad0014e830d23c3b30 Mon Sep 17 00:00:00 2001 From: Dorian Vabre Date: Wed, 9 Jun 2021 14:13:50 +0200 Subject: [PATCH 20/65] using strlen instead of count --- htdocs/core/class/CSMSFile.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/CSMSFile.class.php b/htdocs/core/class/CSMSFile.class.php index a02f00fbac9..1ea2434a27f 100644 --- a/htdocs/core/class/CSMSFile.class.php +++ b/htdocs/core/class/CSMSFile.class.php @@ -75,7 +75,7 @@ class CSMSFile return -1; } - dol_syslog("CSMSFile::CSMSFile: MAIN_SMS_SENDMODE=".$conf->global->MAIN_SMS_SENDMODE." charset=".$conf->file->character_set_client." from=".$from.", to=".$to.", msg length=".count($msg), LOG_DEBUG); + dol_syslog("CSMSFile::CSMSFile: MAIN_SMS_SENDMODE=".$conf->global->MAIN_SMS_SENDMODE." charset=".$conf->file->character_set_client." from=".$from.", to=".$to.", msg length=".strlen($msg), LOG_DEBUG); dol_syslog("CSMSFile::CSMSFile: deferred=".$deferred." priority=".$priority." class=".$class, LOG_DEBUG); // Action according to choosed sending method From c37c3713928a6d2216ceaa2b04e21f436081a7c3 Mon Sep 17 00:00:00 2001 From: lvessiller Date: Wed, 9 Jun 2021 17:18:01 +0200 Subject: [PATCH 21/65] FIX clone invoice with acount line --- .../triggers/interface_90_modSociete_ContactRoles.class.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/htdocs/core/triggers/interface_90_modSociete_ContactRoles.class.php b/htdocs/core/triggers/interface_90_modSociete_ContactRoles.class.php index 0ee3cdb73ab..b15113c9c08 100644 --- a/htdocs/core/triggers/interface_90_modSociete_ContactRoles.class.php +++ b/htdocs/core/triggers/interface_90_modSociete_ContactRoles.class.php @@ -84,11 +84,7 @@ class InterfaceContactRoles extends DolibarrTriggers if (is_array($TContact) && ! empty($TContact)) { $TContactAlreadyLinked = array(); if ($object->id > 0) { - $cloneFrom = dol_clone($object, 1); - - if (! empty($cloneFrom->id)) { - $TContactAlreadyLinked = array_merge($cloneFrom->liste_contact(- 1, 'external'), $cloneFrom->liste_contact(- 1, 'internal')); - } + $TContactAlreadyLinked = array_merge($object->liste_contact(- 1, 'external'), $object->liste_contact(- 1, 'internal')); } foreach ($TContact as $i => $infos) { From b216c81c60305513415c7c9b1086d55df75eac0f Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Thu, 10 Jun 2021 06:22:03 +0200 Subject: [PATCH 22/65] FIX Customer invoice list - Pagination lost search_date_xxx information --- htdocs/compta/facture/list.php | 74 ++++++++++++++++++++++++++++------ 1 file changed, 61 insertions(+), 13 deletions(-) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index f655de32646..94326852d31 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -13,7 +13,7 @@ * Copyright (C) 2015-2016 Ferran Marcet * Copyright (C) 2017 Josep Lluís Amador * Copyright (C) 2018 Charlene Benke - * Copyright (C) 2019 Alexandre Spangaro + * Copyright (C) 2019-2021 Alexandre Spangaro * * 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 @@ -105,12 +105,30 @@ $search_country = GETPOST("search_country", 'int'); $search_type_thirdparty = GETPOST("search_type_thirdparty", 'int'); $search_user = GETPOST('search_user', 'int'); $search_sale = GETPOST('search_sale', 'int'); -$search_date_start = dol_mktime(0, 0, 0, GETPOST('search_date_startmonth', 'int'), GETPOST('search_date_startday', 'int'), GETPOST('search_date_startyear', 'int')); -$search_date_end = dol_mktime(23, 59, 59, GETPOST('search_date_endmonth', 'int'), GETPOST('search_date_endday', 'int'), GETPOST('search_date_endyear', 'int')); -$search_date_valid_start = dol_mktime(0, 0, 0, GETPOST('search_date_valid_startmonth', 'int'), GETPOST('search_date_valid_startday', 'int'), GETPOST('search_date_valid_startyear', 'int')); -$search_date_valid_end = dol_mktime(23, 59, 59, GETPOST('search_date_valid_endmonth', 'int'), GETPOST('search_date_valid_endday', 'int'), GETPOST('search_date_valid_endyear', 'int')); -$search_datelimit_start = dol_mktime(0, 0, 0, GETPOST('search_datelimit_startmonth', 'int'), GETPOST('search_datelimit_startday', 'int'), GETPOST('search_datelimit_startyear', 'int')); -$search_datelimit_end = dol_mktime(23, 59, 59, GETPOST('search_datelimit_endmonth', 'int'), GETPOST('search_datelimit_endday', 'int'), GETPOST('search_datelimit_endyear', 'int')); +$search_date_startday = GETPOST('search_date_startday', 'int'); +$search_date_startmonth = GETPOST('search_date_startmonth', 'int'); +$search_date_startyear = GETPOST('search_date_startyear', 'int'); +$search_date_endday = GETPOST('search_date_endday', 'int'); +$search_date_endmonth = GETPOST('search_date_endmonth', 'int'); +$search_date_endyear = GETPOST('search_date_endyear', 'int'); +$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver +$search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear); +$search_date_valid_startday = GETPOST('search_date_valid_startday', 'int'); +$search_date_valid_startmonth = GETPOST('search_date_valid_startmonth', 'int'); +$search_date_valid_startyear = GETPOST('search_date_valid_startyear', 'int'); +$search_date_valid_endday = GETPOST('search_date_valid_endday', 'int'); +$search_date_valid_endmonth = GETPOST('search_date_valid_endmonth', 'int'); +$search_date_valid_endyear = GETPOST('search_date_valid_endyear', 'int'); +$search_date_valid_start = dol_mktime(0, 0, 0, $search_date_valid_startmonth, $search_date_valid_startday, $search_date_valid_startyear); +$search_date_valid_end = dol_mktime(23, 59, 59, $search_date_valid_endmonth, $search_date_valid_endday, $search_date_valid_endyear); +$search_datelimit_startday = GETPOST('search_datelimit_startday', 'int'); +$search_datelimit_startmonth = GETPOST('search_datelimit_startmonth', 'int'); +$search_datelimit_startyear = GETPOST('search_datelimit_startyear', 'int'); +$search_datelimit_endday = GETPOST('search_datelimit_endday', 'int'); +$search_datelimit_endmonth = GETPOST('search_datelimit_endmonth', 'int'); +$search_datelimit_endyear = GETPOST('search_datelimit_endyear', 'int'); +$search_datelimit_start = dol_mktime(0, 0, 0, $search_datelimit_startmonth, $search_datelimit_startday, $search_datelimit_startyear); +$search_datelimit_end = dol_mktime(23, 59, 59, $search_datelimit_endmonth, $search_datelimit_endday, $search_datelimit_endyear); $search_categ_cus = trim(GETPOST("search_categ_cus", 'int')); $search_btn = GETPOST('button_search', 'alpha'); $search_remove_btn = GETPOST('button_removefilter', 'alpha'); @@ -273,10 +291,28 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter', $search_type = ''; $search_country = ''; $search_type_thirdparty = ''; + $search_date_startday = ''; + $search_date_startmonth = ''; + $search_date_startyear = ''; + $search_date_endday = ''; + $search_date_endmonth = ''; + $search_date_endyear = ''; $search_date_start = ''; $search_date_end = ''; + $search_date_valid_startday = ''; + $search_date_valid_startmonth = ''; + $search_date_valid_startyear = ''; + $search_date_valid_endday = ''; + $search_date_valid_endmonth = ''; + $search_date_valid_endyear = ''; $search_date_valid_start = ''; $search_date_valid_end = ''; + $search_datelimit_startday = ''; + $search_datelimit_startmonth = ''; + $search_datelimit_startyear = ''; + $search_datelimit_endday = ''; + $search_datelimit_endmonth = ''; + $search_datelimit_endyear = ''; $search_datelimit_start = ''; $search_datelimit_end = ''; $option = ''; @@ -623,12 +659,24 @@ if ($resql) if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); if ($sall) $param .= '&sall='.urlencode($sall); - if ($search_date_start) $param .= '&search_date_start='.urlencode($search_date_start); - if ($search_date_end) $param .= '&search_date_end='.urlencode($search_date_end); - if ($search_date_valid_start) $param .= '&search_date_valid_start='.urlencode($search_date_valid_start); - if ($search_date_valid_end) $param .= '&search_date_valid_end='.urlencode($search_date_valid_end); - if ($search_datelimit_start) $param .= '&search_datelimit_start='.urlencode($search_datelimit_start); - if ($search_datelimit_end) $param .= '&search_datelimit_end='.urlencode($search_datelimit_end); + if ($search_date_startday) $param .= '&search_date_startday='.urlencode($search_date_startday); + if ($search_date_startmonth) $param .= '&search_date_startmonth='.urlencode($search_date_startmonth); + if ($search_date_startyear) $param .= '&search_date_startyear='.urlencode($search_date_startyear); + if ($search_date_endday) $param .= '&search_date_endday='.urlencode($search_date_endday); + if ($search_date_endmonth) $param .= '&search_date_endmonth='.urlencode($search_date_endmonth); + if ($search_date_endyear) $param .= '&search_date_endyear='.urlencode($search_date_endyear); + if ($search_date_valid_startday) $param .= '&search_date_valid_startday='.urlencode($search_date_valid_startday); + if ($search_date_valid_startmonth) $param .= '&search_date_valid_startmonth='.urlencode($search_date_valid_startmonth); + if ($search_date_valid_startyear) $param .= '&search_date_valid_startyear='.urlencode($search_date_valid_startyear); + if ($search_date_valid_endday) $param .= '&search_date_valid_endday='.urlencode($search_date_valid_endday); + if ($search_date_valid_endmonth) $param .= '&search_date_valid_endmonth='.urlencode($search_date_valid_endmonth); + if ($search_date_valid_endyear) $param .= '&search_date_valid_endyear='.urlencode($search_date_valid_endyear); + if ($search_datelimit_startday) $param .= '&search_datelimit_startday='.urlencode($search_datelimit_startday); + if ($search_datelimit_startmonth) $param .= '&search_datelimit_startmonth='.urlencode($search_datelimit_startmonth); + if ($search_datelimit_startyear) $param .= '&search_datelimit_startyear='.urlencode($search_datelimit_startyear); + if ($search_datelimit_endday) $param .= '&search_datelimit_endday='.urlencode($search_datelimit_endday); + if ($search_datelimit_endmonth) $param .= '&search_datelimit_endmonth='.urlencode($search_datelimit_endmonth); + if ($search_datelimit_endyear) $param .= '&search_datelimit_endyear='.urlencode($search_datelimit_endyear); if ($search_ref) $param .= '&search_ref='.urlencode($search_ref); if ($search_refcustomer) $param .= '&search_refcustomer='.urlencode($search_refcustomer); if ($search_project_ref) $param .= '&search_project_ref='.urlencode($search_project_ref); From 08186fdff155b6b261bba852cc6002e1554df5cf Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Thu, 10 Jun 2021 06:28:09 +0200 Subject: [PATCH 23/65] Fix warning - search_societe is already present --- htdocs/compta/facture/list.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 94326852d31..a704280a9f4 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -530,7 +530,6 @@ if ($search_zip) $sql .= natural_search("s.zip", $search_zip); if ($search_state) $sql .= natural_search("state.nom", $search_state); if ($search_country) $sql .= " AND s.fk_pays IN (".$db->escape($search_country).')'; if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$db->escape($search_type_thirdparty).')'; -if ($search_company) $sql .= natural_search('s.nom', $search_company); if ($search_montant_ht != '') $sql .= natural_search('f.total', $search_montant_ht, 1); if ($search_montant_vat != '') $sql .= natural_search('f.tva', $search_montant_vat, 1); if ($search_montant_localtax1 != '') $sql .= natural_search('f.localtax1', $search_montant_localtax1, 1); From 8a46fd376f3ce79dafb6e3719c89312a00248551 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 10 Jun 2021 12:58:42 +0200 Subject: [PATCH 24/65] Update commonobject.class.php --- htdocs/core/class/commonobject.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 1d0509d7483..1241a65f6e4 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -440,7 +440,7 @@ abstract class CommonObject /** * @var array List of child tables. To know object to delete on cascade. - * if name like with @ClassNAme:FilePathClass:ParentFkFieldName' it will + * if name like with @ClassName:FilePathClass:ParentFkFieldName' it will * call method deleteByParentField(parentId,ParentFkFieldName) to fetch and delete child object */ protected $childtablesoncascade = array(); From b7ba9df6b4e6c902fcce5c3dbe2506a3c80b2e97 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 10 Jun 2021 12:59:04 +0200 Subject: [PATCH 25/65] Update societe.class.php --- htdocs/societe/class/societe.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 9687485eb10..a58b93bdc96 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -84,7 +84,7 @@ class Societe extends CommonObject /** * @var array List of child tables. To know object to delete on cascade. - * if name like with @ClassNAme:FilePathClass:ParentFkFieldName' it will call method deleteByParentField (with parentId as parameters) and FieldName to fetch and delete child object + * if name like with @ClassName:FilePathClass:ParentFkFieldName' it will call method deleteByParentField (with parentId as parameters) and FieldName to fetch and delete child object */ protected $childtablesoncascade = array( "societe_prices", From 03cd88d145e0bafe3ea0799ea2530b18079c61b6 Mon Sep 17 00:00:00 2001 From: Alexis LAURIER Date: Thu, 10 Jun 2021 16:29:56 +0200 Subject: [PATCH 26/65] bugfix/supplierBankTransfertWrongCodeCheckMassAction --- htdocs/fourn/facture/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 317def67098..904de663e78 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -323,7 +323,7 @@ if (empty($reshook)) if ($numprlv > 0) { $error++; setEventMessages($objecttmp->ref.' '.$langs->trans("RequestAlreadyDone"), $objecttmp->errors, 'warnings'); - } elseif (!empty($objecttmp->mode_reglement_code) && $objecttmp->mode_reglement_code != 'PRE') { + } elseif (!empty($objecttmp->mode_reglement_code) && $objecttmp->mode_reglement_code != 'VIR') { $error++; setEventMessages($objecttmp->ref.' '.$langs->trans("BadPaymentMethod"), $objecttmp->errors, 'errors'); } else { From 1a2434818dff72954c1d661993af33b663728027 Mon Sep 17 00:00:00 2001 From: Alexis LAURIER Date: Thu, 10 Jun 2021 18:00:49 +0200 Subject: [PATCH 27/65] remove useless check on deposit line content when generating pdf --- htdocs/core/lib/pdf.lib.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 6e4cc60ce53..0a73b062ae3 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1272,9 +1272,7 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0, if (!empty($prodser->multilangs[$outputlangs->defaultlang]["note"]) && ($textwasmodified || $translatealsoifmodified)) $note = $prodser->multilangs[$outputlangs->defaultlang]["note"]; } } elseif ($object->element == 'facture' || $object->element == 'facturefourn') { - if ($object->type == $object::TYPE_DEPOSIT) { - $desc = str_replace('(DEPOSIT)', $outputlangs->trans('Deposit'), $desc); - } + $desc = str_replace('(DEPOSIT)', $outputlangs->trans('Deposit'), $desc); } // Description short of product line From 759472f5d1ff5c5439db59b261ba8a6dcf5f7a6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 10 Jun 2021 20:58:56 +0200 Subject: [PATCH 28/65] fix warning --- htdocs/core/class/discount.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/discount.class.php b/htdocs/core/class/discount.class.php index af336c38745..43a6bf50df6 100644 --- a/htdocs/core/class/discount.class.php +++ b/htdocs/core/class/discount.class.php @@ -519,7 +519,7 @@ class DiscountAbsolute //} if ($multicurrency) { - return $obj->amount_multicurrency; + return $obj->multicurrency_amount; } return $obj->amount; From 96656ff148feca5326b306535aea3989ea44e154 Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Thu, 10 Jun 2021 23:26:33 +0200 Subject: [PATCH 29/65] FIX: project time spent by day/week: quote mismatch is SQL query to assign to check task assigment --- htdocs/projet/activity/perday.php | 2 +- htdocs/projet/activity/perweek.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/projet/activity/perday.php b/htdocs/projet/activity/perday.php index 8215eec4258..199591922aa 100644 --- a/htdocs/projet/activity/perday.php +++ b/htdocs/projet/activity/perday.php @@ -210,7 +210,7 @@ if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('assigntask') { // Test if we are already contact of the project (should be rare but sometimes we can add as task contact without being contact of project, like when admin user has been removed from contact of project) $sql = 'SELECT ec.rowid FROM '.MAIN_DB_PREFIX.'element_contact as ec, '.MAIN_DB_PREFIX.'c_type_contact as tc WHERE tc.rowid = ec.fk_c_type_contact'; - $sql .= ' AND ec.fk_socpeople = '.$idfortaskuser." AND ec.element_id = '.$object->fk_project.' AND tc.element = 'project' AND source = 'internal'"; + $sql .= ' AND ec.fk_socpeople = '.$idfortaskuser." AND ec.element_id = ".$object->fk_project." AND tc.element = 'project' AND source = 'internal'"; $resql = $db->query($sql); if ($resql) { diff --git a/htdocs/projet/activity/perweek.php b/htdocs/projet/activity/perweek.php index 4488342ab73..0db7bf57f3a 100644 --- a/htdocs/projet/activity/perweek.php +++ b/htdocs/projet/activity/perweek.php @@ -224,7 +224,7 @@ if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('assigntask') { // Test if we are already contact of the project (should be rare but sometimes we can add as task contact without being contact of project, like when admin user has been removed from contact of project) $sql = 'SELECT ec.rowid FROM '.MAIN_DB_PREFIX.'element_contact as ec, '.MAIN_DB_PREFIX.'c_type_contact as tc WHERE tc.rowid = ec.fk_c_type_contact'; - $sql .= ' AND ec.fk_socpeople = '.$idfortaskuser." AND ec.element_id = '.$object->fk_project.' AND tc.element = 'project' AND source = 'internal'"; + $sql .= ' AND ec.fk_socpeople = '.$idfortaskuser." AND ec.element_id = ".$object->fk_project." AND tc.element = 'project' AND source = 'internal'"; $resql = $db->query($sql); if ($resql) { From 3f72f9b544106dbe9fb89fb7ba28a06f0c8944e0 Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Thu, 10 Jun 2021 23:29:37 +0200 Subject: [PATCH 30/65] FIX: project time spent by month: quote mismatch in SQL query to assign to check task assigment --- htdocs/projet/activity/permonth.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/activity/permonth.php b/htdocs/projet/activity/permonth.php index ae4eed48515..83680885fe5 100644 --- a/htdocs/projet/activity/permonth.php +++ b/htdocs/projet/activity/permonth.php @@ -170,7 +170,7 @@ if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('assigntask') { // Test if we are already contact of the project (should be rare but sometimes we can add as task contact without being contact of project, like when admin user has been removed from contact of project) $sql = 'SELECT ec.rowid FROM '.MAIN_DB_PREFIX.'element_contact as ec, '.MAIN_DB_PREFIX.'c_type_contact as tc WHERE tc.rowid = ec.fk_c_type_contact'; - $sql .= ' AND ec.fk_socpeople = '.$idfortaskuser." AND ec.element_id = '.$object->fk_project.' AND tc.element = 'project' AND source = 'internal'"; + $sql .= ' AND ec.fk_socpeople = '.$idfortaskuser." AND ec.element_id = ".$object->fk_project." AND tc.element = 'project' AND source = 'internal'"; $resql = $db->query($sql); if ($resql) { From 0315f4519878b570e79b69570b88e5ff8f71f773 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Jun 2021 18:10:57 +0200 Subject: [PATCH 31/65] Update permonth.php --- htdocs/projet/activity/permonth.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/activity/permonth.php b/htdocs/projet/activity/permonth.php index 83680885fe5..854c9194315 100644 --- a/htdocs/projet/activity/permonth.php +++ b/htdocs/projet/activity/permonth.php @@ -170,7 +170,7 @@ if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('assigntask') { // Test if we are already contact of the project (should be rare but sometimes we can add as task contact without being contact of project, like when admin user has been removed from contact of project) $sql = 'SELECT ec.rowid FROM '.MAIN_DB_PREFIX.'element_contact as ec, '.MAIN_DB_PREFIX.'c_type_contact as tc WHERE tc.rowid = ec.fk_c_type_contact'; - $sql .= ' AND ec.fk_socpeople = '.$idfortaskuser." AND ec.element_id = ".$object->fk_project." AND tc.element = 'project' AND source = 'internal'"; + $sql .= ' AND ec.fk_socpeople = '.((int) $idfortaskuser)." AND ec.element_id = ".((int) $object->fk_project)." AND tc.element = 'project' AND source = 'internal'"; $resql = $db->query($sql); if ($resql) { From 057d91698f52e5728525a1601f2bb69467be2543 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Jun 2021 18:11:55 +0200 Subject: [PATCH 32/65] Update perday.php --- htdocs/projet/activity/perday.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/activity/perday.php b/htdocs/projet/activity/perday.php index 199591922aa..5e288ae9aea 100644 --- a/htdocs/projet/activity/perday.php +++ b/htdocs/projet/activity/perday.php @@ -210,7 +210,7 @@ if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('assigntask') { // Test if we are already contact of the project (should be rare but sometimes we can add as task contact without being contact of project, like when admin user has been removed from contact of project) $sql = 'SELECT ec.rowid FROM '.MAIN_DB_PREFIX.'element_contact as ec, '.MAIN_DB_PREFIX.'c_type_contact as tc WHERE tc.rowid = ec.fk_c_type_contact'; - $sql .= ' AND ec.fk_socpeople = '.$idfortaskuser." AND ec.element_id = ".$object->fk_project." AND tc.element = 'project' AND source = 'internal'"; + $sql .= ' AND ec.fk_socpeople = '.((int) $idfortaskuser)." AND ec.element_id = ".((int) $object->fk_project)." AND tc.element = 'project' AND source = 'internal'"; $resql = $db->query($sql); if ($resql) { From a8f11fec31c4ec4e89ab08f82734dcb0ba96651f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Jun 2021 18:12:39 +0200 Subject: [PATCH 33/65] Update perweek.php --- htdocs/projet/activity/perweek.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/activity/perweek.php b/htdocs/projet/activity/perweek.php index 0db7bf57f3a..97626c58e50 100644 --- a/htdocs/projet/activity/perweek.php +++ b/htdocs/projet/activity/perweek.php @@ -224,7 +224,7 @@ if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('assigntask') { // Test if we are already contact of the project (should be rare but sometimes we can add as task contact without being contact of project, like when admin user has been removed from contact of project) $sql = 'SELECT ec.rowid FROM '.MAIN_DB_PREFIX.'element_contact as ec, '.MAIN_DB_PREFIX.'c_type_contact as tc WHERE tc.rowid = ec.fk_c_type_contact'; - $sql .= ' AND ec.fk_socpeople = '.$idfortaskuser." AND ec.element_id = ".$object->fk_project." AND tc.element = 'project' AND source = 'internal'"; + $sql .= ' AND ec.fk_socpeople = '.((int) $idfortaskuser)." AND ec.element_id = ".((int) $object->fk_project)." AND tc.element = 'project' AND source = 'internal'"; $resql = $db->query($sql); if ($resql) { From 4e66e134bdbc4367db57be045d5dad236f2c6094 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Jun 2021 18:21:00 +0200 Subject: [PATCH 34/65] Update price.php --- htdocs/product/price.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 27d39779338..61b2be4f837 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -349,7 +349,7 @@ if (empty($reshook)) $newprice = price2num($newprice, 'MU'); $newprice_min = price2num($val['price_min'], 'MU'); - $newvattx = price2num($val['vat_tx'], 'MU'); + $newvattx = price2num($val['vat_tx']); if (!empty($conf->global->PRODUCT_MINIMUM_RECOMMENDED_PRICE) && $newprice_min < $maxpricesupplier) { setEventMessages($langs->trans("MinimumPriceLimit", price($maxpricesupplier, 0, '', 1, - 1, - 1, 'auto')), null, 'errors'); From 663cf28eba4dfa4c66062a3d527b542a743864f7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Jun 2021 19:05:33 +0200 Subject: [PATCH 35/65] Fix lost code during previous merge --- htdocs/product/price.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 6b36e950f78..0c054eb012f 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -357,7 +357,7 @@ if (empty($reshook)) break; } - if ($object->multiprices[$key] != $newprice || $object->multiprices_min[$key] != $newprice_min || $object->multiprices_base_type[$key] != $val['price_base_type']) { + if ($object->multiprices[$key] != $newprice || $object->multiprices_min[$key] != $newprice_min || $object->multiprices_base_type[$key] != $val['price_base_type'] || $object->multiprices_tva_tx[$key] != $newvattx) { $res = $object->updatePrice($newprice, $val['price_base_type'], $user, $val['vat_tx'], $newprice_min, $key, $val['npr'], $psq, 0, $val['localtaxes_array'], $val['default_vat_code']); } else { $res = 0; From 0f91c4cfa26632460ab73303f5eea81715f12648 Mon Sep 17 00:00:00 2001 From: Adrien Raze Date: Mon, 14 Jun 2021 10:02:44 +0200 Subject: [PATCH 36/65] FIX : Allow to set bookmarks on list filtered by multiselect fields --- htdocs/bookmarks/bookmarks.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/bookmarks/bookmarks.lib.php b/htdocs/bookmarks/bookmarks.lib.php index 06f0b0e8fe7..18328e34e92 100644 --- a/htdocs/bookmarks/bookmarks.lib.php +++ b/htdocs/bookmarks/bookmarks.lib.php @@ -53,7 +53,7 @@ function printDropdownBookmarksList() { foreach ($_POST as $key => $val) { - if (preg_match('/^search_/', $key) && $val != '') $tmpurl .= ($tmpurl ? '&' : '').$key.'='.$val; + if (preg_match('/^search_/', $key) && $val != '') $tmpurl .= ($tmpurl ? '&' : '').http_build_query(array($key => $val)); } } $url .= ($tmpurl ? '?'.$tmpurl : ''); From dcca3011eed8bc4f15d191cb56f5839f1729196c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 14 Jun 2021 14:41:50 +0200 Subject: [PATCH 37/65] Clean code --- .../triggers/interface_90_modSociete_ContactRoles.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/triggers/interface_90_modSociete_ContactRoles.class.php b/htdocs/core/triggers/interface_90_modSociete_ContactRoles.class.php index b15113c9c08..2dcbe590692 100644 --- a/htdocs/core/triggers/interface_90_modSociete_ContactRoles.class.php +++ b/htdocs/core/triggers/interface_90_modSociete_ContactRoles.class.php @@ -84,7 +84,7 @@ class InterfaceContactRoles extends DolibarrTriggers if (is_array($TContact) && ! empty($TContact)) { $TContactAlreadyLinked = array(); if ($object->id > 0) { - $TContactAlreadyLinked = array_merge($object->liste_contact(- 1, 'external'), $object->liste_contact(- 1, 'internal')); + $TContactAlreadyLinked = array_merge($object->liste_contact(-1, 'external'), $object->liste_contact(-1, 'internal')); } foreach ($TContact as $i => $infos) { From e81023c35a01868b9447867d54d3fa0260416aee Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 14 Jun 2021 15:12:08 +0200 Subject: [PATCH 38/65] Update doc --- doc/index.html | 2 -- doc/install/README | 2 +- doc/install/README-DE | 2 +- doc/install/README-FR | 8 +++----- doc/user/README | 1 + doc/user/README-FR | 5 +---- 6 files changed, 7 insertions(+), 13 deletions(-) diff --git a/doc/index.html b/doc/index.html index 5c655136e3e..385c7a63c3a 100644 --- a/doc/index.html +++ b/doc/index.html @@ -17,8 +17,6 @@ on Internet on web following sites:

* Dolibarr demo (online)

-* DoliWamp, the Dolibarr for Windows
-
* DoliStore (official addons/plugins market place)
diff --git a/doc/install/README b/doc/install/README index 0c7341b196c..0192ff27521 100644 --- a/doc/install/README +++ b/doc/install/README @@ -19,7 +19,7 @@ Download Install -------------------------------- -* For a Quick guide, take a look at README file into root directory. +* For a Quick guide, take a look at README.md file into root directory. * More complete documentations are also available on line on the Dolibarr Wiki: https://wiki.dolibarr.org diff --git a/doc/install/README-DE b/doc/install/README-DE index c7ece3891f3..e616cd404fe 100644 --- a/doc/install/README-DE +++ b/doc/install/README-DE @@ -22,7 +22,7 @@ Download / Herunterladen Installation -------------------------------- -* Für eine kurze Einleitung, schau auf die README Datei im Hauptverzeichnis. +* Für eine kurze Einleitung, schau auf die README.md Datei im Hauptverzeichnis. * Umfangreiche Dokumentationen sind im Dolibarr Wiki zu finden: https://wiki.dolibarr.org/index.php/Hauptseite diff --git a/doc/install/README-FR b/doc/install/README-FR index 2cee29cf2df..211c76e1851 100644 --- a/doc/install/README-FR +++ b/doc/install/README-FR @@ -19,9 +19,7 @@ https://www.dolistore.org Documentation utilisateur -------------------------------- -* Pour une prise en main et installation rapide, consultez le fichier -README-FR à la racine. +* Pour une prise en main et installation rapide, consultez le fichier README-FR.md à la racine. -* Une documentation utilisateur francophone plus consistante est disponible en -ligne sur le wiki de Dolibarr à l'adresse: -https://wiki.dolibarr.org +* Une documentation utilisateur francophone plus consistante est disponible en ligne sur le wiki de Dolibarr à l'adresse: + https://wiki.dolibarr.org diff --git a/doc/user/README b/doc/user/README index 129dff11058..ecde765cde3 100644 --- a/doc/user/README +++ b/doc/user/README @@ -4,4 +4,5 @@ User guide -------------------------------- * All Dolibarr guides are available, on line, on the Dolibarr Web site: + https://www.dolibarr.org diff --git a/doc/user/README-FR b/doc/user/README-FR index fbf67fd89bc..f5cb72ea1c6 100644 --- a/doc/user/README-FR +++ b/doc/user/README-FR @@ -3,9 +3,6 @@ README (french) Documentation utilisateur -------------------------------- -* Pour une prise en main et installation rapide, consultez le fichier -README-FR à la racine. +La documentation utilisateur francophone est disponible en ligne sur le site Web de Dolibarr à l'adresse: -* Une documentation utilisateur francophone plus consistante est disponible en -ligne sur le site Web de Dolibarr à l'adresse: https://www.dolibarr.fr From c8a41fab11b48b751f28a2c02719e311d90dbc5e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 14 Jun 2021 15:24:50 +0200 Subject: [PATCH 39/65] Doc --- doc/user/{README-DE.md => README-DE} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename doc/user/{README-DE.md => README-DE} (100%) diff --git a/doc/user/README-DE.md b/doc/user/README-DE similarity index 100% rename from doc/user/README-DE.md rename to doc/user/README-DE From a79afeaf02fe23c0e8d2c9c46c2a45248dabff7b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 14 Jun 2021 19:58:12 +0200 Subject: [PATCH 40/65] Add info to allow debug of email collector --- .../class/emailcollector.class.php | 2 +- htdocs/langs/en_US/main.lang | 1 + htdocs/projet/class/project.class.php | 1 + htdocs/projet/list.php | 18 +++++++++++++++++- 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index b01f1883d53..ec5e33d8bb3 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -1539,7 +1539,7 @@ class EmailCollector extends CommonObject // Make Operation dol_syslog("Execute action ".$operation['type']." actionparam=".$operation['actionparam'].' thirdpartystatic->id='.$thirdpartystatic->id.' contactstatic->id='.$contactstatic->id.' projectstatic->id='.$projectstatic->id); - dol_syslog("Execute action fk_element_id=".$fk_element_id." fk_element_type=".$fk_element_type); + dol_syslog("Execute action fk_element_id=".$fk_element_id." fk_element_type=".$fk_element_type); // If a Dolibarr tracker id is found, we should now the id of object $actioncode = 'EMAIL_IN'; // If we scan the Sent box, we use the code for out email diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 39517ca2e1b..86c38e39b8b 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -1117,3 +1117,4 @@ UpdateForAllLines=Update for all lines OnHold=On hold Civility=Civility InformationOnLinkToContract=This amount is only the total of all the lines of the contract. No notion of time is taken into consideration. +EmailMsgID=Email MsgID diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index c6e9799afa7..54e0f87a358 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -206,6 +206,7 @@ class Project extends CommonObject 'fk_user_creat' =>array('type'=>'integer', 'label'=>'UserCreation', 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>210), 'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModification', 'enabled'=>1, 'visible'=>0, 'position'=>215), 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>0, 'position'=>220), + 'email_msgid'=>array('type'=>'varchar(255)', 'label'=>'EmailMsgID', 'enabled'=>1, 'visible'=>-1, 'position'=>250, 'help'=>'EmailMsgIDWhenSourceisEmail'), 'fk_statut' =>array('type'=>'smallint(6)', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>500) ); // END MODULEBUILDER PROPERTIES diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 4438a9ce217..96c960e58d1 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -25,7 +25,7 @@ /** * \file htdocs/projet/list.php - * \ingroup projet + * \ingroup project * \brief Page to list projects */ @@ -300,6 +300,7 @@ if (count($listofprojectcontacttype) == 0) $listofprojectcontacttype[0] = '0'; / $distinct = 'DISTINCT'; // We add distinct until we are added a protection to be sure a contact of a project and task is only once. $sql = "SELECT ".$distinct." p.rowid as id, p.ref, p.title, p.fk_statut as status, p.fk_opp_status, p.public, p.fk_user_creat"; $sql .= ", p.datec as date_creation, p.dateo as date_start, p.datee as date_end, p.opp_amount, p.opp_percent, (p.opp_amount*p.opp_percent/100) as opp_weighted_amount, p.tms as date_update, p.budget_amount, p.usage_opportunity, p.usage_task, p.usage_bill_time"; +$sql .= ", p.email_msgid"; $sql .= ", s.rowid as socid, s.nom as name, s.email"; $sql .= ", cls.code as opp_status_code"; // Add fields from extrafields @@ -668,6 +669,12 @@ if (!empty($arrayfields['p.tms']['checked'])) print ''; print ''; } +if (!empty($arrayfields['p.email_msgid']['checked'])) +{ + // Email msg id + print ''; + print ''; +} if (!empty($arrayfields['p.fk_statut']['checked'])) { print ''; @@ -710,6 +717,7 @@ $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // No print $hookmanager->resPrint; if (!empty($arrayfields['p.datec']['checked'])) print_liste_field_titre($arrayfields['p.datec']['label'], $_SERVER["PHP_SELF"], "p.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap '); if (!empty($arrayfields['p.tms']['checked'])) print_liste_field_titre($arrayfields['p.tms']['label'], $_SERVER["PHP_SELF"], "p.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap '); +if (!empty($arrayfields['p.email_msgid']['checked'])) print_liste_field_titre($arrayfields['p.email_msgid']['label'], $_SERVER["PHP_SELF"], "p.email_msgid", "", $param, '', $sortfield, $sortorder, 'center '); if (!empty($arrayfields['p.fk_statut']['checked'])) print_liste_field_titre($arrayfields['p.fk_statut']['label'], $_SERVER["PHP_SELF"], "p.fk_statut", "", $param, '', $sortfield, $sortorder, 'right '); print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); print "\n"; @@ -948,6 +956,14 @@ while ($i < min($num, $limit)) print ''; if (!$i) $totalarray['nbfield']++; } + // Email MsgID + if (!empty($arrayfields['p.email_msgid']['checked'])) + { + print ''; + print $obj->email_msgid; + print ''; + if (!$i) $totalarray['nbfield']++; + } // Status if (!empty($arrayfields['p.fk_statut']['checked'])) { From d154ec2344f67756552f0e35b98595341cea9c36 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 14 Jun 2021 20:06:52 +0200 Subject: [PATCH 41/65] FIX Collector to create lead was broken --- htdocs/comm/action/class/actioncomm.class.php | 4 ++++ htdocs/projet/class/project.class.php | 4 +++- htdocs/ticket/class/ticket.class.php | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index f7e0ef6acb1..d094fb0bab4 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -683,6 +683,10 @@ class ActionComm extends CommonObject { global $langs; + if (empty($id) && empty($ref) && empty($ref_ext) && empty($email_msgid)) { + return -1; + } + $sql = "SELECT a.id,"; $sql .= " a.id as ref,"; $sql .= " a.entity,"; diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 54e0f87a358..c5dd1045f03 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -526,7 +526,9 @@ class Project extends CommonObject { global $conf; - if (empty($id) && empty($ref)) return -1; + if (empty($id) && empty($ref) && empty($ref_ext) && empty($email_msgid)) { + return -1; + } $sql = "SELECT rowid, entity, ref, title, description, public, datec, opp_amount, budget_amount,"; $sql .= " tms, dateo, datee, date_close, fk_soc, fk_user_creat, fk_user_modif, fk_user_close, fk_statut as status, fk_opp_status, opp_percent,"; diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 5f95c7f0dc5..20d63cea600 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -529,7 +529,7 @@ class Ticket extends CommonObject global $langs; // Check parameters - if (!$id && !$track_id && !$ref && !$email_msgid) { + if (empty($id) && empty($ref) && empty($track_id) && empty($email_msgid)) { $this->error = 'ErrorWrongParameters'; dol_print_error(get_class($this)."::fetch ".$this->error); return -1; From 9ff0efbcc2c04da094507ed8cdcb662fec0686aa Mon Sep 17 00:00:00 2001 From: kevin Date: Tue, 15 Jun 2021 12:04:24 +0200 Subject: [PATCH 42/65] FIX fatal error when adding message to a ticket --- htdocs/ticket/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index 5ed28094e39..85e88ce012c 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -1317,7 +1317,7 @@ elseif (empty($action) || $action == 'view' || $action == 'addlink' || $action = // Substitution array $morehtmlright = ''; $help = ""; - $substitutionarray = getCommonSubstitutionArray($newlang, 0, $arrayoffamiliestoexclude, $object); + $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, $arrayoffamiliestoexclude, $object); if ($object->fk_soc > 0) { $substitutionarray['__THIRDPARTY_NAME__'] = $object->thirdparty->name; } From 78f41bf60e4ae95a9b3978cfc5d2a60e2b97a5ce Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 15 Jun 2021 22:04:31 +0200 Subject: [PATCH 43/65] Update card.php --- htdocs/ticket/card.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index 85e88ce012c..8a571ace839 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -1305,10 +1305,14 @@ elseif (empty($action) || $action == 'view' || $action == 'addlink' || $action = $newlang = ''; if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) { $newlang = GETPOST('lang_id', 'aZ09'); - } - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && is_object($object->thirdparty)) { + } elseif ($conf->global->MAIN_MULTILANGS && empty($newlang) && is_object($object->thirdparty)) { $newlang = $object->thirdparty->default_lang; } + if (!empty($newlang)) { + $outputlangs = new Translate("", $conf); + $outputlangs->setDefaultLang($newlang); + } + $arrayoffamiliestoexclude = array('objectamount'); $action = 'add_message'; // action to use to post the message From 5ddf12b29c0eab546d9f53972a977feebce08558 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 15 Jun 2021 22:06:26 +0200 Subject: [PATCH 44/65] Fix set language --- htdocs/core/actions_massactions.inc.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 3cbcd30af7f..60b386ce083 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -956,8 +956,11 @@ if (!$error && $massaction == "builddoc" && $permissiontoread && !GETPOST('butto // Define output language (Here it is not used because we do only merging existing PDF) $outputlangs = $langs; $newlang = ''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09'); - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $objecttmp->thirdparty->default_lang; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) { + $newlang = GETPOST('lang_id', 'aZ09'); + } elseif ($conf->global->MAIN_MULTILANGS && empty($newlang) && is_object($objecttmp->thirdparty)) { + $newlang = $objecttmp->thirdparty->default_lang; + } if (!empty($newlang)) { $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); From 26cae49fafb59deb74d4938c63acaadb8ebc00ec Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 15 Jun 2021 20:06:48 +0000 Subject: [PATCH 45/65] Fixing style errors. --- htdocs/ticket/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index 8a571ace839..687aca67378 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -1312,7 +1312,7 @@ elseif (empty($action) || $action == 'view' || $action == 'addlink' || $action = $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); } - + $arrayoffamiliestoexclude = array('objectamount'); $action = 'add_message'; // action to use to post the message From 2a3b330e1ef03a0f6989df30be4dfe1683565f38 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 15 Jun 2021 22:10:59 +0200 Subject: [PATCH 46/65] Fix newToken() --- htdocs/contact/canvas/default/tpl/contactcard_create.tpl.php | 2 +- htdocs/contact/canvas/default/tpl/contactcard_edit.tpl.php | 2 +- htdocs/core/tpl/admin_extrafields_add.tpl.php | 2 +- htdocs/core/tpl/contacts.tpl.php | 4 ++-- htdocs/core/tpl/passwordforgotten.tpl.php | 2 +- htdocs/product/canvas/product/tpl/card_create.tpl.php | 2 +- htdocs/product/canvas/product/tpl/card_edit.tpl.php | 2 +- htdocs/product/canvas/service/tpl/card_create.tpl.php | 2 +- htdocs/product/canvas/service/tpl/card_edit.tpl.php | 2 +- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/htdocs/contact/canvas/default/tpl/contactcard_create.tpl.php b/htdocs/contact/canvas/default/tpl/contactcard_create.tpl.php index 98a66e499b9..14186afbff1 100644 --- a/htdocs/contact/canvas/default/tpl/contactcard_create.tpl.php +++ b/htdocs/contact/canvas/default/tpl/contactcard_create.tpl.php @@ -40,7 +40,7 @@ echo $this->control->tpl['ajax_selectcountry']; ?>
"> - + control->tpl['company_id']) { ?> diff --git a/htdocs/contact/canvas/default/tpl/contactcard_edit.tpl.php b/htdocs/contact/canvas/default/tpl/contactcard_edit.tpl.php index 2c82a868ed4..a9cd393866b 100644 --- a/htdocs/contact/canvas/default/tpl/contactcard_edit.tpl.php +++ b/htdocs/contact/canvas/default/tpl/contactcard_edit.tpl.php @@ -40,7 +40,7 @@ echo $this->control->tpl['ajax_selectcountry'];
"> - + diff --git a/htdocs/core/tpl/admin_extrafields_add.tpl.php b/htdocs/core/tpl/admin_extrafields_add.tpl.php index 2a9438f4413..657e29dc8f1 100644 --- a/htdocs/core/tpl/admin_extrafields_add.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_add.tpl.php @@ -141,7 +141,7 @@ $listofexamplesforlink = 'Societe:societe/class/societe.class.php
Contact:con " method="post"> - + diff --git a/htdocs/core/tpl/contacts.tpl.php b/htdocs/core/tpl/contacts.tpl.php index a1abc3a9240..7ea32370fcd 100644 --- a/htdocs/core/tpl/contacts.tpl.php +++ b/htdocs/core/tpl/contacts.tpl.php @@ -96,7 +96,7 @@ if ($permission) { ?> " /> + @@ -121,7 +121,7 @@ if ($permission) ?> " /> + diff --git a/htdocs/core/tpl/passwordforgotten.tpl.php b/htdocs/core/tpl/passwordforgotten.tpl.php index 937ee63a68c..ac2dba0c233 100644 --- a/htdocs/core/tpl/passwordforgotten.tpl.php +++ b/htdocs/core/tpl/passwordforgotten.tpl.php @@ -74,7 +74,7 @@ $(document).ready(function () {