29require
"../../main.inc.php";
38require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
39require_once DOL_DOCUMENT_ROOT.
'/projet/class/task.class.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/lib/project.lib.php';
41require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
42require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
43require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
44require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
45require_once DOL_DOCUMENT_ROOT.
'/holiday/class/holiday.class.php';
48$langs->loadLangs(array(
'projects',
'users',
'companies'));
50$action =
GETPOST(
'action',
'aZ09');
51$mode =
GETPOST(
"mode",
'alpha');
55$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'timespent';
64$hookmanager->initHooks(array(
'timesheetperweekcard'));
82$search_usertoprocessid =
GETPOSTINT(
'search_usertoprocessid');
83$search_task_ref =
GETPOST(
'search_task_ref',
'alpha');
84$search_task_label =
GETPOST(
'search_task_label',
'alpha');
85$search_project_ref =
GETPOST(
'search_project_ref',
'alpha');
86$search_thirdparty =
GETPOST(
'search_thirdparty',
'alpha');
87$search_declared_progress =
GETPOST(
'search_declared_progress',
'alpha');
89$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
90$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
94$prev = $startdayarray;
95$prev_year = $prev[
'prev_year'];
96$prev_month = $prev[
'prev_month'];
97$prev_day = $prev[
'prev_day'];
98$first_day = $prev[
'first_day'];
99$first_month = $prev[
'first_month'];
100$first_year = $prev[
'first_year'];
101$week = $prev[
'week'];
104$next_year = $next[
'year'];
105$next_month = $next[
'month'];
106$next_day = $next[
'day'];
109$firstdaytoshow =
dol_mktime(0, 0, 0, $first_month, $first_day, $first_year);
110$firstdaytoshowgmt =
dol_mktime(0, 0, 0, $first_month, $first_day, $first_year,
'gmt');
112if (empty($search_usertoprocessid) || $search_usertoprocessid == $user->id) {
113 $usertoprocess = $user;
114 $search_usertoprocessid = $usertoprocess->id;
115} elseif ($search_usertoprocessid > 0) {
116 $usertoprocess =
new User(
$db);
117 $usertoprocess->fetch($search_usertoprocessid);
118 $search_usertoprocessid = $usertoprocess->id;
120 $usertoprocess =
new User(
$db);
129$extrafields->fetch_name_optionals_label(
$object->table_element);
132$arrayfields = array();
141$arrayfields[
't.planned_workload'] = array(
'label' =>
'PlannedWorkload',
'checked' =>
'1',
'enabled' =>
'1',
'position' => 5);
142$arrayfields[
't.progress'] = array(
'label' =>
'ProgressDeclared',
'checked' =>
'1',
'enabled' =>
'1',
'position' => 10);
143$arrayfields[
'timeconsumed'] = array(
'label' =>
'TimeConsumed',
'checked' =>
'1',
'enabled' =>
'1',
'position' => 15);
150$extrafieldsobjectkey =
'projet_task';
151$extrafieldsobjectprefix =
'efpt.';
152include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
156$search_array_options = array();
157$search_array_options_project = $extrafields->getOptionalsFromPost(
'projet',
'',
'search_');
158$search_array_options_task = $extrafields->getOptionalsFromPost(
'projet_task',
'',
'search_task_');
167$parameters = array(
'id' => $id,
'taskid' => $taskid,
'projectid' => $projectid);
168$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
173if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
176 $search_usertoprocessid = $user->id;
177 $search_task_ref =
'';
178 $search_task_label =
'';
179 $search_project_ref =
'';
180 $search_thirdparty =
'';
181 $search_declared_progress =
'';
183 $search_array_options_project = array();
184 $search_array_options_task = array();
187 $usertoprocess = $user;
189if (
GETPOST(
"button_search_x",
'alpha') ||
GETPOST(
"button_search.x",
'alpha') ||
GETPOST(
"button_search",
'alpha')) {
193if (
GETPOST(
'submitdateselect')) {
201include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
203if ($action ==
'addtime' && $user->hasRight(
'projet',
'lire') &&
GETPOST(
'assigntask') &&
GETPOST(
'formfilteraction') !=
'listafterchangingselectedfields') {
204 $action =
'assigntask';
207 $result =
$object->fetch($taskid);
212 setEventMessages($langs->transnoentitiesnoconv(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Task")),
null,
'errors');
216 setEventMessages($langs->transnoentitiesnoconv(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Type")),
null,
'errors');
221 $idfortaskuser = $usertoprocess->id;
222 $result =
$object->add_contact($idfortaskuser,
GETPOST(
"type"),
'internal');
224 if ($result >= 0 || $result == -2) {
226 $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';
227 $sql .=
' AND ec.fk_socpeople = '.((int) $idfortaskuser).
" AND ec.element_id = ".((int)
$object->fk_project).
" AND tc.element = 'project' AND source = 'internal'";
228 $resql =
$db->query($sql);
230 $obj =
$db->fetch_object($resql);
233 $project->fetch(
$object->fk_project);
235 $listofprojcontact = $project->liste_type_contact(
'internal');
237 if (count($listofprojcontact)) {
238 $tmparray = array_keys($listofprojcontact);
239 $typeforprojectcontact = reset($tmparray);
240 $result = $project->add_contact($idfortaskuser, $typeforprojectcontact,
'internal');
251 if (
$object->error ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
252 $langs->load(
"errors");
253 setEventMessages($langs->trans(
"ErrorTaskAlreadyAssigned"),
null,
'warnings');
267if ($action ==
'addtime' && $user->hasRight(
'projet',
'lire') &&
GETPOST(
'formfilteraction') !=
'listafterchangingselectedfields') {
269 if (empty($timetoadd)) {
272 foreach ($timetoadd as $tmptaskid => $tmpvalue) {
273 $updateoftaskdone = 0;
274 foreach ($tmpvalue as $key => $val) {
275 $amountoadd = $timetoadd[$tmptaskid][$key];
276 if (!empty($amountoadd)) {
277 $tmpduration = explode(
':', $amountoadd);
279 if (!empty($tmpduration[0])) {
280 $newduration += (int) ((
float) $tmpduration[0] * 3600);
282 if (!empty($tmpduration[1])) {
283 $newduration += (int) ((
float) $tmpduration[1] * 60);
285 if (!empty($tmpduration[2])) {
286 $newduration += ((int) $tmpduration[2]);
289 if ($newduration > 0) {
292 if (GETPOSTISSET($tmptaskid.
'progress')) {
298 $object->timespent_duration = $newduration;
299 $object->timespent_fk_user = $usertoprocess->id;
304 $result =
$object->addTimeSpent($user);
316 if (!$updateoftaskdone && GETPOSTISSET($tmptaskid.
'progress')) {
322 $result =
$object->update($user);
336 $param .= ($mode ?
'&mode='.urlencode($mode) :
'');
337 $param .= ($projectid ?
'id='.urlencode((
string) ($projectid)) :
'');
338 $param .= ($search_usertoprocessid ?
'&search_usertoprocessid='.urlencode((
string) $search_usertoprocessid) :
'');
339 $param .= ($day ?
'&day='.urlencode((
string) ($day)) :
'').($month ?
'&month='.urlencode((
string) ($month)) :
'').($year ?
'&year='.urlencode((
string) ($year)) :
'');
340 $param .= ($search_project_ref ?
'&search_project_ref='.urlencode($search_project_ref) :
'');
341 $param .= ($search_usertoprocessid > 0 ?
'&search_usertoprocessid='.urlencode((
string) $search_usertoprocessid) :
'');
342 $param .= ($search_thirdparty ?
'&search_thirdparty='.urlencode($search_thirdparty) :
'');
343 $param .= ($search_declared_progress ?
'&search_declared_progress='.urlencode($search_declared_progress) :
'');
344 $param .= ($search_task_ref ?
'&search_task_ref='.urlencode($search_task_ref) :
'');
345 $param .= ($search_task_label ?
'&search_task_label='.urlencode($search_task_label) :
'');
352 $search_array_options = $search_array_options_task;
353 $search_options_pattern =
'search_task_options_';
354 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
357 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?'.$param);
378$title = $langs->trans(
"TimeSpent");
380$projectsListId = $projectstatic->getProjectsAuthorizedForUser($usertoprocess, (empty($usertoprocess->id) ? 2 : 0), 1);
383 $project->fetch($id);
384 $project->fetch_thirdparty();
387$onlyopenedproject = 1;
388$morewherefilter =
'';
390if ($search_project_ref) {
391 $morewherefilter .=
natural_search(array(
"p.ref",
"p.title"), $search_project_ref);
393if ($search_task_ref) {
396if ($search_task_label) {
397 $morewherefilter .=
natural_search(array(
"t.ref",
"t.label"), $search_task_label);
399if ($search_thirdparty) {
402if ($search_declared_progress) {
403 $morewherefilter .=
natural_search(
"t.progress", $search_declared_progress, 1);
406$sql = &$morewherefilter;
414$search_array_options = $search_array_options_task;
415$extrafieldsobjectprefix =
'efpt.';
416$search_options_pattern =
'search_task_options_';
417$extrafieldsobjectkey =
'projet_task';
418include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
420$tasksarray = $taskstatic->getTasksArray(
null,
null, ($project->id ? $project->id : 0), $socid, 0, $search_project_ref, (
string) $onlyopenedproject, $morewherefilter, ($search_usertoprocessid ? $search_usertoprocessid : 0), 0, $extrafields, 0, $search_array_options_task, 1);
422$tasksarraywithoutfilter = array();
423if ($morewherefilter) {
424 $tasksarraywithoutfilter = $taskstatic->getTasksArray(
null,
null, ($project->id ? $project->id : 0), $socid, 0,
'', (
string) $onlyopenedproject,
'', ($search_usertoprocessid ? $search_usertoprocessid : 0));
426$projectsrole = $taskstatic->getUserRolesForProjectsOrTasks($usertoprocess,
null, ($project->id ? (
string) $project->id :
'0'), 0, (int) $onlyopenedproject);
427$tasksrole = $taskstatic->getUserRolesForProjectsOrTasks(
null, $usertoprocess, ($project->id ? (
string) $project->id :
'0'), 0, (int) $onlyopenedproject);
433llxHeader(
"", $title,
"",
'', 0, 0, array(
'/core/js/timesheet.js'),
'',
'',
'mod-project project-activity page-activity_perweek');
437$param .= ($mode ?
'&mode='.urlencode($mode) :
'');
438$param .= ($search_project_ref ?
'&search_project_ref='.urlencode($search_project_ref) :
'');
439$param .= ($search_usertoprocessid > 0 ?
'&search_usertoprocessid='.urlencode((
string) $search_usertoprocessid) :
'');
440$param .= ($search_thirdparty ?
'&search_thirdparty='.urlencode($search_thirdparty) :
'');
441$param .= ($search_task_ref ?
'&search_task_ref='.urlencode($search_task_ref) :
'');
442$param .= ($search_task_label ?
'&search_task_label='.urlencode($search_task_label) :
'');
444$search_array_options = $search_array_options_project;
445$search_options_pattern =
'search_options_';
446include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
448$search_array_options = $search_array_options_task;
449$search_options_pattern =
'search_task_options_';
450include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
453$nav =
'<a class="inline-block valignmiddle" href="?year='.$prev_year.
"&month=".$prev_month.
"&day=".$prev_day.$param.
'">'.
img_previous($langs->trans(
"Previous")).
"</a>\n";
454$nav .=
' <span id="month_name">'.dol_print_date(
dol_mktime(0, 0, 0, $first_month, $first_day, $first_year),
"%Y").
", ".$langs->trans(
"WeekShort").
" ".$week.
" </span>\n";
455$nav .=
'<a class="inline-block valignmiddle" href="?year='.$next_year.
"&month=".$next_month.
"&day=".$next_day.$param.
'">'.
img_next($langs->trans(
"Next")).
"</a>\n";
456$nav .=
' '.$form->selectDate(-1,
'', 0, 0, 2,
"addtime", 1, (
$conf->dol_optimize_smallscreen ? 0 : 1)).
' ';
457$nav .=
' <button type="submit" name="submitdateselect" value="x" class="nobordertransp button_search_x"><span class="fa fa-search"></span></button>';
461print
'<form name="addtime" method="POST" action="'.dolBuildUrl($_SERVER[
"PHP_SELF"]).
'">';
462print
'<input type="hidden" name="token" value="'.newToken().
'">';
463print
'<input type="hidden" name="action" value="addtime">';
464print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
465print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
466print
'<input type="hidden" name="mode" value="'.$mode.
'">';
467print
'<input type="hidden" name="day" value="'.$day.
'">';
468print
'<input type="hidden" name="month" value="'.$month.
'">';
469print
'<input type="hidden" name="year" value="'.$year.
'">';
472print
dol_get_fiche_head($head,
'inputperweek', $langs->trans(
'TimeSpent'), -1, $picto);
476if ($mine || ($usertoprocess->id == $user->id)) {
477 $s .= $langs->trans(
"MyTasksDesc").
'.'.($onlyopenedproject ?
' '.$langs->trans(
"OnlyOpenedProject") :
'').
'<br>';
479 if (empty($usertoprocess->id) || $usertoprocess->id < 0) {
480 if ($user->hasRight(
'projet',
'all',
'lire') && !$socid) {
481 $s .= $langs->trans(
"ProjectsDesc").
'.'.($onlyopenedproject ?
' '.$langs->trans(
"OnlyOpenedProject") :
'').
'<br>';
483 $s .= $langs->trans(
"ProjectsPublicTaskDesc").
'.'.($onlyopenedproject ?
' '.$langs->trans(
"OnlyOpenedProject") :
'').
'<br>';
487if ($mine || ($usertoprocess->id == $user->id)) {
488 $s .= $langs->trans(
"OnlyYourTaskAreVisible");
490 $s .= $langs->trans(
"AllTaskVisibleButEditIfYouAreAssigned");
492print
info_admin($s, 0, 0,
'info',
'nomargintop nomarginbottom hideonsmartphone');
496print
'<div class="'.($conf->dol_optimize_smallscreen ?
'center centpercent' :
'floatright right').
'">'.$nav.
'</div>';
498print
'<div class="colorbacktimesheet valignmiddle'.($conf->dol_optimize_smallscreen ?
' center' :
' float').
'">';
499$titleassigntask = $langs->transnoentities(
"AssignTaskToMe");
500if ($usertoprocess->id != $user->id) {
501 $titleassigntask = $langs->transnoentities(
"AssignTaskToUser", $usertoprocess->getFullName($langs));
503print
'<div class="taskiddiv inline-block">';
504print
img_picto(
'',
'projecttask',
'class="pictofixedwidth"');
505$formproject->selectTasks($socid ? $socid : -1, $taskid,
'taskid', 32, 0,
'-- '.$langs->trans(
"ChooseANotYetAssignedTask").
' --', 1, 0, 0,
'widthcentpercentminusx maxwidth500',
'',
'all', $usertoprocess);
508print $formcompany->selectTypeContact($object,
'',
'type',
'internal',
'position', 0,
'maxwidth150onsmartphone');
509print
'<input type="submit" class="button valignmiddle smallonsmartphone small" name="assigntask" value="'.dol_escape_htmltag($titleassigntask).
'">';
512print
'<div class="clearboth" style="padding-bottom: 20px;"></div>';
515$startday =
dol_mktime(12, 0, 0, $startdayarray[
'first_month'], $startdayarray[
'first_day'], $startdayarray[
'first_year']);
517$numendworkingday = 0;
518$numstartworkingday = 0;
520$isavailable = array();
523$numstartworkingday = 1;
524$numendworkingday = 5;
528 if (count($tmparray) >= 2) {
529 $numstartworkingday = $tmparray[0];
530 $numendworkingday = $tmparray[1];
534for ($idw = 0; $idw < 7; $idw++) {
540 $isavailablefordayanduser = $holiday->verifDateHolidayForTimestamp($usertoprocess->id, $dayinloopfromfirstdaytoshow, (
string) $statusofholidaytocheck);
541 $isavailable[$dayinloopfromfirstdaytoshow] = $isavailablefordayanduser;
543 $test =
num_public_holiday($dayinloopfromfirstdaytoshowgmt, $dayinloopfromfirstdaytoshowgmt + 86400,
$mysoc->country_code);
545 $isavailable[$dayinloopfromfirstdaytoshow] = array(
'morning' =>
false,
'afternoon' =>
false,
'morning_reason' =>
'public_holiday',
'afternoon_reason' =>
'public_holiday');
564$includeonly =
'hierarchyme';
565if (!$user->hasRight(
'user',
'user',
'lire')) {
566 $includeonly = array($user->id);
568$selecteduser = $search_usertoprocessid ? $search_usertoprocessid : $usertoprocess->id;
569$moreforfiltertmp = $form->select_dolusers($selecteduser,
'search_usertoprocessid', 0,
null, 0, $includeonly,
'',
'0', 0, 0,
'', 0,
'',
'maxwidth200');
570if ($form->num > 1 || empty(
$conf->dol_optimize_smallscreen)) {
571 $moreforfilter .=
'<div class="divsearchfield">';
572 $moreforfilter .=
'<div class="inline-block hideonsmartphone"></div>';
573 $moreforfilter .=
img_picto($langs->trans(
'Filter').
' '.$langs->trans(
'User'),
'user',
'class="paddingright pictofixedwidth"');
574 $moreforfilter .= $moreforfiltertmp;
575 $moreforfilter .=
'</div>';
577 $moreforfilter .=
'<input type="hidden" name="search_usertoprocessid" value="'.$selecteduser.
'">';
581 $moreforfilter .=
'<div class="divsearchfield">';
582 $moreforfilter .=
'<div class="inline-block"></div>';
583 $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).
'" spellcheck="false">';
584 $moreforfilter .=
'</div>';
586 $moreforfilter .=
'<div class="divsearchfield">';
587 $moreforfilter .=
'<div class="inline-block"></div>';
588 $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).
'" spellcheck="false">';
589 $moreforfilter .=
'</div>';
592if (!empty($moreforfilter)) {
593 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
594 print $moreforfilter;
595 $parameters = array();
596 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
597 print $hookmanager->resPrint;
602$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
604$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
608if (!empty($arrayfields[
't.planned_workload'][
'checked'])) {
611if (!empty($arrayfields[
't.progress'][
'checked'])) {
614foreach ($arrayfields as $key => $val) {
615 if ($val[
'checked'] && substr($key, 0, 5) ==
'efpt.') {
620print
'<div class="div-table-responsive">';
621print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'" id="tablelines3">'.
"\n";
623print
'<tr class="liste_titre_filter">';
625 print
'<td class="liste_titre"><input type="text" class="width75" name="search_project_ref" value="'.dol_escape_htmltag($search_project_ref).
'"></td>';
628 print
'<td class="liste_titre"><input type="text" class="width75" name="search_thirdparty" value="'.dol_escape_htmltag($search_thirdparty).
'"></td>';
630print
'<td class="liste_titre"><input type="text" class="width75" name="search_task_label" value="'.dol_escape_htmltag($search_task_label).
'"></td>';
632$search_options_pattern =
'search_task_options_';
633$extrafieldsobjectkey =
'projet_task';
634$extrafieldsobjectprefix =
'efpt.';
635include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
636if (!empty($arrayfields[
't.planned_workload'][
'checked'])) {
637 print
'<td class="liste_titre"></td>';
639if (!empty($arrayfields[
't.progress'][
'checked'])) {
640 print
'<td class="liste_titre right"><input type="text" class="width50" name="search_declared_progress" value="'.dol_escape_htmltag($search_declared_progress).
'"></td>';
642if (!empty($arrayfields[
'timeconsumed'][
'checked'])) {
643 print
'<td class="liste_titre"></td>';
644 print
'<td class="liste_titre"></td>';
646for ($idw = 0; $idw < 7; $idw++) {
647 print
'<td class="liste_titre"></td>';
650print
'<td class="liste_titre nowrap right">';
651$searchpicto = $form->showFilterAndCheckAddButtons(0);
656print
'<tr class="liste_titre">';
658 print
'<th>'.$langs->trans(
"Project").
'</th>';
661 print
'<th>'.$langs->trans(
"ThirdParty").
'</th>';
663print
'<th>'.$langs->trans(
"Task").
'</th>';
665$extrafieldsobjectkey =
'projet_task';
666$extrafieldsobjectprefix =
'efpt.';
667include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
668if (!empty($arrayfields[
't.planned_workload'][
'checked'])) {
669 print
'<th class="leftborder plannedworkload minwidth75 maxwidth100 right" title="'.dol_escape_htmltag($langs->trans(
"PlannedWorkload")).
'">'.$form->textwithpicto($langs->trans(
"PlannedWorkloadShort"), $langs->trans(
"PlannedWorkload")).
'</th>';
671if (!empty($arrayfields[
't.progress'][
'checked'])) {
672 print
'<th class="right minwidth75 maxwidth100" title="'.dol_escape_htmltag($langs->trans(
"ProgressDeclared")).
'">'.$langs->trans(
"ProgressDeclared").
'</th>';
674if (!empty($arrayfields[
'timeconsumed'][
'checked'])) {
675 print
'<th class="right maxwidth100">'.$langs->trans(
"TimeSpentSmall").
'<br>';
676 print
'<span class="nowraponall">';
677 print
'<span class="opacitymedium nopadding userimg"><img alt="Photo" class="photouserphoto userphotosmall" src="'.DOL_URL_ROOT.
'/theme/common/everybody.png"></span>';
678 print
'<span class="opacitymedium paddingleft">'.$langs->trans(
"EverybodySmall").
'</span>';
681 print
'<th class="right maxwidth75">'.$langs->trans(
"TimeSpentSmall").($usertoprocess->firstname ?
'<br><span class="nowraponall">'.$usertoprocess->getNomUrl(-3).
'<span class="opacitymedium paddingleft">'.
dol_trunc($usertoprocess->firstname, 10).
'</span></span>' :
'').
'</th>';
683for ($idw = 0; $idw < 7; $idw++) {
687 if ((($idw + 1) < $numstartworkingday) || (($idw + 1) > $numendworkingday)) {
688 $cssweekend =
'weekend';
694 if (!$isavailable[$tmpday][
'morning'] && !$isavailable[$tmpday][
'afternoon']) {
695 $cssonholiday .=
'onholidayallday ';
696 } elseif (!$isavailable[$tmpday][
'morning']) {
697 $cssonholiday .=
'onholidaymorning ';
698 } elseif (!$isavailable[$tmpday][
'afternoon']) {
699 $cssonholiday .=
'onholidayafternoon ';
703 $month = (int)
dol_print_date($dayinloopfromfirstdaytoshow,
'%m');
706 print
'<th width="6%" class="center bold hide'.$idw.($cssonholiday ?
' '.$cssonholiday :
'').($cssweekend ?
' '.$cssweekend :
'').
'">';
707 print
'<a href="'.DOL_URL_ROOT.
'/projet/activity/perday.php?year='.$year.
'&month='.$month.
'&day='.$day.
'">';
709 print
'<br>'.dol_print_date($dayinloopfromfirstdaytoshow,
'dayreduceformat').
'</a></th>';
713print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
717$colspan = 1 + (!
getDolGlobalString(
'PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT') ? 0 : 2);
720if (
$conf->use_javascript_ajax && count($tasksarray) >=
getDolGlobalInt(
'NBLINES_TO_DUPLICATE_TOTAL_TIMESPENT_ON_TOP', 10)) {
721 print
'<tr class="liste_total hideonsmartphone">';
722 print
'<td class="liste_total" colspan="'.($colspan + $addcolspan).
'">';
723 print $langs->trans(
"Total");
724 $htmltooltip = $langs->trans(
"ExpectedWorkedHours").
': <strong>'.
price($usertoprocess->weeklyhours, 1, $langs, 0, 0);
725 print
'<span class="opacitymediumbycolor"> <div class="totalDayAll inline-block bold"> </div> '.($usertoprocess->weeklyhours ?
' / '.$form->textwithpicto(
price($usertoprocess->weeklyhours, 1, $langs, 0, 0), $htmltooltip) :
'').
'</strong></span>';
727 if (!empty($arrayfields[
'timeconsumed'][
'checked'])) {
728 print
'<td class="liste_total"></td>';
729 print
'<td class="liste_total"></td>';
731 for ($idw = 0; $idw < 7; $idw++) {
733 if ((($idw + 1) < $numstartworkingday) || (($idw + 1) > $numendworkingday)) {
734 $cssweekend =
'weekend';
740 if (!$isavailable[$tmpday][
'morning'] && !$isavailable[$tmpday][
'afternoon']) {
741 $cssonholiday .=
'onholidayallday ';
742 } elseif (!$isavailable[$tmpday][
'morning']) {
743 $cssonholiday .=
'onholidaymorning ';
744 } elseif (!$isavailable[$tmpday][
'afternoon']) {
745 $cssonholiday .=
'onholidayafternoon ';
747 print
'<td class="liste_total center hide'.$idw.($cssonholiday ?
' '.$cssonholiday :
'').($cssweekend ?
' '.$cssweekend :
'').
'"><div class="totalDay'.$idw.
'"> </div></td>';
749 print
'<td class="liste_total center"></td>';
756$restrictviewformytask =
getDolGlobalInt(
'PROJECT_TIME_SHOW_TASK_NOT_ASSIGNED', 2);
758if (count($tasksarray) > 0) {
765 $totalforvisibletasks =
projectLinesPerWeek($j, $firstdaytoshow, $usertoprocess, 0, $tasksarray, $level, $projectsrole, $tasksrole, $mine, $restrictviewformytask, $isavailable, 0, $arrayfields, $extrafields);
771 $listofdistinctprojectid = array();
772 if (!empty($tasksarraywithoutfilter) && is_array($tasksarraywithoutfilter) && count($tasksarraywithoutfilter)) {
773 foreach ($tasksarraywithoutfilter as $tmptask) {
774 $listofdistinctprojectid[$tmptask->fk_project] = $tmptask->fk_project;
778 $totalforeachday = array();
779 foreach ($listofdistinctprojectid as $tmpprojectid) {
780 $projectstatic->id = $tmpprojectid;
781 $projectstatic->loadTimeSpent($firstdaytoshow, 0, $usertoprocess->id);
782 for ($idw = 0; $idw < 7; $idw++) {
784 if (empty($totalforeachday[$tmpday])) {
785 $totalforeachday[$tmpday] = empty($projectstatic->weekWorkLoad[$tmpday]) ? 0 : $projectstatic->weekWorkLoad[$tmpday];
787 $totalforeachday[$tmpday] += empty($projectstatic->weekWorkLoad[$tmpday]) ? 0 : $projectstatic->weekWorkLoad[$tmpday];
797 if (count($totalforeachday)) {
798 for ($idw = 0; $idw < 7; $idw++) {
800 $timeonothertasks = ($totalforeachday[$tmpday] - $totalforvisibletasks[$tmpday]);
801 if ($timeonothertasks) {
810 print
'<tr class="oddeven othertaskwithtime">';
811 print
'<td colspan="'.($colspan + $addcolspan).
'" class="opacitymedium">';
812 print $langs->trans(
"OtherFilteredTasks");
814 if (!empty($arrayfields[
'timeconsumed'][
'checked'])) {
815 print
'<td class="liste_total"></td>';
816 print
'<td class="liste_total"></td>';
819 for ($idw = 0; $idw < 7; $idw++) {
822 if ((($idw + 1) < $numstartworkingday) || (($idw + 1) > $numendworkingday)) {
823 $cssweekend =
'weekend';
826 print
'<td class="center hide'.$idw.
' '.($cssweekend ?
' '.$cssweekend :
'').($j <= 1 ?
' borderleft' :
'').
'">';
828 $timeonothertasks = ($totalforeachday[$tmpday] - $totalforvisibletasks[$tmpday]);
829 if ($timeonothertasks) {
830 print
'<span class="timesheetalreadyrecorded" title="texttoreplace"><input type="text" class="center smallpadd width50" disabled="" id="timespent[-1]['.$idw.
']" name="task[-1]['.$idw.
']" value="';
836 print
' <td class="liste_total"></td>';
840 if (
$conf->use_javascript_ajax) {
841 print
'<tr class="liste_total">';
842 print
'<td class="liste_total" colspan="'.($colspan + $addcolspan).
'">';
843 print $langs->trans(
"Total");
844 $htmltooltip = $langs->trans(
"ExpectedWorkedHours").
': <strong>'.
price($usertoprocess->weeklyhours, 1, $langs, 0, 0);
845 print
'<span class="opacitymediumbycolor"> <div class="totalDayAll inline-block bold"> </div> '.($usertoprocess->weeklyhours ?
' / '.$form->textwithpicto(
price($usertoprocess->weeklyhours, 1, $langs, 0, 0), $htmltooltip) :
'').
'</strong></span>';
847 if (!empty($arrayfields[
'timeconsumed'][
'checked'])) {
848 print
'<td class="liste_total"></td>';
849 print
'<td class="liste_total"></td>';
853 for ($idw = 0; $idw < 7; $idw++) {
856 if ((($idw + 1) < $numstartworkingday) || (($idw + 1) > $numendworkingday)) {
857 $cssweekend =
'weekend';
863 if (!$isavailable[$tmpday][
'morning'] && !$isavailable[$tmpday][
'afternoon']) {
864 $cssonholiday .=
'onholidayallday ';
865 } elseif (!$isavailable[$tmpday][
'morning']) {
866 $cssonholiday .=
'onholidaymorning ';
867 } elseif (!$isavailable[$tmpday][
'afternoon']) {
868 $cssonholiday .=
'onholidayafternoon ';
871 print
'<td class="liste_total center hide'.$idw.($cssonholiday ?
' '.$cssonholiday :
'').($cssweekend ?
' '.$cssweekend :
'').($j <= 1 ?
' borderleft' :
'').
'"><div class="totalDay'.$idw.
'"> </div></td>';
873 print
'<td class="liste_total center"></td>';
877 print
'<tr><td colspan="15"><span class="opacitymedium">'.$langs->trans(
"NoAssignedTasks").
'</span></td></tr>';
882print
'<input type="hidden" id="numberOfLines" name="numberOfLines" value="'.count($tasksarray).
'"/>'.
"\n";
884print $form->buttonsSaveCancel(
"Save",
'');
886print
'</form>'.
"\n\n";
890if (
$conf->use_javascript_ajax) {
891 print
"\n<!-- JS CODE TO ENABLE Tooltips on all object with class classfortooltip -->\n";
892 print
'<script type="text/javascript">'.
"\n";
893 print
"jQuery(document).ready(function () {\n";
894 print
' jQuery(".timesheetalreadyrecorded").tooltip({
895 show: { collision: "flipfit", effect:\'toggle\', delay:50 },
896 hide: { effect:\'toggle\', delay: 50 },
897 tooltipClass: "mytooltip",
898 content: function () {
899 return \''.dol_escape_js($langs->trans(
"TimeAlreadyRecorded", $usertoprocess->getFullName($langs))).
'\';
905 print " updateTotal(".((int) $idw).", '".dol_escape_js($modeinput)."');";
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
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_get_next_week($day, $week, $month, $year)
Return next week.
dol_get_first_day_week($day, $month, $year, $gm=false)
Return first day of week for a date.
num_public_holiday($timestampStart, $timestampEnd, $countryCodeOrId='', $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_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_now($mode='gmt')
Return date for now.
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...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
print_liste_field_titre($name, $file="", $field="", $begin="", $param="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='', $textonpictotooltip='')
Show information in HTML for admin users or standard users.
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, $morecssdiv='')
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
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.
natural_search($fields, $value, $mode=0, $nofirstand=0, $sqltoadd='')
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
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...
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.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
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 a 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...
print $langs trans("Show") . '< td style="' . $timeColor . '" align="center"> s</td > badge status0 badge status4 badge status3 Error badge status8< td align="center">< span class="badge ' . $badge . '"></span ></td >< td align="center">< a href="#" class="button button-small" onclick="openLogModal(this)" data-req="' . dol_escape_htmltag($reqSafe) . '" data-res="' . dol_escape_htmltag($resSafe) . '" data-err="' . dol_escape_htmltag($errSafe) . '">< span class="fa fa-search-plus"></span ></a ></td ></tr >< tr >< td colspan="' . $colspan . '" class="opacitymedium"></td ></tr ></table ></div ></form > logModal none logModal none s a JSON string
buildzip.php
project_timesheet_prepare_head($mode, $fuser=null)
Prepare array with list of tabs.
projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask, &$isavailable, $oldprojectforbreak=0, $arrayfields=array(), $extrafields=null)
Output a task line into a perday input mode.
print $langs trans('Date')." left Ref Label right Qty right Price right TotalHT right TotalTTC right right right right right right right right right centpercent right TotalHT right n right VAT right n right TotalVAT right n No sujeto a RE IRPF right TotalLT1 right n right TotalLT2 right n right TotalTTC right n takeposcustomercurrency takeposcustomercurrency takeposcustomercurrency takeposcustomercurrency right TotalTTC takeposcustomercurrency right takeposcustomercurrency n right Paid right PaymentTypeShortLIQ right SELECT p pos_change as p datep as date
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.