dolibarr 21.0.0-alpha
perweek.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@inodbox.com>
5 * Copyright (C) 2010 François Legastelois <flegastelois@teclib.com>
6 * Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
7 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
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
39// Load translation files required by the page
40$langs->loadLangs(array('projects', 'users', 'companies'));
41
42$action = GETPOST('action', 'aZ09');
43$mode = GETPOST("mode", 'alpha');
44$id = GETPOSTINT('id');
45$taskid = GETPOSTINT('taskid');
46
47$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'timespent';
48
49$mine = 0;
50if ($mode == 'mine') {
51 $mine = 1;
52}
53
54$projectid = GETPOSTISSET("id") ? GETPOSTINT("id", 1) : GETPOSTINT("projectid");
55
56$hookmanager->initHooks(array('timesheetperweekcard'));
57
58// Security check
59$socid = 0;
60// For external user, no check is done on company because readability is managed by public status of project and assignment.
61// if ($user->socid > 0) $socid=$user->socid;
62$result = restrictedArea($user, 'projet', $projectid);
63
64$now = dol_now();
65
66$year = GETPOSTINT('reyear') ? GETPOSTINT('reyear') : (GETPOSTINT("year") ? GETPOSTINT("year") : date("Y"));
67$month = GETPOSTINT('remonth') ? GETPOSTINT('remonth') : (GETPOSTINT("month") ? GETPOSTINT("month") : date("m"));
68$day = GETPOSTINT('reday') ? GETPOSTINT('reday') : (GETPOSTINT("day") ? GETPOSTINT("day") : date("d"));
69$week = GETPOSTINT("week") ? GETPOSTINT("week") : date("W");
70
71$day = (int) $day;
72
73//$search_categ = GETPOST("search_categ", 'alpha');
74$search_usertoprocessid = GETPOSTINT('search_usertoprocessid');
75$search_task_ref = GETPOST('search_task_ref', 'alpha');
76$search_task_label = GETPOST('search_task_label', 'alpha');
77$search_project_ref = GETPOST('search_project_ref', 'alpha');
78$search_thirdparty = GETPOST('search_thirdparty', 'alpha');
79$search_declared_progress = GETPOST('search_declared_progress', 'alpha');
80
81$sortfield = GETPOST('sortfield', 'aZ09comma');
82$sortorder = GETPOST('sortorder', 'aZ09comma');
83
84$startdayarray = dol_get_first_day_week($day, $month, $year);
85
86$prev = $startdayarray;
87$prev_year = $prev['prev_year'];
88$prev_month = $prev['prev_month'];
89$prev_day = $prev['prev_day'];
90$first_day = $prev['first_day'];
91$first_month = $prev['first_month'];
92$first_year = $prev['first_year'];
93$week = $prev['week'];
94
95$next = dol_get_next_week($first_day, (int) $week, $first_month, $first_year);
96$next_year = $next['year'];
97$next_month = $next['month'];
98$next_day = $next['day'];
99
100// Define firstdaytoshow and lastdaytoshow (warning: lastdaytoshow is last second to show + 1)
101$firstdaytoshow = dol_mktime(0, 0, 0, $first_month, $first_day, $first_year);
102$firstdaytoshowgmt = dol_mktime(0, 0, 0, $first_month, $first_day, $first_year, 'gmt');
103
104if (empty($search_usertoprocessid) || $search_usertoprocessid == $user->id) {
105 $usertoprocess = $user;
106 $search_usertoprocessid = $usertoprocess->id;
107} elseif ($search_usertoprocessid > 0) {
108 $usertoprocess = new User($db);
109 $usertoprocess->fetch($search_usertoprocessid);
110 $search_usertoprocessid = $usertoprocess->id;
111} else {
112 $usertoprocess = new User($db);
113}
114
115$object = new Task($db);
116
117// Extra fields
118$extrafields = new ExtraFields($db);
119
120// fetch optionals attributes and labels
121$extrafields->fetch_name_optionals_label($object->table_element);
122
123// Definition of fields for list
124$arrayfields = array();
125/*$arrayfields=array(
126 // Project
127 'p.opp_amount'=>array('label'=>$langs->trans("OpportunityAmountShort"), 'checked'=>0, 'enabled'=>($conf->global->PROJECT_USE_OPPORTUNITIES?1:0), 'position'=>103),
128 'p.fk_opp_status'=>array('label'=>$langs->trans("OpportunityStatusShort"), 'checked'=>0, 'enabled'=>($conf->global->PROJECT_USE_OPPORTUNITIES?1:0), 'position'=>104),
129 'p.opp_percent'=>array('label'=>$langs->trans("OpportunityProbabilityShort"), 'checked'=>0, 'enabled'=>($conf->global->PROJECT_USE_OPPORTUNITIES?1:0), 'position'=>105),
130 'p.budget_amount'=>array('label'=>$langs->trans("Budget"), 'checked'=>0, 'position'=>110),
131 'p.usage_bill_time'=>array('label'=>$langs->trans("BillTimeShort"), 'checked'=>0, 'position'=>115),
132 );*/
133$arrayfields['t.planned_workload'] = array('label' => 'PlannedWorkload', 'checked' => 1, 'enabled' => 1, 'position' => 5);
134$arrayfields['t.progress'] = array('label' => 'ProgressDeclared', 'checked' => 1, 'enabled' => 1, 'position' => 10);
135$arrayfields['timeconsumed'] = array('label' => 'TimeConsumed', 'checked' => 1, 'enabled' => 1, 'position' => 15);
136/*foreach($object->fields as $key => $val)
137 {
138 // If $val['visible']==0, then we never show the field
139 if (!empty($val['visible'])) $arrayfields['t.'.$key]=array('label'=>$val['label'], 'checked'=>(($val['visible']<0)?0:1), 'enabled'=>$val['enabled'], 'position'=>$val['position']);
140 }*/
141// Definition of fields for list
142// Extra fields
143if (!empty($extrafields->attributes['projet_task']['label']) && is_array($extrafields->attributes['projet_task']['label']) && count($extrafields->attributes['projet_task']['label']) > 0) {
144 foreach ($extrafields->attributes['projet_task']['label'] as $key => $val) {
145 if (!empty($extrafields->attributes['projet_task']['list'][$key])) {
146 $arrayfields["efpt.".$key] = array('label' => $extrafields->attributes['projet_task']['label'][$key], 'checked' => (($extrafields->attributes['projet_task']['list'][$key] < 0) ? 0 : 1), 'position' => $extrafields->attributes['projet_task']['pos'][$key], 'enabled' => (abs((int) $extrafields->attributes['projet_task']['list'][$key]) != 3 && $extrafields->attributes['projet_task']['perms'][$key]));
147 }
148 }
149}
150$arrayfields = dol_sort_array($arrayfields, 'position');
151
152$search_array_options = array();
153$search_array_options_project = $extrafields->getOptionalsFromPost('projet', '', 'search_');
154$search_array_options_task = $extrafields->getOptionalsFromPost('projet_task', '', 'search_task_');
155
156$error = 0;
157
158
159/*
160 * Actions
161 */
162
163$parameters = array('id' => $id, 'taskid' => $taskid, 'projectid' => $projectid);
164$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
165if ($reshook < 0) {
166 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
167}
168// Purge criteria
169if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
170 $action = '';
171 //$search_categ = '';
172 $search_usertoprocessid = $user->id;
173 $search_task_ref = '';
174 $search_task_label = '';
175 $search_project_ref = '';
176 $search_thirdparty = '';
177 $search_declared_progress = '';
178
179 $search_array_options_project = array();
180 $search_array_options_task = array();
181
182 // We redefine $usertoprocess
183 $usertoprocess = $user;
184}
185if (GETPOST("button_search_x", 'alpha') || GETPOST("button_search.x", 'alpha') || GETPOST("button_search", 'alpha')) {
186 $action = '';
187}
188
189if (GETPOST('submitdateselect')) {
190 if (GETPOSTINT('remonth') && GETPOSTINT('reday') && GETPOSTINT('reyear')) {
191 $daytoparse = dol_mktime(0, 0, 0, GETPOSTINT('remonth'), GETPOSTINT('reday'), GETPOSTINT('reyear'));
192 }
193
194 $action = '';
195}
196
197include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
198
199if ($action == 'addtime' && $user->hasRight('projet', 'lire') && GETPOST('assigntask') && GETPOST('formfilteraction') != 'listafterchangingselectedfields') {
200 $action = 'assigntask';
201
202 if ($taskid > 0) {
203 $result = $object->fetch($taskid, $ref);
204 if ($result < 0) {
205 $error++;
206 }
207 } else {
208 setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired", $langs->transnoentitiesnoconv("Task")), null, 'errors');
209 $error++;
210 }
211 if (!GETPOST('type')) {
212 setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors');
213 $error++;
214 }
215
216 if (!$error) {
217 $idfortaskuser = $usertoprocess->id;
218 $result = $object->add_contact($idfortaskuser, GETPOST("type"), 'internal');
219
220 if ($result >= 0 || $result == -2) { // Contact add ok or already contact of task
221 // 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)
222 $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';
223 $sql .= ' AND ec.fk_socpeople = '.((int) $idfortaskuser)." AND ec.element_id = ".((int) $object->fk_project)." AND tc.element = 'project' AND source = 'internal'";
224 $resql = $db->query($sql);
225 if ($resql) {
226 $obj = $db->fetch_object($resql);
227 if (!$obj) { // User is not already linked to project, so we will create link to first type
228 $project = new Project($db);
229 $project->fetch($object->fk_project);
230 // Get type
231 $listofprojcontact = $project->liste_type_contact('internal');
232
233 if (count($listofprojcontact)) {
234 $tmparray = array_keys($listofprojcontact);
235 $typeforprojectcontact = reset($tmparray);
236 $result = $project->add_contact($idfortaskuser, $typeforprojectcontact, 'internal');
237 }
238 }
239 } else {
240 dol_print_error($db);
241 }
242 }
243 }
244
245 if ($result < 0) {
246 $error++;
247 if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
248 $langs->load("errors");
249 setEventMessages($langs->trans("ErrorTaskAlreadyAssigned"), null, 'warnings');
250 } else {
251 setEventMessages($object->error, $object->errors, 'errors');
252 }
253 }
254
255 if (!$error) {
256 setEventMessages("TaskAssignedToEnterTime", null);
257 $taskid = 0;
258 }
259
260 $action = '';
261}
262
263if ($action == 'addtime' && $user->hasRight('projet', 'lire') && GETPOST('formfilteraction') != 'listafterchangingselectedfields') {
264 $timetoadd = GETPOST('task');
265 if (empty($timetoadd)) {
266 setEventMessages($langs->trans("ErrorTimeSpentIsEmpty"), null, 'errors');
267 } else {
268 foreach ($timetoadd as $tmptaskid => $tmpvalue) { // Loop on each task
269 $updateoftaskdone = 0;
270 foreach ($tmpvalue as $key => $val) { // Loop on each day
271 $amountoadd = $timetoadd[$tmptaskid][$key];
272 if (!empty($amountoadd)) {
273 $tmpduration = explode(':', $amountoadd);
274 $newduration = 0;
275 if (!empty($tmpduration[0])) {
276 $newduration += (int) ((float) $tmpduration[0] * 3600);
277 }
278 if (!empty($tmpduration[1])) {
279 $newduration += (int) ((float) $tmpduration[1] * 60);
280 }
281 if (!empty($tmpduration[2])) {
282 $newduration += ((int) $tmpduration[2]);
283 }
284
285 if ($newduration > 0) {
286 $object->fetch($tmptaskid);
287
288 if (GETPOSTISSET($tmptaskid.'progress')) {
289 $object->progress = GETPOSTINT($tmptaskid.'progress');
290 } else {
291 unset($object->progress);
292 }
293
294 $object->timespent_duration = $newduration;
295 $object->timespent_fk_user = $usertoprocess->id;
296 $object->timespent_date = dol_time_plus_duree($firstdaytoshow, $key, 'd');
297 $object->timespent_datehour = $object->timespent_date;
298 $object->timespent_note = $object->description;
299
300 $result = $object->addTimeSpent($user);
301 if ($result < 0) {
302 setEventMessages($object->error, $object->errors, 'errors');
303 $error++;
304 break;
305 }
306
307 $updateoftaskdone++;
308 }
309 }
310 }
311
312 if (!$updateoftaskdone) { // Check to update progress if no update were done on task.
313 $object->fetch($tmptaskid);
314 //var_dump($object->progress);
315 //var_dump(GETPOST($tmptaskid . 'progress', 'int')); exit;
316 if ($object->progress != GETPOSTINT($tmptaskid.'progress')) {
317 $object->progress = GETPOSTINT($tmptaskid.'progress');
318 $result = $object->update($user);
319 if ($result < 0) {
320 setEventMessages($object->error, $object->errors, 'errors');
321 $error++;
322 break;
323 }
324 }
325 }
326 }
327
328 if (!$error) {
329 setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
330
331 $param = '';
332 $param .= ($mode ? '&mode='.urlencode($mode) : '');
333 $param .= ($projectid ? 'id='.urlencode((string) ($projectid)) : '');
334 $param .= ($search_usertoprocessid ? '&search_usertoprocessid='.urlencode((string) $search_usertoprocessid) : '');
335 $param .= ($day ? '&day='.urlencode((string) ($day)) : '').($month ? '&month='.urlencode((string) ($month)) : '').($year ? '&year='.urlencode((string) ($year)) : '');
336 $param .= ($search_project_ref ? '&search_project_ref='.urlencode($search_project_ref) : '');
337 $param .= ($search_usertoprocessid > 0 ? '&search_usertoprocessid='.urlencode((string) $search_usertoprocessid) : '');
338 $param .= ($search_thirdparty ? '&search_thirdparty='.urlencode($search_thirdparty) : '');
339 $param .= ($search_declared_progress ? '&search_declared_progress='.urlencode($search_declared_progress) : '');
340 $param .= ($search_task_ref ? '&search_task_ref='.urlencode($search_task_ref) : '');
341 $param .= ($search_task_label ? '&search_task_label='.urlencode($search_task_label) : '');
342
343 /*$search_array_options=$search_array_options_project;
344 $search_options_pattern='search_options_';
345 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
346 */
347
348 $search_array_options = $search_array_options_task;
349 $search_options_pattern = 'search_task_options_';
350 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
351
352 // Redirect to avoid submit twice on back
353 header('Location: '.$_SERVER["PHP_SELF"].'?'.$param);
354 exit;
355 }
356 }
357}
358
359
360/*
361 * View
362 */
363
364$form = new Form($db);
365$formother = new FormOther($db);
366$formcompany = new FormCompany($db);
367$formproject = new FormProjets($db);
368$projectstatic = new Project($db);
369$project = new Project($db);
370$taskstatic = new Task($db);
371$thirdpartystatic = new Societe($db);
372$holiday = new Holiday($db);
373
374$title = $langs->trans("TimeSpent");
375
376$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
377//var_dump($projectsListId);
378if ($id) {
379 $project->fetch($id);
380 $project->fetch_thirdparty();
381}
382
383$onlyopenedproject = 1; // or -1
384$morewherefilter = '';
385
386if ($search_project_ref) {
387 $morewherefilter .= natural_search(array("p.ref", "p.title"), $search_project_ref);
388}
389if ($search_task_ref) {
390 $morewherefilter .= natural_search("t.ref", $search_task_ref);
391}
392if ($search_task_label) {
393 $morewherefilter .= natural_search(array("t.ref", "t.label"), $search_task_label);
394}
395if ($search_thirdparty) {
396 $morewherefilter .= natural_search("s.nom", $search_thirdparty);
397}
398if ($search_declared_progress) {
399 $morewherefilter .= natural_search("t.progress", $search_declared_progress, 1);
400}
401
402$sql = &$morewherefilter;
403
404/*$search_array_options = $search_array_options_project;
405 $extrafieldsobjectprefix='efp.';
406 $search_options_pattern='search_options_';
407 $extrafieldsobjectkey='projet';
408 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
409 */
410$search_array_options = $search_array_options_task;
411$extrafieldsobjectprefix = 'efpt.';
412$search_options_pattern = 'search_task_options_';
413$extrafieldsobjectkey = 'projet_task';
414include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
415
416$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.
417$tasksarraywithoutfilter = array();
418if ($morewherefilter) { // Get all task without any filter, so we can show total of time spent for not visible tasks
419 $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.
420}
421$projectsrole = $taskstatic->getUserRolesForProjectsOrTasks($usertoprocess, null, ($project->id ? $project->id : 0), 0, $onlyopenedproject);
422$tasksrole = $taskstatic->getUserRolesForProjectsOrTasks(null, $usertoprocess, ($project->id ? $project->id : 0), 0, $onlyopenedproject);
423//var_dump($tasksarray);
424//var_dump($projectsrole);
425//var_dump($taskrole);
426
427
428llxHeader("", $title, "", '', 0, 0, array('/core/js/timesheet.js'), '', '', 'mod-project project-activity page-activity_perweek');
429
430//print_barre_liste($title, $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, "", $num, '', 'project');
431
432$param = '';
433$param .= ($mode ? '&mode='.urlencode($mode) : '');
434$param .= ($search_project_ref ? '&search_project_ref='.urlencode($search_project_ref) : '');
435$param .= ($search_usertoprocessid > 0 ? '&search_usertoprocessid='.urlencode((string) $search_usertoprocessid) : '');
436$param .= ($search_thirdparty ? '&search_thirdparty='.urlencode($search_thirdparty) : '');
437$param .= ($search_task_ref ? '&search_task_ref='.urlencode($search_task_ref) : '');
438$param .= ($search_task_label ? '&search_task_label='.urlencode($search_task_label) : '');
439
440$search_array_options = $search_array_options_project;
441$search_options_pattern = 'search_options_';
442include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
443
444$search_array_options = $search_array_options_task;
445$search_options_pattern = 'search_task_options_';
446include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
447
448// Show navigation bar
449$nav = '<a class="inline-block valignmiddle" href="?year='.$prev_year."&month=".$prev_month."&day=".$prev_day.$param.'">'.img_previous($langs->trans("Previous"))."</a>\n";
450$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";
451$nav .= '<a class="inline-block valignmiddle" href="?year='.$next_year."&month=".$next_month."&day=".$next_day.$param.'">'.img_next($langs->trans("Next"))."</a>\n";
452$nav .= ' '.$form->selectDate(-1, '', 0, 0, 2, "addtime", 1, ($conf->dol_optimize_smallscreen ? 0 : 1)).' ';
453$nav .= ' <button type="submit" name="submitdateselect" value="x" class="nobordertransp button_search_x"><span class="fa fa-search"></span></button>';
454
455$picto = 'clock';
456
457print '<form name="addtime" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
458print '<input type="hidden" name="token" value="'.newToken().'">';
459print '<input type="hidden" name="action" value="addtime">';
460print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
461print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
462print '<input type="hidden" name="mode" value="'.$mode.'">';
463print '<input type="hidden" name="day" value="'.$day.'">';
464print '<input type="hidden" name="month" value="'.$month.'">';
465print '<input type="hidden" name="year" value="'.$year.'">';
466
467$head = project_timesheet_prepare_head($mode, $usertoprocess);
468print dol_get_fiche_head($head, 'inputperweek', $langs->trans('TimeSpent'), -1, $picto);
469
470// Show description of content
471print '<div class="hideonsmartphone opacitymedium">';
472if ($mine || ($usertoprocess->id == $user->id)) {
473 print $langs->trans("MyTasksDesc").'.'.($onlyopenedproject ? ' '.$langs->trans("OnlyOpenedProject") : '').'<br>';
474} else {
475 if (empty($usertoprocess->id) || $usertoprocess->id < 0) {
476 if ($user->hasRight('projet', 'all', 'lire') && !$socid) {
477 print $langs->trans("ProjectsDesc").'.'.($onlyopenedproject ? ' '.$langs->trans("OnlyOpenedProject") : '').'<br>';
478 } else {
479 print $langs->trans("ProjectsPublicTaskDesc").'.'.($onlyopenedproject ? ' '.$langs->trans("OnlyOpenedProject") : '').'<br>';
480 }
481 }
482}
483if ($mine || ($usertoprocess->id == $user->id)) {
484 print $langs->trans("OnlyYourTaskAreVisible").'<br>';
485} else {
486 print $langs->trans("AllTaskVisibleButEditIfYouAreAssigned").'<br>';
487}
488print '</div>';
489
490print dol_get_fiche_end();
491
492print '<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.
493
494print '<div class="colorbacktimesheet valignmiddle'.($conf->dol_optimize_smallscreen ? ' center' : ' float').'">';
495$titleassigntask = $langs->transnoentities("AssignTaskToMe");
496if ($usertoprocess->id != $user->id) {
497 $titleassigntask = $langs->transnoentities("AssignTaskToUser", $usertoprocess->getFullName($langs));
498}
499print '<div class="taskiddiv inline-block">';
500print img_picto('', 'projecttask', 'class="pictofixedwidth"');
501$formproject->selectTasks($socid ? $socid : -1, $taskid, 'taskid', 32, 0, '-- '.$langs->trans("ChooseANotYetAssignedTask").' --', 1, 0, 0, 'widthcentpercentminusx', '', 'all', $usertoprocess);
502print '</div>';
503print ' ';
504print $formcompany->selectTypeContact($object, '', 'type', 'internal', 'position', 0, 'maxwidth150onsmartphone');
505print '<input type="submit" class="button valignmiddle smallonsmartphone small" name="assigntask" value="'.dol_escape_htmltag($titleassigntask).'">';
506print '</div>';
507
508print '<div class="clearboth" style="padding-bottom: 20px;"></div>';
509
510
511$startday = dol_mktime(12, 0, 0, $startdayarray['first_month'], $startdayarray['first_day'], $startdayarray['first_year']);
512
513$numendworkingday = 0;
514$numstartworkingday = 0;
515// Get if user is available or not for each day
516$isavailable = array();
517
518// Assume from Monday to Friday if conf empty or badly formed
519$numstartworkingday = 1;
520$numendworkingday = 5;
521
522if (getDolGlobalString('MAIN_DEFAULT_WORKING_DAYS')) {
523 $tmparray = explode('-', getDolGlobalString('MAIN_DEFAULT_WORKING_DAYS'));
524 if (count($tmparray) >= 2) {
525 $numstartworkingday = $tmparray[0];
526 $numendworkingday = $tmparray[1];
527 }
528}
529
530for ($idw = 0; $idw < 7; $idw++) {
531 $dayinloopfromfirstdaytoshow = dol_time_plus_duree($firstdaytoshow, $idw, 'd'); // $firstdaytoshow is a date with hours = 0
532 $dayinloopfromfirstdaytoshowgmt = dol_time_plus_duree($firstdaytoshowgmt, $idw, 'd'); // $firstdaytoshow is a date with hours = 0
533
534 $statusofholidaytocheck = Holiday::STATUS_APPROVED;
535
536 $isavailablefordayanduser = $holiday->verifDateHolidayForTimestamp($usertoprocess->id, $dayinloopfromfirstdaytoshow, $statusofholidaytocheck);
537 $isavailable[$dayinloopfromfirstdaytoshow] = $isavailablefordayanduser; // in projectLinesPerWeek later, we are using $firstdaytoshow and dol_time_plus_duree to loop on each day
538
539 $test = num_public_holiday($dayinloopfromfirstdaytoshowgmt, $dayinloopfromfirstdaytoshowgmt + 86400, $mysoc->country_code);
540 if ($test) {
541 $isavailable[$dayinloopfromfirstdaytoshow] = array('morning' => false, 'afternoon' => false, 'morning_reason' => 'public_holiday', 'afternoon_reason' => 'public_holiday');
542 }
543}
544
545
546
547$moreforfilter = '';
548
549// Filter on categories
550/*
551 if (isModEnabled("categorie")) {
552 require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
553 $moreforfilter.='<div class="divsearchfield">';
554 $moreforfilter.=$langs->trans('ProjectCategories'). ': ';
555 $moreforfilter.=$formother->select_categories('project', $search_categ, 'search_categ', 1, 1, 'maxwidth300');
556 $moreforfilter.='</div>';
557 }*/
558
559// If the user can view user other than himself
560$includeonly = 'hierarchyme';
561if (!$user->hasRight('user', 'user', 'lire')) {
562 $includeonly = array($user->id);
563}
564$selecteduser = $search_usertoprocessid ? $search_usertoprocessid : $usertoprocess->id;
565$moreforfiltertmp = $form->select_dolusers($selecteduser, 'search_usertoprocessid', 0, null, 0, $includeonly, '', 0, 0, 0, '', 0, '', 'maxwidth200');
566if ($form->num > 1 || empty($conf->dol_optimize_smallscreen)) {
567 $moreforfilter .= '<div class="divsearchfield">';
568 $moreforfilter .= '<div class="inline-block hideonsmartphone"></div>';
569 $moreforfilter .= img_picto($langs->trans('Filter').' '.$langs->trans('User'), 'user', 'class="paddingright pictofixedwidth"');
570 $moreforfilter .= $moreforfiltertmp;
571 $moreforfilter .= '</div>';
572} else {
573 $moreforfilter .= '<input type="hidden" name="search_usertoprocessid" value="'.$selecteduser.'">';
574}
575
576if (!getDolGlobalString('PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT')) {
577 $moreforfilter .= '<div class="divsearchfield">';
578 $moreforfilter .= '<div class="inline-block"></div>';
579 $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).'">';
580 $moreforfilter .= '</div>';
581
582 $moreforfilter .= '<div class="divsearchfield">';
583 $moreforfilter .= '<div class="inline-block"></div>';
584 $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).'">';
585 $moreforfilter .= '</div>';
586}
587
588if (!empty($moreforfilter)) {
589 print '<div class="liste_titre liste_titre_bydiv centpercent">';
590 print $moreforfilter;
591 $parameters = array();
592 $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
593 print $hookmanager->resPrint;
594 print '</div>';
595}
596
597
598$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
599
600$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
601
602// This must be after the $selectedfields
603$addcolspan = 0;
604if (!empty($arrayfields['t.planned_workload']['checked'])) {
605 $addcolspan++;
606}
607if (!empty($arrayfields['t.progress']['checked'])) {
608 $addcolspan++;
609}
610foreach ($arrayfields as $key => $val) {
611 if ($val['checked'] && substr($key, 0, 5) == 'efpt.') {
612 $addcolspan++;
613 }
614}
615
616print '<div class="div-table-responsive">';
617print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'" id="tablelines3">'."\n";
618
619print '<tr class="liste_titre_filter">';
620if (getDolGlobalString('PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT')) {
621 print '<td class="liste_titre"><input type="text" size="4" name="search_project_ref" value="'.dol_escape_htmltag($search_project_ref).'"></td>';
622}
623if (getDolGlobalString('PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT')) {
624 print '<td class="liste_titre"><input type="text" size="4" name="search_thirdparty" value="'.dol_escape_htmltag($search_thirdparty).'"></td>';
625}
626print '<td class="liste_titre"><input type="text" size="4" name="search_task_label" value="'.dol_escape_htmltag($search_task_label).'"></td>';
627// TASK fields
628$search_options_pattern = 'search_task_options_';
629$extrafieldsobjectkey = 'projet_task';
630$extrafieldsobjectprefix = 'efpt.';
631include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
632if (!empty($arrayfields['t.planned_workload']['checked'])) {
633 print '<td class="liste_titre"></td>';
634}
635if (!empty($arrayfields['t.progress']['checked'])) {
636 print '<td class="liste_titre right"><input type="text" size="4" name="search_declared_progress" value="'.dol_escape_htmltag($search_declared_progress).'"></td>';
637}
638if (!empty($arrayfields['timeconsumed']['checked'])) {
639 print '<td class="liste_titre"></td>';
640 print '<td class="liste_titre"></td>';
641}
642for ($idw = 0; $idw < 7; $idw++) {
643 print '<td class="liste_titre"></td>';
644}
645// Action column
646print '<td class="liste_titre nowrap right">';
647$searchpicto = $form->showFilterAndCheckAddButtons(0);
648print $searchpicto;
649print '</td>';
650print "</tr>\n";
651
652print '<tr class="liste_titre">';
653if (getDolGlobalString('PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT')) {
654 print '<th>'.$langs->trans("Project").'</th>';
655}
656if (getDolGlobalString('PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT')) {
657 print '<th>'.$langs->trans("ThirdParty").'</th>';
658}
659print '<th>'.$langs->trans("Task").'</th>';
660// TASK fields
661$extrafieldsobjectkey = 'projet_task';
662$extrafieldsobjectprefix = 'efpt.';
663include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
664if (!empty($arrayfields['t.planned_workload']['checked'])) {
665 print '<th class="leftborder plannedworkload minwidth75 maxwidth100 right" title="'.dol_escape_htmltag($langs->trans("PlannedWorkload")).'">'.$form->textwithpicto($langs->trans("PlannedWorkloadShort"), $langs->trans("PlannedWorkload")).'</th>';
666}
667if (!empty($arrayfields['t.progress']['checked'])) {
668 print '<th class="right minwidth75 maxwidth100" title="'.dol_escape_htmltag($langs->trans("ProgressDeclared")).'">'.$langs->trans("ProgressDeclared").'</th>';
669}
670if (!empty($arrayfields['timeconsumed']['checked'])) {
671 print '<th class="right maxwidth100">'.$langs->trans("TimeSpentSmall").'<br>';
672 print '<span class="nowraponall">';
673 print '<span class="opacitymedium nopadding userimg"><img alt="Photo" class="photouserphoto userphoto" src="'.DOL_URL_ROOT.'/theme/common/everybody.png"></span>';
674 print '<span class="opacitymedium paddingleft">'.$langs->trans("EverybodySmall").'</span>';
675 print '</span>';
676 print '</th>';
677 print '<th 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>' : '').'</th>';
678}
679for ($idw = 0; $idw < 7; $idw++) {
680 $dayinloopfromfirstdaytoshow = dol_time_plus_duree($firstdaytoshow, $idw, 'd'); // $firstdaytoshow is a date with hours = 0
681
682 $cssweekend = '';
683 if ((($idw + 1) < $numstartworkingday) || (($idw + 1) > $numendworkingday)) { // This is a day is not inside the setup of working days, so we use a week-end css.
684 $cssweekend = 'weekend';
685 }
686
687 $tmpday = dol_time_plus_duree($firstdaytoshow, $idw, 'd');
688
689 $cssonholiday = '';
690 if (!$isavailable[$tmpday]['morning'] && !$isavailable[$tmpday]['afternoon']) {
691 $cssonholiday .= 'onholidayallday ';
692 } elseif (!$isavailable[$tmpday]['morning']) {
693 $cssonholiday .= 'onholidaymorning ';
694 } elseif (!$isavailable[$tmpday]['afternoon']) {
695 $cssonholiday .= 'onholidayafternoon ';
696 }
697
698 $year = (int) dol_print_date($dayinloopfromfirstdaytoshow, '%Y');
699 $month = (int) dol_print_date($dayinloopfromfirstdaytoshow, '%m');
700 $day = (int) dol_print_date($dayinloopfromfirstdaytoshow, '%d');
701
702 print '<th width="6%" class="center bold hide'.$idw.($cssonholiday ? ' '.$cssonholiday : '').($cssweekend ? ' '.$cssweekend : '').'">';
703 print '<a href="'.DOL_URL_ROOT.'/projet/activity/perday.php?year='.$year.'&month='.$month.'&day='.$day.'">';
704 print dol_print_date($dayinloopfromfirstdaytoshow, '%a');
705 print '<br>'.dol_print_date($dayinloopfromfirstdaytoshow, 'dayreduceformat').'</a></th>';
706}
707
708//print '<td></td>';
709print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
710
711print "</tr>\n";
712
713$colspan = 1 + (!getDolGlobalString('PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT') ? 0 : 2);
714
715// Show lines with total
716if ($conf->use_javascript_ajax && count($tasksarray) >= getDolGlobalInt('NBLINES_TO_DUPLICATE_TOTAL_TIMESPENT_ON_TOP', 10)) {
717 print '<tr class="liste_total hideonsmartphone">';
718 print '<td class="liste_total" colspan="'.($colspan + $addcolspan).'">';
719 print $langs->trans("Total");
720 $htmltooltip = $langs->trans("ExpectedWorkedHours").': <strong>'.price($usertoprocess->weeklyhours, 1, $langs, 0, 0);
721 print '<span class="opacitymediumbycolor"> <div class="totalDayAll inline-block bold">&nbsp;</div> '.($usertoprocess->weeklyhours ? ' / '.$form->textwithpicto(price($usertoprocess->weeklyhours, 1, $langs, 0, 0), $htmltooltip) : '').'</strong></span>';
722 print '</td>';
723 if (!empty($arrayfields['timeconsumed']['checked'])) {
724 print '<td class="liste_total"></td>';
725 print '<td class="liste_total"></td>';
726 }
727 for ($idw = 0; $idw < 7; $idw++) {
728 $cssweekend = '';
729 if ((($idw + 1) < $numstartworkingday) || (($idw + 1) > $numendworkingday)) { // This is a day is not inside the setup of working days, so we use a week-end css.
730 $cssweekend = 'weekend';
731 }
732
733 $tmpday = dol_time_plus_duree($firstdaytoshow, $idw, 'd');
734
735 $cssonholiday = '';
736 if (!$isavailable[$tmpday]['morning'] && !$isavailable[$tmpday]['afternoon']) {
737 $cssonholiday .= 'onholidayallday ';
738 } elseif (!$isavailable[$tmpday]['morning']) {
739 $cssonholiday .= 'onholidaymorning ';
740 } elseif (!$isavailable[$tmpday]['afternoon']) {
741 $cssonholiday .= 'onholidayafternoon ';
742 }
743 print '<td class="liste_total center hide'.$idw.($cssonholiday ? ' '.$cssonholiday : '').($cssweekend ? ' '.$cssweekend : '').'"><div class="totalDay'.$idw.'">&nbsp;</div></td>';
744 }
745 print '<td class="liste_total center"></td>';
746 print '</tr>';
747}
748
749
750
751// By default, we can edit only tasks we are assigned to
752$restrictviewformytask = getDolGlobalInt('PROJECT_TIME_SHOW_TASK_NOT_ASSIGNED', 2);
753
754if (count($tasksarray) > 0) {
755 //var_dump($tasksarray); // contains only selected tasks
756 //var_dump($tasksarraywithoutfilter); // contains all tasks (if there is a filter, not defined if no filter)
757 //var_dump($tasksrole);
758
759 $j = 0;
760 $level = 0;
761 $totalforvisibletasks = projectLinesPerWeek($j, $firstdaytoshow, $usertoprocess, 0, $tasksarray, $level, $projectsrole, $tasksrole, $mine, $restrictviewformytask, $isavailable, 0, $arrayfields, $extrafields);
762 //var_dump($totalforvisibletasks);
763
764 // Show total for all other tasks
765
766 // Calculate total for all tasks
767 $listofdistinctprojectid = array(); // List of all distinct projects
768 if (!empty($tasksarraywithoutfilter) && is_array($tasksarraywithoutfilter) && count($tasksarraywithoutfilter)) {
769 foreach ($tasksarraywithoutfilter as $tmptask) {
770 $listofdistinctprojectid[$tmptask->fk_project] = $tmptask->fk_project;
771 }
772 }
773 //var_dump($listofdistinctprojectid);
774 $totalforeachday = array();
775 foreach ($listofdistinctprojectid as $tmpprojectid) {
776 $projectstatic->id = $tmpprojectid;
777 $projectstatic->loadTimeSpent($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
778 for ($idw = 0; $idw < 7; $idw++) {
779 $tmpday = dol_time_plus_duree($firstdaytoshow, $idw, 'd');
780 if (empty($totalforeachday[$tmpday])) {
781 $totalforeachday[$tmpday] = empty($projectstatic->weekWorkLoad[$tmpday]) ? 0 : $projectstatic->weekWorkLoad[$tmpday];
782 } else {
783 $totalforeachday[$tmpday] += empty($projectstatic->weekWorkLoad[$tmpday]) ? 0 : $projectstatic->weekWorkLoad[$tmpday];
784 }
785 }
786 }
787
788 //var_dump($totalforeachday);
789 //var_dump($totalforvisibletasks);
790
791 // Is there a diff between selected/filtered tasks and all tasks ?
792 $isdiff = 0;
793 if (count($totalforeachday)) {
794 for ($idw = 0; $idw < 7; $idw++) {
795 $tmpday = dol_time_plus_duree($firstdaytoshow, $idw, 'd');
796 $timeonothertasks = ($totalforeachday[$tmpday] - $totalforvisibletasks[$tmpday]);
797 if ($timeonothertasks) {
798 $isdiff = 1;
799 break;
800 }
801 }
802 }
803
804 // 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
805 if ($isdiff) {
806 print '<tr class="oddeven othertaskwithtime">';
807 print '<td colspan="'.($colspan + $addcolspan).'" class="opacitymedium">';
808 print $langs->trans("OtherFilteredTasks");
809 print '</td>';
810 if (!empty($arrayfields['timeconsumed']['checked'])) {
811 print '<td class="liste_total"></td>';
812 print '<td class="liste_total"></td>';
813 }
814 $j = 0;
815 for ($idw = 0; $idw < 7; $idw++) {
816 $j++;
817 $cssweekend = '';
818 if ((($idw + 1) < $numstartworkingday) || (($idw + 1) > $numendworkingday)) { // This is a day is not inside the setup of working days, so we use a week-end css.
819 $cssweekend = 'weekend';
820 }
821
822 print '<td class="center hide'.$idw.' '.($cssweekend ? ' '.$cssweekend : '').($j <= 1 ? ' borderleft' : '').'">';
823 $tmpday = dol_time_plus_duree($firstdaytoshow, $idw, 'd');
824 $timeonothertasks = ($totalforeachday[$tmpday] - $totalforvisibletasks[$tmpday]);
825 if ($timeonothertasks) {
826 print '<span class="timesheetalreadyrecorded" title="texttoreplace"><input type="text" class="center smallpadd width40" disabled="" id="timespent[-1]['.$idw.']" name="task[-1]['.$idw.']" value="';
827 print convertSecondToTime($timeonothertasks, 'allhourmin');
828 print '"></span>';
829 }
830 print '</td>';
831 }
832 print ' <td class="liste_total"></td>';
833 print '</tr>';
834 }
835
836 if ($conf->use_javascript_ajax) {
837 print '<tr class="liste_total">';
838 print '<td class="liste_total" colspan="'.($colspan + $addcolspan).'">';
839 print $langs->trans("Total");
840 $htmltooltip = $langs->trans("ExpectedWorkedHours").': <strong>'.price($usertoprocess->weeklyhours, 1, $langs, 0, 0);
841 print '<span class="opacitymediumbycolor"> <div class="totalDayAll inline-block bold">&nbsp;</div> '.($usertoprocess->weeklyhours ? ' / '.$form->textwithpicto(price($usertoprocess->weeklyhours, 1, $langs, 0, 0), $htmltooltip) : '').'</strong></span>';
842 print '</td>';
843 if (!empty($arrayfields['timeconsumed']['checked'])) {
844 print '<td class="liste_total"></td>';
845 print '<td class="liste_total"></td>';
846 }
847
848 $j = 0;
849 for ($idw = 0; $idw < 7; $idw++) {
850 $j++;
851 $cssweekend = '';
852 if ((($idw + 1) < $numstartworkingday) || (($idw + 1) > $numendworkingday)) { // This is a day is not inside the setup of working days, so we use a week-end css.
853 $cssweekend = 'weekend';
854 }
855
856 $tmpday = dol_time_plus_duree($firstdaytoshow, $idw, 'd');
857
858 $cssonholiday = '';
859 if (!$isavailable[$tmpday]['morning'] && !$isavailable[$tmpday]['afternoon']) {
860 $cssonholiday .= 'onholidayallday ';
861 } elseif (!$isavailable[$tmpday]['morning']) {
862 $cssonholiday .= 'onholidaymorning ';
863 } elseif (!$isavailable[$tmpday]['afternoon']) {
864 $cssonholiday .= 'onholidayafternoon ';
865 }
866
867 print '<td class="liste_total center hide'.$idw.($cssonholiday ? ' '.$cssonholiday : '').($cssweekend ? ' '.$cssweekend : '').($j <= 1 ? ' borderleft' : '').'"><div class="totalDay'.$idw.'">&nbsp;</div></td>';
868 }
869 print '<td class="liste_total center"></td>';
870 print '</tr>';
871 }
872} else {
873 print '<tr><td colspan="15"><span class="opacitymedium">'.$langs->trans("NoAssignedTasks").'</span></td></tr>';
874}
875print "</table>";
876print '</div>';
877
878print '<input type="hidden" id="numberOfLines" name="numberOfLines" value="'.count($tasksarray).'"/>'."\n";
879
880print $form->buttonsSaveCancel("Save", '');
881
882print '</form>'."\n\n";
883
884$modeinput = 'hours';
885
886if ($conf->use_javascript_ajax) {
887 print "\n<!-- JS CODE TO ENABLE Tooltips on all object with class classfortooltip -->\n";
888 print '<script type="text/javascript">'."\n";
889 print "jQuery(document).ready(function () {\n";
890 print ' jQuery(".timesheetalreadyrecorded").tooltip({
891 show: { collision: "flipfit", effect:\'toggle\', delay:50 },
892 hide: { effect:\'toggle\', delay: 50 },
893 tooltipClass: "mytooltip",
894 content: function () {
895 return \''.dol_escape_js($langs->trans("TimeAlreadyRecorded", $usertoprocess->getFullName($langs))).'\';
896 }
897 });'."\n";
898
899 $idw = 0;
900 while ($idw < 7) {
901 print " updateTotal(".((int) $idw).", '".dol_escape_js($modeinput)."');";
902 $idw++;
903 }
904 print "\n});\n";
905 print '</script>';
906}
907
908// End of page
909llxFooter();
910$db->close();
$id
Definition account.php:39
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:58
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:70
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_next_week($day, $week, $month, $year)
Return next week.
Definition date.lib.php:574
dol_get_first_day_week($day, $month, $year, $gm=false)
Return first day of week for a date.
Definition date.lib.php:671
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:242
num_public_holiday($timestampStart, $timestampEnd, $country_code='', $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 ...
Definition date.lib.php:765
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_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
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...
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.
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.