Fixed: Export was not using user assigned
This commit is contained in:
parent
4d67e6f4d4
commit
362167f319
@ -171,7 +171,7 @@ $message.='<br>';
|
||||
print $message;
|
||||
|
||||
$message=$langs->trans("AgendaUrlOptions1",$user->login,$user->login).'<br>';
|
||||
$message.=$langs->trans("AgendaUrlOptions2",$user->login,$user->login).'<br>';
|
||||
//$message.=$langs->trans("AgendaUrlOptions2",$user->login,$user->login).'<br>';
|
||||
$message.=$langs->trans("AgendaUrlOptions3",$user->login,$user->login).'<br>';
|
||||
$message.=$langs->trans("AgendaUrlOptions4",$user->login,$user->login).'<br>';
|
||||
$message.=$langs->trans("AgendaUrlOptionsProject",$user->login,$user->login);
|
||||
|
||||
@ -976,7 +976,7 @@ class ActionComm extends CommonObject
|
||||
$sql.= " a.label, a.code, a.note, a.fk_action as type_id,";
|
||||
$sql.= " a.fk_soc,";
|
||||
$sql.= " a.fk_user_author, a.fk_user_mod,";
|
||||
$sql.= " a.fk_user_action, a.fk_user_done,";
|
||||
$sql.= " a.fk_user_action,";
|
||||
$sql.= " a.fk_contact, a.percent as percentage,";
|
||||
$sql.= " a.fk_element, a.elementtype,";
|
||||
$sql.= " a.priority, a.fulldayevent, a.location, a.punctual, a.transparency,";
|
||||
@ -984,9 +984,11 @@ class ActionComm extends CommonObject
|
||||
$sql.= " s.nom as socname,";
|
||||
$sql.= " c.id as type_id, c.code as type_code, c.libelle";
|
||||
$sql.= " FROM (".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."actioncomm as a)";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on u.rowid = a.fk_user_author";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on u.rowid = a.fk_user_author"; // Link to get author of event for export
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on s.rowid = a.fk_soc";
|
||||
$sql.= " WHERE a.fk_action=c.id";
|
||||
// We must filter on assignement table
|
||||
if ($filters['logint'] || $filters['login']) $sql.=", ".MAIN_DB_PREFIX."actioncomm_resources as ar";
|
||||
$sql.= " WHERE a.fk_action=c.id";
|
||||
$sql.= " AND a.entity = ".$conf->entity;
|
||||
foreach ($filters as $key => $value)
|
||||
{
|
||||
@ -996,17 +998,8 @@ class ActionComm extends CommonObject
|
||||
if ($key == 'idfrom') $sql.=" AND a.id >= ".(is_numeric($value)?$value:0);
|
||||
if ($key == 'idto') $sql.=" AND a.id <= ".(is_numeric($value)?$value:0);
|
||||
if ($key == 'project') $sql.=" AND a.fk_project=".(is_numeric($value)?$value:0);
|
||||
if ($key == 'login')
|
||||
{
|
||||
$login=$value;
|
||||
$userforfilter=new User($this->db);
|
||||
$result=$userforfilter->fetch('',$value);
|
||||
$sql.= " AND (";
|
||||
$sql.= " a.fk_user_author = ".$userforfilter->id;
|
||||
$sql.= " OR a.fk_user_action = ".$userforfilter->id;
|
||||
$sql.= " OR a.fk_user_done = ".$userforfilter->id;
|
||||
$sql.= ")";
|
||||
}
|
||||
// We must filter on assignement table
|
||||
if ($key == 'logint' || $key == 'login') $sql.= " AND ar.fk_actioncomm = a.id AND ar.element_type='user'";
|
||||
if ($key == 'logina')
|
||||
{
|
||||
$logina=$value;
|
||||
@ -1014,19 +1007,12 @@ class ActionComm extends CommonObject
|
||||
$result=$userforfilter->fetch('',$value);
|
||||
$sql.= " AND a.fk_user_author = ".$userforfilter->id;
|
||||
}
|
||||
if ($key == 'logint')
|
||||
if ($key == 'logint' || $key == 'login')
|
||||
{
|
||||
$logint=$value;
|
||||
$userforfilter=new User($this->db);
|
||||
$result=$userforfilter->fetch('',$value);
|
||||
$sql.= " AND a.fk_user_action = ".$userforfilter->id;
|
||||
}
|
||||
if ($key == 'logind')
|
||||
{
|
||||
$logind=$value;
|
||||
$userforfilter=new User($this->db);
|
||||
$result=$userforfilter->fetch('',$value);
|
||||
$sql.= " AND a.fk_user_done = ".$userforfilter->id;
|
||||
$sql.= " AND ar.fk_element = ".$userforfilter->id;
|
||||
}
|
||||
}
|
||||
$sql.= " AND a.datep IS NOT NULL"; // To exclude corrupted events and avoid errors in lightning/sunbird import
|
||||
|
||||
@ -68,7 +68,7 @@ DateActionDoneEnd= Real end date
|
||||
DateActionStart= Start date
|
||||
DateActionEnd= End date
|
||||
AgendaUrlOptions1=You can also add following parameters to filter output:
|
||||
AgendaUrlOptions2=<b>login=%s</b> to restrict output to actions created by, assigned to or done by user <b>%s</b>.
|
||||
AgendaUrlOptions2=<b>login=%s</b> to restrict output to actions created by or assigned to user <b>%s</b>.
|
||||
AgendaUrlOptions3=<b>logina=%s</b> to restrict output to actions owned by a user <b>%s</b>.
|
||||
AgendaUrlOptions4=<b>logint=%s</b> to restrict output to actions assigned to user <b>%s</b>.
|
||||
AgendaUrlOptionsProject=<b>project=PROJECT_ID</b> to restrict output to actions associated to project <b>PROJECT_ID</b>.
|
||||
|
||||
@ -69,7 +69,6 @@ if (! empty($_GET["project"])) $filters['project']=$_GET["project"];
|
||||
if (! empty($_GET["login"])) $filters['login']=$_GET["login"];
|
||||
if (! empty($_GET["logina"])) $filters['logina']=$_GET["logina"];
|
||||
if (! empty($_GET["logint"])) $filters['logint']=$_GET["logint"];
|
||||
if (! empty($_GET["logind"])) $filters['logind']=$_GET["logind"];
|
||||
// Not older than
|
||||
if (! isset($conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY)) $conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY=100;
|
||||
$filters['notolderthan']=$conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY;
|
||||
@ -111,8 +110,7 @@ foreach ($filters as $key => $value)
|
||||
if ($key == 'project') $filename.='-project'.$value;
|
||||
if ($key == 'login') $filename.='-login'.$value;
|
||||
if ($key == 'logina') $filename.='-logina'.$value; // Author
|
||||
if ($key == 'logind') $filename.='-logind'.$value; // Affected to
|
||||
if ($key == 'logint') $filename.='-logint'.$value; // Done by
|
||||
if ($key == 'logint') $filename.='-logint'.$value; // Assigned to
|
||||
}
|
||||
// Add extension
|
||||
if ($format == 'vcal') { $shortfilename.='.vcs'; $filename.='.vcs'; }
|
||||
|
||||
Loading…
Reference in New Issue
Block a user