diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index b59fbc9f03e..a07a95f1e6d 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -4592,18 +4592,18 @@ abstract class CommonObject
else return 0;
}
- /**
- * Function to show lines of extrafields with output datas
- *
- * @param Extrafields $extrafields Extrafield Object
- * @param string $mode Show output (view) or input (edit) for extrafield
- * @param array $params Optional parameters
- * @param string $keyprefix Prefix string to add into name and id of field (can be used to avoid duplicate names)
- * @param string $keysuffix Prefix string to add into name and id of field (can be used to avoid duplicate names)
- *
- * @return string
- */
- function showOptionals($extrafields, $mode='view', $params=null, $keyprefix='', $keysuffix='')
+ /**
+ * Function to show lines of extrafields with output datas
+ *
+ * @param Extrafields $extrafields Extrafield Object
+ * @param string $mode Show output (view) or input (edit) for extrafield
+ * @param array $params Optional parameters
+ * @param string $keysuffix Suffix 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)
+ *
+ * @return string
+ */
+ function showOptionals($extrafields, $mode='view', $params=null, $keysuffix='', $keyprefix='')
{
global $_POST, $conf, $langs, $action;
@@ -4631,12 +4631,12 @@ abstract class CommonObject
switch($mode) {
case "view":
- $value=$this->array_options["options_".$key.$keyprefix];
+ $value=$this->array_options["options_".$key.$keysuffix];
break;
case "edit":
- $getposttemp = GETPOST($keysuffix.'options_'.$key.$keyprefix, 'none'); // GETPOST can get value from GET, POST or setup of default values.
+ $getposttemp = GETPOST($keyprefix.'options_'.$key.$keysuffix, 'none'); // GETPOST can get value from GET, POST or setup of default values.
// GETPOST("options_" . $key) can be 'abc' or array(0=>'abc')
- if (is_array($getposttemp) || $getposttemp != '' || GETPOSTISSET($keysuffix.'options_'.$key.$keyprefix))
+ if (is_array($getposttemp) || $getposttemp != '' || GETPOSTISSET($keyprefix.'options_'.$key.$keysuffix))
{
if (is_array($getposttemp)) {
// $getposttemp is an array but following code expects a comma separated string
@@ -4676,12 +4676,12 @@ abstract class CommonObject
// Convert date into timestamp format (value in memory must be a timestamp)
if (in_array($extrafields->attribute_type[$key],array('date','datetime')))
{
- $value = GETPOSTISSET($keysuffix.'options_'.$key.$keyprefix)?dol_mktime(GETPOST($keysuffix.'options_'.$key.$keyprefix."hour",'int',3), GETPOST($keysuffix.'options_'.$key.$keyprefix."min",'int',3), 0, GETPOST($keysuffix.'options_'.$key.$keyprefix."month",'int',3), GETPOST($keysuffix.'options_'.$key.$keyprefix."day",'int',3), GETPOST($keysuffix.'options_'.$key.$keyprefix."year",'int',3)):$this->db->jdate($this->array_options['options_'.$key]);
+ $value = GETPOSTISSET($keyprefix.'options_'.$key.$keysuffix)?dol_mktime(GETPOST($keyprefix.'options_'.$key.$keysuffix."hour",'int',3), GETPOST($keyprefix.'options_'.$key.$keysuffix."min",'int',3), 0, GETPOST($keyprefix.'options_'.$key.$keysuffix."month",'int',3), GETPOST($keyprefix.'options_'.$key.$keysuffix."day",'int',3), GETPOST($keyprefix.'options_'.$key.$keysuffix."year",'int',3)):$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 = GETPOSTISSET($keysuffix.'options_'.$key.$keyprefix)?price2num(GETPOST($keysuffix.'options_'.$key.$keyprefix,'int',3)):$this->array_options['options_'.$key];
+ $value = GETPOSTISSET($keyprefix.'options_'.$key.$keysuffix)?price2num(GETPOST($keyprefix.'options_'.$key.$keysuffix,'int',3)):$this->array_options['options_'.$key];
}
$labeltoshow = $langs->trans($label);
@@ -4700,7 +4700,7 @@ abstract class CommonObject
$out .= $extrafields->showOutputField($key, $value);
break;
case "edit":
- $out .= $extrafields->showInputField($key, $value, '', $keyprefix, '', 0, $this->id);
+ $out .= $extrafields->showInputField($key, $value, '', $keysuffix, '', 0, $this->id);
break;
}
@@ -4714,7 +4714,7 @@ abstract class CommonObject
$out .= "\n";
// Add code to manage list depending on others
if (! empty($conf->use_javascript_ajax))
- $out .= '
+ $out .= '
'."\n";
- $out .= ' '."\n";
+ $out .= ' '."\n";
}
return $out;
}
+
/**
* Returns the rights used for this class
* @return stdClass
diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php
index 2ea2447f5bc..7130287b6bd 100644
--- a/htdocs/core/class/extrafields.class.php
+++ b/htdocs/core/class/extrafields.class.php
@@ -806,13 +806,13 @@ class ExtraFields
* @param string $key Key of attribute
* @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 $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 Prefix string to add into name and id of field (can be used to avoid duplicate names)
+ * @param string $keyprefix Suffix string to add into name and id of field (can be used to avoid duplicate names)
* @param mixed $showsize Value for css to define size. May also be a numeric.
* @param int $objectid Current object id
* @return string
*/
- function showInputField($key, $value, $moreparam='', $keyprefix='', $keysuffix='', $showsize=0, $objectid=0)
+ function showInputField($key, $value, $moreparam='', $keysuffix='', $keyprefix='', $showsize=0, $objectid=0)
{
global $conf,$langs;
@@ -831,51 +831,51 @@ class ExtraFields
if ($computed)
{
- if ($keysuffix != 'search_') return ''.$langs->trans("AutomaticallyCalculated").'';
- else return '';
+ if ($keyprefix != 'search_') return ''.$langs->trans("AutomaticallyCalculated").'';
+ else return '';
}
if (empty($showsize))
{
- if ($type == 'date')
- {
- //$showsize=10;
- $showsize = 'minwidth100imp';
- }
+ if ($type == 'date')
+ {
+ //$showsize=10;
+ $showsize = 'minwidth100imp';
+ }
elseif ($type == 'datetime')
- {
- //$showsize=19;
- $showsize = 'minwidth200imp';
- }
- elseif (in_array($type,array('int','double','price')))
- {
- //$showsize=10;
- $showsize = 'maxwidth75';
- }
- elseif ($type == 'url')
- {
- $showsize='minwidth400';
- }
- elseif ($type == 'boolean')
- {
- $showsize='';
- }
- else
- {
- if (round($size) < 12)
- {
- $showsize = 'minwidth100';
- }
- else if (round($size) <= 48)
- {
- $showsize = 'minwidth200';
- }
- else
- {
- //$showsize=48;
- $showsize = 'minwidth400';
- }
- }
+ {
+ //$showsize=19;
+ $showsize = 'minwidth200imp';
+ }
+ elseif (in_array($type,array('int','double','price')))
+ {
+ //$showsize=10;
+ $showsize = 'maxwidth75';
+ }
+ elseif ($type == 'url')
+ {
+ $showsize='minwidth400';
+ }
+ elseif ($type == 'boolean')
+ {
+ $showsize='';
+ }
+ else
+ {
+ if (round($size) < 12)
+ {
+ $showsize = 'minwidth100';
+ }
+ else if (round($size) <= 48)
+ {
+ $showsize = 'minwidth200';
+ }
+ else
+ {
+ //$showsize=48;
+ $showsize = 'minwidth400';
+ }
+ }
}
if (in_array($type,array('date','datetime')))
@@ -893,26 +893,26 @@ class ExtraFields
if (! is_object($form)) $form=new Form($this->db);
// TODO Must also support $moreparam
- $out = $form->select_date($value, $keysuffix.'options_'.$key.$keyprefix, $showtime, $showtime, $required, '', 1, ($keysuffix != 'search_' ? 1 : 0), 1, 0, 1);
+ $out = $form->select_date($value, $keyprefix.'options_'.$key.$keysuffix, $showtime, $showtime, $required, '', 1, ($keyprefix != 'search_' ? 1 : 0), 1, 0, 1);
}
elseif (in_array($type,array('int')))
{
$tmp=explode(',',$size);
$newsize=$tmp[0];
- $out='';
+ $out='';
}
elseif ($type == 'varchar')
{
- $out='';
+ $out='';
}
elseif (in_array($type, array('mail', 'phone', 'url')))
{
- $out='';
+ $out='';
}
elseif ($type == 'text')
{
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
- $doleditor=new DolEditor($keysuffix.'options_'.$key.$keyprefix,$value,'',200,'dolibarr_notes','In',false,false,! empty($conf->fckeditor->enabled) && $conf->global->FCKEDITOR_ENABLE_SOCIETE,ROWS_5,'90%');
+ $doleditor=new DolEditor($keyprefix.'options_'.$key.$keysuffix,$value,'',200,'dolibarr_notes','In',false,false,! empty($conf->fckeditor->enabled) && $conf->global->FCKEDITOR_ENABLE_SOCIETE,ROWS_5,'90%');
$out=$doleditor->Create(1);
}
elseif ($type == 'boolean')
@@ -923,21 +923,21 @@ class ExtraFields
} else {
$checked=' value="1" ';
}
- $out='';
+ $out='';
}
elseif ($type == 'price')
{
if (!empty($value)) { // $value in memory is a php numeric, we format it into user number format.
$value=price($value);
}
- $out=' '.$langs->getCurrencySymbol($conf->currency);
+ $out=' '.$langs->getCurrencySymbol($conf->currency);
}
elseif ($type == 'double')
{
if (!empty($value)) { // $value in memory is a php numeric, we format it into user number format.
$value=price($value);
}
- $out=' ';
+ $out=' ';
}
elseif ($type == 'select')
{
@@ -945,10 +945,10 @@ class ExtraFields
if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->MAIN_EXTRAFIELDS_USE_SELECT2))
{
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
- $out.= ajax_combobox($keysuffix.'options_'.$key.$keyprefix, array(), 0);
+ $out.= ajax_combobox($keyprefix.'options_'.$key.$keysuffix, array(), 0);
}
- $out.='