Debug usage of the new extrafield architecture
This commit is contained in:
parent
7bb8078b46
commit
4dadfac74b
@ -953,6 +953,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
|
|||||||
if ($search_name != '') $param.='&search_name='.urlencode($search_name);
|
if ($search_name != '') $param.='&search_name='.urlencode($search_name);
|
||||||
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
|
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
|
||||||
// Add $param from extra fields
|
// Add $param from extra fields
|
||||||
|
$extrafieldsobjectkey=$contactstatic->table_element;
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
||||||
|
|
||||||
$sql = "SELECT t.rowid, t.lastname, t.firstname, t.fk_pays as country_id, t.civility, t.poste, t.phone as phone_pro, t.phone_mobile, t.phone_perso, t.fax, t.email, t.skype, t.statut, t.photo,";
|
$sql = "SELECT t.rowid, t.lastname, t.firstname, t.fk_pays as country_id, t.civility, t.poste, t.phone as phone_pro, t.phone_mobile, t.phone_perso, t.fax, t.email, t.skype, t.statut, t.photo,";
|
||||||
@ -963,6 +964,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
|
|||||||
if ($search_status!='' && $search_status != '-1') $sql .= " AND t.statut = ".$db->escape($search_status);
|
if ($search_status!='' && $search_status != '-1') $sql .= " AND t.statut = ".$db->escape($search_status);
|
||||||
if ($search_name) $sql .= natural_search(array('t.lastname', 't.firstname'), $search_name);
|
if ($search_name) $sql .= natural_search(array('t.lastname', 't.firstname'), $search_name);
|
||||||
// Add where from extra fields
|
// Add where from extra fields
|
||||||
|
$extrafieldsobjectkey=$contactstatic->table_element;
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
|
||||||
if ($sortfield == "t.name") $sql.=" ORDER BY t.lastname $sortorder, t.firstname $sortorder";
|
if ($sortfield == "t.name") $sql.=" ORDER BY t.lastname $sortorder, t.firstname $sortorder";
|
||||||
else $sql.= " ORDER BY $sortfield $sortorder";
|
else $sql.= " ORDER BY $sortfield $sortorder";
|
||||||
@ -991,6 +993,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Extra fields
|
// Extra fields
|
||||||
|
$extrafieldsobjectkey=$contactstatic->table_element;
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
|
||||||
|
|
||||||
// Fields from hook
|
// Fields from hook
|
||||||
@ -1017,6 +1020,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
|
|||||||
if (! empty($arrayfields['t.'.$key]['checked'])) print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($align?'class="'.$align.'"':''), $sortfield, $sortorder, $align.' ')."\n";
|
if (! empty($arrayfields['t.'.$key]['checked'])) print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($align?'class="'.$align.'"':''), $sortfield, $sortorder, $align.' ')."\n";
|
||||||
}
|
}
|
||||||
// Extra fields
|
// Extra fields
|
||||||
|
$extrafieldsobjectkey=$contactstatic->table_element;
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
|
||||||
// Hook fields
|
// Hook fields
|
||||||
$parameters=array('arrayfields'=>$arrayfields);
|
$parameters=array('arrayfields'=>$arrayfields);
|
||||||
@ -1110,7 +1114,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Extra fields
|
// Extra fields
|
||||||
$extrafieldsobjectkey='socpeople';
|
$extrafieldsobjectkey=$contactstatic->table_element;
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
|
||||||
|
|
||||||
// Actions
|
// Actions
|
||||||
|
|||||||
@ -10,6 +10,8 @@ if (empty($conf) || ! is_object($conf))
|
|||||||
if (empty($extrafieldsobjectkey) && is_object($object)) $extrafieldsobjectkey=$object->table_element;
|
if (empty($extrafieldsobjectkey) && is_object($object)) $extrafieldsobjectkey=$object->table_element;
|
||||||
|
|
||||||
// Loop to show all columns of extrafields for the search title line
|
// Loop to show all columns of extrafields for the search title line
|
||||||
|
if (! empty($extrafieldsobjectkey)) // $extrafieldsobject is the $object->table_element like 'societe', 'socpeople', ...
|
||||||
|
{
|
||||||
if (is_array($extrafields->attributes[$extrafieldsobjectkey]['label']) && count($extrafields->attributes[$extrafieldsobjectkey]['label']))
|
if (is_array($extrafields->attributes[$extrafieldsobjectkey]['label']) && count($extrafields->attributes[$extrafieldsobjectkey]['label']))
|
||||||
{
|
{
|
||||||
foreach($extrafields->attributes[$extrafieldsobjectkey]['label'] as $key => $val)
|
foreach($extrafields->attributes[$extrafieldsobjectkey]['label'] as $key => $val)
|
||||||
@ -43,3 +45,4 @@ if (is_array($extrafields->attributes[$extrafieldsobjectkey]['label']) && count(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@ -7,18 +7,23 @@ if (empty($conf) || ! is_object($conf))
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (empty($extrafieldsobjectkey) && is_object($object)) $extrafieldsobjectkey=$object->table_element;
|
||||||
|
|
||||||
// Loop to show all columns of extrafields for the title line
|
// Loop to show all columns of extrafields for the title line
|
||||||
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']))
|
if (! empty($extrafieldsobjectkey)) // $extrafieldsobject is the $object->table_element like 'societe', 'socpeople', ...
|
||||||
{
|
{
|
||||||
foreach($extrafields->attributes[$object->table_element]['label'] as $key => $val)
|
if (is_array($extrafields->attributes[$extrafieldsobjectkey]['label']) && count($extrafields->attributes[$extrafieldsobjectkey]['label']))
|
||||||
|
{
|
||||||
|
foreach($extrafields->attributes[$extrafieldsobjectkey]['label'] as $key => $val)
|
||||||
{
|
{
|
||||||
if (! empty($arrayfields["ef.".$key]['checked']))
|
if (! empty($arrayfields["ef.".$key]['checked']))
|
||||||
{
|
{
|
||||||
$align=$extrafields->getAlignFlag($key);
|
$align=$extrafields->getAlignFlag($key);
|
||||||
$sortonfield = "ef.".$key;
|
$sortonfield = "ef.".$key;
|
||||||
if (! empty($extrafields->attributes[$object->table_element]['computed'][$key])) $sortonfield='';
|
if (! empty($extrafields->attributes[$extrafieldsobjectkey]['computed'][$key])) $sortonfield='';
|
||||||
if ($extrafields->attributes[$object->table_element]['type'][$key] == 'separate') print '<th class="liste_titre thseparator"></th>';
|
if ($extrafields->attributes[$extrafieldsobjectkey]['type'][$key] == 'separate') print '<th class="liste_titre thseparator"></th>';
|
||||||
else print getTitleFieldOfList($langs->trans($extralabels[$key]), 0, $_SERVER["PHP_SELF"], $sortonfield, "", $param, ($align?'align="'.$align.'"':''), $sortfield, $sortorder)."\n";
|
else print getTitleFieldOfList($langs->trans($extralabels[$key]), 0, $_SERVER["PHP_SELF"], $sortonfield, "", $param, ($align?'align="'.$align.'"':''), $sortfield, $sortorder)."\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user