dolibarr  16.0.5
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 Frédéric France <frederic.france@netlogic.fr>
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <https://www.gnu.org/licenses/>.
20  */
21 
28 require "../../main.inc.php";
29 require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
30 require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
31 require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
32 require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
33 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
34 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
35 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
36 require_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php';
37 
38 // Load translation files required by the page
39 $langs->loadLangs(array('projects', 'users', 'companies'));
40 
41 $action = GETPOST('action', 'aZ09');
42 $mode = GETPOST("mode", 'alpha');
43 $id = GETPOST('id', 'int');
44 $taskid = GETPOST('taskid', 'int');
45 
46 $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'perdaycard';
47 
48 $mine = 0;
49 if ($mode == 'mine') {
50  $mine = 1;
51 }
52 
53 $projectid = GETPOSTISSET("id") ? GETPOST("id", "int", 1) : GETPOST("projectid", "int");
54 
55 $hookmanager->initHooks(array('timesheetperdaycard'));
56 
57 // Security check
58 $socid = 0;
59 // For external user, no check is done on company because readability is managed by public status of project and assignement.
60 //if ($user->socid > 0) $socid=$user->socid;
61 $result = restrictedArea($user, 'projet', $projectid);
62 
63 $now = dol_now();
64 
65 $year = GETPOST('reyear', 'int') ?GETPOST('reyear', 'int') : (GETPOST("year", "int") ?GETPOST("year", "int") : (GETPOST("addtimeyear", "int") ?GETPOST("addtimeyear", "int") : date("Y")));
66 $month = GETPOST('remonth', 'int') ?GETPOST('remonth', 'int') : (GETPOST("month", "int") ?GETPOST("month", "int") : (GETPOST("addtimemonth", "int") ?GETPOST("addtimemonth", "int") : date("m")));
67 $day = GETPOST('reday', 'int') ?GETPOST('reday', 'int') : (GETPOST("day", "int") ?GETPOST("day", "int") : (GETPOST("addtimeday", "int") ?GETPOST("addtimeday", "int") : date("d")));
68 $week = GETPOST("week", "int") ?GETPOST("week", "int") : date("W");
69 
70 $day = (int) $day;
71 
72 //$search_categ = GETPOST("search_categ", 'alpha');
73 $search_usertoprocessid = GETPOST('search_usertoprocessid', 'int');
74 $search_task_ref = GETPOST('search_task_ref', 'alpha');
75 $search_task_label = GETPOST('search_task_label', 'alpha');
76 $search_project_ref = GETPOST('search_project_ref', 'alpha');
77 $search_thirdparty = GETPOST('search_thirdparty', 'alpha');
78 $search_declared_progress = GETPOST('search_declared_progress', 'alpha');
79 
80 $sortfield = GETPOST('sortfield', 'aZ09comma');
81 $sortorder = GETPOST('sortorder', 'aZ09comma');
82 
83 $monthofday = GETPOST('addtimemonth');
84 $dayofday = GETPOST('addtimeday');
85 $yearofday = GETPOST('addtimeyear');
86 
87 //var_dump(GETPOST('remonth'));
88 //var_dump(GETPOST('button_search_x'));
89 //var_dump(GETPOST('button_addtime'));
90 
91 $daytoparse = $now;
92 if ($year && $month && $day) {
93  $daytoparse = dol_mktime(0, 0, 0, $month, $day, $year); // this are value submited after submit of action 'submitdateselect'
94 } elseif ($yearofday && $monthofday && $dayofday) {
95  $daytoparse = dol_mktime(0, 0, 0, $monthofday, $dayofday, $yearofday); // xxxofday is value of day after submit action 'addtime'
96 }
97 
98 $daytoparsegmt = dol_now('gmt');
99 if ($yearofday && $monthofday && $dayofday) $daytoparsegmt = dol_mktime(0, 0, 0, $monthofday, $dayofday, $yearofday, 'gmt'); // xxxofday is value of day after submit action 'addtime'
100 elseif ($year && $month && $day) $daytoparsegmt = dol_mktime(0, 0, 0, $month, $day, $year, 'gmt'); // this are value submited after submit of action 'submitdateselect'
101 
102 if (empty($search_usertoprocessid) || $search_usertoprocessid == $user->id) {
103  $usertoprocess = $user;
104  $search_usertoprocessid = $usertoprocess->id;
105 } elseif ($search_usertoprocessid > 0) {
106  $usertoprocess = new User($db);
107  $usertoprocess->fetch($search_usertoprocessid);
108  $search_usertoprocessid = $usertoprocess->id;
109 } else {
110  $usertoprocess = new User($db);
111 }
112 
113 $object = new Task($db);
114 $project = new Project($db);
115 
116 // Extra fields
117 $extrafields = new ExtraFields($db);
118 
119 // fetch optionals attributes and labels
120 $extrafields->fetch_name_optionals_label($object->table_element);
121 
122 // Definition of fields for list
123 $arrayfields = array();
124 $arrayfields['t.planned_workload'] = array('label'=>'PlannedWorkload', 'checked'=>1, 'enabled'=>1, 'position'=>0);
125 $arrayfields['t.progress'] = array('label'=>'ProgressDeclared', 'checked'=>1, 'enabled'=>1, 'position'=>0);
126 $arrayfields['timeconsumed'] = array('label'=>'TimeConsumed', 'checked'=>1, 'enabled'=>1, 'position'=>15);
127 /*$arrayfields=array(
128  // Project
129  'p.opp_amount'=>array('label'=>$langs->trans("OpportunityAmountShort"), 'checked'=>0, 'enabled'=>($conf->global->PROJECT_USE_OPPORTUNITIES?1:0), 'position'=>103),
130  'p.fk_opp_status'=>array('label'=>$langs->trans("OpportunityStatusShort"), 'checked'=>0, 'enabled'=>($conf->global->PROJECT_USE_OPPORTUNITIES?1:0), 'position'=>104),
131  'p.opp_percent'=>array('label'=>$langs->trans("OpportunityProbabilityShort"), 'checked'=>0, 'enabled'=>($conf->global->PROJECT_USE_OPPORTUNITIES?1:0), 'position'=>105),
132  'p.budget_amount'=>array('label'=>$langs->trans("Budget"), 'checked'=>0, 'position'=>110),
133  'p.usage_bill_time'=>array('label'=>$langs->trans("BillTimeShort"), 'checked'=>0, 'position'=>115),
134  );
135  */
136 // Extra fields
137 if (!empty($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) {
138  foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
139  if (!empty($extrafields->attributes[$object->table_element]['list'][$key])) {
140  $arrayfields["efpt.".$key] = array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs((int) $extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key]));
141  }
142  }
143 }
144 $arrayfields = dol_sort_array($arrayfields, 'position');
145 
146 
147 $search_array_options_project = $extrafields->getOptionalsFromPost($project->table_element, '', 'search_');
148 $search_array_options_task = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_task_');
149 
150 
151 /*
152  * Actions
153  */
154 
155 $parameters = array('id' => $id, 'taskid' => $taskid, 'projectid' => $projectid);
156 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
157 if ($reshook < 0) {
158  setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
159 }
160 // Purge criteria
161 if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
162  $action = '';
163  //$search_categ = '';
164  $search_usertoprocessid = $user->id;
165  $search_task_ref = '';
166  $search_task_label = '';
167  $search_project_ref = '';
168  $search_thirdparty = '';
169  $search_declared_progress = '';
170 
171  $search_array_options_project = array();
172  $search_array_options_task = array();
173 
174  // We redefine $usertoprocess
175  $usertoprocess = $user;
176 }
177 if (GETPOST("button_search_x", 'alpha') || GETPOST("button_search.x", 'alpha') || GETPOST("button_search", 'alpha')) {
178  $action = '';
179 }
180 
181 if (GETPOST('submitdateselect')) {
182  if (GETPOST('remonth', 'int') && GETPOST('reday', 'int') && GETPOST('reyear', 'int')) {
183  $daytoparse = dol_mktime(0, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
184  }
185 
186  $action = '';
187 }
188 
189 include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
190 
191 if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('assigntask') && GETPOST('formfilteraction') != 'listafterchangingselectedfields') {
192  $action = 'assigntask';
193 
194  if ($taskid > 0) {
195  $result = $object->fetch($taskid, $ref);
196  if ($result < 0) {
197  $error++;
198  }
199  } else {
200  setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired", $langs->transnoentitiesnoconv("Task")), '', 'errors');
201  $error++;
202  }
203  if (!GETPOST('type')) {
204  setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), '', 'errors');
205  $error++;
206  }
207  if (!$error) {
208  $idfortaskuser = $usertoprocess->id;
209  $result = $object->add_contact($idfortaskuser, GETPOST("type"), 'internal');
210 
211  if ($result >= 0 || $result == -2) { // Contact add ok or already contact of task
212  // 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)
213  $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';
214  $sql .= ' AND ec.fk_socpeople = '.((int) $idfortaskuser)." AND ec.element_id = ".((int) $object->fk_project)." AND tc.element = 'project' AND source = 'internal'";
215  $resql = $db->query($sql);
216  if ($resql) {
217  $obj = $db->fetch_object($resql);
218  if (!$obj) { // User is not already linked to project, so we will create link to first type
219  $project = new Project($db);
220  $project->fetch($object->fk_project);
221  // Get type
222  $listofprojcontact = $project->liste_type_contact('internal');
223 
224  if (count($listofprojcontact)) {
225  $typeforprojectcontact = reset(array_keys($listofprojcontact));
226  $result = $project->add_contact($idfortaskuser, $typeforprojectcontact, 'internal');
227  }
228  }
229  } else {
230  dol_print_error($db);
231  }
232  }
233  }
234 
235  if ($result < 0) {
236  $error++;
237  if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
238  $langs->load("errors");
239  setEventMessages($langs->trans("ErrorTaskAlreadyAssigned"), null, 'warnings');
240  } else {
241  setEventMessages($object->error, $object->errors, 'errors');
242  }
243  }
244 
245  if (!$error) {
246  setEventMessages("TaskAssignedToEnterTime", null);
247  $taskid = 0;
248  }
249 
250  $action = '';
251 }
252 
253 if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('formfilteraction') != 'listafterchangingselectedfields') {
254  $timespent_duration = array();
255 
256  if (is_array($_POST)) {
257  foreach ($_POST as $key => $time) {
258  if (intval($time) > 0) {
259  $matches = array();
260  // Hours or minutes of duration
261  if (preg_match("/([0-9]+)duration(hour|min)/", $key, $matches)) {
262  $id = $matches[1];
263  if ($id > 0) {
264  // We store HOURS in seconds
265  if ($matches[2] == 'hour') {
266  $timespent_duration[$id] += $time * 60 * 60;
267  }
268 
269  // We store MINUTES in seconds
270  if ($matches[2] == 'min') {
271  $timespent_duration[$id] += $time * 60;
272  }
273  }
274  }
275  }
276  }
277  }
278 
279  if (count($timespent_duration) > 0) {
280  foreach ($timespent_duration as $key => $val) {
281  $object->fetch($key);
282  $taskid = $object->id;
283 
284  if (GETPOSTISSET($taskid.'progress')) {
285  $object->progress = GETPOST($taskid.'progress', 'int');
286  } else {
287  unset($object->progress);
288  }
289 
290  $object->timespent_duration = $val;
291  $object->timespent_fk_user = $usertoprocess->id;
292  $object->timespent_note = GETPOST($key.'note');
293  if (GETPOST($key."hour", 'int') != '' && GETPOST($key."hour", 'int') >= 0) { // If hour was entered
294  $object->timespent_datehour = dol_mktime(GETPOST($key."hour", 'int'), GETPOST($key."min", 'int'), 0, $monthofday, $dayofday, $yearofday);
295  $object->timespent_withhour = 1;
296  } else {
297  $object->timespent_datehour = dol_mktime(12, 0, 0, $monthofday, $dayofday, $yearofday);
298  }
299  $object->timespent_date = $object->timespent_datehour;
300 
301  if ($object->timespent_date > 0) {
302  $result = $object->addTimeSpent($user);
303  } else {
304  setEventMessages("ErrorBadDate", null, 'errors');
305  $error++;
306  break;
307  }
308 
309  if ($result < 0) {
310  setEventMessages($object->error, $object->errors, 'errors');
311  $error++;
312  break;
313  }
314  }
315 
316  if (!$error) {
317  setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
318 
319  // Redirect to avoid submit twice on back
320  header('Location: '.$_SERVER["PHP_SELF"].'?'.($projectid ? 'id='.$projectid : '').($search_usertoprocessid ? '&search_usertoprocessid='.urlencode($search_usertoprocessid) : '').($mode ? '&mode='.$mode : '').'&year='.$yearofday.'&month='.$monthofday.'&day='.$dayofday);
321  exit;
322  }
323  } else {
324  setEventMessages($langs->trans("ErrorTimeSpentIsEmpty"), null, 'errors');
325  }
326 }
327 
328 
329 
330 /*
331  * View
332  */
333 
334 $form = new Form($db);
335 $formother = new FormOther($db);
336 $formcompany = new FormCompany($db);
337 $formproject = new FormProjets($db);
338 $projectstatic = new Project($db);
339 $project = new Project($db);
340 $taskstatic = new Task($db);
341 $thirdpartystatic = new Societe($db);
342 $holiday = new Holiday($db);
343 
344 $prev = dol_getdate($daytoparse - (24 * 3600));
345 $prev_year = $prev['year'];
346 $prev_month = $prev['mon'];
347 $prev_day = $prev['mday'];
348 
349 $next = dol_getdate($daytoparse + (24 * 3600));
350 $next_year = $next['year'];
351 $next_month = $next['mon'];
352 $next_day = $next['mday'];
353 
354 $title = $langs->trans("TimeSpent");
355 
356 $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
357 
358 if ($id) {
359  $project->fetch($id);
360  $project->fetch_thirdparty();
361 }
362 
363 $onlyopenedproject = 1; // or -1
364 $morewherefilter = '';
365 
366 if ($search_project_ref) {
367  $morewherefilter .= natural_search(array("p.ref", "p.title"), $search_project_ref);
368 }
369 if ($search_task_ref) {
370  $morewherefilter .= natural_search("t.ref", $search_task_ref);
371 }
372 if ($search_task_label) {
373  $morewherefilter .= natural_search(array("t.ref", "t.label"), $search_task_label);
374 }
375 if ($search_thirdparty) {
376  $morewherefilter .= natural_search("s.nom", $search_thirdparty);
377 }
378 if ($search_declared_progress) {
379  $morewherefilter .= natural_search("t.progress", $search_declared_progress, 1);
380 }
381 
382 $sql = &$morewherefilter;
383 
384 /*$search_array_options = $search_array_options_project;
385 $extrafieldsobjectprefix='efp.';
386 $search_options_pattern='search_options_';
387 $extrafieldsobjectkey='projet';
388 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
389 */
390 $search_array_options = $search_array_options_task;
391 $extrafieldsobjectprefix = 'efpt.';
392 $search_options_pattern = 'search_task_options_';
393 $extrafieldsobjectkey = 'projet_task';
394 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
395 
396 $tasksarray = $taskstatic->getTasksArray(0, 0, ($project->id ? $project->id : 0), $socid, 0, $search_project_ref, $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.
397 if ($morewherefilter) { // Get all task without any filter, so we can show total of time spent for not visible tasks
398  $tasksarraywithoutfilter = $taskstatic->getTasksArray(0, 0, ($project->id ? $project->id : 0), $socid, 0, '', $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.
399 }
400 $projectsrole = $taskstatic->getUserRolesForProjectsOrTasks($usertoprocess, 0, ($project->id ? $project->id : 0), 0, $onlyopenedproject);
401 $tasksrole = $taskstatic->getUserRolesForProjectsOrTasks(0, $usertoprocess, ($project->id ? $project->id : 0), 0, $onlyopenedproject);
402 //var_dump($usertoprocess);
403 //var_dump($projectsrole);
404 //var_dump($taskrole);
405 
406 llxHeader("", $title, "", '', '', '', array('/core/js/timesheet.js'));
407 
408 //print_barre_liste($title, $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, "", $num, '', 'project');
409 
410 $param = '';
411 $param .= ($mode ? '&mode='.urlencode($mode) : '');
412 $param .= ($search_project_ref ? '&search_project_ref='.urlencode($search_project_ref) : '');
413 $param .= ($search_usertoprocessid > 0 ? '&search_usertoprocessid='.urlencode($search_usertoprocessid) : '');
414 $param .= ($search_thirdparty ? '&search_thirdparty='.urlencode($search_thirdparty) : '');
415 $param .= ($search_task_ref ? '&search_task_ref='.urlencode($search_task_ref) : '');
416 $param .= ($search_task_label ? '&search_task_label='.urlencode($search_task_label) : '');
417 
418 /*
419 $search_array_options = $search_array_options_project;
420 $search_options_pattern='search_options_';
421 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
422 */
423 
424 $search_array_options = $search_array_options_task;
425 $search_options_pattern = 'search_task_options_';
426 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
427 
428 // Show navigation bar
429 $nav = '<a class="inline-block valignmiddle" href="?year='.$prev_year."&month=".$prev_month."&day=".$prev_day.$param.'">'.img_previous($langs->trans("Previous"))."</a>\n";
430 $nav .= dol_print_date(dol_mktime(0, 0, 0, $month, $day, $year), "%A").' ';
431 $nav .= " <span id=\"month_name\">".dol_print_date(dol_mktime(0, 0, 0, $month, $day, $year), "day")." </span>\n";
432 $nav .= '<a class="inline-block valignmiddle" href="?year='.$next_year."&month=".$next_month."&day=".$next_day.$param.'">'.img_next($langs->trans("Next"))."</a>\n";
433 $nav .= ' '.$form->selectDate(-1, '', 0, 0, 2, "addtime", 1, 1).' ';
434 $nav .= ' <button type="submit" name="button_search_x" value="x" class="bordertransp nobordertransp button_search"><span class="fa fa-search"></span></button>';
435 
436 $picto = 'clock';
437 
438 print '<form name="addtime" method="POST" action="'.$_SERVER["PHP_SELF"].($project->id > 0 ? '?id='.$project->id : '').'">';
439 print '<input type="hidden" name="token" value="'.newToken().'">';
440 print '<input type="hidden" name="action" value="addtime">';
441 print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
442 print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
443 print '<input type="hidden" name="mode" value="'.$mode.'">';
444 $tmp = dol_getdate($daytoparse);
445 print '<input type="hidden" name="addtimeyear" value="'.$tmp['year'].'">';
446 print '<input type="hidden" name="addtimemonth" value="'.$tmp['mon'].'">';
447 print '<input type="hidden" name="addtimeday" value="'.$tmp['mday'].'">';
448 
449 $head = project_timesheet_prepare_head($mode, $usertoprocess);
450 print dol_get_fiche_head($head, 'inputperday', $langs->trans('TimeSpent'), -1, $picto);
451 
452 // Show description of content
453 print '<div class="hideonsmartphone opacitymedium">';
454 if ($mine || ($usertoprocess->id == $user->id)) {
455  print $langs->trans("MyTasksDesc").'.'.($onlyopenedproject ? ' '.$langs->trans("OnlyOpenedProject") : '').'<br>';
456 } else {
457  if (empty($usertoprocess->id) || $usertoprocess->id < 0) {
458  if ($user->rights->projet->all->lire && !$socid) {
459  print $langs->trans("ProjectsDesc").'.'.($onlyopenedproject ? ' '.$langs->trans("OnlyOpenedProject") : '').'<br>';
460  } else {
461  print $langs->trans("ProjectsPublicTaskDesc").'.'.($onlyopenedproject ? ' '.$langs->trans("OnlyOpenedProject") : '').'<br>';
462  }
463  }
464 }
465 if ($mine || ($usertoprocess->id == $user->id)) {
466  print $langs->trans("OnlyYourTaskAreVisible").'<br>';
467 } else {
468  print $langs->trans("AllTaskVisibleButEditIfYouAreAssigned").'<br>';
469 }
470 print '</div>';
471 
472 print dol_get_fiche_end();
473 
474 
475 print '<div class="floatright right'.($conf->dol_optimize_smallscreen ? ' centpercent' : '').'">'.$nav.'</div>'; // We move this before the assign to components so, the default submit button is not the assign to.
476 
477 print '<div class="colorbacktimesheet float valignmiddle">';
478 $titleassigntask = $langs->transnoentities("AssignTaskToMe");
479 if ($usertoprocess->id != $user->id) {
480  $titleassigntask = $langs->transnoentities("AssignTaskToUser", $usertoprocess->getFullName($langs));
481 }
482 print '<div class="taskiddiv inline-block">';
483 print img_picto('', 'projecttask', 'class="pictofixedwidth"');
484 $formproject->selectTasks($socid ? $socid : -1, $taskid, 'taskid', 32, 0, '-- '.$langs->trans("ChooseANotYetAssignedTask").' --', 1, 0, 0, '', '', 'all', $usertoprocess);
485 print '</div>';
486 print ' ';
487 print $formcompany->selectTypeContact($object, '', 'type', 'internal', 'position', 0, 'maxwidth150onsmartphone');
488 print '<input type="submit" class="button valignmiddle smallonsmartphone" name="assigntask" value="'.dol_escape_htmltag($titleassigntask).'">';
489 print '</div>';
490 
491 print '<div class="clearboth" style="padding-bottom: 20px;"></div>';
492 
493 
494 $moreforfilter = '';
495 
496 // Filter on categories
497 /*if (! empty($conf->categorie->enabled))
498 {
499  require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
500  $moreforfilter.='<div class="divsearchfield">';
501  $moreforfilter.=$langs->trans('ProjectCategories'). ': ';
502  $moreforfilter.=$formother->select_categories('project', $search_categ, 'search_categ', 1, 1, 'maxwidth300');
503  $moreforfilter.='</div>';
504 }*/
505 
506 // If the user can view user other than himself
507 $moreforfilter .= '<div class="divsearchfield">';
508 $moreforfilter .= '<div class="inline-block hideonsmartphone"></div>';
509 $includeonly = 'hierarchyme';
510 if (empty($user->rights->user->user->lire)) {
511  $includeonly = array($user->id);
512 }
513 $moreforfilter .= img_picto($langs->trans('Filter').' '.$langs->trans('User'), 'user', 'class="paddingright pictofixedwidth"').$form->select_dolusers($search_usertoprocessid ? $search_usertoprocessid : $usertoprocess->id, 'search_usertoprocessid', $user->rights->user->user->lire ? 0 : 0, null, 0, $includeonly, null, 0, 0, 0, '', 0, '', 'maxwidth200');
514 $moreforfilter .= '</div>';
515 
516 if (empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)) {
517  $moreforfilter .= '<div class="divsearchfield">';
518  $moreforfilter .= '<div class="inline-block"></div>';
519  $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).'">';
520  $moreforfilter .= '</div>';
521 
522  $moreforfilter .= '<div class="divsearchfield">';
523  $moreforfilter .= '<div class="inline-block"></div>';
524  $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).'">';
525  $moreforfilter .= '</div>';
526 }
527 
528 if (!empty($moreforfilter)) {
529  print '<div class="liste_titre liste_titre_bydiv centpercent">';
530  print $moreforfilter;
531  $parameters = array();
532  $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
533  print $hookmanager->resPrint;
534  print '</div>';
535 }
536 
537 $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
538 $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
539 
540 // This must be after the $selectedfields
541 $addcolspan = 0;
542 if (!empty($arrayfields['t.planned_workload']['checked'])) {
543  $addcolspan++;
544 }
545 if (!empty($arrayfields['t.progress']['checked'])) {
546  $addcolspan++;
547 }
548 foreach ($arrayfields as $key => $val) {
549  if ($val['checked'] && substr($key, 0, 5) == 'efpt.') {
550  $addcolspan++;
551  }
552 }
553 
554 print '<div class="div-table-responsive">';
555 print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'" id="tablelines3">'."\n";
556 
557 print '<tr class="liste_titre_filter">';
558 if (!empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)) {
559  print '<td class="liste_titre"><input type="text" size="4" name="search_project_ref" value="'.dol_escape_htmltag($search_project_ref).'"></td>';
560 }
561 if (!empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)) {
562  print '<td class="liste_titre"><input type="text" size="4" name="search_thirdparty" value="'.dol_escape_htmltag($search_thirdparty).'"></td>';
563 }
564 print '<td class="liste_titre"><input type="text" size="4" name="search_task_label" value="'.dol_escape_htmltag($search_task_label).'"></td>';
565 // TASK fields
566 $search_options_pattern = 'search_task_options_';
567 $extrafieldsobjectkey = 'projet_task';
568 $extrafieldsobjectprefix = 'efpt.';
569 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
570 if (!empty($arrayfields['t.planned_workload']['checked'])) {
571  print '<td class="liste_titre"></td>';
572 }
573 if (!empty($arrayfields['t.progress']['checked'])) {
574  print '<td class="liste_titre right"><input type="text" size="4" name="search_declared_progress" value="'.dol_escape_htmltag($search_declared_progress).'"></td>';
575 }
576 if (!empty($arrayfields['timeconsumed']['checked'])) {
577  print '<td class="liste_titre"></td>';
578  print '<td class="liste_titre"></td>';
579 }
580 print '<td class="liste_titre"></td>';
581 print '<td class="liste_titre"></td>';
582 print '<td class="liste_titre"></td>';
583 // Action column
584 print '<td class="liste_titre nowrap right">';
585 $searchpicto = $form->showFilterAndCheckAddButtons(0);
586 print $searchpicto;
587 print '</td>';
588 print "</tr>\n";
589 
590 print '<tr class="liste_titre">';
591 if (!empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)) {
592  print '<th>'.$langs->trans("Project").'</th>';
593 }
594 if (!empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)) {
595  print '<th>'.$langs->trans("ThirdParty").'</th>';
596 }
597 print '<th>'.$langs->trans("Task").'</th>';
598 // TASK fields
599 $extrafieldsobjectkey = 'projet_task';
600 $extrafieldsobjectprefix = 'efpt.';
601 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
602 if (!empty($arrayfields['t.planned_workload']['checked'])) {
603  print '<th class="leftborder plannedworkload minwidth75 maxwidth100 right" title="'.dol_escape_htmltag($langs->trans("PlannedWorkload")).'">'.$langs->trans("PlannedWorkload").'</th>';
604 }
605 if (!empty($arrayfields['t.progress']['checked'])) {
606  print '<th class="right minwidth75 maxwidth100 title="'.dol_escape_htmltag($langs->trans("ProgressDeclared")).'">'.$langs->trans("ProgressDeclared").'</th>';
607 }
608 if (!empty($arrayfields['timeconsumed']['checked'])) {
609  print '<th class="right maxwidth100">'.$langs->trans("TimeSpent").'<br>';
610  print '<span class="nowraponall">';
611  print '<span class="opacitymedium nopadding userimg"><img alt="Photo" class="photouserphoto userphoto" src="'.DOL_URL_ROOT.'/theme/common/everybody.png"></span>';
612  print '<span class="opacitymedium paddingleft">'.$langs->trans("Everybody").'</span>';
613  print '</span>';
614  print '</th>';
615  print '<th class="right maxwidth75 maxwidth100">'.$langs->trans("TimeSpent").($usertoprocess->firstname ? '<br><span class="nowraponall">'.$usertoprocess->getNomUrl(-2).'<span class="opacitymedium paddingleft">'.dol_trunc($usertoprocess->firstname, 10).'</span></span>' : '').'</th>';
616 }
617 print '<th class="center leftborder">'.$langs->trans("HourStart").'</td>';
618 
619 // By default, we can edit only tasks we are assigned to
620 $restrictviewformytask = ((!isset($conf->global->PROJECT_TIME_SHOW_TASK_NOT_ASSIGNED)) ? 2 : $conf->global->PROJECT_TIME_SHOW_TASK_NOT_ASSIGNED);
621 
622 $numendworkingday = 0;
623 $numstartworkingday = 0;
624 // Get if user is available or not for each day
625 $isavailable = array();
626 
627 // Assume from Monday to Friday if conf empty or badly formed
628 $numstartworkingday = 1;
629 $numendworkingday = 5;
630 
631 if (!empty($conf->global->MAIN_DEFAULT_WORKING_DAYS)) {
632  $tmparray = explode('-', $conf->global->MAIN_DEFAULT_WORKING_DAYS);
633  if (count($tmparray) >= 2) {
634  $numstartworkingday = $tmparray[0];
635  $numendworkingday = $tmparray[1];
636  }
637 }
638 
639 $statusofholidaytocheck = Holiday::STATUS_APPROVED;
640 $isavailablefordayanduser = $holiday->verifDateHolidayForTimestamp($usertoprocess->id, $daytoparse, $statusofholidaytocheck); // $daytoparse is a date with hours = 0
641 $isavailable[$daytoparse] = $isavailablefordayanduser; // in projectLinesPerWeek later, we are using $firstdaytoshow and dol_time_plus_duree to loop on each day
642 
643 $test = num_public_holiday($daytoparsegmt, $daytoparsegmt + 86400, $mysoc->country_code);
644 if ($test) {
645  $isavailable[$daytoparse] = array('morning'=>false, 'afternoon'=>false, 'morning_reason'=>'public_holiday', 'afternoon_reason'=>'public_holiday');
646 }
647 
648 $tmparray = dol_getdate($daytoparse, true); // detail of current day
649 // For monday, must be 0 for monday if MAIN_START_WEEK = 1, must be 1 for monday if MAIN_START_WEEK = 0
650 $idw = ($tmparray['wday'] - (empty($conf->global->MAIN_START_WEEK) ? 0 : 1));
651 // 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)
652 $cssweekend = '';
653 if ((($idw + 1) < $numstartworkingday) || (($idw + 1) > $numendworkingday)) { // This is a day is not inside the setup of working days, so we use a week-end css.
654  $cssweekend = 'weekend';
655 }
656 
657 $tmpday = dol_time_plus_duree($daytoparse, $idw, 'd');
658 
659 $cssonholiday = '';
660 if (!$isavailable[$daytoparse]['morning'] && !$isavailable[$daytoparse]['afternoon']) {
661  $cssonholiday .= 'onholidayallday ';
662 } elseif (!$isavailable[$daytoparse]['morning']) {
663  $cssonholiday .= 'onholidaymorning ';
664 } elseif (!$isavailable[$daytoparse]['afternoon']) {
665  $cssonholiday .= 'onholidayafternoon ';
666 }
667 
668 print '<th class="center'.($cssonholiday ? ' '.$cssonholiday : '').($cssweekend ? ' '.$cssweekend : '').'">'.$langs->trans("Duration").'</th>';
669 print '<th class="center">'.$langs->trans("Note").'</th>';
670 //print '<td class="center"></td>';
671 print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
672 
673 print "</tr>\n";
674 
675 $colspan = 2 + (empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT) ? 0 : 2);
676 
677 if ($conf->use_javascript_ajax) {
678  print '<tr class="liste_total">';
679  print '<td class="liste_total" colspan="'.($colspan - 1 + $addcolspan).'">';
680  print $langs->trans("Total");
681  print '</td>';
682  if (!empty($arrayfields['timeconsumed']['checked'])) {
683  print '<td class="liste_total"></td>';
684  print '<td class="liste_total"></td>';
685  }
686  print '<td class="liste_total leftborder">';
687  //print ' - '.$langs->trans("ExpectedWorkedHours").': <strong>'.price($usertoprocess->weeklyhours, 1, $langs, 0, 0).'</strong>';
688  print '</td>';
689 
690  print '<td class="liste_total center'.($cssonholiday ? ' '.$cssonholiday : '').($cssweekend ? ' '.$cssweekend : '').'"><div class="totalDay0">&nbsp;</div></td>';
691 
692  print '<td class="liste_total"></td>';
693  print '<td class="liste_total"></td>';
694  print '</tr>';
695 }
696 
697 
698 if (count($tasksarray) > 0) {
699  //var_dump($tasksarray); // contains only selected tasks
700  //var_dump($tasksarraywithoutfilter); // contains all tasks (if there is a filter, not defined if no filter)
701  //var_dump($tasksrole);
702 
703  $j = 0;
704  $level = 0;
705  $totalforvisibletasks = projectLinesPerDay($j, 0, $usertoprocess, $tasksarray, $level, $projectsrole, $tasksrole, $mine, $restrictviewformytask, $daytoparse, $isavailable, 0, $arrayfields, $extrafields);
706  //var_dump($totalforvisibletasks);
707 
708  // Show total for all other tasks
709 
710  // Calculate total for all tasks
711  $listofdistinctprojectid = array(); // List of all distinct projects
712  if (is_array($tasksarraywithoutfilter) && count($tasksarraywithoutfilter)) {
713  foreach ($tasksarraywithoutfilter as $tmptask) {
714  $listofdistinctprojectid[$tmptask->fk_project] = $tmptask->fk_project;
715  }
716  }
717  //var_dump($listofdistinctprojectid);
718  $totalforeachday = array();
719  foreach ($listofdistinctprojectid as $tmpprojectid) {
720  $projectstatic->id = $tmpprojectid;
721  $projectstatic->loadTimeSpent($daytoparse, 0, $usertoprocess->id); // Load time spent from table projet_task_time for the project into this->weekWorkLoad and this->weekWorkLoadPerTask for all days of a week
722  for ($idw = 0; $idw < 7; $idw++) {
723  $tmpday = dol_time_plus_duree($daytoparse, $idw, 'd');
724  $totalforeachday[$tmpday] += $projectstatic->weekWorkLoad[$tmpday];
725  }
726  }
727  //var_dump($totalforeachday);
728 
729  // Is there a diff between selected/filtered tasks and all tasks ?
730  $isdiff = 0;
731  if (count($totalforeachday)) {
732  $timeonothertasks = ($totalforeachday[$daytoparse] - $totalforvisibletasks[$daytoparse]);
733  if ($timeonothertasks) {
734  $isdiff = 1;
735  }
736  }
737 
738  // 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
739  if ($isdiff) {
740  print '<tr class="oddeven othertaskwithtime">';
741  print '<td colspan="'.($colspan - 1).'" class="opacitymedium">';
742  print $langs->trans("OtherFilteredTasks");
743  print '</td>';
744  if (!empty($arrayfields['timeconsumed']['checked'])) {
745  print '<td class="liste_total"></td>';
746  print '<td class="liste_total"></td>';
747  }
748  print '<td class="leftborder"></td>';
749  print '<td class="center">';
750  $timeonothertasks = ($totalforeachday[$daytoparse] - $totalforvisibletasks[$daytoparse]);
751  //if ($timeonothertasks)
752  //{
753  print '<span class="timesheetalreadyrecorded" title="texttoreplace"><input type="text" class="center" size="2" disabled="" id="timespent[-1][0]" name="task[-1][0]" value="';
754  if ($timeonothertasks) {
755  print convertSecondToTime($timeonothertasks, 'allhourmin');
756  }
757  print '"></span>';
758  //}
759  print '</td>';
760  print ' <td class="liste_total"></td>';
761  print ' <td class="liste_total"></td>';
762  print '</tr>';
763  }
764 
765  if ($conf->use_javascript_ajax) {
766  print '<tr class="liste_total">';
767  print '<td class="liste_total" colspan="'.($colspan - 1 + $addcolspan).'">';
768  print $langs->trans("Total");
769  print '</td>';
770  if (!empty($arrayfields['timeconsumed']['checked'])) {
771  print '<td class="liste_total"></td>';
772  print '<td class="liste_total"></td>';
773  }
774  print '<td class="liste_total leftborder">';
775  //print ' - '.$langs->trans("ExpectedWorkedHours").': <strong>'.price($usertoprocess->weeklyhours, 1, $langs, 0, 0).'</strong>';
776  print '</td>';
777 
778  print '<td class="liste_total center'.($cssonholiday ? ' '.$cssonholiday : '').($cssweekend ? ' '.$cssweekend : '').'"><div class="totalDay0">&nbsp;</div></td>';
779 
780  print '<td class="liste_total"></td>
781  <td class="liste_total"></td>
782  </tr>';
783  }
784 } else {
785  print '<tr><td colspan="14"><span class="opacitymedium">'.$langs->trans("NoAssignedTasks").'</span></td></tr>';
786 }
787 print "</table>";
788 print '</div>';
789 
790 print '<input type="hidden" id="numberOfLines" name="numberOfLines" value="'.count($tasksarray).'"/>'."\n";
791 
792 print '<div class="center">';
793 print '<input type="submit" name="button_addtime" class="button button-save"'.(!empty($disabledtask) ? ' disabled' : '').' value="'.$langs->trans("Save").'">';
794 print '</div>';
795 
796 print '</form>';
797 
798 if (!empty($conf->use_javascript_ajax)) {
799  $modeinput = 'hours';
800  print "\n<!-- JS CODE TO ENABLE Tooltips on all object with class classfortooltip -->\n";
801  print '<script type="text/javascript">'."\n";
802  print "jQuery(document).ready(function () {\n";
803  print " updateTotal(0,\''.$modeinput.'\');\n";
804  print ' jQuery(".timesheetalreadyrecorded").tooltip({
805  show: { collision: "flipfit", effect:\'toggle\', delay:50 },
806  hide: { effect:\'toggle\', delay: 50 },
807  tooltipClass: "mytooltip",
808  content: function () {
809  return \''.dol_escape_js($langs->trans("TimeAlreadyRecorded", $usertoprocess->getFullName($langs))).'\';
810  }
811  });'."\n";
812  print " jQuery('.inputhour, .inputminute').bind('keyup', function(e) { updateTotal(0, '".$modeinput."') });";
813  print "\n});\n";
814  print '</script>';
815 }
816 
817 // End of page
818 llxFooter();
819 $db->close();
dol_getdate
dol_getdate($timestamp, $fast=false, $forcetimezone='')
Return an array with locale date info.
Definition: functions.lib.php:2713
Societe
Class to manage third parties objects (customers, suppliers, prospects...)
Definition: societe.class.php:48
dol_escape_htmltag
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields.
Definition: functions.lib.php:1468
dol_trunc
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.
Definition: functions.lib.php:3805
restrictedArea
restrictedArea($user, $features, $objectid=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.
Definition: security.lib.php:234
Project
Class to manage projects.
Definition: project.class.php:35
project_timesheet_prepare_head
project_timesheet_prepare_head($mode, $fuser=null)
Prepare array with list of tabs.
Definition: project.lib.php:440
GETPOST
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Definition: functions.lib.php:484
dol_print_error
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
Definition: functions.lib.php:4844
dol_sort_array
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by second index function, which produces ascending (default) or descending output...
Definition: functions.lib.php:8385
Task
Class to manage tasks.
Definition: task.class.php:37
FormProjets
Class to manage building of HTML components.
Definition: html.formprojet.class.php:30
$form
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:142
Holiday\STATUS_APPROVED
const STATUS_APPROVED
Approved.
Definition: holiday.class.php:154
FormOther
Classe permettant la generation de composants html autre Only common components are here.
Definition: html.formother.class.php:39
convertSecondToTime
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:236
dol_print_date
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
Definition: functions.lib.php:2514
FormCompany
Class to build HTML component for third parties management Only common components are here.
Definition: html.formcompany.class.php:40
img_picto
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
Definition: functions.lib.php:3880
img_next
img_next($titlealt='default', $moreatt='')
Show next logo.
Definition: functions.lib.php:4557
Holiday
Class of the module paid holiday.
Definition: holiday.class.php:34
projectLinesPerDay
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 intput mode.
Definition: project.lib.php:1297
num_public_holiday
num_public_holiday($timestampStart, $timestampEnd, $country_code='', $lastday=0, $includesaturday=-1, $includesunday=-1, $includefriday=-1, $includemonday=-1)
Return the number of non working days including Friday, Saturday and Sunday (or not) between 2 dates ...
Definition: date.lib.php:720
dol_get_fiche_head
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tabs of a record.
Definition: functions.lib.php:1822
dol_get_fiche_end
dol_get_fiche_end($notab=0)
Return tab footer of a card.
Definition: functions.lib.php:2018
dol_time_plus_duree
dol_time_plus_duree($time, $duration_value, $duration_unit, $ruleforendofmonth=0)
Add a delay to a date.
Definition: date.lib.php:121
User
Class to manage Dolibarr users.
Definition: user.class.php:44
GETPOSTISSET
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
Definition: functions.lib.php:386
print_liste_field_titre
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
Definition: functions.lib.php:5026
natural_search
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
Definition: functions.lib.php:9420
ExtraFields
Class to manage standard extra fields.
Definition: extrafields.class.php:39
Form
Class to manage generation of HTML components Only common components must be here.
Definition: html.form.class.php:52
dol_now
dol_now($mode='auto')
Return date for now.
Definition: functions.lib.php:2845
$resql
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->facture->lire)||(isModEnabled('supplier_invoice') && $user->rights->supplier_invoice->lire)) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
Definition: index.php:742
setEventMessages
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
Definition: functions.lib.php:8137
dol_mktime
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
Definition: functions.lib.php:2757
img_previous
img_previous($titlealt='default', $moreatt='')
Show previous logo.
Definition: functions.lib.php:4576
llxHeader
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOCSRFCHECK')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Definition: wrapper.php:59