Clean code
This commit is contained in:
parent
0412d3d11d
commit
742079cfe3
@ -509,13 +509,13 @@ class Project extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* Return list of elements for type, linked to project
|
||||
* Return list of elements for type, linked to a project
|
||||
*
|
||||
* @param string $type 'propal','order','invoice','order_supplier','invoice_supplier',...
|
||||
* @param string $tablename name of table associated of the type
|
||||
* @param string $datefieldname name of date field for filter
|
||||
* @param string $dates Start date (ex 00:00:00)
|
||||
* @param string $datee End date (ex 23:59:59)
|
||||
* @param int $dates Start date
|
||||
* @param int $datee End date
|
||||
* @return mixed Array list of object ids linked to project, < 0 or string if error
|
||||
*/
|
||||
function get_element_list($type, $tablename, $datefieldname='', $dates='', $datee='')
|
||||
@ -524,29 +524,31 @@ class Project extends CommonObject
|
||||
|
||||
if ($this->id <= 0) return $elements;
|
||||
|
||||
$ids = $this->id;
|
||||
|
||||
if ($type == 'agenda')
|
||||
{
|
||||
$sql = "SELECT id as rowid FROM " . MAIN_DB_PREFIX . "actioncomm WHERE fk_project=" . $this->id;
|
||||
$sql = "SELECT id as rowid FROM " . MAIN_DB_PREFIX . "actioncomm WHERE fk_project IN (". $ids .")";
|
||||
}
|
||||
elseif ($type == 'expensereport')
|
||||
{
|
||||
$sql = "SELECT ed.rowid FROM " . MAIN_DB_PREFIX . "expensereport as e, " . MAIN_DB_PREFIX . "expensereport_det as ed WHERE e.rowid = ed.fk_expensereport AND ed.fk_projet=" . $this->id;
|
||||
$sql = "SELECT ed.rowid FROM " . MAIN_DB_PREFIX . "expensereport as e, " . MAIN_DB_PREFIX . "expensereport_det as ed WHERE e.rowid = ed.fk_expensereport AND ed.fk_projet IN (". $ids .")";
|
||||
}
|
||||
elseif ($type == 'project_task')
|
||||
{
|
||||
$sql = "SELECT DISTINCT pt.rowid FROM " . MAIN_DB_PREFIX . "projet_task as pt, " . MAIN_DB_PREFIX . "projet_task_time as ptt WHERE pt.rowid = ptt.fk_task AND pt.fk_projet=" . $this->id;
|
||||
$sql = "SELECT DISTINCT pt.rowid FROM " . MAIN_DB_PREFIX . "projet_task as pt, " . MAIN_DB_PREFIX . "projet_task_time as ptt WHERE pt.rowid = ptt.fk_task AND pt.fk_projet IN (". $ids .")";
|
||||
}
|
||||
elseif ($type == 'project_task_time') // Case we want to duplicate line foreach user
|
||||
{
|
||||
$sql = "SELECT DISTINCT pt.rowid, ptt.fk_user FROM " . MAIN_DB_PREFIX . "projet_task as pt, " . MAIN_DB_PREFIX . "projet_task_time as ptt WHERE pt.rowid = ptt.fk_task AND pt.fk_projet=" . $this->id;
|
||||
$sql = "SELECT DISTINCT pt.rowid, ptt.fk_user FROM " . MAIN_DB_PREFIX . "projet_task as pt, " . MAIN_DB_PREFIX . "projet_task_time as ptt WHERE pt.rowid = ptt.fk_task AND pt.fk_projet IN (". $ids .")";
|
||||
}
|
||||
elseif ($type == 'stock_mouvement')
|
||||
{
|
||||
$sql = 'SELECT ms.rowid, ms.fk_user_author as fk_user FROM ' . MAIN_DB_PREFIX . 'stock_mouvement as ms WHERE ms.origintype = "project" AND ms.fk_origin = ' . $this->id . ' AND ms.type_mouvement = 1';
|
||||
$sql = 'SELECT ms.rowid, ms.fk_user_author as fk_user FROM ' . MAIN_DB_PREFIX . "stock_mouvement as ms WHERE ms.origintype = 'project' AND ms.fk_origin IN (". $ids .") AND ms.type_mouvement = 1";
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = "SELECT rowid FROM " . MAIN_DB_PREFIX . $tablename." WHERE fk_projet=" . $this->id;
|
||||
$sql = "SELECT rowid FROM " . MAIN_DB_PREFIX . $tablename." WHERE fk_projet IN (". $ids .")";
|
||||
}
|
||||
|
||||
if ($dates > 0)
|
||||
|
||||
@ -103,9 +103,9 @@ $socid=$object->socid;
|
||||
//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement.
|
||||
$result = restrictedArea($user, 'projet', $projectid, 'projet&project');
|
||||
|
||||
|
||||
$hookmanager->initHooks(array('projectOverview'));
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
@ -470,7 +470,7 @@ $listofreferent=array(
|
||||
);
|
||||
|
||||
$parameters=array('listofreferent'=>$listofreferent);
|
||||
$resHook = $hookmanager->executeHooks('completeListOfReferent',$parameters,$object,$action);
|
||||
$resHook = $hookmanager->executeHooks('completeListOfReferent', $parameters, $object, $action);
|
||||
|
||||
if(!empty($hookmanager->resArray)) {
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user