parent
d28188d19d
commit
13cb806436
@ -4559,12 +4559,16 @@ abstract class CommonObject
|
|||||||
{
|
{
|
||||||
$out .= '<tr '.$class.$csstyle.' class="'.$this->element.'_extras_'.$key.'">';
|
$out .= '<tr '.$class.$csstyle.' class="'.$this->element.'_extras_'.$key.'">';
|
||||||
}
|
}
|
||||||
// Convert date into timestamp format
|
// Convert date into timestamp format (value in memory must be a timestamp)
|
||||||
if (in_array($extrafields->attribute_type[$key],array('date','datetime')))
|
if (in_array($extrafields->attribute_type[$key],array('date','datetime')))
|
||||||
{
|
{
|
||||||
$value = isset($_POST["options_".$key])?dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]):$this->db->jdate($this->array_options['options_'.$key]);
|
$value = isset($_POST["options_".$key])?dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]):$this->db->jdate($this->array_options['options_'.$key]);
|
||||||
}
|
}
|
||||||
|
// Convert float submited string into real php numeric (value in memory must be a php numeric)
|
||||||
|
if (in_array($extrafields->attribute_type[$key],array('price','double')))
|
||||||
|
{
|
||||||
|
$value = isset($_POST["options_".$key])?price2num($_POST["options_".$key]):$this->array_options['options_'.$key];
|
||||||
|
}
|
||||||
if($extrafields->attribute_required[$key])
|
if($extrafields->attribute_required[$key])
|
||||||
$label = '<span'.($mode != 'view' ? ' class="fieldrequired"':'').'>'.$label.'</span>';
|
$label = '<span'.($mode != 'view' ? ' class="fieldrequired"':'').'>'.$label.'</span>';
|
||||||
|
|
||||||
|
|||||||
@ -738,7 +738,7 @@ class ExtraFields
|
|||||||
* Return HTML string to put an input field into a page
|
* Return HTML string to put an input field into a page
|
||||||
*
|
*
|
||||||
* @param string $key Key of attribute
|
* @param string $key Key of attribute
|
||||||
* @param string $value Preselected value to show (for date type it must be in timestamp format)
|
* @param string $value Preselected value to show (for date type it must be in timestamp format, for amount or price it must be a php numeric value)
|
||||||
* @param string $moreparam To add more parametes on html input tag
|
* @param string $moreparam To add more parametes on html input tag
|
||||||
* @param string $keyprefix Prefix string to add into name and id of field (can be used to avoid duplicate names)
|
* @param string $keyprefix Prefix string to add into name and id of field (can be used to avoid duplicate names)
|
||||||
* @param string $keysuffix Suffix string to add into name and id of field (can be used to avoid duplicate names)
|
* @param string $keysuffix Suffix string to add into name and id of field (can be used to avoid duplicate names)
|
||||||
@ -861,11 +861,14 @@ class ExtraFields
|
|||||||
}
|
}
|
||||||
elseif ($type == 'price')
|
elseif ($type == 'price')
|
||||||
{
|
{
|
||||||
$out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keysuffix.'options_'.$key.$keyprefix.'" value="'.price2num($value).'" '.($moreparam?$moreparam:'').'> '.$langs->getCurrencySymbol($conf->currency);
|
if (!empty($value)) { // $value in memory is a php numeric, we format it into user number format.
|
||||||
|
$value=price($value);
|
||||||
|
}
|
||||||
|
$out.='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keysuffix.'options_'.$key.$keyprefix.'" value="'.$value.'" '.($moreparam?$moreparam:'').'> '.$langs->getCurrencySymbol($conf->currency);
|
||||||
}
|
}
|
||||||
elseif ($type == 'double')
|
elseif ($type == 'double')
|
||||||
{
|
{
|
||||||
if (!empty($value)) {
|
if (!empty($value)) { // $value in memory is a php numeric, we format it into user number format.
|
||||||
$value=price($value);
|
$value=price($value);
|
||||||
}
|
}
|
||||||
$out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keysuffix.'options_'.$key.$keyprefix.'" value="'.$value.'" '.($moreparam?$moreparam:'').'> ';
|
$out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keysuffix.'options_'.$key.$keyprefix.'" value="'.$value.'" '.($moreparam?$moreparam:'').'> ';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user