36require
'../../main.inc.php';
46@phan-var-force ?string $uploaddir
48require_once DOL_DOCUMENT_ROOT .
'/projet/class/project.class.php';
49require_once DOL_DOCUMENT_ROOT .
'/projet/class/task.class.php';
50require_once DOL_DOCUMENT_ROOT .
'/compta/facture/class/facture.class.php';
51require_once DOL_DOCUMENT_ROOT .
'/core/lib/project.lib.php';
52require_once DOL_DOCUMENT_ROOT .
'/core/lib/date.lib.php';
53require_once DOL_DOCUMENT_ROOT .
'/core/class/html.formother.class.php';
54require_once DOL_DOCUMENT_ROOT .
'/core/class/html.formprojet.class.php';
55require_once DOL_DOCUMENT_ROOT .
'/core/class/html.formintervention.class.php';
56require_once DOL_DOCUMENT_ROOT .
'/product/class/product.class.php';
59$langsLoad = array(
'projects',
'bills',
'orders',
'companies');
61 $langsLoad[] =
'eventorganization';
64$langs->loadLangs($langsLoad);
66$action =
GETPOST(
'action',
'aZ09');
67$massaction =
GETPOST(
'massaction',
'alpha');
68$confirm =
GETPOST(
'confirm',
'alpha');
69$cancel =
GETPOST(
'cancel',
'alpha');
70$toselect =
GETPOST(
'toselect',
'array:int');
71$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'timespentlist';
72$backtopage =
GETPOST(
'backtopage',
'alpha');
73$optioncss =
GETPOST(
'optioncss',
'alpha');
74$mode =
GETPOST(
'mode',
'alpha');
81$project_ref =
GETPOST(
'project_ref',
'alpha');
87$search_date_startday =
GETPOSTINT(
'search_date_startday');
88$search_date_startmonth =
GETPOSTINT(
'search_date_startmonth');
89$search_date_startyear =
GETPOSTINT(
'search_date_startyear');
90$search_date_endday =
GETPOSTINT(
'search_date_endday');
91$search_date_endmonth =
GETPOSTINT(
'search_date_endmonth');
92$search_date_endyear =
GETPOSTINT(
'search_date_endyear');
93$search_date_start =
dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear);
94$search_date_end =
dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
95$search_note =
GETPOST(
'search_note',
'alpha');
96$search_duration =
GETPOST(
'search_duration',
'alpha');
97$search_task_ref =
GETPOST(
'search_task_ref',
'alpha');
98$search_task_label =
GETPOST(
'search_task_label',
'alpha');
99$search_user =
GETPOST(
'search_user',
'intcomma');
100$search_valuebilled =
GETPOST(
'search_valuebilled',
'intcomma');
101$search_product_ref =
GETPOST(
'search_product_ref',
'alpha');
102$search_company =
GETPOST(
'$search_company',
'alpha');
103$search_company_alias =
GETPOST(
'$search_company_alias',
'alpha');
104$search_project_ref =
GETPOST(
'$search_project_ref',
'alpha');
105$search_project_label =
GETPOST(
'$search_project_label',
'alpha');
106$search_timespent_starthour =
GETPOSTINT(
"search_timespent_duration_starthour");
107$search_timespent_startmin =
GETPOSTINT(
"search_timespent_duration_startmin");
108$search_timespent_endhour =
GETPOSTINT(
"search_timespent_duration_endhour");
109$search_timespent_endmin =
GETPOSTINT(
"search_timespent_duration_endmin");
112$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
113$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
115if (empty($page) || $page == -1) {
118$offset = $limit * $page;
119$pageprev = $page - 1;
120$pagenext = $page + 1;
122 $sortfield =
't.element_date,t.element_datehour,t.rowid';
125 $sortorder =
'DESC,DESC,DESC';
128$childids = $user->getAllChildIds(1);
132$hookmanager->initHooks(array(
'projecttasktime',
'globalcard'));
136$projectstatic =
new Project($db);
139$extrafields->fetch_name_optionals_label($projectstatic->table_element);
140$extrafields->fetch_name_optionals_label(
$object->table_element);
142$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
145if ($id > 0 || $ref) {
154if (!$user->hasRight(
'projet',
'lire')) {
163 if (empty($projectid) && !$user->hasRight(
'projet',
'all',
'lire')) {
164 $search_user = $user->id;
175if (
GETPOST(
'cancel',
'alpha')) {
178if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend' && $massaction !=
'confirm_generateinvoice' && $massaction !=
'confirm_generateinter') {
182$parameters = array(
'socid' => $socid,
'projectid' => $projectid);
183$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
185 setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
188include DOL_DOCUMENT_ROOT .
'/core/actions_changeselectedfields.inc.php';
191if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
196 $search_duration =
'';
197 $search_date_startday =
'';
198 $search_date_startmonth =
'';
199 $search_date_startyear =
'';
200 $search_date_endday =
'';
201 $search_date_endmonth =
'';
202 $search_date_endyear =
'';
203 $search_date_start =
'';
204 $search_date_end =
'';
205 $search_task_ref =
'';
206 $search_company =
'';
207 $search_company_alias =
'';
208 $search_project_ref =
'';
209 $search_project_label =
'';
210 $search_task_label =
'';
212 $search_valuebilled =
'';
213 $search_product_ref =
'';
215 $search_array_options = array();
216 $search_timespent_starthour =
'';
217 $search_timespent_startmin =
'';
218 $search_timespent_endhour =
'';
219 $search_timespent_endmin =
'';
223if ($action ==
'addtimespent' && $user->hasRight(
'projet',
'time')) {
224 $timespent_durationhour =
GETPOSTINT(
'timespent_durationhour');
225 $timespent_durationmin =
GETPOSTINT(
'timespent_durationmin');
226 if (empty($timespent_durationhour) && empty($timespent_durationmin)) {
227 setEventMessages($langs->trans(
'ErrorFieldRequired', $langs->transnoentitiesnoconv(
"Duration")),
null,
'errors');
231 $langs->load(
"errors");
232 setEventMessages($langs->trans(
'ErrorUserNotAssignedToTask'),
null,
'errors');
241 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Task")),
null,
'errors');
242 $action =
'createtime';
252 if (empty(
$object->project->status)) {
253 setEventMessages($langs->trans(
"ProjectMustBeValidatedFirst"),
null,
'errors');
254 $action =
'createtime';
265 $object->timespent_withhour = 1;
268 $object->timespent_withhour = 0;
273 $result =
$object->addTimeSpent($user);
276 setEventMessages($langs->trans(
"RecordSaved"),
null,
'mesgs');
278 setEventMessages($langs->trans(
$object->error),
null,
'errors');
284 $action =
'createtime';
288if (($action ==
'updateline' || $action ==
'updatesplitline') && !$cancel && $user->hasRight(
'projet',
'lire')) {
289 if (!
GETPOST(
"new_durationhour") && !
GETPOST(
"new_durationmin")) {
290 setEventMessages($langs->trans(
'ErrorFieldRequired', $langs->transnoentitiesnoconv(
"Duration")),
null,
'errors');
301 $object->fetchTimeSpent($lineid);
305 $object->fetch($id_temp, $ref);
307 $object->timespent_note =
GETPOST(
"timespent_note_line",
"alphanohtml");
311 if (
GETPOST(
"timelinehour") !=
'' &&
GETPOST(
"timelinehour") >= 0 && !empty($timespent_date)) {
313 $object->timespent_withhour = 1;
314 } elseif (!empty($timespent_date)) {
315 $object->timespent_date = $timespent_date;
316 $object->timespent_withhour = 0;
327 if (in_array(
$object->timespent_fk_user, $childids) || $user->hasRight(
'projet',
'all',
'creer')) {
328 $result =
$object->updateTimeSpent($user);
330 setEventMessages($langs->trans(
"RecordSaved"),
null,
'mesgs');
332 setEventMessages($langs->trans(
$object->error),
null,
'errors');
341 $object->timespent_note =
GETPOST(
"timespent_note_line",
"alphanohtml");
346 if (
GETPOST(
"timelinehour") !=
'' &&
GETPOST(
"timelinehour") >= 0) {
349 $object->timespent_withhour = 1;
350 } elseif (!empty($timespent_date)) {
351 $object->timespent_date = $timespent_date;
352 $object->timespent_datehour = $timespent_date;
353 $object->timespent_withhour = 0;
366 if (in_array(
$object->timespent_fk_user, $childids) || $user->hasRight(
'projet',
'all',
'creer')) {
367 $result =
$object->updateTimeSpent($user);
370 setEventMessages($langs->trans(
"RecordSaved"),
null,
'mesgs');
372 setEventMessages($langs->trans(
$object->error),
null,
'errors');
382if ($action ==
'confirm_deleteline' && $confirm ==
"yes" && ($user->hasRight(
'projet',
'time') || $user->hasRight(
'projet',
'all',
'creer'))) {
385 if (in_array(
$object->timespent_fk_user, $childids) || $user->hasRight(
'projet',
'all',
'creer')) {
386 $result =
$object->delTimeSpent($user);
389 $langs->load(
"errors");
390 setEventMessages($langs->trans(
$object->error),
null,
'errors');
394 setEventMessages($langs->trans(
"RecordDeleted"),
null,
'mesgs');
400if (!empty($project_ref) && !empty($withproject)) {
401 if ($projectstatic->fetch(0, $project_ref) > 0) {
402 $tasksarray =
$object->getTasksArray(
null,
null, $projectstatic->id, $socid, 0);
403 if (count($tasksarray) > 0) {
404 $id = $tasksarray[0]->id;
406 header(
"Location: " . DOL_URL_ROOT .
'/projet/tasks.php?id=' . $projectstatic->id . ($withproject ?
'&withproject=1' :
'') . (empty($mode) ?
'' :
'&mode=' . $mode));
413$projectidforalltimes = 0;
415 $projectidforalltimes =
GETPOSTINT(
'projectid');
417 $result = $projectstatic->fetch($projectidforalltimes);
418 if (!empty($projectstatic->socid)) {
419 $projectstatic->fetch_thirdparty();
421 $res = $projectstatic->fetch_optionals();
424 if ($action ==
'update_extras' && $projectstatic->id > 0) {
425 $permissiontoeditextra = $user->hasRight(
'projet',
'creer');
426 if (
GETPOST(
'attribute',
'aZ09') && isset($extrafields->attributes[$projectstatic->table_element][
'perms'][
GETPOST(
'attribute',
'aZ09')])) {
427 $permissiontoeditextra =
dol_eval((
string) $extrafields->attributes[$projectstatic->table_element][
'perms'][
GETPOST(
'attribute',
'aZ09')]);
430 if ($permissiontoeditextra) {
431 $projectstatic->oldcopy =
dol_clone($projectstatic, 2);
433 $attribute_name =
GETPOST(
'attribute',
'aZ09');
436 $ret = $extrafields->setOptionalsFromPost(
null, $projectstatic, $attribute_name);
442 $result = $projectstatic->updateExtraField($attribute_name,
'PROJECT_MODIFY');
444 setEventMessages($projectstatic->error, $projectstatic->errors,
'errors');
451 $action =
'edit_extras';
454} elseif (
GETPOST(
'project_ref',
'alpha')) {
455 $projectstatic->fetch(0,
GETPOST(
'project_ref',
'alpha'));
456 $projectidforalltimes = $projectstatic->id;
460 $result = $projectstatic->fetch(
$object->fk_project);
463$allprojectforuser = 0;
465if ($id <= 0 && $projectidforalltimes == 0) {
466 $allprojectforuser = $user->id;
469if ($action ==
'confirm_generateinvoice' && $user->hasRight(
'facture',
'creer')) {
470 if (!empty($projectstatic->socid)) {
471 $projectstatic->fetch_thirdparty();
474 if (!($projectstatic->thirdparty->id > 0)) {
475 setEventMessages($langs->trans(
"ThirdPartyRequiredToGenerateInvoice"),
null,
'errors');
477 include_once DOL_DOCUMENT_ROOT .
'/compta/facture/class/facture.class.php';
478 include_once DOL_DOCUMENT_ROOT .
'/projet/class/project.class.php';
479 include_once DOL_DOCUMENT_ROOT .
'/product/class/product.class.php';
481 $tmpinvoice =
new Facture($db);
482 $tmptimespent =
new Task($db);
483 $tmpproduct =
new Product($db);
484 $fuser =
new User($db);
491 $generateinvoicemode =
GETPOST(
'generateinvoicemode',
'alphanohtml');
494 $prodDurationHoursBase = 1.0;
495 $product_data_cache = array();
497 $result = $tmpproduct->fetch($idprod);
500 setEventMessages($tmpproduct->error, $tmpproduct->errors,
'errors');
503 $prodDurationHoursBase = $tmpproduct->getProductDurationHours();
504 if ($prodDurationHoursBase < 0) {
506 $langs->load(
"errors");
507 setEventMessages(
null, $tmpproduct->errors,
'errors');
510 $dataforprice = $tmpproduct->getSellPrice(
$mysoc, $projectstatic->thirdparty, 0);
512 $pu_ht = empty($dataforprice[
'pu_ht']) ? 0 : $dataforprice[
'pu_ht'];
513 $txtva = $dataforprice[
'tva_tx'];
514 $localtax1 =
get_localtax($txtva, 1, $projectstatic->thirdparty);
515 $localtax2 =
get_localtax($txtva, 2, $projectstatic->thirdparty);
517 $prodDurationHoursBase = 1;
525 $tmpinvoice->socid = $projectstatic->thirdparty->id;
527 $tmpinvoice->fk_project = $projectstatic->id;
528 $tmpinvoice->cond_reglement_id = $condidproject;
529 $tmpinvoice->mode_reglement_id = $projectstatic->thirdparty->mode_reglement_id;
530 $tmpinvoice->fk_account = $projectstatic->thirdparty->fk_account;
533 $tmpinvoice->fetch($invoiceToUse);
535 $result = $tmpinvoice->create($user);
538 setEventMessages($tmpinvoice->error, $tmpinvoice->errors,
'errors');
543 if ($generateinvoicemode ==
'onelineperuser') {
544 $arrayoftasks = array();
545 foreach ($toselect as $key => $value) {
547 $object->fetchTimeSpent($value);
548 if (!array_key_exists(
$object->timespent_fk_user, $arrayoftasks)) {
549 $arrayoftasks[
$object->timespent_fk_user] = [
550 (int)
$object->timespent_fk_product => [
'timespent' => 0,
'totalvaluetodivideby3600' => 0]
553 $arrayoftasks[
$object->timespent_fk_user][(int)
$object->timespent_fk_product][
'timespent'] +=
$object->timespent_duration;
554 $arrayoftasks[
$object->timespent_fk_user][(int)
$object->timespent_fk_product][
'totalvaluetodivideby3600'] += (
$object->timespent_duration *
$object->timespent_thm);
557 foreach ($arrayoftasks as $userid => $data) {
558 $fuser->fetch($userid);
559 $username = $fuser->getFullName($langs);
561 foreach ($data as $fk_product => $timespent_data) {
563 $qtyhour = $timespent_data[
'timespent'] / 3600;
570 } elseif ($idprod <= 0) {
573 $pu_ht = $fuser->thm;
578 if ($timespent_data[
'timespent']) {
579 $pu_ht =
price2num(($timespent_data[
'totalvaluetodivideby3600'] / $timespent_data[
'timespent']),
'MU');
584 $prodDurationHours = $prodDurationHoursBase;
585 $idprodline = $idprod;
588 $localtax1line = $localtax1;
589 $localtax2line = $localtax2;
592 if (!empty($fk_product) && ($fk_product > 0) && ($fk_product !== $idprod)) {
593 if (!array_key_exists($fk_product, $product_data_cache)) {
594 $result = $tmpproduct->fetch($fk_product);
597 setEventMessages($tmpproduct->error, $tmpproduct->errors,
'errors');
599 $prodDurationHours = $tmpproduct->getProductDurationHours();
600 if ($prodDurationHours < 0) {
602 $langs->load(
"errors");
603 setEventMessages(
null, $tmpproduct->errors,
'errors');
608 $dataforprice = $tmpproduct->getSellPrice(
$mysoc, $projectstatic->thirdparty, 0);
610 $pu_htline = empty($dataforprice[
'pu_ht']) ? 0 : $dataforprice[
'pu_ht'];
611 $txtvaline = $dataforprice[
'tva_tx'];
612 $localtax1line = $dataforprice[
'localtax1'];
613 $localtax2line = $dataforprice[
'localtax2'];
615 $product_data_cache[$fk_product] = array(
'duration' => $prodDurationHours,
'dataforprice' => $dataforprice);
617 $prodDurationHours = $product_data_cache[$fk_product][
'duration'];
618 $pu_htline = empty($product_data_cache[$fk_product][
'dataforprice'][
'pu_ht']) ? 0 : $product_data_cache[$fk_product][
'dataforprice'][
'pu_ht'];
619 $txtvaline = $product_data_cache[$fk_product][
'dataforprice'][
'tva_tx'];
620 $localtax1line = $product_data_cache[$fk_product][
'dataforprice'][
'localtax1'];
621 $localtax2line = $product_data_cache[$fk_product][
'dataforprice'][
'localtax2'];
623 $idprodline = $fk_product;
630 $lineid = $tmpinvoice->addline($langs->trans(
"TimeSpentForInvoice").
' - '.$username .
' : ' . $qtyhourtext, $pu_htline, round($qtyhour / $prodDurationHours, 2), $txtvaline, $localtax1line, $localtax2line, ($idprodline > 0 ? $idprodline : 0), (float) $remiseproject,
'',
'', 0, 0, 0,
'HT', 0,
Product::TYPE_SERVICE);
633 setEventMessages(
null, $tmpinvoice->errors,
'errors');
637 $sql =
'UPDATE '.MAIN_DB_PREFIX.
'element_time SET invoice_line_id = '.((int) $lineid).
', invoice_id = '.((int) $tmpinvoice->id);
638 $sql .=
' WHERE rowid IN ('.$db->sanitize(implode(
',', $toselect)).
') AND fk_user = '.((
int) $userid);
639 $result = $db->query($sql);
642 setEventMessages($db->lasterror(),
null,
'errors');
647 } elseif ($generateinvoicemode ==
'onelineperperiod') {
648 $arrayoftasks = array();
650 $withdetail =
GETPOST(
'detail_time_duration',
'alpha');
651 foreach ($toselect as $key => $value) {
653 $object->fetchTimeSpent($value);
655 $ftask =
new Task($db);
658 $fuser->fetch(
$object->timespent_fk_user);
659 $username = $fuser->getFullName($langs);
661 $arrayoftasks[
$object->timespent_id][
'timespent'] =
$object->timespent_duration;
662 $arrayoftasks[
$object->timespent_id][
'totalvaluetodivideby3600'] =
$object->timespent_duration *
$object->timespent_thm;
663 $arrayoftasks[
$object->timespent_id][
'note'] = $ftask->ref .
' - ' . $ftask->label .
' - ' . $username;
666 if (!empty($withdetail)) {
667 if (!empty(
$object->timespent_withhour)) {
674 $arrayoftasks[
$object->timespent_id][
'user'] =
$object->timespent_fk_user;
675 $arrayoftasks[
$object->timespent_id][
'fk_product'] =
$object->timespent_fk_product;
678 $pu_ht_saved = $pu_ht;
679 foreach ($arrayoftasks as $timespent_id => $value) {
680 $pu_ht = $pu_ht_saved;
681 $userid = $value[
'user'];
685 $qtyhour = $value[
'timespent'] / 3600;
689 if ($value[
'timespent']) {
690 $pu_ht =
price2num(($value[
'totalvaluetodivideby3600'] / $value[
'timespent']),
'MU');
695 $prodDurationHours = $prodDurationHoursBase;
696 $idprodline = $idprod;
699 $localtax1line = $localtax1;
700 $localtax2line = $localtax2;
702 if (!empty($value[
'fk_product']) && $value[
'fk_product'] !== $idprod) {
703 if (!array_key_exists($value[
'fk_product'], $product_data_cache)) {
704 $result = $tmpproduct->fetch($value[
'fk_product']);
707 setEventMessages($tmpproduct->error, $tmpproduct->errors,
'errors');
709 $prodDurationHours = $tmpproduct->getProductDurationHours();
710 if ($prodDurationHours < 0) {
712 $langs->load(
"errors");
713 setEventMessages(
null, $tmpproduct->errors,
'errors');
718 $dataforprice = $tmpproduct->getSellPrice(
$mysoc, $projectstatic->thirdparty, 0);
720 $pu_htline = empty($dataforprice[
'pu_ht']) ? 0 : $dataforprice[
'pu_ht'];
721 $txtvaline = $dataforprice[
'tva_tx'];
722 $localtax1line = $dataforprice[
'localtax1'];
723 $localtax2line = $dataforprice[
'localtax2'];
725 $product_data_cache[$value[
'fk_product']] = array(
'duration' => $prodDurationHours,
'dataforprice' => $dataforprice);
727 $prodDurationHours = $product_data_cache[$value[
'fk_product']][
'duration'];
728 $pu_htline = empty($product_data_cache[$value[
'fk_product']][
'dataforprice'][
'pu_ht']) ? 0 : $product_data_cache[$value[
'fk_product']][
'dataforprice'][
'pu_ht'];
729 $txtvaline = $product_data_cache[$value[
'fk_product']][
'dataforprice'][
'tva_tx'];
730 $localtax1line = $product_data_cache[$value[
'fk_product']][
'dataforprice'][
'localtax1'];
731 $localtax2line = $product_data_cache[$value[
'fk_product']][
'dataforprice'][
'localtax2'];
733 $idprodline = $value[
'fk_product'];
739 $lineid = $tmpinvoice->addline($value[
'note'], $pu_htline, round($qtyhour / $prodDurationHours, 2), $txtvaline, $localtax1line, $localtax2line, ($idprodline > 0 ? $idprodline : 0), (float) $remiseproject,
'',
'', 0, 0, 0,
'HT', 0,
Product::TYPE_SERVICE);
742 setEventMessages(
null, $tmpinvoice->errors,
'errors');
747 $sql =
'UPDATE '.MAIN_DB_PREFIX.
'element_time SET invoice_line_id = '.((int) $lineid).
', invoice_id = '.((int) $tmpinvoice->id);
748 $sql .=
' WHERE rowid = '.((int) $timespent_id).
' AND fk_user = '.((int) $userid);
749 $result = $db->query($sql);
752 setEventMessages($db->lasterror(),
null,
'errors');
756 } elseif ($generateinvoicemode ==
'onelinepertask') {
757 $arrayoftasks = array();
758 foreach ($toselect as $key => $value) {
760 $object->fetchTimeSpent($value);
762 $arrayoftasks[
$object->id][(int)
$object->timespent_fk_product][
'timespent'] +=
$object->timespent_duration;
763 $arrayoftasks[
$object->id][(int)
$object->timespent_fk_product][
'totalvaluetodivideby3600'] += (
$object->timespent_duration *
$object->timespent_thm);
766 foreach ($arrayoftasks as $task_id => $data) {
767 $ftask =
new Task($db);
768 $ftask->fetch($task_id);
770 foreach ($data as $fk_product => $timespent_data) {
771 $qtyhour = $timespent_data[
'timespent'] / 3600;
775 $prodDurationHours = $prodDurationHoursBase;
776 $idprodline = $idprod;
779 $localtax1line = $localtax1;
780 $localtax2line = $localtax2;
782 if (!empty($fk_product) && $fk_product !== $idprod) {
783 if (!array_key_exists($fk_product, $product_data_cache)) {
784 $result = $tmpproduct->fetch($fk_product);
787 setEventMessages($tmpproduct->error, $tmpproduct->errors,
'errors');
789 $prodDurationHours = $tmpproduct->getProductDurationHours();
790 if ($prodDurationHours < 0) {
792 $langs->load(
"errors");
793 setEventMessages(
null, $tmpproduct->errors,
'errors');
798 $dataforprice = $tmpproduct->getSellPrice(
$mysoc, $projectstatic->thirdparty, 0);
800 $pu_htline = empty($dataforprice[
'pu_ht']) ? 0 : $dataforprice[
'pu_ht'];
801 $txtvaline = $dataforprice[
'tva_tx'];
802 $localtax1line = $dataforprice[
'localtax1'];
803 $localtax2line = $dataforprice[
'localtax2'];
805 $product_data_cache[$fk_product] = array(
'duration' => $prodDurationHours,
'dataforprice' => $dataforprice);
807 $prodDurationHours = $product_data_cache[$fk_product][
'duration'];
808 $pu_htline = empty($product_data_cache[$fk_product][
'dataforprice'][
'pu_ht']) ? 0 : $product_data_cache[$fk_product][
'dataforprice'][
'pu_ht'];
809 $txtvaline = $product_data_cache[$fk_product][
'dataforprice'][
'tva_tx'];
810 $localtax1line = $product_data_cache[$fk_product][
'dataforprice'][
'localtax1'];
811 $localtax2line = $product_data_cache[$fk_product][
'dataforprice'][
'localtax2'];
813 $idprodline = $fk_product;
817 if ($idprodline > 0) {
819 $pu_ht_for_task = $pu_htline;
822 $pu_ht_for_task = (float)
price2num($timespent_data[
'totalvaluetodivideby3600'] / $timespent_data[
'timespent'],
'MU') * $prodDurationHours;
824 $pa_ht = (float)
price2num($timespent_data[
'totalvaluetodivideby3600'] / $timespent_data[
'timespent'],
'MU') * $prodDurationHours;
830 $pu_ht_for_task =
price2num($timespent_data[
'totalvaluetodivideby3600'] / $timespent_data[
'timespent'],
'MU');
832 $pa_ht =
price2num($timespent_data[
'totalvaluetodivideby3600'] / $timespent_data[
'timespent'],
'MU');
838 $lineName = $ftask->ref .
' - ' . $ftask->label;
839 $lineid = $tmpinvoice->addline($lineName, (
float) $pu_ht_for_task, (
float)
price2num($qtyhour / $prodDurationHours,
'MS'), $txtvaline, $localtax1line, $localtax2line, ($idprodline > 0 ? $idprodline : 0), (float) $remiseproject,
$date_start, $date_end, 0, 0, 0,
'HT', 0, 1, -1, 0,
'', 0, 0, 0, $pa_ht);
842 setEventMessages($tmpinvoice->error, $tmpinvoice->errors,
'errors');
848 $sql =
'UPDATE ' . MAIN_DB_PREFIX .
'element_time SET invoice_line_id = ' . ((int) $lineid) .
', invoice_id = ' . ((int) $tmpinvoice->id);
849 $sql .=
' WHERE rowid IN (' . $db->sanitize(implode(
',', $toselect)) .
')';
850 $result = $db->query($sql);
853 setEventMessages($db->lasterror(),
null,
'errors');
863 $urltoinvoice = $tmpinvoice->getNomUrl(0);
864 $mesg = $langs->trans(
"InvoiceGeneratedFromTimeSpent",
'{s1}');
865 $mesg = str_replace(
'{s1}', $urltoinvoice, $mesg);
866 setEventMessages($mesg,
null,
'mesgs');
875if ($action ==
'confirm_generateinter' && $user->hasRight(
'fichinter',
'creer')) {
876 $langs->load(
'interventions');
878 if (!empty($projectstatic->socid)) {
879 $projectstatic->fetch_thirdparty();
882 if (!($projectstatic->thirdparty->id > 0)) {
883 setEventMessages($langs->trans(
"ThirdPartyRequiredToGenerateIntervention"),
null,
'errors');
885 include_once DOL_DOCUMENT_ROOT .
'/compta/facture/class/facture.class.php';
886 include_once DOL_DOCUMENT_ROOT .
'/projet/class/project.class.php';
887 include_once DOL_DOCUMENT_ROOT .
'/product/class/product.class.php';
890 require_once DOL_DOCUMENT_ROOT .
'/fichinter/class/fichinter.class.php';
892 $tmptimespent =
new Task($db);
893 $fuser =
new User($db);
899 $tmpinter->socid = $projectstatic->thirdparty->id;
901 $tmpinter->fk_project = $projectstatic->id;
902 $tmpinter->description = $projectstatic->title . (!empty($projectstatic->description) ?
'-' . $projectstatic->label :
'');
905 $tmpinter->fetch($interToUse);
907 $result = $tmpinter->create($user);
910 setEventMessages($tmpinter->error, $tmpinter->errors,
'errors');
915 $arrayoftasks = array();
916 foreach ($toselect as $key => $value) {
918 $object->fetchTimeSpent($value);
921 $arrayoftasks[
$object->timespent_id][
'timespent'] =
$object->timespent_duration;
922 $arrayoftasks[
$object->timespent_id][
'totalvaluetodivideby3600'] =
$object->timespent_duration *
$object->timespent_thm;
923 $arrayoftasks[
$object->timespent_id][
'note'] =
$object->timespent_note;
924 $arrayoftasks[
$object->timespent_id][
'date'] =
$object->timespent_datehour;
927 foreach ($arrayoftasks as $timespent_id => $value) {
928 $ftask =
new Task($db);
929 $ftask->fetch($value[
'id']);
931 $qtyhour = $value[
'timespent'] / 3600;
935 $lineid = $tmpinter->addline($user, $tmpinter->id, $ftask->label . (!empty($value[
'note']) ?
' - ' . $value[
'note'] :
''), (int) $value[
'date'], $value[
'timespent']);
940 $timespent->fetch($timespent_id);
941 $timespent->intervention_id = $tmpinter->id;
942 $timespent->intervention_line_id = $lineid;
943 $result = $timespent->update($user);
946 setEventMessages($timespent->error, $timespent->errors,
'errors');
953 $urltointer = $tmpinter->getNomUrl(0);
954 $mesg = $langs->trans(
"InterventionGeneratedFromTimeSpent",
'{s1}');
955 $mesg = str_replace(
'{s1}', $urltointer, $mesg);
956 setEventMessages($mesg,
null,
'mesgs');
972$form =
new Form($db);
975$userstatic =
new User($db);
977$arrayofselected = is_array($toselect) ? $toselect : array();
979$title =
$object->ref .
' - ' . $langs->trans(
"TimeSpent");
980if (!empty($withproject)) {
981 $title .=
' | ' . $langs->trans(
"Project") . (!empty($projectstatic->ref) ?
': ' . $projectstatic->ref :
'');
985llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-project project-tasks page-task_time');
988$param = ((!empty($mode) && $mode ==
'mine') ?
'&mode=mine' :
'');
990 $param .=
'&search_user=' . ((int) $search_user);
993 $param .=
'&search_month=' . ((int) $search_month);
996 $param .=
'&search_year=' . ((int) $search_year);
1000if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser > 0) {
1002 if ($projectidforalltimes > 0) {
1003 $result = $projectstatic->fetch($projectidforalltimes);
1004 if (!empty($projectstatic->socid)) {
1005 $projectstatic->fetch_thirdparty();
1007 $res = $projectstatic->fetch_optionals();
1008 } elseif (
$object->fetch($id, $ref) > 0) {
1012 $result = $projectstatic->fetch(
$object->fk_project);
1013 if (
getDolGlobalString(
'PROJECT_ALLOW_COMMENT_ON_PROJECT') && method_exists($projectstatic,
'fetchComments') && empty($projectstatic->comments)) {
1014 $projectstatic->fetchComments();
1016 if (!empty($projectstatic->socid)) {
1017 $projectstatic->fetch_thirdparty();
1019 $res = $projectstatic->fetch_optionals();
1021 $object->project = clone $projectstatic;
1024 $userRead = $projectstatic->restrictedProjectArea($user,
'read');
1025 $linktocreatetime =
'';
1027 if ($projectstatic->id > 0) {
1030 if (empty($id) || $tab ==
'timespent') {
1037 print
dol_get_fiche_head($head, $tab, $langs->trans(
"Project"), -1, ($projectstatic->public ?
'projectpub' :
'project'));
1041 $linkback =
'<a href="'.DOL_URL_ROOT.
'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
1043 $morehtmlref =
'<div class="refidno">';
1045 $morehtmlref .= $projectstatic->title;
1047 if (!empty($projectstatic->thirdparty->id) && $projectstatic->thirdparty->id > 0) {
1048 $morehtmlref .=
'<br>' . $projectstatic->thirdparty->getNomUrl(1,
'project');
1050 $morehtmlref .=
'</div>';
1053 if (!$user->hasRight(
'projet',
'all',
'lire')) {
1054 $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0);
1055 $projectstatic->next_prev_filter =
"rowid:IN:" . $db->sanitize(count($objectsListId) ? implode(
',', array_keys($objectsListId)) :
'0');
1058 dol_banner_tab($projectstatic,
'project_ref', $linkback, 1,
'ref',
'ref', $morehtmlref, $param);
1060 print
'<div class="fichecenter">';
1061 print
'<div class="fichehalfleft">';
1062 print
'<div class="underbanner clearboth"></div>';
1064 print
'<table class="border tableforfield centpercent">';
1068 print
'<tr><td class="tdtop">';
1069 print $langs->trans(
"Usage");
1073 print
'<input type="checkbox" disabled name="usage_opportunity"' . (
GETPOSTISSET(
'usage_opportunity') ? (
GETPOST(
'usage_opportunity',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($projectstatic->usage_opportunity ?
' checked="checked"' :
'')) .
'"> ';
1074 $htmltext = $langs->trans(
"ProjectFollowOpportunity");
1075 print $form->textwithpicto($langs->trans(
"ProjectFollowOpportunity"), $htmltext);
1079 print
'<input type="checkbox" disabled name="usage_task"' . (
GETPOSTISSET(
'usage_task') ? (
GETPOST(
'usage_task',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($projectstatic->usage_task ?
' checked="checked"' :
'')) .
'"> ';
1080 $htmltext = $langs->trans(
"ProjectFollowTasks");
1081 print $form->textwithpicto($langs->trans(
"ProjectFollowTasks"), $htmltext);
1085 print
'<input type="checkbox" disabled name="usage_bill_time"' . (
GETPOSTISSET(
'usage_bill_time') ? (
GETPOST(
'usage_bill_time',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($projectstatic->usage_bill_time ?
' checked="checked"' :
'')) .
'"> ';
1086 $htmltext = $langs->trans(
"ProjectBillTimeDescription");
1087 print $form->textwithpicto($langs->trans(
"BillTime"), $htmltext);
1091 print
'<input type="checkbox" disabled name="usage_organize_event"' . (
GETPOSTISSET(
'usage_organize_event') ? (
GETPOST(
'usage_organize_event',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($projectstatic->usage_organize_event ?
' checked="checked"' :
'')) .
'"> ';
1092 $htmltext = $langs->trans(
"EventOrganizationDescriptionLong");
1093 print $form->textwithpicto($langs->trans(
"ManageOrganizeEvent"), $htmltext);
1099 print
'<tr><td>' . $langs->trans(
"Budget") .
'</td><td>';
1100 if (!is_null($projectstatic->budget_amount) && strcmp($projectstatic->budget_amount,
'')) {
1101 print
'<span class="amount">' .
price($projectstatic->budget_amount, 0, $langs, 1, 0, 0,
$conf->currency) .
'</span>';
1106 print
'<tr><td>' . $langs->trans(
"Dates") .
'</td><td>';
1108 print($start ? $start :
'?');
1111 print($end ? $end :
'?');
1112 if ($projectstatic->hasDelay()) {
1113 print img_warning(
"Late");
1118 print
'<tr><td class="titlefield">' . $langs->trans(
"Visibility") .
'</td><td>';
1119 if ($projectstatic->public) {
1120 print img_picto($langs->trans(
'SharedProject'),
'world',
'class="paddingrightonly"');
1121 print $langs->trans(
'SharedProject');
1123 print img_picto($langs->trans(
'PrivateProject'),
'private',
'class="paddingrightonly"');
1124 print $langs->trans(
'PrivateProject');
1135 $forcefieldid =
'projectid';
1136 $moreparam =
'&withproject=1';
1137 include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_view.tpl.php';
1138 unset($forcefieldid, $moreparam);
1144 print
'<div class="fichehalfright">';
1145 print
'<div class="underbanner clearboth"></div>';
1147 print
'<table class="border tableforfield centpercent">';
1151 print
'<tr><td class="valignmiddle">' . $langs->trans(
"Categories") .
'</td><td>';
1152 print $form->showCategories($projectstatic->id,
'project', 1);
1157 print
'<tr><td class="titlefield'.($projectstatic->description ?
' noborderbottom' :
'').
'" colspan="2">'.$langs->trans(
"Description").
'</td></tr>';
1158 if ($projectstatic->description) {
1159 print
'<tr><td class="nottitleforfield" colspan="2">';
1160 print
'<div class="longmessagecut">';
1161 print dolPrintHTML($projectstatic->description);
1171 print
'<div class="clearboth"></div>';
1179 $linktocreatetimeBtnStatus = 0;
1180 $linktocreatetimeUrl =
'';
1181 $linktocreatetimeHelpText =
'';
1182 if ($user->hasRight(
'projet',
'time')) {
1183 if ($projectstatic->public || $userRead > 0) {
1184 $linktocreatetimeBtnStatus = 1;
1186 if (!empty($projectidforalltimes)) {
1188 $backtourl = $_SERVER[
'PHP_SELF'] .
'?projectid=' . $projectstatic->id . ($withproject ?
'&withproject=1' :
'');
1189 $linktocreatetimeUrl = $_SERVER[
'PHP_SELF'] .
'?' . ($withproject ?
'withproject=1' :
'') .
'&projectid=' . $projectstatic->id .
'&action=createtime&token=' .
newToken() . $param .
'&backtopage=' . urlencode($backtourl);
1192 $backtourl = $_SERVER[
'PHP_SELF'] .
'?id=' .
$object->id . ($withproject ?
'&withproject=1' :
'');
1193 $linktocreatetimeUrl = $_SERVER[
'PHP_SELF'] .
'?' . ($withproject ?
'withproject=1' :
'') . (
$object->id > 0 ?
'&id=' .
$object->id :
'&projectid=' . $projectstatic->id) .
'&action=createtime&token=' .
newToken() . $param .
'&backtopage=' . urlencode($backtourl);
1196 $linktocreatetimeBtnStatus = -2;
1197 $linktocreatetimeHelpText = $langs->trans(
"NotOwnerOfProject");
1200 $linktocreatetimeBtnStatus = -2;
1201 $linktocreatetimeHelpText = $langs->trans(
"NotEnoughPermissions");
1204 $paramsbutton = array(
'morecss' =>
'reposition');
1205 $linktocreatetime =
dolGetButtonTitle($langs->trans(
'AddTimeSpent'), $linktocreatetimeHelpText,
'fa fa-plus-circle', $linktocreatetimeUrl,
'', $linktocreatetimeBtnStatus, $paramsbutton);
1208 $massactionbutton =
'';
1209 $arrayofmassactions = array();
1211 if ($projectstatic->id > 0) {
1213 if ($projectstatic->usage_bill_time) {
1214 $arrayofmassactions = array(
1215 'generateinvoice' => $langs->trans(
"GenerateBill"),
1219 if (
isModEnabled(
'intervention') && $user->hasRight(
'ficheinter',
'creer')) {
1220 $langs->load(
"interventions");
1221 $arrayofmassactions[
'generateinter'] = $langs->trans(
"GenerateInter");
1224 if (in_array($massaction, array(
'presend',
'predelete',
'generateinvoice',
'generateinter'))) {
1225 $arrayofmassactions = array();
1227 $massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
1234 if (empty($projectidforalltimes) && empty($allprojectforuser)) {
1236 print
dol_get_fiche_head($head,
'task_time', $langs->trans(
"Task"), -1,
'projecttask', 0,
'',
'reposition');
1238 $param = (
GETPOST(
'withproject') ?
'&withproject=1' :
'');
1239 $linkback =
GETPOST(
'withproject') ?
'<a href="'.DOL_URL_ROOT.
'/projet/tasks.php?id='.$projectstatic->id.
'">'.$langs->trans(
"BackToList").
'</a>' :
'';
1241 if ($action ==
'deleteline') {
1242 $urlafterconfirm = $_SERVER[
"PHP_SELF"] .
"?" . (
$object->id > 0 ?
"id=" .
$object->id :
'projectid=' . $projectstatic->id) .
'&lineid=' .
GETPOSTINT(
"lineid") . $param;
1243 $formconfirm .= $form->formconfirm($urlafterconfirm, $langs->trans(
"DeleteATimeSpent"), $langs->trans(
"ConfirmDeleteATimeSpent"),
"confirm_deleteline",
'',
'', 1);
1246 if (!
GETPOST(
'withproject') || empty($projectstatic->id)) {
1247 $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1);
1248 $object->next_prev_filter =
"fk_projet:IN:" . $db->sanitize($projectsListId);
1250 $object->next_prev_filter =
"fk_projet:=:" . ((int) $projectstatic->id);
1256 if (empty($withproject)) {
1257 $morehtmlref .=
'<div class="refidno">';
1258 $morehtmlref .= $langs->trans(
"Project") .
': ';
1259 $morehtmlref .= $projectstatic->getNomUrl(1);
1260 $morehtmlref .=
'<br>';
1263 $morehtmlref .= $langs->trans(
"ThirdParty") .
': ';
1264 if (!empty($projectstatic->thirdparty) && is_object($projectstatic->thirdparty)) {
1265 $morehtmlref .= $projectstatic->thirdparty->getNomUrl(1);
1267 $morehtmlref .=
'</div>';
1270 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref, $param);
1272 print
'<div class="fichecenter">';
1273 print
'<div class="fichehalfleft">';
1275 print
'<div class="underbanner clearboth"></div>';
1276 print
'<table class="border centpercent tableforfield">';
1279 print
'<tr><td>' . $langs->trans(
"ParentTask") .
'</td><td>';
1280 if (
$object->fk_task_parent > 0) {
1281 $tasktmp =
new Task($db);
1282 $tasktmp->fetch(
$object->fk_task_parent);
1283 print $tasktmp->getNomUrl(1);
1288 print
'<tr><td class="titlefield">' . $langs->trans(
"DateStart") .
' - ' . $langs->trans(
"Deadline") .
'</td><td>';
1290 print($start ? $start :
'?');
1293 print($end ? $end :
'?');
1295 print img_warning(
"Late");
1300 print
'<tr><td>' . $langs->trans(
"PlannedWorkload") .
'</td><td>';
1301 if (
$object->planned_workload) {
1309 print
'<div class="fichehalfright">';
1311 print
'<div class="underbanner clearboth"></div>';
1312 print
'<table class="border tableforfield centpercent">';
1315 print
'<tr><td class="titlefield">' . $langs->trans(
"ProgressDeclared") .
'</td><td>';
1320 print
'<tr><td>' . $langs->trans(
"ProgressCalculated") .
'</td><td>';
1321 if (
$object->planned_workload) {
1322 $tmparray =
$object->getSummaryOfTimeSpent();
1323 if ($tmparray[
'total_duration'] > 0) {
1324 print round($tmparray[
'total_duration'] /
$object->planned_workload * 100, 2) .
' %';
1329 print
'<span class="opacitymedium">' . $langs->trans(
"WorkloadNotDefined") .
'</span>';
1340 print
'<div class="clearboth"></div>';
1344 if ($action ==
'deleteline') {
1345 $urlafterconfirm = $_SERVER[
"PHP_SELF"] .
"?" . ($projectstatic->id > 0 ?
'projectid=' . $projectstatic->id : (
$object->id > 0 ?
"id=" .
$object->id :
'')) .
'&lineid=' .
GETPOSTINT(
"lineid") . ($withproject ?
'&withproject=1' :
'').
"&contextpage=" . urlencode($contextpage).$param;
1346 $formconfirm .= $form->formconfirm($urlafterconfirm, $langs->trans(
"DeleteATimeSpent"), $langs->trans(
"ConfirmDeleteATimeSpent"),
"confirm_deleteline",
'',
'', 1);
1351 $parameters = array(
'formConfirm' => $formconfirm,
"projectstatic" => $projectstatic,
"withproject" => $withproject);
1352 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters, $object, $action);
1353 if (empty($reshook)) {
1354 $formconfirm .= $hookmanager->resPrint;
1355 } elseif ($reshook > 0) {
1356 $formconfirm = $hookmanager->resPrint;
1360 if ($projectstatic->id > 0 || $allprojectforuser > 0) {
1362 $hookmanager->initHooks(array(
'tasktimelist'));
1368 $arrayfields = array();
1369 $arrayfields[
't.element_date'] = array(
'label' => $langs->trans(
"Date"),
'checked' =>
'1');
1370 $arrayfields[
'p.fk_soc'] = array(
'label' => $langs->trans(
"ThirdParty"),
'type' =>
'integer:Societe:/societe/class/societe.class.php:1',
'checked' =>
'1');
1371 $arrayfields[
's.name_alias'] = array(
'label' => $langs->trans(
"AliasNameShort"),
'type' =>
'integer:Societe:/societe/class/societe.class.php:1');
1372 if ((empty($id) && empty($ref)) || !empty($projectidforalltimes)) {
1373 if (! empty($allprojectforuser)) {
1374 $arrayfields[
'p.project_ref'] = [
'label' => $langs->trans(
'RefProject'),
'checked' =>
'1'];
1375 $arrayfields[
'p.project_label'] = [
'label' => $langs->trans(
'ProjectLabel'),
'checked' =>
'1'];
1377 $arrayfields[
't.element_ref'] = array(
'label' => $langs->trans(
"RefTask"),
'checked' =>
'1');
1378 $arrayfields[
't.element_label'] = array(
'label' => $langs->trans(
"LabelTask"),
'checked' =>
'1');
1380 $arrayfields[
'author'] = array(
'label' => $langs->trans(
"By"),
'checked' =>
'1');
1381 $arrayfields[
't.note'] = array(
'label' => $langs->trans(
"Note"),
'checked' =>
'1');
1382 $arrayfields[
't.tms'] = array(
'label' => $langs->trans(
"DateModification"),
'checked' =>
'0');
1383 if (
isModEnabled(
'service') && !empty($projectstatic->thirdparty) && $projectstatic->thirdparty->id > 0 && $projectstatic->usage_bill_time) {
1384 $arrayfields[
't.fk_product'] = array(
'label' => $langs->trans(
"Product"),
'checked' =>
'1');
1386 $arrayfields[
't.element_duration'] = array(
'label' => $langs->trans(
"Duration"),
'checked' =>
'1');
1387 $arrayfields[
't.fk_product'] = array(
'label' => $langs->trans(
"Product"),
'checked' =>
'0',
'enabled' => (
string) (
int) (((
getDolGlobalInt(
'PROJECT_HIDE_TASKS') || !
getDolGlobalInt(
'PROJECT_BILL_TIME_SPENT')) ? 0 : 1) && $projectstatic->usage_bill_time));
1388 $arrayfields[
'value'] = array(
'label' => $langs->trans(
"Value"),
'checked' =>
'1',
'enabled' => (
string) (
int)
isModEnabled(
"salaries"));
1389 $arrayfields[
'valuebilled'] = array(
'label' => $langs->trans(
"Billed"),
'checked' =>
'1',
'enabled' => (
string) (
int) (((
getDolGlobalInt(
'PROJECT_HIDE_TASKS') || !
getDolGlobalInt(
'PROJECT_BILL_TIME_SPENT')) ? 0 : 1) && $projectstatic->usage_bill_time));
1391 include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_list_array_fields.tpl.php';
1396 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
1397 $param .=
'&contextpage=' . urlencode($contextpage);
1399 if ($limit > 0 && $limit !=
$conf->liste_limit) {
1400 $param .=
'&limit='.((int) $limit);
1403 $param .=
'&id='.((int) $id);
1405 if ($search_month > 0) {
1406 $param .=
'&search_month=' . urlencode((
string) ($search_month));
1408 if ($search_year > 0) {
1409 $param .=
'&search_year=' . urlencode((
string) ($search_year));
1411 if (!empty($search_user)) {
1412 $param .=
'&search_user='.urlencode($search_user);
1414 if ($search_task_ref !=
'') {
1415 $param .=
'&search_task_ref=' . urlencode($search_task_ref);
1417 if ($search_company !=
'') {
1418 $param .=
'&search_company=' . urlencode($search_company);
1420 if ($search_company_alias !=
'') {
1421 $param .=
'&search_company_alias=' . urlencode($search_company_alias);
1423 if ($search_project_ref !=
'') {
1424 $param .=
'&search_project_ref=' . urlencode($search_project_ref);
1426 if ($search_project_label !=
'') {
1427 $param .=
'&search_project_label=' . urlencode($search_project_label);
1429 if ($search_task_label !=
'') {
1430 $param .=
'&search_task_label=' . urlencode($search_task_label);
1432 if ($search_note !=
'') {
1433 $param .=
'&search_note=' . urlencode($search_note);
1435 if ($search_duration !=
'') {
1436 $param .=
'&search_field2=' . urlencode((
string) ($search_duration));
1438 if ($optioncss !=
'') {
1439 $param .=
'&optioncss=' . urlencode($optioncss);
1441 if ($search_date_startday) {
1442 $param .=
'&search_date_startday=' . urlencode((
string) ($search_date_startday));
1444 if ($search_date_startmonth) {
1445 $param .=
'&search_date_startmonth=' . urlencode((
string) ($search_date_startmonth));
1447 if ($search_date_startyear) {
1448 $param .=
'&search_date_startyear=' . urlencode((
string) ($search_date_startyear));
1450 if ($search_date_endday) {
1451 $param .=
'&search_date_endday=' . urlencode((
string) ($search_date_endday));
1453 if ($search_date_endmonth) {
1454 $param .=
'&search_date_endmonth=' . urlencode((
string) ($search_date_endmonth));
1456 if ($search_date_endyear) {
1457 $param .=
'&search_date_endyear=' . urlencode((
string) ($search_date_endyear));
1459 if ($search_timespent_starthour) {
1460 $param .=
'&search_timespent_duration_starthour=' . urlencode((
string) ($search_timespent_starthour));
1462 if ($search_timespent_startmin) {
1463 $param .=
'&search_timespent_duration_startmin=' . urlencode((
string) ($search_timespent_startmin));
1465 if ($search_timespent_endhour) {
1466 $param .=
'&search_timespent_duration_endhour=' . urlencode((
string) ($search_timespent_endhour));
1468 if ($search_timespent_endmin) {
1469 $param .=
'&search_timespent_duration_endmin=' . urlencode((
string) ($search_timespent_endmin));
1472 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
1474 $param .=
'&id=' . urlencode((
string) ($id));
1477 $param .=
'&projectid=' . urlencode((
string) ($projectid));
1480 $param .=
'&withproject=' . urlencode((
string) ($withproject));
1483 $parameters = array(
'param' => &$param);
1484 $reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
1485 $param .= $hookmanager->resPrint;
1487 print
'<form method="POST" action="' . $_SERVER[
"PHP_SELF"] .
'">';
1488 if ($optioncss !=
'') {
1489 print
'<input type="hidden" name="optioncss" value="' . $optioncss .
'">';
1491 print
'<input type="hidden" name="token" value="' .
newToken() .
'">';
1492 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1493 if ($action ==
'editline') {
1494 print
'<input type="hidden" name="action" value="updateline">';
1495 } elseif ($action ==
'splitline') {
1496 print
'<input type="hidden" name="action" value="updatesplitline">';
1497 } elseif ($action ==
'createtime' && $user->hasRight(
'projet',
'time')) {
1498 print
'<input type="hidden" name="action" value="addtimespent">';
1499 } elseif ($massaction ==
'generateinvoice' && $user->hasRight(
'facture',
'creer')) {
1500 print
'<input type="hidden" name="action" value="confirm_generateinvoice">';
1501 } elseif ($massaction ==
'generateinter' && $user->hasRight(
'ficheinter',
'creer')) {
1502 print
'<input type="hidden" name="action" value="confirm_generateinter">';
1504 print
'<input type="hidden" name="action" value="list">';
1506 print
'<input type="hidden" name="sortfield" value="' . $sortfield .
'">';
1507 print
'<input type="hidden" name="sortorder" value="' . $sortorder .
'">';
1511 print
'<input type="hidden" name="id" value="' . ((int) $id) .
'">';
1512 print
'<input type="hidden" name="projectid" value="' . $projectidforalltimes .
'">';
1513 print
'<input type="hidden" name="withproject" value="' . $withproject .
'">';
1514 print
'<input type="hidden" name="tab" value="' . $tab .
'">';
1515 print
'<input type="hidden" name="page_y" value="">';
1518 if ($massaction ==
'generateinvoice') {
1519 if (!empty($projectstatic->thirdparty) && $projectstatic->thirdparty->id > 0) {
1520 print
'<table class="noborder centerpercent">';
1522 print
'<td class="titlefield">';
1523 print $langs->trans(
'DateInvoice');
1526 print $form->selectDate(
'',
'', 0, 0, 0,
'', 1, 1);
1532 print $langs->trans(
'Mode');
1536 'onelineperuser' =>
'OneLinePerUser',
1537 'onelinepertask' =>
'OneLinePerTask',
1538 'onelineperperiod' =>
'OneLinePerTimeSpentLine',
1540 print $form->selectarray(
'generateinvoicemode', $tmparray,
'onelineperuser', 0, 0, 0,
'', 1);
1541 print
"\n" .
'<script type="text/javascript">';
1543 $(document).ready(function () {
1544 setDetailVisibility();
1545 $("#generateinvoicemode").change(function() {
1546 setDetailVisibility();
1548 function setDetailVisibility() {
1549 generateinvoicemode = $("#generateinvoicemode option:selected").val();
1550 if (generateinvoicemode=="onelineperperiod") {
1551 $("#detail_time_duration").show();
1553 $("#detail_time_duration").hide();
1558 print
'</script>' .
"\n";
1559 print
'<span style="display:none" id="detail_time_duration"><input type="checkbox" value="detail" name="detail_time_duration"/>' . $langs->trans(
'AddDetailDateAndDuration') .
'</span>';
1566 print $langs->trans(
'ServiceToUseOnLines');
1569 $form->select_produits(0,
'productid', 1, 0, $projectstatic->thirdparty->price_level, 1, 2,
'', 0, array(), $projectstatic->thirdparty->id,
'None', 0,
'maxwidth500');
1574 print
'<td class="titlefield">';
1575 print $langs->trans(
'InvoiceToUse');
1578 print $form->selectInvoiceForTimeProject($projectstatic->thirdparty->id,
'',
'invoiceid', 24, 0, $langs->trans(
'NewInvoice'), 1, 0, 0,
'maxwidth500',
'',
'all');
1582 print
'<td class="titlefield">';
1583 print $langs->trans(
"CustomerRelativeDiscount");
1586 print
'<input type="text" size="5" name="remiseproject" value="'.$projectstatic->thirdparty->remise_percent.
'">%';
1589 print
'<tr class="newinvoicedetail">';
1590 print
'<td class="titlefield">';
1591 print $langs->trans(
"PaymentConditions");
1594 print $form->getSelectConditionsPaiements((
int) $projectstatic->thirdparty->cond_reglement_id,
'condidproject');
1608 print
'<div class="center">';
1609 print
'<input type="submit" class="button" id="createbills" name="createbills" value="' . $langs->trans(
'GenerateBill') .
'"> ';
1610 print
'<input type="submit" class="button button-cancel" id="cancel" name="cancel" value="' . $langs->trans(
"Cancel") .
'">';
1614 print
'<div class="warning">' . $langs->trans(
"ThirdPartyRequiredToGenerateInvoice") .
'</div>';
1615 print
'<div class="center">';
1616 print
'<input type="submit" class="button button-cancel" id="cancel" name="cancel" value="' . $langs->trans(
"Cancel") .
'">';
1620 } elseif ($massaction ==
'generateinter') {
1622 print
'<input type="hidden" name="massaction" value="confirm_createinter">';
1624 if (!empty($projectstatic->thirdparty) && $projectstatic->thirdparty->id > 0) {
1626 print
'<table class="noborder centpercent">';
1628 print
'<td class="titlefield">';
1629 print img_picto(
'',
'intervention',
'class="pictofixedwidth"') . $langs->trans(
'InterToUse');
1633 print $forminter->select_interventions($projectstatic->thirdparty->id, 0,
'interid', 24, $langs->trans(
'NewInter'),
true);
1638 print
'<div class="center">';
1639 print
'<input type="submit" class="button" id="createinter" name="createinter" value="' . $langs->trans(
'GenerateInter') .
'"> ';
1640 print
'<input type="submit" class="button" id="cancel" name="cancel" value="' . $langs->trans(
'Cancel') .
'">';
1644 print
'<div class="warning">' . $langs->trans(
"ThirdPartyRequiredToGenerateIntervention") .
'</div>';
1645 print
'<div class="center">';
1646 print
'<input type="submit" class="button" id="cancel" name="cancel" value="' . $langs->trans(
'Cancel') .
'">';
1653 $parameters = array(
1654 'toselect' => $toselect,
1655 'uploaddir' => isset($uploaddir) ? $uploaddir : null
1658 $reshook = $hookmanager->executeHooks(
'doPreMassActions', $parameters, $object, $action);
1660 setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
1662 print $hookmanager->resPrint;
1670 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1671 $selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
$conf->main_checkbox_left_column);
1674 if ($projectstatic->usage_bill_time) {
1675 $arrayfields[
'valuebilled'][
'checked'] = 1;
1678 $sql =
"SELECT t.rowid, t.fk_element, t.element_date, t.element_datehour, t.element_date_withhour, t.element_duration, t.fk_user, t.note, t.thm,";
1679 $sql .=
" t.fk_product, t.invoice_line_id, t.import_key, t.datec, t.tms,";
1680 $sql .=
" pt.rowid as taskid, pt.ref, pt.label, pt.fk_projet, pt.billable,";
1681 $sql .=
" u.lastname, u.firstname, u.login, u.photo, u.gender, u.statut as user_status,";
1682 $sql .=
" il.fk_facture as invoice_id, inv.fk_statut,";
1683 $sql .=
" p.fk_soc, s.name_alias";
1684 if (!empty($extrafields->attributes[
'projet_task'][
'label'])) {
1685 foreach ($extrafields->attributes[
'projet_task'][
'label'] as $key => $val) {
1686 $sql .= ($extrafields->attributes[
'projet_task'][
'type'][$key] !=
'separate' ?
",efpt.".$key.
" as options_".$key :
'');
1690 $parameters = array();
1691 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
1692 $sql .= $hookmanager->resPrint;
1693 $sql = preg_replace(
'/,\s*$/',
'', $sql);
1697 $sql .=
" FROM ".MAIN_DB_PREFIX.
"element_time as t";
1698 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"facturedet as il ON il.rowid = t.invoice_line_id";
1699 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"facture as inv ON inv.rowid = il.fk_facture";
1700 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"product as prod ON prod.rowid = t.fk_product";
1701 $sql .=
" INNER JOIN ".MAIN_DB_PREFIX.
"projet_task as pt ON pt.rowid = t.fk_element";
1702 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet_task_extrafields as efpt ON pt.rowid = efpt.fk_object";
1703 $sql .=
" INNER JOIN ".MAIN_DB_PREFIX.
"projet as p ON p.rowid = pt.fk_projet";
1704 $sql .=
" INNER JOIN ".MAIN_DB_PREFIX.
"user as u ON t.fk_user = u.rowid";
1705 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s ON s.rowid = p.fk_soc";
1708 $parameters = array();
1709 $reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
1710 $sql .= $hookmanager->resPrint;
1711 $sql .=
" WHERE elementtype = 'task'";
1712 $sql .=
" AND p.entity IN (".getEntity(
'project').
")";
1713 if (!$user->hasRight(
'projet',
'all',
'lire')) {
1717 $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1, $user->socid > 0 ? $user->socid : 0, $filterproj);
1718 $sql .=
" AND p.rowid IN (".$db->sanitize($projectsListId).
")";
1720 if (empty($projectidforalltimes) && empty($allprojectforuser)) {
1722 $sql .=
" AND t.fk_element =".((int)
$object->id);
1723 } elseif (!empty($projectidforalltimes)) {
1725 $sql .=
" AND pt.fk_projet IN (" . $db->sanitize((
string) $projectidforalltimes) .
")";
1726 } elseif (!empty($allprojectforuser)) {
1728 if (empty($search_user) && !empty($arrayfields[
'author'][
'checked'])) {
1729 $search_user = $user->id;
1731 if ($search_user > 0) {
1732 $sql .=
" AND t.fk_user = " . ((int) $search_user);
1739 if ($search_task_ref) {
1742 if (empty($arrayfields[
's.name_alias'][
'checked']) && $search_company) {
1743 $sql .=
natural_search(array(
"s.nom",
"s.name_alias"), $search_company);
1745 if ($search_company) {
1748 if ($search_company_alias) {
1752 if ($search_project_ref) {
1755 if ($search_project_label) {
1758 if ($search_task_label) {
1761 if ($search_user > 0) {
1764 if (!empty($search_product_ref)) {
1767 if ($search_valuebilled ==
'1') {
1768 $sql .=
' AND t.invoice_id > 0';
1770 if ($search_valuebilled ==
'0') {
1771 $sql .=
' AND (t.invoice_id = 0 OR t.invoice_id IS NULL)';
1774 if ($search_date_start) {
1775 $sql .=
" AND t.element_date >= '".$db->idate($search_date_start).
"'";
1777 if ($search_date_end) {
1778 $sql .=
" AND t.element_date <= '".$db->idate($search_date_end).
"'";
1781 if (!empty($arrayfields[
't.element_duration'][
'checked'])) {
1782 if ($search_timespent_starthour || $search_timespent_startmin) {
1783 $timespent_duration_start = $search_timespent_starthour * 60 * 60;
1784 $timespent_duration_start += ($search_timespent_startmin ? $search_timespent_startmin : 0) * 60;
1785 $sql .=
" AND t.element_duration >= " . ((int) $timespent_duration_start);
1788 if ($search_timespent_endhour || $search_timespent_endmin) {
1789 $timespent_duration_end = $search_timespent_endhour * 60 * 60;
1790 $timespent_duration_end += ($search_timespent_endmin ? $search_timespent_endmin : 0) * 60;
1791 $sql .=
" AND t.element_duration <= " . ((int) $timespent_duration_end);
1795 $sql .=
dolSqlDateFilter(
't.element_datehour', $search_day, $search_month, $search_year);
1798 $extrafieldsobjectkey =
'projet_task';
1799 $extrafieldsobjectprefix =
'efpt.';
1800 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
1803 $parameters = array();
1804 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
1805 $sql .= $hookmanager->resPrint;
1808 $nbtotalofrecords =
'';
1811 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
1812 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
1813 $resql = $db->query($sqlforcount);
1815 $objforcount = $db->fetch_object($resql);
1816 $nbtotalofrecords = $objforcount->nbtotalofrecords;
1818 dol_print_error($db);
1821 if (($page * $limit) > (
int) $nbtotalofrecords) {
1829 $sql .= $db->order($sortfield, $sortorder);
1831 $sql .= $db->plimit($limit + 1, $offset);
1834 $resql = $db->query($sql);
1836 dol_print_error($db);
1840 $num = $db->num_rows($resql);
1843 if (!empty($projectidforalltimes)) {
1844 print
'<!-- List of time spent for project -->' .
"\n";
1846 $title = $langs->trans(
"ListTaskTimeUserProject");
1848 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'clock', 0, $linktocreatetime,
'', $limit, 0, 0, 1);
1850 print
'<!-- List of time spent -->' .
"\n";
1852 $title = $langs->trans(
"ListTaskTimeForTask");
1854 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'clock', 0, $linktocreatetime,
'', $limit, 0, 0, 1);
1859 $obj = $db->fetch_object($resql);
1867 dol_print_error($db);
1873 if ($action ==
'createtime' && $user->hasRight(
'projet',
'time')) {
1874 print
'<!-- table to add time spent -->' .
"\n";
1876 print
'<input type="hidden" name="taskid" value="' .
$id .
'">';
1879 print
'<div class="div-table-responsive-no-min">';
1880 print
'<table class="noborder nohover centpercent">';
1882 print
'<tr class="liste_titre">';
1883 print
'<td>' . $langs->trans(
"Date") .
'</td>';
1884 if (!empty($allprojectforuser)) {
1885 print
'<td>' . $langs->trans(
"Project") .
'</td>';
1888 print
'<td>' . $langs->trans(
"Task") .
'</td>';
1890 print
'<td>' . $langs->trans(
"By") .
'</td>';
1891 print
'<td>' . $langs->trans(
"Note") .
'</td>';
1892 print
'<td>' . $langs->trans(
"NewTimeSpent") .
'</td>';
1893 print
'<td>' . $langs->trans(
"ProgressDeclared") .
'</td>';
1897 if (
isModEnabled(
"service") && !empty($projectstatic->thirdparty) && $projectstatic->thirdparty->id > 0 && $projectstatic->usage_bill_time) {
1898 print
'<td>'.$langs->trans(
"Product").
'</td>';
1902 $parameters = array(
'mode' =>
'create');
1903 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
1904 print $hookmanager->resPrint;
1908 print
'<tr class="oddeven nohover">';
1911 print
'<td class="maxwidthonsmartphone">';
1913 print $form->selectDate($newdate,
'time', (
$conf->browser->layout ==
'phone' ? 2 : 1), 1, 2,
"timespent_date", 1, 0);
1916 if (!empty($allprojectforuser)) {
1925 print
'<td class="maxwidthonsmartphone">';
1926 $nboftasks = $formproject->selectTasks(-1,
GETPOSTINT(
'taskid'),
'taskid', 0, 0,
'1', 1, 0, 0,
'maxwidth300', (
string) $projectstatic->id,
'progress');
1931 print
'<td class="maxwidthonsmartphone nowraponall">';
1932 $contactsofproject = $projectstatic->getListContactId(
'internal');
1933 if (count($contactsofproject) > 0) {
1934 print img_object(
'',
'user',
'class="hideonsmartphone"');
1935 if (in_array($user->id, $contactsofproject)) {
1936 $userid = $user->id;
1938 $userid = $contactsofproject[0];
1941 if ($projectstatic->public) {
1942 $contactsofproject = array();
1944 print $form->select_dolusers((
GETPOSTINT(
'userid') ?
GETPOSTINT(
'userid') : $userid),
'userid', 0, null, 0,
'', $contactsofproject,
'0', 0, 0,
'', 0, $langs->trans(
"ResourceNotAssignedToProject"),
'minwidth150imp maxwidth200');
1947 print img_error($langs->trans(
'FirstAddRessourceToAllocateTime')) .
' ' . $langs->trans(
'FirstAddRessourceToAllocateTime');
1954 print
'<textarea name="timespent_note" class="maxwidth100onsmartphone" rows="' . ROWS_2 .
'">' . (
GETPOST(
'timespent_note') ?
GETPOST(
'timespent_note') :
'') .
'</textarea>';
1958 print
'<td class="nowraponall">';
1959 $durationtouse = (
GETPOST(
'timespent_duration') ?
GETPOST(
'timespent_duration') :
'');
1961 $durationtouse = ((int)
GETPOST(
'timespent_durationhour') * 3600 + (int)
GETPOST(
'timespent_durationmin') * 60);
1963 print $form->select_duration(
'timespent_duration', $durationtouse, 0,
'text');
1967 print
'<td class="nowrap">';
1968 print $formother->select_percent(
GETPOST(
'progress') ?
GETPOST(
'progress') :
$object->progress,
'progress', 0, 5, 0, 100, 1);
1976 if (
isModEnabled(
"service") && !empty($projectstatic->thirdparty) && $projectstatic->thirdparty->id > 0 && $projectstatic->usage_bill_time) {
1977 print
'<td class="nowraponall">';
1978 print img_picto(
'',
'service');
1979 print $form->select_produits((
GETPOSTISSET(
'fk_product') ?
GETPOSTINT(
"fk_product") :
''),
'fk_product', 1, 0, $projectstatic->thirdparty->price_level, 1, 2,
'', 1, array(), $projectstatic->thirdparty->id,
'None', 0,
'maxwidth150', ($user->hasRight(
'produit',
'lire') ? 0 : 1),
'', null, 1);
1985 $parameters = array(
'mode' =>
'create');
1986 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
1987 print $hookmanager->resPrint;
1989 print
'<td class="center">';
1990 $form->buttonsSaveCancel();
1991 print
'<input type="submit" name="save" class="button buttongen smallpaddingimp marginleftonly margintoponlyshort marginbottomonlyshort button-add reposition" value="'.$langs->trans(
"Add").
'">';
1992 print
'<input type="submit" name="cancel" class="button buttongen smallpaddingimp marginleftonly margintoponlyshort marginbottomonlyshort button-cancel" value="'.$langs->trans(
"Cancel").
'">';
2001 $moreforfilter =
'';
2003 $parameters = array();
2004 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
2005 if (empty($reshook)) {
2006 $moreforfilter .= $hookmanager->resPrint;
2008 $moreforfilter = $hookmanager->resPrint;
2011 if (!empty($moreforfilter)) {
2012 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
2013 print $moreforfilter;
2017 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
2018 $selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
$conf->main_checkbox_left_column);
2019 $selectedfields .= (is_array($arrayofmassactions) && count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
2022 if ($projectstatic->usage_bill_time) {
2023 $arrayfields[
'valuebilled'][
'checked'] = 1;
2026 print
'<!-- Liste of time spent -->'.
"\n";
2027 print
'<div class="div-table-responsive">';
2028 print
'<table class="tagtable nobottomiftotal liste' . ($moreforfilter ?
" listwithfilterbefore" :
"") .
'">' .
"\n";
2032 print
'<tr class="liste_titre_filter">';
2034 if (
$conf->main_checkbox_left_column) {
2035 print
'<td class="liste_titre center">';
2036 $searchpicto = $form->showFilterButtons(
'left');
2041 if (!empty($arrayfields[
't.element_date'][
'checked'])) {
2042 print
'<td class="liste_titre left">';
2043 print
'<div class="nowrapfordate paddingright">';
2044 print $form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
2046 print
'<div class="nowrapfordate">';
2047 print $form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
2052 if (!empty($arrayfields[
'p.fk_soc'][
'checked'])) {
2053 print
'<td class="liste_titre"><input type="text" class="flat maxwidth100" name="$search_company" value="' .
dol_escape_htmltag($search_company) .
'"></td>';
2057 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
2058 print
'<td class="liste_titre"><input type="text" class="flat maxwidth100" name="$search_company_alias" value="' .
dol_escape_htmltag($search_company_alias) .
'"></td>';
2061 if (!empty($allprojectforuser)) {
2062 if (!empty($arrayfields[
'p.project_ref'][
'checked'])) {
2063 print
'<td class="liste_titre"><input type="text" class="flat maxwidth100" name="$search_project_ref" value="' .
dol_escape_htmltag($search_project_ref) .
'"></td>';
2065 if (!empty($arrayfields[
'p.project_label'][
'checked'])) {
2066 print
'<td class="liste_titre"><input type="text" class="flat maxwidth100" name="$search_project_label" value="' .
dol_escape_htmltag($search_project_label) .
'"></td>';
2070 if ((empty($id) && empty($ref)) || !empty($projectidforalltimes)) {
2071 if (!empty($arrayfields[
't.element_ref'][
'checked'])) {
2072 print
'<td class="liste_titre"><input type="text" class="flat maxwidth75" name="search_task_ref" value="'.dol_escape_htmltag($search_task_ref).
'"></td>';
2074 if (!empty($arrayfields[
't.element_label'][
'checked'])) {
2075 print
'<td class="liste_titre"><input type="text" class="flat maxwidth100" name="search_task_label" value="'.dol_escape_htmltag($search_task_label).
'"></td>';
2079 if (!empty($arrayfields[
'author'][
'checked'])) {
2080 print
'<td class="liste_titre">'.$form->select_dolusers(($search_user > 0 ? $search_user : -1),
'search_user', 1, null, 0,
'',
'',
'0', 0, 0,
'', 0,
'',
'maxwidth125').
'</td>';
2083 if (!empty($arrayfields[
't.note'][
'checked'])) {
2084 print
'<td class="liste_titre"><input type="text" class="flat maxwidth75" name="search_note" value="' .
dol_escape_htmltag($search_note) .
'"></td>';
2087 if (!empty($arrayfields[
't.tms'][
'checked'])) {
2088 print
'<td class="liste_titre"></td>';
2091 if (!empty($arrayfields[
't.element_duration'][
'checked'])) {
2093 print
'<td class="liste_titre right">';
2095 $durationtouse_start =
'';
2096 if ($search_timespent_starthour || $search_timespent_startmin) {
2097 $durationtouse_start = ($search_timespent_starthour * 3600 + $search_timespent_startmin * 60);
2099 print
'<div class="nowraponall"><span class="opacitymedium">' . $langs->trans(
'fromhour') .
'</span> ';
2100 print $form->select_duration(
'search_timespent_duration_start', $durationtouse_start, 0,
'text', 0, 1);
2103 $durationtouse_end =
'';
2104 if ($search_timespent_endhour || $search_timespent_endmin) {
2105 $durationtouse_end = ($search_timespent_endhour * 3600 + $search_timespent_endmin * 60);
2107 print
'<div class="nowraponall"><span class="opacitymedium">' . $langs->trans(
'tohour') .
'</span> ';
2108 print $form->select_duration(
'search_timespent_duration_end', $durationtouse_end, 0,
'text', 0, 1);
2114 if (!empty($arrayfields[
't.fk_product'][
'checked'])) {
2115 print
'<td class="liste_titre"></td>';
2118 if (!empty($arrayfields[
'value'][
'checked'])) {
2119 print
'<td class="liste_titre"></td>';
2122 if (!empty($arrayfields[
'valuebilled'][
'checked'])) {
2123 print
'<td class="liste_titre center">' . $form->selectyesno(
'search_valuebilled', $search_valuebilled, 1,
false, 1) .
'</td>';
2127 $extrafieldsobjectkey =
'projet_task';
2128 $extrafieldsobjectprefix =
'ef.';
2129 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
2131 $parameters = array(
'arrayfields' => $arrayfields);
2132 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
2133 print $hookmanager->resPrint;
2135 if (!
$conf->main_checkbox_left_column) {
2136 print
'<td class="liste_titre center">';
2137 $searchpicto = $form->showFilterButtons();
2141 print
'</tr>' .
"\n";
2144 $totalarray = array();
2145 $totalarray[
'nbfield'] = 0;
2149 print
'<tr class="liste_titre">';
2150 if (
$conf->main_checkbox_left_column) {
2151 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'', $param,
'', $sortfield, $sortorder,
'center maxwidthsearch ');
2152 $totalarray[
'nbfield']++;
2154 if (!empty($arrayfields[
't.element_date'][
'checked'])) {
2155 print_liste_field_titre($arrayfields[
't.element_date'][
'label'], $_SERVER[
'PHP_SELF'],
't.element_date,t.element_datehour,t.rowid',
'', $param,
'', $sortfield, $sortorder);
2156 $totalarray[
'nbfield']++;
2158 if (!empty($arrayfields[
'p.fk_soc'][
'checked'])) {
2159 print_liste_field_titre($arrayfields[
'p.fk_soc'][
'label'], $_SERVER[
'PHP_SELF'],
't.element_date,t.element_datehour,t.rowid',
'', $param,
'', $sortfield, $sortorder);
2160 $totalarray[
'nbfield']++;
2162 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
2164 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
'PHP_SELF'],
's.name_alias',
'', $param,
'', $sortfield, $sortorder);
2165 $totalarray[
'nbfield']++;
2167 if (!empty($allprojectforuser)) {
2168 if (!empty($arrayfields[
'p.project_ref'][
'checked'])) {
2169 print_liste_field_titre($arrayfields[
'p.project_ref'][
'label'], $_SERVER[
'PHP_SELF'],
'p.ref',
'', $param,
'', $sortfield, $sortorder);
2170 $totalarray[
'nbfield']++;
2172 if (!empty($arrayfields[
'p.project_label'][
'checked'])) {
2173 print_liste_field_titre($arrayfields[
'p.project_label'][
'label'], $_SERVER[
'PHP_SELF'],
'p.title',
'', $param,
'', $sortfield, $sortorder);
2174 $totalarray[
'nbfield']++;
2177 if ((empty($id) && empty($ref)) || !empty($projectidforalltimes)) {
2178 if (!empty($arrayfields[
't.element_ref'][
'checked'])) {
2179 print_liste_field_titre($arrayfields[
't.element_ref'][
'label'], $_SERVER[
'PHP_SELF'],
'pt.ref',
'', $param,
'', $sortfield, $sortorder);
2180 $totalarray[
'nbfield']++;
2182 if (!empty($arrayfields[
't.element_label'][
'checked'])) {
2183 print_liste_field_titre($arrayfields[
't.element_label'][
'label'], $_SERVER[
'PHP_SELF'],
'pt.label',
'', $param,
'', $sortfield, $sortorder);
2184 $totalarray[
'nbfield']++;
2187 if (!empty($arrayfields[
'author'][
'checked'])) {
2188 print_liste_field_titre($arrayfields[
'author'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder);
2189 $totalarray[
'nbfield']++;
2191 if (!empty($arrayfields[
't.note'][
'checked'])) {
2192 print_liste_field_titre($arrayfields[
't.note'][
'label'], $_SERVER[
'PHP_SELF'],
't.note',
'', $param,
'', $sortfield, $sortorder);
2193 $totalarray[
'nbfield']++;
2195 if (!empty($arrayfields[
't.tms'][
'checked'])) {
2196 print_liste_field_titre($arrayfields[
't.tms'][
'label'], $_SERVER[
'PHP_SELF'],
't.tms',
'', $param,
'', $sortfield, $sortorder);
2197 $totalarray[
'nbfield']++;
2199 if (!empty($arrayfields[
't.element_duration'][
'checked'])) {
2200 print_liste_field_titre($arrayfields[
't.element_duration'][
'label'], $_SERVER[
'PHP_SELF'],
't.element_duration',
'', $param,
'', $sortfield, $sortorder,
'right ');
2201 $totalarray[
'nbfield']++;
2203 if (!empty($arrayfields[
't.fk_product'][
'checked'])) {
2204 print_liste_field_titre($arrayfields[
't.fk_product'][
'label'], $_SERVER[
'PHP_SELF'],
't.fk_product',
'', $param,
'', $sortfield, $sortorder);
2205 $totalarray[
'nbfield']++;
2208 if (!empty($arrayfields[
'value'][
'checked'])) {
2209 print_liste_field_titre($arrayfields[
'value'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
2210 $totalarray[
'nbfield']++;
2212 if (!empty($arrayfields[
'valuebilled'][
'checked'])) {
2213 print_liste_field_titre($arrayfields[
'valuebilled'][
'label'], $_SERVER[
'PHP_SELF'],
'il.total_ht',
'', $param,
'', $sortfield, $sortorder,
'center ', $langs->trans(
"SelectLinesOfTimeSpentToInvoice"));
2214 $totalarray[
'nbfield']++;
2217 $extrafieldsobjectkey =
'projet_task';
2218 $extrafieldsobjectprefix =
'ef.';
2219 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
2221 $parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder);
2222 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
2223 print $hookmanager->resPrint;
2224 if (!
$conf->main_checkbox_left_column) {
2225 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'', $param,
'', $sortfield, $sortorder,
'center maxwidthsearch ');
2226 $totalarray[
'nbfield']++;
2230 $tasktmp =
new Task($db);
2231 $tmpinvoice =
new Facture($db);
2234 $param .=
'&page='.((int) $page);
2236 $param .=
'&sortfield='.urlencode($sortfield).
'&sortorder='.urlencode($sortorder);
2240 $savnbfield = $totalarray[
'nbfield'];
2241 $totalarray = array();
2242 $totalarray[
'nbfield'] = 0;
2244 foreach ($tasks as $task_time) {
2250 $invoiced = $task_time->invoice_id ? true :
false;
2252 $date1 = $db->jdate($task_time->element_date);
2253 $date2 = $db->jdate($task_time->element_datehour);
2257 print
'<tr data-rowid="'.$task_time->rowid.
'" class="oddeven">';
2260 if (
$conf->main_checkbox_left_column) {
2261 print
'<td class="center nowraponall">';
2262 if (($action ==
'editline' || $action ==
'splitline') &&
GETPOSTINT(
'lineid') == $task_time->rowid) {
2263 print
'<input type="hidden" name="lineid" value="' .
GETPOSTINT(
'lineid') .
'">';
2265 print
'<input type="hidden" name="id" value="' .
$id .
'">';
2267 print
'<input type="submit" class="button buttongen reposition smallpaddingimp margintoponlyshort marginbottomonlyshort button-save" name="save" value="'.$langs->trans(
"Save").
'">';
2269 print
'<input type="submit" class="button buttongen reposition smallpaddingimp margintoponlyshort marginbottomonlyshort button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
2270 } elseif ($user->hasRight(
'projet',
'time') || $user->hasRight(
'projet',
'all',
'creer')) {
2271 if (in_array($task_time->fk_user, $childids) || $user->hasRight(
'projet',
'all',
'creer')) {
2272 print
'<a class="reposition editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?'.($withproject ?
'id='.$task_time->fk_element :
'').
'&action=editline&token='.
newToken().
'&lineid='.$task_time->rowid.$param.((empty($id) || $tab ==
'timespent') ?
'&tab=timespent' :
'').
'">';
2273 print img_edit(
'default', 0,
'class="pictofixedwidth paddingleft"');
2277 print
'<a class="reposition editfielda paddingleft" href="' . $_SERVER[
"PHP_SELF"] .
'?action=splitline&token=' .
newToken() .
'&lineid=' . $task_time->rowid . $param . ((empty($id) || $tab ==
'timespent') ?
'&tab=timespent' :
'') .
'">';
2278 print
img_split(
'',
'class="pictofixedwidth paddingleft"');
2282 print
'<a class="reposition paddingleft" href="'.$_SERVER[
"PHP_SELF"].
'?'.($withproject ?
'id='.$task_time->fk_element :
'').
'&action=deleteline&token='.
newToken().
'&lineid='.$task_time->rowid.$param.((empty($id) || $tab ==
'timespent') ?
'&tab=timespent' :
'').
'">';
2283 print img_delete(
'default',
'class="pictodelete paddingleft"');
2286 if ($massactionbutton || $massaction) {
2288 if (in_array($task_time->rowid, $arrayofselected)) {
2294 $disabled = (intval($task_time->billable) != 1 || $invoiced);
2295 $ctrl =
'<input '.($disabled ?
'disabled' :
'').
' id="cb' . $task_time->rowid .
'" class="flat checkforselect marginleftonly" type="checkbox" name="toselect[]" value="' . $task_time->rowid .
'"' . ($selected ?
' checked="checked"' :
'') .
'>';
2299 print
'<span id="cbsp'. $task_time->rowid .
'">'.$ctrl.
'</span>';
2300 print
'<script>$("#cbsp' . $task_time->rowid .
'").dblclick(()=>{ $("#cb' . $task_time->rowid .
'").removeAttr("disabled") })</script>';
2309 $totalarray[
'nbfield']++;
2314 if (!empty($arrayfields[
't.element_date'][
'checked'])) {
2315 print
'<td class="nowrap">';
2316 if ($action ==
'editline' &&
GETPOSTINT(
'lineid') == $task_time->rowid) {
2317 if (empty($task_time->element_date_withhour)) {
2318 print $form->selectDate(($date2 ? $date2 : $date1),
'timeline', 4, 3, 2,
"timespent_date", 1, 0);
2320 print $form->selectDate(($date2 ? $date2 : $date1),
'timeline', 2, 1, 2,
"timespent_date", 1, 0);
2323 print
dol_print_date(($date2 ? $date2 : $date1), ($task_time->element_date_withhour ?
'dayhour' :
'day'));
2327 $totalarray[
'nbfield']++;
2332 if (!empty($arrayfields[
'p.fk_soc'][
'checked'])) {
2333 print
'<td class="tdoverflowmax125">';
2334 if ($task_time->fk_soc > 0) {
2335 if (empty(
$conf->cache[
'thirdparty'][$task_time->fk_soc])) {
2336 $tmpsociete =
new Societe($db);
2337 $tmpsociete->fetch($task_time->fk_soc);
2338 $conf->cache[
'thirdparty'][$task_time->fk_soc] = $tmpsociete;
2340 $tmpsociete =
$conf->cache[
'thirdparty'][$task_time->fk_soc];
2342 print $tmpsociete->getNomUrl(1,
'', 100, 0, 1, empty($arrayfields[
's.name_alias'][
'checked']) ? 0 : 1);
2346 $totalarray[
'nbfield']++;
2351 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
2353 if ($task_time->fk_soc > 0) {
2354 if (empty(
$conf->cache[
'thirdparty'][$task_time->fk_soc])) {
2355 $tmpsociete =
new Societe($db);
2356 $tmpsociete->fetch($task_time->fk_soc);
2357 $conf->cache[
'thirdparty'][$task_time->fk_soc] = $tmpsociete;
2359 $tmpsociete =
$conf->cache[
'thirdparty'][$task_time->fk_soc];
2361 $valtoshow = $tmpsociete->name_alias;
2363 print
'<td class="nowrap tdoverflowmax150" title="'.dol_escape_htmltag($valtoshow).
'">';
2367 $totalarray[
'nbfield']++;
2371 if (!empty($allprojectforuser)) {
2373 if (!empty($arrayfields[
'p.project_ref'][
'checked'])) {
2374 if (empty(
$conf->cache[
'project'][$task_time->fk_projet])) {
2375 $tmpproject =
new Project($db);
2376 $tmpproject->fetch($task_time->fk_projet);
2377 $conf->cache[
'project'][$task_time->fk_projet] = $tmpproject;
2379 $tmpproject =
$conf->cache[
'project'][$task_time->fk_projet];
2381 print
'<td class="nowraponall">';
2382 print $tmpproject->getNomUrl(1);
2385 $totalarray[
'nbfield']++;
2389 if (!empty($arrayfields[
'p.project_label'][
'checked'])) {
2390 if (empty(
$conf->cache[
'project'][$task_time->fk_projet])) {
2391 $tmpproject =
new Project($db);
2392 $tmpproject->fetch($task_time->fk_projet);
2393 $conf->cache[
'project'][$task_time->fk_projet] = $tmpproject;
2395 $tmpproject =
$conf->cache[
'project'][$task_time->fk_projet];
2397 print
'<td class="tdoverflowmax250" title="'.dolPrintHTMLForAttribute($tmpproject->title).
'">';
2398 if (!empty($arrayfields[
'p.project_ref'][
'checked'])) {
2399 print dolPrintHTML($tmpproject->title);
2401 print $tmpproject->getNomUrl(1,
'', -1);
2405 $totalarray[
'nbfield']++;
2411 if (!empty($arrayfields[
't.element_ref'][
'checked'])) {
2412 if ((empty($id) && empty($ref)) || !empty($projectidforalltimes)) {
2413 print
'<td class="nowrap">';
2414 if ($action ==
'editline' &&
GETPOSTINT(
'lineid') == $task_time->rowid) {
2415 $formproject->selectTasks(-1,
GETPOSTINT(
'taskid') ?
GETPOSTINT(
'taskid') : $task_time->fk_element,
'taskid', 0, 0,
'1', 1, 0, 0,
'maxwidth250', (string) $projectstatic->id,
'');
2417 $tasktmp->id = $task_time->fk_element;
2418 $tasktmp->ref = $task_time->ref;
2419 $tasktmp->label = $task_time->label;
2420 print $tasktmp->getNomUrl(1,
'withproject',
'time');
2424 $totalarray[
'nbfield']++;
2427 } elseif ($action !==
'createtime') {
2428 print
'<input type="hidden" name="taskid" value="' .
$id .
'">';
2432 if (!empty($arrayfields[
't.element_label'][
'checked'])) {
2433 if ((empty($id) && empty($ref)) || !empty($projectidforalltimes)) {
2434 print
'<td class="tdoverflowmax250" title="'.dolPrintHTMLForAttribute($task_time->label).
'">';
2435 if (!empty($arrayfields[
't.element_ref'][
'checked'])) {
2436 print dolPrintHTML($task_time->label);
2438 $tasktmp->id = $task_time->fk_element;
2439 $tasktmp->ref = $task_time->ref;
2440 $tasktmp->label = $task_time->label;
2441 print $tasktmp->getNomUrl(1,
'withproject',
'time', -1);
2445 $totalarray[
'nbfield']++;
2451 if (!empty($arrayfields[
'author'][
'checked'])) {
2452 print
'<td class="tdoverflowmax125">';
2453 if ($action ==
'editline' &&
GETPOSTINT(
'lineid') == $task_time->rowid) {
2456 $object->fetch($task_time->fk_element);
2458 $contactsoftask =
$object->getListContactId(
'internal');
2459 if (!in_array($task_time->fk_user, $contactsoftask)) {
2460 $contactsoftask[] = $task_time->fk_user;
2462 if (count($contactsoftask) > 0) {
2463 print img_object(
'',
'user',
'class="pictofixedwidth hideonsmartphone"');
2464 print $form->select_dolusers($task_time->fk_user,
'userid_line', 0,
null, 0,
'', $contactsoftask,
'0', 0, 0,
'', 0,
'',
'minwidth100 maxwidth100');
2466 print img_error($langs->trans(
'FirstAddRessourceToAllocateTime')) . $langs->trans(
'FirstAddRessourceToAllocateTime');
2469 $userstatic->id = $task_time->fk_user;
2470 $userstatic->lastname = $task_time->lastname;
2471 $userstatic->firstname = $task_time->firstname;
2472 $userstatic->photo = $task_time->photo;
2473 $userstatic->gender = $task_time->gender;
2474 $userstatic->status = $task_time->user_status;
2476 print $userstatic->getNomUrl(-1);
2480 $totalarray[
'nbfield']++;
2485 if (!empty($arrayfields[
't.note'][
'checked'])) {
2486 if ($action ==
'editline' &&
GETPOSTINT(
'lineid') == $task_time->rowid) {
2487 print
'<td class="small">';
2488 print
'<textarea name="timespent_note_line" class="centpercentimp" rows="' . ROWS_2 .
'">' .
dol_escape_htmltag($task_time->note, 0, 1) .
'</textarea>';
2491 print
'<td class="small tdoverflowmax150 classfortooltip" title="'.dol_string_onlythesehtmltags(
dol_htmlentitiesbr($task_time->note)).
'">';
2496 $totalarray[
'nbfield']++;
2498 } elseif ($action ==
'editline' &&
GETPOSTINT(
'lineid') == $task_time->rowid) {
2499 print
'<input type="hidden" name="timespent_note_line" value="' .
dol_escape_htmltag($task_time->note, 0, 1) .
'">';
2503 if (!empty($arrayfields[
't.tms'][
'checked'])) {
2504 print
'<td class="nowraponall">';
2508 $totalarray[
'nbfield']++;
2513 if (!empty($arrayfields[
't.element_duration'][
'checked'])) {
2514 print
'<td class="right nowraponall">';
2515 if ($action ==
'editline' &&
GETPOSTINT(
'lineid') == $task_time->rowid) {
2516 print
'<input type="hidden" name="old_duration" value="'.$task_time->element_duration.
'">';
2517 print $form->select_duration(
'new_duration', $task_time->element_duration, 0,
'text');
2523 $totalarray[
'nbfield']++;
2526 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.element_duration';
2528 if (empty($totalarray[
'val'][
't.element_duration'])) {
2529 $totalarray[
'val'][
't.element_duration'] = $task_time->element_duration;
2531 $totalarray[
'val'][
't.element_duration'] += $task_time->element_duration;
2534 $totalarray[
'totaldurationfield'] = $totalarray[
'nbfield'];
2536 if (empty($totalarray[
'totalduration'])) {
2537 $totalarray[
'totalduration'] = $task_time->element_duration;
2539 $totalarray[
'totalduration'] += $task_time->element_duration;
2544 if (!empty($arrayfields[
't.fk_product'][
'checked'])) {
2545 print
'<td class="nowraponall">';
2546 if ($action ==
'editline' &&
GETPOSTINT(
'lineid') == $task_time->rowid) {
2547 print img_picto(
'',
'service');
2548 print $form->select_produits($task_time->fk_product,
'fk_product', 1, 0, $projectstatic->thirdparty->price_level, 1, 2,
'', 1, array(), $projectstatic->thirdparty->id,
'None', 0,
'maxwidth500', ($user->hasRight(
'produit',
'lire') ? 0 : 1),
'', null, 1);
2549 } elseif (!empty($task_time->fk_product)) {
2551 $resultFetch = $product->fetch($task_time->fk_product);
2552 if ($resultFetch < 0) {
2553 setEventMessages($product->error, $product->errors,
'errors');
2555 print $product->getNomUrl(1);
2560 $totalarray[
'nbfield']++;
2565 if (!empty($arrayfields[
'value'][
'checked'])) {
2566 $langs->load(
"salaries");
2567 $value =
price2num($task_time->thm * $task_time->element_duration / 3600,
'MT', 1);
2569 print
'<td class="nowraponall right">';
2570 print
'<span class="amount" title="' . $langs->trans(
"THM") .
': ' .
price($task_time->thm) .
'">';
2571 print
price($value, 1, $langs, 1, -1, -1,
$conf->currency);
2575 $totalarray[
'nbfield']++;
2578 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'value';
2580 if (empty($totalarray[
'val'][
'value'])) {
2581 $totalarray[
'val'][
'value'] = $value;
2583 $totalarray[
'val'][
'value'] += $value;
2586 $totalarray[
'totalvaluefield'] = $totalarray[
'nbfield'];
2588 if (empty($totalarray[
'totalvalue'])) {
2589 $totalarray[
'totalvalue'] = $value;
2591 $totalarray[
'totalvalue'] += $value;
2596 if (!empty($arrayfields[
'valuebilled'][
'checked'])) {
2597 print
'<td class="center">';
2599 if ($projectstatic->usage_bill_time) {
2600 if ($task_time->invoice_id) {
2601 $result = $tmpinvoice->fetch($task_time->invoice_id);
2603 if ($user->hasRight(
'facture',
'lire')) {
2604 if ($action ==
'editline' &&
GETPOSTINT(
'lineid') == $task_time->rowid) {
2605 print $formproject->selectInvoiceAndLine($task_time->invoice_id, $task_time->invoice_line_id,
'invoiceid',
'invoicelineid',
'maxwidth500', array(
'p.rowid' => $projectstatic->id));
2607 print $tmpinvoice->getNomUrl(1);
2608 if (!empty($task_time->invoice_line_id)) {
2610 $invoiceLine->fetch($task_time->invoice_line_id);
2611 if (!empty($invoiceLine->id)) {
2612 print
'<br><span class="small opacitymedium">'.$langs->trans(
'Qty').
':'.$invoiceLine->qty;
2613 print
' '.$langs->trans(
'TotalHT').
':'.
price($invoiceLine->total_ht);
2619 print $langs->trans(
"Yes");
2624 if (intval($task_time->billable) == 1) {
2625 print $langs->trans(
"No");
2627 print $langs->trans(
"Disabled");
2631 print
'<span class="opacitymedium">' . $langs->trans(
"NA") .
'</span>';
2636 $totalarray[
'nbfield']++;
2642 $extrafieldsobjectkey =
'projet_task';
2643 $extrafieldsobjectprefix =
'ef.';
2644 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
2647 $parameters = array(
'arrayfields' => $arrayfields,
'obj' => $task_time,
'i' => $i,
'totalarray' => &$totalarray);
2648 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
2649 print $hookmanager->resPrint;
2652 if (!
$conf->main_checkbox_left_column) {
2653 print
'<td class="center nowraponall">';
2654 if (($action ==
'editline' || $action ==
'splitline') &&
GETPOSTINT(
'lineid') == $task_time->rowid) {
2655 print
'<input type="hidden" name="lineid" value="'.GETPOSTINT(
'lineid').
'">';
2656 print
'<input type="submit" class="button buttongen smallpaddingimp margintoponlyshort marginbottomonlyshort button-save" name="save" value="'.$langs->trans(
"Save").
'">';
2658 print
'<input type="submit" class="button buttongen smallpaddingimp margintoponlyshort marginbottomonlyshort button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
2659 } elseif ($user->hasRight(
'projet',
'time') || $user->hasRight(
'projet',
'all',
'creer')) {
2660 if (in_array($task_time->fk_user, $childids) || $user->hasRight(
'projet',
'all',
'creer')) {
2661 print
'<a class="reposition editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?'.($withproject ?
'id='.$task_time->fk_element :
'').
'&action=editline&token='.
newToken().
'&lineid='.$task_time->rowid.$param.((empty($id) || $tab ==
'timespent') ?
'&tab=timespent' :
'').
'">';
2662 print img_edit(
'default', 0,
'class="pictofixedwidth paddingleft"');
2666 print
'<a class="reposition editfielda paddingleft" href="' . $_SERVER[
"PHP_SELF"] .
'?action=splitline&token=' .
newToken() .
'&lineid=' . $task_time->rowid . $param . ((empty($id) || $tab ==
'timespent') ?
'&tab=timespent' :
'') .
'">';
2667 print
img_split(
'',
'class="pictofixedwidth paddingleft"');
2671 print
'<a class="reposition paddingleft" href="'.$_SERVER[
"PHP_SELF"].
'?'.($withproject ?
'id='.$task_time->fk_element :
'').
'&action=deleteline&token='.
newToken().
'&lineid='.$task_time->rowid.$param.((empty($id) || $tab ==
'timespent') ?
'&tab=timespent' :
'').
'">';
2672 print img_delete(
'default',
'class="pictodelete paddingleft"');
2675 if ($massactionbutton || $massaction) {
2677 if (in_array($task_time->rowid, $arrayofselected)) {
2683 $disabled = (intval($task_time->billable) != 1 || $invoiced);
2684 $ctrl =
'<input '.($disabled ?
'disabled' :
'').
' id="cb' . $task_time->rowid .
'" class="flat checkforselect marginleftonly" type="checkbox" name="toselect[]" value="' . $task_time->rowid .
'"' . ($selected ?
' checked="checked"' :
'') .
'>';
2688 print
'<span id="cbsp'. $task_time->rowid .
'">'.$ctrl.
'</span>';
2689 print
'<script>$("#cbsp' . $task_time->rowid .
'").dblclick(()=>{ $("#cb' . $task_time->rowid .
'").removeAttr("disabled") })</script>';
2698 $totalarray[
'nbfield']++;
2707 if ($action ==
'splitline' &&
GETPOSTINT(
'lineid') == $task_time->rowid) {
2708 print
'<!-- first line -->';
2709 print
'<tr class="oddeven">';
2712 if (
$conf->main_checkbox_left_column) {
2717 if (!empty($arrayfields[
't.element_date'][
'checked'])) {
2718 print
'<td class="nowrap">';
2719 if ($action ==
'splitline' &&
GETPOSTINT(
'lineid') == $task_time->rowid) {
2720 if (empty($task_time->element_date_withhour)) {
2721 print $form->selectDate(($date2 ? $date2 : $date1),
'timeline', 3, 3, 2,
"timespent_date", 1, 0);
2723 print $form->selectDate(($date2 ? $date2 : $date1),
'timeline', 1, 1, 2,
"timespent_date", 1, 0);
2726 print
dol_print_date(($date2 ? $date2 : $date1), ($task_time->element_date_withhour ?
'dayhour' :
'day'));
2732 if (!empty($arrayfields[
'p.fk_soc'][
'checked'])) {
2733 print
'<td class="nowrap">';
2738 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
2739 print
'<td class="nowrap">';
2744 if (!empty($allprojectforuser)) {
2745 if ((empty($id) && empty($ref)) || !empty($projectidforalltimes)) {
2746 print
'<td class="nowrap">';
2752 if (!empty($arrayfields[
't.element_ref'][
'checked'])) {
2753 if ((empty($id) && empty($ref)) || !empty($projectidforalltimes)) {
2754 print
'<td class="nowrap">';
2755 $tasktmp->id = $task_time->fk_element;
2756 $tasktmp->ref = $task_time->ref;
2757 $tasktmp->label = $task_time->label;
2758 print $tasktmp->getNomUrl(1,
'withproject',
'time');
2764 if (!empty($arrayfields[
't.element_label'][
'checked'])) {
2765 if ((empty($id) && empty($ref)) || !empty($projectidforalltimes)) {
2766 print
'<td class="tdoverflowmax300" title="'.dol_escape_htmltag($task_time->label).
'">';
2773 if (!empty($arrayfields[
'author'][
'checked'])) {
2774 print
'<td class="nowraponall">';
2775 if ($action ==
'splitline' &&
GETPOSTINT(
'lineid') == $task_time->rowid) {
2777 $idTask = (!empty($id)) ? $id : $task_time->fk_element;
2780 $contactsoftask =
$object->getListContactId(
'internal');
2781 if (!in_array($task_time->fk_user, $contactsoftask)) {
2782 $contactsoftask[] = $task_time->fk_user;
2784 if (count($contactsoftask) > 0) {
2785 print img_object(
'',
'user',
'class="hideonsmartphone"');
2786 print $form->select_dolusers($task_time->fk_user,
'userid_line', 0,
null, 0,
'', $contactsoftask);
2788 print img_error($langs->trans(
'FirstAddRessourceToAllocateTime')) . $langs->trans(
'FirstAddRessourceToAllocateTime');
2791 $userstatic->id = $task_time->fk_user;
2792 $userstatic->lastname = $task_time->lastname;
2793 $userstatic->firstname = $task_time->firstname;
2794 $userstatic->photo = $task_time->photo;
2795 $userstatic->status = $task_time->user_status;
2796 print $userstatic->getNomUrl(-1);
2802 if (!empty($arrayfields[
't.note'][
'checked'])) {
2803 print
'<td class="tdoverflowmax300">';
2804 if ($action ==
'splitline' &&
GETPOSTINT(
'lineid') == $task_time->rowid) {
2805 print
'<textarea name="timespent_note_line" class="centpercentimp" rows="' . ROWS_2 .
'">' .
dol_escape_htmltag($task_time->note, 0, 1) .
'</textarea>';
2810 } elseif ($action ==
'splitline' &&
GETPOSTINT(
'lineid') == $task_time->rowid) {
2811 print
'<input type="hidden" name="timespent_note_line" rows="' . ROWS_2 .
'" value="' .
dol_escape_htmltag($task_time->note, 0, 1) .
'">';
2815 if (!empty($arrayfields[
't.tms'][
'checked'])) {
2816 print
'<td class="nowraponall">';
2821 if (!empty($arrayfields[
't.element_duration'][
'checked'])) {
2822 print
'<td class="right">';
2823 if ($action ==
'splitline' &&
GETPOSTINT(
'lineid') == $task_time->rowid) {
2824 print
'<input type="hidden" name="old_duration" value="'.$task_time->element_duration.
'">';
2825 print $form->select_duration(
'new_duration', $task_time->element_duration, 0,
'text');
2833 if (!empty($arrayfields[
't.fk_product'][
'checked'])) {
2834 print
'<td class="nowraponall tdoverflowmax125">';
2839 if (!empty($arrayfields[
'value'][
'checked'])) {
2840 print
'<td class="right">';
2841 print
'<span class="amount">';
2842 $value =
price2num($task_time->thm * $task_time->element_duration / 3600,
'MT', 1);
2843 print
price($value, 1, $langs, 1, -1, -1,
$conf->currency);
2849 if (!empty($arrayfields[
'valuebilled'][
'checked'])) {
2850 print
'<td class="right">';
2851 $valuebilled =
price2num($task_time->total_ht,
'', 1);
2852 if (isset($task_time->total_ht)) {
2853 print
price($valuebilled, 1, $langs, 1, -1, -1,
$conf->currency);
2860 $extrafieldsobjectkey =
'projet_task';
2861 $extrafieldsobjectprefix =
'ef.';
2862 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
2865 $parameters = array(
'arrayfields' => $arrayfields,
'obj' => $task_time,
'mode' =>
'split1');
2866 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
2867 print $hookmanager->resPrint;
2870 if (!
$conf->main_checkbox_left_column) {
2871 print
'<td class="center nowraponall">';
2880 print
'<!-- second line --><tr class="oddeven">';
2883 if (
$conf->main_checkbox_left_column) {
2884 print
'<td class="center nowraponall">';
2889 if (!empty($arrayfields[
't.element_date'][
'checked'])) {
2890 print
'<td class="nowraponall">';
2891 if ($action ==
'splitline' &&
GETPOSTINT(
'lineid') == $task_time->rowid) {
2892 if (empty($task_time->element_date_withhour)) {
2893 print $form->selectDate(($date2 ? $date2 : $date1),
'timeline_2', 3, 3, 2,
"timespent_date", 1, 0);
2895 print $form->selectDate(($date2 ? $date2 : $date1),
'timeline_2', 1, 1, 2,
"timespent_date", 1, 0);
2898 print
dol_print_date(($date2 ? $date2 : $date1), ($task_time->element_date_withhour ?
'dayhour' :
'day'));
2904 if (!empty($arrayfields[
'p.fk_soc'][
'checked'])) {
2910 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
2916 if (!empty($allprojectforuser)) {
2917 if ((empty($id) && empty($ref)) || !empty($projectidforalltimes)) {
2924 if (!empty($arrayfields[
't.element_ref'][
'checked'])) {
2925 if ((empty($id) && empty($ref)) || !empty($projectidforalltimes)) {
2926 print
'<td class="nowraponall">';
2927 $tasktmp->id = $task_time->fk_element;
2928 $tasktmp->ref = $task_time->ref;
2929 $tasktmp->label = $task_time->label;
2930 print $tasktmp->getNomUrl(1,
'withproject',
'time');
2936 if (!empty($arrayfields[
't.element_label'][
'checked'])) {
2937 if ((empty($id) && empty($ref)) || !empty($projectidforalltimes)) {
2938 print
'<td class="tdoverflowmax125" title="'.dol_escape_htmltag($task_time->label).
'">';
2945 if (!empty($arrayfields[
'author'][
'checked'])) {
2946 print
'<td class="nowraponall tdoverflowmax100">';
2947 if ($action ==
'splitline' &&
GETPOSTINT(
'lineid') == $task_time->rowid) {
2949 $idTask = (!empty($id)) ? $id : $task_time->fk_element;
2952 $contactsoftask =
$object->getListContactId(
'internal');
2953 if (!in_array($task_time->fk_user, $contactsoftask)) {
2954 $contactsoftask[] = $task_time->fk_user;
2956 if (count($contactsoftask) > 0) {
2957 print img_object(
'',
'user',
'class="hideonsmartphone"');
2958 print $form->select_dolusers($task_time->fk_user,
'userid_line_2', 0,
null, 0,
'', $contactsoftask);
2960 print img_error($langs->trans(
'FirstAddRessourceToAllocateTime')) . $langs->trans(
'FirstAddRessourceToAllocateTime');
2963 $userstatic->id = $task_time->fk_user;
2964 $userstatic->lastname = $task_time->lastname;
2965 $userstatic->firstname = $task_time->firstname;
2966 $userstatic->photo = $task_time->photo;
2967 $userstatic->status = $task_time->user_status;
2968 print $userstatic->getNomUrl(-1);
2974 if (!empty($arrayfields[
't.note'][
'checked'])) {
2975 print
'<td class="small tdoverflowmax300"">';
2976 if ($action ==
'splitline' &&
GETPOSTINT(
'lineid') == $task_time->rowid) {
2977 print
'<textarea name="timespent_note_line_2" class="centpercentimp" rows="' . ROWS_2 .
'">' .
dol_escape_htmltag($task_time->note, 0, 1) .
'</textarea>';
2982 } elseif ($action ==
'splitline' &&
GETPOSTINT(
'lineid') == $task_time->rowid) {
2983 print
'<input type="hidden" name="timespent_note_line_2" value="' .
dol_escape_htmltag($task_time->note, 0, 1) .
'">';
2987 if (!empty($arrayfields[
't.tms'][
'checked'])) {
2988 print
'<td class="nowraponall">';
2994 if (!empty($arrayfields[
't.element_duration'][
'checked'])) {
2995 print
'<td class="right">';
2996 if ($action ==
'splitline' &&
GETPOSTINT(
'lineid') == $task_time->rowid) {
2997 print
'<input type="hidden" name="old_duration_2" value="0">';
2998 print $form->select_duration(
'new_duration_2', 0, 0,
'text');
3006 if (!empty($arrayfields[
't.fk_product'][
'checked'])) {
3007 print
'<td class="nowraponall tdoverflowmax125">';
3012 if (!empty($arrayfields[
'value'][
'checked'])) {
3013 print
'<td class="right">';
3014 print
'<span class="amount nowraponall">';
3016 print
price($value, 1, $langs, 1, -1, -1,
$conf->currency);
3023 if (!empty($arrayfields[
'valuebilled'][
'checked'])) {
3024 print
'<td class="right">';
3025 if (isset($task_time->total_ht)) {
3026 $valuebilled =
price2num($task_time->total_ht,
'', 1);
3027 print
'<span class="amount nowraponall small">';
3028 print
price($valuebilled, 1, $langs, 1, -1, -1,
$conf->currency);
3036 $extrafieldsobjectkey =
'projet_task';
3037 $extrafieldsobjectprefix =
'ef.';
3038 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
3041 $parameters = array(
'arrayfields' => $arrayfields,
'obj' => $task_time,
'mode' =>
'split2');
3042 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
3043 print $hookmanager->resPrint;
3046 if (!
$conf->main_checkbox_left_column) {
3047 print
'<td class="center nowraponall">';
3059 if (isset($totalarray[
'totaldurationfield']) || isset($totalarray[
'totalvaluefield'])) {
3060 print
'<tr class="liste_total">';
3062 while ($i < $totalarray[
'nbfield']) {
3065 if ($num < $limit && empty($offset)) {
3066 print
'<td class="left">' . $langs->trans(
"Total") .
'</td>';
3068 print
'<td class="left">'.$form->textwithpicto($langs->trans(
"Total"), $langs->trans(
"Totalforthispage")).
'</td>';
3070 } elseif (isset($totalarray[
'totaldurationfield']) && $totalarray[
'totaldurationfield'] == $i) {
3071 print
'<td class="right">' .
convertSecondToTime($totalarray[
'totalduration'],
'allhourmin') .
'</td>';
3072 } elseif (isset($totalarray[
'totalvaluefield']) && $totalarray[
'totalvaluefield'] == $i) {
3073 print
'<td class="right">' .
price($totalarray[
'totalvalue']) .
'</td>';
3082 if (!count($tasks)) {
3083 $totalnboffields = 1;
3084 foreach ($arrayfields as $value) {
3085 if (!empty($value[
'checked'])) {
3089 print
'<tr class="oddeven"><td colspan="' . $totalnboffields .
'">';
3090 print
'<span class="opacitymedium">' . $langs->trans(
"None") .
'</span>';
3094 $parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
3095 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
3096 print $hookmanager->resPrint;
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
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.
Class to manage invoices.
Class to manage invoice lines.
Class to manage products or services.
Class to manage projects.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage Dolibarr users.
dolSqlDateFilter($datefield, $day_date, $month_date, $year_date, $excludefirstand=0, $gm=false)
Generate a SQL string to make a filter into a range (for second of date until last second of date).
convertSecondToTime($iSecond, $format='all', $lengthOfDay=86400, $lengthOfWeek=7)
Return, in clear text, value of a number of seconds in days, hours and minutes.
$date_start
Variables from include:
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...
get_default_localtax($thirdparty_seller, $thirdparty_buyer, $local, $idprod=0)
Function that return localtax of a product line (according to seller, buyer and product vat rate) If ...
dolGetFirstLineOfText($text, $nboflines=1, $charset='UTF-8')
Return first line of text.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_eval($s, $returnvalue=1, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
dol_nl2br($stringtoencode, $nl2brmode=0, $forxml=false)
Replace CRLF in string with a HTML BR tag.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
natural_search($fields, $value, $mode=0, $nofirstand=0, $sqltoadd='')
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by the value of a given key, which produces ascending (default) or descending out...
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
dol_concatdesc($text1, $text2, $forxml=false, $invert=false)
Concat 2 descriptions with a new line between them (second operand after first one with appropriate n...
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_clone($srcobject, $native=2)
Create a clone of instance of object (new instance with same value for each properties) With native =...
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).
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
dol_htmlentitiesbr($stringtoencode, $nl2brmode=0, $pagecodefrom='UTF-8', $removelasteolbr=1)
This function is called to encode a string into a HTML string but differs from htmlentities because a...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
get_default_tva(Societe $thirdparty_seller, Societe $thirdparty_buyer, $idprod=0, $idprodfournprice=0)
Function that return vat rate of a product line (according to seller, buyer and product vat rate) VAT...
get_localtax($vatrate, $local, $thirdparty_buyer=null, $thirdparty_seller=null, $vatnpr=0)
Return localtax rate for a particular VAT rate, when selling a product with vat $vatrate,...
print_liste_field_titre($name, $file="", $field="", $begin="", $param="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
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.
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
img_split($titlealt='default', $other='class="pictosplit"')
Show split logo.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
task_prepare_head($object)
Prepare array with list of tabs.
project_prepare_head(Project $project, $moreparam='')
Prepare array with list of tabs.
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.