2009-07-28 16:23:09 +02:00
< ? php
2006-05-13 02:52:13 +02:00
/* Copyright ( C ) 2005 Rodolphe Quiedeville < rodolphe @ quiedeville . org >
2018-05-25 11:08:05 +02:00
* Copyright ( C ) 2004 - 2018 Laurent Destailleur < eldy @ users . sourceforge . net >
2018-10-27 14:43:12 +02:00
* Copyright ( C ) 2005 - 2017 Regis Houssin < regis . houssin @ inodbox . com >
2013-10-30 21:44:04 +01:00
*
* This program is free software ; you can redistribute it and / or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation ; either version 3 of the License , or
* ( at your option ) any later version .
*
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* You should have received a copy of the GNU General Public License
* along with this program . If not , see < http :// www . gnu . org / licenses />.
*/
2005-08-21 14:24:33 +02:00
/**
2010-05-30 22:25:08 +02:00
* \file htdocs / projet / tasks . php
2008-09-10 13:36:13 +02:00
* \ingroup projet
2010-05-30 22:25:08 +02:00
* \brief List all tasks of a project
2008-08-26 00:14:58 +02:00
*/
2005-08-21 14:24:33 +02:00
2018-07-26 11:57:25 +02:00
require " ../main.inc.php " ;
2012-08-22 23:11:24 +02:00
require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php' ;
require_once DOL_DOCUMENT_ROOT . '/projet/class/task.class.php' ;
require_once DOL_DOCUMENT_ROOT . '/core/lib/project.lib.php' ;
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php' ;
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php' ;
2013-04-12 11:09:53 +02:00
require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php' ;
2018-05-18 10:33:32 +02:00
require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php' ;
2005-08-21 14:24:33 +02:00
2018-05-26 21:11:25 +02:00
// Load translation files required by the page
2018-05-04 11:25:21 +02:00
$langs -> loadLangs ( array ( " users " , " projects " ));
2012-01-25 11:05:15 +01:00
$id = GETPOST ( 'id' , 'int' );
$ref = GETPOST ( 'ref' , 'alpha' );
2016-07-09 13:58:46 +02:00
$taskref = GETPOST ( 'taskref' , 'alpha' );
2018-01-04 20:42:57 +01:00
$action = GETPOST ( 'action' , 'alpha' );
2012-02-27 17:02:56 +01:00
$backtopage = GETPOST ( 'backtopage' , 'alpha' );
2017-09-15 10:50:50 +02:00
$cancel = GETPOST ( 'cancel' , 'alpha' );
2012-01-25 11:05:15 +01:00
2017-04-11 02:48:16 +02:00
$search_user_id = GETPOST ( 'search_user_id' , 'int' );
2018-05-18 10:33:32 +02:00
$search_taskref = GETPOST ( 'search_taskref' );
$search_tasklabel = GETPOST ( 'search_tasklabel' );
$search_dtstartday = GETPOST ( 'search_dtstartday' );
$search_dtstartmonth = GETPOST ( 'search_dtstartmonth' );
$search_dtstartyear = GETPOST ( 'search_dtstartyear' );
$search_dtendday = GETPOST ( 'search_dtendday' );
$search_dtendmonth = GETPOST ( 'search_dtendmonth' );
$search_dtendyear = GETPOST ( 'search_dtendyear' );
$search_planedworkload = GETPOST ( 'search_planedworkload' );
$search_timespend = GETPOST ( 'search_timespend' );
$search_progresscalc = GETPOST ( 'search_progresscalc' );
$search_progressdeclare = GETPOST ( 'search_progressdeclare' );
2017-06-11 10:37:58 +02:00
2010-05-29 01:26:08 +02:00
//if (! $user->rights->projet->all->lire) $mine=1; // Special for projects
2010-05-30 14:21:32 +02:00
2012-05-23 14:34:44 +02:00
$object = new Project ( $db );
2013-04-26 10:29:14 +02:00
$taskstatic = new Task ( $db );
2013-04-12 11:09:53 +02:00
$extrafields_project = new ExtraFields ( $db );
$extrafields_task = new ExtraFields ( $db );
2015-03-02 17:54:35 +01:00
2015-05-14 16:47:15 +02:00
include DOL_DOCUMENT_ROOT . '/core/actions_fetchobject.inc.php' ; // Must be include, not include_once
2018-05-22 16:07:32 +02:00
if ( ! empty ( $conf -> global -> PROJECT_ALLOW_COMMENT_ON_PROJECT ) && method_exists ( $object , 'fetchComments' ) && empty ( $object -> comments )) $object -> fetchComments ();
2015-03-02 17:54:35 +01:00
2014-09-18 09:59:29 +02:00
if ( $id > 0 || ! empty ( $ref ))
2012-05-23 14:34:44 +02:00
{
2014-03-11 20:38:29 +01:00
// fetch optionals attributes and labels
2013-04-26 10:29:14 +02:00
$extralabels_projet = $extrafields_project -> fetch_name_optionals_label ( $object -> table_element );
2012-05-23 14:34:44 +02:00
}
2015-08-04 13:32:44 +02:00
$extralabels_task = $extrafields_task -> fetch_name_optionals_label ( $taskstatic -> table_element );
2012-05-23 14:34:44 +02:00
2010-05-30 14:21:32 +02:00
// Security check
$socid = 0 ;
2017-01-12 15:23:30 +01:00
//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.
2017-04-11 02:48:16 +02:00
$result = restrictedArea ( $user , 'projet' , $id , 'projet&project' );
2006-03-10 18:19:14 +01:00
2017-06-10 12:56:28 +02:00
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
2018-05-18 08:52:13 +02:00
$hookmanager -> initHooks ( array ( 'projecttaskscard' , 'globalcard' ));
Add: hooks and triggers for a lot of core modules (action/calendrier, deplacement, dons, tva, contact/tiers, contrat, product lines, expedition, fournisseur commandes et factures, fiche intervention, projet et taches)
Signed-off-by: Stephen L. <lrq3000@gmail.com>
2012-08-14 15:50:45 +02:00
2012-01-25 11:05:15 +01:00
$progress = GETPOST ( 'progress' , 'int' );
$label = GETPOST ( 'label' , 'alpha' );
2012-07-26 14:33:25 +02:00
$description = GETPOST ( 'description' );
2017-09-01 16:54:06 +02:00
$planned_workloadhour = ( GETPOST ( 'planned_workloadhour' , 'int' ) ? GETPOST ( 'planned_workloadhour' , 'int' ) : 0 );
$planned_workloadmin = ( GETPOST ( 'planned_workloadmin' , 'int' ) ? GETPOST ( 'planned_workloadmin' , 'int' ) : 0 );
$planned_workload = $planned_workloadhour * 3600 + $planned_workloadmin * 60 ;
2011-05-18 13:55:41 +02:00
2011-09-14 14:47:51 +02:00
$userAccess = 0 ;
2012-01-25 11:05:15 +01:00
2008-09-10 22:49:21 +02:00
/*
* Actions
2014-01-06 13:02:20 +01:00
*/
2006-03-10 18:19:14 +01:00
2018-10-26 23:27:29 +02:00
$parameters = array ( 'id' => $id );
$reshook = $hookmanager -> executeHooks ( 'doActions' , $parameters , $object , $action ); // Note that $action and $object may have been modified by some hooks
if ( $reshook < 0 ) setEventMessages ( $hookmanager -> error , $hookmanager -> errors , 'errors' );
2017-04-11 02:48:16 +02:00
// Purge search criteria
2017-07-13 00:35:10 +02:00
if ( GETPOST ( 'button_removefilter_x' , 'alpha' ) || GETPOST ( 'button_removefilter.x' , 'alpha' ) || GETPOST ( 'button_removefilter' , 'alpha' )) // All tests are required to be compatible with all browsers
2017-04-11 02:48:16 +02:00
{
$search_user_id = " " ;
2018-05-18 10:33:32 +02:00
$search_taskref = '' ;
$search_tasklabel = '' ;
$search_dtstartday = '' ;
$search_dtstartmonth = '' ;
$search_dtstartyear = '' ;
$search_dtendday = '' ;
$search_dtendmonth = '' ;
$search_dtendyear = '' ;
$search_planedworkload = '' ;
$search_timespend = '' ;
$search_progresscalc = '' ;
$search_progressdeclare = '' ;
2017-04-11 02:48:16 +02:00
$toselect = '' ;
$search_array_options = array ();
}
2018-05-18 10:33:32 +02:00
$morewherefilterarray = array ();
if ( ! empty ( $search_taskref )) {
$morewherefilterarray [] = natural_search ( 't.ref' , $search_taskref , 0 , 1 );
}
if ( ! empty ( $search_tasklabel )) {
$morewherefilterarray [] = natural_search ( 't.label' , $search_tasklabel , 0 , 1 );
}
if ( $search_dtstartmonth > 0 )
{
if ( $search_dtstartyear > 0 && empty ( $search_dtstartday )) {
$morewherefilterarray [] = " (t.dateo BETWEEN ' " . $db -> idate ( dol_get_first_day ( $search_dtstartyear , $search_dtstartmonth , false )) . " ' AND ' " . $db -> idate ( dol_get_last_day ( $search_dtstartyear , $search_dtstartmonth , false )) . " ') " ;
} else if ( $search_dtstartyear > 0 && ! empty ( $search_dtstartday )) {
$morewherefilterarray [] = " (t.dateo BETWEEN ' " . $db -> idate ( dol_mktime ( 0 , 0 , 0 , $search_dtstartmonth , $search_dtstartday , $search_dtstartyear )) . " ' AND ' " . $db -> idate ( dol_mktime ( 23 , 59 , 59 , $search_dtstartmonth , $search_dtstartday , $search_dtstartyear )) . " ') " ;
} else {
$morewherefilterarray [] = " date_format(t.dateo, '%m') = ' " . $search_dtstartmonth . " ' " ;
}
}
else if ( $search_dtstartyear > 0 )
{
$morewherefilterarray [] = " (t.dateo BETWEEN ' " . $db -> idate ( dol_get_first_day ( $search_dtstartyear , 1 , false )) . " ' AND ' " . $db -> idate ( dol_get_last_day ( $search_dtstartyear , 12 , false )) . " ') " ;
}
if ( $search_dtendmonth > 0 )
{
if ( $search_dtendyear > 0 && empty ( $search_dtendday )) {
$morewherefilterarray [] = " (t.datee BETWEEN ' " . $db -> idate ( dol_get_first_day ( $search_dtendyear , $search_dtendmonth , false )) . " ' AND ' " . $db -> idate ( dol_get_last_day ( $search_dtendyear , $search_dtendmonth , false )) . " ') " ;
} else if ( $search_dtendyear > 0 && ! empty ( $search_dtendday )) {
$morewherefilterarray [] = " (t.datee BETWEEN ' " . $db -> idate ( dol_mktime ( 0 , 0 , 0 , $search_dtendmonth , $search_dtendday , $search_dtendyear )) . " ' AND ' " . $db -> idate ( dol_mktime ( 23 , 59 , 59 , $search_dtendmonth , $search_dtendday , $search_dtendyear )) . " ') " ;
} else {
$morewherefilterarray [] = " date_format(t.datee, '%m') = ' " . $search_dtendmonth . " ' " ;
}
}
else if ( $search_dtendyear > 0 )
{
$morewherefilterarray [] = " (t.datee BETWEEN ' " . $db -> idate ( dol_get_first_day ( $search_dtendyear , 1 , false )) . " ' AND ' " . $db -> idate ( dol_get_last_day ( $search_dtendyear , 12 , false )) . " ') " ;
}
if ( ! empty ( $search_planedworkload )) {
$morewherefilterarray [] = natural_search ( 't.planned_workload' , $search_planedworkload , 1 , 1 );
}
if ( ! empty ( $search_timespend )) {
$morewherefilterarray [] = natural_search ( 't.duration_effective' , $search_timespend , 1 , 1 );
}
if ( ! empty ( $search_progresscalc )) {
$filterprogresscalc = 'if ' . natural_search ( 'round(100 * $line->duration / $line->planned_workload,2)' , $search_progresscalc , 1 , 1 ) . '{return 1;} else {return 0;}' ;
} else {
$filterprogresscalc = '' ;
}
if ( ! empty ( $search_progressdeclare )) {
$morewherefilterarray [] = natural_search ( 't.progress' , $search_progressdeclare , 1 , 1 );
}
$morewherefilter = '' ;
if ( count ( $morewherefilterarray ) > 0 ) {
$morewherefilter = ' AND ' . implode ( ' AND ' , $morewherefilterarray );
}
2012-01-25 11:05:15 +01:00
if ( $action == 'createtask' && $user -> rights -> projet -> creer )
2005-08-21 14:24:33 +02:00
{
2008-09-10 22:49:21 +02:00
$error = 0 ;
2005-08-21 14:24:33 +02:00
2017-05-18 12:12:36 +02:00
// If we use user timezone, we must change also view/list to use user timezone everywhere
//$date_start = dol_mktime($_POST['dateohour'],$_POST['dateomin'],0,$_POST['dateomonth'],$_POST['dateoday'],$_POST['dateoyear'],'user');
//$date_end = dol_mktime($_POST['dateehour'],$_POST['dateemin'],0,$_POST['dateemonth'],$_POST['dateeday'],$_POST['dateeyear'],'user');
$date_start = dol_mktime ( $_POST [ 'dateohour' ], $_POST [ 'dateomin' ], 0 , $_POST [ 'dateomonth' ], $_POST [ 'dateoday' ], $_POST [ 'dateoyear' ]);
$date_end = dol_mktime ( $_POST [ 'dateehour' ], $_POST [ 'dateemin' ], 0 , $_POST [ 'dateemonth' ], $_POST [ 'dateeday' ], $_POST [ 'dateeyear' ]);
2017-06-11 10:37:58 +02:00
2015-05-14 16:47:15 +02:00
if ( ! $cancel )
2009-01-10 04:40:06 +01:00
{
2016-07-09 13:58:46 +02:00
if ( empty ( $taskref ))
{
setEventMessages ( $langs -> trans ( " ErrorFieldRequired " , $langs -> transnoentities ( " Ref " )), null , 'errors' );
$action = 'create' ;
$error ++ ;
}
if ( empty ( $label ))
2009-02-04 21:38:07 +01:00
{
2015-10-17 17:09:34 +02:00
setEventMessages ( $langs -> trans ( " ErrorFieldRequired " , $langs -> transnoentities ( " Label " )), null , 'errors' );
2012-01-25 11:05:15 +01:00
$action = 'create' ;
2009-02-04 21:38:07 +01:00
$error ++ ;
}
2010-02-15 02:21:47 +01:00
else if ( empty ( $_POST [ 'task_parent' ]))
{
2017-11-16 23:11:49 +01:00
setEventMessages ( $langs -> trans ( " ErrorFieldRequired " , $langs -> transnoentities ( " ChildOfProjectTask " )), null , 'errors' );
2012-01-25 11:05:15 +01:00
$action = 'create' ;
2010-02-15 02:21:47 +01:00
$error ++ ;
}
2009-01-14 17:40:45 +01:00
2009-02-04 21:38:07 +01:00
if ( ! $error )
{
2009-10-20 15:14:44 +02:00
$tmparray = explode ( '_' , $_POST [ 'task_parent' ]);
2009-02-04 21:38:07 +01:00
$projectid = $tmparray [ 0 ];
2012-01-25 11:05:15 +01:00
if ( empty ( $projectid )) $projectid = $id ; // If projectid is ''
2009-02-04 21:38:07 +01:00
$task_parent = $tmparray [ 1 ];
2010-01-28 15:52:45 +01:00
if ( empty ( $task_parent )) $task_parent = 0 ; // If task_parent is ''
2009-01-14 17:40:45 +01:00
2010-01-25 11:59:20 +01:00
$task = new Task ( $db );
2010-01-28 15:52:45 +01:00
2010-01-25 11:59:20 +01:00
$task -> fk_project = $projectid ;
2016-07-09 13:58:46 +02:00
$task -> ref = $taskref ;
2012-01-25 11:05:15 +01:00
$task -> label = $label ;
$task -> description = $description ;
2013-10-30 21:44:04 +01:00
$task -> planned_workload = $planned_workload ;
2010-01-25 11:59:20 +01:00
$task -> fk_task_parent = $task_parent ;
2010-12-08 14:13:17 +01:00
$task -> date_c = dol_now ();
2011-05-18 13:54:05 +02:00
$task -> date_start = $date_start ;
$task -> date_end = $date_end ;
2012-01-25 11:05:15 +01:00
$task -> progress = $progress ;
2017-06-11 10:37:58 +02:00
2013-04-12 11:09:53 +02:00
// Fill array 'array_options' with data from add form
$ret = $extrafields_task -> setOptionalsFromPost ( $extralabels_task , $task );
2009-01-14 17:40:45 +01:00
2010-01-25 23:24:40 +01:00
$taskid = $task -> create ( $user );
2010-02-03 23:34:12 +01:00
2010-01-25 23:24:40 +01:00
if ( $taskid > 0 )
2010-02-03 23:34:12 +01:00
{
2010-01-28 16:55:43 +01:00
$result = $task -> add_contact ( $_POST [ " userid " ], 'TASKEXECUTIVE' , 'internal' );
2014-09-18 09:59:29 +02:00
}
else
2014-07-03 17:15:42 +02:00
{
2018-11-15 18:20:38 +01:00
if ( $db -> lasterrno () == 'DB_ERROR_RECORD_ALREADY_EXISTS' )
{
$langs -> load ( " projects " );
setEventMessages ( $langs -> trans ( 'NewTaskRefSuggested' ), '' , 'warnings' );
$duplicate_code_error = true ;
}
else
{
setEventMessages ( $task -> error , $task -> errors , 'errors' );
}
2018-11-15 17:55:27 +01:00
$action = 'create' ;
$error ++ ;
2010-01-25 23:24:40 +01:00
}
2009-02-04 21:38:07 +01:00
}
2010-02-03 23:34:12 +01:00
2010-01-28 16:55:43 +01:00
if ( ! $error )
2009-01-12 21:26:06 +01:00
{
2013-04-12 11:09:53 +02:00
if ( ! empty ( $backtopage ))
2010-01-28 16:55:43 +01:00
{
2012-08-31 05:58:38 +02:00
header ( " Location: " . $backtopage );
2010-01-28 16:55:43 +01:00
exit ;
}
2012-02-15 23:08:20 +01:00
else if ( empty ( $projectid ))
2010-01-28 16:55:43 +01:00
{
2015-12-04 15:37:28 +01:00
header ( " Location: " . DOL_URL_ROOT . '/projet/tasks/list.php' . ( empty ( $mode ) ? '' : '?mode=' . $mode ));
2010-01-28 16:55:43 +01:00
exit ;
}
2015-02-07 04:04:56 +01:00
$id = $projectid ;
2009-01-12 21:26:06 +01:00
}
2008-08-26 00:14:58 +02:00
}
2010-08-23 21:15:51 +02:00
else
{
2012-02-27 17:02:56 +01:00
if ( ! empty ( $backtopage ))
2012-02-15 23:08:20 +01:00
{
2012-08-31 05:58:38 +02:00
header ( " Location: " . $backtopage );
2012-02-15 23:08:20 +01:00
exit ;
}
2013-04-12 11:09:53 +02:00
else if ( empty ( $id ))
{
// We go back on task list
2015-12-04 15:37:28 +01:00
header ( " Location: " . DOL_URL_ROOT . '/projet/tasks/list.php' . ( empty ( $mode ) ? '' : '?mode=' . $mode ));
2013-04-12 11:09:53 +02:00
exit ;
}
2010-08-23 21:15:51 +02:00
}
2005-08-21 14:24:33 +02:00
}
2015-02-07 04:04:56 +01:00
2008-09-10 22:49:21 +02:00
/*
* View
2015-02-07 04:04:56 +01:00
*/
2009-01-10 04:40:06 +01:00
2008-09-10 22:49:21 +02:00
$form = new Form ( $db );
2010-01-28 16:55:43 +01:00
$formother = new FormOther ( $db );
2013-07-18 10:24:45 +02:00
$taskstatic = new Task ( $db );
2012-02-15 23:08:20 +01:00
$userstatic = new User ( $db );
2005-08-21 14:24:33 +02:00
2015-03-23 12:44:41 +01:00
$title = $langs -> trans ( " Project " ) . ' - ' . $langs -> trans ( " Tasks " ) . ' - ' . $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 ( " Tasks " );
2009-08-31 00:08:21 +02:00
$help_url = " EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos " ;
2015-03-23 12:44:41 +01:00
llxHeader ( " " , $title , $help_url );
2005-08-21 14:24:33 +02:00
2009-01-12 21:26:06 +01:00
if ( $id > 0 || ! empty ( $ref ))
2008-09-10 22:49:21 +02:00
{
2012-01-25 11:05:15 +01:00
$object -> fetch ( $id , $ref );
2014-09-18 09:59:29 +02:00
$object -> fetch_thirdparty ();
2018-05-25 10:52:24 +02:00
$res = $object -> fetch_optionals ();
2010-02-03 23:34:12 +01:00
2012-02-15 23:08:20 +01:00
2013-04-12 11:09:53 +02:00
// To verify role of users
//$userAccess = $object->restrictedProjectArea($user,'read');
$userWrite = $object -> restrictedProjectArea ( $user , 'write' );
//$userDelete = $object->restrictedProjectArea($user,'delete');
//print "userAccess=".$userAccess." userWrite=".$userWrite." userDelete=".$userDelete;
2012-02-15 23:08:20 +01:00
2013-04-12 11:09:53 +02:00
$tab = GETPOST ( 'tab' ) ? GETPOST ( 'tab' ) : 'tasks' ;
2012-02-15 23:08:20 +01:00
2013-04-12 11:09:53 +02:00
$head = project_prepare_head ( $object );
2017-05-18 12:12:36 +02:00
dol_fiche_head ( $head , $tab , $langs -> trans ( " Project " ), - 1 , ( $object -> public ? 'projectpub' : 'project' ));
2014-09-18 09:59:29 +02:00
2017-04-11 02:48:16 +02:00
$param = '' ;
if ( $search_user_id > 0 ) $param .= '&search_user_id=' . dol_escape_htmltag ( $search_user_id );
2012-07-28 21:49:47 +02:00
2016-10-17 20:10:53 +02:00
// Project card
2017-06-11 10:37:58 +02:00
2017-05-19 00:52:13 +02:00
$linkback = '<a href="' . DOL_URL_ROOT . '/projet/list.php?restore_lastsearch_values=1">' . $langs -> trans ( " BackToList " ) . '</a>' ;
2017-06-11 10:37:58 +02:00
2016-10-17 20:10:53 +02:00
$morehtmlref = '<div class="refidno">' ;
// Title
$morehtmlref .= $object -> title ;
// Thirdparty
2017-06-11 10:37:58 +02:00
if ( $object -> thirdparty -> id > 0 )
2016-10-17 20:10:53 +02:00
{
$morehtmlref .= '<br>' . $langs -> trans ( 'ThirdParty' ) . ' : ' . $object -> thirdparty -> getNomUrl ( 1 , 'project' );
}
$morehtmlref .= '</div>' ;
2017-06-11 10:37:58 +02:00
2016-10-17 20:10:53 +02:00
// Define a complementary filter for search of next/prev ref.
if ( ! $user -> rights -> projet -> all -> lire )
{
$objectsListId = $object -> getProjectsAuthorizedForUser ( $user , 0 , 0 );
$object -> next_prev_filter = " rowid in ( " . ( count ( $objectsListId ) ? join ( ',' , array_keys ( $objectsListId )) : '0' ) . " ) " ;
}
2017-06-11 10:37:58 +02:00
2016-10-17 20:10:53 +02:00
dol_banner_tab ( $object , 'ref' , $linkback , 1 , 'ref' , 'ref' , $morehtmlref );
print '<div class="fichecenter">' ;
print '<div class="fichehalfleft">' ;
print '<div class="underbanner clearboth"></div>' ;
print '<table class="border" width="100%">' ;
// Visibility
print '<tr><td class="titlefield">' . $langs -> trans ( " Visibility " ) . '</td><td>' ;
if ( $object -> public ) print $langs -> trans ( 'SharedProject' );
else print $langs -> trans ( 'PrivateProject' );
print '</td></tr>' ;
2016-10-18 12:16:12 +02:00
/* if ( ! empty ( $conf -> global -> PROJECT_USE_OPPORTUNITIES ))
2016-10-17 20:10:53 +02:00
{
// Opportunity status
print '<tr><td>' . $langs -> trans ( " OpportunityStatus " ) . '</td><td>' ;
$code = dol_getIdFromCode ( $db , $object -> opp_status , 'c_lead_status' , 'rowid' , 'code' );
if ( $code ) print $langs -> trans ( " OppStatus " . $code );
print '</td></tr>' ;
// Opportunity percent
print '<tr><td>' . $langs -> trans ( " OpportunityProbability " ) . '</td><td>' ;
if ( strcmp ( $object -> opp_percent , '' )) print price ( $object -> opp_percent , '' , $langs , 1 , 0 ) . ' %' ;
print '</td></tr>' ;
// Opportunity Amount
print '<tr><td>' . $langs -> trans ( " OpportunityAmount " ) . '</td><td>' ;
if ( strcmp ( $object -> opp_amount , '' )) print price ( $object -> opp_amount , '' , $langs , 1 , 0 , 0 , $conf -> currency );
print '</td></tr>' ;
2016-10-18 12:16:12 +02:00
} */
2016-10-17 20:10:53 +02:00
2016-10-18 12:16:12 +02:00
// Date start - end
print '<tr><td>' . $langs -> trans ( " DateStart " ) . ' - ' . $langs -> trans ( " DateEnd " ) . '</td><td>' ;
2018-05-18 10:33:32 +02:00
$start = dol_print_date ( $object -> date_start , 'dayhour' );
2017-04-05 14:48:24 +02:00
print ( $start ? $start : '?' );
2018-05-18 10:33:32 +02:00
$end = dol_print_date ( $object -> date_end , 'dayhour' );
2017-04-05 14:48:24 +02:00
print ' - ' ;
print ( $end ? $end : '?' );
if ( $object -> hasDelay ()) print img_warning ( " Late " );
2016-10-17 20:10:53 +02:00
print '</td></tr>' ;
2017-06-11 10:37:58 +02:00
2016-10-17 20:10:53 +02:00
// Budget
print '<tr><td>' . $langs -> trans ( " Budget " ) . '</td><td>' ;
if ( strcmp ( $object -> budget_amount , '' )) print price ( $object -> budget_amount , '' , $langs , 1 , 0 , 0 , $conf -> currency );
print '</td></tr>' ;
// Other attributes
$cols = 2 ;
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php' ;
2017-06-11 10:37:58 +02:00
2016-10-17 20:10:53 +02:00
print '</table>' ;
2017-06-11 10:37:58 +02:00
2016-10-17 20:10:53 +02:00
print '</div>' ;
print '<div class="fichehalfright">' ;
print '<div class="ficheaddleft">' ;
print '<div class="underbanner clearboth"></div>' ;
2017-06-11 10:37:58 +02:00
2016-10-17 20:10:53 +02:00
print '<table class="border" width="100%">' ;
2017-06-11 10:37:58 +02:00
2016-10-17 20:10:53 +02:00
// Description
print '<td class="titlefield tdtop">' . $langs -> trans ( " Description " ) . '</td><td>' ;
print nl2br ( $object -> description );
print '</td></tr>' ;
2018-10-26 23:27:29 +02:00
// Bill time
2018-12-06 21:25:28 +01:00
if ( empty ( $conf -> global -> PROJECT_HIDE_TASKS ) && ! empty ( $conf -> global -> PROJECT_BILL_TIME_SPENT ))
2018-10-26 23:27:29 +02:00
{
print '<tr><td>' . $langs -> trans ( " BillTime " ) . '</td><td>' ;
print yn ( $object -> bill_time );
print '</td></tr>' ;
}
2016-10-17 20:10:53 +02:00
// Categories
if ( $conf -> categorie -> enabled ) {
print '<tr><td valign="middle">' . $langs -> trans ( " Categories " ) . '</td><td>' ;
print $form -> showCategories ( $object -> id , 'project' , 1 );
print " </td></tr> " ;
}
2017-06-11 10:37:58 +02:00
2016-10-17 20:10:53 +02:00
print '</table>' ;
2017-06-11 10:37:58 +02:00
2016-10-17 20:10:53 +02:00
print '</div>' ;
print '</div>' ;
print '</div>' ;
2017-06-11 10:37:58 +02:00
2016-10-17 20:10:53 +02:00
print '<div class="clearboth"></div>' ;
2012-02-15 23:08:20 +01:00
2013-04-12 11:09:53 +02:00
dol_fiche_end ();
2008-09-10 22:49:21 +02:00
}
2005-08-21 14:24:33 +02:00
2012-02-15 23:08:20 +01:00
2014-09-18 09:59:29 +02:00
if ( $action == 'create' && $user -> rights -> projet -> creer && ( empty ( $object -> thirdparty -> id ) || $userWrite > 0 ))
2005-08-21 14:24:33 +02:00
{
2013-04-12 11:09:53 +02:00
if ( $id > 0 || ! empty ( $ref )) print '<br>' ;
2012-02-15 23:08:20 +01:00
2015-09-24 18:33:48 +02:00
print load_fiche_titre ( $langs -> trans ( " NewTask " ), '' , 'title_project' );
2008-09-10 22:49:21 +02:00
2018-12-10 15:06:54 +01:00
if ( $object -> statut == Project :: STATUS_CLOSED )
{
print '<div class="warning">' ;
$langs -> load ( " errors " );
print $langs -> trans ( " WarningProjectClosed " );
print '</div>' ;
}
else
{
print '<form action="' . $_SERVER [ 'PHP_SELF' ] . '" method="POST">' ;
print '<input type="hidden" name="token" value="' . $_SESSION [ 'newtoken' ] . '">' ;
print '<input type="hidden" name="action" value="createtask">' ;
print '<input type="hidden" name="backtopage" value="' . $backtopage . '">' ;
if ( ! empty ( $object -> id )) print '<input type="hidden" name="id" value="' . $object -> id . '">' ;
2017-06-11 10:37:58 +02:00
2018-12-10 15:06:54 +01:00
dol_fiche_head ( '' );
2015-05-14 16:47:15 +02:00
2018-12-10 15:06:54 +01:00
print '<table class="border" width="100%">' ;
2008-09-10 22:49:21 +02:00
2018-12-10 15:06:54 +01:00
$defaultref = '' ;
$obj = empty ( $conf -> global -> PROJECT_TASK_ADDON ) ? 'mod_task_simple' : $conf -> global -> PROJECT_TASK_ADDON ;
if ( ! empty ( $conf -> global -> PROJECT_TASK_ADDON ) && is_readable ( DOL_DOCUMENT_ROOT . " /core/modules/project/task/ " . $conf -> global -> PROJECT_TASK_ADDON . " .php " ))
{
require_once DOL_DOCUMENT_ROOT . " /core/modules/project/task/ " . $conf -> global -> PROJECT_TASK_ADDON . '.php' ;
$modTask = new $obj ;
$defaultref = $modTask -> getNextValue ( $object -> thirdparty , null );
}
2013-10-30 21:44:04 +01:00
2018-12-10 15:06:54 +01:00
if ( is_numeric ( $defaultref ) && $defaultref <= 0 ) $defaultref = '' ;
2013-10-30 21:44:04 +01:00
2018-12-10 15:06:54 +01:00
// Ref
print '<tr><td class="titlefieldcreate"><span class="fieldrequired">' . $langs -> trans ( " Ref " ) . '</span></td><td>' ;
if ( empty ( $duplicate_code_error ))
{
print ( GETPOSTISSET ( " ref " ) ? GETPOST ( " ref " , 'alpha' ) : $defaultref );
}
else
{
print $defaultref ;
}
print '<input type="hidden" name="taskref" value="' . ( $_POST [ " ref " ] ? $_POST [ " ref " ] : $defaultref ) . '">' ;
print '</td></tr>' ;
2013-07-18 10:24:45 +02:00
2018-12-10 15:06:54 +01:00
print '<tr><td class="fieldrequired">' . $langs -> trans ( " Label " ) . '</td><td>' ;
print '<input type="text" name="label" autofocus class="minwidth500" value="' . $label . '">' ;
print '</td></tr>' ;
2009-01-15 00:36:51 +01:00
2018-12-10 15:06:54 +01:00
// List of projects
print '<tr><td class="fieldrequired">' . $langs -> trans ( " ChildOfProjectTask " ) . '</td><td>' ;
print $formother -> selectProjectTasks ( GETPOST ( 'task_parent' ), $projectid ? $projectid : $object -> id , 'task_parent' , 0 , 0 , 1 , 1 , 0 , '0,1' , 'maxwidth500' );
print '</td></tr>' ;
2008-09-10 22:49:21 +02:00
2018-12-10 15:06:54 +01:00
print '<tr><td>' . $langs -> trans ( " AffectedTo " ) . '</td><td>' ;
$contactsofproject = ( ! empty ( $object -> id ) ? $object -> getListContactId ( 'internal' ) : '' );
if ( is_array ( $contactsofproject ) && count ( $contactsofproject ))
{
print $form -> select_dolusers ( $user -> id , 'userid' , 0 , '' , 0 , '' , $contactsofproject , 0 , 0 , 0 , '' , 0 , '' , 'maxwidth300' );
}
else
{
print $langs -> trans ( " NoUserAssignedToTheProject " );
}
print '</td></tr>' ;
// Date start
print '<tr><td>' . $langs -> trans ( " DateStart " ) . '</td><td>' ;
print $form -> selectDate (( $date_start ? $date_start : '' ), 'dateo' , 1 , 1 , 0 , '' , 1 , 1 );
print '</td></tr>' ;
// Date end
print '<tr><td>' . $langs -> trans ( " DateEnd " ) . '</td><td>' ;
print $form -> selectDate (( $date_end ? $date_end :- 1 ), 'datee' , - 1 , 1 , 0 , '' , 1 , 1 );
print '</td></tr>' ;
// Planned workload
print '<tr><td>' . $langs -> trans ( " PlannedWorkload " ) . '</td><td>' ;
print $form -> select_duration ( 'planned_workload' , $planned_workload ? $planned_workload : 0 , 0 , 'text' );
print '</td></tr>' ;
// Progress
print '<tr><td>' . $langs -> trans ( " ProgressDeclared " ) . '</td><td colspan="3">' ;
print $formother -> select_percent ( $progress , 'progress' , 0 , 5 , 0 , 100 , 1 );
print '</td></tr>' ;
// Description
print '<tr><td class="tdtop">' . $langs -> trans ( " Description " ) . '</td>' ;
print '<td>' ;
print '<textarea name="description" class="quatrevingtpercent" rows="' . ROWS_4 . '">' . $description . '</textarea>' ;
print '</td></tr>' ;
// Other options
$parameters = array ();
$reshook = $hookmanager -> executeHooks ( 'formObjectOptions' , $parameters , $taskstatic , $action ); // Note that $action and $object may have been modified by hook
print $hookmanager -> resPrint ;
if ( empty ( $reshook ) && ! empty ( $extrafields_task -> attribute_label ))
{
print $taskstatic -> showOptionals ( $extrafields_task , 'edit' ); // Do not use $object here that is object of project
}
Add: hooks and triggers for a lot of core modules (action/calendrier, deplacement, dons, tva, contact/tiers, contrat, product lines, expedition, fournisseur commandes et factures, fiche intervention, projet et taches)
Signed-off-by: Stephen L. <lrq3000@gmail.com>
2012-08-14 15:50:45 +02:00
2018-12-10 15:06:54 +01:00
print '</table>' ;
2012-02-04 18:34:52 +01:00
2018-12-10 15:06:54 +01:00
dol_fiche_end ();
2015-05-14 16:47:15 +02:00
2018-12-10 15:06:54 +01:00
print '<div align="center">' ;
print '<input type="submit" class="button" name="add" value="' . $langs -> trans ( " Add " ) . '">' ;
print ' ' ;
print '<input type="submit" class="button" name="cancel" value="' . $langs -> trans ( " Cancel " ) . '">' ;
print '</div>' ;
2008-09-10 22:49:21 +02:00
2018-12-10 15:06:54 +01:00
print '</form>' ;
}
2009-01-14 17:40:45 +01:00
}
2015-04-22 21:17:49 +02:00
else if ( $id > 0 || ! empty ( $ref ))
2008-09-10 22:49:21 +02:00
{
2006-09-23 02:27:47 +02:00
/*
2018-01-04 20:42:57 +01:00
* Projet card in view mode
2014-03-11 20:38:29 +01:00
*/
2009-01-14 17:40:45 +01:00
2018-01-04 20:42:57 +01:00
// Definition of fields for list
$arrayfields = array ();
$arrayfields [ 't.task_ref' ] = array ( 'label' => $langs -> trans ( " RefTask " ), 'checked' => 1 );
$arrayfields [ 't.task_label' ] = array ( 'label' => $langs -> trans ( " LabelTask " ), 'checked' => 1 );
$arrayfields [ 't.task_date_start' ] = array ( 'label' => $langs -> trans ( " DateStart " ), 'checked' => 1 );
$arrayfields [ 't.task_date_end' ] = array ( 'label' => $langs -> trans ( " DateEnd " ), 'checked' => 1 );
// Extra fields
if ( is_array ( $extrafields_task -> attribute_label ) && count ( $extrafields_task -> attribute_label ))
{
foreach ( $extrafields_task -> attribute_label as $key => $val )
{
if ( ! empty ( $extrafields_task -> attribute_list [ $key ])) $arrayfields [ " ef. " . $key ] = array ( 'label' => $extrafields_task -> attribute_label [ $key ], 'checked' => (( $extrafields_task -> attribute_list [ $key ] < 0 ) ? 0 : 1 ), 'position' => $extrafields_task -> attribute_pos [ $key ], 'enabled' => ( abs ( $extrafields_task -> attribute_list [ $key ]) != 3 && $extrafields_task -> attribute_perms [ $key ]));
}
}
2018-02-26 11:57:29 +01:00
print '<br>' ;
2018-01-04 20:42:57 +01:00
2018-02-26 11:57:29 +01:00
// Link to create task
2010-02-21 01:16:47 +01:00
if ( $user -> rights -> projet -> all -> creer || $user -> rights -> projet -> creer )
2009-01-12 10:53:45 +01:00
{
2012-02-04 18:34:52 +01:00
if ( $object -> public || $userWrite > 0 )
2009-01-15 00:36:51 +01:00
{
2018-04-26 10:07:27 +02:00
$linktocreatetask = '<a class="butActionNew" href="' . $_SERVER [ 'PHP_SELF' ] . '?id=' . $object -> id . '&action=create' . $param . '&backtopage=' . urlencode ( $_SERVER [ 'PHP_SELF' ] . '?id=' . $object -> id ) . '">' . $langs -> trans ( 'AddTask' ) . '<span class="fa fa-plus-circle valignmiddle"></span></a>' ;
2009-01-15 00:36:51 +01:00
}
else
{
2018-04-26 10:07:27 +02:00
$linktocreatetask = '<a class="butActionNewRefused" href="#" title="' . $langs -> trans ( " NotOwnerOfProject " ) . '">' . $langs -> trans ( 'AddTask' ) . '<span class="fa fa-plus-circle valignmiddle"></span></a>' ;
2009-01-15 00:36:51 +01:00
}
2009-01-12 10:53:45 +01:00
}
2010-02-07 03:39:01 +01:00
else
{
2018-04-26 10:07:27 +02:00
$linktocreatetask = '<a class="butActionNewRefused" href="#" title="' . $langs -> trans ( " NotEnoughPermissions " ) . '">' . $langs -> trans ( 'AddTask' ) . '<span class="fa fa-plus-circle valignmiddle"></span></a>' ;
2010-02-07 03:39:01 +01:00
}
2009-01-14 17:40:45 +01:00
2017-06-11 10:37:58 +02:00
2017-04-11 02:48:16 +02:00
print '<form method="POST" id="searchFormList" action="' . $_SERVER [ " PHP_SELF " ] . '?id=' . $object -> id . '">' ;
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 . '">' ;
2017-05-21 02:43:51 +02:00
print '<input type="hidden" name="page" value="' . $page . '">' ;
2017-04-11 02:48:16 +02:00
print '<input type="hidden" name="contextpage" value="' . $contextpage . '">' ;
2017-06-11 10:37:58 +02:00
2016-02-28 00:00:08 +01:00
$title = $langs -> trans ( " ListOfTasks " );
2018-05-04 17:55:29 +02:00
$linktotasks = '<a href="' . DOL_URL_ROOT . '/projet/ganttview.php?id=' . $object -> id . '&withproject=1">' . $langs -> trans ( " GoToGanttView " ) . '<span class="paddingleft fa fa-calendar-minus-o valignmiddle"></span></a>' ;
2018-02-26 11:57:29 +01:00
2016-02-28 00:00:08 +01:00
//print_barre_liste($title, 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, $linktotasks, $num, $totalnboflines, 'title_generic.png', 0, '', '', 0, 1);
2018-02-26 11:57:29 +01:00
print load_fiche_titre ( $title , $linktotasks . ' ' . $linktocreatetask , 'title_generic.png' );
2017-06-11 10:37:58 +02:00
2009-07-28 15:37:28 +02:00
// Get list of tasks in tasksarray and taskarrayfiltered
2014-01-06 13:02:20 +01:00
// 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).
2017-01-12 15:23:30 +01:00
$filteronthirdpartyid = $socid ;
2018-05-18 10:33:32 +02:00
$tasksarray = $taskstatic -> getTasksArray ( 0 , 0 , $object -> id , $filteronthirdpartyid , 0 , '' , - 1 , $morewherefilter );
2009-07-28 15:37:28 +02:00
// We load also tasks limited to a particular user
2017-04-11 02:48:16 +02:00
$tmpuser = new User ( $db );
if ( $search_user_id > 0 ) $tmpuser -> fetch ( $search_user_id );
2017-06-11 10:37:58 +02:00
2017-04-11 02:48:16 +02:00
$tasksrole = ( $tmpuser -> id > 0 ? $taskstatic -> getUserRolesForProjectsOrTasks ( 0 , $tmpuser , $object -> id , 0 ) : '' );
2010-02-15 11:54:55 +01:00
//var_dump($tasksarray);
//var_dump($tasksrole);
2009-07-28 15:37:28 +02:00
2012-09-19 17:53:09 +02:00
if ( ! empty ( $conf -> use_javascript_ajax ))
2012-09-15 15:33:00 +02:00
{
2012-09-19 17:53:09 +02:00
include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php' ;
}
2012-09-15 13:53:19 +02:00
2018-05-18 10:33:32 +02:00
// Filter on categories
$moreforfilter = '' ;
if ( count ( $tasksarray ) > 0 )
{
$moreforfilter .= '<div class="divsearchfield">' ;
$moreforfilter .= $langs -> trans ( " TasksAssignedTo " ) . ': ' ;
$moreforfilter .= $form -> select_dolusers ( $tmpuser -> id > 0 ? $tmpuser -> id : '' , 'search_user_id' , 1 );
$moreforfilter .= '</div>' ;
}
if ( $moreforfilter )
{
print '<div class="liste_titre liste_titre_bydiv centpercent">' ;
print $moreforfilter ;
print '</div>' ;
}
2018-01-04 20:42:57 +01:00
$varpage = empty ( $contextpage ) ? $_SERVER [ " PHP_SELF " ] : $contextpage ;
$selectedfields = $form -> multiSelectArrayWithCheckbox ( 'selectedfields' , $arrayfields , $varpage ); // This also change content of $arrayfields
2017-08-22 20:20:34 +02:00
print '<div class="div-table-responsive">' ;
2018-05-18 10:33:32 +02:00
print '<table id="tablelines" class="tagtable liste' . ( $moreforfilter ? " listwithfilterbefore " : " " ) . '"">' ;
// Fields title search
print '<tr class="liste_titre_filter">' ;
print '<td class="liste_titre">' ;
2018-05-25 11:08:05 +02:00
print '<input class="flat searchstring maxwidth50" type="text" name="search_taskref" value="' . dol_escape_htmltag ( $search_taskref ) . '">' ;
2018-05-18 10:33:32 +02:00
print '</td>' ;
print '<td class="liste_titre">' ;
2018-05-25 11:08:05 +02:00
print '<input class="flat searchstring maxwidth100" type="text" name="search_tasklabel" value="' . dol_escape_htmltag ( $search_tasklabel ) . '">' ;
2018-05-18 10:33:32 +02:00
print '</td>' ;
print '<td class="liste_titre" align="center">' ;
2018-05-25 11:08:05 +02:00
print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_dtstartday" value="' . $search_dtstartday . '">' ;
print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_dtstartmonth" value="' . $search_dtstartmonth . '">' ;
2018-05-18 10:33:32 +02:00
$formother -> select_year ( $search_dtstartyear ? $search_dtstartyear :- 1 , 'search_dtstartyear' , 1 , 20 , 5 );
print '</td>' ;
print '<td class="liste_titre" align="center">' ;
2018-05-25 11:08:05 +02:00
print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_dtendday" value="' . $search_dtendday . '">' ;
print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_dtendmonth" value="' . $search_dtendmonth . '">' ;
2018-05-18 10:33:32 +02:00
$formother -> select_year ( $search_dtendyear ? $search_dtendyear :- 1 , 'search_dtendyear' , 1 , 20 , 5 );
print '</td>' ;
print '<td class="liste_titre" align="right">' ;
print '<input class="flat" type="text" size="4" name="search_planedworkload" value="' . $search_planedworkload . '">' ;
print '</td>' ;
print '<td class="liste_titre" align="right">' ;
print '<input class="flat" type="text" size="4" name="search_timespend" value="' . $search_timespend . '">' ;
print '</td>' ;
print '<td class="liste_titre" align="right">' ;
print '<input class="flat" type="text" size="4" name="search_progresscalc" value="' . $search_progresscalc . '">' ;
print '</td>' ;
print '<td class="liste_titre" align="right">' ;
print '<input class="flat" type="text" size="4" name="search_progressdeclare" value="' . $search_progressdeclare . '">' ;
print '</td>' ;
2018-05-25 10:54:17 +02:00
if ( ! empty ( $conf -> global -> PROJECT_SHOW_CONTACTS_IN_LIST )) print '<td></td>' ;
2018-05-21 11:03:48 +02:00
2018-05-18 10:33:32 +02:00
// Action column
print '<td class="liste_titre" align="right">' ;
$searchpicto = $form -> showFilterButtons ();
print $searchpicto ;
print '</td>' ;
print " </tr> \n " ;
2017-06-11 10:37:58 +02:00
2015-04-08 20:40:01 +02:00
print '<tr class="liste_titre nodrag nodrop">' ;
2012-02-04 18:34:52 +01:00
// print '<td>'.$langs->trans("Project").'</td>';
2018-01-05 01:46:07 +01:00
print_liste_field_titre ( " RefTask " , $_SERVER [ " PHP_SELF " ], " " , '' , '' , '' , $sortfield , $sortorder , '' );
print_liste_field_titre ( " LabelTask " , $_SERVER [ " PHP_SELF " ], " " , '' , '' , '' , $sortfield , $sortorder , '' );
print_liste_field_titre ( " DateStart " , $_SERVER [ " PHP_SELF " ], " " , '' , '' , 'align="center"' , $sortfield , $sortorder , '' );
print_liste_field_titre ( " DateEnd " , $_SERVER [ " PHP_SELF " ], " " , '' , '' , 'align="center"' , $sortfield , $sortorder , '' );
print_liste_field_titre ( " PlannedWorkload " , $_SERVER [ " PHP_SELF " ], " " , '' , '' , 'align="right"' , $sortfield , $sortorder , '' );
print_liste_field_titre ( " TimeSpent " , $_SERVER [ " PHP_SELF " ], " " , '' , '' , 'align="right"' , $sortfield , $sortorder , '' );
print_liste_field_titre ( " ProgressCalculated " , $_SERVER [ " PHP_SELF " ], " " , '' , '' , 'align="right"' , $sortfield , $sortorder , '' );
print_liste_field_titre ( " ProgressDeclared " , $_SERVER [ " PHP_SELF " ], " " , '' , '' , 'align="right"' , $sortfield , $sortorder , '' );
2018-05-25 10:54:17 +02:00
if ( ! empty ( $conf -> global -> PROJECT_SHOW_CONTACTS_IN_LIST )) print_liste_field_titre ( " TaskRessourceLinks " , $_SERVER [ " PHP_SELF " ], '' , '' , '' , $sortfield , $sortorder , '' );
2018-01-04 20:42:57 +01:00
print_liste_field_titre ( '' , $_SERVER [ " PHP_SELF " ], " " , '' , '' , 'align="center" width="80"' , $sortfield , $sortorder , 'maxwidthsearch ' );
2009-01-12 21:26:06 +01:00
print " </tr> \n " ;
2017-06-11 10:37:58 +02:00
2011-09-17 21:49:50 +02:00
if ( count ( $tasksarray ) > 0 )
2010-05-23 22:37:28 +02:00
{
2016-02-28 00:00:08 +01:00
// Show all lines in taskarray (recursive function to go down on tree)
2014-03-11 20:38:29 +01:00
$j = 0 ; $level = 0 ;
2018-05-18 10:33:32 +02:00
$nboftaskshown = projectLinesa ( $j , 0 , $tasksarray , $level , true , 0 , $tasksrole , $object -> id , 1 , $object -> id , $filterprogresscalc );
2010-05-23 22:37:28 +02:00
}
else
{
2018-05-21 11:03:48 +02:00
print '<tr class="oddeven"><td colspan="10" class="opacitymedium">' . $langs -> trans ( " NoTasks " ) . '</td></tr>' ;
2010-05-23 22:37:28 +02:00
}
2017-06-11 10:37:58 +02:00
2009-01-12 21:26:06 +01:00
print " </table> " ;
2017-08-22 20:20:34 +02:00
print '</div>' ;
2009-07-28 15:37:28 +02:00
2017-04-11 02:48:16 +02:00
print '</form>' ;
2017-06-11 10:37:58 +02:00
2009-01-14 17:40:45 +01:00
2009-07-28 15:37:28 +02:00
// Test if database is clean. If not we clean it.
2011-09-17 21:49:50 +02:00
//print 'mode='.$_REQUEST["mode"].' $nboftaskshown='.$nboftaskshown.' count($tasksarray)='.count($tasksarray).' count($tasksrole)='.count($tasksrole).'<br>';
2014-01-06 13:02:20 +01:00
if ( ! empty ( $user -> rights -> projet -> all -> lire )) // We make test to clean only if user has permission to see all (test may report false positive otherwise)
2008-09-10 22:49:21 +02:00
{
2017-04-11 02:48:16 +02:00
if ( $search_user_id == $user -> id )
2014-01-06 13:02:20 +01:00
{
2014-04-26 21:36:58 +02:00
if ( $nboftaskshown < count ( $tasksrole ))
{
include_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php' ;
cleanCorruptedTree ( $db , 'projet_task' , 'fk_task_parent' );
}
2014-01-06 13:02:20 +01:00
}
else
{
2018-02-26 12:01:13 +01:00
if ( $nboftaskshown < count ( $tasksarray ) && ! GETPOST ( 'search_user_id' , 'int' ))
2014-04-26 21:36:58 +02:00
{
include_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php' ;
cleanCorruptedTree ( $db , 'projet_task' , 'fk_task_parent' );
}
2014-01-06 13:02:20 +01:00
}
2008-09-10 22:49:21 +02:00
}
}
2018-08-15 12:48:13 +02:00
// End of page
2012-01-25 11:05:15 +01:00
llxFooter ();
2009-01-15 00:36:51 +01:00
$db -> close ();