27require
"../../main.inc.php";
28require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
29require_once DOL_DOCUMENT_ROOT.
'/projet/class/task.class.php';
30require_once DOL_DOCUMENT_ROOT.
'/core/lib/project.lib.php';
31require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
33require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
34require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
35require_once DOL_DOCUMENT_ROOT.
'/holiday/class/holiday.class.php';
38$langs->loadLangs(array(
'projects',
'users',
'companies'));
40$action =
GETPOST(
'action',
'aZ09');
41$mode =
GETPOST(
"mode",
'alpha');
43$taskid =
GETPOST(
'taskid',
'int');
45$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'perweekcard';
52$projectid = GETPOSTISSET(
"id") ?
GETPOST(
"id",
"int", 1) :
GETPOST(
"projectid",
"int");
54$hookmanager->initHooks(array(
'timesheetpermonthcard'));
67$week =
GETPOST(
"week",
"int") ?
GETPOST(
"week",
"int") : date(
"W");
72$search_usertoprocessid =
GETPOST(
'search_usertoprocessid',
'int');
73$search_task_ref =
GETPOST(
'search_task_ref',
'alpha');
74$search_task_label =
GETPOST(
'search_task_label',
'alpha');
75$search_project_ref =
GETPOST(
'search_project_ref',
'alpha');
76$search_thirdparty =
GETPOST(
'search_thirdparty',
'alpha');
77$search_declared_progress =
GETPOST(
'search_declared_progress',
'alpha');
79$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
80$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
84$prev = $startdayarray;
85$prev_year = $prev[
'year'];
86$prev_month = $prev[
'month'];
90$next_year = $next[
'year'];
91$next_month = $next[
'month'];
94$firstdaytoshow =
dol_mktime(0, 0, 0, $month, 1, $year);
96$TFirstDays[reset($TWeek)] =
'01';
98$TLastDays[end($TWeek)] = date(
"t", strtotime($year.
'-'.$month.
'-'.$day));
99if (empty($search_usertoprocessid) || $search_usertoprocessid == $user->id) {
100 $usertoprocess = $user;
101 $search_usertoprocessid = $usertoprocess->id;
102} elseif ($search_usertoprocessid > 0) {
103 $usertoprocess =
new User($db);
104 $usertoprocess->fetch($search_usertoprocessid);
105 $search_usertoprocessid = $usertoprocess->id;
107 $usertoprocess =
new User($db);
110$object =
new Task($db);
116$extrafields->fetch_name_optionals_label($object->table_element);
119$arrayfields = array();
128$arrayfields[
't.planned_workload'] = array(
'label'=>
'PlannedWorkload',
'checked'=>1,
'enabled'=>1,
'position'=>5);
129$arrayfields[
't.progress'] = array(
'label'=>
'ProgressDeclared',
'checked'=>1,
'enabled'=>1,
'position'=>10);
130$arrayfields[
'timeconsumed'] = array(
'label'=>
'TimeConsumed',
'checked'=>1,
'enabled'=>1,
'position'=>15);
138if (!empty($extrafields->attributes[
'projet_task'][
'label']) && is_array($extrafields->attributes[
'projet_task'][
'label']) && count($extrafields->attributes[
'projet_task'][
'label']) > 0) {
139 foreach ($extrafields->attributes[
'projet_task'][
'label'] as $key => $val) {
140 if (!empty($extrafields->attributes[
'projet_task'][
'list'][$key])) {
141 $arrayfields[
"efpt.".$key] = array(
'label'=>$extrafields->attributes[
'projet_task'][
'label'][$key],
'checked'=>(($extrafields->attributes[
'projet_task'][
'list'][$key] < 0) ? 0 : 1),
'position'=>$extrafields->attributes[
'projet_task'][
'pos'][$key],
'enabled'=>(abs((int) $extrafields->attributes[
'projet_task'][
'list'][$key]) != 3 && $extrafields->attributes[
'projet_task'][
'perms'][$key]));
147$search_array_options = array();
148$search_array_options_project = $extrafields->getOptionalsFromPost(
'projet',
'',
'search_');
149$search_array_options_task = $extrafields->getOptionalsFromPost(
'projet_task',
'',
'search_task_');
157$parameters = array(
'id' => $id,
'taskid' => $taskid,
'projectid' => $projectid,
'TWeek' => $TWeek,
'TFirstDays' => $TFirstDays,
'TLastDays' => $TLastDays);
158$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
164if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
167 $search_usertoprocessid = $user->id;
168 $search_task_ref =
'';
169 $search_task_label =
'';
170 $search_project_ref =
'';
171 $search_thirdparty =
'';
172 $search_declared_progress =
'';
174 $search_array_options_project = array();
175 $search_array_options_task = array();
178 $usertoprocess = $user;
180if (
GETPOST(
"button_search_x",
'alpha') ||
GETPOST(
"button_search.x",
'alpha') ||
GETPOST(
"button_search",
'alpha')) {
184if (
GETPOST(
'submitdateselect')) {
192include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
194if ($action ==
'addtime' && $user->hasRight(
'projet',
'lire') &&
GETPOST(
'assigntask') &&
GETPOST(
'formfilteraction') !=
'listafterchangingselectedfields') {
195 $action =
'assigntask';
198 $result = $object->fetch($taskid, $ref);
203 setEventMessages($langs->transnoentitiesnoconv(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Task")),
null,
'errors');
207 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') {
260 if (empty($timetoadd)) {
263 foreach ($timetoadd as $tmptaskid => $tmpvalue) {
264 $updateoftaskdone = 0;
265 foreach ($tmpvalue as $key => $val) {
266 $amountoadd = $timetoadd[$tmptaskid][$key];
267 if (!empty($amountoadd)) {
268 $tmpduration = explode(
':', $amountoadd);
270 if (!empty($tmpduration[0])) {
271 $newduration += ($tmpduration[0] * 3600);
273 if (!empty($tmpduration[1])) {
274 $newduration += ($tmpduration[1] * 60);
276 if (!empty($tmpduration[2])) {
277 $newduration += ($tmpduration[2]);
280 if ($newduration > 0) {
281 $object->fetch($tmptaskid);
283 if (GETPOSTISSET($tmptaskid.
'progress')) {
284 $object->progress =
GETPOST($tmptaskid.
'progress',
'int');
286 unset($object->progress);
289 $object->timespent_duration = $newduration;
290 $object->timespent_fk_user = $usertoprocess->id;
292 $object->timespent_datehour = $object->timespent_date;
293 $object->timespent_note = $object->description;
295 $result = $object->addTimeSpent($user);
307 if (!$updateoftaskdone) {
308 $object->fetch($tmptaskid);
311 if ($object->progress !=
GETPOST($tmptaskid.
'progress',
'int')) {
312 $object->progress =
GETPOST($tmptaskid.
'progress',
'int');
313 $result = $object->update($user);
327 $param .= ($mode ?
'&mode='.urlencode($mode) :
'');
328 $param .= ($projectid ?
'id='.urlencode($projectid) :
'');
329 $param .= ($search_usertoprocessid ?
'&search_usertoprocessid='.urlencode($search_usertoprocessid) :
'');
330 $param .= ($day ?
'&day='.urlencode($day) :
'').($month ?
'&month='.urlencode($month) :
'').($year ?
'&year='.urlencode($year) :
'');
331 $param .= ($search_project_ref ?
'&search_project_ref='.urlencode($search_project_ref) :
'');
332 $param .= ($search_usertoprocessid > 0 ?
'&search_usertoprocessid='.urlencode($search_usertoprocessid) :
'');
333 $param .= ($search_thirdparty ?
'&search_thirdparty='.urlencode($search_thirdparty) :
'');
334 $param .= ($search_declared_progress ?
'&search_declared_progress='.urlencode($search_declared_progress) :
'');
335 $param .= ($search_task_ref ?
'&search_task_ref='.urlencode($search_task_ref) :
'');
336 $param .= ($search_task_label ?
'&search_task_label='.urlencode($search_task_label) :
'');
343 $search_array_options = $search_array_options_task;
344 $search_options_pattern =
'search_task_options_';
345 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
348 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?'.$param);
360$form =
new Form($db);
364$projectstatic =
new Project($db);
366$taskstatic =
new Task($db);
367$thirdpartystatic =
new Societe($db);
370$title = $langs->trans(
"TimeSpent");
372$projectsListId = $projectstatic->getProjectsAuthorizedForUser($usertoprocess, (empty($usertoprocess->id) ? 2 : 0), 1);
375 $project->fetch($id);
376 $project->fetch_thirdparty();
379$onlyopenedproject = 1;
380$morewherefilter =
'';
382if ($search_project_ref) {
383 $morewherefilter .=
natural_search(array(
"p.ref",
"p.title"), $search_project_ref);
385if ($search_task_ref) {
388if ($search_task_label) {
389 $morewherefilter .=
natural_search(array(
"t.ref",
"t.label"), $search_task_label);
391if ($search_thirdparty) {
394if ($search_declared_progress) {
395 $morewherefilter .=
natural_search(
"t.progress", $search_declared_progress, 1);
398$sql = &$morewherefilter;
406$search_array_options = $search_array_options_task;
407$extrafieldsobjectprefix =
'efpt.';
408$search_options_pattern =
'search_task_options_';
409$extrafieldsobjectkey =
'projet_task';
410include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
412$tasksarray = $taskstatic->getTasksArray(0, 0, ($project->id ? $project->id : 0), $socid, 0, $search_project_ref, $onlyopenedproject, $morewherefilter, ($search_usertoprocessid ? $search_usertoprocessid : 0), 0, $extrafields);
413if ($morewherefilter) {
414 $tasksarraywithoutfilter = $taskstatic->getTasksArray(0, 0, ($project->id ? $project->id : 0), $socid, 0,
'', $onlyopenedproject,
'', ($search_usertoprocessid ? $search_usertoprocessid : 0));
416$projectsrole = $taskstatic->getUserRolesForProjectsOrTasks($usertoprocess,
null, ($project->id ? $project->id : 0), 0, $onlyopenedproject);
417$tasksrole = $taskstatic->getUserRolesForProjectsOrTasks(
null, $usertoprocess, ($project->id ? $project->id : 0), 0, $onlyopenedproject);
423llxHeader(
"", $title,
"",
'',
'',
'', array(
'/core/js/timesheet.js'));
428$param .= ($mode ?
'&mode='.urlencode($mode) :
'');
429$param .= ($search_project_ref ?
'&search_project_ref='.urlencode($search_project_ref) :
'');
430$param .= ($search_usertoprocessid > 0 ?
'&search_usertoprocessid='.urlencode($search_usertoprocessid) :
'');
431$param .= ($search_thirdparty ?
'&search_thirdparty='.urlencode($search_thirdparty) :
'');
432$param .= ($search_task_ref ?
'&search_task_ref='.urlencode($search_task_ref) :
'');
433$param .= ($search_task_label ?
'&search_task_label='.urlencode($search_task_label) :
'');
435$search_array_options = $search_array_options_project;
436$search_options_pattern =
'search_options_';
437include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
439$search_array_options = $search_array_options_task;
440$search_options_pattern =
'search_task_options_';
441include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
444$nav =
'<a class="inline-block valignmiddle" href="?year='.$prev_year.
"&month=".$prev_month.
"&day=".$prev_day.$param.
'">'.
img_previous($langs->trans(
"Previous")).
"</a>\n";
445$nav .=
' <span id="month_name">'.dol_print_date(
dol_mktime(0, 0, 0, $month, 1, $year),
"%Y").
", ".$langs->trans(date(
'F', mktime(0, 0, 0, $month, 10))).
" </span>\n";
446$nav .=
'<a class="inline-block valignmiddle" href="?year='.$next_year.
"&month=".$next_month.
"&day=".$next_day.$param.
'">'.
img_next($langs->trans(
"Next")).
"</a>\n";
447$nav .=
' '.$form->selectDate(-1,
'', 0, 0, 2,
"addtime", 1, 1).
' ';
448$nav .=
' <button type="submit" name="submitdateselect" value="x" class="bordertransp nobordertransp button_search_x"><span class="fa fa-search"></span></button>';
452print
'<form name="addtime" method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
453print
'<input type="hidden" name="token" value="'.newToken().
'">';
454print
'<input type="hidden" name="action" value="addtime">';
455print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
456print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
457print
'<input type="hidden" name="mode" value="'.$mode.
'">';
458print
'<input type="hidden" name="day" value="'.$day.
'">';
459print
'<input type="hidden" name="month" value="'.$month.
'">';
460print
'<input type="hidden" name="year" value="'.$year.
'">';
463print
dol_get_fiche_head($head,
'inputpermonth', $langs->trans(
'TimeSpent'), -1, $picto);
466print
'<div class="hideonsmartphone opacitymedium">';
467if ($mine || ($usertoprocess->id == $user->id)) {
468 print $langs->trans(
"MyTasksDesc").
'.'.($onlyopenedproject ?
' '.$langs->trans(
"OnlyOpenedProject") :
'').
'<br>';
470 if (empty($usertoprocess->id) || $usertoprocess->id < 0) {
471 if ($user->hasRight(
'projet',
'all',
'lire') && !$socid) {
472 print $langs->trans(
"ProjectsDesc").
'.'.($onlyopenedproject ?
' '.$langs->trans(
"OnlyOpenedProject") :
'').
'<br>';
474 print $langs->trans(
"ProjectsPublicTaskDesc").
'.'.($onlyopenedproject ?
' '.$langs->trans(
"OnlyOpenedProject") :
'').
'<br>';
478if ($mine || ($usertoprocess->id == $user->id)) {
479 print $langs->trans(
"OnlyYourTaskAreVisible").
'<br>';
481 print $langs->trans(
"AllTaskVisibleButEditIfYouAreAssigned").
'<br>';
487print
'<div class="'.($conf->dol_optimize_smallscreen ?
'center centpercent' :
'floatright right').
'">'.$nav.
'</div>';
489print
'<div class="colorbacktimesheet valignmiddle'.($conf->dol_optimize_smallscreen ?
' center' :
' float').
'">';
490$titleassigntask = $langs->transnoentities(
"AssignTaskToMe");
491if ($usertoprocess->id != $user->id) {
492 $titleassigntask = $langs->transnoentities(
"AssignTaskToUser", $usertoprocess->getFullName($langs));
494print
'<div class="taskiddiv inline-block">';
495print
img_picto(
'',
'projecttask',
'class="pictofixedwidth"');
496$formproject->selectTasks($socid ? $socid : -1, $taskid,
'taskid', 32, 0,
'-- '.$langs->trans(
"ChooseANotYetAssignedTask").
' --', 1, 0, 0,
'widthcentpercentminusx');
499print $formcompany->selectTypeContact($object,
'',
'type',
'internal',
'position', 0,
'maxwidth150onsmartphone');
500print
'<input type="submit" class="button valignmiddle smallonsmartphone small" name="assigntask" value="'.dol_escape_htmltag($titleassigntask).
'">';
503print
'<div class="clearboth" style="padding-bottom: 20px;"></div>';
519$moreforfilter .=
'<div class="divsearchfield">';
520$moreforfilter .=
'<div class="inline-block hideonsmartphone"></div>';
521$includeonly =
'hierarchyme';
522if (!$user->hasRight(
'user',
'user',
'lire')) {
523 $includeonly = array($user->id);
525$moreforfilter .=
img_picto($langs->trans(
'Filter').
' '.$langs->trans(
'User'),
'user',
'class="paddingright pictofixedwidth"').$form->select_dolusers($search_usertoprocessid ? $search_usertoprocessid : $usertoprocess->id,
'search_usertoprocessid', $user->hasRight(
'user',
'user',
'lire') ? 0 : 0, null, 0, $includeonly, null, 0, 0, 0,
'', 0,
'',
'maxwidth200');
526$moreforfilter .=
'</div>';
529 $moreforfilter .=
'<div class="divsearchfield">';
530 $moreforfilter .=
'<div class="inline-block"></div>';
531 $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).
'">';
532 $moreforfilter .=
'</div>';
534 $moreforfilter .=
'<div class="divsearchfield">';
535 $moreforfilter .=
'<div class="inline-block"></div>';
536 $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).
'">';
537 $moreforfilter .=
'</div>';
540if (!empty($moreforfilter)) {
541 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
542 print $moreforfilter;
543 $parameters = array();
544 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters);
545 print $hookmanager->resPrint;
549print
'<div class="div-table-responsive">';
551print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'" id="tablelines3">'.
"\n";
553print
'<tr class="liste_titre_filter">';
555 print
'<td class="liste_titre"><input type="text" size="4" name="search_project_ref" value="'.dol_escape_htmltag($search_project_ref).
'"></td>';
558 print
'<td class="liste_titre"><input type="text" size="4" name="search_thirdparty" value="'.dol_escape_htmltag($search_thirdparty).
'"></td>';
560print
'<td class="liste_titre"><input type="text" size="4" name="search_task_label" value="'.dol_escape_htmltag($search_task_label).
'"></td>';
561print
'<td class="liste_titre"></td>';
562print
'<td class="liste_titre right"><input type="text" size="4" name="search_declared_progress" value="'.dol_escape_htmltag($search_declared_progress).
'"></td>';
563print
'<td class="liste_titre"></td>';
564print
'<td class="liste_titre"></td>';
565foreach ($TWeek as $week_number) {
566 print
'<td class="liste_titre"></td>';
569print
'<td class="liste_titre nowrap" align="right">';
570$searchpicto = $form->showFilterAndCheckAddButtons(0);
575print
'<tr class="liste_titre">';
577 print
'<td>'.$langs->trans(
"Project").
'</td>';
580 print
'<td>'.$langs->trans(
"ThirdParty").
'</td>';
582print
'<td>'.$langs->trans(
"Task").
'</td>';
583print
'<td align="right" class="leftborder plannedworkload maxwidth75">'.$langs->trans(
"PlannedWorkload").
'</td>';
584print
'<td align="right" class="maxwidth75">'.$langs->trans(
"ProgressDeclared").
'</td>';
588print
'<td class="right maxwidth100">'.$langs->trans(
"TimeSpentSmall").
'<br>';
589print
'<span class="nowraponall">';
590print
'<span class="opacitymedium nopadding userimg"><img alt="Photo" class="photouserphoto userphoto" src="'.DOL_URL_ROOT.
'/theme/common/everybody.png"></span>';
591print
'<span class="opacitymedium paddingleft">'.$langs->trans(
"EverybodySmall").
'</span>';
594print
'<td align="right" class="maxwidth75">'.$langs->trans(
"TimeSpentSmall").($usertoprocess->firstname ?
'<br><span class="nowraponall">'.$usertoprocess->getNomUrl(-2).
'<span class="opacitymedium paddingleft">'.
dol_trunc($usertoprocess->firstname, 10).
'</span></span>' :
'').
'</td>';
596foreach ($TWeek as $week_number) {
597 print
'<td width="6%" class="center bold hide">'.$langs->trans(
"Week").
' '.$week_number.
'<br>('.$TFirstDays[$week_number].
'...'.$TLastDays[$week_number].
')</td>';
606$isavailable = array();
610$restrictviewformytask = ((!isset($conf->global->PROJECT_TIME_SHOW_TASK_NOT_ASSIGNED)) ? 2 : $conf->global->PROJECT_TIME_SHOW_TASK_NOT_ASSIGNED);
611if (count($tasksarray) > 0) {
618 $totalforvisibletasks =
projectLinesPerMonth($j, $firstdaytoshow, $usertoprocess, 0, $tasksarray, $level, $projectsrole, $tasksrole, $mine, $restrictviewformytask, $isavailable, 0, $TWeek);
624 $listofdistinctprojectid = array();
625 if (!empty($tasksarraywithoutfilter) && is_array($tasksarraywithoutfilter) && count($tasksarraywithoutfilter)) {
626 foreach ($tasksarraywithoutfilter as $tmptask) {
627 $listofdistinctprojectid[$tmptask->fk_project] = $tmptask->fk_project;
631 $totalforeachweek = array();
632 foreach ($listofdistinctprojectid as $tmpprojectid) {
633 $projectstatic->id = $tmpprojectid;
634 $projectstatic->loadTimeSpentMonth($firstdaytoshow, 0, $usertoprocess->id);
635 foreach ($TWeek as $weekNb) {
636 $totalforeachweek[$weekNb] += $projectstatic->monthWorkLoad[$weekNb];
645 if (count($totalforeachweek)) {
646 foreach ($TWeek as $weekNb) {
647 $timeonothertasks = ($totalforeachweek[$weekNb] - $totalforvisibletasks[$weekNb]);
648 if ($timeonothertasks) {
657 print
'<tr class="oddeven othertaskwithtime">';
658 print
'<td colspan="'.$colspan.
'" class="opacitymedium">';
659 print $langs->trans(
"OtherFilteredTasks");
661 foreach ($TWeek as $weekNb) {
662 print
'<td class="center hide">';
664 $timeonothertasks = ($totalforeachweek[$weekNb] - $totalforvisibletasks[$weekNb]);
665 if ($timeonothertasks) {
666 print
'<span class="timesheetalreadyrecorded" title="texttoreplace"><input type="text" class="center smallpadd width40" disabled="" id="timespent[-1]['.$weekNb.
']" name="task[-1]['.$weekNb.
']" value="';
672 print
' <td class="liste_total"></td>';
676 if ($conf->use_javascript_ajax) {
677 print
'<tr class="liste_total">';
678 print
'<td class="liste_total" colspan="'.$colspan.
'">';
679 print $langs->trans(
"Total");
680 print
'<span class="opacitymediumbycolor"> - '.$langs->trans(
"ExpectedWorkedHours").
': <strong>'.
price($usertoprocess->weeklyhours, 1, $langs, 0, 0).
'</strong></span>';
683 foreach ($TWeek as $weekNb) {
684 print
'<td class="liste_total hide'.$weekNb.
'" align="center"><div class="totalDay'.$weekNb.
'">'.
convertSecondToTime($totalforvisibletasks[$weekNb],
'allhourmin').
'</div></td>';
686 print
'<td class="liste_total center"><div class="totalDayAll"> </div></td>
690 print
'<tr><td colspan="15"><span class="opacitymedium">'.$langs->trans(
"NoAssignedTasks").
'</span></td></tr>';
695print
'<input type="hidden" id="numberOfLines" name="numberOfLines" value="'.count($tasksarray).
'"/>'.
"\n";
696print
'<input type="hidden" id="numberOfFirstLine" name="numberOfFirstLine" value="'.(reset($TWeek)).
'"/>'.
"\n";
698print $form->buttonsSaveCancel(
"Save",
'');
700print
'</form>'.
"\n\n";
704if ($conf->use_javascript_ajax) {
705 print
"\n<!-- JS CODE TO ENABLE Tooltips on all object with class classfortooltip -->\n";
706 print
'<script type="text/javascript">'.
"\n";
707 print
"jQuery(document).ready(function () {\n";
708 print
' jQuery(".timesheetalreadyrecorded").tooltip({
709 show: { collision: "flipfit", effect:\'toggle\', delay:50 },
710 hide: { effect:\'toggle\', delay: 50 },
711 tooltipClass: "mytooltip",
712 content: function () {
713 return \''.dol_escape_js($langs->trans(
"TimeAlreadyRecorded", $usertoprocess->getFullName($langs))).
'\';
717 foreach ($TWeek as $week_number) {
718 print " updateTotal(".((int) $week_number).", '".dol_escape_js($modeinput)."');";
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.
Class to manage projects.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage Dolibarr users.
dol_get_prev_month($month, $year)
Return previous month.
getLastDayOfEachWeek($TWeek, $year)
Return array of last day of weeks.
getWeekNumbersOfMonth($month, $year)
Return array of week numbers.
getFirstDayOfEachWeek($TWeek, $year)
Return array of first day of weeks.
dol_get_next_month($month, $year)
Return next month.
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.
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_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_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.
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...
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
dol_now($mode='auto')
Return date for now.
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_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...
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.
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_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...
projectLinesPerMonth(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask, &$isavailable, $oldprojectforbreak=0, $TWeek=array())
Output a task line into a perday intput 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.