Logical variable name suffix/prefix
This commit is contained in:
parent
695740142a
commit
17db813a4e
@ -4592,18 +4592,18 @@ abstract class CommonObject
|
|||||||
else return 0;
|
else return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function to show lines of extrafields with output datas
|
* Function to show lines of extrafields with output datas
|
||||||
*
|
*
|
||||||
* @param Extrafields $extrafields Extrafield Object
|
* @param Extrafields $extrafields Extrafield Object
|
||||||
* @param string $mode Show output (view) or input (edit) for extrafield
|
* @param string $mode Show output (view) or input (edit) for extrafield
|
||||||
* @param array $params Optional parameters
|
* @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 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 Prefix string to add into name and id of field (can be used to avoid duplicate names)
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function showOptionals($extrafields, $mode='view', $params=null, $keyprefix='', $keysuffix='')
|
function showOptionals($extrafields, $mode='view', $params=null, $keysuffix='', $keyprefix='')
|
||||||
{
|
{
|
||||||
global $_POST, $conf, $langs, $action;
|
global $_POST, $conf, $langs, $action;
|
||||||
|
|
||||||
@ -4631,12 +4631,12 @@ abstract class CommonObject
|
|||||||
|
|
||||||
switch($mode) {
|
switch($mode) {
|
||||||
case "view":
|
case "view":
|
||||||
$value=$this->array_options["options_".$key.$keyprefix];
|
$value=$this->array_options["options_".$key.$keysuffix];
|
||||||
break;
|
break;
|
||||||
case "edit":
|
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')
|
// 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)) {
|
if (is_array($getposttemp)) {
|
||||||
// $getposttemp is an array but following code expects a comma separated string
|
// $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)
|
// 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 = 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)
|
// 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')))
|
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);
|
$labeltoshow = $langs->trans($label);
|
||||||
@ -4700,7 +4700,7 @@ abstract class CommonObject
|
|||||||
$out .= $extrafields->showOutputField($key, $value);
|
$out .= $extrafields->showOutputField($key, $value);
|
||||||
break;
|
break;
|
||||||
case "edit":
|
case "edit":
|
||||||
$out .= $extrafields->showInputField($key, $value, '', $keyprefix, '', 0, $this->id);
|
$out .= $extrafields->showInputField($key, $value, '', $keysuffix, '', 0, $this->id);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4714,7 +4714,7 @@ abstract class CommonObject
|
|||||||
$out .= "\n";
|
$out .= "\n";
|
||||||
// Add code to manage list depending on others
|
// Add code to manage list depending on others
|
||||||
if (! empty($conf->use_javascript_ajax))
|
if (! empty($conf->use_javascript_ajax))
|
||||||
$out .= '
|
$out .= '
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
jQuery(document).ready(function() {
|
jQuery(document).ready(function() {
|
||||||
function showOptions(child_list, parent_list)
|
function showOptions(child_list, parent_list)
|
||||||
@ -4743,11 +4743,12 @@ abstract class CommonObject
|
|||||||
setListDependencies();
|
setListDependencies();
|
||||||
});
|
});
|
||||||
</script>'."\n";
|
</script>'."\n";
|
||||||
$out .= '<!-- /showOptionalsInput --> '."\n";
|
$out .= '<!-- /showOptionalsInput --> '."\n";
|
||||||
}
|
}
|
||||||
return $out;
|
return $out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the rights used for this class
|
* Returns the rights used for this class
|
||||||
* @return stdClass
|
* @return stdClass
|
||||||
|
|||||||
@ -806,13 +806,13 @@ class ExtraFields
|
|||||||
* @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, for amount or price it must be a php numeric value)
|
* @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 $keysuffix 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 $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 mixed $showsize Value for css to define size. May also be a numeric.
|
||||||
* @param int $objectid Current object id
|
* @param int $objectid Current object id
|
||||||
* @return string
|
* @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;
|
global $conf,$langs;
|
||||||
|
|
||||||
@ -831,51 +831,51 @@ class ExtraFields
|
|||||||
|
|
||||||
if ($computed)
|
if ($computed)
|
||||||
{
|
{
|
||||||
if ($keysuffix != 'search_') return '<span class="opacitymedium">'.$langs->trans("AutomaticallyCalculated").'</span>';
|
if ($keyprefix != 'search_') return '<span class="opacitymedium">'.$langs->trans("AutomaticallyCalculated").'</span>';
|
||||||
else return '';
|
else return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($showsize))
|
if (empty($showsize))
|
||||||
{
|
{
|
||||||
if ($type == 'date')
|
if ($type == 'date')
|
||||||
{
|
{
|
||||||
//$showsize=10;
|
//$showsize=10;
|
||||||
$showsize = 'minwidth100imp';
|
$showsize = 'minwidth100imp';
|
||||||
}
|
}
|
||||||
elseif ($type == 'datetime')
|
elseif ($type == 'datetime')
|
||||||
{
|
{
|
||||||
//$showsize=19;
|
//$showsize=19;
|
||||||
$showsize = 'minwidth200imp';
|
$showsize = 'minwidth200imp';
|
||||||
}
|
}
|
||||||
elseif (in_array($type,array('int','double','price')))
|
elseif (in_array($type,array('int','double','price')))
|
||||||
{
|
{
|
||||||
//$showsize=10;
|
//$showsize=10;
|
||||||
$showsize = 'maxwidth75';
|
$showsize = 'maxwidth75';
|
||||||
}
|
}
|
||||||
elseif ($type == 'url')
|
elseif ($type == 'url')
|
||||||
{
|
{
|
||||||
$showsize='minwidth400';
|
$showsize='minwidth400';
|
||||||
}
|
}
|
||||||
elseif ($type == 'boolean')
|
elseif ($type == 'boolean')
|
||||||
{
|
{
|
||||||
$showsize='';
|
$showsize='';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (round($size) < 12)
|
if (round($size) < 12)
|
||||||
{
|
{
|
||||||
$showsize = 'minwidth100';
|
$showsize = 'minwidth100';
|
||||||
}
|
}
|
||||||
else if (round($size) <= 48)
|
else if (round($size) <= 48)
|
||||||
{
|
{
|
||||||
$showsize = 'minwidth200';
|
$showsize = 'minwidth200';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//$showsize=48;
|
//$showsize=48;
|
||||||
$showsize = 'minwidth400';
|
$showsize = 'minwidth400';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in_array($type,array('date','datetime')))
|
if (in_array($type,array('date','datetime')))
|
||||||
@ -893,26 +893,26 @@ class ExtraFields
|
|||||||
if (! is_object($form)) $form=new Form($this->db);
|
if (! is_object($form)) $form=new Form($this->db);
|
||||||
|
|
||||||
// TODO Must also support $moreparam
|
// 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')))
|
elseif (in_array($type,array('int')))
|
||||||
{
|
{
|
||||||
$tmp=explode(',',$size);
|
$tmp=explode(',',$size);
|
||||||
$newsize=$tmp[0];
|
$newsize=$tmp[0];
|
||||||
$out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keysuffix.'options_'.$key.$keyprefix.'" id="'.$keysuffix.'options_'.$key.$keyprefix.'" maxlength="'.$newsize.'" value="'.$value.'"'.($moreparam?$moreparam:'').'>';
|
$out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keyprefix.'options_'.$key.$keysuffix.'" id="'.$keyprefix.'options_'.$key.$keysuffix.'" maxlength="'.$newsize.'" value="'.$value.'"'.($moreparam?$moreparam:'').'>';
|
||||||
}
|
}
|
||||||
elseif ($type == 'varchar')
|
elseif ($type == 'varchar')
|
||||||
{
|
{
|
||||||
$out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keysuffix.'options_'.$key.$keyprefix.'" id="'.$keysuffix.'options_'.$key.$keyprefix.'" maxlength="'.$size.'" value="'.dol_escape_htmltag($value).'"'.($moreparam?$moreparam:'').'>';
|
$out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keyprefix.'options_'.$key.$keysuffix.'" id="'.$keyprefix.'options_'.$key.$keysuffix.'" maxlength="'.$size.'" value="'.dol_escape_htmltag($value).'"'.($moreparam?$moreparam:'').'>';
|
||||||
}
|
}
|
||||||
elseif (in_array($type, array('mail', 'phone', 'url')))
|
elseif (in_array($type, array('mail', 'phone', 'url')))
|
||||||
{
|
{
|
||||||
$out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keysuffix.'options_'.$key.$keyprefix.'" id="'.$keysuffix.'options_'.$key.$keyprefix.'" value="'.$value.'" '.($moreparam?$moreparam:'').'>';
|
$out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keyprefix.'options_'.$key.$keysuffix.'" id="'.$keyprefix.'options_'.$key.$keysuffix.'" value="'.$value.'" '.($moreparam?$moreparam:'').'>';
|
||||||
}
|
}
|
||||||
elseif ($type == 'text')
|
elseif ($type == 'text')
|
||||||
{
|
{
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
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);
|
$out=$doleditor->Create(1);
|
||||||
}
|
}
|
||||||
elseif ($type == 'boolean')
|
elseif ($type == 'boolean')
|
||||||
@ -923,21 +923,21 @@ class ExtraFields
|
|||||||
} else {
|
} else {
|
||||||
$checked=' value="1" ';
|
$checked=' value="1" ';
|
||||||
}
|
}
|
||||||
$out='<input type="checkbox" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keysuffix.'options_'.$key.$keyprefix.'" id="'.$keysuffix.'options_'.$key.$keyprefix.'" '.$checked.' '.($moreparam?$moreparam:'').'>';
|
$out='<input type="checkbox" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keyprefix.'options_'.$key.$keysuffix.'" id="'.$keyprefix.'options_'.$key.$keysuffix.'" '.$checked.' '.($moreparam?$moreparam:'').'>';
|
||||||
}
|
}
|
||||||
elseif ($type == 'price')
|
elseif ($type == 'price')
|
||||||
{
|
{
|
||||||
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);
|
||||||
}
|
}
|
||||||
$out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keysuffix.'options_'.$key.$keyprefix.'" id="'.$keysuffix.'options_'.$key.$keyprefix.'" value="'.$value.'" '.($moreparam?$moreparam:'').'> '.$langs->getCurrencySymbol($conf->currency);
|
$out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keyprefix.'options_'.$key.$keysuffix.'" id="'.$keyprefix.'options_'.$key.$keysuffix.'" value="'.$value.'" '.($moreparam?$moreparam:'').'> '.$langs->getCurrencySymbol($conf->currency);
|
||||||
}
|
}
|
||||||
elseif ($type == 'double')
|
elseif ($type == 'double')
|
||||||
{
|
{
|
||||||
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);
|
||||||
}
|
}
|
||||||
$out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keysuffix.'options_'.$key.$keyprefix.'" id="'.$keysuffix.'options_'.$key.$keyprefix.'" value="'.$value.'" '.($moreparam?$moreparam:'').'> ';
|
$out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keyprefix.'options_'.$key.$keysuffix.'" id="'.$keyprefix.'options_'.$key.$keysuffix.'" value="'.$value.'" '.($moreparam?$moreparam:'').'> ';
|
||||||
}
|
}
|
||||||
elseif ($type == 'select')
|
elseif ($type == 'select')
|
||||||
{
|
{
|
||||||
@ -945,10 +945,10 @@ class ExtraFields
|
|||||||
if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->MAIN_EXTRAFIELDS_USE_SELECT2))
|
if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->MAIN_EXTRAFIELDS_USE_SELECT2))
|
||||||
{
|
{
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
|
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.='<select class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keysuffix.'options_'.$key.$keyprefix.'" id="'.$keysuffix.'options_'.$key.$keyprefix.'" '.($moreparam?$moreparam:'').'>';
|
$out.='<select class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keyprefix.'options_'.$key.$keysuffix.'" id="'.$keyprefix.'options_'.$key.$keysuffix.'" '.($moreparam?$moreparam:'').'>';
|
||||||
$out.='<option value="0"> </option>';
|
$out.='<option value="0"> </option>';
|
||||||
foreach ($param['options'] as $key => $val)
|
foreach ($param['options'] as $key => $val)
|
||||||
{
|
{
|
||||||
@ -967,10 +967,10 @@ class ExtraFields
|
|||||||
if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->MAIN_EXTRAFIELDS_USE_SELECT2))
|
if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->MAIN_EXTRAFIELDS_USE_SELECT2))
|
||||||
{
|
{
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
|
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.='<select class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keysuffix.'options_'.$key.$keyprefix.'" id="'.$keysuffix.'options_'.$key.$keyprefix.'" '.($moreparam?$moreparam:'').'>';
|
$out.='<select class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keyprefix.'options_'.$key.$keysuffix.'" id="'.$keyprefix.'options_'.$key.$keysuffix.'" '.($moreparam?$moreparam:'').'>';
|
||||||
if (is_array($param['options']))
|
if (is_array($param['options']))
|
||||||
{
|
{
|
||||||
$param_list=array_keys($param['options']);
|
$param_list=array_keys($param['options']);
|
||||||
@ -1132,7 +1132,7 @@ class ExtraFields
|
|||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
|
|
||||||
$value_arr=explode(',',$value);
|
$value_arr=explode(',',$value);
|
||||||
$out=$form->multiselectarray($keysuffix.'options_'.$key.$keyprefix, (empty($param['options'])?null:$param['options']), $value_arr, '', 0, '', 0, '100%');
|
$out=$form->multiselectarray($keyprefix.'options_'.$key.$keysuffix, (empty($param['options'])?null:$param['options']), $value_arr, '', 0, '', 0, '100%');
|
||||||
|
|
||||||
}
|
}
|
||||||
elseif ($type == 'radio')
|
elseif ($type == 'radio')
|
||||||
@ -1140,11 +1140,11 @@ class ExtraFields
|
|||||||
$out='';
|
$out='';
|
||||||
foreach ($param['options'] as $keyopt => $val)
|
foreach ($param['options'] as $keyopt => $val)
|
||||||
{
|
{
|
||||||
$out.='<input class="flat '.$showsize.'" type="radio" name="'.$keysuffix.'options_'.$key.$keyprefix.'" id="'.$keysuffix.'options_'.$key.$keyprefix.'" '.($moreparam?$moreparam:'');
|
$out.='<input class="flat '.$showsize.'" type="radio" name="'.$keyprefix.'options_'.$key.$keysuffix.'" id="'.$keyprefix.'options_'.$key.$keysuffix.'" '.($moreparam?$moreparam:'');
|
||||||
$out.=' value="'.$keyopt.'"';
|
$out.=' value="'.$keyopt.'"';
|
||||||
$out.=' id="'.$keysuffix.'options_'.$key.$keyprefix.'_'.$keyopt.'"';
|
$out.=' id="'.$keyprefix.'options_'.$key.$keysuffix.'_'.$keyopt.'"';
|
||||||
$out.= ($value==$keyopt?'checked':'');
|
$out.= ($value==$keyopt?'checked':'');
|
||||||
$out.='/><label for="'.$keysuffix.'options_'.$key.$keyprefix.'_'.$keyopt.'">'.$val.'</label><br>';
|
$out.='/><label for="'.$keyprefix.'options_'.$key.$keysuffix.'_'.$keyopt.'">'.$val.'</label><br>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elseif ($type == 'chkbxlst')
|
elseif ($type == 'chkbxlst')
|
||||||
@ -1268,15 +1268,15 @@ class ExtraFields
|
|||||||
if (empty($labeltoshow))
|
if (empty($labeltoshow))
|
||||||
$labeltoshow = '(not defined)';
|
$labeltoshow = '(not defined)';
|
||||||
|
|
||||||
if (is_array($value_arr) && in_array($obj->rowid, $value_arr)) {
|
if (is_array($value_arr) && in_array($obj->rowid, $value_arr)) {
|
||||||
|
$data[$obj->rowid]=$labeltoshow;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! empty($InfoFieldList[3])) {
|
||||||
|
$parent = $parentName . ':' . $obj->{$parentField};
|
||||||
|
}
|
||||||
|
|
||||||
$data[$obj->rowid]=$labeltoshow;
|
$data[$obj->rowid]=$labeltoshow;
|
||||||
}
|
|
||||||
|
|
||||||
if (! empty($InfoFieldList[3])) {
|
|
||||||
$parent = $parentName . ':' . $obj->{$parentField};
|
|
||||||
}
|
|
||||||
|
|
||||||
$data[$obj->rowid]=$labeltoshow;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$i ++;
|
$i ++;
|
||||||
@ -1286,7 +1286,7 @@ class ExtraFields
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
|
|
||||||
$out=$form->multiselectarray($keysuffix.'options_'.$key.$keyprefix, $data, $value_arr, '', 0, '', 0, '100%');
|
$out=$form->multiselectarray($keyprefix.'options_'.$key.$keysuffix, $data, $value_arr, '', 0, '', 0, '100%');
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
print 'Error in request ' . $sql . ' ' . $this->db->lasterror() . '. Check setup of extra parameters.<br>';
|
print 'Error in request ' . $sql . ' ' . $this->db->lasterror() . '. Check setup of extra parameters.<br>';
|
||||||
@ -1305,40 +1305,41 @@ class ExtraFields
|
|||||||
dol_include_once($InfoFieldList[1]);
|
dol_include_once($InfoFieldList[1]);
|
||||||
if ($InfoFieldList[0] && class_exists($InfoFieldList[0]))
|
if ($InfoFieldList[0] && class_exists($InfoFieldList[0]))
|
||||||
{
|
{
|
||||||
$valuetoshow=$value;
|
$valuetoshow=$value;
|
||||||
if (!empty($value))
|
if (!empty($value))
|
||||||
{
|
{
|
||||||
$object = new $InfoFieldList[0]($this->db);
|
$object = new $InfoFieldList[0]($this->db);
|
||||||
$resfetch=$object->fetch($value);
|
$resfetch=$object->fetch($value);
|
||||||
if ($resfetch > 0)
|
if ($resfetch > 0)
|
||||||
{
|
{
|
||||||
$valuetoshow=$object->ref;
|
$valuetoshow=$object->ref;
|
||||||
if ($object->element == 'societe') $valuetoshow=$object->name; // Special case for thirdparty because ->ref is not name but id (because name is not unique)
|
if ($object->element == 'societe') $valuetoshow=$object->name; // Special case for thirdparty because ->ref is not name but id (because name is not unique)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$out.='<input type="text" class="flat '.$showsize.'" name="'.$keysuffix.'options_'.$key.$keyprefix.'" id="'.$keysuffix.'options_'.$key.$keyprefix.'" value="'.$valuetoshow.'" >';
|
$out.='<input type="text" class="flat '.$showsize.'" name="'.$keyprefix.'options_'.$key.$keysuffix.'" id="'.$keyprefix.'options_'.$key.$keysuffix.'" value="'.$valuetoshow.'" >';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dol_syslog('Error bad setup of extrafield', LOG_WARNING);
|
dol_syslog('Error bad setup of extrafield', LOG_WARNING);
|
||||||
$out.='Error bad setup of extrafield';
|
$out.='Error bad setup of extrafield';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elseif ($type == 'password')
|
elseif ($type == 'password')
|
||||||
{
|
{
|
||||||
// If prefix is 'search_', field is used as a filter, we use a common text field.
|
// If prefix is 'search_', field is used as a filter, we use a common text field.
|
||||||
$out='<input type="'.($keysuffix=='search_'?'text':'password').'" class="flat '.$showsize.'" name="'.$keysuffix.'options_'.$key.$keyprefix.'" id="'.$keysuffix.'options_'.$key.$keyprefix.'" value="'.$value.'" '.($moreparam?$moreparam:'').'>';
|
$out='<input type="'.($keyprefix=='search_'?'text':'password').'" class="flat '.$showsize.'" name="'.$keyprefix.'options_'.$key.$keysuffix.'" id="'.$keyprefix.'options_'.$key.$keysuffix.'" value="'.$value.'" '.($moreparam?$moreparam:'').'>';
|
||||||
}
|
}
|
||||||
if (!empty($hidden)) {
|
if (!empty($hidden)) {
|
||||||
$out='<input type="hidden" value="'.$value.'" name="'.$keysuffix.'options_'.$key.$keyprefix.'" id="'.$keysuffix.'options_'.$key.$keyprefix.'"/>';
|
$out='<input type="hidden" value="'.$value.'" name="'.$keyprefix.'options_'.$key.$keysuffix.'" id="'.$keyprefix.'options_'.$key.$keysuffix.'"/>';
|
||||||
}
|
}
|
||||||
/* Add comments
|
/* Add comments
|
||||||
if ($type == 'date') $out.=' (YYYY-MM-DD)';
|
if ($type == 'date') $out.=' (YYYY-MM-DD)';
|
||||||
elseif ($type == 'datetime') $out.=' (YYYY-MM-DD HH:MM:SS)';
|
elseif ($type == 'datetime') $out.=' (YYYY-MM-DD HH:MM:SS)';
|
||||||
*/
|
*/
|
||||||
return $out;
|
return $out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return HTML string to put an output field into a page
|
* Return HTML string to put an output field into a page
|
||||||
*
|
*
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user