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