Fix rewrite of project and task list to solve bad listing
Fix correct sort and pagination of lists
This commit is contained in:
parent
19bcdb6910
commit
ddd8f8586f
@ -72,11 +72,29 @@ if ($page == -1) { $page = 0; }
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if (! $sortfield) $sortfield='c.rowid';
|
||||
if (! $sortfield) $sortfield='c.ref';
|
||||
if (! $sortorder) $sortorder='DESC';
|
||||
|
||||
$viewstatut=GETPOST('viewstatut');
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
$hookmanager->initHooks(array('orderlist'));
|
||||
|
||||
// List of fields to search into when doing a "search in all"
|
||||
$fieldstosearchall = array(
|
||||
'c.ref'=>'Ref',
|
||||
'c.ref_client'=>'RefCustomerOrder',
|
||||
'pd.description'=>'Description',
|
||||
's.nom'=>"ThirdParty",
|
||||
'c.note_public'=>'NotePublic',
|
||||
);
|
||||
if (empty($user->socid)) $fieldstosearchall["c.note_private"]="NotePrivate";
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
// Purge search criteria
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
|
||||
{
|
||||
@ -96,24 +114,6 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP
|
||||
$billed='';
|
||||
}
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
$hookmanager->initHooks(array('orderlist'));
|
||||
|
||||
// List of fields to search into when doing a "search in all"
|
||||
$fieldstosearchall = array(
|
||||
'c.ref'=>'Ref',
|
||||
'c.ref_client'=>'RefCustomerOrder',
|
||||
'pd.description'=>'Description',
|
||||
's.nom'=>"ThirdParty",
|
||||
'c.note_public'=>'NotePublic',
|
||||
);
|
||||
if (empty($user->socid)) $fieldstosearchall["c.note_private"]="NotePrivate";
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
$parameters=array('socid'=>$socid);
|
||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hook
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
@ -76,7 +76,7 @@ $search_sale=GETPOST('search_sale','int');
|
||||
$optioncss = GETPOST('optioncss','alpha');
|
||||
|
||||
$mine = $_REQUEST['mode']=='mine' ? 1 : 0;
|
||||
if ($mine) $search_user = $user->id;
|
||||
if ($mine) { $search_user = $user->id; $mine=0; }
|
||||
|
||||
$sday = GETPOST('sday','int');
|
||||
$smonth = GETPOST('smonth','int');
|
||||
@ -87,6 +87,17 @@ $year = GETPOST('year','int');
|
||||
|
||||
if ($search_status == '') $search_status=-1; // -1 or 1
|
||||
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
$page = GETPOST("page",'int');
|
||||
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
|
||||
if ($page == -1) { $page = 0; }
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if (! $sortfield) $sortfield='p.ref';
|
||||
if (! $sortorder) $sortorder='DESC';
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
$contextpage='projectlist';
|
||||
|
||||
@ -115,11 +126,11 @@ $arrayfields=array(
|
||||
'p.dateo'=>array('label'=>$langs->trans("DateStart"), 'checked'=>1, 'position'=>100),
|
||||
'p.datee'=>array('label'=>$langs->trans("DateEnd"), 'checked'=>1, 'position'=>101),
|
||||
'p.public'=>array('label'=>$langs->trans("Visibility"), 'checked'=>1, 'position'=>102),
|
||||
'p.opp_amount'=>array('label'=>$langs->trans("OpportunityAmount"), 'checked'=>1, 'enabled'=>$conf->global->PROJECT_USE_OPPORTUNITIES, 'position'=>103),
|
||||
'p.fk_opp_status'=>array('label'=>$langs->trans("OpportunityStatus"), 'checked'=>1, 'enabled'=>$conf->global->PROJECT_USE_OPPORTUNITIES, 'position'=>104),
|
||||
'p.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
|
||||
'p.opp_amount'=>array('label'=>$langs->trans("OpportunityAmountShort"), 'checked'=>1, 'enabled'=>$conf->global->PROJECT_USE_OPPORTUNITIES, 'position'=>103),
|
||||
'p.fk_opp_status'=>array('label'=>$langs->trans("OpportunityStatusShort"), 'checked'=>1, 'enabled'=>$conf->global->PROJECT_USE_OPPORTUNITIES, 'position'=>104),
|
||||
'p.datec'=>array('label'=>$langs->trans("DateCreationShort"), 'checked'=>0, 'position'=>500),
|
||||
'p.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
|
||||
'p.statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
|
||||
'p.fk_statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
|
||||
);
|
||||
// Extra fields
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||
@ -171,12 +182,32 @@ $form = new Form($db);
|
||||
$formother = new FormOther($db);
|
||||
$formproject = new FormProjets($db);
|
||||
|
||||
llxHeader("",$langs->trans("Projects"),"EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos");
|
||||
$title=$langs->trans("Projects");
|
||||
if ($search_user == $user->id) $title=$langs->trans("MyProjects");
|
||||
|
||||
llxHeader("",$title,"EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos");
|
||||
|
||||
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,($mine?$mine:($user->rights->projet->all->lire?2:0)),1,$socid);
|
||||
// Get list of project id allowed to user (in a string list separated by coma)
|
||||
if (! $user->rights->projet->all->lire) $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,1,$socid);
|
||||
|
||||
$sql = "SELECT p.rowid as projectid, p.ref, p.title, p.fk_statut, p.fk_opp_status, p.public, p.fk_user_creat";
|
||||
// Get id of types of contacts for projects (This list never contains a lot of elements)
|
||||
$listofprojectcontacttype=array();
|
||||
$sql = "SELECT ctc.rowid, ctc.code FROM ".MAIN_DB_PREFIX."c_type_contact as ctc";
|
||||
$sql.= " WHERE ctc.element = '" . $projectstatic->element . "'";
|
||||
$sql.= " AND ctc.source = 'internal'";
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
while($obj = $db->fetch_object($resql))
|
||||
{
|
||||
$listofprojectcontacttype[$obj->rowid]=$obj->code;
|
||||
}
|
||||
}
|
||||
else dol_print_error($db);
|
||||
if (count($listofprojectcontacttype) == 0) $listofprojectcontacttype[0]='0'; // To avoid sql syntax error if not found
|
||||
|
||||
$distinct='DISTINCT'; // We add distinct until we are added a protection to be sure a contact of a project and task is only once.
|
||||
$sql = "SELECT ".$distinct." p.rowid as projectid, p.ref, p.title, p.fk_statut, p.fk_opp_status, p.public, p.fk_user_creat";
|
||||
$sql.= ", p.datec as date_creation, p.dateo as date_start, p.datee as date_end, p.opp_amount, p.tms as date_update";
|
||||
$sql.= ", s.nom as name, s.rowid as socid";
|
||||
$sql.= ", cls.code as opp_status_code";
|
||||
@ -194,14 +225,12 @@ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_lead_status as cls on p.fk_opp_status = c
|
||||
if ($search_sale > 0 || (! $user->rights->societe->client->voir && ! $socid)) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc = s.rowid";
|
||||
if ($search_user > 0)
|
||||
{
|
||||
$sql.=", ".MAIN_DB_PREFIX."element_contact as c";
|
||||
$sql.=", ".MAIN_DB_PREFIX."c_type_contact as tc";
|
||||
$sql.=", ".MAIN_DB_PREFIX."element_contact as ecp";
|
||||
}
|
||||
|
||||
$sql.= " WHERE p.entity IN (".getEntity('project').')';
|
||||
if ($mine || ! $user->rights->projet->all->lire) $sql.= " AND p.rowid IN (".$projectsListId.")";
|
||||
if (! $user->rights->projet->all->lire) $sql.= " AND p.rowid IN (".$projectsListId.")"; // public and assigned to, or restricted to company for external users
|
||||
// No need to check company, as filtering of projects must be done by getProjectsAuthorizedForUser
|
||||
//if ($socid || ! $user->rights->societe->client->voir) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")";
|
||||
if ($socid) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")";
|
||||
if ($search_ref) $sql .= natural_search('p.ref', $search_ref);
|
||||
if ($search_label) $sql .= natural_search('p.title', $search_label);
|
||||
@ -243,26 +272,36 @@ if ($search_opp_status)
|
||||
if ($search_public!='') $sql .= " AND p.public = ".$db->escape($search_public);
|
||||
if ($search_sale > 0) $sql.= " AND sc.fk_user = " .$search_sale;
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND ((s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id.") OR (s.rowid IS NULL))";
|
||||
if ($search_user > 0) $sql.= " AND c.fk_c_type_contact = tc.rowid AND tc.element='project' AND tc.source='internal' AND c.element_id = p.rowid AND c.fk_socpeople = ".$search_user;
|
||||
if ($search_user > 0) $sql.= " AND ecp.fk_c_type_contact IN (".join(',',array_keys($listofprojectcontacttype)).") AND ecp.element_id = p.rowid AND ecp.fk_socpeople = ".$search_user;
|
||||
// Add where from hooks
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql.=$hookmanager->resPrint;
|
||||
|
||||
$sql.= $db->order($sortfield,$sortorder);
|
||||
$sql.= $db->plimit($conf->liste_limit+1, $offset);
|
||||
//print $sql;
|
||||
|
||||
$nbtotalofrecords = 0;
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
{
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
}
|
||||
|
||||
$sql.= $db->plimit($limit + 1,$offset);
|
||||
|
||||
|
||||
dol_syslog("list allowed project", LOG_DEBUG);
|
||||
//print $sql;
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$var=true;
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
$param='';
|
||||
//if ($mine) $param.='&mode=mine';
|
||||
if ($sday) $param.='&sday='.$day;
|
||||
if ($smonth) $param.='&smonth='.$smonth;
|
||||
if ($syear) $param.='&syear=' .$syear;
|
||||
if ($day) $param.='&day='.$day;
|
||||
if ($month) $param.='&month='.$month;
|
||||
if ($year) $param.='&year=' .$year;
|
||||
if ($socid) $param.='&socid='.$socid;
|
||||
@ -311,12 +350,6 @@ if ($resql)
|
||||
print $langs->trans("FilterOnInto", $search_all) . join(', ',$fieldstosearchall);
|
||||
}
|
||||
|
||||
|
||||
$colspan=8;
|
||||
if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) $colspan+=2;
|
||||
if (empty($conf->global->PROJECT_LIST_HIDE_STARTDATE)) $colspan++;
|
||||
|
||||
|
||||
// If the user can view thirdparties other than his'
|
||||
if ($user->rights->societe->client->voir || $socid)
|
||||
{
|
||||
@ -327,7 +360,7 @@ if ($resql)
|
||||
$moreforfilter.='</div>';
|
||||
}
|
||||
|
||||
// If the user can view prospects other than his'
|
||||
// If the user can view user other than himself
|
||||
$moreforfilter.='<div class="divsearchfield">';
|
||||
$moreforfilter.=$langs->trans('ProjectsWithThisUserAsContact'). ': ';
|
||||
$includeonly='';
|
||||
@ -351,15 +384,15 @@ if ($resql)
|
||||
print '<table class="liste '.($moreforfilter?"listwithfilterbefore":"").'">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
if (! empty($arrayfields['p.ref']['checked'])) print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"p.ref","",$param,"",$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.title']['checked'])) print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"p.title","",$param,"",$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom","",$param,"",$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['commercial']['checked'])) print_liste_field_titre($langs->trans("SalesRepresentative"),$_SERVER["PHP_SELF"],"","",$param,"",$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.dateo']['checked'])) print_liste_field_titre($langs->trans("DateStart"),$_SERVER["PHP_SELF"],"p.dateo","",$param,'align="center"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.datee']['checked'])) print_liste_field_titre($langs->trans("DateEnd"),$_SERVER["PHP_SELF"],"p.datee","",$param,'align="center"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.public']['checked'])) print_liste_field_titre($langs->trans("Visibility"),$_SERVER["PHP_SELF"],"p.public","",$param,"",$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.opp_amount']['checked'])) print_liste_field_titre($langs->trans("OpportunityAmountShort"),$_SERVER["PHP_SELF"],'p.opp_amount',"",$param,'align="right"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.fk_opp_status']['checked'])) print_liste_field_titre($langs->trans("OpportunityStatusShort"),$_SERVER["PHP_SELF"],'p.fk_opp_status',"",$param,'align="center"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.ref']['checked'])) print_liste_field_titre($arrayfields['p.ref']['label'],$_SERVER["PHP_SELF"],"p.ref","",$param,"",$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.title']['checked'])) print_liste_field_titre($arrayfields['p.title']['label'],$_SERVER["PHP_SELF"],"p.title","",$param,"",$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'],$_SERVER["PHP_SELF"],"s.nom","",$param,"",$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['commercial']['checked'])) print_liste_field_titre($arrayfields['commercial']['label'],$_SERVER["PHP_SELF"],"","",$param,"",$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.dateo']['checked'])) print_liste_field_titre($arrayfields['p.dateo']['label'],$_SERVER["PHP_SELF"],"p.dateo","",$param,'align="center"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.datee']['checked'])) print_liste_field_titre($arrayfields['p.datee']['label'],$_SERVER["PHP_SELF"],"p.datee","",$param,'align="center"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.public']['checked'])) print_liste_field_titre($arrayfields['p.public']['label'],$_SERVER["PHP_SELF"],"p.public","",$param,"",$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.opp_amount']['checked'])) print_liste_field_titre($arrayfields['p.opp_amount']['label'],$_SERVER["PHP_SELF"],'p.opp_amount',"",$param,'align="right"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.fk_opp_status']['checked'])) print_liste_field_titre($arrayfields['p.fk_opp_status']['label'],$_SERVER["PHP_SELF"],'p.fk_opp_status',"",$param,'align="center"',$sortfield,$sortorder);
|
||||
// Extra fields
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||
{
|
||||
@ -376,9 +409,9 @@ if ($resql)
|
||||
$parameters=array('arrayfields'=>$arrayfields);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
if (! empty($arrayfields['p.datec']['checked'])) print_liste_field_titre($langs->trans("DateCreationShort"),$_SERVER["PHP_SELF"],"p.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.tms']['checked'])) print_liste_field_titre($langs->trans("DateModificationShort"),$_SERVER["PHP_SELF"],"p.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.statut']['checked'])) print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"p.fk_statut","",$param,'align="center"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.datec']['checked'])) print_liste_field_titre($arrayfields['p.datec']['label'],$_SERVER["PHP_SELF"],"p.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.tms']['checked'])) print_liste_field_titre($arrayfields['p.tms']['label'],$_SERVER["PHP_SELF"],"p.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.fk_statut']['checked'])) print_liste_field_titre($arrayfields['p.fk_statut']['label'],$_SERVER["PHP_SELF"],"p.fk_statut","",$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch ');
|
||||
print "</tr>\n";
|
||||
|
||||
@ -466,7 +499,7 @@ if ($resql)
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['p.statut']['checked']))
|
||||
if (! empty($arrayfields['p.fk_statut']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre nowrap" align="right">';
|
||||
print $form->selectarray('search_status', array('-1'=>'', '0'=>$langs->trans('Draft'),'1'=>$langs->trans('Opened'),'2'=>$langs->trans('Closed')),$search_status);
|
||||
@ -480,17 +513,17 @@ if ($resql)
|
||||
|
||||
print '</tr>'."\n";
|
||||
|
||||
|
||||
while ($i < $num)
|
||||
$i = 0;
|
||||
while ($i < min($num,$limit))
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
$projectstatic->id = $obj->projectid;
|
||||
$projectstatic->user_author_id = $obj->fk_user_creat;
|
||||
$projectstatic->public = $obj->public;
|
||||
|
||||
$userAccess = $projectstatic->restrictedProjectArea($user);
|
||||
|
||||
$projectstatic->ref = $obj->ref;
|
||||
|
||||
$userAccess = $projectstatic->restrictedProjectArea($user); // why this ?
|
||||
if ($userAccess >= 0)
|
||||
{
|
||||
$var=!$var;
|
||||
@ -500,7 +533,6 @@ if ($resql)
|
||||
if (! empty($arrayfields['p.ref']['checked']))
|
||||
{
|
||||
print '<td class="nowrap">';
|
||||
$projectstatic->ref = $obj->ref;
|
||||
print $projectstatic->getNomUrl(1);
|
||||
print '</td>';
|
||||
}
|
||||
@ -636,7 +668,7 @@ if ($resql)
|
||||
print '</td>';
|
||||
}
|
||||
// Status
|
||||
if (! empty($arrayfields['p.statut']['checked']))
|
||||
if (! empty($arrayfields['p.fk_statut']['checked']))
|
||||
{
|
||||
$projectstatic->statut = $obj->fk_statut;
|
||||
print '<td align="right">'.$projectstatic->getLibStatut(5).'</td>';
|
||||
|
||||
@ -32,6 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
|
||||
$langs->load('projects');
|
||||
$langs->load('users');
|
||||
$langs->load('companies');
|
||||
|
||||
$id=GETPOST('id','int');
|
||||
|
||||
@ -39,13 +40,16 @@ $search_all=GETPOST('search_all');
|
||||
$search_project=GETPOST('search_project');
|
||||
if (! isset($_GET['search_projectstatus']) && ! isset($_POST['search_projectstatus'])) $search_projectstatus=1;
|
||||
else $search_projectstatus=GETPOST('search_projectstatus');
|
||||
$search_project_ref=GETPOST('search_project_ref');
|
||||
$search_project_title=GETPOST('search_project_title');
|
||||
$search_task_ref=GETPOST('search_task_ref');
|
||||
$search_task_label=GETPOST('search_task_label');
|
||||
$search_task_description=GETPOST('search_task_description');
|
||||
$search_project_user=GETPOST('search_project_user');
|
||||
$search_task_user=GETPOST('search_task_user');
|
||||
|
||||
$mine = $_REQUEST['mode']=='mine' ? 1 : 0;
|
||||
if ($mine) $search_task_user = $user->id;
|
||||
if ($mine) { $search_task_user = $user->id; $mine = 0; }
|
||||
|
||||
$sday = GETPOST('sday','int');
|
||||
$smonth = GETPOST('smonth','int');
|
||||
@ -54,60 +58,58 @@ $day = GETPOST('day','int');
|
||||
$month = GETPOST('month','int');
|
||||
$year = GETPOST('year','int');
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
$contextpage='tasklist';
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
$hookmanager->initHooks(array($contextpage));
|
||||
$extrafields = new ExtraFields($db);
|
||||
|
||||
// fetch optionals attributes and labels
|
||||
$extralabels = $extrafields->fetch_name_optionals_label('project');
|
||||
$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_');
|
||||
|
||||
// Security check
|
||||
$socid=0;
|
||||
if ($user->societe_id > 0) $socid = $user->societe_id;
|
||||
if (!$user->rights->projet->lire) accessforbidden();
|
||||
|
||||
$sortfield = GETPOST("sortfield");
|
||||
$sortorder = GETPOST("sortorder");
|
||||
$page = GETPOST("page");
|
||||
$page = is_numeric($page) ? $page : 0;
|
||||
$page = $page == -1 ? 0 : $page;
|
||||
|
||||
// Purge criteria
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
|
||||
{
|
||||
$search_all="";
|
||||
$search_project="";
|
||||
$search_projectstatus="";
|
||||
$search_task_ref="";
|
||||
$search_task_label="";
|
||||
$search_task_user=-1;
|
||||
$search_project_user=-1;
|
||||
$sday='';
|
||||
$smonth='';
|
||||
$syear='';
|
||||
$day='';
|
||||
$month='';
|
||||
$year='';
|
||||
}
|
||||
if (empty($search_projectstatus) && $search_projectstatus == '') $search_projectstatus=1;
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
$page = GETPOST("page",'int');
|
||||
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
|
||||
if ($page == -1) { $page = 0; }
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if (! $sortfield) $sortfield='p.ref';
|
||||
if (! $sortorder) $sortorder='DESC';
|
||||
|
||||
// List of fields to search into when doing a "search in all"
|
||||
$fieldstosearchall = array(
|
||||
't.ref'=>"Ref",
|
||||
't.label'=>"Label",
|
||||
't.label'=>"Label",
|
||||
't.description'=>"Description",
|
||||
't.note_public'=>"NotePublic",
|
||||
);
|
||||
if (empty($user->socid)) $fieldstosearchall['t.note_private']="NotePrivate";
|
||||
|
||||
$arrayfields=array(
|
||||
'p.ref'=>array('label'=>$langs->trans("Project"), 'checked'=>1),
|
||||
'p.title'=>array('label'=>$langs->trans("ProjectLabel"), 'checked'=>1),
|
||||
'p.ref'=>array('label'=>$langs->trans("ProjectRef"), 'checked'=>1),
|
||||
'p.title'=>array('label'=>$langs->trans("ProjectLabel"), 'checked'=>0),
|
||||
's.nom'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>0),
|
||||
'p.fk_statut'=>array('label'=>$langs->trans("ProjectStatus"), 'checked'=>1),
|
||||
//'s.nom'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1),
|
||||
't.title'=>array('label'=>$langs->trans("TaskLabel"), 'checked'=>1, 'position'=>80),
|
||||
't.ref'=>array('label'=>$langs->trans("RefTask"), 'checked'=>1, 'position'=>80),
|
||||
't.label'=>array('label'=>$langs->trans("LabelTask"), 'checked'=>1, 'position'=>80),
|
||||
't.dateo'=>array('label'=>$langs->trans("DateStart"), 'checked'=>1, 'position'=>100),
|
||||
't.datee'=>array('label'=>$langs->trans("DateEnd"), 'checked'=>1, 'position'=>101),
|
||||
't.planned_workload'=>array('label'=>$langs->trans("Workload"), 'checked'=>1, 'position'=>102),
|
||||
't.duration_effective'=>array('label'=>$langs->trans("TimeConsumed"), 'checked'=>1, 'position'=>103),
|
||||
// Calculated progression
|
||||
't.progress'=>array('label'=>$langs->trans("TimeDeclared"), 'checked'=>1, 'position'=>105),
|
||||
|
||||
't.planned_workload'=>array('label'=>$langs->trans("PlannedWorkload"), 'checked'=>1, 'position'=>102),
|
||||
't.duration_effective'=>array('label'=>$langs->trans("TimeSpent"), 'checked'=>1, 'position'=>103),
|
||||
't.progress_calculated'=>array('label'=>$langs->trans("ProgressCalculated"), 'checked'=>1, 'position'=>104),
|
||||
't.progress'=>array('label'=>$langs->trans("ProgressDeclared"), 'checked'=>1, 'position'=>105),
|
||||
't.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
|
||||
't.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
|
||||
't.fk_statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
|
||||
//'t.fk_statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
|
||||
);
|
||||
// Extra fields
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||
@ -123,7 +125,31 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
||||
* Actions
|
||||
*/
|
||||
|
||||
// None
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||
|
||||
// Purge criteria
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
|
||||
{
|
||||
$search_all="";
|
||||
$search_project="";
|
||||
$search_projectstatus=-1;
|
||||
$search_project_ref="";
|
||||
$search_project_title="";
|
||||
$search_task_ref="";
|
||||
$search_task_label="";
|
||||
$search_task_description="";
|
||||
$search_task_user=-1;
|
||||
$search_project_user=-1;
|
||||
$sday='';
|
||||
$smonth='';
|
||||
$syear='';
|
||||
$day='';
|
||||
$month='';
|
||||
$year='';
|
||||
}
|
||||
if (empty($search_projectstatus) && $search_projectstatus == '') $search_projectstatus=1;
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
@ -132,6 +158,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
||||
|
||||
$form=new Form($db);
|
||||
$formother=new FormOther($db);
|
||||
$socstatic=new Societe($db);
|
||||
$projectstatic = new Project($db);
|
||||
$taskstatic = new Task($db);
|
||||
$puser=new User($db);
|
||||
@ -140,7 +167,7 @@ if ($search_project_user > 0) $puser->fetch($search_project_user);
|
||||
if ($search_task_user > 0) $tuser->fetch($search_task_user);
|
||||
|
||||
$title=$langs->trans("Activities");
|
||||
if ($mine) $title=$langs->trans("MyActivities");
|
||||
if ($search_task_user == $user->id) $title=$langs->trans("MyActivities");
|
||||
|
||||
llxHeader("",$title,"Projet");
|
||||
|
||||
@ -150,184 +177,547 @@ if ($id)
|
||||
$projectstatic->societe->fetch($projectstatic->societe->id);
|
||||
}
|
||||
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, "", $num, '', 'title_project');
|
||||
|
||||
// Show description of content
|
||||
if ($mine) print $langs->trans("MyTasksDesc").'<br><br>';
|
||||
else
|
||||
{
|
||||
if ($user->rights->projet->all->lire && ! $socid) print $langs->trans("ProjectsDesc").'<br><br>';
|
||||
else print $langs->trans("ProjectsPublicDesc").'<br><br>';
|
||||
}
|
||||
|
||||
// Get list of project id allowed to user (in a string list separated by coma)
|
||||
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,$mine,1,$socid);
|
||||
if (! $user->rights->projet->all->lire) $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,1,$socid);
|
||||
//var_dump($projectsListId);
|
||||
|
||||
// Get id of types of contacts for projects (This list never contains a lot of elements)
|
||||
$listofprojectcontacttype=array();
|
||||
$sql = "SELECT ctc.rowid, ctc.code FROM ".MAIN_DB_PREFIX."c_type_contact as ctc";
|
||||
$sql.= " WHERE ctc.element = '" . $projectstatic->element . "'";
|
||||
$sql.= " AND ctc.source = 'internal'";
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
while($obj = $db->fetch_object($resql))
|
||||
{
|
||||
$listofprojectcontacttype[$obj->rowid]=$obj->code;
|
||||
}
|
||||
}
|
||||
else dol_print_error($db);
|
||||
if (count($listofprojectcontacttype) == 0) $listofprojectcontacttype[0]='0'; // To avoid sql syntax error if not found
|
||||
// Get id of types of contacts for tasks (This list never contains a lot of elements)
|
||||
$listoftaskcontacttype=array();
|
||||
$sql = "SELECT ctc.rowid, ctc.code FROM ".MAIN_DB_PREFIX."c_type_contact as ctc";
|
||||
$sql.= " WHERE ctc.element = '" . $taskstatic->element . "'";
|
||||
$sql.= " AND ctc.source = 'internal'";
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
while($obj = $db->fetch_object($resql))
|
||||
{
|
||||
$listoftaskcontacttype[$obj->rowid]=$obj->code;
|
||||
}
|
||||
}
|
||||
else dol_print_error($db);
|
||||
if (count($listoftaskcontacttype) == 0) $listoftaskcontacttype[0]='0'; // To avoid sql syntax error if not found
|
||||
|
||||
|
||||
// Get list of tasks in tasksarray and taskarrayfiltered
|
||||
// We need all tasks (even not limited to a user because a task assigned to a user can have a parent that is not assigned to him and we need such parents).
|
||||
$morewherefilter='';
|
||||
if ($search_all) $morewherefilter.=natural_search(array_keys($fieldstosearchall), $search_all);
|
||||
if ($search_task_ref) $morewherefilter.=natural_search('t.ref', $search_task_ref);
|
||||
if ($search_task_label) $morewherefilter.=natural_search('t.label', $search_task_label);
|
||||
$distinct='DISTINCT'; // We add distinct until we are added a protection to be sure a contact of a project and task is only once.
|
||||
$sql = "SELECT ".$distinct." p.rowid as projectid, p.ref as projectref, p.title as projecttitle, p.fk_statut as projectstatus, p.fk_opp_status, p.public, p.fk_user_creat as projectusercreate";
|
||||
$sql.= ", s.nom as name, s.rowid as socid";
|
||||
$sql.= ", t.datec as date_creation, t.dateo as date_start, t.datee as date_end, t.tms as date_update";
|
||||
$sql.= ", t.rowid as id, t.ref, t.label, t.planned_workload, t.duration_effective, t.progress, t.fk_statut";
|
||||
// Add fields for extrafields
|
||||
foreach ($extrafields->attribute_list as $key => $val) $sql.=",ef.".$key.' as options_'.$key;
|
||||
// Add fields from hooks
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql.=$hookmanager->resPrint;
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."projet_task as t";
|
||||
if ($search_project_user > 0)
|
||||
{
|
||||
$sql.=", ".MAIN_DB_PREFIX."element_contact as ecp";
|
||||
}
|
||||
if ($search_task_user > 0)
|
||||
{
|
||||
$sql.=", ".MAIN_DB_PREFIX."element_contact as ect";
|
||||
}
|
||||
$sql.= " WHERE t.fk_projet = p.rowid";
|
||||
$sql.= " AND p.entity IN (".getEntity('project').')';
|
||||
if (! $user->rights->projet->all->lire) $sql.=" p.rowid IN (".join(',',$projectsListId).")"; // public and assigned to projects, or restricted to company for external users
|
||||
// No need to check company, as filtering of projects must be done by getProjectsAuthorizedForUser
|
||||
if ($socid) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")";
|
||||
if ($search_project_ref) $sql .= natural_search('p.ref', $search_project_ref);
|
||||
if ($search_project_title) $sql .= natural_search('p.title', $search_project_title);
|
||||
if ($search_task_ref) $sql .= natural_search('t.ref', $search_task_ref);
|
||||
if ($search_task_label) $sql .= natural_search('t.label', $search_task_label);
|
||||
if ($search_societe) $sql .= natural_search('s.nom', $search_societe);
|
||||
if ($smonth > 0)
|
||||
{
|
||||
if ($syear > 0 && empty($sday))
|
||||
$morewherefilter.= " AND t.dateo BETWEEN '".$db->idate(dol_get_first_day($syear,$smonth,false))."' AND '".$db->idate(dol_get_last_day($syear,$smonth,false))."'";
|
||||
$sql.= " AND t.dateo BETWEEN '".$db->idate(dol_get_first_day($syear,$smonth,false))."' AND '".$db->idate(dol_get_last_day($syear,$smonth,false))."'";
|
||||
else if ($syear > 0 && ! empty($sday))
|
||||
$morewherefilter.= " AND t.dateo BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $smonth, $sday, $syear))."' AND '".$db->idate(dol_mktime(23, 59, 59, $smonth, $sday, $syear))."'";
|
||||
$sql.= " AND t.dateo BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $smonth, $sday, $syear))."' AND '".$db->idate(dol_mktime(23, 59, 59, $smonth, $sday, $syear))."'";
|
||||
else
|
||||
$morewherefilter.= " AND date_format(t.dateo, '%m') = '".$smonth."'";
|
||||
$sql.= " AND date_format(t.dateo, '%m') = '".$smonth."'";
|
||||
}
|
||||
else if ($syear > 0)
|
||||
{
|
||||
$morewherefilter.= " AND t.dateo BETWEEN '".$db->idate(dol_get_first_day($syear,1,false))."' AND '".$db->idate(dol_get_last_day($syear,12,false))."'";
|
||||
$sql.= " AND t.dateo BETWEEN '".$db->idate(dol_get_first_day($syear,1,false))."' AND '".$db->idate(dol_get_last_day($syear,12,false))."'";
|
||||
}
|
||||
if ($month > 0)
|
||||
{
|
||||
if ($year > 0 && empty($day))
|
||||
$morewherefilter.= " AND t.datee BETWEEN '".$db->idate(dol_get_first_day($year,$month,false))."' AND '".$db->idate(dol_get_last_day($year,$month,false))."'";
|
||||
$sql.= " AND t.datee BETWEEN '".$db->idate(dol_get_first_day($year,$month,false))."' AND '".$db->idate(dol_get_last_day($year,$month,false))."'";
|
||||
else if ($year > 0 && ! empty($day))
|
||||
$morewherefilter.= " AND t.datee BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year))."'";
|
||||
$sql.= " AND t.datee BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year))."'";
|
||||
else
|
||||
$morewherefilter.= " AND date_format(t.datee, '%m') = '".$month."'";
|
||||
$sql.= " AND date_format(t.datee, '%m') = '".$month."'";
|
||||
}
|
||||
else if ($year > 0)
|
||||
{
|
||||
$morewherefilter.= " AND t.datee BETWEEN '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'";
|
||||
$sql.= " AND t.datee BETWEEN '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'";
|
||||
}
|
||||
if ($search_all) $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
|
||||
if ($search_projectstatus >= 0) $sql .= " AND p.fk_statut = ".$db->escape($search_projectstatus);
|
||||
if ($search_public!='') $sql .= " AND p.public = ".$db->escape($search_public);
|
||||
if ($search_project_user > 0) $sql.= " AND ecp.fk_c_type_contact IN (".join(',',array_keys($listofprojectcontacttype)).") AND ecp.element_id = p.rowid AND ecp.fk_socpeople = ".$search_project_user;
|
||||
if ($search_task_user > 0) $sql.= " AND ect.fk_c_type_contact IN (".join(',',array_keys($listoftaskcontacttype)).") AND ect.element_id = t.rowid AND ect.fk_socpeople = ".$search_task_user;
|
||||
// Add where from hooks
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql.=$hookmanager->resPrint;
|
||||
$sql.= $db->order($sortfield,$sortorder);
|
||||
|
||||
$nbtotalofrecords = 0;
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
{
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
}
|
||||
|
||||
//$tasksarray=$taskstatic->getTasksArray(0, 0, $projectstatic->id, $socid, 0, $search_project, $search_projectstatus, $morewherefilter, $search_project_user, 0); // We don't use filter on task user. Because sometimes a task is assigned but not the parent one and we want to show also parent, so filtering is done during output
|
||||
//$tasksrole=$taskstatic->getUserRolesForProjectsOrTasks(0, ($tuser->id?$tuser:null), $projectstatic->id, 0, $search_projectstatus); // We load also tasks limited to a particular user
|
||||
$sql.= $db->plimit($limit + 1,$offset);
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="list">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="type" value="'.$type.'">';
|
||||
|
||||
if ($search_all)
|
||||
dol_syslog("list allowed project", LOG_DEBUG);
|
||||
//print $sql;
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
|
||||
print $langs->trans("FilterOnInto", $search_all) . join(', ',$fieldstosearchall);
|
||||
}
|
||||
$var=true;
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
$param='';
|
||||
if ($sday) $param.='&sday='.$day;
|
||||
if ($smonth) $param.='&smonth='.$smonth;
|
||||
if ($syear) $param.='&syear=' .$syear;
|
||||
if ($day) $param.='&day='.$day;
|
||||
if ($month) $param.='&month='.$month;
|
||||
if ($year) $param.='&year=' .$year;
|
||||
if ($socid) $param.='&socid='.$socid;
|
||||
if ($search_all != '') $param.='&search_all='.$search_all;
|
||||
if ($search_project_ref != '') $param.='&search_project_ref='.$search_project_ref;
|
||||
if ($search_project_title != '') $param.='&search_project_title='.$search_project_title;
|
||||
if ($search_ref != '') $param.='&search_ref='.$search_ref;
|
||||
if ($search_label != '') $param.='&search_label='.$search_label;
|
||||
if ($search_societe != '') $param.='&search_societe='.$search_societe;
|
||||
if ($search_projectstatus != '') $param.='&search_projectstatus='.$search_projectstatus;
|
||||
if ((is_numeric($search_opp_status) && $search_opp_status >= 0) || in_array($search_opp_status, array('all','none'))) $param.='&search_opp_status='.urlencode($search_opp_status);
|
||||
if ($search_public != '') $param.='&search_public='.$search_public;
|
||||
if ($search_project_user > 0) $param.='&search_project_user='.$search_project_user;
|
||||
if ($search_task_user > 0) $param.='&search_task_user='.$search_task_user;
|
||||
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
||||
// Add $param from extra fields
|
||||
foreach ($search_array_options as $key => $val)
|
||||
{
|
||||
$crit=$val;
|
||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||
if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val);
|
||||
}
|
||||
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, "", $num, '', 'title_project');
|
||||
|
||||
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="list">';
|
||||
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="type" value="'.$type.'">';
|
||||
|
||||
// Show description of content
|
||||
if ($search_task_user == $user->id) print $langs->trans("MyTasksDesc").'<br><br>';
|
||||
else
|
||||
{
|
||||
if ($user->rights->projet->all->lire && ! $socid) print $langs->trans("ProjectsDesc").'<br><br>';
|
||||
else print $langs->trans("ProjectsPublicDesc").'<br><br>';
|
||||
}
|
||||
|
||||
if ($search_all)
|
||||
{
|
||||
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
|
||||
print $langs->trans("FilterOnInto", $search_all) . join(', ',$fieldstosearchall);
|
||||
}
|
||||
|
||||
// If the user can view users
|
||||
$moreforfilter.='<div class="divsearchfield">';
|
||||
$moreforfilter.=$langs->trans('ProjectsWithThisUserAsContact'). ' ';
|
||||
$includeonly='';
|
||||
if (empty($user->rights->user->user->lire)) $includeonly=array($user->id);
|
||||
$moreforfilter.=$form->select_dolusers($search_project_user, 'search_project_user', 1, '', 0, $includeonly, '', 0, 0, 0, '', 0, '', 'maxwidth300');
|
||||
$moreforfilter.='</div>';
|
||||
|
||||
// If the user can view users
|
||||
$moreforfilter.='<div class="divsearchfield">';
|
||||
$moreforfilter.=$langs->trans('TasksWithThisUserAsContact'). ': ';
|
||||
$includeonly='';
|
||||
if (empty($user->rights->user->user->lire)) $includeonly=array($user->id);
|
||||
$moreforfilter.=$form->select_dolusers($search_task_user, 'search_task_user', 1, '', 0, $includeonly, '', 0, 0, 0, '', 0, '', 'maxwidth300');
|
||||
$moreforfilter.='</div>';
|
||||
|
||||
if (! empty($moreforfilter))
|
||||
{
|
||||
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
||||
print $moreforfilter;
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
|
||||
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
|
||||
print '<table class="liste '.($moreforfilter?"listwithfilterbefore":"").'" id="tablelines3">';
|
||||
|
||||
// If the user can view users
|
||||
//if ($mine) $search_project_user=$user->id; // We want by default all project. "mine" is a filter for task contact on this page
|
||||
$moreforfilter.='<div class="divsearchfield">';
|
||||
$moreforfilter.=$langs->trans('ProjectsWithThisUserAsContact'). ' ';
|
||||
$includeonly='';
|
||||
if (empty($user->rights->user->user->lire)) $includeonly=array($user->id);
|
||||
$moreforfilter.=$form->select_dolusers($search_project_user, 'search_project_user', 1, '', 0, $includeonly, '', 0, 0, 0, '', 0, '', 'maxwidth300');
|
||||
$moreforfilter.='</div>';
|
||||
|
||||
// If the user can view users
|
||||
$moreforfilter.='<div class="divsearchfield">';
|
||||
$moreforfilter.=$langs->trans('TasksWithThisUserAsContact'). ': ';
|
||||
$includeonly='';
|
||||
if (empty($user->rights->user->user->lire)) $includeonly=array($user->id);
|
||||
$moreforfilter.=$form->select_dolusers($search_task_user, 'search_task_user', 1, '', 0, $includeonly, '', 0, 0, 0, '', 0, '', 'maxwidth300');
|
||||
$moreforfilter.='</div>';
|
||||
|
||||
if (! empty($moreforfilter))
|
||||
{
|
||||
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
||||
print $moreforfilter;
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
|
||||
print '<tr class="liste_titre">';
|
||||
if (! empty($arrayfields['p.ref']['checked'])) print_liste_field_titre($arrayfields['p.ref']['label'],$_SERVER["PHP_SELF"],"p.ref","",$param,"",$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.title']['checked'])) print_liste_field_titre($arrayfields['p.title']['label'],$_SERVER["PHP_SELF"],"p.title","",$param,"",$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'],$_SERVER["PHP_SELF"],"s.nom","",$param,"",$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.fk_statut']['checked'])) print_liste_field_titre($arrayfields['p.fk_statut']['label'],$_SERVER["PHP_SELF"],"p.fk_statut","",$param,"",$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['t.ref']['checked'])) print_liste_field_titre($arrayfields['t.ref']['label'],$_SERVER["PHP_SELF"],"t.ref","",$param,"",$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['t.label']['checked'])) print_liste_field_titre($arrayfields['t.label']['label'],$_SERVER["PHP_SELF"],"t.label","",$param,"",$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['t.dateo']['checked'])) print_liste_field_titre($arrayfields['t.dateo']['label'],$_SERVER["PHP_SELF"],"t.dateo","",$param,'align="center"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['t.datee']['checked'])) print_liste_field_titre($arrayfields['t.datee']['label'],$_SERVER["PHP_SELF"],"t.datee","",$param,'align="center"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['t.planned_workload']['checked'])) print_liste_field_titre($arrayfields['t.planned_workload']['label'],$_SERVER["PHP_SELF"],"t.planned_workload","",$param,'align="center"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['t.duration_effective']['checked'])) print_liste_field_titre($arrayfields['t.duration_effective']['label'],$_SERVER["PHP_SELF"],"t.duration_effective","",$param,'align="center"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['t.progress_calculated']['checked'])) print_liste_field_titre($arrayfields['t.progress_calculated']['label'],$_SERVER["PHP_SELF"],"","",$param,'align="center"');
|
||||
if (! empty($arrayfields['t.progress']['checked'])) print_liste_field_titre($arrayfields['t.progress']['label'],$_SERVER["PHP_SELF"],"t.progress","",$param,'align="center"',$sortfield,$sortorder);
|
||||
// Extra fields
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($arrayfields["ef.".$key]['checked']))
|
||||
{
|
||||
$align=$extrafields->getAlignFlag($key);
|
||||
print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Hook fields
|
||||
$parameters=array('arrayfields'=>$arrayfields);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
print '</div>';
|
||||
}
|
||||
if (! empty($arrayfields['t.datec']['checked'])) print_liste_field_titre($arrayfields['t.datec']['label'],$_SERVER["PHP_SELF"],"t.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['t.tms']['checked'])) print_liste_field_titre($arrayfields['t.tms']['label'],$_SERVER["PHP_SELF"],"t.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch ');
|
||||
print "</tr>\n";
|
||||
|
||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'" id="tablelines3">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Project").'</td>';
|
||||
print '<td>'.$langs->trans("ProjectStatus").'</td>';
|
||||
print '<td>'.$langs->trans("RefTask").'</td>';
|
||||
print '<td>'.$langs->trans("LabelTask").'</td>';
|
||||
print '<td align="center">'.$langs->trans("DateStart").'</td>';
|
||||
print '<td align="center">'.$langs->trans("DateEnd").'</td>';
|
||||
print '<td align="right">'.$langs->trans("PlannedWorkload");
|
||||
// TODO Replace 86400 and 7 to take account working hours per day and working day per weeks
|
||||
//print '<br>('.$langs->trans("DelayWorkHour").')';
|
||||
print '</td>';
|
||||
print '<td align="right">'.$langs->trans("TimeSpent").'</td>';
|
||||
print '<td align="right">'.$langs->trans("ProgressCalculated").'</td>';
|
||||
print '<td align="right">'.$langs->trans("ProgressDeclared").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" class="flat" name="search_project" value="'.$search_project.'" size="8">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre">';
|
||||
$listofstatus=array(-1=>' ');
|
||||
foreach($projectstatic->statuts_short as $key => $val) $listofstatus[$key]=$langs->trans($val);
|
||||
print $form->selectarray('search_projectstatus', $listofstatus, $search_projectstatus);
|
||||
print '</td>';
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" class="flat" name="search_task_ref" value="'.dol_escape_htmltag($search_task_ref).'" size="4">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" class="flat" name="search_task_label" value="'.dol_escape_htmltag($search_task_label).'" size="8">';
|
||||
print '</td>';
|
||||
// Start date
|
||||
if (! empty($arrayfields['t.dateo']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre center">';
|
||||
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="sday" value="'.$sday.'">';
|
||||
print '<input class="flat" type="text" size="1" maxlength="2" name="smonth" value="'.$smonth.'">';
|
||||
$formother->select_year($syear?$syear:-1,'syear',1, 20, 5);
|
||||
print '<tr class="liste_titre">';
|
||||
if (! empty($arrayfields['p.ref']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" class="flat" name="search_project_ref" value="'.$search_project_ref.'" size="4">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['p.title']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" class="flat" name="search_project_title" value="'.$search_project_title.'" size="6">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['s.nom']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" class="flat" name="search_societe" value="'.dol_escape_htmltag($search_societe).'" size="4">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['p.fk_statut']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
$listofstatus=array(-1=>' ');
|
||||
foreach($projectstatic->statuts_short as $key => $val) $listofstatus[$key]=$langs->trans($val);
|
||||
print $form->selectarray('search_projectstatus', $listofstatus, $search_projectstatus);
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['t.ref']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" class="flat" name="search_task_ref" value="'.dol_escape_htmltag($search_task_ref).'" size="4">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['t.label']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" class="flat" name="search_task_label" value="'.dol_escape_htmltag($search_task_label).'" size="8">';
|
||||
print '</td>';
|
||||
}
|
||||
// Start date
|
||||
if (! empty($arrayfields['t.dateo']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre center">';
|
||||
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="sday" value="'.$sday.'">';
|
||||
print '<input class="flat" type="text" size="1" maxlength="2" name="smonth" value="'.$smonth.'">';
|
||||
$formother->select_year($syear?$syear:-1,'syear',1, 20, 5);
|
||||
print '</td>';
|
||||
}
|
||||
// End date
|
||||
if (! empty($arrayfields['t.datee']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre center">';
|
||||
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="day" value="'.$day.'">';
|
||||
print '<input class="flat" type="text" size="1" maxlength="2" name="month" value="'.$month.'">';
|
||||
$formother->select_year($year?$year:-1,'year',1, 20, 5);
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['t.planned_workload']['checked'])) print '<td></td>';
|
||||
if (! empty($arrayfields['t.duration_effective']['checked'])) print '<td></td>';
|
||||
if (! empty($arrayfields['t.progress_calculated']['checked'])) print '<td></td>';
|
||||
if (! empty($arrayfields['t.progress']['checked'])) print '<td></td>';
|
||||
// Extra fields
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($arrayfields["ef.".$key]['checked'])) print '<td class="liste_titre"></td>';
|
||||
}
|
||||
}
|
||||
// Fields from hook
|
||||
$parameters=array('arrayfields'=>$arrayfields);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
if (! empty($arrayfields['t.datec']['checked']))
|
||||
{
|
||||
// Date creation
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['t.tms']['checked']))
|
||||
{
|
||||
// Date modification
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
}
|
||||
// Action column
|
||||
print '<td class="liste_titre" align="right">';
|
||||
print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
|
||||
print '</td>';
|
||||
}
|
||||
// End date
|
||||
if (! empty($arrayfields['t.datee']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre center">';
|
||||
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="day" value="'.$day.'">';
|
||||
print '<input class="flat" type="text" size="1" maxlength="2" name="month" value="'.$month.'">';
|
||||
$formother->select_year($year?$year:-1,'year',1, 20, 5);
|
||||
print '</td>';
|
||||
}
|
||||
print '<td class="liste_titre" colspan="3">';
|
||||
print ' ';
|
||||
print '<td class="liste_titre nowrap" align="right">';
|
||||
print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("RemoveFilter"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
$i = 0;
|
||||
while ($i < min($num,$limit))
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
/*
|
||||
$max=10000;
|
||||
if (count($tasksarray) > (empty($conf->global->PROJECT_LIMIT_TASK_PROJECT_AREA)?$max:$conf->global->PROJECT_LIMIT_TASK_PROJECT_AREA))
|
||||
{
|
||||
$langs->load("errors");
|
||||
print '<tr '.$bc[0].'>';
|
||||
print '<td colspan="9">';
|
||||
print $langs->trans("WarningTooManyDataPleaseUseMoreFilters", $max, 'PROJECT_LIMIT_TASK_PROJECT_AREA');
|
||||
print '</td></tr>';
|
||||
$projectstatic->id = $obj->projectid;
|
||||
$projectstatic->ref = $obj->projectref;
|
||||
$projectstatic->title = $obj->projecttitle;
|
||||
$projectstatic->public = $obj->public;
|
||||
$projectstatic->statut = $obj->projectstatus;
|
||||
|
||||
$taskstatic->id = $obj->id;
|
||||
$taskstatic->ref = $obj->ref;
|
||||
$taskstatic->label = $obj->label;
|
||||
$taskstatic->fk_statut = $obj->fk_statut;
|
||||
$taskstatic->progress = $obj->progress;
|
||||
|
||||
$userAccess = $projectstatic->restrictedProjectArea($user); // why this ?
|
||||
if ($userAccess >= 0)
|
||||
{
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
|
||||
// Project url
|
||||
if (! empty($arrayfields['p.ref']['checked']))
|
||||
{
|
||||
print '<td class="nowrap">';
|
||||
print $projectstatic->getNomUrl(1);
|
||||
print '</td>';
|
||||
}
|
||||
// Title
|
||||
if (! empty($arrayfields['p.title']['checked']))
|
||||
{
|
||||
print '<td>';
|
||||
print dol_trunc($obj->projecttitle,80);
|
||||
print '</td>';
|
||||
}
|
||||
// Company
|
||||
if (! empty($arrayfields['s.nom']['checked']))
|
||||
{
|
||||
print '<td>';
|
||||
if ($obj->socid)
|
||||
{
|
||||
$socstatic->id=$obj->socid;
|
||||
$socstatic->name=$obj->name;
|
||||
print $socstatic->getNomUrl(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
print ' ';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
// Status
|
||||
if (! empty($arrayfields['p.fk_statut']['checked']))
|
||||
{
|
||||
print '<td>';
|
||||
print $projectstatic->getLibStatut(1);
|
||||
print '</td>';
|
||||
}
|
||||
// Ref
|
||||
if (! empty($arrayfields['t.ref']['checked']))
|
||||
{
|
||||
print '<td>';
|
||||
print $taskstatic->getNomUrl(1);
|
||||
print '</td>';
|
||||
}
|
||||
// Label
|
||||
if (! empty($arrayfields['t.label']['checked']))
|
||||
{
|
||||
print '<td>';
|
||||
print $taskstatic->label;
|
||||
print '</td>';
|
||||
}
|
||||
// Date start
|
||||
if (! empty($arrayfields['t.dateo']['checked']))
|
||||
{
|
||||
print '<td class="center">';
|
||||
print dol_print_date($db->jdate($obj->date_start),'day');
|
||||
print '</td>';
|
||||
}
|
||||
// Date end
|
||||
if (! empty($arrayfields['t.datee']['checked']))
|
||||
{
|
||||
print '<td class="center">';
|
||||
print dol_print_date($db->jdate($obj->date_end),'day');
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
$plannedworkloadoutputformat='allhourmin';
|
||||
$timespentoutputformat='allhourmin';
|
||||
if (! empty($conf->global->PROJECT_PLANNED_WORKLOAD_FORMAT)) $plannedworkloadoutputformat=$conf->global->PROJECT_PLANNED_WORKLOAD_FORMAT;
|
||||
if (! empty($conf->global->PROJECT_TIMES_SPENT_FORMAT)) $timespentoutputformat=$conf->global->PROJECT_TIME_SPENT_FORMAT;
|
||||
|
||||
// Planned workload
|
||||
if (! empty($arrayfields['t.planned_workload']['checked']))
|
||||
{
|
||||
print '<td class="center">';
|
||||
$fullhour=convertSecondToTime($obj->planned_workload,$plannedworkloadoutputformat);
|
||||
$workingdelay=convertSecondToTime($obj->planned_workload,'all',86400,7); // TODO Replace 86400 and 7 to take account working hours per day and working day per weeks
|
||||
if ($obj->planned_workload != '')
|
||||
{
|
||||
print $fullhour;
|
||||
// TODO Add delay taking account of working hours per day and working day per week
|
||||
//if ($workingdelay != $fullhour) print '<br>('.$workingdelay.')';
|
||||
}
|
||||
//else print '--:--';
|
||||
print '</td>';
|
||||
}
|
||||
// Time spent
|
||||
if (! empty($arrayfields['t.duration_effective']['checked']))
|
||||
{
|
||||
$showlineingray=0;$showproject=1;
|
||||
print '<td class="center">';
|
||||
if ($showlineingray) print '<i>';
|
||||
else print '<a href="'.DOL_URL_ROOT.'/projet/tasks/time.php?id='.$lines[$i]->id.($showproject?'':'&withproject=1').'">';
|
||||
if ($obj->duration_effective) print convertSecondToTime($obj->duration_effective,$timespentoutputformat);
|
||||
else print '--:--';
|
||||
if ($showlineingray) print '</i>';
|
||||
else print '</a>';
|
||||
print '</td>';
|
||||
}
|
||||
// Calculated progress
|
||||
if (! empty($arrayfields['t.progress_calculated']['checked']))
|
||||
{
|
||||
print '<td class="center">';
|
||||
if ($obj->planned_workload || $obj->duration_effective)
|
||||
{
|
||||
if ($obj->planned_workload) print round(100 * $obj->duration_effective / $obj->planned_workload,2).' %';
|
||||
else print $langs->trans('WorkloadNotDefined');
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
// Declared progress
|
||||
if (! empty($arrayfields['t.progress']['checked']))
|
||||
{
|
||||
print '<td class="center">';
|
||||
if ($obj->progress != '')
|
||||
{
|
||||
print $obj->progress.' %';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
// Extra fields
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($arrayfields["ef.".$key]['checked']))
|
||||
{
|
||||
print '<td';
|
||||
$align=$extrafields->getAlignFlag($key);
|
||||
if ($align) print ' align="'.$align.'"';
|
||||
print '>';
|
||||
$tmpkey='options_'.$key;
|
||||
print $extrafields->showOutputField($key, $obj->$tmpkey, '', 1);
|
||||
print '</td>';
|
||||
}
|
||||
}
|
||||
}
|
||||
// Fields from hook
|
||||
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Date creation
|
||||
if (! empty($arrayfields['t.datec']['checked']))
|
||||
{
|
||||
print '<td align="center">';
|
||||
print dol_print_date($db->jdate($obj->date_creation), 'dayhour');
|
||||
print '</td>';
|
||||
}
|
||||
// Date modification
|
||||
if (! empty($arrayfields['t.tms']['checked']))
|
||||
{
|
||||
print '<td align="center">';
|
||||
print dol_print_date($db->jdate($obj->date_update), 'dayhour');
|
||||
print '</td>';
|
||||
}
|
||||
// Status
|
||||
/*if (! empty($arrayfields['p.fk_statut']['checked']))
|
||||
{
|
||||
$projectstatic->statut = $obj->fk_statut;
|
||||
print '<td align="right">'.$projectstatic->getLibStatut(5).'</td>';
|
||||
}*/
|
||||
// Action column
|
||||
print '<td></td>';
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
//print projectLinesa();
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
$db->free($resql);
|
||||
|
||||
$parameters=array('sql' => $sql);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
print "</table>";
|
||||
|
||||
print '</form>';
|
||||
}
|
||||
else
|
||||
{
|
||||
// Show all lines in taskarray (recursive function to go down on tree)
|
||||
$j=0; $level=0;
|
||||
if ($morewherefilter) $level=-1; // No recursive output when there is search criteria
|
||||
//var_dump($tasksarray);
|
||||
$nboftaskshown=projectLinesa($j, 0, $tasksarray, $level, true, 1, $tasksrole, $projectsListId, 0);
|
||||
dol_print_error($db);
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
print "</table>";
|
||||
|
||||
print '</form>';
|
||||
|
||||
|
||||
llxFooter();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user