Fix conflict between option login and logina and logint in agenda export
This commit is contained in:
parent
cb1c461b69
commit
0ee93fb00c
@ -174,8 +174,8 @@ $message.='<br>';
|
|||||||
print $message;
|
print $message;
|
||||||
|
|
||||||
$message=$langs->trans("AgendaUrlOptions1",$user->login,$user->login).'<br>';
|
$message=$langs->trans("AgendaUrlOptions1",$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("AgendaUrlOptions3",$user->login,$user->login).'<br>';
|
||||||
|
$message.=$langs->trans("AgendaUrlOptionsNotAdmin",$user->login,$user->login).'<br>';
|
||||||
$message.=$langs->trans("AgendaUrlOptions4",$user->login,$user->login).'<br>';
|
$message.=$langs->trans("AgendaUrlOptions4",$user->login,$user->login).'<br>';
|
||||||
$message.=$langs->trans("AgendaUrlOptionsProject",$user->login,$user->login);
|
$message.=$langs->trans("AgendaUrlOptionsProject",$user->login,$user->login);
|
||||||
|
|
||||||
|
|||||||
@ -1279,7 +1279,7 @@ class ActionComm extends CommonObject
|
|||||||
$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."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.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on s.rowid = a.fk_soc";
|
||||||
// We must filter on assignement table
|
// We must filter on assignement table
|
||||||
if ($filters['logint'] || $filters['login']) $sql.=", ".MAIN_DB_PREFIX."actioncomm_resources as ar";
|
if ($filters['logint']) $sql.=", ".MAIN_DB_PREFIX."actioncomm_resources as ar";
|
||||||
$sql.= " WHERE a.fk_action=c.id";
|
$sql.= " WHERE a.fk_action=c.id";
|
||||||
$sql.= " AND a.entity IN (".getEntity('agenda').")";
|
$sql.= " AND a.entity IN (".getEntity('agenda').")";
|
||||||
foreach ($filters as $key => $value)
|
foreach ($filters as $key => $value)
|
||||||
@ -1291,20 +1291,34 @@ class ActionComm extends CommonObject
|
|||||||
if ($key == 'idto') $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 == 'project') $sql.=" AND a.fk_project=".(is_numeric($value)?$value:0);
|
||||||
// We must filter on assignement table
|
// 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 == 'logint') $sql.= " AND ar.fk_actioncomm = a.id AND ar.element_type='user'";
|
||||||
if ($key == 'logina')
|
if ($key == 'logina')
|
||||||
{
|
{
|
||||||
$logina=$value;
|
$logina=$value;
|
||||||
|
$condition='=';
|
||||||
|
if (preg_match('/^!/',$logina))
|
||||||
|
{
|
||||||
|
$logina=preg_replace('/^!/','',$logina);
|
||||||
|
$condition='<>';
|
||||||
|
}
|
||||||
$userforfilter=new User($this->db);
|
$userforfilter=new User($this->db);
|
||||||
$result=$userforfilter->fetch('',$value);
|
$result=$userforfilter->fetch('',$logina);
|
||||||
$sql.= " AND a.fk_user_author = ".$userforfilter->id;
|
if ($result > 0) $sql.= " AND a.fk_user_author ".$condition." ".$userforfilter->id;
|
||||||
|
elseif ($result < 0 || $condition == '=') $sql.= " AND a.fk_user_author = 0";
|
||||||
}
|
}
|
||||||
if ($key == 'logint' || $key == 'login')
|
if ($key == 'logint')
|
||||||
{
|
{
|
||||||
$logint=$value;
|
$logint=$value;
|
||||||
|
$condition='=';
|
||||||
|
if (preg_match('/^!/',$logint))
|
||||||
|
{
|
||||||
|
$logint=preg_replace('/^!/','',$logint);
|
||||||
|
$condition='<>';
|
||||||
|
}
|
||||||
$userforfilter=new User($this->db);
|
$userforfilter=new User($this->db);
|
||||||
$result=$userforfilter->fetch('',$value);
|
$result=$userforfilter->fetch('',$logint);
|
||||||
$sql.= " AND ar.fk_element = ".$userforfilter->id;
|
if ($result > 0) $sql.= " AND ar.fk_element = ".$userforfilter->id;
|
||||||
|
elseif ($result < 0 || $condition == '=') $sql.= " AND ar.fk_element = 0";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$sql.= " AND a.datep IS NOT NULL"; // To exclude corrupted events and avoid errors in lightning/sunbird import
|
$sql.= " AND a.datep IS NOT NULL"; // To exclude corrupted events and avoid errors in lightning/sunbird import
|
||||||
|
|||||||
@ -80,9 +80,9 @@ AgendaModelModule=Document templates for event
|
|||||||
DateActionStart=Start date
|
DateActionStart=Start date
|
||||||
DateActionEnd=End date
|
DateActionEnd=End date
|
||||||
AgendaUrlOptions1=You can also add following parameters to filter output:
|
AgendaUrlOptions1=You can also add following parameters to filter output:
|
||||||
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>.
|
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>.
|
AgendaUrlOptionsNotAdmin=<b>logina=!%s</b> to restrict output to actions not owned by user <b>%s</b>.
|
||||||
|
AgendaUrlOptions4=<b>logint=%s</b> to restrict output to actions assigned to user <b>%s</b> (owner and others).
|
||||||
AgendaUrlOptionsProject=<b>project=PROJECT_ID</b> to restrict output to actions associated to project <b>PROJECT_ID</b>.
|
AgendaUrlOptionsProject=<b>project=PROJECT_ID</b> to restrict output to actions associated to project <b>PROJECT_ID</b>.
|
||||||
AgendaShowBirthdayEvents=Show birthdays of contacts
|
AgendaShowBirthdayEvents=Show birthdays of contacts
|
||||||
AgendaHideBirthdayEvents=Hide birthdays of contacts
|
AgendaHideBirthdayEvents=Hide birthdays of contacts
|
||||||
|
|||||||
@ -65,19 +65,18 @@ if (! isset($conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY)) $conf->global->MAIN_A
|
|||||||
// Define format, type and filter
|
// Define format, type and filter
|
||||||
$format='ical';
|
$format='ical';
|
||||||
$type='event';
|
$type='event';
|
||||||
if (! empty($_GET["format"])) $format=$_GET["format"];
|
if (GETPOST("format",'alpha')) $format=GETPOST("format",'apha');
|
||||||
if (! empty($_GET["type"])) $type=$_GET["type"];
|
if (GETPOST("type",'apha')) $type=GETPOST("type",'alpha');
|
||||||
|
|
||||||
$filters=array();
|
$filters=array();
|
||||||
if (! empty($_GET["year"])) $filters['year']=$_GET["year"];
|
if (GETPOST("year",'int')) $filters['year']=GETPOST("year",'int');
|
||||||
if (! empty($_GET["id"])) $filters['id']=$_GET["id"];
|
if (GETPOST("id",'int')) $filters['id']=GETPOST("id",'int');
|
||||||
if (! empty($_GET["idfrom"])) $filters['idfrom']=$_GET["idfrom"];
|
if (GETPOST("idfrom",'int')) $filters['idfrom']=GETPOST("idfrom",'int');
|
||||||
if (! empty($_GET["idto"])) $filters['idto']=$_GET["idto"];
|
if (GETPOST("idto",'int')) $filters['idto']=GETPOST("idto",'int');
|
||||||
if (! empty($_GET["project"])) $filters['project']=$_GET["project"];
|
if (GETPOST("project",'apha')) $filters['project']=GETPOST("project",'apha');
|
||||||
if (! empty($_GET["login"])) $filters['login']=$_GET["login"];
|
if (GETPOST("logina",'apha')) $filters['logina']=GETPOST("logina",'apha');
|
||||||
if (! empty($_GET["logina"])) $filters['logina']=$_GET["logina"];
|
if (GETPOST("logint",'apha')) $filters['logint']=GETPOST("logint",'apha');
|
||||||
if (! empty($_GET["logint"])) $filters['logint']=$_GET["logint"];
|
if (GETPOST("notolderthan",'int')) $filters['notolderthan']=GETPOST("notolderthan","int");
|
||||||
if (GETPOST("notolderthan")) $filters['notolderthan']=GETPOST("notolderthan","int");
|
|
||||||
else $filters['notolderthan']=$conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY;
|
else $filters['notolderthan']=$conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY;
|
||||||
|
|
||||||
// Check config
|
// Check config
|
||||||
@ -115,7 +114,6 @@ foreach ($filters as $key => $value)
|
|||||||
if ($key == 'idfrom') $filename.='-idfrom'.$value;
|
if ($key == 'idfrom') $filename.='-idfrom'.$value;
|
||||||
if ($key == 'idto') $filename.='-idto'.$value;
|
if ($key == 'idto') $filename.='-idto'.$value;
|
||||||
if ($key == 'project') $filename.='-project'.$value;
|
if ($key == 'project') $filename.='-project'.$value;
|
||||||
if ($key == 'login') $filename.='-login'.$value;
|
|
||||||
if ($key == 'logina') $filename.='-logina'.$value; // Author
|
if ($key == 'logina') $filename.='-logina'.$value; // Author
|
||||||
if ($key == 'logint') $filename.='-logint'.$value; // Assigned to
|
if ($key == 'logint') $filename.='-logint'.$value; // Assigned to
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user