2008-09-10 22:49:21 +02:00
< ? php
/* Copyright ( C ) 2005 Rodolphe Quiedeville < rodolphe @ quiedeville . org >
2016-05-04 12:24:15 +02:00
* Copyright ( C ) 2004 - 2016 Laurent Destailleur < eldy @ users . sourceforge . net >
2012-12-30 15:13:49 +01:00
* Copyright ( C ) 2005 - 2010 Regis Houssin < regis . houssin @ capnetworks . com >
2010-11-06 21:55:52 +01:00
* Copyright ( C ) 2010 François Legastelois < flegastelois @ teclib . com >
2008-09-10 22:49:21 +02: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
2013-01-16 15:36:08 +01:00
* the Free Software Foundation ; either version 3 of the License , or
2008-09-10 22:49:21 +02:00
* ( 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
2011-08-01 01:19:04 +02:00
* along with this program . If not , see < http :// www . gnu . org / licenses />.
2008-09-10 22:49:21 +02:00
*/
/**
2015-03-18 11:04:50 +01:00
* \file htdocs / projet / activity / perday . php
2008-09-10 22:49:21 +02:00
* \ingroup projet
2015-03-18 11:04:50 +01:00
* \brief List activities of tasks ( per day entry )
2008-09-10 22:49:21 +02:00
*/
2010-03-01 09:42:10 +01: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' ;
2015-03-18 11:20:08 +01:00
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php' ;
2015-06-11 18:27:59 +02:00
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php' ;
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formcompany.class.php' ;
2010-03-01 20:36:58 +01:00
$langs -> load ( 'projects' );
2008-09-10 22:49:21 +02:00
2012-02-15 23:08:20 +01:00
$action = GETPOST ( 'action' );
2011-12-04 15:26:32 +01:00
$mode = GETPOST ( " mode " );
2012-02-27 22:26:22 +01:00
$id = GETPOST ( 'id' , 'int' );
2015-06-11 18:27:59 +02:00
$taskid = GETPOST ( 'taskid' );
2008-09-10 22:49:21 +02:00
2010-09-18 15:38:43 +02:00
$mine = 0 ;
if ( $mode == 'mine' ) $mine = 1 ;
2010-01-22 21:20:41 +01:00
$projectid = '' ;
2010-01-27 08:58:31 +01:00
$projectid = isset ( $_GET [ " id " ]) ? $_GET [ " id " ] : $_POST [ " projectid " ];
2008-09-10 22:49:21 +02:00
// Security check
2010-02-14 16:43:37 +01:00
$socid = 0 ;
2010-05-30 14:21:32 +02:00
if ( $user -> societe_id > 0 ) $socid = $user -> societe_id ;
2010-01-22 21:20:41 +01:00
$result = restrictedArea ( $user , 'projet' , $projectid );
2008-09-10 22:49:21 +02:00
2015-04-09 20:40:49 +02:00
$now = dol_now ();
$nowtmp = dol_getdate ( $now );
$nowday = $nowtmp [ 'mday' ];
$nowmonth = $nowtmp [ 'mon' ];
$nowyear = $nowtmp [ 'year' ];
$year = GETPOST ( 'reyear' ) ? GETPOST ( 'reyear' ) : ( GETPOST ( " year " , " int " ) ? GETPOST ( " year " , " int " ) : date ( " Y " ));
$month = GETPOST ( 'remonth' ) ? GETPOST ( 'remonth' ) : ( GETPOST ( " month " , " int " ) ? GETPOST ( " month " , " int " ) : date ( " m " ));
$day = GETPOST ( 'reday' ) ? GETPOST ( 'reday' ) : ( GETPOST ( " day " , " int " ) ? GETPOST ( " day " , " int " ) : date ( " d " ));
$day = ( int ) $day ;
$week = GETPOST ( " week " , " int " ) ? GETPOST ( " week " , " int " ) : date ( " W " );
2016-10-18 12:15:59 +02:00
$search_project_ref = GETPOST ( 'search_project_ref' , 'alpha' );
2015-04-09 20:40:49 +02:00
2015-07-04 02:08:06 +02:00
$monthofday = GETPOST ( 'addtimemonth' );
$dayofday = GETPOST ( 'addtimeday' );
$yearofday = GETPOST ( 'addtimeyear' );
2015-04-09 20:40:49 +02:00
$daytoparse = $now ;
2015-07-04 02:08:06 +02:00
if ( $yearofday && $monthofday && $dayofday ) $daytoparse = dol_mktime ( 0 , 0 , 0 , $monthofday , $dayofday , $yearofday ); // xxxofday is value of day after submit action 'addtime'
else if ( $year && $month && $day ) $daytoparse = dol_mktime ( 0 , 0 , 0 , $month , $day , $year ); // this are value submited after submit of action 'submitdateselect'
2015-04-09 20:40:49 +02:00
2015-06-11 18:27:59 +02:00
$object = new Task ( $db );
2011-12-04 15:26:32 +01:00
2008-09-10 22:49:21 +02:00
/*
* Actions
*/
2016-10-18 12:15:59 +02:00
// Purge criteria
if ( GETPOST ( " button_removefilter_x " ) || GETPOST ( " button_removefilter.x " ) || GETPOST ( " button_removefilter " )) // Both test are required to be compatible with all browsers
{
$action = '' ;
$search_project_ref = '' ;
}
if ( GETPOST ( " button_search_x " ) || GETPOST ( " button_search.x " ) || GETPOST ( " button_search " ))
{
$action = '' ;
}
2015-04-09 20:40:49 +02:00
if ( GETPOST ( 'submitdateselect' ))
{
$daytoparse = dol_mktime ( 0 , 0 , 0 , GETPOST ( 'remonth' ), GETPOST ( 'reday' ), GETPOST ( 'reyear' ));
$action = '' ;
}
2015-06-11 18:27:59 +02:00
2016-07-09 13:58:46 +02:00
if ( $action == 'addtime' && $user -> rights -> projet -> lire && GETPOST ( 'assigntask' ))
2008-09-10 22:49:21 +02:00
{
2016-01-25 16:01:50 +01:00
$action = 'assigntask' ;
2015-06-11 18:27:59 +02:00
if ( $taskid > 0 )
{
$result = $object -> fetch ( $taskid , $ref );
if ( $result < 0 ) $error ++ ;
}
else
{
2015-09-12 12:52:07 +02:00
setEventMessages ( $langs -> transnoentitiesnoconv ( " ErrorFieldRequired " , $langs -> transnoentitiesnoconv ( " Task " )), '' , 'errors' );
2015-06-11 18:27:59 +02:00
$error ++ ;
}
if ( ! GETPOST ( 'type' ))
{
2015-09-12 12:52:07 +02:00
setEventMessages ( $langs -> transnoentitiesnoconv ( " ErrorFieldRequired " , $langs -> transnoentitiesnoconv ( " Type " )), '' , 'errors' );
2015-06-11 18:27:59 +02:00
$error ++ ;
}
if ( ! $error )
{
$idfortaskuser = $user -> id ;
$result = $object -> add_contact ( $idfortaskuser , GETPOST ( " type " ), 'internal' );
2016-01-26 17:50:57 +01:00
if ( $result >= 0 || $result == - 2 ) // Contact add ok or already contact of task
{
// Test if we are already contact of the project (should be rare but sometimes we can add as task contact without being contact of project, like when admin user has been removed from contact of project)
$sql = 'SELECT ec.rowid FROM ' . MAIN_DB_PREFIX . 'element_contact as ec, ' . MAIN_DB_PREFIX . 'c_type_contact as tc WHERE tc.rowid = ec.fk_c_type_contact' ;
$sql .= ' AND ec.fk_socpeople = ' . $idfortaskuser . " AND ec.element_id = '. $object->fk_project .' AND tc.element = 'project' AND source = 'internal' " ;
$resql = $db -> query ( $sql );
if ( $resql )
{
$obj = $db -> fetch_object ( $resql );
if ( ! $obj ) // User is not already linked to project, so we will create link to first type
{
$project = new Project ( $db );
$project -> fetch ( $object -> fk_project );
// Get type
$listofprojcontact = $project -> liste_type_contact ( 'internal' );
if ( count ( $listofprojcontact ))
{
$typeforprojectcontact = reset ( array_keys ( $listofprojcontact ));
$result = $project -> add_contact ( $idfortaskuser , $typeforprojectcontact , 'internal' );
}
}
}
else
{
dol_print_error ( $db );
}
}
2015-06-11 18:27:59 +02:00
}
if ( $result < 0 )
{
2015-07-04 02:08:06 +02:00
$error ++ ;
2015-06-11 18:27:59 +02:00
if ( $object -> error == 'DB_ERROR_RECORD_ALREADY_EXISTS' )
{
$langs -> load ( " errors " );
2015-12-17 14:14:44 +01:00
setEventMessages ( $langs -> trans ( " ErrorThisContactIsAlreadyDefinedAsThisType " ), null , 'warnings' );
2015-06-11 18:27:59 +02:00
}
else
{
setEventMessages ( $object -> error , $object -> errors , 'errors' );
}
}
2015-06-15 00:12:52 +02:00
2015-07-04 02:08:06 +02:00
if ( ! $error )
{
2015-09-12 12:52:07 +02:00
setEventMessages ( " TaskAssignedToEnterTime " , null );
2015-07-04 02:08:06 +02:00
}
2015-06-11 18:27:59 +02:00
$action = '' ;
}
2011-09-20 17:59:46 +02:00
2016-07-09 13:58:46 +02:00
if ( $action == 'addtime' && $user -> rights -> projet -> lire )
2015-06-11 18:27:59 +02:00
{
2015-03-18 11:04:50 +01:00
$timespent_duration = array ();
foreach ( $_POST as $key => $time )
{
if ( intval ( $time ) > 0 )
{
// Hours or minutes of duration
if ( preg_match ( " /([0-9]+)duration(hour|min)/ " , $key , $matches ))
{
$id = $matches [ 1 ];
if ( $id > 0 )
{
// We store HOURS in seconds
if ( $matches [ 2 ] == 'hour' ) $timespent_duration [ $id ] += $time * 60 * 60 ;
// We store MINUTES in seconds
if ( $matches [ 2 ] == 'min' ) $timespent_duration [ $id ] += $time * 60 ;
}
}
}
}
if ( count ( $timespent_duration ) > 0 )
{
foreach ( $timespent_duration as $key => $val )
{
2015-06-15 00:12:52 +02:00
$object -> fetch ( $key );
2016-05-04 12:24:15 +02:00
$object -> progress = GETPOST ( $key . 'progress' , 'int' );
2015-06-15 00:12:52 +02:00
$object -> timespent_duration = $val ;
$object -> timespent_fk_user = $user -> id ;
2016-05-04 12:24:15 +02:00
$object -> timespent_note = GETPOST ( $key . 'note' );
2015-03-18 11:04:50 +01:00
if ( GETPOST ( $key . " hour " ) != '' && GETPOST ( $key . " hour " ) >= 0 ) // If hour was entered
{
2015-07-04 02:08:06 +02:00
$object -> timespent_date = dol_mktime ( GETPOST ( $key . " hour " ), GETPOST ( $key . " min " ), 0 , $monthofday , $dayofday , $yearofday );
2015-06-15 00:12:52 +02:00
$object -> timespent_withhour = 1 ;
2015-03-18 11:04:50 +01:00
}
else
{
2015-07-04 02:08:06 +02:00
$object -> timespent_date = dol_mktime ( 12 , 0 , 0 , $monthofday , $dayofday , $yearofday );
}
if ( $object -> timespent_date > 0 )
{
$result = $object -> addTimeSpent ( $user );
}
else
{
2015-09-12 12:52:07 +02:00
setEventMessages ( " ErrorBadDate " , null , 'errors' );
2015-07-04 02:08:06 +02:00
$error ++ ;
break ;
2015-03-18 11:04:50 +01:00
}
if ( $result < 0 )
{
2015-06-15 00:12:52 +02:00
setEventMessages ( $object -> error , $object -> errors , 'errors' );
2015-03-18 11:04:50 +01:00
$error ++ ;
break ;
}
}
if ( ! $error )
{
2015-12-17 14:14:44 +01:00
setEventMessages ( $langs -> trans ( " RecordSaved " ), null , 'mesgs' );
2015-03-18 11:04:50 +01:00
// Redirect to avoid submit twice on back
2015-07-04 02:08:06 +02:00
header ( 'Location: ' . $_SERVER [ " PHP_SELF " ] . ( $projectid ? '?id=' . $projectid : '?' ) . ( $mode ? '&mode=' . $mode : '' ) . '&year=' . $yearofday . '&month=' . $monthofday . '&day=' . $dayofday );
2015-03-18 11:04:50 +01:00
exit ;
}
}
2016-07-09 14:28:33 +02:00
else
{
setEventMessages ( $langs -> trans ( " ErrorTimeSpentIsEmpty " ), null , 'errors' );
2015-03-18 11:04:50 +01:00
}
2011-09-20 17:59:46 +02:00
}
2008-09-10 22:49:21 +02:00
2014-08-08 02:11:03 +02:00
2008-09-10 22:49:21 +02:00
/*
* View
*/
$form = new Form ( $db );
2015-03-18 11:20:08 +01:00
$formother = new FormOther ( $db );
2015-06-11 18:27:59 +02:00
$formcompany = new FormCompany ( $db );
$formproject = new FormProjets ( $db );
2010-09-18 15:38:43 +02:00
$projectstatic = new Project ( $db );
$project = new Project ( $db );
$taskstatic = new Task ( $db );
2016-10-18 12:15:59 +02:00
$thirdpartystatic = new Societe ( $db );
2008-09-10 22:49:21 +02:00
2015-04-09 20:40:49 +02:00
$prev = dol_getdate ( $daytoparse - ( 24 * 3600 ));
$prev_year = $prev [ 'year' ];
$prev_month = $prev [ 'mon' ];
$prev_day = $prev [ 'mday' ];
$next = dol_getdate ( $daytoparse + ( 24 * 3600 ));
$next_year = $next [ 'year' ];
$next_month = $next [ 'mon' ];
$next_day = $next [ 'mday' ];
2008-09-10 22:49:21 +02:00
$title = $langs -> trans ( " TimeSpent " );
2010-09-18 15:38:43 +02:00
if ( $mine ) $title = $langs -> trans ( " MyTimeSpent " );
2015-03-18 11:04:50 +01:00
$usertoprocess = $user ;
2015-03-05 13:48:57 +01:00
$projectsListId = $projectstatic -> getProjectsAuthorizedForUser ( $usertoprocess , 0 , 1 ); // Return all project i have permission on. I want my tasks and some of my task may be on a public projet that is not my project
2010-01-27 08:58:31 +01:00
2012-02-15 23:08:20 +01:00
if ( $id )
2008-09-10 22:49:21 +02:00
{
2012-02-15 23:08:20 +01:00
$project -> fetch ( $id );
2014-08-21 23:43:11 +02:00
$project -> fetch_thirdparty ();
2008-09-10 22:49:21 +02:00
}
2015-12-04 15:37:28 +01:00
$onlyopenedproject = 1 ; // or -1
2016-10-18 12:15:59 +02:00
$morewherefilter = '' ;
$tasksarray = $taskstatic -> getTasksArray ( 0 , 0 , ( $project -> id ? $project -> id : 0 ), $socid , 0 , $search_project_ref , $onlyopenedproject , $morewherefilter ); // We want to see all task of opened project i am allowed to see, not only mine. Later only mine will be editable later.
2015-12-04 15:37:28 +01:00
$projectsrole = $taskstatic -> getUserRolesForProjectsOrTasks ( $usertoprocess , 0 , ( $project -> id ? $project -> id : 0 ), 0 , $onlyopenedproject );
$tasksrole = $taskstatic -> getUserRolesForProjectsOrTasks ( 0 , $usertoprocess , ( $project -> id ? $project -> id : 0 ), 0 , $onlyopenedproject );
2010-09-18 15:38:43 +02:00
//var_dump($tasksarray);
//var_dump($projectsrole);
//var_dump($taskrole);
2014-08-07 11:08:36 +02:00
2015-03-18 11:04:50 +01:00
llxHeader ( " " , $title , " " );
2014-08-08 01:26:53 +02:00
2015-04-18 23:39:04 +02:00
print_barre_liste ( $title , $page , $_SERVER [ " PHP_SELF " ], " " , $sortfield , $sortorder , " " , $num , '' , 'title_project' );
2014-08-07 11:08:36 +02:00
2016-10-18 12:15:59 +02:00
$param = '' ;
$param .= ( $mode ? '&mode=' . $mode : '' );
$param .= ( $search_project_ref ? '&search_project_ref=' . $search_project_ref : '' );
2015-03-01 17:45:36 +01:00
2015-04-09 20:40:49 +02:00
// Show navigation bar
2016-10-18 12:15:59 +02:00
$nav = '<a class="inline-block valignmiddle" href="?year=' . $prev_year . " &month= " . $prev_month . " &day= " . $prev_day . $param . '">' . img_previous ( $langs -> trans ( " Previous " )) . " </a> \n " ;
2015-04-09 20:40:49 +02:00
$nav .= " <span id= \" month_name \" > " . dol_print_date ( dol_mktime ( 0 , 0 , 0 , $month , $day , $year ), " day " ) . " </span> \n " ;
2016-10-18 12:15:59 +02:00
$nav .= '<a class="inline-block valignmiddle" href="?year=' . $next_year . " &month= " . $next_month . " &day= " . $next_day . $param . '">' . img_next ( $langs -> trans ( " Next " )) . " </a> \n " ;
2015-04-09 20:40:49 +02:00
$nav .= " (<a href= \" ?year= " . $nowyear . " &month= " . $nowmonth . " &day= " . $nowday . $param . " \" > " . $langs -> trans ( " Today " ) . " </a>) " ;
2016-03-25 15:53:44 +01:00
$nav .= '<br>' . $form -> select_date ( - 1 , '' , 0 , 0 , 2 , " addtime " , 1 , 0 , 1 ) . ' ' ;
2015-04-09 20:40:49 +02:00
$nav .= ' <input type="submit" name="submitdateselect" class="button" value="' . $langs -> trans ( " Refresh " ) . '">' ;
$picto = 'calendarweek' ;
print '<form name="addtime" method="POST" action="' . $_SERVER [ " PHP_SELF " ] . ( $project -> id > 0 ? '?id=' . $project -> id : '' ) . '">' ;
2015-03-01 17:45:36 +01:00
print '<input type="hidden" name="token" value="' . $_SESSION [ 'newtoken' ] . '">' ;
print '<input type="hidden" name="action" value="addtime">' ;
print '<input type="hidden" name="mode" value="' . $mode . '">' ;
2015-07-04 02:08:06 +02:00
$tmp = dol_getdate ( $daytoparse );
print '<input type="hidden" name="addtimeyear" value="' . $tmp [ 'year' ] . '">' ;
print '<input type="hidden" name="addtimemonth" value="' . $tmp [ 'mon' ] . '">' ;
print '<input type="hidden" name="addtimeday" value="' . $tmp [ 'mday' ] . '">' ;
2015-03-01 17:45:36 +01:00
$head = project_timesheet_prepare_head ( $mode );
dol_fiche_head ( $head , 'inputperday' , '' , 0 , 'task' );
2014-08-08 02:11:03 +02:00
// Show description of content
2015-12-04 15:37:28 +01:00
if ( $mine ) print $langs -> trans ( " MyTasksDesc " ) . ( $onlyopenedproject ? ' ' . $langs -> trans ( " OnlyOpenedProject " ) : '' ) . '<br>' ;
2014-08-08 02:11:03 +02:00
else
{
2015-12-04 15:37:28 +01:00
if ( $user -> rights -> projet -> all -> lire && ! $socid ) print $langs -> trans ( " ProjectsDesc " ) . ( $onlyopenedproject ? ' ' . $langs -> trans ( " OnlyOpenedProject " ) : '' ) . '<br>' ;
else print $langs -> trans ( " ProjectsPublicTaskDesc " ) . ( $onlyopenedproject ? ' ' . $langs -> trans ( " AlsoOnlyOpenedProject " ) : '' ) . '<br>' ;
2014-08-08 02:11:03 +02:00
}
2015-06-11 18:27:59 +02:00
if ( $mine )
{
print $langs -> trans ( " OnlyYourTaskAreVisible " ) . '<br>' ;
}
else
{
print $langs -> trans ( " AllTaskVisibleButEditIfYouAreAssigned " ) . '<br>' ;
}
2015-04-09 20:40:49 +02:00
print '<br>' ;
print " \n " ;
2008-09-10 22:49:21 +02:00
2014-08-07 11:08:36 +02:00
// Filter on user
2014-08-07 11:48:19 +02:00
/* dol_fiche_head ( '' );
print '<table class="border" width="100%"><tr><td width="25%">' . $langs -> trans ( " User " ) . '</td>' ;
print '<td>' ;
if ( $mine ) print $user -> getLoginUrl ( 1 );
print '</td>' ;
print '</tr></table>' ;
dol_fiche_end ();
*/
2014-08-07 11:08:36 +02:00
2014-08-08 01:26:53 +02:00
// Filter on user
/* dol_fiche_head ( '' );
print '<table class="border" width="100%"><tr><td width="25%">' . $langs -> trans ( " User " ) . '</td>' ;
print '<td>' ;
if ( $mine ) print $user -> getLoginUrl ( 1 );
print '</td>' ;
print '</tr></table>' ;
dol_fiche_end ();
*/
2008-09-10 22:49:21 +02:00
2015-04-09 20:40:49 +02:00
2016-01-25 16:01:50 +01:00
// Add a new project/task
//print '<br>';
//print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
//print '<input type="hidden" name="action" value="assigntask">';
//print '<input type="hidden" name="mode" value="'.$mode.'">';
//print '<input type="hidden" name="year" value="'.$year.'">';
//print '<input type="hidden" name="month" value="'.$month.'">';
//print '<input type="hidden" name="day" value="'.$day.'">';
2016-10-18 12:15:59 +02:00
print '<div class="floatright">' . $nav . '</div>' ; // We move this before the assign to components so, the default submit button is not the assign to.
2016-01-25 16:01:50 +01:00
print '<div class="float">' ;
print $langs -> trans ( " AssignTaskToMe " ) . '<br>' ;
$formproject -> selectTasks ( $socid ? $socid :- 1 , $taskid , 'taskid' , 32 , 0 , 1 , 1 );
print $formcompany -> selectTypeContact ( $object , '' , 'type' , 'internal' , 'rowid' , 0 );
print '<input type="submit" class="button" name="assigntask" value="' . $langs -> trans ( " AssignTask " ) . '">' ;
//print '</form>';
print '</div>' ;
print '<div class="clearboth" style="padding-bottom: 8px;"></div>' ;
2015-04-09 20:40:49 +02:00
2008-09-10 22:49:21 +02:00
print '<table class="noborder" width="100%">' ;
print '<tr class="liste_titre">' ;
print '<td>' . $langs -> trans ( " RefTask " ) . '</td>' ;
print '<td>' . $langs -> trans ( " LabelTask " ) . '</td>' ;
2016-10-18 12:15:59 +02:00
print '<td>' . $langs -> trans ( " ProjectRef " ) . '</td>' ;
if ( ! empty ( $conf -> global -> PROJECT_LINES_PERDAY_SHOW_THIRDPARTY ))
{
print '<td>' . $langs -> trans ( " ThirdParty " ) . '</td>' ;
}
2013-11-05 11:17:54 +01:00
print '<td align="right">' . $langs -> trans ( " PlannedWorkload " ) . '</td>' ;
2014-10-12 01:04:34 +02:00
print '<td align="right">' . $langs -> trans ( " ProgressDeclared " ) . '</td>' ;
2015-03-05 13:48:57 +01:00
print '<td align="right">' . $langs -> trans ( " TimeSpent " ) . '</td>' ;
if ( $usertoprocess -> id == $user -> id ) print '<td align="right">' . $langs -> trans ( " TimeSpentByYou " ) . '</td>' ;
else print '<td align="right">' . $langs -> trans ( " TimeSpentByUser " ) . '</td>' ;
2015-04-09 20:40:49 +02:00
print '<td align="center">' . $langs -> trans ( " HourStart " ) . '</td>' ;
2015-03-18 11:04:50 +01:00
print '<td align="center" colspan="2">' . $langs -> trans ( " Duration " ) . '</td>' ;
2016-09-19 17:12:53 +02:00
print '<td align="right">' . $langs -> trans ( " Note " ) . '</td>' ;
2008-09-10 22:49:21 +02:00
print " </tr> \n " ;
2016-10-18 12:15:59 +02:00
print '<tr class="liste_titre">' ;
print '<td class="liste_total"></td>' ;
print '<td class="liste_total"></td>' ;
print '<td class="liste_total"><input type="text" size="4" name="search_project_ref" value="' . dol_escape_htmltag ( $search_project_ref ) . '"></td>' ;
if ( ! empty ( $conf -> global -> PROJECT_LINES_PERWEEK_SHOW_THIRDPARTY )) print '<td class="liste_total"></td>' ;
print '<td class="liste_total"></td>' ;
print '<td class="liste_total"></td>' ;
print '<td class="liste_total"></td>' ;
print '<td class="liste_total"></td>' ;
print '<td class="liste_total"></td>' ;
print '<td class="liste_total"></td>' ;
// Action column
print '<td class="liste_titre nowrap" align="right">' ;
$searchpitco = $form -> showFilterAndCheckAddButtons ( 0 );
print $searchpitco ;
print '</td>' ;
print " </tr> \n " ;
2014-08-07 11:48:19 +02:00
// By default, we can edit only tasks we are assigned to
2015-06-11 18:27:59 +02:00
$restrictviewformytask = ( empty ( $conf -> global -> PROJECT_TIME_SHOW_TASK_NOT_ASSIGNED ) ? 1 : 0 );
2014-08-07 11:48:19 +02:00
2014-08-07 11:08:36 +02:00
if ( count ( $tasksarray ) > 0 )
{
2015-03-01 17:45:36 +01:00
$j = 0 ;
2016-07-09 13:58:46 +02:00
projectLinesPerDay ( $j , 0 , $usertoprocess , $tasksarray , $level , $projectsrole , $tasksrole , $mine , $restrictviewformytask , $daytoparse );
2014-08-07 11:08:36 +02:00
}
else
{
print '<tr><td colspan="10">' . $langs -> trans ( " NoTasks " ) . '</td></tr>' ;
}
2008-09-10 22:49:21 +02:00
print " </table> " ;
2015-03-01 17:45:36 +01:00
dol_fiche_end ();
2015-03-18 11:20:08 +01:00
print '<div class="center">' ;
2015-05-07 11:57:23 +02:00
print '<input type="submit" class="button"' . ( $disabledtask ? ' disabled' : '' ) . ' value="' . $langs -> trans ( " Save " ) . '">' ;
2015-03-18 11:20:08 +01:00
print '</div>' ;
2015-03-18 11:04:50 +01:00
print '</form>' ;
2012-02-15 23:08:20 +01:00
2008-09-10 22:49:21 +02:00
2015-04-09 20:40:49 +02:00
print '<script type="text/javascript">' ;
print " jQuery(document).ready(function () { \n " ;
print ' jQuery(".timesheetalreadyrecorded").tipTip({ maxWidth: "600px", edgeOffset: 10, delay: 50, fadeIn: 50, fadeOut: 50, content: \'' . dol_escape_js ( $langs -> trans ( " TimeAlreadyRecorded " , $user -> getFullName ( $langs ))) . '\'});' ;
print " }); " ;
print '</script>' ;
2011-08-27 16:24:16 +02:00
llxFooter ();
2011-12-04 15:26:32 +01:00
$db -> close ();