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