This commit is contained in:
ldestailleur 2019-01-03 13:28:35 +01:00
parent 60d3cced37
commit 7c1ed5b913

View File

@ -1341,6 +1341,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
if (is_object($objcon) && $objcon->id) {
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."actioncomm_resources as r ON a.id = r.fk_actioncomm";
$sql.= " AND r.element_type = '" . $db->escape($objcon->table_element) . "' AND r.fk_element = " . $objcon->id;
}
if (is_object($filterobj) && get_class($filterobj) == 'Societe') $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid";
@ -1373,13 +1374,6 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
if ($filterobj->id) $sql.= " AND a.fk_element = ".$filterobj->id;
}
// Work with new table actioncomm_resources and multiple contact affectation.
if (is_object($objcon) && $objcon->id)
{
$sql.= " AND r.element_type = '" . $objcon->table_element . "'" .
" AND r.fk_element = " . $objcon->id;
}
// Condition on actioncode
if (! empty($actioncode))
{
@ -1403,7 +1397,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
if ($donetodo == 'todo') $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep > '".$db->idate($now)."'))";
elseif ($donetodo == 'done') $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep <= '".$db->idate($now)."'))";
if (is_array($filters) && $filters['search_agenda_label']) $sql.= natural_search('a.label', $filters['search_agenda_label']);
//TODO Add limit for thirdparty in contexte very all result
$sql.= $db->order($sortfield, $sortorder);
dol_syslog("company.lib::show_actions_done", LOG_DEBUG);