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(
'timesheetperdaycard'));
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');
101if ($year && $month && $day) {
102 $daytoparse =
dol_mktime(0, 0, 0, $month, $day, $year);
103} elseif ($yearofday && $monthofday && $dayofday) {
104 $daytoparse =
dol_mktime(0, 0, 0, $monthofday, $dayofday, $yearofday);
107$daytoparsegmt =
dol_now(
'gmt');
108if ($yearofday && $monthofday && $dayofday) {
109 $daytoparsegmt =
dol_mktime(0, 0, 0, $monthofday, $dayofday, $yearofday,
'gmt');
110} elseif ($year && $month && $day) {
111 $daytoparsegmt =
dol_mktime(0, 0, 0, $month, $day, $year,
'gmt');
114if (empty($search_usertoprocessid) || $search_usertoprocessid == $user->id) {
115 $usertoprocess = $user;
116 $search_usertoprocessid = $usertoprocess->id;
117} elseif ($search_usertoprocessid > 0) {
118 $usertoprocess =
new User(
$db);
119 $usertoprocess->fetch($search_usertoprocessid);
120 $search_usertoprocessid = $usertoprocess->id;
122 $usertoprocess =
new User(
$db);
132$extrafields->fetch_name_optionals_label(
$object->table_element);
135$arrayfields = array();
136$arrayfields[
't.planned_workload'] = array(
'label' =>
'PlannedWorkload',
'checked' =>
'1',
'enabled' =>
'1',
'position' => 0);
137$arrayfields[
't.progress'] = array(
'label' =>
'ProgressDeclared',
'checked' =>
'1',
'enabled' =>
'1',
'position' => 0);
138$arrayfields[
'timeconsumed'] = array(
'label' =>
'TimeConsumed',
'checked' =>
'1',
'enabled' =>
'1',
'position' => 15);
149$extrafieldsobjectkey =
$object->table_element;
150$extrafieldsobjectprefix =
'efpt.';
151include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
156$search_array_options_project = $extrafields->getOptionalsFromPost($project->table_element,
'',
'search_');
157$search_array_options_task = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_task_');
165$parameters = array(
'id' => $id,
'taskid' => $taskid,
'projectid' => $projectid);
166$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
171if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
174 $search_usertoprocessid = $user->id;
175 $search_task_ref =
'';
176 $search_task_label =
'';
177 $search_project_ref =
'';
178 $search_thirdparty =
'';
179 $search_declared_progress =
'';
181 $search_array_options_project = array();
182 $search_array_options_task = array();
185 $usertoprocess = $user;
187if (
GETPOST(
"button_search_x",
'alpha') ||
GETPOST(
"button_search.x",
'alpha') ||
GETPOST(
"button_search",
'alpha')) {
191if (
GETPOST(
'submitdateselect')) {
199include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
201if ($action ==
'addtime' && $user->hasRight(
'projet',
'lire') &&
GETPOST(
'assigntask') &&
GETPOST(
'formfilteraction') !=
'listafterchangingselectedfields') {
202 $action =
'assigntask';
205 $result =
$object->fetch($taskid);
210 setEventMessages($langs->transnoentitiesnoconv(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Task")),
null,
'errors');
214 setEventMessages($langs->transnoentitiesnoconv(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Type")),
null,
'errors');
218 $idfortaskuser = $usertoprocess->id;
219 $result =
$object->add_contact($idfortaskuser,
GETPOST(
"type"),
'internal');
221 if ($result >= 0 || $result == -2) {
223 $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';
224 $sql .=
' AND ec.fk_socpeople = '.((int) $idfortaskuser).
" AND ec.element_id = ".((int)
$object->fk_project).
" AND tc.element = 'project' AND source = 'internal'";
225 $resql =
$db->query($sql);
227 $obj =
$db->fetch_object($resql);
230 $project->fetch(
$object->fk_project);
232 $listofprojcontact = $project->liste_type_contact(
'internal');
234 if (count($listofprojcontact)) {
235 $tmparray = array_keys($listofprojcontact);
236 $typeforprojectcontact = reset($tmparray);
237 $result = $project->add_contact($idfortaskuser, $typeforprojectcontact,
'internal');
248 if (
$object->error ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
249 $langs->load(
"errors");
250 setEventMessages($langs->trans(
"ErrorTaskAlreadyAssigned"),
null,
'warnings');
264if ($action ==
'addtime' && $user->hasRight(
'projet',
'lire') &&
GETPOST(
'formfilteraction') !=
'listafterchangingselectedfields') {
265 $timespent_duration = array();
267 if (is_array($_POST)) {
268 foreach ($_POST as $key => $time) {
273 if (preg_match(
"/([0-9]+)duration(hour|min)/", $key, $matches)) {
276 if (!array_key_exists($id, $timespent_duration)) {
277 $timespent_duration[
$id] = 0;
280 if ($matches[2] ==
'hour') {
281 $timespent_duration[
$id] += $time * 60 * 60;
285 if ($matches[2] ==
'min') {
286 $timespent_duration[
$id] += $time * 60;
294 if (count($timespent_duration) > 0) {
295 foreach ($timespent_duration as $key => $val) {
299 if (GETPOSTISSET($taskid.
'progress')) {
305 $object->timespent_duration = (int) $val;
306 $object->timespent_fk_user = $usertoprocess->id;
310 $object->timespent_withhour = 1;
312 $object->timespent_datehour =
dol_mktime(12, 0, 0, $monthofday, $dayofday, $yearofday);
316 if (
$object->timespent_date > 0) {
317 $result =
$object->addTimeSpent($user);
335 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?'.($projectid ?
'id='.$projectid :
'').($search_usertoprocessid ?
'&search_usertoprocessid='.urlencode((
string) $search_usertoprocessid) :
'').($mode ?
'&mode='.$mode :
'').
'&year='.$yearofday.
'&month='.$monthofday.
'&day='.$dayofday);
360$prev_year = $prev[
'year'];
361$prev_month = $prev[
'mon'];
362$prev_day = $prev[
'mday'];
365$next_year = $next[
'year'];
366$next_month = $next[
'mon'];
367$next_day = $next[
'mday'];
369$title = $langs->trans(
"TimeSpent");
371$projectsListId = $projectstatic->getProjectsAuthorizedForUser($usertoprocess, (empty($usertoprocess->id) ? 2 : 0), 1);
374 $project->fetch($id);
375 $project->fetch_thirdparty();
378$onlyopenedproject = 1;
379$morewherefilter =
'';
381if ($search_project_ref) {
382 $morewherefilter .=
natural_search(array(
"p.ref",
"p.title"), $search_project_ref);
384if ($search_task_ref) {
387if ($search_task_label) {
388 $morewherefilter .=
natural_search(array(
"t.ref",
"t.label"), $search_task_label);
390if ($search_thirdparty) {
393if ($search_declared_progress) {
394 $morewherefilter .=
natural_search(
"t.progress", $search_declared_progress, 1);
397$sql = &$morewherefilter;
405$search_array_options = $search_array_options_task;
406$extrafieldsobjectprefix =
'efpt.';
407$search_options_pattern =
'search_task_options_';
408$extrafieldsobjectkey =
'projet_task';
409include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
411$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);
413$tasksarraywithoutfilter = array();
414if ($morewherefilter) {
415 $tasksarraywithoutfilter = $taskstatic->getTasksArray(
null,
null, ($project->id ? $project->id : 0), $socid, 0,
'', (
string) $onlyopenedproject,
'', ($search_usertoprocessid ? $search_usertoprocessid : 0));
417$projectsrole = $taskstatic->getUserRolesForProjectsOrTasks($usertoprocess,
null, ($project->id ? (
string) $project->id :
'0'), 0, $onlyopenedproject);
418$tasksrole = $taskstatic->getUserRolesForProjectsOrTasks(
null, $usertoprocess, ($project->id ? (
string) $project->id :
'0'), 0, $onlyopenedproject);
420llxHeader(
'', $title,
'',
'', 0, 0, array(
'/core/js/timesheet.js'),
'',
'',
'mod-project project-activity page-activity_perday');
425$param .= ($mode ?
'&mode='.urlencode($mode) :
'');
426$param .= ($search_project_ref ?
'&search_project_ref='.urlencode($search_project_ref) :
'');
427$param .= ($search_usertoprocessid > 0 ?
'&search_usertoprocessid='.urlencode((
string) $search_usertoprocessid) :
'');
428$param .= ($search_thirdparty ?
'&search_thirdparty='.urlencode($search_thirdparty) :
'');
429$param .= ($search_task_ref ?
'&search_task_ref='.urlencode($search_task_ref) :
'');
430$param .= ($search_task_label ?
'&search_task_label='.urlencode($search_task_label) :
'');
438$search_array_options = $search_array_options_task;
439$search_options_pattern =
'search_task_options_';
440include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
443$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, $day, $year),
"day").
" </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, (
$conf->dol_optimize_smallscreen ? 0 : 1)).
' ';
448$nav .=
' <button type="submit" name="button_search_x" value="x" class="bordertransp nobordertransp button_search"><span class="fa fa-search"></span></button>';
452print
'<form name="addtime" method="POST" action="'.$_SERVER[
"PHP_SELF"].($project->id > 0 ?
'?id='.$project->id :
'').
'">';
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.
'">';
459print
'<input type="hidden" name="addtimeyear" value="'.$tmp[
'year'].
'">';
460print
'<input type="hidden" name="addtimemonth" value="'.$tmp[
'mon'].
'">';
461print
'<input type="hidden" name="addtimeday" value="'.$tmp[
'mday'].
'">';
464print
dol_get_fiche_head($head,
'inputperday', $langs->trans(
'TimeSpent'), -1, $picto);
468if ($mine || ($usertoprocess->id == $user->id)) {
469 $s .= $langs->trans(
"MyTasksDesc").
'.'.($onlyopenedproject ?
' '.$langs->trans(
"OnlyOpenedProject") :
'').
'<br>';
471 if (empty($usertoprocess->id) || $usertoprocess->id < 0) {
472 if ($user->hasRight(
'projet',
'all',
'lire') && !$socid) {
473 $s .= $langs->trans(
"ProjectsDesc").
'.'.($onlyopenedproject ?
' '.$langs->trans(
"OnlyOpenedProject") :
'').
'<br>';
475 $s .= $langs->trans(
"ProjectsPublicTaskDesc").
'.'.($onlyopenedproject ?
' '.$langs->trans(
"OnlyOpenedProject") :
'').
'<br>';
479if ($mine || ($usertoprocess->id == $user->id)) {
480 $s .= $langs->trans(
"OnlyYourTaskAreVisible");
482 $s .= $langs->trans(
"AllTaskVisibleButEditIfYouAreAssigned");
484print
info_admin($s, 0, 0,
'info',
'nomargintop nomarginbottom hideonsmartphone');
489print
'<div class="'.($conf->dol_optimize_smallscreen ?
'center centpercent' :
'floatright right').
'">'.$nav.
'</div>';
491print
'<div class="colorbacktimesheet valignmiddle'.($conf->dol_optimize_smallscreen ?
' center' :
' float').
'">';
492$titleassigntask = $langs->transnoentities(
"AssignTaskToMe");
493if ($usertoprocess->id != $user->id) {
494 $titleassigntask = $langs->transnoentities(
"AssignTaskToUser", $usertoprocess->getFullName($langs));
496print
'<div class="taskiddiv inline-block">';
497print
img_picto(
'',
'projecttask',
'class="pictofixedwidth"');
498$formproject->selectTasks($socid ? $socid : -1, $taskid,
'taskid', 32, 0,
'-- '.$langs->trans(
"ChooseANotYetAssignedTask").
' --', 1, 0, 0,
'widthcentpercentminusx maxwidth500',
'',
'all', $usertoprocess);
501print $formcompany->selectTypeContact($object,
'',
'type',
'internal',
'position', 0,
'maxwidth150onsmartphone');
502print
'<input type="submit" class="button valignmiddle smallonsmartphone small" name="assigntask" value="'.dol_escape_htmltag($titleassigntask).
'">';
505print
'<div class="clearboth" style="padding-bottom: 20px;"></div>';
520$includeonly =
'hierarchyme';
521if (!$user->hasRight(
'user',
'user',
'lire')) {
522 $includeonly = array($user->id);
524$selecteduser = $search_usertoprocessid ? $search_usertoprocessid : $usertoprocess->id;
525$moreforfiltertmp = $form->select_dolusers($selecteduser,
'search_usertoprocessid', 0,
null, 0, $includeonly,
'',
'0', 0, 0,
'', 0,
'',
'maxwidth200');
526if ($form->num > 1 || empty(
$conf->dol_optimize_smallscreen)) {
527 $moreforfilter .=
'<div class="divsearchfield">';
528 $moreforfilter .=
'<div class="inline-block hideonsmartphone"></div>';
529 $moreforfilter .=
img_picto($langs->trans(
'Filter').
' '.$langs->trans(
'User'),
'user',
'class="paddingright pictofixedwidth"');
530 $moreforfilter .= $moreforfiltertmp;
531 $moreforfilter .=
'</div>';
533 $moreforfilter .=
'<input type="hidden" name="search_usertoprocessid" value="'.$selecteduser.
'">';
537 $moreforfilter .=
'<div class="divsearchfield">';
538 $moreforfilter .=
'<div class="inline-block"></div>';
539 $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">';
540 $moreforfilter .=
'</div>';
542 $moreforfilter .=
'<div class="divsearchfield">';
543 $moreforfilter .=
'<div class="inline-block"></div>';
544 $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">';
545 $moreforfilter .=
'</div>';
548if (!empty($moreforfilter)) {
549 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
550 print $moreforfilter;
551 $parameters = array();
552 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
553 print $hookmanager->resPrint;
557$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
558$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
562if (!empty($arrayfields[
't.planned_workload'][
'checked'])) {
565if (!empty($arrayfields[
't.progress'][
'checked'])) {
568foreach ($arrayfields as $key => $val) {
569 if ($val[
'checked'] && substr($key, 0, 5) ==
'efpt.') {
574print
'<div class="div-table-responsive">';
575print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'" id="tablelines3">'.
"\n";
577print
'<tr class="liste_titre_filter">';
579 print
'<td class="liste_titre"><input type="text" class="maxwidth75" name="search_project_ref" value="'.dol_escape_htmltag($search_project_ref).
'"></td>';
582 print
'<td class="liste_titre"><input type="text" class="maxwidth75" name="search_thirdparty" value="'.dol_escape_htmltag($search_thirdparty).
'"></td>';
584print
'<td class="liste_titre"><input type="text" class="maxwidth75" name="search_task_label" value="'.dol_escape_htmltag($search_task_label).
'"></td>';
586$search_options_pattern =
'search_task_options_';
587$extrafieldsobjectkey =
'projet_task';
588$extrafieldsobjectprefix =
'efpt.';
589include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
590if (!empty($arrayfields[
't.planned_workload'][
'checked'])) {
591 print
'<td class="liste_titre"></td>';
593if (!empty($arrayfields[
't.progress'][
'checked'])) {
594 print
'<td class="liste_titre right"><input type="text" class="width50" name="search_declared_progress" value="'.dol_escape_htmltag($search_declared_progress).
'"></td>';
596if (!empty($arrayfields[
'timeconsumed'][
'checked'])) {
597 print
'<td class="liste_titre"></td>';
598 print
'<td class="liste_titre"></td>';
600print
'<td class="liste_titre"></td>';
601print
'<td class="liste_titre"></td>';
602print
'<td class="liste_titre"></td>';
604print
'<td class="liste_titre nowrap right">';
605$searchpicto = $form->showFilterAndCheckAddButtons(0);
610print
'<tr class="liste_titre">';
612 print
'<th>'.$langs->trans(
"Project").
'</th>';
615 print
'<th>'.$langs->trans(
"ThirdParty").
'</th>';
617print
'<th>'.$langs->trans(
"Task").
'</th>';
619$extrafieldsobjectkey =
'projet_task';
620$extrafieldsobjectprefix =
'efpt.';
621include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
622if (!empty($arrayfields[
't.planned_workload'][
'checked'])) {
623 print
'<th class="leftborder plannedworkload minwidth75 maxwidth100 right" title="'.dol_escape_htmltag($langs->trans(
"PlannedWorkload")).
'">'.$form->textwithpicto($langs->trans(
"PlannedWorkloadShort"), $langs->trans(
"PlannedWorkload")).
'</th>';
625if (!empty($arrayfields[
't.progress'][
'checked'])) {
626 print
'<th class="right minwidth75 maxwidth100 title="'.dol_escape_htmltag($langs->trans(
"ProgressDeclared")).
'">'.$langs->trans(
"ProgressDeclared").
'</th>';
628if (!empty($arrayfields[
'timeconsumed'][
'checked'])) {
629 print
'<th class="right maxwidth100">'.$langs->trans(
"TimeSpentSmall").
'<br>';
630 print
'<span class="nowraponall">';
631 print
'<span class="opacitymedium nopadding userimg"><img alt="Photo" class="photouserphoto userphotosmall" src="'.DOL_URL_ROOT.
'/theme/common/everybody.png"></span>';
632 print
'<span class="opacitymedium paddingleft">'.$langs->trans(
"EverybodySmall").
'</span>';
635 print
'<th class="right maxwidth75 maxwidth100">'.$langs->trans(
"TimeSpentSmall").($usertoprocess->firstname ?
'<br><span class="nowraponall">'.$usertoprocess->getNomUrl(-3).
'<span class="opacitymedium paddingleft">'.
dol_trunc($usertoprocess->firstname, 10).
'</span></span>' :
'').
'</th>';
637print
'<th class="center leftborder">'.$langs->trans(
"HourStart").
'</td>';
640$restrictviewformytask =
getDolGlobalInt(
'PROJECT_TIME_SHOW_TASK_NOT_ASSIGNED', 2);
642$numendworkingday = 0;
643$numstartworkingday = 0;
645$isavailable = array();
648$numstartworkingday = 1;
649$numendworkingday = 5;
653 if (count($tmparray) >= 2) {
654 $numstartworkingday = $tmparray[0];
655 $numendworkingday = $tmparray[1];
660$isavailablefordayanduser = $holiday->verifDateHolidayForTimestamp($usertoprocess->id, $daytoparse, (
string) $statusofholidaytocheck);
661$isavailable[$daytoparse] = $isavailablefordayanduser;
665 $isavailable[$daytoparse] = array(
'morning' =>
false,
'afternoon' =>
false,
'morning_reason' =>
'public_holiday',
'afternoon_reason' =>
'public_holiday');
673if ((($idw + 1) < $numstartworkingday) || (($idw + 1) > $numendworkingday)) {
674 $cssweekend =
'weekend';
680if (!$isavailable[$daytoparse][
'morning'] && !$isavailable[$daytoparse][
'afternoon']) {
681 $cssonholiday .=
'onholidayallday ';
682} elseif (!$isavailable[$daytoparse][
'morning']) {
683 $cssonholiday .=
'onholidaymorning ';
684} elseif (!$isavailable[$daytoparse][
'afternoon']) {
685 $cssonholiday .=
'onholidayafternoon ';
688print
'<th class="center'.($cssonholiday ?
' '.$cssonholiday :
'').($cssweekend ?
' '.$cssweekend :
'').
'">'.$langs->trans(
"Duration").
'</th>';
689print
'<th class="center">'.$langs->trans(
"Note").
'</th>';
691print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
695$colspan = 2 + (!
getDolGlobalString(
'PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT') ? 0 : 2);
697if (
$conf->use_javascript_ajax && count($tasksarray) >=
getDolGlobalInt(
'NBLINES_TO_DUPLICATE_TOTAL_TIMESPENT_ON_TOP', 10)) {
698 print
'<tr class="liste_total hideonsmartphone">';
699 print
'<td class="liste_total" colspan="'.($colspan - 1 + $addcolspan).
'">';
700 print $langs->trans(
"Total");
702 if (!empty($arrayfields[
'timeconsumed'][
'checked'])) {
703 print
'<td class="liste_total"></td>';
704 print
'<td class="liste_total"></td>';
706 print
'<td class="liste_total leftborder">';
709 print
'<td class="liste_total center'.($cssonholiday ?
' '.$cssonholiday :
'').($cssweekend ?
' '.$cssweekend :
'').
'"><div class="totalDay0"> </div></td>';
711 print
'<td class="liste_total"></td>';
712 print
'<td class="liste_total"></td>';
717if (count($tasksarray) > 0) {
724 $totalforvisibletasks =
projectLinesPerDay($j, 0, $usertoprocess, $tasksarray, $level, $projectsrole, $tasksrole, $mine, $restrictviewformytask, $daytoparse, $isavailable, 0, $arrayfields, $extrafields);
730 $listofdistinctprojectid = array();
731 if (!empty($tasksarraywithoutfilter) && is_array($tasksarraywithoutfilter) && count($tasksarraywithoutfilter)) {
732 foreach ($tasksarraywithoutfilter as $tmptask) {
733 $listofdistinctprojectid[$tmptask->fk_project] = $tmptask->fk_project;
737 $totalforeachday = array();
738 foreach ($listofdistinctprojectid as $tmpprojectid) {
739 $projectstatic->id = $tmpprojectid;
740 $projectstatic->loadTimeSpent($daytoparse, 0, $usertoprocess->id);
741 for ($idw = 0; $idw < 7; $idw++) {
743 $totalforeachday[$tmpday] += $projectstatic->weekWorkLoad[$tmpday];
750 if (count($totalforeachday)) {
751 $timeonothertasks = ($totalforeachday[$daytoparse] - $totalforvisibletasks[$daytoparse]);
752 if ($timeonothertasks) {
759 print
'<tr class="oddeven othertaskwithtime">';
760 print
'<td colspan="'.($colspan - 1).
'" class="opacitymedium">';
761 print $langs->trans(
"OtherFilteredTasks");
763 if (!empty($arrayfields[
'timeconsumed'][
'checked'])) {
764 print
'<td class="liste_total"></td>';
765 print
'<td class="liste_total"></td>';
767 print
'<td class="leftborder"></td>';
768 print
'<td class="right">';
769 $timeonothertasks = ($totalforeachday[$daytoparse] - $totalforvisibletasks[$daytoparse]);
770 print
'<span class="timesheetalreadyrecorded" title="texttoreplace"><input type="text" class="center width50" disabled="" id="timespent[-1][0]" name="task[-1][0]" value="';
771 if ($timeonothertasks) {
776 print
' <td class="liste_total borderleft"></td>';
777 print
' <td class="liste_total"></td>';
781 if (
$conf->use_javascript_ajax) {
782 print
'<tr class="liste_total">';
783 print
'<td class="liste_total" colspan="'.($colspan - 1 + $addcolspan).
'">';
784 print $langs->trans(
"Total");
786 if (!empty($arrayfields[
'timeconsumed'][
'checked'])) {
787 print
'<td class="liste_total"></td>';
788 print
'<td class="liste_total"></td>';
790 print
'<td class="liste_total leftborder borderleft">';
794 print
'<td class="liste_total center'.($cssonholiday ?
' '.$cssonholiday :
'').($cssweekend ?
' '.$cssweekend :
'').
'"><div class="totalDay0"> </div></td>';
796 print
'<td class="liste_total"></td>';
797 print
'<td class="liste_total"></td>';
801 print
'<tr><td colspan="14"><span class="opacitymedium">'.$langs->trans(
"NoAssignedTasks").
'</span></td></tr>';
806print
'<input type="hidden" id="numberOfLines" name="numberOfLines" value="'.count($tasksarray).
'"/>'.
"\n";
808print
'<div class="center">';
809print
'<input type="submit" name="button_addtime" class="button button-save"'.(!empty($disabledtask) ?
' disabled' :
'').
' value="'.$langs->trans(
"Save").
'">';
814if (!empty(
$conf->use_javascript_ajax)) {
815 $modeinput =
'hours';
816 print
"\n<!-- JS CODE TO ENABLE Tooltips on all object with class classfortooltip -->\n";
817 print
'<script type="text/javascript">'.
"\n";
818 print
"jQuery(document).ready(function () {\n";
819 print
" updateTotal(0, '".dol_escape_js($modeinput).
"');\n";
820 print
' jQuery(".timesheetalreadyrecorded").tooltip({
821 show: { collision: "flipfit", effect:\'toggle\', delay:50 },
822 hide: { effect:\'toggle\', delay: 50 },
823 tooltipClass: "mytooltip",
824 content: function () {
825 return \''.dol_escape_js($langs->trans(
"TimeAlreadyRecorded", $usertoprocess->getFullName($langs))).
'\';
828 print " jQuery('.inputhour, .inputminute
').bind('keyup
', function(e) { updateTotal(0, '".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.
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.
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_getdate($timestamp, $fast=false, $forcetimezone='')
Return an array with locale date info.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
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
projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask, $preselectedday, &$isavailable, $oldprojectforbreak=0, $arrayfields=array(), $extrafields=null)
Output a task line into a pertime input mode.
project_timesheet_prepare_head($mode, $fuser=null)
Prepare array with list of tabs.
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.