dolibarr 21.0.0-beta
permonth.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
4 * Copyright (C) 2005-2010 Regis Houssin <regis.houssin@capnetworks.com>
5 * Copyright (C) 2010 François Legastelois <flegastelois@teclib.com>
6 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
7 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 3 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <https://www.gnu.org/licenses/>.
21 */
22
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';
38
48// Load translation files required by the page
49$langs->loadLangs(array('projects', 'users', 'companies'));
50
51$action = GETPOST('action', 'aZ09');
52$mode = GETPOST("mode", 'alpha');
53$id = GETPOSTINT('id');
54$taskid = GETPOSTINT('taskid');
55
56$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'timespent';
57
58$mine = 0;
59if ($mode == 'mine') {
60 $mine = 1;
61}
62
63$projectid = GETPOSTISSET("id") ? GETPOSTINT("id", 1) : GETPOSTINT("projectid");
64
65$hookmanager->initHooks(array('timesheetpermonthcard'));
66
67// Security check
68$socid = 0;
69// For external user, no check is done on company because readability is managed by public status of project and assignment.
70// if ($user->socid > 0) $socid=$user->socid;
71$result = restrictedArea($user, 'projet', $projectid);
72
73$now = dol_now();
74
75$year = GETPOSTINT('reyear') ? GETPOSTINT('reyear') : (GETPOSTINT("year") ? GETPOSTINT("year") : date("Y"));
76$month = GETPOSTINT('remonth') ? GETPOSTINT('remonth') : (GETPOSTINT("month") ? GETPOSTINT("month") : date("m"));
77$day = GETPOSTINT('reday') ? GETPOSTINT('reday') : (GETPOSTINT("day") ? GETPOSTINT("day") : date("d"));
78$week = GETPOSTINT("week") ? GETPOSTINT("week") : date("W");
79
80$day = (int) $day;
81
82//$search_categ = GETPOST("search_categ", 'alpha');
83$search_usertoprocessid = GETPOSTINT('search_usertoprocessid');
84$search_task_ref = GETPOST('search_task_ref', 'alpha');
85$search_task_label = GETPOST('search_task_label', 'alpha');
86$search_project_ref = GETPOST('search_project_ref', 'alpha');
87$search_thirdparty = GETPOST('search_thirdparty', 'alpha');
88$search_declared_progress = GETPOST('search_declared_progress', 'alpha');
89
90$sortfield = GETPOST('sortfield', 'aZ09comma');
91$sortorder = GETPOST('sortorder', 'aZ09comma');
92
93$startdayarray = dol_get_prev_month($month, $year);
94
95$prev = $startdayarray;
96$prev_year = $prev['year'];
97$prev_month = $prev['month'];
98$prev_day = 1;
99
100$next = dol_get_next_month($month, $year);
101$next_year = $next['year'];
102$next_month = $next['month'];
103$next_day = 1;
104$TWeek = getWeekNumbersOfMonth($month, $year);
105$firstdaytoshow = dol_mktime(0, 0, 0, $month, 1, $year);
106$TFirstDays = getFirstDayOfEachWeek($TWeek, $year);
107$TFirstDays[reset($TWeek)] = '01'; //first day of month
108$TLastDays = getLastDayOfEachWeek($TWeek, $year);
109$TLastDays[end($TWeek)] = date("t", strtotime($year.'-'.$month.'-'.$day)); //last day of month
110if (empty($search_usertoprocessid) || $search_usertoprocessid == $user->id) {
111 $usertoprocess = $user;
112 $search_usertoprocessid = $usertoprocess->id;
113} elseif ($search_usertoprocessid > 0) {
114 $usertoprocess = new User($db);
115 $usertoprocess->fetch($search_usertoprocessid);
116 $search_usertoprocessid = $usertoprocess->id;
117} else {
118 $usertoprocess = new User($db);
119}
120
121$object = new Task($db);
122
123// Extra fields
124$extrafields = new ExtraFields($db);
125
126// fetch optionals attributes and labels
127$extrafields->fetch_name_optionals_label($object->table_element);
128
129// Definition of fields for list
130$arrayfields = array();
131/*$arrayfields=array(
132 // Project
133 'p.opp_amount'=>array('label'=>$langs->trans("OpportunityAmountShort"), 'checked'=>0, 'enabled'=>($conf->global->PROJECT_USE_OPPORTUNITIES?1:0), 'position'=>103),
134 'p.fk_opp_status'=>array('label'=>$langs->trans("OpportunityStatusShort"), 'checked'=>0, 'enabled'=>($conf->global->PROJECT_USE_OPPORTUNITIES?1:0), 'position'=>104),
135 'p.opp_percent'=>array('label'=>$langs->trans("OpportunityProbabilityShort"), 'checked'=>0, 'enabled'=>($conf->global->PROJECT_USE_OPPORTUNITIES?1:0), 'position'=>105),
136 'p.budget_amount'=>array('label'=>$langs->trans("Budget"), 'checked'=>0, 'position'=>110),
137 'p.usage_bill_time'=>array('label'=>$langs->trans("BillTimeShort"), 'checked'=>0, 'position'=>115),
138 );*/
139$arrayfields['t.planned_workload'] = array('label' => 'PlannedWorkload', 'checked' => 1, 'enabled' => 1, 'position' => 5);
140$arrayfields['t.progress'] = array('label' => 'ProgressDeclared', 'checked' => 1, 'enabled' => 1, 'position' => 10);
141$arrayfields['timeconsumed'] = array('label' => 'TimeConsumed', 'checked' => 1, 'enabled' => 1, 'position' => 15);
142/*foreach($object->fields as $key => $val)
143 {
144 // If $val['visible']==0, then we never show the field
145 if (!empty($val['visible'])) $arrayfields['t.'.$key]=array('label'=>$val['label'], 'checked'=>(($val['visible']<0)?0:1), 'enabled'=>$val['enabled'], 'position'=>$val['position']);
146 }*/
147// Definition of fields for list
148// Extra fields
149if (!empty($extrafields->attributes['projet_task']['label']) && is_array($extrafields->attributes['projet_task']['label']) && count($extrafields->attributes['projet_task']['label']) > 0) {
150 foreach ($extrafields->attributes['projet_task']['label'] as $key => $val) {
151 if (!empty($extrafields->attributes['projet_task']['list'][$key])) {
152 $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]));
153 }
154 }
155}
156$arrayfields = dol_sort_array($arrayfields, 'position');
157
158$search_array_options = array();
159$search_array_options_project = $extrafields->getOptionalsFromPost('projet', '', 'search_');
160$search_array_options_task = $extrafields->getOptionalsFromPost('projet_task', '', 'search_task_');
161
162$error = 0;
163
164
165/*
166 * Actions
167 */
168
169$parameters = array('id' => $id, 'taskid' => $taskid, 'projectid' => $projectid, 'TWeek' => $TWeek, 'TFirstDays' => $TFirstDays, 'TLastDays' => $TLastDays);
170$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
171if ($reshook < 0) {
172 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
173}
174
175// Purge criteria
176if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
177 $action = '';
178 //$search_categ = '';
179 $search_usertoprocessid = $user->id;
180 $search_task_ref = '';
181 $search_task_label = '';
182 $search_project_ref = '';
183 $search_thirdparty = '';
184 $search_declared_progress = '';
185
186 $search_array_options_project = array();
187 $search_array_options_task = array();
188
189 // We redefine $usertoprocess
190 $usertoprocess = $user;
191}
192if (GETPOST("button_search_x", 'alpha') || GETPOST("button_search.x", 'alpha') || GETPOST("button_search", 'alpha')) {
193 $action = '';
194}
195
196if (GETPOST('submitdateselect')) {
197 if (GETPOSTINT('remonth') && GETPOSTINT('reday') && GETPOSTINT('reyear')) {
198 $daytoparse = dol_mktime(0, 0, 0, GETPOSTINT('remonth'), GETPOSTINT('reday'), GETPOSTINT('reyear'));
199 }
200
201 $action = '';
202}
203
204include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
205
206if ($action == 'addtime' && $user->hasRight('projet', 'lire') && GETPOST('assigntask') && GETPOST('formfilteraction') != 'listafterchangingselectedfields') {
207 $action = 'assigntask';
208
209 if ($taskid > 0) {
210 $result = $object->fetch($taskid, $ref);
211 if ($result < 0) {
212 $error++;
213 }
214 } else {
215 setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired", $langs->transnoentitiesnoconv("Task")), null, 'errors');
216 $error++;
217 }
218 if (!GETPOST('type')) {
219 setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors');
220 $error++;
221 }
222
223 if (!$error) {
224 $idfortaskuser = $usertoprocess->id;
225 $result = $object->add_contact($idfortaskuser, GETPOST("type"), 'internal');
226
227 if ($result >= 0 || $result == -2) { // Contact add ok or already contact of task
228 // Test if we are already contact of the project (should be rare but sometimes we can add as task contact without being contact of project, like when admin user has been removed from contact of project)
229 $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';
230 $sql .= ' AND ec.fk_socpeople = '.((int) $idfortaskuser)." AND ec.element_id = ".((int) $object->fk_project)." AND tc.element = 'project' AND source = 'internal'";
231 $resql = $db->query($sql);
232 if ($resql) {
233 $obj = $db->fetch_object($resql);
234 if (!$obj) { // User is not already linked to project, so we will create link to first type
235 $project = new Project($db);
236 $project->fetch($object->fk_project);
237 // Get type
238 $listofprojcontact = $project->liste_type_contact('internal');
239
240 if (count($listofprojcontact)) {
241 $tmparray = array_keys($listofprojcontact);
242 $typeforprojectcontact = reset($tmparray);
243 $result = $project->add_contact($idfortaskuser, $typeforprojectcontact, 'internal');
244 }
245 }
246 } else {
247 dol_print_error($db);
248 }
249 }
250 }
251
252 if ($result < 0) {
253 $error++;
254 if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
255 $langs->load("errors");
256 setEventMessages($langs->trans("ErrorTaskAlreadyAssigned"), null, 'warnings');
257 } else {
258 setEventMessages($object->error, $object->errors, 'errors');
259 }
260 }
261
262 if (!$error) {
263 setEventMessages("TaskAssignedToEnterTime", null);
264 $taskid = 0;
265 }
266
267 $action = '';
268}
269
270if ($action == 'addtime' && $user->hasRight('projet', 'lire') && GETPOST('formfilteraction') != 'listafterchangingselectedfields') {
271 $timetoadd = GETPOST('task');
272 if (empty($timetoadd)) {
273 setEventMessages($langs->trans("ErrorTimeSpentIsEmpty"), null, 'errors');
274 } else {
275 foreach ($timetoadd as $tmptaskid => $tmpvalue) { // Loop on each task
276 $updateoftaskdone = 0;
277 foreach ($tmpvalue as $key => $val) { // Loop on each day
278 $amountoadd = $timetoadd[$tmptaskid][$key];
279 if (!empty($amountoadd)) {
280 $tmpduration = explode(':', $amountoadd);
281 $newduration = 0;
282 if (!empty($tmpduration[0])) {
283 $newduration += (int) ((float) $tmpduration[0] * 3600);
284 }
285 if (!empty($tmpduration[1])) {
286 $newduration += (int) ((float) $tmpduration[1] * 60);
287 }
288 if (!empty($tmpduration[2])) {
289 $newduration += ((int) $tmpduration[2]);
290 }
291
292 if ($newduration > 0) {
293 $object->fetch($tmptaskid);
294
295 if (GETPOSTISSET($tmptaskid.'progress')) {
296 $object->progress = GETPOSTINT($tmptaskid.'progress');
297 } else {
298 unset($object->progress);
299 }
300
301 $object->timespent_duration = $newduration;
302 $object->timespent_fk_user = $usertoprocess->id;
303 $object->timespent_date = dol_time_plus_duree($firstdaytoshow, $key, 'd');
304 $object->timespent_datehour = $object->timespent_date;
305 $object->timespent_note = $object->description;
306
307 $result = $object->addTimeSpent($user);
308 if ($result < 0) {
309 setEventMessages($object->error, $object->errors, 'errors');
310 $error++;
311 break;
312 }
313
314 $updateoftaskdone++;
315 }
316 }
317 }
318
319 if (!$updateoftaskdone) { // Check to update progress if no update were done on task.
320 $object->fetch($tmptaskid);
321 //var_dump($object->progress);
322 //var_dump(GETPOST($tmptaskid . 'progress', 'int')); exit;
323 if ($object->progress != GETPOSTINT($tmptaskid.'progress')) {
324 $object->progress = GETPOSTINT($tmptaskid.'progress');
325 $result = $object->update($user);
326 if ($result < 0) {
327 setEventMessages($object->error, $object->errors, 'errors');
328 $error++;
329 break;
330 }
331 }
332 }
333 }
334
335 if (!$error) {
336 setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
337
338 $param = '';
339 $param .= ($mode ? '&mode='.urlencode($mode) : '');
340 $param .= ($projectid ? 'id='.urlencode((string) ($projectid)) : '');
341 $param .= ($search_usertoprocessid ? '&search_usertoprocessid='.urlencode((string) $search_usertoprocessid) : '');
342 $param .= ($day ? '&day='.urlencode((string) ($day)) : '').($month ? '&month='.urlencode((string) ($month)) : '').($year ? '&year='.urlencode((string) ($year)) : '');
343 $param .= ($search_project_ref ? '&search_project_ref='.urlencode($search_project_ref) : '');
344 $param .= ($search_usertoprocessid > 0 ? '&search_usertoprocessid='.urlencode((string) $search_usertoprocessid) : '');
345 $param .= ($search_thirdparty ? '&search_thirdparty='.urlencode($search_thirdparty) : '');
346 $param .= ($search_declared_progress ? '&search_declared_progress='.urlencode($search_declared_progress) : '');
347 $param .= ($search_task_ref ? '&search_task_ref='.urlencode($search_task_ref) : '');
348 $param .= ($search_task_label ? '&search_task_label='.urlencode($search_task_label) : '');
349
350 /*$search_array_options=$search_array_options_project;
351 $search_options_pattern='search_options_';
352 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
353 */
354
355 $search_array_options = $search_array_options_task;
356 $search_options_pattern = 'search_task_options_';
357 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
358
359 // Redirect to avoid submit twice on back
360 header('Location: '.$_SERVER["PHP_SELF"].'?'.$param);
361 exit;
362 }
363 }
364}
365
366
367
368/*
369 * View
370 */
371
372$form = new Form($db);
373$formother = new FormOther($db);
374$formcompany = new FormCompany($db);
375$formproject = new FormProjets($db);
376$projectstatic = new Project($db);
377$project = new Project($db);
378$taskstatic = new Task($db);
379$thirdpartystatic = new Societe($db);
380$holiday = new Holiday($db);
381
382$title = $langs->trans("TimeSpent");
383
384$projectsListId = $projectstatic->getProjectsAuthorizedForUser($usertoprocess, (empty($usertoprocess->id) ? 2 : 0), 1); // Return all project i have permission on (assigned to me+public). I want my tasks and some of my task may be on a public projet that is not my project
385//var_dump($projectsListId);
386if ($id) {
387 $project->fetch($id);
388 $project->fetch_thirdparty();
389}
390
391$onlyopenedproject = 1; // or -1
392$morewherefilter = '';
393
394if ($search_project_ref) {
395 $morewherefilter .= natural_search(array("p.ref", "p.title"), $search_project_ref);
396}
397if ($search_task_ref) {
398 $morewherefilter .= natural_search("t.ref", $search_task_ref);
399}
400if ($search_task_label) {
401 $morewherefilter .= natural_search(array("t.ref", "t.label"), $search_task_label);
402}
403if ($search_thirdparty) {
404 $morewherefilter .= natural_search("s.nom", $search_thirdparty);
405}
406if ($search_declared_progress) {
407 $morewherefilter .= natural_search("t.progress", $search_declared_progress, 1);
408}
409
410$sql = &$morewherefilter;
411
412/*$search_array_options = $search_array_options_project;
413 $extrafieldsobjectprefix='efp.';
414 $search_options_pattern='search_options_';
415 $extrafieldsobjectkey='projet';
416 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
417 */
418$search_array_options = $search_array_options_task;
419$extrafieldsobjectprefix = 'efpt.';
420$search_options_pattern = 'search_task_options_';
421$extrafieldsobjectkey = 'projet_task';
422include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
423
424$tasksarraywithoutfilter = array(); // Default
425
426$tasksarray = $taskstatic->getTasksArray(null, null, ($project->id ? $project->id : 0), $socid, 0, $search_project_ref, $onlyopenedproject, $morewherefilter, ($search_usertoprocessid ? $search_usertoprocessid : 0), 0, $extrafields); // We want to see all tasks of open project i am allowed to see and that match filter, not only my tasks. Later only mine will be editable later.
427if ($morewherefilter) { // Get all task without any filter, so we can show total of time spent for not visible tasks
428 $tasksarraywithoutfilter = $taskstatic->getTasksArray(null, null, ($project->id ? $project->id : 0), $socid, 0, '', $onlyopenedproject, '', ($search_usertoprocessid ? $search_usertoprocessid : 0)); // We want to see all tasks of open project i am allowed to see and that match filter, not only my tasks. Later only mine will be editable later.
429}
430$projectsrole = $taskstatic->getUserRolesForProjectsOrTasks($usertoprocess, null, ($project->id ? $project->id : 0), 0, $onlyopenedproject);
431$tasksrole = $taskstatic->getUserRolesForProjectsOrTasks(null, $usertoprocess, ($project->id ? $project->id : 0), 0, $onlyopenedproject);
432//var_dump($tasksarray);
433//var_dump($projectsrole);
434//var_dump($taskrole);
435
436
437llxHeader('', $title, '', '', 0, 0, array('/core/js/timesheet.js'), '', '', 'mod-project project-activity page-activity_permonth');
438
439//print_barre_liste($title, $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, "", $num, '', 'project');
440
441$param = '';
442$param .= ($mode ? '&mode='.urlencode($mode) : '');
443$param .= ($search_project_ref ? '&search_project_ref='.urlencode($search_project_ref) : '');
444$param .= ($search_usertoprocessid > 0 ? '&search_usertoprocessid='.urlencode((string) $search_usertoprocessid) : '');
445$param .= ($search_thirdparty ? '&search_thirdparty='.urlencode($search_thirdparty) : '');
446$param .= ($search_task_ref ? '&search_task_ref='.urlencode($search_task_ref) : '');
447$param .= ($search_task_label ? '&search_task_label='.urlencode($search_task_label) : '');
448
449$search_array_options = $search_array_options_project;
450$search_options_pattern = 'search_options_';
451include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
452
453$search_array_options = $search_array_options_task;
454$search_options_pattern = 'search_task_options_';
455include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
456
457// Show navigation bar
458$nav = '<a class="inline-block valignmiddle" href="?year='.$prev_year."&month=".$prev_month."&day=".$prev_day.$param.'">'.img_previous($langs->trans("Previous"))."</a>\n";
459$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";
460$nav .= '<a class="inline-block valignmiddle" href="?year='.$next_year."&month=".$next_month."&day=".$next_day.$param.'">'.img_next($langs->trans("Next"))."</a>\n";
461$nav .= ' '.$form->selectDate(-1, '', 0, 0, 2, "addtime", 1, ($conf->dol_optimize_smallscreen ? 0 : 1)).' ';
462$nav .= ' <button type="submit" name="submitdateselect" value="x" class="bordertransp nobordertransp button_search_x"><span class="fa fa-search"></span></button>';
463
464$picto = 'clock';
465
466print '<form name="addtime" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
467print '<input type="hidden" name="token" value="'.newToken().'">';
468print '<input type="hidden" name="action" value="addtime">';
469print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
470print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
471print '<input type="hidden" name="mode" value="'.$mode.'">';
472print '<input type="hidden" name="day" value="'.$day.'">';
473print '<input type="hidden" name="month" value="'.$month.'">';
474print '<input type="hidden" name="year" value="'.$year.'">';
475
476$head = project_timesheet_prepare_head($mode, $usertoprocess);
477print dol_get_fiche_head($head, 'inputpermonth', $langs->trans('TimeSpent'), -1, $picto);
478
479// Show description of content
480print '<div class="hideonsmartphone opacitymedium">';
481if ($mine || ($usertoprocess->id == $user->id)) {
482 print $langs->trans("MyTasksDesc").'.'.($onlyopenedproject ? ' '.$langs->trans("OnlyOpenedProject") : '').'<br>';
483} else {
484 if (empty($usertoprocess->id) || $usertoprocess->id < 0) {
485 if ($user->hasRight('projet', 'all', 'lire') && !$socid) {
486 print $langs->trans("ProjectsDesc").'.'.($onlyopenedproject ? ' '.$langs->trans("OnlyOpenedProject") : '').'<br>';
487 } else {
488 print $langs->trans("ProjectsPublicTaskDesc").'.'.($onlyopenedproject ? ' '.$langs->trans("OnlyOpenedProject") : '').'<br>';
489 }
490 }
491}
492if ($mine || ($usertoprocess->id == $user->id)) {
493 print $langs->trans("OnlyYourTaskAreVisible").'<br>';
494} else {
495 print $langs->trans("AllTaskVisibleButEditIfYouAreAssigned").'<br>';
496}
497print '</div>';
498
499print dol_get_fiche_end();
500
501print '<div class="'.($conf->dol_optimize_smallscreen ? 'center centpercent' : 'floatright right').'">'.$nav.'</div>'; // We move this before the assign to components so, the default submit button is not the assign to.
502
503print '<div class="colorbacktimesheet valignmiddle'.($conf->dol_optimize_smallscreen ? ' center' : ' float').'">';
504$titleassigntask = $langs->transnoentities("AssignTaskToMe");
505if ($usertoprocess->id != $user->id) {
506 $titleassigntask = $langs->transnoentities("AssignTaskToUser", $usertoprocess->getFullName($langs));
507}
508print '<div class="taskiddiv inline-block">';
509print img_picto('', 'projecttask', 'class="pictofixedwidth"');
510$formproject->selectTasks($socid ? $socid : -1, $taskid, 'taskid', 32, 0, '-- '.$langs->trans("ChooseANotYetAssignedTask").' --', 1, 0, 0, 'widthcentpercentminusx', '', 'all', $usertoprocess);
511print '</div>';
512print ' ';
513print $formcompany->selectTypeContact($object, '', 'type', 'internal', 'position', 0, 'maxwidth150onsmartphone');
514print '<input type="submit" class="button valignmiddle smallonsmartphone small" name="assigntask" value="'.dol_escape_htmltag($titleassigntask).'">';
515print '</div>';
516
517print '<div class="clearboth" style="padding-bottom: 20px;"></div>';
518
519
520$moreforfilter = '';
521
522// Filter on categories
523/*
524if (isModEnabled("categorie")) {
525 require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
526 $moreforfilter.='<div class="divsearchfield">';
527 $moreforfilter.=$langs->trans('ProjectCategories'). ': ';
528 $moreforfilter.=$formother->select_categories('project', $search_categ, 'search_categ', 1, 1, 'maxwidth300');
529 $moreforfilter.='</div>';
530}*/
531
532// If the user can view user other than himself
533$includeonly = 'hierarchyme';
534if (!$user->hasRight('user', 'user', 'lire')) {
535 $includeonly = array($user->id);
536}
537$selecteduser = $search_usertoprocessid ? $search_usertoprocessid : $usertoprocess->id;
538$moreforfiltertmp = $form->select_dolusers($selecteduser, 'search_usertoprocessid', 0, null, 0, $includeonly, array(), 0, 0, 0, '', 0, '', 'maxwidth200');
539if ($form->num > 1 || empty($conf->dol_optimize_smallscreen)) {
540 $moreforfilter .= '<div class="divsearchfield">';
541 $moreforfilter .= '<div class="inline-block hideonsmartphone"></div>';
542 $moreforfilter .= img_picto($langs->trans('Filter').' '.$langs->trans('User'), 'user', 'class="paddingright pictofixedwidth"');
543 $moreforfilter .= $moreforfiltertmp;
544 $moreforfilter .= '</div>';
545} else {
546 $moreforfilter .= '<input type="hidden" name="search_usertoprocessid" value="'.$selecteduser.'">';
547}
548
549if (!getDolGlobalString('PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT')) {
550 $moreforfilter .= '<div class="divsearchfield">';
551 $moreforfilter .= '<div class="inline-block"></div>';
552 $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).'">';
553 $moreforfilter .= '</div>';
554
555 $moreforfilter .= '<div class="divsearchfield">';
556 $moreforfilter .= '<div class="inline-block"></div>';
557 $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).'">';
558 $moreforfilter .= '</div>';
559}
560
561if (!empty($moreforfilter)) {
562 print '<div class="liste_titre liste_titre_bydiv centpercent">';
563 print $moreforfilter;
564 $parameters = array();
565 $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
566 print $hookmanager->resPrint;
567 print '</div>';
568}
569
570$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
571
572$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
573
574// This must be after the $selectedfields
575$addcolspan = 0;
576if (!empty($arrayfields['t.planned_workload']['checked'])) {
577 $addcolspan++;
578}
579if (!empty($arrayfields['t.progress']['checked'])) {
580 $addcolspan++;
581}
582foreach ($arrayfields as $key => $val) {
583 if ($val['checked'] && substr($key, 0, 5) == 'efpt.') {
584 $addcolspan++;
585 }
586}
587
588print '<div class="div-table-responsive">';
589
590print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'" id="tablelines3">'."\n";
591
592print '<tr class="liste_titre_filter">';
593if (getDolGlobalString('PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT')) {
594 print '<td class="liste_titre"><input type="text" size="4" name="search_project_ref" value="'.dol_escape_htmltag($search_project_ref).'"></td>';
595}
596if (getDolGlobalString('PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT')) {
597 print '<td class="liste_titre"><input type="text" size="4" name="search_thirdparty" value="'.dol_escape_htmltag($search_thirdparty).'"></td>';
598}
599print '<td class="liste_titre"><input type="text" size="4" name="search_task_label" value="'.dol_escape_htmltag($search_task_label).'"></td>';
600if (!empty($arrayfields['t.planned_workload']['checked'])) {
601 print '<td class="liste_titre"></td>';
602}
603if (!empty($arrayfields['t.progress']['checked'])) {
604 print '<td class="liste_titre right"><input type="text" size="4" name="search_declared_progress" value="'.dol_escape_htmltag($search_declared_progress).'"></td>';
605}
606if (!empty($arrayfields['timeconsumed']['checked'])) {
607 print '<td class="liste_titre"></td>';
608 print '<td class="liste_titre"></td>';
609}
610foreach ($TWeek as $week_number) {
611 print '<td class="liste_titre"></td>';
612}
613// Action column
614print '<td class="liste_titre nowrap right">';
615$searchpicto = $form->showFilterAndCheckAddButtons(0);
616print $searchpicto;
617print '</td>';
618print "</tr>\n";
619
620print '<tr class="liste_titre">';
621if (getDolGlobalString('PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT')) {
622 print '<td>'.$langs->trans("Project").'</td>';
623}
624if (getDolGlobalString('PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT')) {
625 print '<td>'.$langs->trans("ThirdParty").'</td>';
626}
627print '<td>'.$langs->trans("Task").'</td>';
628if (!empty($arrayfields['t.planned_workload']['checked'])) {
629 print '<td align="right" class="leftborder plannedworkload maxwidth75">'.$form->textwithpicto($langs->trans("PlannedWorkloadShort"), $langs->trans("PlannedWorkload")).'</td>';
630}
631if (!empty($arrayfields['t.progress']['checked'])) {
632 print '<td class="right maxwidth75">'.$langs->trans("ProgressDeclared").'</td>';
633}
634if (!empty($arrayfields['timeconsumed']['checked'])) {
635 print '<td class="right maxwidth100">'.$langs->trans("TimeSpentSmall").'<br>';
636 print '<span class="nowraponall">';
637 print '<span class="opacitymedium nopadding userimg"><img alt="Photo" class="photouserphoto userphoto" src="'.DOL_URL_ROOT.'/theme/common/everybody.png"></span>';
638 print '<span class="opacitymedium paddingleft">'.$langs->trans("EverybodySmall").'</span>';
639 print '</span>';
640 print '</td>';
641 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>';
642}
643foreach ($TWeek as $week_number) {
644 print '<td width="6%" class="center bold hide"><a href="'.DOL_URL_ROOT.'/projet/activity/perweek.php?year='.$year.'&month='.$month.'&day='.$TFirstDays[$week_number].'">'.$langs->trans("WeekShort").' '.$week_number.'<br>('.$TFirstDays[$week_number].'...'.$TLastDays[$week_number].')</a></td>';
645}
646
647//print '<td></td>';
648print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
649
650print "</tr>\n";
651
652$colspan = 1;
653
654
655// Get if user is available or not for each day
656$isavailable = array();
657// TODO See code into perweek.php to initialize isavailable array
658
659// By default, we can edit only tasks we are assigned to
660$restrictviewformytask = getDolGlobalInt('PROJECT_TIME_SHOW_TASK_NOT_ASSIGNED', 2);
661if (count($tasksarray) > 0) {
662 //var_dump($tasksarray); // contains only selected tasks
663 //var_dump($tasksarraywithoutfilter); // contains all tasks (if there is a filter, not defined if no filter)
664 //var_dump($tasksrole);
665
666 $j = 0;
667 $level = 0;
668 $totalforvisibletasks = projectLinesPerMonth($j, $firstdaytoshow, $usertoprocess, 0, $tasksarray, $level, $projectsrole, $tasksrole, $mine, $restrictviewformytask, $isavailable, 0, $TWeek, $arrayfields);
669 //var_dump($totalforvisibletasks);
670
671 // Show total for all other tasks
672
673 // Calculate total for all tasks
674 $listofdistinctprojectid = array(); // List of all distinct projects
675 if (!empty($tasksarraywithoutfilter) && is_array($tasksarraywithoutfilter) && count($tasksarraywithoutfilter)) {
676 foreach ($tasksarraywithoutfilter as $tmptask) {
677 $listofdistinctprojectid[$tmptask->fk_project] = $tmptask->fk_project;
678 }
679 }
680 //var_dump($listofdistinctprojectid);
681 $totalforeachweek = array();
682 '@phan-var-force array<string,int> $totalforeachweek';
683
684 foreach ($listofdistinctprojectid as $tmpprojectid) {
685 $projectstatic->id = $tmpprojectid;
686 $projectstatic->loadTimeSpentMonth($firstdaytoshow, 0, $usertoprocess->id); // Load time spent from table element_time for the project into this->weekWorkLoad and this->weekWorkLoadPerTask for all days of a week
687 foreach ($TWeek as $weekNb) {
688 $totalforeachweek[$weekNb] += $projectstatic->monthWorkLoad[$weekNb];
689 }
690 }
691
692 //var_dump($totalforeachday);
693 //var_dump($totalforvisibletasks);
694
695 // Is there a diff between selected/filtered tasks and all tasks ?
696 $isdiff = 0;
697 if (count($totalforeachweek)) {
698 foreach ($TWeek as $weekNb) {
699 $timeonothertasks = ($totalforeachweek[$weekNb] - $totalforvisibletasks[$weekNb]);
700 if ($timeonothertasks) {
701 $isdiff = 1;
702 break;
703 }
704 }
705 }
706
707 // There is a diff between total shown on screen and total spent by user, so we add a line with all other cumulated time of user
708 if ($isdiff) {
709 print '<tr class="oddeven othertaskwithtime">';
710 print '<td colspan="'.$colspan.'" class="opacitymedium">';
711 print $langs->trans("OtherFilteredTasks");
712 print '</td>';
713 if (!empty($arrayfields['t.planned_workload']['checked'])) {
714 print '<td class="liste_total"></td>';
715 }
716 if (!empty($arrayfields['t.progress']['checked'])) {
717 print '<td class="liste_total"></td>';
718 }
719 if (!empty($arrayfields['timeconsumed']['checked'])) {
720 print '<td class="liste_total"></td>';
721 print '<td class="liste_total"></td>';
722 }
723 $j = 0;
724 foreach ($TWeek as $weekNb) {
725 $j++;
726 print '<td class="center hide'.($j <= 1 ? ' borderleft' : '').'">';
727
728 $timeonothertasks = ($totalforeachweek[$weekNb] - $totalforvisibletasks[$weekNb]);
729 if ($timeonothertasks) {
730 print '<span class="timesheetalreadyrecorded" title="texttoreplace"><input type="text" class="center smallpadd width40" disabled="" id="timespent[-1]['.$weekNb.']" name="task[-1]['.$weekNb.']" value="';
731 print convertSecondToTime($timeonothertasks, 'allhourmin');
732 print '"></span>';
733 }
734 print '</td>';
735 }
736 print ' <td class="liste_total"></td>';
737 print '</tr>';
738 }
739
740 if ($conf->use_javascript_ajax) {
741 print '<tr class="liste_total">';
742 print '<td class="liste_total" colspan="'.($colspan + $addcolspan).'">';
743 print $langs->trans("Total");
744 print '<span class="opacitymediumbycolor"> - '.$langs->trans("ExpectedWorkedHours").': <strong>'.price($usertoprocess->weeklyhours, 1, $langs, 0, 0).'</strong></span>';
745 print '</td>';
746 if (!empty($arrayfields['timeconsumed']['checked'])) {
747 print '<td class="liste_total"></td>';
748 print '<td class="liste_total"></td>';
749 }
750
751 $j = 0;
752 foreach ($TWeek as $weekNb) {
753 $j++;
754 print '<td class="liste_total hide'.$weekNb.' center'.($j <= 1 ? ' borderleft' : '').'"><div class="totalDay'.$weekNb.'">'.convertSecondToTime($totalforvisibletasks[$weekNb], 'allhourmin').'</div></td>';
755 }
756 print '<td class="liste_total center"><div class="totalDayAll">&nbsp;</div></td>
757 </tr>';
758 }
759
760 $THolidays = array();
761 $totaldayholiday = 0;
762 foreach ($TWeek as $weekNb) {
763 $weekstart = dol_stringtotime($year.$month.($TFirstDays[$weekNb]));
764 $weekend = dol_stringtotime($year.$month.$TLastDays[$weekNb]);
765 $filter = " AND cp.statut = ".((int) Holiday::STATUS_APPROVED);
766 $filter .= " AND ('".$db->idate($weekstart)."' BETWEEN cp.date_debut AND cp.date_fin";
767 $filter .= " OR '".$db->idate($weekend)."' BETWEEN cp.date_debut AND cp.date_fin)";
768 $holiday->fetchByUser($usertoprocess->id, '', $filter);
769 $THolidays[$weekNb] = array();
770 $THolidays[$weekNb]["ids"] = array();
771 $THolidays[$weekNb]["days"] = 0;
772 foreach ($holiday->holiday as $key => $h) {
773 if (!empty($THolidays[$weekNb]["ids"]) && in_array($h->rowid, $THolidays[$weekNb]["ids"])) {
774 continue;
775 }
776 $startweekholiday =(int) (($h["date_debut"] <= $weekstart) ? $weekstart : $h["date_debut"] );
777 $endweekholiday =(int) (($h["date_fin"] >= $weekend) ? $weekend : $h["date_fin"]);
778 $halfdays = (int) $h["halfday"];
779 $nbdays = num_open_day($startweekholiday, $endweekholiday, 0, 1, $halfdays);
780
781 $THolidays[$weekNb]["ids"][] = $h->rowid;
782 $THolidays[$weekNb]["days"] += $nbdays;
783 $totaldayholiday += $nbdays;
784 }
785 }
786
787 //Calculate nb holiday
788 print '<tr class="liste_total">';
789 print '<td class="liste_total" colspan="'.($colspan + $addcolspan).'">';
790 print $langs->trans("Total");
791 print '<span class="opacitymediumbycolor"> - '.$langs->trans("NbUseDaysCP").': <strong>'.price($totaldayholiday, 1, $langs, 0, 0).'</strong></span>';
792 print '</td>';
793 if (!empty($arrayfields['timeconsumed']['checked'])) {
794 print '<td class="liste_total"></td>';
795 print '<td class="liste_total"></td>';
796 }
797 $j = 0;
798 foreach ($TWeek as $weekNb) {
799 $j++;
800 print '<td class="liste_total_holidays '.($THolidays[$weekNb]["days"] > 0 ? "onholidayallday" : "").' hide'.$weekNb.' center'.($j <= 1 ? ' borderleft' : '').'"><div class="totalDay'.$weekNb.'holidays">'.$THolidays[$weekNb]["days"].'</div></td>';
801 }
802 print '<td class="liste_total_holidays center"><div class="totalDayAllHolidays">&nbsp;</div></td>
803 </tr>';
804} else {
805 print '<tr><td colspan="15"><span class="opacitymedium">'.$langs->trans("NoAssignedTasks").'</span></td></tr>';
806}
807print "</table>";
808print '</div>';
809
810print '<input type="hidden" id="numberOfLines" name="numberOfLines" value="'.count($tasksarray).'"/>'."\n";
811print '<input type="hidden" id="numberOfFirstLine" name="numberOfFirstLine" value="'.(reset($TWeek)).'"/>'."\n";
812
813print $form->buttonsSaveCancel("Save", '');
814
815print '</form>'."\n\n";
816
817$modeinput = 'hours';
818
819if ($conf->use_javascript_ajax) {
820 print "\n<!-- JS CODE TO ENABLE Tooltips on all object with class classfortooltip -->\n";
821 print '<script type="text/javascript">'."\n";
822 print "jQuery(document).ready(function () {\n";
823 print ' jQuery(".timesheetalreadyrecorded").tooltip({
824 show: { collision: "flipfit", effect:\'toggle\', delay:50 },
825 hide: { effect:\'toggle\', delay: 50 },
826 tooltipClass: "mytooltip",
827 content: function () {
828 return \''.dol_escape_js($langs->trans("TimeAlreadyRecorded", $usertoprocess->getFullName($langs))).'\';
829 }
830 });'."\n";
831
832 foreach ($TWeek as $week_number) {
833 print " updateTotal(".((int) $week_number).", '".dol_escape_js($modeinput)."');";
834 }
835 print "\n});\n";
836 print '</script>';
837}
838
839// End of page
840llxFooter();
841$db->close();
$id
Definition account.php:48
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:66
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.
Definition wrapper.php:71
Class to manage standard extra fields.
Class to build HTML component for third parties management Only common components are here.
Class to manage generation of HTML components Only common components must be here.
Class permettant la generation de composants html autre Only common components are here.
Class to manage building of HTML components.
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 tasks.
Class to manage Dolibarr users.
dol_get_prev_month($month, $year)
Return previous month.
Definition date.lib.php:519
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.
Definition date.lib.php:538
num_open_day($timestampStart, $timestampEnd, $inhour=0, $lastday=0, $halfday=0, $country_code='')
Function to return number of working days (and text of units) between two dates (working days)
dol_time_plus_duree($time, $duration_value, $duration_unit, $ruleforendofmonth=0)
Add a delay to a date.
Definition date.lib.php:125
convertSecondToTime($iSecond, $format='all', $lengthOfDay=86400, $lengthOfWeek=7)
Return, in clear text, value of a number of seconds in days, hours and minutes.
Definition date.lib.php:244
dol_stringtotime($string, $gm=1)
Convert a string date into a GM Timestamps date Warning: YYYY-MM-DDTHH:MM:SS+02:00 (RFC3339) is not s...
Definition date.lib.php:431
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.
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.
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...
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
Definition member.php:79
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.