FIX closing tags

This commit is contained in:
Laurent Destailleur 2020-03-22 02:44:00 +01:00
parent 4ce1665a15
commit bcf17c79ef

View File

@ -1317,6 +1317,8 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
} }
$sortfield_new = implode(',', $sortfield_new_list); $sortfield_new = implode(',', $sortfield_new_list);
$sql = '';
if (!empty($conf->agenda->enabled)) if (!empty($conf->agenda->enabled))
{ {
// Recherche histo sur actioncomm // Recherche histo sur actioncomm
@ -1468,85 +1470,88 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
} }
//TODO Add limit in nb of results //TODO Add limit in nb of results
$sql .= $db->order($sortfield_new, $sortorder); if ($sql)
dol_syslog("company.lib::show_actions_done", LOG_DEBUG);
$resql = $db->query($sql);
if ($resql)
{ {
$i = 0; $sql .= $db->order($sortfield_new, $sortorder);
$num = $db->num_rows($resql); dol_syslog("company.lib::show_actions_done", LOG_DEBUG);
$resql = $db->query($sql);
if ($resql)
{
$i = 0;
$num = $db->num_rows($resql);
while ($i < $num) while ($i < $num)
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
if ($obj->type == 'action') { if ($obj->type == 'action') {
$contactaction = new ActionComm($db); $contactaction = new ActionComm($db);
$contactaction->id = $obj->id; $contactaction->id = $obj->id;
$result = $contactaction->fetchResources(); $result = $contactaction->fetchResources();
if ($result < 0) { if ($result < 0) {
dol_print_error($db); dol_print_error($db);
setEventMessage("company.lib::show_actions_done Error fetch ressource", 'errors'); setEventMessage("company.lib::show_actions_done Error fetch ressource", 'errors');
} }
//if ($donetodo == 'todo') $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep > '".$db->idate($now)."'))"; //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)."'))"; //elseif ($donetodo == 'done') $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep <= '".$db->idate($now)."'))";
$tododone = ''; $tododone = '';
if (($obj->percent >= 0 and $obj->percent < 100) || ($obj->percent == -1 && $obj->datep > $now)) $tododone = 'todo'; if (($obj->percent >= 0 and $obj->percent < 100) || ($obj->percent == -1 && $obj->datep > $now)) $tododone = 'todo';
$histo[$numaction] = array( $histo[$numaction] = array(
'type'=>$obj->type, 'type'=>$obj->type,
'tododone'=>$tododone, 'tododone'=>$tododone,
'id'=>$obj->id, 'id'=>$obj->id,
'datestart'=>$db->jdate($obj->dp), 'datestart'=>$db->jdate($obj->dp),
'dateend'=>$db->jdate($obj->dp2), 'dateend'=>$db->jdate($obj->dp2),
'note'=>$obj->label, 'note'=>$obj->label,
'percent'=>$obj->percent, 'percent'=>$obj->percent,
'userid'=>$obj->user_id, 'userid'=>$obj->user_id,
'login'=>$obj->user_login, 'login'=>$obj->user_login,
'userfirstname'=>$obj->user_firstname, 'userfirstname'=>$obj->user_firstname,
'userlastname'=>$obj->user_lastname, 'userlastname'=>$obj->user_lastname,
'userphoto'=>$obj->user_photo, 'userphoto'=>$obj->user_photo,
'contact_id'=>$obj->fk_contact, 'contact_id'=>$obj->fk_contact,
'socpeopleassigned' => $contactaction->socpeopleassigned, 'socpeopleassigned' => $contactaction->socpeopleassigned,
'lastname'=>$obj->lastname, 'lastname'=>$obj->lastname,
'firstname'=>$obj->firstname, 'firstname'=>$obj->firstname,
'fk_element'=>$obj->fk_element, 'fk_element'=>$obj->fk_element,
'elementtype'=>$obj->elementtype, 'elementtype'=>$obj->elementtype,
// Type of event // Type of event
'acode'=>$obj->acode, 'acode'=>$obj->acode,
'alabel'=>$obj->alabel, 'alabel'=>$obj->alabel,
'libelle'=>$obj->alabel, // deprecated 'libelle'=>$obj->alabel, // deprecated
'apicto'=>$obj->apicto 'apicto'=>$obj->apicto
); );
} else { } else {
$histo[$numaction] = array( $histo[$numaction] = array(
'type'=>$obj->type, 'type'=>$obj->type,
'tododone'=>'done', 'tododone'=>'done',
'id'=>$obj->id, 'id'=>$obj->id,
'datestart'=>$db->jdate($obj->dp), 'datestart'=>$db->jdate($obj->dp),
'dateend'=>$db->jdate($obj->dp2), 'dateend'=>$db->jdate($obj->dp2),
'note'=>$obj->label, 'note'=>$obj->label,
'percent'=>$obj->percent, 'percent'=>$obj->percent,
'acode'=>$obj->acode, 'acode'=>$obj->acode,
'userid'=>$obj->user_id, 'userid'=>$obj->user_id,
'login'=>$obj->user_login, 'login'=>$obj->user_login,
'userfirstname'=>$obj->user_firstname, 'userfirstname'=>$obj->user_firstname,
'userlastname'=>$obj->user_lastname, 'userlastname'=>$obj->user_lastname,
'userphoto'=>$obj->user_photo 'userphoto'=>$obj->user_photo
); );
} }
$numaction++; $numaction++;
$i++; $i++;
} }
} }
else else
{ {
dol_print_error($db); dol_print_error($db);
}
} }
if (!empty($conf->agenda->enabled) || (!empty($conf->mailing->enabled) && !empty($objcon->email))) if (!empty($conf->agenda->enabled) || (!empty($conf->mailing->enabled) && !empty($objcon->email)))
@ -1781,9 +1786,9 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
} }
$out .= "</table>\n"; $out .= "</table>\n";
$out .= "</div>\n"; $out .= "</div>\n";
}
$out .= '</form>'; $out .= '</form>';
}
if ($noprint) return $out; if ($noprint) return $out;
else print $out; else print $out;