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