Fix Show double(x,y) fields

This commit is contained in:
patrick Delcroix 2018-05-26 23:39:36 +02:00
parent 3158fdc551
commit adda3144bc
2 changed files with 5 additions and 6 deletions

View File

@ -5118,11 +5118,10 @@ $val=$this->fields[$key];
{ {
$morecss = 'minwidth200imp'; $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'; $morecss = 'maxwidth75';
} }elseif ($type == 'url')
elseif ($type == 'url')
{ {
$morecss='minwidth400'; $morecss='minwidth400';
} }
@ -5217,7 +5216,7 @@ $val=$this->fields[$key];
} }
$out='<input type="text" class="flat '.$morecss.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" value="'.$value.'" '.($moreparam?$moreparam:'').'> '.$langs->getCurrencySymbol($conf->currency); $out='<input type="text" class="flat '.$morecss.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" value="'.$value.'" '.($moreparam?$moreparam:'').'> '.$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. if (!empty($value)) { // $value in memory is a php numeric, we format it into user number format.
$value=price($value); $value=price($value);

View File

@ -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' $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 == '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; $texttoinsert.= "\t".$key." ".$type;
if ($key == 'rowid') $texttoinsert.= ' AUTO_INCREMENT PRIMARY KEY'; if ($key == 'rowid') $texttoinsert.= ' AUTO_INCREMENT PRIMARY KEY';
if ($key == 'entity') $texttoinsert.= ' DEFAULT 1'; if ($key == 'entity') $texttoinsert.= ' DEFAULT 1';