From 2e7371eee649798adbab3d73dcbb54773ba73bde Mon Sep 17 00:00:00 2001 From: Guenter Lukas Date: Mon, 6 Feb 2023 08:45:44 +0100 Subject: [PATCH 1/9] Fix #23795 --- htdocs/comm/propal/card.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index eb8ac018979..c702cf66434 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -132,7 +132,6 @@ $permissiontoedit = $usercancreate; // Used by the include of actions_lineupdown // Security check if (!empty($user->socid)) { $socid = $user->socid; - $object->id = $user->socid; } restrictedArea($user, 'propal', $object->id); From 89a2f7a0c10054de042ec5fe33be3a4004c67c5a Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 14 Feb 2023 10:53:59 +0100 Subject: [PATCH 2/9] FIX multicompany compatibility --- htdocs/core/lib/signature.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/signature.lib.php b/htdocs/core/lib/signature.lib.php index c59acbea209..600f3878a0a 100644 --- a/htdocs/core/lib/signature.lib.php +++ b/htdocs/core/lib/signature.lib.php @@ -120,7 +120,7 @@ function getOnlineSignatureUrl($mode, $type, $ref = '', $localorexternal = 1) // For multicompany if (!empty($out) && !empty($conf->multicompany->enabled)) { - $out .= "&entity=".$conf->entity; // Check the entity because we may have the same reference in several entities + $out .= "&entity=".$object->entity; // Check the entity because we may have the same reference in several entities } return $out; From 670ae506e3f940ee42d21f1e51f86adb0c038945 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Wed, 15 Feb 2023 10:47:25 +0100 Subject: [PATCH 3/9] Fix: Bad assignation for external users access --- htdocs/comm/propal/card.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 3a037d4b4a2..b36415f5b15 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -5,7 +5,7 @@ * Copyright (C) 2005 Marc Barilley / Ocebo * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2006 Andre Cianfarani - * Copyright (C) 2010-2016 Juanjo Menent + * Copyright (C) 2010-2023 Juanjo Menent * Copyright (C) 2010-2021 Philippe Grand * Copyright (C) 2012-2013 Christophe Battarel * Copyright (C) 2012 Cedric Salvador @@ -131,7 +131,6 @@ $permissiontoedit = $usercancreate; // Used by the include of actions_lineupdown // Security check if (!empty($user->socid)) { $socid = $user->socid; - $object->id = $user->socid; } restrictedArea($user, 'propal', $object->id); From 7653a7126b0280982664922ed1002284f1d8831a Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 15 Feb 2023 13:47:55 +0100 Subject: [PATCH 4/9] FIX wrong url param name action --- htdocs/core/multicompany_page.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/multicompany_page.php b/htdocs/core/multicompany_page.php index 4a3bcba51fb..1161b7f07c9 100644 --- a/htdocs/core/multicompany_page.php +++ b/htdocs/core/multicompany_page.php @@ -19,7 +19,7 @@ */ /** - * \file htdocs/multicompany_page.php + * \file htdocs/core/multicompany_page.php * \brief File to return a page with the list of all entities user can switch to */ @@ -41,7 +41,7 @@ if (!defined('NOREQUIREMENU')) { require_once '../main.inc.php'; -$action = GETPOST('action', 'aZ09'); +$action = GETPOST('action', 'aZ'); $entityid = GETPOST('entity', 'int'); $backtourl = GETPOST('backtourl'); if (empty($backtourl)) { @@ -63,7 +63,7 @@ $left = ($langs->trans("DIRECTION") == 'rtl' ? 'right' : 'left'); * Actions */ -if (GETPOST('acction', 'aZ') == 'switchentity') { +if ($action == 'switchentity') { if (is_object($mc)) { $mc->switchEntity($entityid); } From f24ffe5b91da2b2a3187cf4a98a8ad4ac41645b6 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Thu, 16 Feb 2023 10:20:37 +0100 Subject: [PATCH 5/9] Supplier proposal - List - SQL error on total_ht --- htdocs/supplier_proposal/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index ba68fb82a77..c179b44146e 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -344,7 +344,7 @@ if ($search_login) { $sql .= natural_search(array('u.lastname', 'u.firstname', 'u.login'), $search_login); } if ($search_montant_ht) { - $sql .= natural_search('sp.total_ht=', $search_montant_ht, 1); + $sql .= natural_search('sp.total_ht', $search_montant_ht, 1); } if ($search_montant_vat != '') { $sql .= natural_search("sp.total_tva", $search_montant_vat, 1); From 9e1b8bcd4ca7aa6e53730a9e9147a2ae6cc2e004 Mon Sep 17 00:00:00 2001 From: GregM Date: Thu, 16 Feb 2023 11:33:43 +0100 Subject: [PATCH 6/9] FIX parse error and NAN --- htdocs/compta/resultat/result.php | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/resultat/result.php b/htdocs/compta/resultat/result.php index bf7eee28609..4d2aa61673f 100644 --- a/htdocs/compta/resultat/result.php +++ b/htdocs/compta/resultat/result.php @@ -333,6 +333,9 @@ if ($modecompta == 'CREANCES-DETTES') { // Previous Fiscal year (N-1) foreach ($sommes as $code => $det) { + if (is_null($det['NP'])){ + $det['NP'] = 0; + } $vars[$code] = $det['NP']; } @@ -340,8 +343,11 @@ if ($modecompta == 'CREANCES-DETTES') { //var_dump($result); //$r = $AccCat->calculate($result); + $r = dol_eval($result, 1, 1, '1'); - //var_dump($r); + if (is_nan($r)){ + $r = 0; + } print ''.price($r).''; @@ -360,6 +366,9 @@ if ($modecompta == 'CREANCES-DETTES') { //$r = $AccCat->calculate($result); $r = dol_eval($result, 1, 1, 1); + if (is_nan($r)){ + $r = 0; + } print ''.price($r).''; $sommes[$code]['N'] += $r; @@ -374,6 +383,9 @@ if ($modecompta == 'CREANCES-DETTES') { //$r = $AccCat->calculate($result); $r = dol_eval($result, 1, 1, 1); + if (is_nan($r)){ + $r = 0; + } print ''.price($r).''; $sommes[$code]['M'][$k] += $r; @@ -388,6 +400,9 @@ if ($modecompta == 'CREANCES-DETTES') { //$r = $AccCat->calculate($result); $r = dol_eval($result, 1, 1, 1); + if (is_nan($r)){ + $r = 0; + } print ''.price($r).''; $sommes[$code]['M'][$k] += $r; @@ -416,8 +431,10 @@ if ($modecompta == 'CREANCES-DETTES') { $arrayofaccountforfilter = array(); - foreach ($cpts as $i => $cpt) { // Loop on each account. - $arrayofaccountforfilter[] = $cpt['account_number']; + foreach ($cpts as $i => $cpt) {// Loop on each account. + if (!empty($cpt['account_number'])){ + $arrayofaccountforfilter[] = $cpt['account_number']; + } } // N-1 From 390e7c83b2ae12861b3c43d90da8c8b97174e0a9 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 16 Feb 2023 10:48:41 +0000 Subject: [PATCH 7/9] Fixing style errors. --- htdocs/compta/resultat/result.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/compta/resultat/result.php b/htdocs/compta/resultat/result.php index 4d2aa61673f..1a31c3d7eb1 100644 --- a/htdocs/compta/resultat/result.php +++ b/htdocs/compta/resultat/result.php @@ -333,7 +333,7 @@ if ($modecompta == 'CREANCES-DETTES') { // Previous Fiscal year (N-1) foreach ($sommes as $code => $det) { - if (is_null($det['NP'])){ + if (is_null($det['NP'])) { $det['NP'] = 0; } $vars[$code] = $det['NP']; @@ -345,7 +345,7 @@ if ($modecompta == 'CREANCES-DETTES') { //$r = $AccCat->calculate($result); $r = dol_eval($result, 1, 1, '1'); - if (is_nan($r)){ + if (is_nan($r)) { $r = 0; } @@ -366,7 +366,7 @@ if ($modecompta == 'CREANCES-DETTES') { //$r = $AccCat->calculate($result); $r = dol_eval($result, 1, 1, 1); - if (is_nan($r)){ + if (is_nan($r)) { $r = 0; } @@ -383,7 +383,7 @@ if ($modecompta == 'CREANCES-DETTES') { //$r = $AccCat->calculate($result); $r = dol_eval($result, 1, 1, 1); - if (is_nan($r)){ + if (is_nan($r)) { $r = 0; } @@ -400,7 +400,7 @@ if ($modecompta == 'CREANCES-DETTES') { //$r = $AccCat->calculate($result); $r = dol_eval($result, 1, 1, 1); - if (is_nan($r)){ + if (is_nan($r)) { $r = 0; } @@ -432,7 +432,7 @@ if ($modecompta == 'CREANCES-DETTES') { $arrayofaccountforfilter = array(); foreach ($cpts as $i => $cpt) {// Loop on each account. - if (!empty($cpt['account_number'])){ + if (!empty($cpt['account_number'])) { $arrayofaccountforfilter[] = $cpt['account_number']; } } From 33e345a280ea993804ca0532776a547df6667d5a Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 16 Feb 2023 15:51:55 +0100 Subject: [PATCH 8/9] FIX missing getEntity filter --- htdocs/core/lib/invoice.lib.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/invoice.lib.php b/htdocs/core/lib/invoice.lib.php index 43e4879e62f..b532b9db108 100644 --- a/htdocs/core/lib/invoice.lib.php +++ b/htdocs/core/lib/invoice.lib.php @@ -281,13 +281,16 @@ function getNumberInvoicesPieChart($mode) $sql .= ", sum(".$db->ifsql("f.date_lim_reglement > '".date_format($datenowadd15, 'Y-m-d')."'", 1, 0).") as nbnotlate15"; $sql .= ", sum(".$db->ifsql("f.date_lim_reglement > '".date_format($datenowadd30, 'Y-m-d')."'", 1, 0).") as nbnotlate30"; if ($mode == 'customers') { + $element = 'invoice'; $sql .= " FROM ".MAIN_DB_PREFIX."facture as f"; } elseif ($mode == 'fourn' || $mode == 'suppliers') { + $element = 'supplier_invoice'; $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f"; } else { return ''; } - $sql .= " WHERE f.type <> 2"; + $sql .= " WHERE f.entity IN (".getEntity($element).")"; + $sql .= " AND f.type <> 2"; $sql .= " AND f.fk_statut = 1"; if (isset($user->socid) && $user->socid > 0) { $sql .= " AND f.fk_soc = ".((int) $user->socid); From bf9a44ac6faab0ef0abeda1d329011c14236b0fe Mon Sep 17 00:00:00 2001 From: Eric Seigne Date: Thu, 16 Feb 2023 21:48:55 +0100 Subject: [PATCH 9/9] msg is not defined --- htdocs/core/class/CMailFile.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 67c3387fbc8..f16bfb856b1 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -60,6 +60,7 @@ class CMailFile public $atleastonefile; + public $msg; public $eol; public $eol2;