29require
"../../main.inc.php";
30require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
31require_once DOL_DOCUMENT_ROOT.
'/projet/class/task.class.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/lib/project.lib.php';
33require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
34require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
35require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
36require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
37require_once DOL_DOCUMENT_ROOT.
'/holiday/class/holiday.class.php';
40$langs->loadLangs(array(
'projects',
'users',
'companies'));
42$action =
GETPOST(
'action',
'aZ09');
43$mode =
GETPOST(
"mode",
'alpha');
47$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'timespent';
56$hookmanager->initHooks(array(
'timesheetperdaycard'));
74$search_usertoprocessid =
GETPOSTINT(
'search_usertoprocessid');
75$search_task_ref =
GETPOST(
'search_task_ref',
'alpha');
76$search_task_label =
GETPOST(
'search_task_label',
'alpha');
77$search_project_ref =
GETPOST(
'search_project_ref',
'alpha');
78$search_thirdparty =
GETPOST(
'search_thirdparty',
'alpha');
79$search_declared_progress =
GETPOST(
'search_declared_progress',
'alpha');
81$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
82$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
84$monthofday =
GETPOST(
'addtimemonth');
85$dayofday =
GETPOST(
'addtimeday');
86$yearofday =
GETPOST(
'addtimeyear');
93if ($year && $month && $day) {
94 $daytoparse =
dol_mktime(0, 0, 0, $month, $day, $year);
95} elseif ($yearofday && $monthofday && $dayofday) {
96 $daytoparse =
dol_mktime(0, 0, 0, $monthofday, $dayofday, $yearofday);
100if ($yearofday && $monthofday && $dayofday) {
101 $daytoparsegmt =
dol_mktime(0, 0, 0, $monthofday, $dayofday, $yearofday,
'gmt');
102} elseif ($year && $month && $day) {
103 $daytoparsegmt =
dol_mktime(0, 0, 0, $month, $day, $year,
'gmt');
106if (empty($search_usertoprocessid) || $search_usertoprocessid == $user->id) {
107 $usertoprocess = $user;
108 $search_usertoprocessid = $usertoprocess->id;
109} elseif ($search_usertoprocessid > 0) {
110 $usertoprocess =
new User($db);
111 $usertoprocess->fetch($search_usertoprocessid);
112 $search_usertoprocessid = $usertoprocess->id;
114 $usertoprocess =
new User($db);
124$extrafields->fetch_name_optionals_label(
$object->table_element);
127$arrayfields = array();
128$arrayfields[
't.planned_workload'] = array(
'label' =>
'PlannedWorkload',
'checked' => 1,
'enabled' => 1,
'position' => 0);
129$arrayfields[
't.progress'] = array(
'label' =>
'ProgressDeclared',
'checked' => 1,
'enabled' => 1,
'position' => 0);
130$arrayfields[
'timeconsumed'] = array(
'label' =>
'TimeConsumed',
'checked' => 1,
'enabled' => 1,
'position' => 15);
141if (!empty($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label']) > 0) {
142 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
143 if (!empty($extrafields->attributes[
$object->table_element][
'list'][$key])) {
144 $arrayfields[
"efpt.".$key] = array(
'label' => $extrafields->attributes[
$object->table_element][
'label'][$key],
'checked' => (($extrafields->attributes[
$object->table_element][
'list'][$key] < 0) ? 0 : 1),
'position' => $extrafields->attributes[
$object->table_element][
'pos'][$key],
'enabled' => (abs((int) $extrafields->attributes[
$object->table_element][
'list'][$key]) != 3 && $extrafields->attributes[
$object->table_element][
'perms'][$key]));
151$search_array_options_project = $extrafields->getOptionalsFromPost($project->table_element,
'',
'search_');
152$search_array_options_task = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_task_');
159$parameters = array(
'id' => $id,
'taskid' => $taskid,
'projectid' => $projectid);
160$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
165if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
168 $search_usertoprocessid = $user->id;
169 $search_task_ref =
'';
170 $search_task_label =
'';
171 $search_project_ref =
'';
172 $search_thirdparty =
'';
173 $search_declared_progress =
'';
175 $search_array_options_project = array();
176 $search_array_options_task = array();
179 $usertoprocess = $user;
181if (
GETPOST(
"button_search_x",
'alpha') ||
GETPOST(
"button_search.x",
'alpha') ||
GETPOST(
"button_search",
'alpha')) {
185if (
GETPOST(
'submitdateselect')) {
193include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
195if ($action ==
'addtime' && $user->hasRight(
'projet',
'lire') &&
GETPOST(
'assigntask') &&
GETPOST(
'formfilteraction') !=
'listafterchangingselectedfields') {
196 $action =
'assigntask';
199 $result =
$object->fetch($taskid, $ref);
204 setEventMessages($langs->transnoentitiesnoconv(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Task")),
null,
'errors');
208 setEventMessages($langs->transnoentitiesnoconv(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Type")),
null,
'errors');
212 $idfortaskuser = $usertoprocess->id;
213 $result =
$object->add_contact($idfortaskuser,
GETPOST(
"type"),
'internal');
215 if ($result >= 0 || $result == -2) {
217 $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';
218 $sql .=
' AND ec.fk_socpeople = '.((int) $idfortaskuser).
" AND ec.element_id = ".((int)
$object->fk_project).
" AND tc.element = 'project' AND source = 'internal'";
219 $resql = $db->query($sql);
221 $obj = $db->fetch_object($resql);
224 $project->fetch(
$object->fk_project);
226 $listofprojcontact = $project->liste_type_contact(
'internal');
228 if (count($listofprojcontact)) {
229 $tmparray = array_keys($listofprojcontact);
230 $typeforprojectcontact = reset($tmparray);
231 $result = $project->add_contact($idfortaskuser, $typeforprojectcontact,
'internal');
242 if (
$object->error ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
243 $langs->load(
"errors");
244 setEventMessages($langs->trans(
"ErrorTaskAlreadyAssigned"),
null,
'warnings');
258if ($action ==
'addtime' && $user->hasRight(
'projet',
'lire') &&
GETPOST(
'formfilteraction') !=
'listafterchangingselectedfields') {
259 $timespent_duration = array();
261 if (is_array($_POST)) {
262 foreach ($_POST as $key => $time) {
263 if (intval($time) > 0) {
266 if (preg_match(
"/([0-9]+)duration(hour|min)/", $key, $matches)) {
270 if ($matches[2] ==
'hour') {
271 $timespent_duration[$id] += $time * 60 * 60;
275 if ($matches[2] ==
'min') {
276 $timespent_duration[$id] += $time * 60;
284 if (count($timespent_duration) > 0) {
285 foreach ($timespent_duration as $key => $val) {
289 if (GETPOSTISSET($taskid.
'progress')) {
295 $object->timespent_duration = $val;
296 $object->timespent_fk_user = $usertoprocess->id;
300 $object->timespent_withhour = 1;
302 $object->timespent_datehour =
dol_mktime(12, 0, 0, $monthofday, $dayofday, $yearofday);
306 if (
$object->timespent_date > 0) {
307 $result =
$object->addTimeSpent($user);
325 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?'.($projectid ?
'id='.$projectid :
'').($search_usertoprocessid ?
'&search_usertoprocessid='.urlencode($search_usertoprocessid) :
'').($mode ?
'&mode='.$mode :
'').
'&year='.$yearofday.
'&month='.$monthofday.
'&day='.$dayofday);
339$form =
new Form($db);
343$projectstatic =
new Project($db);
345$taskstatic =
new Task($db);
346$thirdpartystatic =
new Societe($db);
350$prev_year = $prev[
'year'];
351$prev_month = $prev[
'mon'];
352$prev_day = $prev[
'mday'];
355$next_year = $next[
'year'];
356$next_month = $next[
'mon'];
357$next_day = $next[
'mday'];
359$title = $langs->trans(
"TimeSpent");
361$projectsListId = $projectstatic->getProjectsAuthorizedForUser($usertoprocess, (empty($usertoprocess->id) ? 2 : 0), 1);
364 $project->fetch($id);
365 $project->fetch_thirdparty();
368$onlyopenedproject = 1;
369$morewherefilter =
'';
371if ($search_project_ref) {
372 $morewherefilter .=
natural_search(array(
"p.ref",
"p.title"), $search_project_ref);
374if ($search_task_ref) {
377if ($search_task_label) {
378 $morewherefilter .=
natural_search(array(
"t.ref",
"t.label"), $search_task_label);
380if ($search_thirdparty) {
383if ($search_declared_progress) {
384 $morewherefilter .=
natural_search(
"t.progress", $search_declared_progress, 1);
387$sql = &$morewherefilter;
395$search_array_options = $search_array_options_task;
396$extrafieldsobjectprefix =
'efpt.';
397$search_options_pattern =
'search_task_options_';
398$extrafieldsobjectkey =
'projet_task';
399include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
401$tasksarray = $taskstatic->getTasksArray(0, 0, ($project->id ? $project->id : 0), $socid, 0, $search_project_ref, $onlyopenedproject, $morewherefilter, ($search_usertoprocessid ? $search_usertoprocessid : 0), 0, $extrafields);
402if ($morewherefilter) {
403 $tasksarraywithoutfilter = $taskstatic->getTasksArray(0, 0, ($project->id ? $project->id : 0), $socid, 0,
'', $onlyopenedproject,
'', ($search_usertoprocessid ? $search_usertoprocessid : 0));
405$projectsrole = $taskstatic->getUserRolesForProjectsOrTasks($usertoprocess,
null, ($project->id ? $project->id : 0), 0, $onlyopenedproject);
406$tasksrole = $taskstatic->getUserRolesForProjectsOrTasks(
null, $usertoprocess, ($project->id ? $project->id : 0), 0, $onlyopenedproject);
411llxHeader(
"", $title,
"",
'',
'',
'', array(
'/core/js/timesheet.js'));
416$param .= ($mode ?
'&mode='.urlencode($mode) :
'');
417$param .= ($search_project_ref ?
'&search_project_ref='.urlencode($search_project_ref) :
'');
418$param .= ($search_usertoprocessid > 0 ?
'&search_usertoprocessid='.urlencode($search_usertoprocessid) :
'');
419$param .= ($search_thirdparty ?
'&search_thirdparty='.urlencode($search_thirdparty) :
'');
420$param .= ($search_task_ref ?
'&search_task_ref='.urlencode($search_task_ref) :
'');
421$param .= ($search_task_label ?
'&search_task_label='.urlencode($search_task_label) :
'');
429$search_array_options = $search_array_options_task;
430$search_options_pattern =
'search_task_options_';
431include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
434$nav =
'<a class="inline-block valignmiddle" href="?year='.$prev_year.
"&month=".$prev_month.
"&day=".$prev_day.$param.
'">'.
img_previous($langs->trans(
"Previous")).
"</a>\n";
436$nav .=
' <span id="month_name">'.dol_print_date(
dol_mktime(0, 0, 0, $month, $day, $year),
"day").
" </span>\n";
437$nav .=
'<a class="inline-block valignmiddle" href="?year='.$next_year.
"&month=".$next_month.
"&day=".$next_day.$param.
'">'.
img_next($langs->trans(
"Next")).
"</a>\n";
438$nav .=
' '.$form->selectDate(-1,
'', 0, 0, 2,
"addtime", 1, ($conf->dol_optimize_smallscreen ? 0 : 1)).
' ';
439$nav .=
' <button type="submit" name="button_search_x" value="x" class="bordertransp nobordertransp button_search"><span class="fa fa-search"></span></button>';
443print
'<form name="addtime" method="POST" action="'.$_SERVER[
"PHP_SELF"].($project->id > 0 ?
'?id='.$project->id :
'').
'">';
444print
'<input type="hidden" name="token" value="'.newToken().
'">';
445print
'<input type="hidden" name="action" value="addtime">';
446print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
447print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
448print
'<input type="hidden" name="mode" value="'.$mode.
'">';
450print
'<input type="hidden" name="addtimeyear" value="'.$tmp[
'year'].
'">';
451print
'<input type="hidden" name="addtimemonth" value="'.$tmp[
'mon'].
'">';
452print
'<input type="hidden" name="addtimeday" value="'.$tmp[
'mday'].
'">';
455print
dol_get_fiche_head($head,
'inputperday', $langs->trans(
'TimeSpent'), -1, $picto);
458print
'<div class="hideonsmartphone opacitymedium">';
459if ($mine || ($usertoprocess->id == $user->id)) {
460 print $langs->trans(
"MyTasksDesc").
'.'.($onlyopenedproject ?
' '.$langs->trans(
"OnlyOpenedProject") :
'').
'<br>';
462 if (empty($usertoprocess->id) || $usertoprocess->id < 0) {
463 if ($user->hasRight(
'projet',
'all',
'lire') && !$socid) {
464 print $langs->trans(
"ProjectsDesc").
'.'.($onlyopenedproject ?
' '.$langs->trans(
"OnlyOpenedProject") :
'').
'<br>';
466 print $langs->trans(
"ProjectsPublicTaskDesc").
'.'.($onlyopenedproject ?
' '.$langs->trans(
"OnlyOpenedProject") :
'').
'<br>';
470if ($mine || ($usertoprocess->id == $user->id)) {
471 print $langs->trans(
"OnlyYourTaskAreVisible").
'<br>';
473 print $langs->trans(
"AllTaskVisibleButEditIfYouAreAssigned").
'<br>';
480print
'<div class="'.($conf->dol_optimize_smallscreen ?
'center centpercent' :
'floatright right').
'">'.$nav.
'</div>';
482print
'<div class="colorbacktimesheet valignmiddle'.($conf->dol_optimize_smallscreen ?
' center' :
' float').
'">';
483$titleassigntask = $langs->transnoentities(
"AssignTaskToMe");
484if ($usertoprocess->id != $user->id) {
485 $titleassigntask = $langs->transnoentities(
"AssignTaskToUser", $usertoprocess->getFullName($langs));
487print
'<div class="taskiddiv inline-block">';
488print
img_picto(
'',
'projecttask',
'class="pictofixedwidth"');
489$formproject->selectTasks($socid ? $socid : -1, $taskid,
'taskid', 32, 0,
'-- '.$langs->trans(
"ChooseANotYetAssignedTask").
' --', 1, 0, 0,
'widthcentpercentminusx',
'',
'all', $usertoprocess);
492print $formcompany->selectTypeContact($object,
'',
'type',
'internal',
'position', 0,
'maxwidth150onsmartphone');
493print
'<input type="submit" class="button valignmiddle smallonsmartphone small" name="assigntask" value="'.dol_escape_htmltag($titleassigntask).
'">';
496print
'<div class="clearboth" style="padding-bottom: 20px;"></div>';
511$includeonly =
'hierarchyme';
512if (!$user->hasRight(
'user',
'user',
'lire')) {
513 $includeonly = array($user->id);
515$selecteduser = $search_usertoprocessid ? $search_usertoprocessid : $usertoprocess->id;
516$moreforfiltertmp = $form->select_dolusers($selecteduser,
'search_usertoprocessid', 0,
null, 0, $includeonly,
null, 0, 0, 0,
'', 0,
'',
'maxwidth200');
517if ($form->num > 1 || empty($conf->dol_optimize_smallscreen)) {
518 $moreforfilter .=
'<div class="divsearchfield">';
519 $moreforfilter .=
'<div class="inline-block hideonsmartphone"></div>';
520 $moreforfilter .=
img_picto($langs->trans(
'Filter').
' '.$langs->trans(
'User'),
'user',
'class="paddingright pictofixedwidth"');
521 $moreforfilter .= $moreforfiltertmp;
522 $moreforfilter .=
'</div>';
524 $moreforfilter .=
'<input type="hidden" name="search_usertoprocessid" value="'.$selecteduser.
'">';
528 $moreforfilter .=
'<div class="divsearchfield">';
529 $moreforfilter .=
'<div class="inline-block"></div>';
530 $moreforfilter .=
img_picto($langs->trans(
'Filter').
' '.$langs->trans(
'Project'),
'project',
'class="paddingright pictofixedwidth"').
'<input type="text" name="search_project_ref" class="maxwidth100" value="'.
dol_escape_htmltag($search_project_ref).
'">';
531 $moreforfilter .=
'</div>';
533 $moreforfilter .=
'<div class="divsearchfield">';
534 $moreforfilter .=
'<div class="inline-block"></div>';
535 $moreforfilter .=
img_picto($langs->trans(
'Filter').
' '.$langs->trans(
'ThirdParty'),
'company',
'class="paddingright pictofixedwidth"').
'<input type="text" name="search_thirdparty" class="maxwidth100" value="'.
dol_escape_htmltag($search_thirdparty).
'">';
536 $moreforfilter .=
'</div>';
539if (!empty($moreforfilter)) {
540 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
541 print $moreforfilter;
542 $parameters = array();
543 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
544 print $hookmanager->resPrint;
548$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
549$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
553if (!empty($arrayfields[
't.planned_workload'][
'checked'])) {
556if (!empty($arrayfields[
't.progress'][
'checked'])) {
559foreach ($arrayfields as $key => $val) {
560 if ($val[
'checked'] && substr($key, 0, 5) ==
'efpt.') {
565print
'<div class="div-table-responsive">';
566print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'" id="tablelines3">'.
"\n";
568print
'<tr class="liste_titre_filter">';
570 print
'<td class="liste_titre"><input type="text" size="4" name="search_project_ref" value="'.dol_escape_htmltag($search_project_ref).
'"></td>';
573 print
'<td class="liste_titre"><input type="text" size="4" name="search_thirdparty" value="'.dol_escape_htmltag($search_thirdparty).
'"></td>';
575print
'<td class="liste_titre"><input type="text" size="4" name="search_task_label" value="'.dol_escape_htmltag($search_task_label).
'"></td>';
577$search_options_pattern =
'search_task_options_';
578$extrafieldsobjectkey =
'projet_task';
579$extrafieldsobjectprefix =
'efpt.';
580include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
581if (!empty($arrayfields[
't.planned_workload'][
'checked'])) {
582 print
'<td class="liste_titre"></td>';
584if (!empty($arrayfields[
't.progress'][
'checked'])) {
585 print
'<td class="liste_titre right"><input type="text" size="4" name="search_declared_progress" value="'.dol_escape_htmltag($search_declared_progress).
'"></td>';
587if (!empty($arrayfields[
'timeconsumed'][
'checked'])) {
588 print
'<td class="liste_titre"></td>';
589 print
'<td class="liste_titre"></td>';
591print
'<td class="liste_titre"></td>';
592print
'<td class="liste_titre"></td>';
593print
'<td class="liste_titre"></td>';
595print
'<td class="liste_titre nowrap right">';
596$searchpicto = $form->showFilterAndCheckAddButtons(0);
601print
'<tr class="liste_titre">';
603 print
'<th>'.$langs->trans(
"Project").
'</th>';
606 print
'<th>'.$langs->trans(
"ThirdParty").
'</th>';
608print
'<th>'.$langs->trans(
"Task").
'</th>';
610$extrafieldsobjectkey =
'projet_task';
611$extrafieldsobjectprefix =
'efpt.';
612include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
613if (!empty($arrayfields[
't.planned_workload'][
'checked'])) {
614 print
'<th class="leftborder plannedworkload minwidth75 maxwidth100 right" title="'.dol_escape_htmltag($langs->trans(
"PlannedWorkload")).
'">'.$form->textwithpicto($langs->trans(
"PlannedWorkloadShort"), $langs->trans(
"PlannedWorkload")).
'</th>';
616if (!empty($arrayfields[
't.progress'][
'checked'])) {
617 print
'<th class="right minwidth75 maxwidth100 title="'.dol_escape_htmltag($langs->trans(
"ProgressDeclared")).
'">'.$langs->trans(
"ProgressDeclared").
'</th>';
619if (!empty($arrayfields[
'timeconsumed'][
'checked'])) {
620 print
'<th class="right maxwidth100">'.$langs->trans(
"TimeSpentSmall").
'<br>';
621 print
'<span class="nowraponall">';
622 print
'<span class="opacitymedium nopadding userimg"><img alt="Photo" class="photouserphoto userphoto" src="'.DOL_URL_ROOT.
'/theme/common/everybody.png"></span>';
623 print
'<span class="opacitymedium paddingleft">'.$langs->trans(
"EverybodySmall").
'</span>';
626 print
'<th class="right maxwidth75 maxwidth100">'.$langs->trans(
"TimeSpentSmall").($usertoprocess->firstname ?
'<br><span class="nowraponall">'.$usertoprocess->getNomUrl(-2).
'<span class="opacitymedium paddingleft">'.
dol_trunc($usertoprocess->firstname, 10).
'</span></span>' :
'').
'</th>';
628print
'<th class="center leftborder">'.$langs->trans(
"HourStart").
'</td>';
631$restrictviewformytask =
getDolGlobalInt(
'PROJECT_TIME_SHOW_TASK_NOT_ASSIGNED', 2);
633$numendworkingday = 0;
634$numstartworkingday = 0;
636$isavailable = array();
639$numstartworkingday = 1;
640$numendworkingday = 5;
644 if (count($tmparray) >= 2) {
645 $numstartworkingday = $tmparray[0];
646 $numendworkingday = $tmparray[1];
651$isavailablefordayanduser = $holiday->verifDateHolidayForTimestamp($usertoprocess->id, $daytoparse, $statusofholidaytocheck);
652$isavailable[$daytoparse] = $isavailablefordayanduser;
654$test =
num_public_holiday($daytoparsegmt, $daytoparsegmt + 86400, $mysoc->country_code);
656 $isavailable[$daytoparse] = array(
'morning' =>
false,
'afternoon' =>
false,
'morning_reason' =>
'public_holiday',
'afternoon_reason' =>
'public_holiday');
664if ((($idw + 1) < $numstartworkingday) || (($idw + 1) > $numendworkingday)) {
665 $cssweekend =
'weekend';
671if (!$isavailable[$daytoparse][
'morning'] && !$isavailable[$daytoparse][
'afternoon']) {
672 $cssonholiday .=
'onholidayallday ';
673} elseif (!$isavailable[$daytoparse][
'morning']) {
674 $cssonholiday .=
'onholidaymorning ';
675} elseif (!$isavailable[$daytoparse][
'afternoon']) {
676 $cssonholiday .=
'onholidayafternoon ';
679print
'<th class="center'.($cssonholiday ?
' '.$cssonholiday :
'').($cssweekend ?
' '.$cssweekend :
'').
'">'.$langs->trans(
"Duration").
'</th>';
680print
'<th class="center">'.$langs->trans(
"Note").
'</th>';
682print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
686$colspan = 2 + (!
getDolGlobalString(
'PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT') ? 0 : 2);
688if ($conf->use_javascript_ajax && count($tasksarray) >=
getDolGlobalInt(
'NBLINES_TO_DUPLICATE_TOTAL_TIMESPENT_ON_TOP', 10)) {
689 print
'<tr class="liste_total hideonsmartphone">';
690 print
'<td class="liste_total" colspan="'.($colspan - 1 + $addcolspan).
'">';
691 print $langs->trans(
"Total");
693 if (!empty($arrayfields[
'timeconsumed'][
'checked'])) {
694 print
'<td class="liste_total"></td>';
695 print
'<td class="liste_total"></td>';
697 print
'<td class="liste_total leftborder">';
701 print
'<td class="liste_total center'.($cssonholiday ?
' '.$cssonholiday :
'').($cssweekend ?
' '.$cssweekend :
'').
'"><div class="totalDay0"> </div></td>';
703 print
'<td class="liste_total"></td>';
704 print
'<td class="liste_total"></td>';
709if (count($tasksarray) > 0) {
716 $totalforvisibletasks =
projectLinesPerDay($j, 0, $usertoprocess, $tasksarray, $level, $projectsrole, $tasksrole, $mine, $restrictviewformytask, $daytoparse, $isavailable, 0, $arrayfields, $extrafields);
722 $listofdistinctprojectid = array();
723 if (!empty($tasksarraywithoutfilter) && is_array($tasksarraywithoutfilter) && count($tasksarraywithoutfilter)) {
724 foreach ($tasksarraywithoutfilter as $tmptask) {
725 $listofdistinctprojectid[$tmptask->fk_project] = $tmptask->fk_project;
729 $totalforeachday = array();
730 foreach ($listofdistinctprojectid as $tmpprojectid) {
731 $projectstatic->id = $tmpprojectid;
732 $projectstatic->loadTimeSpent($daytoparse, 0, $usertoprocess->id);
733 for ($idw = 0; $idw < 7; $idw++) {
735 $totalforeachday[$tmpday] += $projectstatic->weekWorkLoad[$tmpday];
742 if (count($totalforeachday)) {
743 $timeonothertasks = ($totalforeachday[$daytoparse] - $totalforvisibletasks[$daytoparse]);
744 if ($timeonothertasks) {
751 print
'<tr class="oddeven othertaskwithtime">';
752 print
'<td colspan="'.($colspan - 1).
'" class="opacitymedium">';
753 print $langs->trans(
"OtherFilteredTasks");
755 if (!empty($arrayfields[
'timeconsumed'][
'checked'])) {
756 print
'<td class="liste_total"></td>';
757 print
'<td class="liste_total"></td>';
759 print
'<td class="leftborder"></td>';
760 print
'<td class="right">';
761 $timeonothertasks = ($totalforeachday[$daytoparse] - $totalforvisibletasks[$daytoparse]);
764 print
'<span class="timesheetalreadyrecorded" title="texttoreplace"><input type="text" class="center width40" disabled="" id="timespent[-1][0]" name="task[-1][0]" value="';
765 if ($timeonothertasks) {
771 print
' <td class="liste_total borderleft"></td>';
772 print
' <td class="liste_total"></td>';
776 if ($conf->use_javascript_ajax) {
777 print
'<tr class="liste_total">';
778 print
'<td class="liste_total" colspan="'.($colspan - 1 + $addcolspan).
'">';
779 print $langs->trans(
"Total");
781 if (!empty($arrayfields[
'timeconsumed'][
'checked'])) {
782 print
'<td class="liste_total"></td>';
783 print
'<td class="liste_total"></td>';
785 print
'<td class="liste_total leftborder borderleft">';
789 print
'<td class="liste_total center'.($cssonholiday ?
' '.$cssonholiday :
'').($cssweekend ?
' '.$cssweekend :
'').
'"><div class="totalDay0"> </div></td>';
791 print
'<td class="liste_total"></td>
792 <td class="liste_total"></td>
796 print
'<tr><td colspan="14"><span class="opacitymedium">'.$langs->trans(
"NoAssignedTasks").
'</span></td></tr>';
801print
'<input type="hidden" id="numberOfLines" name="numberOfLines" value="'.count($tasksarray).
'"/>'.
"\n";
803print
'<div class="center">';
804print
'<input type="submit" name="button_addtime" class="button button-save"'.(!empty($disabledtask) ?
' disabled' :
'').
' value="'.$langs->trans(
"Save").
'">';
809if (!empty($conf->use_javascript_ajax)) {
810 $modeinput =
'hours';
811 print
"\n<!-- JS CODE TO ENABLE Tooltips on all object with class classfortooltip -->\n";
812 print
'<script type="text/javascript">'.
"\n";
813 print
"jQuery(document).ready(function () {\n";
814 print
" updateTotal(0, '".dol_escape_js($modeinput).
"');\n";
815 print
' jQuery(".timesheetalreadyrecorded").tooltip({
816 show: { collision: "flipfit", effect:\'toggle\', delay:50 },
817 hide: { effect:\'toggle\', delay: 50 },
818 tooltipClass: "mytooltip",
819 content: function () {
820 return \''.dol_escape_js($langs->trans(
"TimeAlreadyRecorded", $usertoprocess->getFullName($langs))).
'\';
823 print " jQuery('.inputhour, .inputminute
').bind('keyup
', function(e) { updateTotal(0, '".dol_escape_js($modeinput)."') });";
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Class of the module paid holiday.
const STATUS_APPROVED
Approved.
Class to manage projects.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage Dolibarr users.
dol_time_plus_duree($time, $duration_value, $duration_unit, $ruleforendofmonth=0)
Add a delay to a date.
convertSecondToTime($iSecond, $format='all', $lengthOfDay=86400, $lengthOfWeek=7)
Return, in clear text, value of a number of seconds in days, hours and minutes.
num_public_holiday($timestampStart, $timestampEnd, $country_code='', $lastday=0, $includesaturday=-1, $includesunday=-1, $includefriday=-1, $includemonday=-1)
Return the number of non working days including Friday, Saturday and Sunday (or not) between 2 dates ...
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by the value of a given key, which produces ascending (default) or descending out...
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
img_previous($titlealt='default', $moreatt='')
Show previous logo.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
img_next($titlealt='default', $moreatt='')
Show next logo.
dol_trunc($string, $size=40, $trunc='right', $stringencoding='UTF-8', $nodot=0, $display=0)
Truncate a string to a particular length adding '…' if string larger than length.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
dol_getdate($timestamp, $fast=false, $forcetimezone='')
Return an array with locale date info.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask, $preselectedday, &$isavailable, $oldprojectforbreak=0, $arrayfields=array(), $extrafields=null)
Output a task line into a pertime input mode.
project_timesheet_prepare_head($mode, $fuser=null)
Prepare array with list of tabs.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.