Fix css for field pos/position in dictionary.

This commit is contained in:
Laurent Destailleur 2021-07-07 18:41:37 +02:00
parent 9d3f7c5cdd
commit 6cfb3c0e16

View File

@ -882,12 +882,12 @@ if (GETPOST('actionadd') || GETPOST('actionmodify')) {
} }
if ($keycode == 'sortorder') { // For column name 'sortorder', we use the field name 'position' if ($keycode == 'sortorder') { // For column name 'sortorder', we use the field name 'position'
$sql .= "'".(int) GETPOST('position', 'int')."'"; $sql .= (int) GETPOST('position', 'int');
} elseif ($_POST[$keycode] == '' && !($keycode == 'code' && $id == 10)) { } elseif ($_POST[$keycode] == '' && !($keycode == 'code' && $id == 10)) {
$sql .= "null"; // For vat, we want/accept code = '' $sql .= "null"; // For vat, we want/accept code = ''
} elseif ($keycode == 'content') { } elseif ($keycode == 'content') {
$sql .= "'".$db->escape(GETPOST($keycode, 'restricthtml'))."'"; $sql .= "'".$db->escape(GETPOST($keycode, 'restricthtml'))."'";
} elseif (in_array($keycode, array('joinfile', 'private', 'position', 'scale'))) { } elseif (in_array($keycode, array('joinfile', 'private', 'pos', 'position', 'scale'))) {
$sql .= (int) GETPOST($keycode, 'int'); $sql .= (int) GETPOST($keycode, 'int');
} else { } else {
$sql .= "'".$db->escape(GETPOST($keycode, 'nohtml'))."'"; $sql .= "'".$db->escape(GETPOST($keycode, 'nohtml'))."'";
@ -898,8 +898,8 @@ if (GETPOST('actionadd') || GETPOST('actionmodify')) {
$sql .= ",1)"; $sql .= ",1)";
dol_syslog("actionadd", LOG_DEBUG); dol_syslog("actionadd", LOG_DEBUG);
$result = $db->query($sql); $resql = $db->query($sql);
if ($result) { // Add is ok if ($resql) { // Add is ok
setEventMessages($langs->transnoentities("RecordCreatedSuccessfully"), null, 'mesgs'); setEventMessages($langs->transnoentities("RecordCreatedSuccessfully"), null, 'mesgs');
// Clean $_POST array, we keep only id of dictionary // Clean $_POST array, we keep only id of dictionary
@ -956,7 +956,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify')) {
$sql .= "null"; // For vat, we want/accept code = '' $sql .= "null"; // For vat, we want/accept code = ''
} elseif ($keycode == 'content') { } elseif ($keycode == 'content') {
$sql .= "'".$db->escape(GETPOST($keycode, 'restricthtml'))."'"; $sql .= "'".$db->escape(GETPOST($keycode, 'restricthtml'))."'";
} elseif (in_array($keycode, array('private', 'position', 'scale'))) { } elseif (in_array($keycode, array('joinfile', 'private', 'pos', 'position', 'scale'))) {
$sql .= (int) GETPOST($keycode, 'int'); $sql .= (int) GETPOST($keycode, 'int');
} else { } else {
$sql .= "'".$db->escape(GETPOST($keycode, 'nohtml'))."'"; $sql .= "'".$db->escape(GETPOST($keycode, 'nohtml'))."'";
@ -1626,11 +1626,8 @@ if ($id) {
if ($value == 'code') { if ($value == 'code') {
$valuetoshow = $langs->trans("Code"); $valuetoshow = $langs->trans("Code");
} }
if ($value == 'pos') { if (in_array($value, array('pos', 'position'))) {
$cssprefix = 'right '; $valuetoshow = $langs->trans("Position"); $valuetoshow = $langs->trans("Position"); $cssprefix = 'right ';
}
if ($value == 'position') {
$cssprefix = 'right '; $valuetoshow = $langs->trans("Position");
} }
if ($value == 'libelle' || $value == 'label') { if ($value == 'libelle' || $value == 'label') {
$valuetoshow = $langs->trans("Label"); $valuetoshow = $langs->trans("Label");
@ -1998,15 +1995,12 @@ if ($id) {
if ($value == 'tracking') { if ($value == 'tracking') {
$class .= ' tdoverflowauto'; $class .= ' tdoverflowauto';
} }
if ($value == 'position') { if (in_array($value, array('pos', 'position'))) {
$class .= ' right'; $class .= ' right';
} }
if (in_array($value, array('localtax1_type', 'localtax2_type'))) { if (in_array($value, array('localtax1_type', 'localtax2_type'))) {
$class .= ' nowrap'; $class .= ' nowrap';
} }
if ($value == 'pos') {
$class .= ' right';
}
if (in_array($value, array('use_default', 'fk_parent'))) { if (in_array($value, array('use_default', 'fk_parent'))) {
$class .= ' center'; $class .= ' center';
} }
@ -2386,7 +2380,10 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
if ($fieldlist[$field] == 'code') { if ($fieldlist[$field] == 'code') {
$class = 'maxwidth100'; $class = 'maxwidth100';
} }
if (in_array($fieldlist[$field], array('dayrule', 'day', 'month', 'year', 'pos', 'use_default', 'affect', 'delay', 'position', 'public', 'sortorder', 'sens', 'category_type', 'fk_parent'))) { if (in_array($fieldlist[$field], array('pos', 'position'))) {
$classtd = 'right'; $class = 'maxwidth50 right';
}
if (in_array($fieldlist[$field], array('dayrule', 'day', 'month', 'year', 'use_default', 'affect', 'delay', 'public', 'sortorder', 'sens', 'category_type', 'fk_parent'))) {
$class = 'maxwidth50 center'; $class = 'maxwidth50 center';
} }
if (in_array($fieldlist[$field], array('use_default', 'public', 'fk_parent'))) { if (in_array($fieldlist[$field], array('use_default', 'public', 'fk_parent'))) {