mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Debug v18
This commit is contained in:
parent
5441b1998b
commit
b9cea63027
|
|
@ -823,9 +823,9 @@ class ExtraFields
|
|||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Load array this->attributes
|
||||
* Load the array of extrafields defintion $this->attributes
|
||||
*
|
||||
* @param string $elementtype Type of element ('' = all or $object->table_element like 'adherent', 'commande', 'thirdparty', 'facture', 'propal', 'product', ...).
|
||||
* @param string $elementtype Type of element ('all' = all or $object->table_element like 'adherent', 'commande', 'thirdparty', 'facture', 'propal', 'product', ...).
|
||||
* @param boolean $forceload Force load of extra fields whatever is status of cache.
|
||||
* @return array Array of attributes keys+label for all extra fields.
|
||||
*/
|
||||
|
|
@ -848,6 +848,9 @@ class ExtraFields
|
|||
$elementtype = 'commande_fournisseur';
|
||||
}
|
||||
|
||||
// Test cache $this->attributes[$elementtype]['loaded'] to see if we must do something
|
||||
// TODO
|
||||
|
||||
$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
|
||||
|
|
@ -855,7 +858,7 @@ class ExtraFields
|
|||
$sql .= " css, cssview, csslist";
|
||||
$sql .= " FROM ".$this->db->prefix()."extrafields";
|
||||
//$sql.= " WHERE entity IN (0,".$conf->entity.")"; // Filter is done later
|
||||
if ($elementtype) {
|
||||
if ($elementtype && $elementtype != 'all') {
|
||||
$sql .= " WHERE elementtype = '".$this->db->escape($elementtype)."'"; // Filed with object->table_element
|
||||
}
|
||||
$sql .= " ORDER BY pos";
|
||||
|
|
@ -906,7 +909,7 @@ class ExtraFields
|
|||
}
|
||||
}
|
||||
if ($elementtype) {
|
||||
$this->attributes[$elementtype]['loaded'] = 1; // If nothing found, we also save tag 'loaded'
|
||||
$this->attributes[$elementtype]['loaded'] = 1; // Note: If nothing is found, we also set the key 'loaded' to 1.
|
||||
$this->attributes[$elementtype]['count'] = $count;
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -152,7 +152,7 @@ if ($user->socid > 0) { // Protection if external user
|
|||
}
|
||||
|
||||
// Fetch optionals attributes and labels
|
||||
$extrafields->fetch_name_optionals_label($object->table_element);
|
||||
$extrafields->fetch_name_optionals_label('all'); // We load all extrafields definitions for all objects
|
||||
//$extrafields->fetch_name_optionals_label($object->table_element_line);
|
||||
|
||||
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
|
||||
|
|
@ -452,12 +452,12 @@ if (empty($conf->use_javascript_ajax)) {
|
|||
}
|
||||
print '</div><div class="clearboth"></div>';
|
||||
|
||||
// Add Filter (you can use param &show_search_component_params_hidden=1 for debug)
|
||||
// Filter (you can use param &show_search_component_params_hidden=1 for debug)
|
||||
print '<div class="divadvancedsearchfield quatrevingtpercent">';
|
||||
print $form->searchComponent(array($object->element => $object->fields), $search_component_params, array(), $search_component_params_hidden);
|
||||
print '</div>';
|
||||
|
||||
// Add measures into array
|
||||
// YAxis (add measures into array)
|
||||
$count = 0;
|
||||
//var_dump($arrayofmesures);
|
||||
print '<div class="divadvancedsearchfield clearboth">';
|
||||
|
|
@ -952,7 +952,6 @@ $db->close();
|
|||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Fill arrayofmesures for an object
|
||||
*
|
||||
|
|
@ -1039,7 +1038,7 @@ function fillArrayOfMeasures($object, $tablealias, $labelofobject, &$arrayofmesu
|
|||
foreach ($object->fields as $key => $val) {
|
||||
if (preg_match('/^[^:]+:[^:]+:/', $val['type'])) {
|
||||
$tmptype = explode(':', $val['type'], 4);
|
||||
if ($tmptype[0] == 'integer' && $tmptype[1] && $tmptype[2]) {
|
||||
if ($tmptype[0] == 'integer' && !empty($tmptype[1]) && !empty($tmptype[2])) {
|
||||
$newobject = $tmptype[1];
|
||||
dol_include_once($tmptype[2]);
|
||||
if (class_exists($newobject)) {
|
||||
|
|
@ -1073,11 +1072,7 @@ function fillArrayOfXAxis($object, $tablealias, $labelofobject, &$arrayofxaxis,
|
|||
{
|
||||
global $langs, $extrafields, $db;
|
||||
|
||||
if ($level > 10) { // Protection against infinite loop
|
||||
return $arrayofxaxis;
|
||||
}
|
||||
|
||||
if ($level >= 2) {
|
||||
if ($level >= 2) { // Limit scan on 2 levels max
|
||||
return $arrayofxaxis;
|
||||
}
|
||||
|
||||
|
|
@ -1088,6 +1083,10 @@ function fillArrayOfXAxis($object, $tablealias, $labelofobject, &$arrayofxaxis,
|
|||
$MI = substr($langs->trans("Minute"), 0, 1).substr($langs->trans("Minute"), 0, 1);
|
||||
$SS = substr($langs->trans("Second"), 0, 1).substr($langs->trans("Second"), 0, 1);
|
||||
|
||||
/*if ($level > 0) {
|
||||
var_dump($object->element.' '.$object->isextrafieldmanaged);
|
||||
}*/
|
||||
|
||||
// Add main fields of object
|
||||
foreach ($object->fields as $key => $val) {
|
||||
if (empty($val['measure'])) {
|
||||
|
|
@ -1148,11 +1147,30 @@ function fillArrayOfXAxis($object, $tablealias, $labelofobject, &$arrayofxaxis,
|
|||
if (!empty($extrafields->attributes[$object->table_element]['totalizable'][$key])) {
|
||||
continue;
|
||||
}
|
||||
$arrayofxaxis[$tablealias.'e.'.$key] = array(
|
||||
'label' => img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($extrafields->attributes[$object->table_element]['label'][$key]),
|
||||
'position' => 1000 + (int) $extrafields->attributes[$object->table_element]['pos'][$key] + ($count * 100000),
|
||||
'table' => $object->table_element
|
||||
);
|
||||
if (in_array($extrafields->attributes[$object->table_element]['type'][$key], array('timestamp', 'date', 'datetime'))) {
|
||||
$position = (empty($extrafields->attributes[$object->table_element]['pos'][$key]) ? 0 : intVal($extrafields->attributes[$object->table_element]['pos'][$key]));
|
||||
$arrayofxaxis[$tablealias.'.e'.$key.'-year'] = array(
|
||||
'label' => img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val).' <span class="opacitymedium">('.$YYYY.')</span>',
|
||||
'position' => ($position + ($count * 100000)).'.1',
|
||||
'table' => $object->table_element
|
||||
);
|
||||
$arrayofxaxis[$tablealias.'.e'.$key.'-month'] = array(
|
||||
'label' => img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val).' <span class="opacitymedium">('.$YYYY.'-'.$MM.')</span>',
|
||||
'position' => ($position + ($count * 100000)).'.2',
|
||||
'table' => $object->table_element
|
||||
);
|
||||
$arrayofxaxis[$tablealias.'.e'.$key.'-day'] = array(
|
||||
'label' => img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val).' <span class="opacitymedium">('.$YYYY.'-'.$MM.'-'.$DD.')</span>',
|
||||
'position' => ($position + ($count * 100000)).'.3',
|
||||
'table' => $object->table_element
|
||||
);
|
||||
} else {
|
||||
$arrayofxaxis[$tablealias.'e.'.$key] = array(
|
||||
'label' => img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val),
|
||||
'position' => 1000 + (int) $extrafields->attributes[$object->table_element]['pos'][$key] + ($count * 100000),
|
||||
'table' => $object->table_element
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -131,6 +131,11 @@ class Societe extends CommonObject
|
|||
*/
|
||||
public $ismultientitymanaged = 1;
|
||||
|
||||
/**
|
||||
* @var int Does object support extrafields ? 0=No, 1=Yes
|
||||
*/
|
||||
public $isextrafieldmanaged = 1;
|
||||
|
||||
/**
|
||||
* 0=Default, 1=View may be restricted to sales representative only if no permission to see all or to company of external user if external user
|
||||
* @var integer
|
||||
|
|
@ -194,8 +199,8 @@ class Societe extends CommonObject
|
|||
'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'RefExt', 'enabled'=>1, 'visible'=>0, 'position'=>45),
|
||||
'code_client' =>array('type'=>'varchar(24)', 'label'=>'CustomerCode', 'enabled'=>1, 'visible'=>-1, 'position'=>55),
|
||||
'code_fournisseur' =>array('type'=>'varchar(24)', 'label'=>'SupplierCode', 'enabled'=>1, 'visible'=>-1, 'position'=>60),
|
||||
'code_compta' =>array('type'=>'varchar(24)', 'label'=>'CodeCompta', 'enabled'=>1, 'visible'=>-1, 'position'=>65),
|
||||
'code_compta_fournisseur' =>array('type'=>'varchar(24)', 'label'=>'CodeComptaSupplier', 'enabled'=>1, 'visible'=>-1, 'position'=>70),
|
||||
'code_compta' =>array('type'=>'varchar(24)', 'label'=>'CustomerAccountancyCode', 'enabled'=>1, 'visible'=>-1, 'position'=>65),
|
||||
'code_compta_fournisseur' =>array('type'=>'varchar(24)', 'label'=>'SupplierAccountancyCode', 'enabled'=>1, 'visible'=>-1, 'position'=>70),
|
||||
'address' =>array('type'=>'varchar(255)', 'label'=>'Address', 'enabled'=>1, 'visible'=>-1, 'position'=>75),
|
||||
'zip' =>array('type'=>'varchar(25)', 'label'=>'Zip', 'enabled'=>1, 'visible'=>-1, 'position'=>80),
|
||||
'town' =>array('type'=>'varchar(50)', 'label'=>'Town', 'enabled'=>1, 'visible'=>-1, 'position'=>85),
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user