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