Fix filter on project id when id is list with comma
This commit is contained in:
parent
1351a43a30
commit
2204790602
@ -30,16 +30,19 @@
|
||||
|
||||
if (($id > 0 || (! empty($ref) && ! in_array($action, array('create', 'createtask', 'add')))) && (empty($cancel) || $id > 0))
|
||||
{
|
||||
$ret = $object->fetch($id, $ref);
|
||||
if ($ret > 0)
|
||||
{
|
||||
$object->fetch_thirdparty();
|
||||
$id = $object->id;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (empty($object->error) && ! count($object->errors)) setEventMessages('Fetch on object return an error without filling $object->error nor $object->errors', null, 'errors');
|
||||
else setEventMessages($object->error, $object->errors, 'errors');
|
||||
$action='';
|
||||
}
|
||||
if (($id > 0 && is_numeric($id)) || ! empty($ref)) // To discard case when id is list of ids like '1,2,3...'
|
||||
{
|
||||
$ret = $object->fetch($id, $ref);
|
||||
if ($ret > 0)
|
||||
{
|
||||
$object->fetch_thirdparty();
|
||||
$id = $object->id;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (empty($object->error) && ! count($object->errors)) setEventMessages('Fetch on object return an error without filling $object->error nor $object->errors', null, 'errors');
|
||||
else setEventMessages($object->error, $object->errors, 'errors');
|
||||
$action='';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -6568,7 +6568,7 @@ function dol_getmypid()
|
||||
/**
|
||||
* Generate natural SQL search string for a criteria (this criteria can be tested on one or several fields)
|
||||
*
|
||||
* @param string|string[] $fields String or array of strings, filled with the name of all fields in the SQL query we must check (combined with a OR)
|
||||
* @param string|string[] $fields String or array of strings, filled with the name of all fields in the SQL query we must check (combined with a OR). Example: array("p.field1","p.field2")
|
||||
* @param string $value The value to look for.
|
||||
* If param $mode is 0, can contains several keywords separated with a space or |
|
||||
* like "keyword1 keyword2" = We want record field like keyword1 AND field like keyword2
|
||||
|
||||
@ -754,8 +754,8 @@ class Task extends CommonObject
|
||||
}
|
||||
if ($socid) $sql.= " AND p.fk_soc = ".$socid;
|
||||
if ($projectid) $sql.= " AND p.rowid in (".$projectid.")";
|
||||
if ($filteronproj) $sql.= " AND (p.ref LIKE '%".$this->db->escape($filteronproj)."%' OR p.title LIKE '%".$this->db->escape($filteronproj)."%')";
|
||||
if ($filteronprojstatus > -1) $sql.= " AND p.fk_statut = ".$filteronprojstatus;
|
||||
if ($filteronproj) $sql.= natural_search(array("p.ref", "p.title"), $filteronproj);
|
||||
if ($filteronprojstatus > -1) $sql.= " AND p.fk_statut IN (".$filteronprojstatus.")";
|
||||
if ($morewherefilter) $sql.=$morewherefilter;
|
||||
$sql.= " ORDER BY p.ref, t.rang, t.dateo";
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -80,12 +80,12 @@ if (! empty($conf->use_javascript_ajax))
|
||||
);
|
||||
}
|
||||
|
||||
$title=$langs->trans("Project").' - '.$langs->trans("Gantt").' - '.$object->ref.' '.$object->name;
|
||||
if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/projectnameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->ref.' '.$object->name.' - '.$langs->trans("Gantt");
|
||||
$title=$langs->trans("Project").' - '.$langs->trans("Gantt").($object->ref?' - '.$object->ref.' '.$object->name:'');
|
||||
if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/projectnameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=($object->ref?$object->ref.' '.$object->name.' - ':'').$langs->trans("Gantt");
|
||||
$help_url="EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos";
|
||||
llxHeader("",$title,$help_url,'',0,0,$arrayofjs,$arrayofcss);
|
||||
|
||||
if ($id > 0 || ! empty($ref))
|
||||
if (($id > 0 && is_numeric($id)) || ! empty($ref))
|
||||
{
|
||||
// To verify role of users
|
||||
//$userAccess = $object->restrictedProjectArea($user,'read');
|
||||
@ -93,7 +93,6 @@ if ($id > 0 || ! empty($ref))
|
||||
//$userDelete = $object->restrictedProjectArea($user,'delete');
|
||||
//print "userAccess=".$userAccess." userWrite=".$userWrite." userDelete=".$userDelete;
|
||||
|
||||
|
||||
$tab='gantt';
|
||||
|
||||
$head=project_prepare_head($object);
|
||||
@ -195,7 +194,7 @@ if ($id > 0 || ! empty($ref))
|
||||
* Buttons actions
|
||||
*/
|
||||
|
||||
if ($id > 0)
|
||||
if ($id > 0 && is_numeric($id))
|
||||
{
|
||||
|
||||
print '<div class="tabsAction">';
|
||||
@ -229,7 +228,7 @@ else
|
||||
// Get list of tasks in tasksarray and taskarrayfiltered
|
||||
// We need all tasks (even not limited to a user because a task to user
|
||||
// can have a parent that is not affected to him).
|
||||
$tasksarray=$task->getTasksArray(0, 0, $object->id, $socid, 0);
|
||||
$tasksarray=$task->getTasksArray(0, 0, ($object->id ? $object->id : $id), $socid, 0);
|
||||
// We load also tasks limited to a particular user
|
||||
//$tasksrole=($_REQUEST["mode"]=='mine' ? $task->getUserRolesForProjectsOrTasks(0,$user,$object->id,0) : '');
|
||||
//var_dump($tasksarray);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user