Update to make lan field common
This commit is contained in:
parent
d3515253b2
commit
8cbbcc01a9
@ -57,7 +57,9 @@ if ($action == 'add' && !empty($permissiontoadd)) {
|
||||
}
|
||||
} else {
|
||||
if (!GETPOSTISSET($key)) {
|
||||
continue; // The field was not submited to be edited
|
||||
if ($key != 'lang' || !GETPOSTISSET($key.'object')) {
|
||||
continue; // The field was not submited to be edited
|
||||
}
|
||||
}
|
||||
}
|
||||
// Ignore special fields
|
||||
@ -87,7 +89,11 @@ if ($action == 'add' && !empty($permissiontoadd)) {
|
||||
$tmparraykey = array_keys($object->param_list);
|
||||
$value = $tmparraykey[GETPOST($key)].','.GETPOST($key.'2');
|
||||
} else {
|
||||
$value = GETPOST($key, 'alphanohtml');
|
||||
if ($key == 'lang') {
|
||||
$value = GETPOST($key.'object', 'aZ09');
|
||||
} else {
|
||||
$value = GETPOST($key, 'alphanohtml');
|
||||
}
|
||||
}
|
||||
if (preg_match('/^integer:/i', $object->fields[$key]['type']) && $value == '-1') {
|
||||
$value = ''; // This is an implicit foreign key field
|
||||
@ -152,7 +158,9 @@ if ($action == 'update' && !empty($permissiontoadd)) {
|
||||
}
|
||||
} else {
|
||||
if (!GETPOSTISSET($key)) {
|
||||
continue; // The field was not submited to be edited
|
||||
if ($key != 'lang' || !GETPOSTISSET($key.'object')) {
|
||||
continue; // The field was not submited to be edited
|
||||
}
|
||||
}
|
||||
}
|
||||
// Ignore special fields
|
||||
@ -190,7 +198,11 @@ if ($action == 'update' && !empty($permissiontoadd)) {
|
||||
} elseif ($object->fields[$key]['type'] == 'reference') {
|
||||
$value = array_keys($object->param_list)[GETPOST($key)].','.GETPOST($key.'2');
|
||||
} else {
|
||||
$value = GETPOST($key, 'alpha');
|
||||
if ($key == 'lang') {
|
||||
$value = GETPOST($key.'object', 'aZ09');
|
||||
} else {
|
||||
$value = GETPOST($key, 'alphanohtml');
|
||||
}
|
||||
}
|
||||
if (preg_match('/^integer:/i', $object->fields[$key]['type']) && $value == '-1') {
|
||||
$value = ''; // This is an implicit foreign key field
|
||||
|
||||
@ -79,13 +79,20 @@ foreach ($object->fields as $key => $val) {
|
||||
$value = (GETPOST($key) == 'on' ? 1 : 0);
|
||||
} elseif ($val['type'] == 'price') {
|
||||
$value = price2num(GETPOST($key));
|
||||
} elseif ($key == 'lang') {
|
||||
$value = GETPOST($key.'object', 'aZ09');
|
||||
} else {
|
||||
$value = GETPOST($key, 'alphanohtml');
|
||||
}
|
||||
if (!empty($val['noteditable'])) {
|
||||
print $object->showOutputField($val, $key, $value, '', '', '', 0);
|
||||
} else {
|
||||
print $object->showInputField($val, $key, $value, '', '', '', 0);
|
||||
if ($key == 'lang') {
|
||||
print img_picto('', 'language', 'class="pictofixedwidth"');
|
||||
print $formadmin->select_language($value, $key.'object', 0, null, 1, 0, 0, 'minwidth300', 2);
|
||||
} else {
|
||||
print $object->showInputField($val, $key, $value, '', '', '', 0);
|
||||
}
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
@ -79,6 +79,8 @@ foreach ($object->fields as $key => $val) {
|
||||
$value = GETPOSTISSET($key) ? GETPOST($key, $check) : $object->$key;
|
||||
} elseif ($val['type'] == 'price') {
|
||||
$value = GETPOSTISSET($key) ? price2num(GETPOST($key)) : price2num($object->$key);
|
||||
} elseif ($key == 'lang') {
|
||||
$value = GETPOSTISSET($key.'object', 'aZ09')?GETPOST($key.'object', 'aZ09'):$object->lang;
|
||||
} else {
|
||||
$value = GETPOSTISSET($key) ? GETPOST($key, 'alpha') : $object->$key;
|
||||
}
|
||||
@ -86,7 +88,12 @@ foreach ($object->fields as $key => $val) {
|
||||
if ($val['noteditable']) {
|
||||
print $object->showOutputField($val, $key, $value, '', '', '', 0);
|
||||
} else {
|
||||
print $object->showInputField($val, $key, $value, '', '', '', 0);
|
||||
if ($key == 'lang') {
|
||||
print img_picto('', 'language', 'class="pictofixedwidth"');
|
||||
print $formadmin->select_language($value, $key.'object', 0, null, 1, 0, 0, 'minwidth300', 2);
|
||||
} else {
|
||||
print $object->showInputField($val, $key, $value, '', '', '', 0);
|
||||
}
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
@ -81,7 +81,14 @@ foreach ($object->fields as $key => $val) {
|
||||
if (in_array($val['type'], array('text', 'html'))) {
|
||||
print '<div class="longmessagecut">';
|
||||
}
|
||||
print $object->showOutputField($val, $key, $value, '', '', '', 0);
|
||||
if ($key == 'lang') {
|
||||
$langs->load("languages");
|
||||
$labellang = ($value ? $langs->trans('Language_'.$value) : '');
|
||||
print picto_from_langcode($value, 'class="paddingrightonly saturatemedium opacitylow"');
|
||||
print $labellang;
|
||||
} else {
|
||||
print $object->showOutputField($val, $key, $value, '', '', '', 0);
|
||||
}
|
||||
//print dol_escape_htmltag($object->$key, 1, 1);
|
||||
if (in_array($val['type'], array('text', 'html'))) {
|
||||
print '</div>';
|
||||
|
||||
@ -115,7 +115,7 @@ class KnowledgeRecord extends CommonObject
|
||||
//'url' => array('type'=>'varchar(255)', 'label'=>'URL', 'enabled'=>'1', 'position'=>55, 'notnull'=>0, 'visible'=>-1, 'csslist'=>'tdoverflow200', 'help'=>'UrlForInfoPage'),
|
||||
'fk_c_ticket_category' => array('type'=>'integer:CTicketCategory:ticket/class/cticketcategory.class.php', 'label'=>'GroupOfTicket', 'enabled'=>'$conf->ticket->enabled', 'position'=>512, 'notnull'=>0, 'visible'=>-1, 'help'=>'YouCanLinkArticleToATicketCategory'),
|
||||
'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>'1', 'position'=>1000, 'notnull'=>1, 'visible'=>1, 'default'=>0, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Draft', '1'=>'Valid'),),
|
||||
'lang' => array('type'=>'varchar(6)', 'label'=>'Language', 'enabled'=>'1', 'position'=>51, 'notnull'=>0, 'visible'=>0,),
|
||||
'lang' => array('type'=>'varchar(6)', 'label'=>'Language', 'enabled'=>'1', 'position'=>51, 'notnull'=>0, 'visible'=>1),
|
||||
);
|
||||
public $rowid;
|
||||
public $ref;
|
||||
|
||||
@ -192,12 +192,6 @@ if ($action == 'create') {
|
||||
// Common attributes
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_add.tpl.php';
|
||||
|
||||
//Language of question/response
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("Language").'</td><td>';
|
||||
print img_picto('', 'language', 'class="pictofixedwidth"');
|
||||
print $formadmin->select_language('', 'langkm', 0, null, 1, 0, 0, 'minwidth300', 2);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Other attributes
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php';
|
||||
@ -239,12 +233,6 @@ if (($id || $ref) && $action == 'edit') {
|
||||
// Common attributes
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_edit.tpl.php';
|
||||
|
||||
//Language of question/response
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("Language").'</td><td>';
|
||||
print img_picto('', 'language', 'class="pictofixedwidth"');
|
||||
print $formadmin->select_language($object->lang, 'langkm', 0, null, 1, 0, 0, 'minwidth300', 2);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Other attributes
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php';
|
||||
@ -353,15 +341,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
//unset($object->fields['fk_soc']); // Hide field already shown in banner
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
|
||||
|
||||
//Language of question/response
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("Language").'</td><td>';
|
||||
$langs->load("languages");
|
||||
$labellang = ($object->lang ? $langs->trans('Language_'.$object->lang) : '');
|
||||
print picto_from_langcode($object->lang, 'class="paddingrightonly saturatemedium opacitylow"');
|
||||
print $labellang;
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Other attributes. Fields from hook formObjectOptions and Extrafields.
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user