2
0
forked from Wavyzz/dolibarr

Complete fix for #14146

This commit is contained in:
Laurent Destailleur
2020-08-07 15:19:26 +02:00
parent ac48576b88
commit 00804c1020
3 changed files with 14 additions and 3 deletions

View File

@@ -200,7 +200,13 @@ if (is_array($extrafields->attributes[$object->table_element]['label']) && count
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val)
{ {
if (!empty($extrafields->attributes[$object->table_element]['list'][$key])) if (!empty($extrafields->attributes[$object->table_element]['list'][$key]))
$arrayfields["ef.".$key] = array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key])); $arrayfields["ef.".$key] = array(
'label'=>$extrafields->attributes[$object->table_element]['label'][$key],
'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1),
'position'=>$extrafields->attributes[$object->table_element]['pos'][$key],
'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key]),
'langfile'=>$extrafields->attributes[$object->table_element]['langfile'][$key],
);
} }
} }
$object->fields = dol_sort_array($object->fields, 'position'); $object->fields = dol_sort_array($object->fields, 'position');

View File

@@ -6744,7 +6744,7 @@ class Form
*/ */
public static function multiSelectArrayWithCheckbox($htmlname, &$array, $varpage) public static function multiSelectArrayWithCheckbox($htmlname, &$array, $varpage)
{ {
global $conf, $langs, $user; global $conf, $langs, $user, $extrafields;
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) return ''; if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) return '';
@@ -6776,6 +6776,10 @@ class Form
} }
if ($val['label']) if ($val['label'])
{ {
if (! empty($val['langfile']) && is_object($langs)) {
$langs->load($val['langfile']);
}
$lis .= '<li><input type="checkbox" id="checkbox'.$key.'" value="'.$key.'"'.(empty($val['checked']) ? '' : ' checked="checked"').'/><label for="checkbox'.$key.'">'.dol_escape_htmltag($langs->trans($val['label'])).'</label></li>'; $lis .= '<li><input type="checkbox" id="checkbox'.$key.'" value="'.$key.'"'.(empty($val['checked']) ? '' : ' checked="checked"').'/><label for="checkbox'.$key.'">'.dol_escape_htmltag($langs->trans($val['label'])).'</label></li>';
$listcheckedstring .= (empty($val['checked']) ? '' : $key.','); $listcheckedstring .= (empty($val['checked']) ? '' : $key.',');
} }

View File

@@ -139,7 +139,8 @@ if (is_array($extrafields->attributes[$object->table_element]['label']) && count
'label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'label'=>$extrafields->attributes[$object->table_element]['label'][$key],
'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1),
'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key],
'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key]) 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key]),
'langfile'=>$extrafields->attributes[$object->table_element]['langfile'][$key]
); );
} }
} }