Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into

develop
This commit is contained in:
Laurent Destailleur
2025-11-25 21:00:16 +01:00
8 changed files with 56 additions and 33 deletions

View File

@@ -244,7 +244,11 @@ if ($user->socid > 0) { // Protection if external user
$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_');
if (!empty($object->table_element)) {
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
} else {
$search_array_options = array();
}
$search_component_params = array('');
$search_component_params_hidden = trim(GETPOST('search_component_params_hidden', 'alphanohtml'));
@@ -353,7 +357,11 @@ $arrayofgroupby = array();
$arrayofyaxis = array();
$arrayofvaluesforgroupby = array();
$features = $object->element;
if (!empty($object->element)) {
$features = $object->element;
} else {
$features = '';
}
if (!empty($object->element_for_permission)) {
$features = $object->element_for_permission;
} else {
@@ -516,28 +524,30 @@ if (count($search_groupby)) {
}
$regs = array();
if (!empty($object->fields[$gvalwithoutprefix]['arrayofkeyval'])) {
$valuetranslated = $object->fields[$gvalwithoutprefix]['arrayofkeyval'][$obj->val];
if (is_null($valuetranslated)) {
$valuetranslated = $langs->transnoentitiesnoconv("UndefinedKey");
}
$valuetranslated = $langs->trans($valuetranslated);
} elseif (preg_match('/integer:([^:]+):([^:]+)$/', $object->fields[$gvalwithoutprefix]['type'], $regs)) {
$classname = $regs[1];
$classpath = $regs[2];
dol_include_once($classpath);
if (class_exists($classname)) {
$tmpobject = new $classname($db);
'@phan-var-force CommonObject $tmpobject';
$tmpobject->fetch($obj->val);
foreach ($tmpobject->fields as $fieldkey => $field) {
if ($field['showoncombobox']) {
$valuetranslated = $tmpobject->$fieldkey;
//if ($valuetranslated == '-') $valuetranslated = $langs->transnoentitiesnoconv("Unknown")
break;
}
if (isset($object->fields[$gvalwithoutprefix])) {
if (!empty($object->fields[$gvalwithoutprefix]['arrayofkeyval'])) {
$valuetranslated = $object->fields[$gvalwithoutprefix]['arrayofkeyval'][$obj->val];
if (is_null($valuetranslated)) {
$valuetranslated = $langs->transnoentitiesnoconv("UndefinedKey");
}
$valuetranslated = $langs->trans($valuetranslated);
} elseif (preg_match('/integer:([^:]+):([^:]+)$/', $object->fields[$gvalwithoutprefix]['type'], $regs)) {
$classname = $regs[1];
$classpath = $regs[2];
dol_include_once($classpath);
if (class_exists($classname)) {
$tmpobject = new $classname($db);
'@phan-var-force CommonObject $tmpobject';
$tmpobject->fetch($obj->val);
foreach ($tmpobject->fields as $fieldkey => $field) {
if ($field['showoncombobox']) {
$valuetranslated = $tmpobject->$fieldkey;
//if ($valuetranslated == '-') $valuetranslated = $langs->transnoentitiesnoconv("Unknown")
break;
}
}
//$valuetranslated = $tmpobject->ref.'eee';
}
//$valuetranslated = $tmpobject->ref.'eee';
}
}
@@ -545,7 +555,7 @@ if (count($search_groupby)) {
}
// Add also the possible NULL value if field is a parent field that is not a strict join
$tmpfield = explode('.', $gval);
if ($tmpfield[0] != 't' || (is_array($object->fields[$tmpfield[1]]) && empty($object->fields[$tmpfield[1]]['notnull']))) {
if ($tmpfield[0] != 't' || (isset($object->fields[$tmpfield[1]]) && is_array($object->fields[$tmpfield[1]]) && empty($object->fields[$tmpfield[1]]['notnull']))) {
dol_syslog("The group by field ".$gval." may be null (because field is null or it is a left join), so we add __NULL__ entry in list of possible values");
//var_dump($gval); var_dump($object->fields);
$arrayofvaluesforgroupby['g_'.$gkey]['__NULL__'] = $langs->transnoentitiesnoconv("NotDefined");
@@ -1270,10 +1280,14 @@ if ($mode == 'graph') {
$dir = $conf->user->dir_temp;
dol_mkdir($dir);
// $customreportkey may be defined when using customreports.php as an include
$filenamekey = $dir.'/customreport_'.$object->element.(empty($customreportkey) ? '' : $customreportkey).'.png';
$fileurlkey = DOL_URL_ROOT.'/viewimage.php?modulepart=user&file=customreport_'.$object->element.(empty($customreportkey) ? '' : $customreportkey).'.png';
if (!empty($object->element)) {
$filenamekey = $dir.'/customreport_'.$object->element.(empty($customreportkey) ? '' : $customreportkey).'.png';
$fileurlkey = DOL_URL_ROOT.'/viewimage.php?modulepart=user&file=customreport_'.$object->element.(empty($customreportkey) ? '' : $customreportkey).'.png';
}
$px1->draw($filenamekey, $fileurlkey);
if (isset($filenamekey) && isset($fileurlkey)) {
$px1->draw($filenamekey, $fileurlkey);
}
$texttoshow = $langs->trans("NoRecordFound");
if (!GETPOSTISSET('search_measures') || !GETPOSTISSET('search_xaxis')) {