From 89e8889c5c4d193d9528d257968cb975761f73c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 19 Mar 2019 16:33:34 +0100 Subject: [PATCH 1/3] phpcs fix v9 --- htdocs/compta/facture/card.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 7ccbb4c0366..dd9de10b970 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -1301,7 +1301,6 @@ if (empty($reshook)) $tva_tx = $lines[$i]->tva_tx; $amountdeposit[$tva_tx] += ($lines[$i]->total_ht * $valuedeposit) / 100; } - } if($totalamount == 0) { From a1fe1bb58c60ea1ff545c7e9362d9dbd8b87d11d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Mar 2019 12:33:39 +0100 Subject: [PATCH 2/3] FIX when 2 extra fields are mandatory in 2 different entities --- htdocs/core/class/commonobject.class.php | 12 +++++++++--- htdocs/core/class/extrafields.class.php | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 90bd03513fe..f0fe7bf437c 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4997,7 +4997,10 @@ abstract class CommonObject { foreach($extrafields->attributes[$this->table_element]['mandatoryfieldsofotherentities'] as $tmpkey => $tmpval) { - $sql.=",".$tmpkey; + if (! isset($extrafields->attributes[$this->table_element]['type'][$tmpkey])) // If field not already added previously + { + $sql.=",".$tmpkey; + } } } $sql .= ") VALUES (".$this->id; @@ -5023,8 +5026,11 @@ abstract class CommonObject { foreach($extrafields->attributes[$this->table_element]['mandatoryfieldsofotherentities'] as $tmpkey => $tmpval) { - if (in_array($tmpval, array('int', 'double'))) $sql.=", 0"; - else $sql.=", ''"; + if (! isset($extrafields->attributes[$this->table_element]['type'][$tmpkey])) // If field not already added previously + { + if (in_array($tmpval, array('int', 'double'))) $sql.=", 0"; + else $sql.=", ''"; + } } } diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 6e92509756f..6babf6709d8 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -796,7 +796,7 @@ class ExtraFields { if ($tab->entity != 0 && $tab->entity != $conf->entity) { - // This field is not in current entity. We discard but before we save it into the array of mandatory fields if it is a mandatory field + // This field is not in current entity. We discard but before we save it into the array of mandatory fields if it is a mandatory field without default value if ($tab->fieldrequired && is_null($tab->fielddefault)) { $this->attributes[$tab->elementtype]['mandatoryfieldsofotherentities'][$tab->name]=$tab->type; From e0d89101df533578ae90bc30d2a3acf0e60d42dc Mon Sep 17 00:00:00 2001 From: Mathieu Pellegrin Date: Thu, 21 Mar 2019 12:06:43 +0100 Subject: [PATCH 3/3] #9480 Password link broken if login contains space --- htdocs/user/class/user.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index a5a81b48869..a02b4916c91 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -1963,7 +1963,7 @@ class User extends CommonObject } else { - $url = $urlwithroot.'/user/passwordforgotten.php?action=validatenewpassword&username='.$this->login."&passwordhash=".dol_hash($password); + $url = $urlwithroot.'/user/passwordforgotten.php?action=validatenewpassword&username='.urlencode($this->login)."&passwordhash=".dol_hash($password); $mesg.= $outputlangs->transnoentitiesnoconv("RequestToResetPasswordReceived")."\n"; $mesg.= $outputlangs->transnoentitiesnoconv("NewKeyWillBe")." :\n\n";