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(
'timesheetpermonthcard'));
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');
86$prev = $startdayarray;
87$prev_year = $prev[
'year'];
88$prev_month = $prev[
'month'];
92$next_year = $next[
'year'];
93$next_month = $next[
'month'];
96$firstdaytoshow =
dol_mktime(0, 0, 0, $month, 1, $year);
98$TFirstDays[reset($TWeek)] =
'01';
100$TLastDays[end($TWeek)] = date(
"t", strtotime($year.
'-'.$month.
'-'.$day));
101if (empty($search_usertoprocessid) || $search_usertoprocessid == $user->id) {
102 $usertoprocess = $user;
103 $search_usertoprocessid = $usertoprocess->id;
104} elseif ($search_usertoprocessid > 0) {
105 $usertoprocess =
new User($db);
106 $usertoprocess->fetch($search_usertoprocessid);
107 $search_usertoprocessid = $usertoprocess->id;
109 $usertoprocess =
new User($db);
118$extrafields->fetch_name_optionals_label(
$object->table_element);
121$arrayfields = array();
130$arrayfields[
't.planned_workload'] = array(
'label' =>
'PlannedWorkload',
'checked' => 1,
'enabled' => 1,
'position' => 5);
131$arrayfields[
't.progress'] = array(
'label' =>
'ProgressDeclared',
'checked' => 1,
'enabled' => 1,
'position' => 10);
132$arrayfields[
'timeconsumed'] = array(
'label' =>
'TimeConsumed',
'checked' => 1,
'enabled' => 1,
'position' => 15);
140if (!empty($extrafields->attributes[
'projet_task'][
'label']) && is_array($extrafields->attributes[
'projet_task'][
'label']) && count($extrafields->attributes[
'projet_task'][
'label']) > 0) {
141 foreach ($extrafields->attributes[
'projet_task'][
'label'] as $key => $val) {
142 if (!empty($extrafields->attributes[
'projet_task'][
'list'][$key])) {
143 $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]));
149$search_array_options = array();
150$search_array_options_project = $extrafields->getOptionalsFromPost(
'projet',
'',
'search_');
151$search_array_options_task = $extrafields->getOptionalsFromPost(
'projet_task',
'',
'search_task_');
160$parameters = array(
'id' => $id,
'taskid' => $taskid,
'projectid' => $projectid,
'TWeek' => $TWeek,
'TFirstDays' => $TFirstDays,
'TLastDays' => $TLastDays);
161$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
167if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
170 $search_usertoprocessid = $user->id;
171 $search_task_ref =
'';
172 $search_task_label =
'';
173 $search_project_ref =
'';
174 $search_thirdparty =
'';
175 $search_declared_progress =
'';
177 $search_array_options_project = array();
178 $search_array_options_task = array();
181 $usertoprocess = $user;
183if (
GETPOST(
"button_search_x",
'alpha') ||
GETPOST(
"button_search.x",
'alpha') ||
GETPOST(
"button_search",
'alpha')) {
187if (
GETPOST(
'submitdateselect')) {
195include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
197if ($action ==
'addtime' && $user->hasRight(
'projet',
'lire') &&
GETPOST(
'assigntask') &&
GETPOST(
'formfilteraction') !=
'listafterchangingselectedfields') {
198 $action =
'assigntask';
201 $result =
$object->fetch($taskid, $ref);
206 setEventMessages($langs->transnoentitiesnoconv(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Task")),
null,
'errors');
210 setEventMessages($langs->transnoentitiesnoconv(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Type")),
null,
'errors');
215 $idfortaskuser = $usertoprocess->id;
216 $result =
$object->add_contact($idfortaskuser,
GETPOST(
"type"),
'internal');
218 if ($result >= 0 || $result == -2) {
220 $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';
221 $sql .=
' AND ec.fk_socpeople = '.((int) $idfortaskuser).
" AND ec.element_id = ".((int)
$object->fk_project).
" AND tc.element = 'project' AND source = 'internal'";
222 $resql = $db->query($sql);
224 $obj = $db->fetch_object($resql);
227 $project->fetch(
$object->fk_project);
229 $listofprojcontact = $project->liste_type_contact(
'internal');
231 if (count($listofprojcontact)) {
232 $tmparray = array_keys($listofprojcontact);
233 $typeforprojectcontact = reset($tmparray);
234 $result = $project->add_contact($idfortaskuser, $typeforprojectcontact,
'internal');
245 if (
$object->error ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
246 $langs->load(
"errors");
247 setEventMessages($langs->trans(
"ErrorTaskAlreadyAssigned"),
null,
'warnings');
261if ($action ==
'addtime' && $user->hasRight(
'projet',
'lire') &&
GETPOST(
'formfilteraction') !=
'listafterchangingselectedfields') {
263 if (empty($timetoadd)) {
266 foreach ($timetoadd as $tmptaskid => $tmpvalue) {
267 $updateoftaskdone = 0;
268 foreach ($tmpvalue as $key => $val) {
269 $amountoadd = $timetoadd[$tmptaskid][$key];
270 if (!empty($amountoadd)) {
271 $tmpduration = explode(
':', $amountoadd);
273 if (!empty($tmpduration[0])) {
274 $newduration += ($tmpduration[0] * 3600);
276 if (!empty($tmpduration[1])) {
277 $newduration += ($tmpduration[1] * 60);
279 if (!empty($tmpduration[2])) {
280 $newduration += ($tmpduration[2]);
283 if ($newduration > 0) {
286 if (GETPOSTISSET($tmptaskid.
'progress')) {
292 $object->timespent_duration = $newduration;
293 $object->timespent_fk_user = $usertoprocess->id;
298 $result =
$object->addTimeSpent($user);
310 if (!$updateoftaskdone) {
316 $result =
$object->update($user);
330 $param .= ($mode ?
'&mode='.urlencode($mode) :
'');
331 $param .= ($projectid ?
'id='.urlencode((
string) ($projectid)) :
'');
332 $param .= ($search_usertoprocessid ?
'&search_usertoprocessid='.urlencode($search_usertoprocessid) :
'');
333 $param .= ($day ?
'&day='.urlencode((
string) ($day)) :
'').($month ?
'&month='.urlencode((
string) ($month)) :
'').($year ?
'&year='.urlencode((
string) ($year)) :
'');
334 $param .= ($search_project_ref ?
'&search_project_ref='.urlencode($search_project_ref) :
'');
335 $param .= ($search_usertoprocessid > 0 ?
'&search_usertoprocessid='.urlencode($search_usertoprocessid) :
'');
336 $param .= ($search_thirdparty ?
'&search_thirdparty='.urlencode($search_thirdparty) :
'');
337 $param .= ($search_declared_progress ?
'&search_declared_progress='.urlencode($search_declared_progress) :
'');
338 $param .= ($search_task_ref ?
'&search_task_ref='.urlencode($search_task_ref) :
'');
339 $param .= ($search_task_label ?
'&search_task_label='.urlencode($search_task_label) :
'');
346 $search_array_options = $search_array_options_task;
347 $search_options_pattern =
'search_task_options_';
348 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
351 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?'.$param);
363$form =
new Form($db);
367$projectstatic =
new Project($db);
369$taskstatic =
new Task($db);
370$thirdpartystatic =
new Societe($db);
373$title = $langs->trans(
"TimeSpent");
375$projectsListId = $projectstatic->getProjectsAuthorizedForUser($usertoprocess, (empty($usertoprocess->id) ? 2 : 0), 1);
378 $project->fetch($id);
379 $project->fetch_thirdparty();
382$onlyopenedproject = 1;
383$morewherefilter =
'';
385if ($search_project_ref) {
386 $morewherefilter .=
natural_search(array(
"p.ref",
"p.title"), $search_project_ref);
388if ($search_task_ref) {
391if ($search_task_label) {
392 $morewherefilter .=
natural_search(array(
"t.ref",
"t.label"), $search_task_label);
394if ($search_thirdparty) {
397if ($search_declared_progress) {
398 $morewherefilter .=
natural_search(
"t.progress", $search_declared_progress, 1);
401$sql = &$morewherefilter;
409$search_array_options = $search_array_options_task;
410$extrafieldsobjectprefix =
'efpt.';
411$search_options_pattern =
'search_task_options_';
412$extrafieldsobjectkey =
'projet_task';
413include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
415$tasksarray = $taskstatic->getTasksArray(0, 0, ($project->id ? $project->id : 0), $socid, 0, $search_project_ref, $onlyopenedproject, $morewherefilter, ($search_usertoprocessid ? $search_usertoprocessid : 0), 0, $extrafields);
416if ($morewherefilter) {
417 $tasksarraywithoutfilter = $taskstatic->getTasksArray(0, 0, ($project->id ? $project->id : 0), $socid, 0,
'', $onlyopenedproject,
'', ($search_usertoprocessid ? $search_usertoprocessid : 0));
419$projectsrole = $taskstatic->getUserRolesForProjectsOrTasks($usertoprocess,
null, ($project->id ? $project->id : 0), 0, $onlyopenedproject);
420$tasksrole = $taskstatic->getUserRolesForProjectsOrTasks(
null, $usertoprocess, ($project->id ? $project->id : 0), 0, $onlyopenedproject);
426llxHeader(
"", $title,
"",
'',
'',
'', array(
'/core/js/timesheet.js'));
431$param .= ($mode ?
'&mode='.urlencode($mode) :
'');
432$param .= ($search_project_ref ?
'&search_project_ref='.urlencode($search_project_ref) :
'');
433$param .= ($search_usertoprocessid > 0 ?
'&search_usertoprocessid='.urlencode($search_usertoprocessid) :
'');
434$param .= ($search_thirdparty ?
'&search_thirdparty='.urlencode($search_thirdparty) :
'');
435$param .= ($search_task_ref ?
'&search_task_ref='.urlencode($search_task_ref) :
'');
436$param .= ($search_task_label ?
'&search_task_label='.urlencode($search_task_label) :
'');
438$search_array_options = $search_array_options_project;
439$search_options_pattern =
'search_options_';
440include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
442$search_array_options = $search_array_options_task;
443$search_options_pattern =
'search_task_options_';
444include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
447$nav =
'<a class="inline-block valignmiddle" href="?year='.$prev_year.
"&month=".$prev_month.
"&day=".$prev_day.$param.
'">'.
img_previous($langs->trans(
"Previous")).
"</a>\n";
448$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";
449$nav .=
'<a class="inline-block valignmiddle" href="?year='.$next_year.
"&month=".$next_month.
"&day=".$next_day.$param.
'">'.
img_next($langs->trans(
"Next")).
"</a>\n";
450$nav .=
' '.$form->selectDate(-1,
'', 0, 0, 2,
"addtime", 1, ($conf->dol_optimize_smallscreen ? 0 : 1)).
' ';
451$nav .=
' <button type="submit" name="submitdateselect" value="x" class="bordertransp nobordertransp button_search_x"><span class="fa fa-search"></span></button>';
455print
'<form name="addtime" method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
456print
'<input type="hidden" name="token" value="'.newToken().
'">';
457print
'<input type="hidden" name="action" value="addtime">';
458print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
459print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
460print
'<input type="hidden" name="mode" value="'.$mode.
'">';
461print
'<input type="hidden" name="day" value="'.$day.
'">';
462print
'<input type="hidden" name="month" value="'.$month.
'">';
463print
'<input type="hidden" name="year" value="'.$year.
'">';
466print
dol_get_fiche_head($head,
'inputpermonth', $langs->trans(
'TimeSpent'), -1, $picto);
469print
'<div class="hideonsmartphone opacitymedium">';
470if ($mine || ($usertoprocess->id == $user->id)) {
471 print $langs->trans(
"MyTasksDesc").
'.'.($onlyopenedproject ?
' '.$langs->trans(
"OnlyOpenedProject") :
'').
'<br>';
473 if (empty($usertoprocess->id) || $usertoprocess->id < 0) {
474 if ($user->hasRight(
'projet',
'all',
'lire') && !$socid) {
475 print $langs->trans(
"ProjectsDesc").
'.'.($onlyopenedproject ?
' '.$langs->trans(
"OnlyOpenedProject") :
'').
'<br>';
477 print $langs->trans(
"ProjectsPublicTaskDesc").
'.'.($onlyopenedproject ?
' '.$langs->trans(
"OnlyOpenedProject") :
'').
'<br>';
481if ($mine || ($usertoprocess->id == $user->id)) {
482 print $langs->trans(
"OnlyYourTaskAreVisible").
'<br>';
484 print $langs->trans(
"AllTaskVisibleButEditIfYouAreAssigned").
'<br>';
490print
'<div class="'.($conf->dol_optimize_smallscreen ?
'center centpercent' :
'floatright right').
'">'.$nav.
'</div>';
492print
'<div class="colorbacktimesheet valignmiddle'.($conf->dol_optimize_smallscreen ?
' center' :
' float').
'">';
493$titleassigntask = $langs->transnoentities(
"AssignTaskToMe");
494if ($usertoprocess->id != $user->id) {
495 $titleassigntask = $langs->transnoentities(
"AssignTaskToUser", $usertoprocess->getFullName($langs));
497print
'<div class="taskiddiv inline-block">';
498print
img_picto(
'',
'projecttask',
'class="pictofixedwidth"');
499$formproject->selectTasks($socid ? $socid : -1, $taskid,
'taskid', 32, 0,
'-- '.$langs->trans(
"ChooseANotYetAssignedTask").
' --', 1, 0, 0,
'widthcentpercentminusx',
'',
'all', $usertoprocess);
502print $formcompany->selectTypeContact($object,
'',
'type',
'internal',
'position', 0,
'maxwidth150onsmartphone');
503print
'<input type="submit" class="button valignmiddle smallonsmartphone small" name="assigntask" value="'.dol_escape_htmltag($titleassigntask).
'">';
506print
'<div class="clearboth" style="padding-bottom: 20px;"></div>';
522$includeonly =
'hierarchyme';
523if (!$user->hasRight(
'user',
'user',
'lire')) {
524 $includeonly = array($user->id);
526$selecteduser = $search_usertoprocessid ? $search_usertoprocessid : $usertoprocess->id;
527$moreforfiltertmp = $form->select_dolusers($selecteduser,
'search_usertoprocessid', 0,
null, 0, $includeonly,
null, 0, 0, 0,
'', 0,
'',
'maxwidth200');
528if ($form->num > 1 || empty($conf->dol_optimize_smallscreen)) {
529 $moreforfilter .=
'<div class="divsearchfield">';
530 $moreforfilter .=
'<div class="inline-block hideonsmartphone"></div>';
531 $moreforfilter .=
img_picto($langs->trans(
'Filter').
' '.$langs->trans(
'User'),
'user',
'class="paddingright pictofixedwidth"');
532 $moreforfilter .= $moreforfiltertmp;
533 $moreforfilter .=
'</div>';
535 $moreforfilter .=
'<input type="hidden" name="search_usertoprocessid" value="'.$selecteduser.
'">';
539 $moreforfilter .=
'<div class="divsearchfield">';
540 $moreforfilter .=
'<div class="inline-block"></div>';
541 $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).
'">';
542 $moreforfilter .=
'</div>';
544 $moreforfilter .=
'<div class="divsearchfield">';
545 $moreforfilter .=
'<div class="inline-block"></div>';
546 $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).
'">';
547 $moreforfilter .=
'</div>';
550if (!empty($moreforfilter)) {
551 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
552 print $moreforfilter;
553 $parameters = array();
554 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters);
555 print $hookmanager->resPrint;
559$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
561$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
565if (!empty($arrayfields[
't.planned_workload'][
'checked'])) {
568if (!empty($arrayfields[
't.progress'][
'checked'])) {
571foreach ($arrayfields as $key => $val) {
572 if ($val[
'checked'] && substr($key, 0, 5) ==
'efpt.') {
577print
'<div class="div-table-responsive">';
579print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'" id="tablelines3">'.
"\n";
581print
'<tr class="liste_titre_filter">';
583 print
'<td class="liste_titre"><input type="text" size="4" name="search_project_ref" value="'.dol_escape_htmltag($search_project_ref).
'"></td>';
586 print
'<td class="liste_titre"><input type="text" size="4" name="search_thirdparty" value="'.dol_escape_htmltag($search_thirdparty).
'"></td>';
588print
'<td class="liste_titre"><input type="text" size="4" name="search_task_label" value="'.dol_escape_htmltag($search_task_label).
'"></td>';
589if (!empty($arrayfields[
't.planned_workload'][
'checked'])) {
590 print
'<td class="liste_titre"></td>';
592if (!empty($arrayfields[
't.progress'][
'checked'])) {
593 print
'<td class="liste_titre right"><input type="text" size="4" name="search_declared_progress" value="'.dol_escape_htmltag($search_declared_progress).
'"></td>';
595if (!empty($arrayfields[
'timeconsumed'][
'checked'])) {
596 print
'<td class="liste_titre"></td>';
597 print
'<td class="liste_titre"></td>';
599foreach ($TWeek as $week_number) {
600 print
'<td class="liste_titre"></td>';
603print
'<td class="liste_titre nowrap right">';
604$searchpicto = $form->showFilterAndCheckAddButtons(0);
609print
'<tr class="liste_titre">';
611 print
'<td>'.$langs->trans(
"Project").
'</td>';
614 print
'<td>'.$langs->trans(
"ThirdParty").
'</td>';
616print
'<td>'.$langs->trans(
"Task").
'</td>';
617if (!empty($arrayfields[
't.planned_workload'][
'checked'])) {
618 print
'<td align="right" class="leftborder plannedworkload maxwidth75">'.$form->textwithpicto($langs->trans(
"PlannedWorkloadShort"), $langs->trans(
"PlannedWorkload")).
'</td>';
620if (!empty($arrayfields[
't.progress'][
'checked'])) {
621 print
'<td class="right maxwidth75">'.$langs->trans(
"ProgressDeclared").
'</td>';
623if (!empty($arrayfields[
'timeconsumed'][
'checked'])) {
624 print
'<td class="right maxwidth100">'.$langs->trans(
"TimeSpentSmall").
'<br>';
625 print
'<span class="nowraponall">';
626 print
'<span class="opacitymedium nopadding userimg"><img alt="Photo" class="photouserphoto userphoto" src="'.DOL_URL_ROOT.
'/theme/common/everybody.png"></span>';
627 print
'<span class="opacitymedium paddingleft">'.$langs->trans(
"EverybodySmall").
'</span>';
630 print
'<td class="right 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>';
632foreach ($TWeek as $week_number) {
633 print
'<td width="6%" class="center bold hide">'.$langs->trans(
"WeekShort").
' '.$week_number.
'<br>('.$TFirstDays[$week_number].
'...'.$TLastDays[$week_number].
')</td>';
637print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
645$isavailable = array();
649$restrictviewformytask =
getDolGlobalInt(
'PROJECT_TIME_SHOW_TASK_NOT_ASSIGNED', 2);
650if (count($tasksarray) > 0) {
657 $totalforvisibletasks =
projectLinesPerMonth($j, $firstdaytoshow, $usertoprocess, 0, $tasksarray, $level, $projectsrole, $tasksrole, $mine, $restrictviewformytask, $isavailable, 0, $TWeek, $arrayfields);
663 $listofdistinctprojectid = array();
664 if (!empty($tasksarraywithoutfilter) && is_array($tasksarraywithoutfilter) && count($tasksarraywithoutfilter)) {
665 foreach ($tasksarraywithoutfilter as $tmptask) {
666 $listofdistinctprojectid[$tmptask->fk_project] = $tmptask->fk_project;
670 $totalforeachweek = array();
671 foreach ($listofdistinctprojectid as $tmpprojectid) {
672 $projectstatic->id = $tmpprojectid;
673 $projectstatic->loadTimeSpentMonth($firstdaytoshow, 0, $usertoprocess->id);
674 foreach ($TWeek as $weekNb) {
675 $totalforeachweek[$weekNb] += $projectstatic->monthWorkLoad[$weekNb];
684 if (count($totalforeachweek)) {
685 foreach ($TWeek as $weekNb) {
686 $timeonothertasks = ($totalforeachweek[$weekNb] - $totalforvisibletasks[$weekNb]);
687 if ($timeonothertasks) {
696 print
'<tr class="oddeven othertaskwithtime">';
697 print
'<td colspan="'.$colspan.
'" class="opacitymedium">';
698 print $langs->trans(
"OtherFilteredTasks");
700 if (!empty($arrayfields[
't.planned_workload'][
'checked'])) {
701 print
'<td class="liste_total"></td>';
703 if (!empty($arrayfields[
't.progress'][
'checked'])) {
704 print
'<td class="liste_total"></td>';
706 if (!empty($arrayfields[
'timeconsumed'][
'checked'])) {
707 print
'<td class="liste_total"></td>';
708 print
'<td class="liste_total"></td>';
711 foreach ($TWeek as $weekNb) {
713 print
'<td class="center hide'.($j <= 1 ?
' borderleft' :
'').
'">';
715 $timeonothertasks = ($totalforeachweek[$weekNb] - $totalforvisibletasks[$weekNb]);
716 if ($timeonothertasks) {
717 print
'<span class="timesheetalreadyrecorded" title="texttoreplace"><input type="text" class="center smallpadd width40" disabled="" id="timespent[-1]['.$weekNb.
']" name="task[-1]['.$weekNb.
']" value="';
723 print
' <td class="liste_total"></td>';
727 if ($conf->use_javascript_ajax) {
728 print
'<tr class="liste_total">';
729 print
'<td class="liste_total" colspan="'.($colspan + $addcolspan).
'">';
730 print $langs->trans(
"Total");
731 print
'<span class="opacitymediumbycolor"> - '.$langs->trans(
"ExpectedWorkedHours").
': <strong>'.
price($usertoprocess->weeklyhours, 1, $langs, 0, 0).
'</strong></span>';
733 if (!empty($arrayfields[
'timeconsumed'][
'checked'])) {
734 print
'<td class="liste_total"></td>';
735 print
'<td class="liste_total"></td>';
739 foreach ($TWeek as $weekNb) {
741 print
'<td class="liste_total hide'.$weekNb.
' center'.($j <= 1 ?
' borderleft' :
'').
'"><div class="totalDay'.$weekNb.
'">'.
convertSecondToTime($totalforvisibletasks[$weekNb],
'allhourmin').
'</div></td>';
743 print
'<td class="liste_total center"><div class="totalDayAll"> </div></td>
747 print
'<tr><td colspan="15"><span class="opacitymedium">'.$langs->trans(
"NoAssignedTasks").
'</span></td></tr>';
752print
'<input type="hidden" id="numberOfLines" name="numberOfLines" value="'.count($tasksarray).
'"/>'.
"\n";
753print
'<input type="hidden" id="numberOfFirstLine" name="numberOfFirstLine" value="'.(reset($TWeek)).
'"/>'.
"\n";
755print $form->buttonsSaveCancel(
"Save",
'');
757print
'</form>'.
"\n\n";
761if ($conf->use_javascript_ajax) {
762 print
"\n<!-- JS CODE TO ENABLE Tooltips on all object with class classfortooltip -->\n";
763 print
'<script type="text/javascript">'.
"\n";
764 print
"jQuery(document).ready(function () {\n";
765 print
' jQuery(".timesheetalreadyrecorded").tooltip({
766 show: { collision: "flipfit", effect:\'toggle\', delay:50 },
767 hide: { effect:\'toggle\', delay: 50 },
768 tooltipClass: "mytooltip",
769 content: function () {
770 return \''.dol_escape_js($langs->trans(
"TimeAlreadyRecorded", $usertoprocess->getFullName($langs))).
'\';
774 foreach ($TWeek as $week_number) {
775 print " updateTotal(".((int) $week_number).", '".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.
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 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...
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.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
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_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...
project_timesheet_prepare_head($mode, $fuser=null)
Prepare array with list of tabs.
projectLinesPerMonth(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask, &$isavailable, $oldprojectforbreak=0, $TWeek=array(), $arrayfields=array(), $extrafields=null)
Output a task line into a perday input mode.
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.