28 require
"../../main.inc.php";
29 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
30 require_once DOL_DOCUMENT_ROOT.
'/projet/class/task.class.php';
31 require_once DOL_DOCUMENT_ROOT.
'/core/lib/project.lib.php';
32 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
33 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
34 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
35 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
36 require_once DOL_DOCUMENT_ROOT.
'/holiday/class/holiday.class.php';
39 $langs->loadLangs(array(
'projects',
'users',
'companies'));
41 $action =
GETPOST(
'action',
'aZ09');
42 $mode =
GETPOST(
"mode",
'alpha');
44 $taskid =
GETPOST(
'taskid',
'int');
46 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'perdaycard';
49 if ($mode ==
'mine') $mine = 1;
51 $projectid = isset($_GET[
"id"]) ?
GETPOST(
"id",
"int", 1) :
GETPOST(
"projectid",
"int");
53 $hookmanager->initHooks(array(
'timesheetperdaycard'));
63 $nowday = $nowtmp[
'mday'];
64 $nowmonth = $nowtmp[
'mon'];
65 $nowyear = $nowtmp[
'year'];
70 $week =
GETPOST(
"week",
"int") ?
GETPOST(
"week",
"int") : date(
"W");
74 $search_categ =
GETPOST(
"search_categ",
'alpha');
75 $search_usertoprocessid =
GETPOST(
'search_usertoprocessid',
'int');
76 $search_task_ref =
GETPOST(
'search_task_ref',
'alpha');
77 $search_task_label =
GETPOST(
'search_task_label',
'alpha');
78 $search_project_ref =
GETPOST(
'search_project_ref',
'alpha');
79 $search_thirdparty =
GETPOST(
'search_thirdparty',
'alpha');
80 $search_declared_progress =
GETPOST(
'search_declared_progress',
'alpha');
82 $monthofday =
GETPOST(
'addtimemonth');
83 $dayofday =
GETPOST(
'addtimeday');
84 $yearofday =
GETPOST(
'addtimeyear');
87 if ($yearofday && $monthofday && $dayofday) $daytoparse =
dol_mktime(0, 0, 0, $monthofday, $dayofday, $yearofday);
88 elseif ($year && $month && $day) $daytoparse =
dol_mktime(0, 0, 0, $month, $day, $year);
91 if (empty($search_usertoprocessid) || $search_usertoprocessid == $user->
id)
93 $usertoprocess = $user;
94 $search_usertoprocessid = $usertoprocess->id;
95 } elseif ($search_usertoprocessid > 0)
97 $usertoprocess =
new User($db);
98 $usertoprocess->fetch($search_usertoprocessid);
99 $search_usertoprocessid = $usertoprocess->id;
101 $usertoprocess =
new User($db);
104 $object =
new Task($db);
111 $extrafields->fetch_name_optionals_label($object->table_element);
114 $arrayfields = array();
115 $arrayfields[
't.planned_workload'] = array(
'label'=>
'PlannedWorkload',
'checked'=>1,
'enabled'=>1,
'position'=>0);
116 $arrayfields[
't.progress'] = array(
'label'=>
'ProgressDeclared',
'checked'=>1,
'enabled'=>1,
'position'=>0);
127 if (is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label']) > 0)
129 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val)
131 if (!empty($extrafields->attributes[$object->table_element][
'list'][$key]))
132 $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]));
138 $search_array_options_project = $extrafields->getOptionalsFromPost($project->table_element,
'',
'search_');
139 $search_array_options_task = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_task_');
146 $parameters = array(
'id' => $id,
'taskid' => $taskid,
'projectid' => $projectid);
147 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
148 if ($reshook < 0)
setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
150 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha'))
154 $search_usertoprocessid = $user->id;
155 $search_task_ref =
'';
156 $search_task_label =
'';
157 $search_project_ref =
'';
158 $search_thirdparty =
'';
159 $search_declared_progress =
'';
161 $search_array_options_project = array();
162 $search_array_options_task = array();
165 $usertoprocess = $user;
167 if (
GETPOST(
"button_search_x",
'alpha') ||
GETPOST(
"button_search.x",
'alpha') ||
GETPOST(
"button_search",
'alpha'))
172 if (
GETPOST(
'submitdateselect'))
182 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
184 if ($action ==
'addtime' && $user->rights->projet->lire &&
GETPOST(
'assigntask') &&
GETPOST(
'formfilteraction') !=
'listafterchangingselectedfields')
186 $action =
'assigntask';
190 $result = $object->fetch($taskid, $ref);
191 if ($result < 0) $error++;
193 setEventMessages($langs->transnoentitiesnoconv(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Task")),
'',
'errors');
198 setEventMessages($langs->transnoentitiesnoconv(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Type")),
'',
'errors');
203 $idfortaskuser = $usertoprocess->id;
204 $result = $object->add_contact($idfortaskuser,
GETPOST(
"type"),
'internal');
206 if ($result >= 0 || $result == -2)
209 $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';
210 $sql .=
' AND ec.fk_socpeople = '.$idfortaskuser.
" AND ec.element_id = '.$object->fk_project.' AND tc.element = 'project' AND source = 'internal'";
211 $resql = $db->query($sql);
214 $obj = $db->fetch_object(
$resql);
218 $project->fetch($object->fk_project);
220 $listofprojcontact = $project->liste_type_contact(
'internal');
222 if (count($listofprojcontact))
224 $typeforprojectcontact = reset(array_keys($listofprojcontact));
225 $result = $project->add_contact($idfortaskuser, $typeforprojectcontact,
'internal');
237 if ($object->error ==
'DB_ERROR_RECORD_ALREADY_EXISTS')
239 $langs->load(
"errors");
240 setEventMessages($langs->trans(
"ErrorTaskAlreadyAssigned"), null,
'warnings');
255 if ($action ==
'addtime' && $user->rights->projet->lire &&
GETPOST(
'formfilteraction') !=
'listafterchangingselectedfields')
257 $timespent_duration = array();
259 if (is_array($_POST))
261 foreach ($_POST as $key => $time)
263 if (intval($time) > 0)
267 if (preg_match(
"/([0-9]+)duration(hour|min)/", $key, $matches))
273 if ($matches[2] ==
'hour') $timespent_duration[$id] += $time * 60 * 60;
276 if ($matches[2] ==
'min') $timespent_duration[$id] += $time * 60;
283 if (count($timespent_duration) > 0)
285 foreach ($timespent_duration as $key => $val)
287 $object->fetch($key);
288 $taskid = $object->id;
290 if (
GETPOSTISSET($taskid.
'progress')) $object->progress =
GETPOST($taskid.
'progress',
'int');
291 else unset($object->progress);
293 $object->timespent_duration = $val;
294 $object->timespent_fk_user = $usertoprocess->id;
295 $object->timespent_note =
GETPOST($key.
'note');
296 if (
GETPOST($key.
"hour",
'int') !=
'' &&
GETPOST($key.
"hour",
'int') >= 0)
298 $object->timespent_datehour =
dol_mktime(
GETPOST($key.
"hour",
'int'),
GETPOST($key.
"min",
'int'), 0, $monthofday, $dayofday, $yearofday);
299 $object->timespent_withhour = 1;
301 $object->timespent_datehour =
dol_mktime(12, 0, 0, $monthofday, $dayofday, $yearofday);
303 $object->timespent_date = $object->timespent_datehour;
305 if ($object->timespent_date > 0)
307 $result = $object->addTimeSpent($user);
327 header(
'Location: '.
$_SERVER[
"PHP_SELF"].
'?'.($projectid ?
'id='.$projectid :
'').($search_usertoprocessid ?
'&search_usertoprocessid='.$search_usertoprocessid :
'').($mode ?
'&mode='.$mode :
'').
'&year='.$yearofday.
'&month='.$monthofday.
'&day='.$dayofday);
341 $form =
new Form($db);
345 $projectstatic =
new Project($db);
347 $taskstatic =
new Task($db);
348 $thirdpartystatic =
new Societe($db);
352 $prev_year = $prev[
'year'];
353 $prev_month = $prev[
'mon'];
354 $prev_day = $prev[
'mday'];
357 $next_year = $next[
'year'];
358 $next_month = $next[
'mon'];
359 $next_day = $next[
'mday'];
361 $title = $langs->trans(
"TimeSpent");
363 $projectsListId = $projectstatic->getProjectsAuthorizedForUser($usertoprocess, (empty($usertoprocess->id) ? 2 : 0), 1);
367 $project->fetch($id);
368 $project->fetch_thirdparty();
371 $onlyopenedproject = 1;
372 $morewherefilter =
'';
374 if ($search_project_ref) $morewherefilter .=
natural_search(array(
"p.ref",
"p.title"), $search_project_ref);
375 if ($search_task_ref) $morewherefilter .=
natural_search(
"t.ref", $search_task_ref);
376 if ($search_task_label) $morewherefilter .=
natural_search(array(
"t.ref",
"t.label"), $search_task_label);
377 if ($search_thirdparty) $morewherefilter .=
natural_search(
"s.nom", $search_thirdparty);
378 if ($search_declared_progress) $morewherefilter .=
natural_search(
"t.progress", $search_declared_progress, 1);
380 $sql = &$morewherefilter;
388 $search_array_options = $search_array_options_task;
389 $extrafieldsobjectprefix =
'efpt.';
390 $search_options_pattern =
'search_task_options_';
391 $extrafieldsobjectkey =
'projet_task';
392 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
394 $tasksarray = $taskstatic->getTasksArray(0, 0, ($project->id ? $project->id : 0), $socid, 0, $search_project_ref, $onlyopenedproject, $morewherefilter, ($search_usertoprocessid ? $search_usertoprocessid : 0), 0, $extrafields);
395 if ($morewherefilter)
397 $tasksarraywithoutfilter = $taskstatic->getTasksArray(0, 0, ($project->id ? $project->id : 0), $socid, 0,
'', $onlyopenedproject,
'', ($search_usertoprocessid ? $search_usertoprocessid : 0));
399 $projectsrole = $taskstatic->getUserRolesForProjectsOrTasks($usertoprocess, 0, ($project->id ? $project->id : 0), 0, $onlyopenedproject);
400 $tasksrole = $taskstatic->getUserRolesForProjectsOrTasks(0, $usertoprocess, ($project->id ? $project->id : 0), 0, $onlyopenedproject);
405 llxHeader(
"", $title,
"",
'',
'',
'', array(
'/core/js/timesheet.js'));
410 $param .= ($mode ?
'&mode='.urlencode($mode) :
'');
411 $param .= ($search_project_ref ?
'&search_project_ref='.urlencode($search_project_ref) :
'');
412 $param .= ($search_usertoprocessid ?
'&search_usertoprocessid='.urlencode($search_usertoprocessid) :
'');
413 $param .= ($search_thirdparty ?
'&search_thirdparty='.urlencode($search_thirdparty) :
'');
414 $param .= ($search_task_ref ?
'&search_task_ref='.urlencode($search_task_ref) :
'');
415 $param .= ($search_task_label ?
'&search_task_label='.urlencode($search_task_label) :
'');
422 $search_array_options = $search_array_options_task;
423 $search_options_pattern =
'search_task_options_';
424 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
427 $nav =
'<a class="inline-block valignmiddle" href="?year='.$prev_year.
"&month=".$prev_month.
"&day=".$prev_day.$param.
'">'.
img_previous($langs->trans(
"Previous")).
"</a>\n";
429 $nav .=
" <span id=\"month_name\">".dol_print_date(
dol_mktime(0, 0, 0, $month, $day, $year),
"day").
" </span>\n";
430 $nav .=
'<a class="inline-block valignmiddle" href="?year='.$next_year.
"&month=".$next_month.
"&day=".$next_day.$param.
'">'.
img_next($langs->trans(
"Next")).
"</a>\n";
432 $nav .=
' '.$form->selectDate(-1,
'', 0, 0, 2,
"addtime", 1, 1).
' ';
434 $nav .=
' <button type="submit" name="button_search_x" value="x" class="bordertransp"><span class="fa fa-search"></span></button>';
438 print '<form name="addtime" method="POST" action="'.$_SERVER[
"PHP_SELF"].($project->id > 0 ?
'?id='.$project->id :
'').
'">';
439 print '<input type="hidden" name="token" value="'.newToken().
'">';
440 print '<input type="hidden" name="action" value="addtime">';
441 print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
442 print '<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
443 print '<input type="hidden" name="mode" value="'.$mode.
'">';
445 print '<input type="hidden" name="addtimeyear" value="'.$tmp[
'year'].
'">';
446 print '<input type="hidden" name="addtimemonth" value="'.$tmp[
'mon'].
'">';
447 print '<input type="hidden" name="addtimeday" value="'.$tmp[
'mday'].
'">';
453 print '<div class="hideonsmartphone opacitymedium">';
454 if ($mine || ($usertoprocess->id == $user->id)) print $langs->trans(
"MyTasksDesc").
'.'.($onlyopenedproject ?
' '.$langs->trans(
"OnlyOpenedProject") :
'').
'<br>';
456 if (empty($usertoprocess->id) || $usertoprocess->id < 0)
458 if ($user->rights->projet->all->lire && !$socid) print $langs->trans(
"ProjectsDesc").
'.'.($onlyopenedproject ?
' '.$langs->trans(
"OnlyOpenedProject") :
'').
'<br>';
459 else print $langs->trans(
"ProjectsPublicTaskDesc").
'.'.($onlyopenedproject ?
' '.$langs->trans(
"OnlyOpenedProject") :
'').
'<br>';
462 if ($mine || ($usertoprocess->id == $user->id))
464 print $langs->trans(
"OnlyYourTaskAreVisible").
'<br>';
466 print $langs->trans(
"AllTaskVisibleButEditIfYouAreAssigned").
'<br>';
473 print
'<div class="floatright right'.($conf->dol_optimize_smallscreen ?
' centpercent' :
'').
'">'.$nav.
'</div>';
475 print
'<div class="colorbacktimesheet float valignmiddle">';
476 $titleassigntask = $langs->transnoentities(
"AssignTaskToMe");
477 if ($usertoprocess->id != $user->id) $titleassigntask = $langs->transnoentities(
"AssignTaskToUser", $usertoprocess->getFullName($langs));
478 print
'<div class="taskiddiv inline-block">';
480 $formproject->selectTasks($socid ? $socid : -1, $taskid,
'taskid', 32, 0,
'-- '.$langs->trans(
"ChooseANotYetAssignedTask").
' --', 1, 0, 0,
'',
'',
'all', $usertoprocess);
483 print $formcompany->selectTypeContact($object,
'',
'type',
'internal',
'rowid', 0,
'maxwidth150onsmartphone');
484 print
'<input type="submit" class="button valignmiddle" name="assigntask" value="'.dol_escape_htmltag($titleassigntask).
'">';
487 print
'<div class="clearboth" style="padding-bottom: 20px;"></div>';
503 $moreforfilter .=
'<div class="divsearchfield">';
504 $moreforfilter .=
'<div class="inline-block hideonsmartphone"></div>';
505 $includeonly =
'hierarchyme';
506 if (empty($user->rights->user->user->lire)) $includeonly = array($user->id);
507 $moreforfilter .=
img_picto($langs->trans(
'User'),
'user').$form->select_dolusers($search_usertoprocessid ? $search_usertoprocessid : $usertoprocess->id,
'search_usertoprocessid', $user->rights->user->user->lire ? 0 : 0, null, 0, $includeonly, null, 0, 0, 0,
'', 0,
'',
'maxwidth200 marginleftonly');
508 $moreforfilter .=
'</div>';
510 if (empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT))
512 $moreforfilter .=
'<div class="divsearchfield">';
513 $moreforfilter .=
'<div class="inline-block"></div>';
514 $moreforfilter .=
img_picto($langs->trans(
'Project'),
'project').
'<input type="text" size="4" name="search_project_ref" class="marginleftonly" value="'.
dol_escape_htmltag($search_project_ref).
'">';
515 $moreforfilter .=
'</div>';
517 $moreforfilter .=
'<div class="divsearchfield">';
518 $moreforfilter .=
'<div class="inline-block"></div>';
519 $moreforfilter .=
img_picto($langs->trans(
'ThirdParty'),
'company').
'<input type="text" size="4" name="search_thirdparty" class="marginleftonly" value="'.
dol_escape_htmltag($search_thirdparty).
'">';
520 $moreforfilter .=
'</div>';
523 if (!empty($moreforfilter))
525 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
526 print $moreforfilter;
527 $parameters = array();
528 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters);
529 print $hookmanager->resPrint;
533 $varpage = empty($contextpage) ?
$_SERVER[
"PHP_SELF"] : $contextpage;
534 $selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
538 if (!empty($arrayfields[
't.planned_workload'][
'checked'])) $addcolspan++;
539 if (!empty($arrayfields[
't.progress'][
'checked'])) $addcolspan++;
540 foreach ($arrayfields as $key => $val)
542 if ($val[
'checked'] && substr($key, 0, 5) ==
'efpt.') $addcolspan++;
545 print
'<div class="div-table-responsive">';
546 print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'" id="tablelines3">'.
"\n";
548 print
'<tr class="liste_titre_filter">';
549 if (!empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)) print
'<td class="liste_titre"><input type="text" size="4" name="search_project_ref" value="'.
dol_escape_htmltag($search_project_ref).
'"></td>';
550 if (!empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)) print
'<td class="liste_titre"><input type="text" size="4" name="search_thirdparty" value="'.
dol_escape_htmltag($search_thirdparty).
'"></td>';
551 print
'<td class="liste_titre"><input type="text" size="4" name="search_task_label" value="'.dol_escape_htmltag($search_task_label).
'"></td>';
553 $search_options_pattern =
'search_task_options_';
554 $extrafieldsobjectkey =
'projet_task';
555 $extrafieldsobjectprefix =
'efpt.';
556 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
557 print
'<td class="liste_titre"></td>';
558 if (!empty($arrayfields[
't.planned_workload'][
'checked']))
560 print
'<td class="liste_titre right"><input type="text" size="4" name="search_declared_progress" value="'.dol_escape_htmltag($search_declared_progress).
'"></td>';
562 if (!empty($arrayfields[
't.progress'][
'checked']))
564 print
'<td class="liste_titre"></td>';
566 print
'<td class="liste_titre"></td>';
567 print
'<td class="liste_titre"></td>';
568 print
'<td class="liste_titre"></td>';
569 print
'<td class="liste_titre"></td>';
571 print
'<td class="liste_titre nowrap right">';
572 $searchpicto = $form->showFilterAndCheckAddButtons(0);
577 print
'<tr class="liste_titre">';
578 if (!empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)) print
'<th>'.$langs->trans(
"Project").
'</th>';
579 if (!empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)) print
'<th>'.$langs->trans(
"ThirdParty").
'</th>';
580 print
'<th>'.$langs->trans(
"Task").
'</th>';
582 $extrafieldsobjectkey =
'projet_task';
583 $extrafieldsobjectprefix =
'efpt.';
584 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
585 if (!empty($arrayfields[
't.planned_workload'][
'checked']))
587 print
'<th class="right leftborder plannedworkload maxwidth100">'.$langs->trans(
"PlannedWorkload").
'</th>';
589 if (!empty($arrayfields[
't.progress'][
'checked']))
591 print
'<th class="right maxwidth100">'.$langs->trans(
"ProgressDeclared").
'</th>';
596 print
'<th class="right maxwidth100">'.$langs->trans(
"TimeSpent").
'<br><span class="opacitymedium">'.$langs->trans(
"Everybody").
'</span></th>';
597 print
'<th class="right maxwidth100">'.$langs->trans(
"TimeSpent").($usertoprocess->firstname ?
'<br><span class="opacitymedium">'.dol_trunc($usertoprocess->firstname, 10).
'</span>' :
'').
'</th>';
598 print
'<th class="center leftborder">'.$langs->trans(
"HourStart").
'</td>';
601 $restrictviewformytask = ((!isset($conf->global->PROJECT_TIME_SHOW_TASK_NOT_ASSIGNED)) ? 2 : $conf->global->PROJECT_TIME_SHOW_TASK_NOT_ASSIGNED);
604 $isavailable = array();
605 if (!empty($conf->global->MAIN_DEFAULT_WORKING_DAYS))
607 $tmparray = explode(
'-', $conf->global->MAIN_DEFAULT_WORKING_DAYS);
608 if (count($tmparray) >= 2)
610 $numstartworkingday = $tmparray[0];
611 $numendworkingday = $tmparray[1];
616 $isavailablefordayanduser = $holiday->verifDateHolidayForTimestamp($usertoprocess->id, $daytoparse, $statusofholidaytocheck);
617 $isavailable[$daytoparse] = $isavailablefordayanduser;
620 if ($test) $isavailable[$daytoparse] = array(
'morning'=>
false,
'afternoon'=>
false,
'morning_reason'=>
'public_holiday',
'afternoon_reason'=>
'public_holiday');
624 $idw = ($tmparray[
'wday'] - (empty($conf->global->MAIN_START_WEEK) ? 0 : 1));
627 if ((($idw + 1) < $numstartworkingday) || (($idw + 1) > $numendworkingday))
629 $cssweekend =
'weekend';
635 if (!$isavailable[$daytoparse][
'morning'] && !$isavailable[$daytoparse][
'afternoon']) $cssonholiday .=
'onholidayallday ';
636 elseif (!$isavailable[$daytoparse][
'morning']) $cssonholiday .=
'onholidaymorning ';
637 elseif (!$isavailable[$daytoparse][
'afternoon']) $cssonholiday .=
'onholidayafternoon ';
639 print
'<th class="center'.($cssonholiday ?
' '.$cssonholiday :
'').($cssweekend ?
' '.$cssweekend :
'').
'">'.$langs->trans(
"Duration").
'</th>';
640 print
'<th class="center">'.$langs->trans(
"Note").
'</th>';
646 $colspan = 4 + (empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT) ? 0 : 2);
648 if ($conf->use_javascript_ajax)
650 print
'<tr class="liste_total">';
651 print
'<td class="liste_total" colspan="'.($colspan - 1 + $addcolspan).
'">';
652 print $langs->trans(
"Total");
654 print
'<td class="liste_total leftborder">';
658 print
'<td class="liste_total center'.($cssonholiday ?
' '.$cssonholiday :
'').($cssweekend ?
' '.$cssweekend :
'').
'"><div class="totalDay0"> </div></td>';
660 print
'<td class="liste_total"></td>';
661 print
'<td class="liste_total"></td>';
666 if (count($tasksarray) > 0)
674 $totalforvisibletasks =
projectLinesPerDay($j, 0, $usertoprocess, $tasksarray, $level, $projectsrole, $tasksrole, $mine, $restrictviewformytask, $daytoparse, $isavailable, 0, $arrayfields, $extrafields);
680 $listofdistinctprojectid = array();
681 if (is_array($tasksarraywithoutfilter) && count($tasksarraywithoutfilter))
683 foreach ($tasksarraywithoutfilter as $tmptask)
685 $listofdistinctprojectid[$tmptask->fk_project] = $tmptask->fk_project;
689 $totalforeachday = array();
690 foreach ($listofdistinctprojectid as $tmpprojectid)
692 $projectstatic->id = $tmpprojectid;
693 $projectstatic->loadTimeSpent($daytoparse, 0, $usertoprocess->id);
694 for ($idw = 0; $idw < 7; $idw++)
697 $totalforeachday[$tmpday] += $projectstatic->weekWorkLoad[$tmpday];
704 if (count($totalforeachday))
706 $timeonothertasks = ($totalforeachday[$daytoparse] - $totalforvisibletasks[$daytoparse]);
707 if ($timeonothertasks)
716 print
'<tr class="oddeven othertaskwithtime">';
717 print
'<td colspan="'.($colspan - 1).
'" class="opacitymedium">';
718 print $langs->trans(
"OtherFilteredTasks");
720 print
'<td class="leftborder"></td>';
721 print
'<td class="center">';
722 $timeonothertasks = ($totalforeachday[$daytoparse] - $totalforvisibletasks[$daytoparse]);
725 print
'<span class="timesheetalreadyrecorded" title="texttoreplace"><input type="text" class="center" size="2" disabled="" id="timespent[-1][0]" name="task[-1][0]" value="';
730 print
' <td class="liste_total"></td>';
731 print
' <td class="liste_total"></td>';
735 if ($conf->use_javascript_ajax)
737 print
'<tr class="liste_total">';
738 print
'<td class="liste_total" colspan="'.($colspan - 1 + $addcolspan).
'">';
739 print $langs->trans(
"Total");
741 print
'<td class="liste_total leftborder">';
745 print
'<td class="liste_total center'.($cssonholiday ?
' '.$cssonholiday :
'').($cssweekend ?
' '.$cssweekend :
'').
'"><div class="totalDay0"> </div></td>';
747 print
'<td class="liste_total"></td>
748 <td class="liste_total"></td>
752 print
'<tr><td colspan="14"><span class="opacitymedium">'.$langs->trans(
"NoAssignedTasks").
'</span></td></tr>';
757 print
'<input type="hidden" id="numberOfLines" name="numberOfLines" value="'.count($tasksarray).
'"/>'.
"\n";
759 print
'<div class="center">';
760 print
'<input type="submit" class="button button-save"'.($disabledtask ?
' disabled' :
'').
' value="'.$langs->trans(
"Save").
'">';
765 $modeinput =
'hours';
767 if ($conf->use_javascript_ajax)
769 print
"\n<!-- JS CODE TO ENABLE Tooltips on all object with class classfortooltip -->\n";
770 print
'<script type="text/javascript">'.
"\n";
771 print
"jQuery(document).ready(function () {\n";
772 print
' jQuery(".timesheetalreadyrecorded").tooltip({
773 show: { collision: "flipfit", effect:\'toggle\', delay:50 },
774 hide: { effect:\'toggle\', delay: 50 },
775 tooltipClass: "mytooltip",
776 content: function () {
777 return \''.dol_escape_js($langs->trans(
"TimeAlreadyRecorded", $usertoprocess->getFullName($langs))).
'\';
781 print ' updateTotal(0,\
''.$modeinput.
'\');
';
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Class of the module paid holiday.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm= 'auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
dol_now($mode= 'auto')
Return date for now.
Class to manage Dolibarr users.
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 intput mode.
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname.
Class to manage third parties objects (customers, suppliers, prospects...)
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
Class to manage projects.
img_picto($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt= '', $morecss= '', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_getdate($timestamp, $fast=false, $forcetimezone= '')
Return an array with locale date info.
restrictedArea($user, $features, $objectid=0, $tableandshare= '', $feature2= '', $dbt_keyfield= 'fk_soc', $dbt_select= 'rowid', $isdraft=0)
Check permissions of a user to show a page and an object.
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...
const STATUS_APPROVED
Approved.
num_public_holiday($timestampStart, $timestampEnd, $country_code= '', $lastday=0, $includesaturday=-1, $includesunday=-1)
Return the number of non working days including saturday and sunday (or not) between 2 dates in times...
print $_SERVER["PHP_SELF"]
Edit parameters.
img_next($titlealt= 'default', $moreatt= '')
Show next logo.
dol_sort_array(&$array, $index, $order= 'asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by second index function, which produces ascending (default) or descending output...
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
print
Draft customers invoices.
dol_print_date($time, $format= '', $tzoutput= 'auto', $outputlangs= '', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
img_previous($titlealt= 'default', $moreatt= '')
Show previous logo.
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_get_fiche_end($notab=0)
Return tab footer of a card.
project_timesheet_prepare_head($mode, $fuser=null)
Prepare array with list of tabs.
dol_time_plus_duree($time, $duration_value, $duration_unit)
Add a delay to a date.
if(!defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN'
Draft customers invoices.
convertSecondToTime($iSecond, $format= 'all', $lengthOfDay=86400, $lengthOfWeek=7)
Return, in clear text, value of a number of seconds in days, hours and minutes.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $keepmoretags= '', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields...