From adda3144bc0c16d1c5b761536fc5c0ad2cbc4db7 Mon Sep 17 00:00:00 2001 From: patrick Delcroix Date: Sat, 26 May 2018 23:39:36 +0200 Subject: [PATCH] Fix Show double(x,y) fields --- htdocs/core/class/commonobject.class.php | 7 +++---- htdocs/core/lib/modulebuilder.lib.php | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 62c3176e829..7d3c6648353 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -5118,11 +5118,10 @@ $val=$this->fields[$key]; { $morecss = 'minwidth200imp'; } - elseif (in_array($type,array('int','integer','double','price'))) + elseif (in_array($type,array('int','integer','price')) || preg_match('/^double(\([0-9],[0-9]\)){0,1}/',$type)) { $morecss = 'maxwidth75'; - } - elseif ($type == 'url') + }elseif ($type == 'url') { $morecss='minwidth400'; } @@ -5217,7 +5216,7 @@ $val=$this->fields[$key]; } $out=' '.$langs->getCurrencySymbol($conf->currency); } - elseif ($type == 'double') + elseif (preg_match('/^double(\([0-9],[0-9]\)){0,1}/',$type)) { if (!empty($value)) { // $value in memory is a php numeric, we format it into user number format. $value=price($value); diff --git a/htdocs/core/lib/modulebuilder.lib.php b/htdocs/core/lib/modulebuilder.lib.php index 81cf2b99c55..978e3bdf246 100644 --- a/htdocs/core/lib/modulebuilder.lib.php +++ b/htdocs/core/lib/modulebuilder.lib.php @@ -263,8 +263,8 @@ function rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir='', $type = preg_replace('/:.*$/', '', $type); // For case type = 'integer:Societe:societe/class/societe.class.php' if ($type == 'html') $type = 'text'; // html modulebuilder type is a text type in database - if ($type == 'price') $type = 'double'; // html modulebuilder type is a text type in database - + else if ($type == 'price') $type = 'double'; // html modulebuilder type is a text type in database + else if ($type == 'link' || $type == 'sellist') $type = 'integer'; $texttoinsert.= "\t".$key." ".$type; if ($key == 'rowid') $texttoinsert.= ' AUTO_INCREMENT PRIMARY KEY'; if ($key == 'entity') $texttoinsert.= ' DEFAULT 1';