Merge pull request #22617 from atm-jpb/FIX_task_never_deleted_in_bdd_on_deleted_project
FIX : add loadRoleMode on getlinearray
This commit is contained in:
commit
f0c257f62e
@ -838,7 +838,7 @@ class Project extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Fetch tasks
|
// Fetch tasks
|
||||||
$this->getLinesArray($user);
|
$this->getLinesArray($user, 0);
|
||||||
|
|
||||||
// Delete tasks
|
// Delete tasks
|
||||||
$ret = $this->deleteTasks($user);
|
$ret = $this->deleteTasks($user);
|
||||||
@ -2205,13 +2205,14 @@ class Project extends CommonObject
|
|||||||
* Create an array of tasks of current project
|
* Create an array of tasks of current project
|
||||||
*
|
*
|
||||||
* @param User $user Object user we want project allowed to
|
* @param User $user Object user we want project allowed to
|
||||||
|
* @param int $loadRoleMode 1= will test Roles on task; 0 used in delete project action
|
||||||
* @return int >0 if OK, <0 if KO
|
* @return int >0 if OK, <0 if KO
|
||||||
*/
|
*/
|
||||||
public function getLinesArray($user)
|
public function getLinesArray($user, $loadRoleMode = 1)
|
||||||
{
|
{
|
||||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
|
||||||
$taskstatic = new Task($this->db);
|
$taskstatic = new Task($this->db);
|
||||||
|
|
||||||
$this->lines = $taskstatic->getTasksArray(0, $user, $this->id, 0, 0);
|
$this->lines = $taskstatic->getTasksArray(0, $user, $this->id, 0, 0, '', '-1', '', 0, 0, array(), 0, array(), 0, $loadRoleMode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -772,9 +772,10 @@ class Task extends CommonObject
|
|||||||
* @param array $extrafields Show additional column from project or task
|
* @param array $extrafields Show additional column from project or task
|
||||||
* @param int $includebilltime Calculate also the time to bill and billed
|
* @param int $includebilltime Calculate also the time to bill and billed
|
||||||
* @param array $search_array_options Array of search
|
* @param array $search_array_options Array of search
|
||||||
|
* @param int $loadRoleMode 1= will test Roles on task; 0 used in delete project action
|
||||||
* @return array Array of tasks
|
* @return array Array of tasks
|
||||||
*/
|
*/
|
||||||
public function getTasksArray($usert = null, $userp = null, $projectid = 0, $socid = 0, $mode = 0, $filteronproj = '', $filteronprojstatus = '-1', $morewherefilter = '', $filteronprojuser = 0, $filterontaskuser = 0, $extrafields = array(), $includebilltime = 0, $search_array_options = array())
|
public function getTasksArray($usert = null, $userp = null, $projectid = 0, $socid = 0, $mode = 0, $filteronproj = '', $filteronprojstatus = '-1', $morewherefilter = '', $filteronprojuser = 0, $filterontaskuser = 0, $extrafields = array(), $includebilltime = 0, $search_array_options = array(), $loadRoleMode = 1)
|
||||||
{
|
{
|
||||||
global $conf, $hookmanager;
|
global $conf, $hookmanager;
|
||||||
|
|
||||||
@ -925,7 +926,7 @@ class Task extends CommonObject
|
|||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
$obj = $this->db->fetch_object($resql);
|
$obj = $this->db->fetch_object($resql);
|
||||||
|
if ($loadRoleMode) {
|
||||||
if ((!$obj->public) && (is_object($userp))) { // If not public project and we ask a filter on project owned by a user
|
if ((!$obj->public) && (is_object($userp))) { // If not public project and we ask a filter on project owned by a user
|
||||||
if (!$this->getUserRolesForProjectsOrTasks($userp, 0, $obj->projectid, 0)) {
|
if (!$this->getUserRolesForProjectsOrTasks($userp, 0, $obj->projectid, 0)) {
|
||||||
$error++;
|
$error++;
|
||||||
@ -936,7 +937,7 @@ class Task extends CommonObject
|
|||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (!$error) {
|
if (!$error) {
|
||||||
$tasks[$i] = new Task($this->db);
|
$tasks[$i] = new Task($this->db);
|
||||||
$tasks[$i]->id = $obj->taskid;
|
$tasks[$i]->id = $obj->taskid;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user