Debug v16

This commit is contained in:
Laurent Destailleur 2022-06-04 02:08:08 +02:00
parent 0f7b84cfae
commit fc0f624445
4 changed files with 28 additions and 20 deletions

View File

@ -817,7 +817,8 @@ class ExtraFields
$array_name_label = array();
// We should not have several time this request. If we have, there is some optimization to do by calling a simple $extrafields->fetch_optionals() in top of code and not into subcode
$sql = "SELECT rowid, name, label, type, size, elementtype, fieldunique, fieldrequired, param, pos, alwayseditable, perms, langs, list, printable, totalizable, fielddefault, fieldcomputed, entity, enabled, help";
$sql = "SELECT rowid, name, label, type, size, elementtype, fieldunique, fieldrequired, param, pos, alwayseditable, perms, langs, list, printable, totalizable, fielddefault, fieldcomputed, entity, enabled, help,";
$sql .= " css, cssview, csslist";
$sql .= " FROM ".$this->db->prefix()."extrafields";
//$sql.= " WHERE entity IN (0,".$conf->entity.")"; // Filter is done later
if ($elementtype) {
@ -866,6 +867,9 @@ class ExtraFields
$this->attributes[$tab->elementtype]['entityid'][$tab->name] = $tab->entity;
$this->attributes[$tab->elementtype]['enabled'][$tab->name] = $tab->enabled;
$this->attributes[$tab->elementtype]['help'][$tab->name] = $tab->help;
$this->attributes[$tab->elementtype]['css'][$tab->name] = $tab->css;
$this->attributes[$tab->elementtype]['cssview'][$tab->name] = $tab->cssview;
$this->attributes[$tab->elementtype]['csslist'][$tab->name] = $tab->csslist;
$this->attributes[$tab->elementtype]['loaded'] = 1;
}
@ -1838,7 +1842,7 @@ class ExtraFields
}
/**
* Return tag to describe alignement to use for this extrafield
* Return the CSS to use for this extrafield into list
*
* @param string $key Key of attribute
* @param string $extrafieldsobjectkey If defined, use the new method to get extrafields data
@ -1854,29 +1858,33 @@ class ExtraFields
$type = $this->attribute_type[$key];
}
$align = '';
$cssstring = '';
if ($type == 'date') {
$align = "center";
$cssstring = "center";
} elseif ($type == 'datetime') {
$align = "center";
$cssstring = "center";
} elseif ($type == 'int') {
$align = "right";
$cssstring = "right";
} elseif ($type == 'price') {
$align = "right";
$cssstring = "right";
} elseif ($type == 'double') {
$align = "right";
$cssstring = "right";
} elseif ($type == 'boolean') {
$align = "center";
$cssstring = "center";
} elseif ($type == 'radio') {
$align = "center";
$cssstring = "center";
} elseif ($type == 'checkbox') {
$align = "center";
$cssstring = "center";
} elseif ($type == 'price') {
$align = "right";
$cssstring = "right";
}
return $align;
if (!empty($this->attributes[$extrafieldsobjectkey]['csslist'][$key])) {
$cssstring .= ($cssstring ? ' ' : '').$this->attributes[$extrafieldsobjectkey]['csslist'][$key];
}
return $cssstring;
}
/**

View File

@ -24,10 +24,10 @@ if (!empty($extrafieldsobjectkey)) { // $extrafieldsobject is the $object->table
foreach ($extrafields->attributes[$extrafieldsobjectkey]['label'] as $key => $val) {
if (!empty($arrayfields[$extrafieldsobjectprefix.$key]['checked'])) {
$align = $extrafields->getAlignFlag($key);
$cssclass = $extrafields->getAlignFlag($key, $extrafieldsobjectkey);
$typeofextrafield = $extrafields->attributes[$extrafieldsobjectkey]['type'][$key];
print '<td class="liste_titre'.($align ? ' '.$align : '').'">';
print '<td class="liste_titre'.($cssclass ? ' '.$cssclass : '').'">';
$tmpkey = preg_replace('/'.$search_options_pattern.'/', '', $key);
if (in_array($typeofextrafield, array('varchar', 'int', 'double')) && empty($extrafields->attributes[$extrafieldsobjectkey]['computed'][$key])) {
$searchclass = '';

View File

@ -22,7 +22,7 @@ if (!empty($extrafieldsobjectkey)) { // $extrafieldsobject is the $object->table
foreach ($extrafields->attributes[$extrafieldsobjectkey]['label'] as $key => $val) {
if (!empty($arrayfields[$extrafieldsobjectprefix.$key]['checked'])) {
$align = $extrafields->getAlignFlag($key);
$cssclass = $extrafields->getAlignFlag($key, $extrafieldsobjectkey);
$sortonfield = $extrafieldsobjectprefix.$key;
if (!empty($extrafields->attributes[$extrafieldsobjectkey]['computed'][$key])) {
$sortonfield = '';
@ -36,7 +36,7 @@ if (!empty($extrafieldsobjectkey)) { // $extrafieldsobject is the $object->table
$tooltip = empty($extrafields->attributes[$extrafieldsobjectkey]['help'][$key]) ? '' : $extrafields->attributes[$extrafieldsobjectkey]['help'][$key];
print getTitleFieldOfList($extrafields->attributes[$extrafieldsobjectkey]['label'][$key], 0, $_SERVER["PHP_SELF"], $sortonfield, "", $param, ($align ? 'align="'.$align.'" data-titlekey="'.$key.'"' : 'data-titlekey="'.$key.'"'), $sortfield, $sortorder, '', $disablesortlink, $tooltip)."\n";
print getTitleFieldOfList($extrafields->attributes[$extrafieldsobjectkey]['label'][$key], 0, $_SERVER["PHP_SELF"], $sortonfield, "", $param, ($cssclass ? 'class="'.$cssclass.'" data-titlekey="'.$key.'"' : 'data-titlekey="'.$key.'"'), $sortfield, $sortorder, '', $disablesortlink, $tooltip)."\n";
if (isset($totalarray) && isset($totalarray['nbfield'])) {
$totalarray['nbfield']++;
}

View File

@ -659,9 +659,9 @@ if ($action == "view_ticketlist") {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
if (!empty($arrayfields["ef.".$key]['checked'])) {
print '<td';
$align = $extrafields->getAlignFlag($key);
if ($align) {
print ' align="'.$align.'"';
$cssstring = $extrafields->getAlignFlag($key, $object->table_element);
if ($cssstring) {
print ' class="'.$cssstring.'"';
}
print '>';
$tmpkey = 'options_'.$key;