From 08453a53373ba1f2fe725391c0df71c376161320 Mon Sep 17 00:00:00 2001 From: tarrsalah Date: Thu, 13 Sep 2018 10:55:34 +0100 Subject: [PATCH] FIX #9497 Extract $defaultcode and $defaulttxt from the value returned by get_default_tva function . --- htdocs/core/class/html.form.class.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 23c48d93adb..54b378ad281 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -4711,6 +4711,10 @@ class Form $tmpthirdparty=new Societe($this->db); $defaulttx=get_default_tva($societe_vendeuse, (is_object($societe_acheteuse)?$societe_acheteuse:$tmpthirdparty), $idprod); $defaultnpr=get_default_npr($societe_vendeuse, (is_object($societe_acheteuse)?$societe_acheteuse:$tmpthirdparty), $idprod); + if (preg_match('/\((.*)\)/', $defaulttx, $reg)) { + $defaultcode=$reg[1]; + $defaulttx=preg_replace('/\s*\(.*\)/','',$defaulttx); + } if (empty($defaulttx)) $defaultnpr=0; }