29 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
41 global $db, $langs, $conf, $user;
46 $head[$h][0] = DOL_URL_ROOT.
'/projet/card.php?id='.((int) $project->id).($moreparam ?
'&'.$moreparam :
'');
47 $head[$h][1] = $langs->trans(
"Project");
48 $head[$h][2] =
'project';
52 require_once DOL_DOCUMENT_ROOT.
'/core/lib/memory.lib.php';
53 $cachekey =
'count_contacts_project_'.$project->id;
56 if (!is_null($dataretrieved)) {
57 $nbContacts = $dataretrieved;
59 $nbContacts = count($project->liste_contact(-1,
'internal')) + count($project->liste_contact(-1,
'external'));
62 $head[$h][0] = DOL_URL_ROOT.
'/projet/contact.php?id='.((int) $project->id).($moreparam ?
'&'.$moreparam :
'');
63 $head[$h][1] = $langs->trans(
"ProjectContact");
64 if ($nbContacts > 0) {
65 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbContacts.
'</span>';
67 $head[$h][2] =
'contact';
70 if (empty($conf->global->PROJECT_HIDE_TASKS)) {
74 require_once DOL_DOCUMENT_ROOT.
'/core/lib/memory.lib.php';
75 $cachekey =
'count_tasks_project_'.$project->id;
78 if (!is_null($dataretrieved)) {
79 $nbTasks = $dataretrieved;
81 require_once DOL_DOCUMENT_ROOT.
'/projet/class/task.class.php';
82 $taskstatic =
new Task($db);
83 $nbTasks = count($taskstatic->getTasksArray(0, 0, $project->id, 0, 0));
86 $head[$h][0] = DOL_URL_ROOT.
'/projet/tasks.php?id='.((int) $project->id).($moreparam ?
'&'.$moreparam :
'');
87 $head[$h][1] = $langs->trans(
"Tasks");
89 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.($nbTasks).
'</span>';
91 $head[$h][2] =
'tasks';
96 $cachekey =
'count_timespent_project_'.$project->id;
98 if (!is_null($dataretrieved)) {
99 $nbTimeSpent = $dataretrieved;
101 $sql =
"SELECT t.rowid";
104 $sql .=
" FROM ".MAIN_DB_PREFIX.
"element_time as t, ".MAIN_DB_PREFIX.
"projet_task as pt";
105 $sql .=
" WHERE t.fk_element = pt.rowid";
106 $sql .=
" AND t.elementtype = 'task'";
107 $sql .=
" AND pt.fk_projet =".((int) $project->id);
108 $resql = $db->query(
$sql);
110 $obj = $db->fetch_object($resql);
120 $head[$h][0] = DOL_URL_ROOT.
'/projet/tasks/time.php?withproject=1&projectid='.((int) $project->id).($moreparam ?
'&'.$moreparam :
'');
121 $head[$h][1] = $langs->trans(
"TimeSpent");
122 if ($nbTimeSpent > 0) {
123 $head[$h][1] .=
'<span class="badge marginleftonlyshort">...</span>';
125 $head[$h][2] =
'timespent';
135 $cachekey =
'count_elements_project_'.$project->id;
137 if (!is_null($dataretrieved)) {
138 $nbElements = $dataretrieved;
141 $nbElements += $project->getElementCount(
'stock',
'entrepot',
'fk_project');
144 $nbElements += $project->getElementCount(
'propal',
'propal');
147 $nbElements += $project->getElementCount(
'order',
'commande');
150 $nbElements += $project->getElementCount(
'invoice',
'facture');
153 $nbElements += $project->getElementCount(
'invoice_predefined',
'facture_rec');
156 $nbElements += $project->getElementCount(
'proposal_supplier',
'supplier_proposal');
159 $nbElements += $project->getElementCount(
'order_supplier',
'commande_fournisseur');
162 $nbElements += $project->getElementCount(
'invoice_supplier',
'facture_fourn');
165 $nbElements += $project->getElementCount(
'contract',
'contrat');
168 $nbElements += $project->getElementCount(
'intervention',
'fichinter');
171 $nbElements += $project->getElementCount(
'shipping',
'expedition');
174 $nbElements += $project->getElementCount(
'mrp',
'mrp_mo',
'fk_project');
177 $nbElements += $project->getElementCount(
'trip',
'deplacement');
180 $nbElements += $project->getElementCount(
'expensereport',
'expensereport');
183 $nbElements += $project->getElementCount(
'donation',
'don');
186 $nbElements += $project->getElementCount(
'loan',
'loan');
189 $nbElements += $project->getElementCount(
'chargesociales',
'chargesociales');
192 $nbElements += $project->getElementCount(
'project_task',
'projet_task');
195 $nbElements += $project->getElementCount(
'stock_mouvement',
'stock');
198 $nbElements += $project->getElementCount(
'salaries',
'payment_salary');
201 $nbElements += $project->getElementCount(
'variouspayment',
'payment_various');
205 $head[$h][0] = DOL_URL_ROOT.
'/projet/element.php?id='.$project->id;
206 $head[$h][1] = $langs->trans(
"ProjectOverview");
207 if ($nbElements > 0) {
208 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbElements.
'</span>';
210 $head[$h][2] =
'element';
214 if (
isModEnabled(
'ticket') && $user->hasRight(
'ticket',
'read')) {
215 require_once DOL_DOCUMENT_ROOT.
'/ticket/class/ticket.class.php';
216 $Tickettatic =
new Ticket($db);
217 $nbTicket = count($Tickettatic->getAllItemsLinkedByObjectID($project->id,
'*',
'fk_project',
'ticket'));
218 $head[$h][0] = DOL_URL_ROOT.
'/ticket/list.php?projectid='.((int) $project->id);
219 $head[$h][1] = $langs->trans(
"Ticket");
221 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.($nbTicket).
'</span>';
223 $head[$h][2] =
'ticket';
227 if (
isModEnabled(
'eventorganization') && !empty($project->usage_organize_event)) {
228 $langs->load(
'eventorganization');
229 $head[$h][0] = DOL_URL_ROOT .
'/eventorganization/conferenceorbooth_list.php?projectid=' . $project->id;
230 $head[$h][1] = $langs->trans(
"EventOrganization");
233 $nbConfOrBooth = 0; $nbAttendees = 0;
234 require_once DOL_DOCUMENT_ROOT.
'/core/lib/memory.lib.php';
235 $cachekey =
'count_conferenceorbooth_'.$project->id;
237 if (!is_null($dataretrieved)) {
238 $nbConfOrBooth = $dataretrieved;
240 require_once DOL_DOCUMENT_ROOT.
'/eventorganization/class/conferenceorbooth.class.php';
242 $result = $conforbooth->fetchAll(
'',
'', 0, 0, array(
't.fk_project'=>$project->id));
244 if (!is_array($result) && $result<0) {
247 $nbConfOrBooth = count($result);
251 $cachekey =
'count_attendees_'.$project->id;
253 if (!is_null($dataretrieved)) {
254 $nbAttendees = $dataretrieved;
256 require_once DOL_DOCUMENT_ROOT.
'/eventorganization/class/conferenceorboothattendee.class.php';
258 $result = $conforboothattendee->fetchAll(
'',
'', 0, 0, array(
't.fk_project'=>$project->id));
260 if (!is_array($result) && $result<0) {
261 setEventMessages($conforboothattendee->error, $conforboothattendee->errors,
'errors');
263 $nbAttendees = count($result);
267 if ($nbConfOrBooth > 0 || $nbAttendees > 0) {
268 $head[$h][1] .=
'<span class="badge marginleftonlyshort">';
269 $head[$h][1] .=
'<span title="'.dol_escape_htmltag($langs->trans(
"ConferenceOrBooth")).
'">'.$nbConfOrBooth.
'</span>';
270 if ($nbConfOrBooth > 0 && $nbAttendees > 0) {
271 $head[$h][1] .=
' + ';
273 $head[$h][1] .=
'<span title="'.dol_escape_htmltag($langs->trans(
"Attendees")).
'">'.$nbAttendees.
'</span>';
274 $head[$h][1] .=
'</span>';
276 $head[$h][2] =
'eventorganisation';
287 if (empty($conf->global->MAIN_DISABLE_NOTES_TAB)) {
289 if (!empty($project->note_private)) {
292 if (!empty($project->note_public)) {
295 $head[$h][0] = DOL_URL_ROOT.
'/projet/note.php?id='.$project->id;
296 $head[$h][1] = $langs->trans(
'Notes');
298 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbNote.
'</span>';
300 $head[$h][2] =
'notes';
307 require_once DOL_DOCUMENT_ROOT.
'/core/lib/memory.lib.php';
308 $cachekey =
'count_attached_project_'.$project->id;
310 if (!is_null($dataretrieved)) {
311 $totalAttached = $dataretrieved;
313 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
314 require_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
315 $upload_dir = $conf->project->multidir_output[$project->entity].
"/".
dol_sanitizeFileName($project->ref);
316 $nbFiles = count(
dol_dir_list($upload_dir,
'files', 0,
'',
'(\.meta|_preview.*\.png)$'));
317 $nbLinks =
Link::count($db, $project->element, $project->id);
318 $totalAttached = $nbFiles + $nbLinks;
321 $head[$h][0] = DOL_URL_ROOT.
'/projet/document.php?id='.$project->id;
322 $head[$h][1] = $langs->trans(
'Documents');
323 if (($totalAttached) > 0) {
324 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.($totalAttached).
'</span>';
326 $head[$h][2] =
'document';
330 if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT)) {
333 require_once DOL_DOCUMENT_ROOT.
'/core/lib/memory.lib.php';
334 $cachekey =
'count_attached_project_'.$project->id;
336 if (!is_null($dataretrieved)) {
337 $nbComments = $dataretrieved;
339 $nbComments = $project->getNbComments();
342 $head[$h][0] = DOL_URL_ROOT.
'/projet/comment.php?id='.$project->id;
343 $head[$h][1] = $langs->trans(
"CommentLink");
344 if ($nbComments > 0) {
345 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbComments.
'</span>';
347 $head[$h][2] =
'project_comment';
351 $head[$h][0] = DOL_URL_ROOT.
'/projet/messaging.php?id='.$project->id;
352 $head[$h][1] = $langs->trans(
"Events");
353 if (
isModEnabled(
'agenda') && ($user->hasRight(
'agenda',
'myactions',
'read') || $user->hasRight(
'agenda',
'allactions',
'read'))) {
355 $head[$h][1] .= $langs->trans(
"Agenda");
357 $head[$h][2] =
'agenda';
376 global $db, $langs, $conf, $user;
380 $head[$h][0] = DOL_URL_ROOT.
'/projet/tasks/task.php?id='.$object->id.(GETPOST(
'withproject') ?
'&withproject=1' :
'');
381 $head[$h][1] = $langs->trans(
"Task");
382 $head[$h][2] =
'task_task';
385 $nbContact = count($object->liste_contact(-1,
'internal')) + count($object->liste_contact(-1,
'external'));
386 $head[$h][0] = DOL_URL_ROOT.
'/projet/tasks/contact.php?id='.$object->id.(GETPOST(
'withproject') ?
'&withproject=1' :
'');
387 $head[$h][1] = $langs->trans(
"TaskRessourceLinks");
388 if ($nbContact > 0) {
389 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbContact.
'</span>';
391 $head[$h][2] =
'task_contact';
396 $sql =
"SELECT t.rowid";
399 $sql .=
" FROM ".MAIN_DB_PREFIX.
"element_time as t";
400 $sql .=
" WHERE t.elementtype='task' AND t.fk_element = ".((int) $object->id);
401 $resql = $db->query(
$sql);
403 $obj = $db->fetch_object($resql);
411 $head[$h][0] = DOL_URL_ROOT.
'/projet/tasks/time.php?id='.urlencode($object->id).(GETPOST(
'withproject') ?
'&withproject=1' :
'');
412 $head[$h][1] = $langs->trans(
"TimeSpent");
413 if ($nbTimeSpent > 0) {
414 $head[$h][1] .=
'<span class="badge marginleftonlyshort">...</span>';
416 $head[$h][2] =
'task_time';
425 if (empty($conf->global->MAIN_DISABLE_NOTES_TAB)) {
427 if (!empty($object->note_private)) {
430 if (!empty($object->note_public)) {
433 $head[$h][0] = DOL_URL_ROOT.
'/projet/tasks/note.php?id='.urlencode($object->id).(GETPOST(
'withproject') ?
'&withproject=1' :
'');
434 $head[$h][1] = $langs->trans(
'Notes');
436 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbNote.
'</span>';
438 $head[$h][2] =
'task_notes';
442 $head[$h][0] = DOL_URL_ROOT.
'/projet/tasks/document.php?id='.$object->id.(GETPOST(
'withproject') ?
'&withproject=1' :
'');
444 include_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
445 include_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
446 $nbFiles = count(
dol_dir_list($filesdir,
'files', 0,
'',
'(\.meta|_preview.*\.png)$'));
447 $nbLinks =
Link::count($db, $object->element, $object->id);
448 $head[$h][1] = $langs->trans(
'Documents');
449 if (($nbFiles + $nbLinks) > 0) {
450 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).
'</span>';
452 $head[$h][2] =
'task_document';
456 if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_TASK)) {
457 $nbComments = $object->getNbComments();
458 $head[$h][0] = DOL_URL_ROOT.
'/projet/tasks/comment.php?id='.$object->id.(GETPOST(
'withproject') ?
'&withproject=1' :
'');
459 $head[$h][1] = $langs->trans(
"CommentLink");
460 if ($nbComments > 0) {
461 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbComments.
'</span>';
463 $head[$h][2] =
'task_comment';
483 global $langs, $conf, $user;
490 $param .= ($mode ?
'&mode='.$mode :
'');
491 if (is_object($fuser) && $fuser->id > 0 && $fuser->id != $user->id) {
492 $param .=
'&search_usertoprocessid='.$fuser->id;
495 if (empty($conf->global->PROJECT_DISABLE_TIMESHEET_PERMONTH)) {
496 $head[$h][0] = DOL_URL_ROOT.
"/projet/activity/permonth.php".($param ?
'?'.$param :
'');
497 $head[$h][1] = $langs->trans(
"InputPerMonth");
498 $head[$h][2] =
'inputpermonth';
502 if (empty($conf->global->PROJECT_DISABLE_TIMESHEET_PERWEEK)) {
503 $head[$h][0] = DOL_URL_ROOT.
"/projet/activity/perweek.php".($param ?
'?'.$param :
'');
504 $head[$h][1] = $langs->trans(
"InputPerWeek");
505 $head[$h][2] =
'inputperweek';
509 if (empty($conf->global->PROJECT_DISABLE_TIMESHEET_PERTIME)) {
510 $head[$h][0] = DOL_URL_ROOT.
"/projet/activity/perday.php".($param ?
'?'.$param :
'');
511 $head[$h][1] = $langs->trans(
"InputPerDay");
512 $head[$h][2] =
'inputperday';
531 global $langs, $conf, $user, $db;
534 $extrafields->fetch_name_optionals_label(
'projet');
535 $extrafields->fetch_name_optionals_label(
'projet_task');
540 $head[$h][0] = DOL_URL_ROOT.
"/projet/admin/project.php";
541 $head[$h][1] = $langs->trans(
"Projects");
542 $head[$h][2] =
'project';
547 $head[$h][0] = DOL_URL_ROOT.
"/projet/admin/project_extrafields.php";
548 $head[$h][1] = $langs->trans(
"ExtraFieldsProject");
549 $nbExtrafields = $extrafields->attributes[
'projet'][
'count'];
550 if ($nbExtrafields > 0) {
551 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
553 $head[$h][2] =
'attributes';
556 $head[$h][0] = DOL_URL_ROOT.
'/projet/admin/project_task_extrafields.php';
557 $head[$h][1] = $langs->trans(
"ExtraFieldsProjectTask");
558 $nbExtrafields = $extrafields->attributes[
'projet_task'][
'count'];
559 if ($nbExtrafields > 0) {
560 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
562 $head[$h][2] =
'attributes_task';
565 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
566 $langs->load(
"members");
568 $head[$h][0] = DOL_URL_ROOT.
'/projet/admin/website.php';
569 $head[$h][1] = $langs->trans(
"BlankSubscriptionForm");
570 $head[$h][2] =
'website';
599 function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$taskrole, $projectsListId =
'', $addordertick = 0, $projectidfortotallink = 0, $dummy =
'', $showbilltime = 0, $arrayfields = array(), $arrayofselected = array())
601 global $user, $langs, $conf, $db, $hookmanager;
602 global $projectstatic, $taskstatic, $extrafields;
606 $projectsArrayId = explode(
',', $projectsListId);
608 $numlines = count($lines);
611 global $total_projectlinesa_spent, $total_projectlinesa_planned, $total_projectlinesa_spent_if_planned, $total_projectlinesa_declared_if_planned, $total_projectlinesa_tobill, $total_projectlinesa_billed, $total_budget_amount;
615 $total_projectlinesa_spent = 0;
616 $total_projectlinesa_planned = 0;
617 $total_projectlinesa_spent_if_planned = 0;
618 $total_projectlinesa_declared_if_planned = 0;
619 $total_projectlinesa_tobill = 0;
620 $total_projectlinesa_billed = 0;
621 $total_budget_amount = 0;
622 $totalarray = array();
625 for ($i = 0; $i < $numlines; $i++) {
626 if ($parent == 0 && $level >= 0) {
632 if ($lines[$i]->fk_task_parent == $parent || $level < 0) {
638 if (is_array($taskrole)) {
640 if (!isset($taskrole[$lines[$i]->
id]) && $lines[$i]->
id != $lines[$i]->fk_task_parent) {
642 $foundtaskforuserdeeper = 0;
645 if ($foundtaskforuserdeeper > 0) {
654 if (empty($user->rights->projet->all->lire)) {
656 if (!in_array($lines[$i]->fk_project, $projectsArrayId)) {
667 if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid) {
669 $lastprojectid = $lines[$i]->fk_project;
672 print
'<tr class="oddeven" id="row-'.$lines[$i]->id.
'">'.
"\n";
674 $projectstatic->id = $lines[$i]->fk_project;
675 $projectstatic->ref = $lines[$i]->projectref;
676 $projectstatic->public = $lines[$i]->public;
677 $projectstatic->title = $lines[$i]->projectlabel;
678 $projectstatic->usage_bill_time = $lines[$i]->usage_bill_time;
679 $projectstatic->status = $lines[$i]->projectstatus;
681 $taskstatic->id = $lines[$i]->id;
682 $taskstatic->ref = $lines[$i]->ref;
683 $taskstatic->label = (!empty($taskrole[$lines[$i]->
id]) ? $langs->trans(
"YourRole").
': '.$taskrole[$lines[$i]->id] :
'');
684 $taskstatic->projectstatus = $lines[$i]->projectstatus;
685 $taskstatic->progress = $lines[$i]->progress;
686 $taskstatic->fk_statut = $lines[$i]->status;
687 $taskstatic->date_start = $lines[$i]->date_start;
688 $taskstatic->date_end = $lines[$i]->date_end;
689 $taskstatic->datee = $lines[$i]->date_end;
690 $taskstatic->planned_workload = $lines[$i]->planned_workload;
691 $taskstatic->duration_effective = $lines[$i]->duration_effective;
692 $taskstatic->budget_amount = $lines[$i]->budget_amount;
696 print
'<td class="nowrap center">';
698 if (in_array($lines[$i]->
id, $arrayofselected)) {
701 print
'<input id="cb' . $lines[$i]->id .
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="' . $lines[$i]->id .
'"' . ($selected ?
' checked="checked"' :
'') .
'>';
707 print
'<td class="nowraponall">';
709 if ($lines[$i]->
public || in_array($lines[$i]->fk_project, $projectsArrayId) || !empty($user->rights->projet->all->lire)) {
710 print $projectstatic->getNomUrl(1);
712 print $projectstatic->getNomUrl(1,
'nolink');
719 $projectstatic->statut = $lines[$i]->projectstatus;
720 print $projectstatic->getLibStatut(2);
725 if (count($arrayfields) > 0 && !empty($arrayfields[
't.ref'][
'checked'])) {
726 print
'<td class="nowraponall">';
727 if ($showlineingray) {
728 print
'<i>'.img_object(
'',
'projecttask').
' '.$lines[$i]->ref.
'</i>';
730 print $taskstatic->getNomUrl(1,
'withproject');
736 if (count($arrayfields) > 0 && !empty($arrayfields[
't.label'][
'checked'])) {
738 if ($showlineingray) {
739 $labeltoshow .=
'<i>';
742 for ($k = 0; $k < $level; $k++) {
743 $labeltoshow .=
'<div class="marginleftonly">';
746 for ($k = 0; $k < $level; $k++) {
747 $labeltoshow .=
'</div>';
749 if ($showlineingray) {
750 $labeltoshow .=
'</i>';
752 print
'<td class="tdoverflowmax200" title="'.dol_escape_htmltag($labeltoshow).
'">';
757 if (count($arrayfields) > 0 && !empty($arrayfields[
't.description'][
'checked'])) {
758 print
'<td class="tdoverflowmax200" title="'.dol_escape_htmltag($lines[$i]->
description).
'">';
759 print $lines[$i]->description;
764 if (count($arrayfields) > 0 && !empty($arrayfields[
't.dateo'][
'checked'])) {
765 print
'<td class="center nowraponall">';
771 if (count($arrayfields) > 0 && !empty($arrayfields[
't.datee'][
'checked'])) {
772 print
'<td class="center nowraponall">';
774 if ($taskstatic->hasDelay()) {
780 $plannedworkloadoutputformat =
'allhourmin';
781 $timespentoutputformat =
'allhourmin';
782 if (!empty($conf->global->PROJECT_PLANNED_WORKLOAD_FORMAT)) {
783 $plannedworkloadoutputformat = $conf->global->PROJECT_PLANNED_WORKLOAD_FORMAT;
785 if (!empty($conf->global->PROJECT_TIMES_SPENT_FORMAT)) {
786 $timespentoutputformat = $conf->global->PROJECT_TIME_SPENT_FORMAT;
790 if (count($arrayfields) > 0 && !empty($arrayfields[
't.planned_workload'][
'checked'])) {
791 print
'<td class="right">';
792 $fullhour =
convertSecondToTime($lines[$i]->planned_workload, $plannedworkloadoutputformat);
794 if ($lines[$i]->planned_workload !=
'') {
804 if (count($arrayfields) > 0 && !empty($arrayfields[
't.duration_effective'][
'checked'])) {
805 print
'<td class="right">';
806 if ($showlineingray) {
809 print
'<a href="'.DOL_URL_ROOT.
'/projet/tasks/time.php?id='.$lines[$i]->id.($showproject ?
'' :
'&withproject=1').
'">';
811 if ($lines[$i]->duration_effective) {
816 if ($showlineingray) {
825 if (count($arrayfields) > 0 && !empty($arrayfields[
't.progress_calculated'][
'checked'])) {
826 $s =
''; $shtml =
'';
827 if ($lines[$i]->planned_workload || $lines[$i]->duration_effective) {
828 if ($lines[$i]->planned_workload) {
829 $s = round(100 * $lines[$i]->duration_effective / $lines[$i]->planned_workload, 2).
' %';
832 $s = $langs->trans(
'WorkloadNotDefined');
833 $shtml =
'<span class="opacitymedium">'.$s.
'</span>';
836 print
'<td class="right tdoverflowmax100" title="'.dol_escape_htmltag($s).
'">';
842 if (count($arrayfields) > 0 && !empty($arrayfields[
't.progress'][
'checked'])) {
843 print
'<td class="right">';
844 if ($lines[$i]->progress !=
'') {
851 if (count($arrayfields) > 0 && !empty($arrayfields[
't.progress_summary'][
'checked'])) {
852 print
'<td class="right">';
853 if ($lines[$i]->progress !=
'' && $lines[$i]->duration_effective) {
861 if (count($arrayfields) > 0 && !empty($arrayfields[
't.tobill'][
'checked'])) {
862 print
'<td class="right">';
863 if ($lines[$i]->usage_bill_time) {
865 $total_projectlinesa_tobill += $lines[$i]->tobill;
867 print
'<span class="opacitymedium">'.$langs->trans(
"NA").
'</span>';
873 if (count($arrayfields) > 0 && !empty($arrayfields[
't.billed'][
'checked'])) {
874 print
'<td class="right">';
875 if ($lines[$i]->usage_bill_time) {
877 $total_projectlinesa_billed += $lines[$i]->billed;
879 print
'<span class="opacitymedium">'.$langs->trans(
"NA").
'</span>';
886 if (count($arrayfields) > 0 && !empty($arrayfields[
't.budget_amount'][
'checked'])) {
887 print
'<td class="center">';
888 if ($lines[$i]->budget_amount) {
889 print
'<span class="amount">'.price($lines[$i]->budget_amount, 0, $langs, 1, 0, 0, $conf->currency).
'</span>';
890 $total_budget_amount += $lines[$i]->budget_amount;
896 if (count($arrayfields) > 0 && !empty($arrayfields[
'c.assigned'][
'checked'])) {
897 print
'<td class="center">';
899 foreach (array(
'internal',
'external') as $source) {
901 $tab = $lines[$i]->liste_contact(-1, $source, 0,
'', 1);
903 $numcontact = count($tab);
904 if (!empty($numcontact)) {
905 foreach ($tab as $contacttask) {
907 if ($source ==
'internal') {
912 $c->fetch($contacttask[
'id']);
913 if (!empty($c->photo)) {
914 if (get_class($c) ==
'User') {
915 print $c->getNomUrl(-2,
'', 0, 0, 24, 1,
'', ($ifisrt ?
'' :
'notfirst'));
917 print $c->getNomUrl(-2,
'', 0,
'', -1, 0, ($ifisrt ?
'' :
'notfirst'));
920 if (get_class($c) ==
'User') {
921 print $c->getNomUrl(2,
'', 0, 0, 24, 1,
'', ($ifisrt ?
'' :
'notfirst'));
923 print $c->getNomUrl(2,
'', 0,
'', -1, 0, ($ifisrt ?
'' :
'notfirst'));
934 $extrafieldsobjectkey = $taskstatic->table_element;
935 $extrafieldsobjectprefix =
'efpt.';
936 $obj = $lines[$i]->obj;
937 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
939 $parameters = array(
'arrayfields'=>$arrayfields,
'obj'=>$lines[$i]);
940 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters);
941 print $hookmanager->resPrint;
944 print
'<td class="tdlineupdown center"></td>';
948 print
'<td class="nowrap center">';
950 if (in_array($lines[$i]->
id, $arrayofselected)) {
953 print
'<input id="cb' . $lines[$i]->id .
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="' . $lines[$i]->id .
'"' . ($selected ?
' checked="checked"' :
'') .
'>';
960 if (!$showlineingray) {
966 if ($lines[$i]->
id) {
967 projectLinesa($inc, $lines[$i]->
id, $lines, $level, $var, $showproject, $taskrole, $projectsListId, $addordertick, $projectidfortotallink,
'', $showbilltime, $arrayfields);
972 $total_projectlinesa_spent += $lines[$i]->duration_effective;
973 $total_projectlinesa_planned += $lines[$i]->planned_workload;
974 if ($lines[$i]->planned_workload) {
975 $total_projectlinesa_spent_if_planned += $lines[$i]->duration_effective;
977 if ($lines[$i]->planned_workload) {
978 $total_projectlinesa_declared_if_planned += $lines[$i]->planned_workload * $lines[$i]->progress / 100;
987 if (($total_projectlinesa_planned > 0 || $total_projectlinesa_spent > 0 || $total_projectlinesa_tobill > 0 || $total_projectlinesa_billed > 0 || $total_budget_amount > 0)
989 print
'<tr class="liste_total nodrag nodrop">';
992 print
'<td class="liste_total"></td>';
995 print
'<td class="liste_total">'.$langs->trans(
"Total").
'</td>';
997 print
'<td></td><td></td>';
999 if (count($arrayfields) > 0 && !empty($arrayfields[
't.label'][
'checked'])) {
1002 if (count($arrayfields) > 0 && !empty($arrayfields[
't.description'][
'checked'])) {
1005 if (count($arrayfields) > 0 && !empty($arrayfields[
't.dateo'][
'checked'])) {
1008 if (count($arrayfields) > 0 && !empty($arrayfields[
't.datee'][
'checked'])) {
1011 if (count($arrayfields) > 0 && !empty($arrayfields[
't.planned_workload'][
'checked'])) {
1012 print
'<td class="nowrap liste_total right">';
1016 if (count($arrayfields) > 0 && !empty($arrayfields[
't.duration_effective'][
'checked'])) {
1017 print
'<td class="nowrap liste_total right">';
1018 if ($projectidfortotallink > 0) {
1019 print
'<a href="'.DOL_URL_ROOT.
'/projet/tasks/time.php?projectid='.$projectidfortotallink.($showproject ?
'' :
'&withproject=1').
'">';
1022 if ($projectidfortotallink > 0) {
1028 if ($total_projectlinesa_planned) {
1029 $totalAverageDeclaredProgress = round(100 * $total_projectlinesa_declared_if_planned / $total_projectlinesa_planned, 2);
1030 $totalCalculatedProgress = round(100 * $total_projectlinesa_spent / $total_projectlinesa_planned, 2);
1033 $warningRatio = !empty($conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT) ? (1 + $conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT / 100) : 1.10;
1036 $progressBarClass =
'progress-bar-info';
1037 $badgeClass =
'badge ';
1039 if ($totalCalculatedProgress > $totalAverageDeclaredProgress) {
1040 $progressBarClass =
'progress-bar-danger';
1041 $badgeClass .=
'badge-danger';
1042 } elseif ($totalCalculatedProgress * $warningRatio >= $totalAverageDeclaredProgress) {
1043 $progressBarClass =
'progress-bar-warning';
1044 $badgeClass .=
'badge-warning';
1046 $progressBarClass =
'progress-bar-success';
1047 $badgeClass .=
'badge-success';
1052 if (count($arrayfields) > 0 && !empty($arrayfields[
't.progress_calculated'][
'checked'])) {
1053 print
'<td class="nowrap liste_total right">';
1054 if ($total_projectlinesa_planned) {
1055 print $totalCalculatedProgress.
' %';
1061 if (count($arrayfields) > 0 && !empty($arrayfields[
't.progress'][
'checked'])) {
1062 print
'<td class="nowrap liste_total right">';
1063 if ($total_projectlinesa_planned) {
1064 print
'<span class="'.$badgeClass.
'" >'.$totalAverageDeclaredProgress.
' %</span>';
1071 if (count($arrayfields) > 0 && !empty($arrayfields[
't.progress_summary'][
'checked'])) {
1072 print
'<td class="right">';
1073 if ($total_projectlinesa_planned) {
1075 print
' <div class="progress sm" title="'.$totalAverageDeclaredProgress.
'%" >';
1076 print
' <div class="progress-bar '.$progressBarClass.
'" style="width: '.$totalAverageDeclaredProgress.
'%"></div>';
1083 if ($showbilltime) {
1084 if (count($arrayfields) > 0 && !empty($arrayfields[
't.tobill'][
'checked'])) {
1085 print
'<td class="nowrap liste_total right">';
1089 if (count($arrayfields) > 0 && !empty($arrayfields[
't.billed'][
'checked'])) {
1090 print
'<td class="nowrap liste_total right">';
1097 if (count($arrayfields) > 0 && !empty($arrayfields[
't.budget_amount'][
'checked'])) {
1098 print
'<td class="nowrap liste_total center">';
1099 if (strcmp($total_budget_amount,
'')) {
1100 print
price($total_budget_amount, 0, $langs, 1, 0, 0, $conf->currency);
1106 if (!empty($conf->global->PROJECT_SHOW_CONTACTS_IN_LIST)) {
1110 if (count($arrayfields) > 0 && !empty($arrayfields[
'c.assigned'][
'checked'])) {
1115 foreach ($extrafields->attributes[
'projet_task'][
'totalizable'] as $key => $value) {
1116 if (!empty($arrayfields[
'efpt.'.$key][
'checked']) && $arrayfields[
'efpt.'.$key][
'checked'] == 1) {
1117 print
'<td class="right">';
1119 print empty($totalarray[
'totalizable'][$key][
'total']) ?
'' : $totalarray[
'totalizable'][$key][
'total'];
1126 print
'<td class="liste_total"></td>';
1129 print
'<td class="liste_total"></td>';
1156 function projectLinesPerAction(&$inc, $parent, $fuser, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask, $preselectedday, &$isavailable, $oldprojectforbreak = 0)
1158 global $conf, $db, $user, $langs;
1159 global
$form, $formother, $projectstatic, $taskstatic, $thirdpartystatic;
1162 $totalforeachline = array();
1163 $workloadforid = array();
1164 $lineswithoutlevel0 = array();
1166 $numlines = count($lines);
1170 for ($i = 0; $i < $numlines; $i++) {
1171 if ($lines[$i]->fk_task_parent) {
1172 $lineswithoutlevel0[] = $lines[$i];
1177 if (empty($oldprojectforbreak)) {
1178 $oldprojectforbreak = (empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT) ? 0 : -1);
1182 for ($i = 0; $i < $numlines; $i++) {
1190 if (empty($mine) || !empty($tasksrole[$lines[$i]->
id])) {
1194 if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid) {
1195 $lastprojectid = $lines[$i]->fk_project;
1196 if ($preselectedday) {
1197 $projectstatic->id = $lines[$i]->fk_project;
1201 if (empty($workloadforid[$projectstatic->id])) {
1202 if ($preselectedday) {
1203 $projectstatic->loadTimeSpent($preselectedday, 0, $fuser->id);
1204 $workloadforid[$projectstatic->id] = 1;
1208 $projectstatic->id = $lines[$i]->fk_project;
1209 $projectstatic->ref = $lines[$i]->project_ref;
1210 $projectstatic->title = $lines[$i]->project_label;
1211 $projectstatic->public = $lines[$i]->public;
1212 $projectstatic->status = $lines[$i]->project->status;
1214 $taskstatic->id = $lines[$i]->fk_statut;
1215 $taskstatic->ref = ($lines[$i]->task_ref ? $lines[$i]->task_ref : $lines[$i]->task_id);
1216 $taskstatic->label = $lines[$i]->task_label;
1217 $taskstatic->date_start = $lines[$i]->date_start;
1218 $taskstatic->date_end = $lines[$i]->date_end;
1220 $thirdpartystatic->id = $lines[$i]->socid;
1221 $thirdpartystatic->name = $lines[$i]->thirdparty_name;
1222 $thirdpartystatic->email = $lines[$i]->thirdparty_email;
1224 if (empty($oldprojectforbreak) || ($oldprojectforbreak != -1 && $oldprojectforbreak != $projectstatic->id)) {
1225 print
'<tr class="oddeven trforbreak nobold">'.
"\n";
1226 print
'<td colspan="11">';
1227 print $projectstatic->getNomUrl(1,
'', 0, $langs->transnoentitiesnoconv(
"YourRole").
': '.$projectsrole[$lines[$i]->fk_project]);
1228 if ($projectstatic->title) {
1230 print $projectstatic->title;
1236 if ($oldprojectforbreak != -1) {
1237 $oldprojectforbreak = $projectstatic->id;
1240 print
'<tr class="oddeven">'.
"\n";
1251 if ($oldprojectforbreak == -1) {
1252 print $projectstatic->getNomUrl(1,
'', 0, $langs->transnoentitiesnoconv(
"YourRole").
': '.$projectsrole[$lines[$i]->fk_project]);
1253 print
'<br>'.$projectstatic->title;
1258 print
'<td class="tdoverflowmax100">';
1259 if ($thirdpartystatic->id > 0) {
1260 print $thirdpartystatic->getNomUrl(1,
'project', 10);
1266 print
'<!-- Task id = '.$lines[$i]->id.
' -->';
1267 for ($k = 0; $k < $level; $k++) {
1268 print
" ";
1270 print $taskstatic->getNomUrl(1,
'withproject',
'time');
1273 for ($k = 0; $k < $level; $k++) {
1274 print
" ";
1276 print $taskstatic->label;
1283 print
'<td class="center">';
1287 $disabledproject = 1;
1293 if ($lines[$i]->
public || !empty($projectsrole[$lines[$i]->fk_project]) || $user->rights->projet->all->creer) {
1294 $disabledproject = 0;
1298 if ($restricteditformytask && empty($tasksrole[$lines[$i]->
id])) {
1303 print
'<td class="nowrap center">';
1308 if (!$isavailable[$preselectedday][
'morning'] && !$isavailable[$preselectedday][
'afternoon']) {
1309 $cssonholiday .=
'onholidayallday ';
1310 } elseif (!$isavailable[$preselectedday][
'morning']) {
1311 $cssonholiday .=
'onholidaymorning ';
1312 } elseif (!$isavailable[$preselectedday][
'afternoon']) {
1313 $cssonholiday .=
'onholidayafternoon ';
1317 print
'<td class="duration'.($cssonholiday ?
' '.$cssonholiday :
'').
' center">';
1319 $dayWorkLoad = $lines[$i]->timespent_duration;
1320 $totalforeachline[$preselectedday] += $lines[$i]->timespent_duration;
1323 if ($dayWorkLoad > 0) {
1332 print
'<td class="center">';
1333 print
'<textarea name="'.$lines[$i]->id.
'note" rows="'.ROWS_2.
'" id="'.$lines[$i]->id.
'note"'.($disabledtask ?
' disabled="disabled"' :
'').
'>';
1334 print $lines[$i]->timespent_note;
1335 print
'</textarea>';
1339 print
'<td class="right">';
1359 return $totalforeachline;
1382 function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask, $preselectedday, &$isavailable, $oldprojectforbreak = 0, $arrayfields = array(), $extrafields =
null)
1384 global $conf, $db, $user, $langs;
1385 global
$form, $formother, $projectstatic, $taskstatic, $thirdpartystatic;
1388 $totalforeachday = array();
1389 $workloadforid = array();
1390 $lineswithoutlevel0 = array();
1392 $numlines = count($lines);
1396 for ($i = 0; $i < $numlines; $i++) {
1397 if ($lines[$i]->fk_task_parent) {
1398 $lineswithoutlevel0[] = $lines[$i];
1403 if (empty($oldprojectforbreak)) {
1404 $oldprojectforbreak = (empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT) ? 0 : -1);
1407 $restrictBefore =
null;
1409 if (!empty($conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS)) {
1410 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
1415 for ($i = 0; $i < $numlines; $i++) {
1420 if ($lines[$i]->fk_task_parent == $parent) {
1424 if (empty($mine) || !empty($tasksrole[$lines[$i]->
id])) {
1427 if ($restricteditformytask == 2 && empty($tasksrole[$lines[$i]->
id])) {
1432 if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid) {
1433 $lastprojectid = $lines[$i]->fk_project;
1434 if ($preselectedday) {
1435 $projectstatic->id = $lines[$i]->fk_project;
1439 if (empty($workloadforid[$projectstatic->id])) {
1440 if ($preselectedday) {
1441 $projectstatic->loadTimeSpent($preselectedday, 0, $fuser->id);
1442 $workloadforid[$projectstatic->id] = 1;
1446 $projectstatic->id = $lines[$i]->fk_project;
1447 $projectstatic->ref = $lines[$i]->projectref;
1448 $projectstatic->title = $lines[$i]->projectlabel;
1449 $projectstatic->public = $lines[$i]->public;
1450 $projectstatic->status = $lines[$i]->projectstatus;
1452 $taskstatic->id = $lines[$i]->id;
1453 $taskstatic->ref = ($lines[$i]->ref ? $lines[$i]->ref : $lines[$i]->id);
1454 $taskstatic->label = $lines[$i]->label;
1455 $taskstatic->date_start = $lines[$i]->date_start;
1456 $taskstatic->date_end = $lines[$i]->date_end;
1458 $thirdpartystatic->id = $lines[$i]->socid;
1459 $thirdpartystatic->name = $lines[$i]->thirdparty_name;
1460 $thirdpartystatic->email = $lines[$i]->thirdparty_email;
1462 if (empty($oldprojectforbreak) || ($oldprojectforbreak != -1 && $oldprojectforbreak != $projectstatic->id)) {
1464 if (!empty($arrayfields[
't.planned_workload'][
'checked'])) {
1467 if (!empty($arrayfields[
't.progress'][
'checked'])) {
1470 foreach ($arrayfields as $key => $val) {
1471 if ($val[
'checked'] && substr($key, 0, 5) ==
'efpt.') {
1476 print
'<tr class="oddeven trforbreak nobold">'.
"\n";
1477 print
'<td colspan="'.(7 + $addcolspan).
'">';
1478 print $projectstatic->getNomUrl(1,
'', 0,
'<strong>'.$langs->transnoentitiesnoconv(
"YourRole").
':</strong> '.$projectsrole[$lines[$i]->fk_project]);
1479 if ($thirdpartystatic->id > 0) {
1480 print
' - '.$thirdpartystatic->getNomUrl(1);
1482 if ($projectstatic->title) {
1484 print
'<span class="secondary">'.$projectstatic->title.
'</span>';
1551 if ($oldprojectforbreak != -1) {
1552 $oldprojectforbreak = $projectstatic->id;
1555 print
'<tr class="oddeven" data-taskid="'.$lines[$i]->id.
'">'.
"\n";
1565 if (!empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)) {
1567 if ($oldprojectforbreak == -1) {
1568 print $projectstatic->getNomUrl(1,
'', 0, $langs->transnoentitiesnoconv(
"YourRole").
': '.$projectsrole[$lines[$i]->fk_project]);
1574 if (!empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)) {
1575 print
'<td class="tdoverflowmax100">';
1576 if ($thirdpartystatic->id > 0) {
1577 print $thirdpartystatic->getNomUrl(1,
'project', 10);
1584 print
'<!-- Task id = '.$lines[$i]->id.
' -->';
1585 for ($k = 0; $k < $level; $k++) {
1586 print
'<div class="marginleftonly">';
1588 print $taskstatic->getNomUrl(1,
'withproject',
'time');
1591 print
'<span class="opacitymedium">'.$taskstatic->label.
'</a>';
1592 for ($k = 0; $k < $level; $k++) {
1598 $extrafieldsobjectkey =
'projet_task';
1599 $extrafieldsobjectprefix =
'efpt.';
1600 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
1603 if (!empty($arrayfields[
't.planned_workload'][
'checked'])) {
1604 print
'<td class="leftborder plannedworkload right">';
1605 if ($lines[$i]->planned_workload) {
1614 if (!empty($arrayfields[
't.progress'][
'checked'])) {
1615 print
'<td class="right">';
1616 print $formother->select_percent($lines[$i]->progress, $lines[$i]->
id.
'progress');
1620 if (!empty($arrayfields[
'timeconsumed'][
'checked'])) {
1622 print
'<td class="right">';
1624 if ($lines[$i]->duration_effective) {
1625 print
'<a href="'.DOL_URL_ROOT.
'/projet/tasks/time.php?id='.$lines[$i]->id.
'">';
1634 print
'<td class="right">';
1635 $tmptimespent = $taskstatic->getSummaryOfTimeSpent($fuser->id);
1636 if ($tmptimespent[
'total_duration']) {
1644 $disabledproject = 1;
1650 if ($lines[$i]->
public || !empty($projectsrole[$lines[$i]->fk_project]) || $user->rights->projet->all->creer) {
1651 $disabledproject = 0;
1655 if ($restricteditformytask && empty($tasksrole[$lines[$i]->
id])) {
1659 if ($restrictBefore && $preselectedday < $restrictBefore) {
1664 print
'<td class="nowraponall leftborder center minwidth150imp">';
1665 $tableCell =
$form->selectDate($preselectedday, $lines[$i]->
id, 1, 1, 2,
"addtime", 0, 0, $disabledtask);
1670 if (!$isavailable[$preselectedday][
'morning'] && !$isavailable[$preselectedday][
'afternoon']) {
1671 $cssonholiday .=
'onholidayallday ';
1672 } elseif (!$isavailable[$preselectedday][
'morning']) {
1673 $cssonholiday .=
'onholidaymorning ';
1674 } elseif (!$isavailable[$preselectedday][
'afternoon']) {
1675 $cssonholiday .=
'onholidayafternoon ';
1681 $idw = ($tmparray[
'wday'] - (empty($conf->global->MAIN_START_WEEK) ? 0 : 1));
1682 global $numstartworkingday, $numendworkingday;
1684 if ((($idw + 1) < $numstartworkingday) || (($idw + 1) > $numendworkingday)) {
1685 $cssweekend =
'weekend';
1689 print
'<td class="center duration'.($cssonholiday ?
' '.$cssonholiday :
'').($cssweekend ?
' '.$cssweekend :
'').
'">';
1690 $dayWorkLoad = empty($projectstatic->weekWorkLoadPerTask[$preselectedday][$lines[$i]->id]) ? 0 : $projectstatic->weekWorkLoadPerTask[$preselectedday][$lines[$i]->id];
1691 if (!isset($totalforeachday[$preselectedday])) {
1692 $totalforeachday[$preselectedday] = 0;
1694 $totalforeachday[$preselectedday] += $dayWorkLoad;
1697 if ($dayWorkLoad > 0) {
1704 $tableCell .=
'<span class="timesheetalreadyrecorded" title="texttoreplace"><input type="text" class="center" size="2" disabled id="timespent['.$inc.
']['.$idw.
']" name="task['.$lines[$i]->id.
']['.$idw.
']" value="'.$alreadyspent.
'"></span>';
1705 $tableCell .=
'<span class="hideonsmartphone"> + </span>';
1707 $tableCell .=
$form->select_duration($lines[$i]->
id.
'duration',
'', $disabledtask,
'text', 0, 1);
1714 print
'<td class="center">';
1715 print
'<textarea name="'.$lines[$i]->id.
'note" rows="'.ROWS_2.
'" id="'.$lines[$i]->id.
'note"'.($disabledtask ?
' disabled="disabled"' :
'').
'>';
1716 print
'</textarea>';
1720 print
'<td class="right">';
1721 if ((!$lines[$i]->
public) && $disabledproject) {
1722 print
$form->textwithpicto(
'', $langs->trans(
"UserIsNotContactOfProject"));
1723 } elseif ($disabledtask) {
1724 $titleassigntask = $langs->trans(
"AssignTaskToMe");
1725 if ($fuser->id != $user->id) {
1726 $titleassigntask = $langs->trans(
"AssignTaskToUser",
'...');
1729 print
$form->textwithpicto(
'', $langs->trans(
"TaskIsNotAssignedToUser", $titleassigntask));
1738 if ($lines[$i]->
id > 0) {
1741 $ret =
projectLinesPerDay($inc, $lines[$i]->
id, $fuser, ($parent == 0 ? $lineswithoutlevel0 : $lines), $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $preselectedday, $isavailable, $oldprojectforbreak, $arrayfields, $extrafields);
1744 foreach ($ret as $key => $val) {
1745 $totalforeachday[$key] += $val;
1756 return $totalforeachday;
1779 function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask, &$isavailable, $oldprojectforbreak = 0, $arrayfields = array(), $extrafields =
null)
1781 global $conf, $db, $user, $langs;
1782 global
$form, $formother, $projectstatic, $taskstatic, $thirdpartystatic;
1784 $numlines = count($lines);
1787 $workloadforid = array();
1788 $totalforeachday = array();
1789 $lineswithoutlevel0 = array();
1793 for ($i = 0; $i < $numlines; $i++) {
1794 if ($lines[$i]->fk_task_parent) {
1795 $lineswithoutlevel0[] = $lines[$i];
1802 if (empty($oldprojectforbreak)) {
1803 $oldprojectforbreak = (empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT) ? 0 : -1);
1806 $restrictBefore =
null;
1808 if (!empty($conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS)) {
1809 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
1813 for ($i = 0; $i < $numlines; $i++) {
1818 if ($lines[$i]->fk_task_parent == $parent) {
1822 if (empty($mine) || !empty($tasksrole[$lines[$i]->
id])) {
1825 if ($restricteditformytask == 2 && empty($tasksrole[$lines[$i]->
id])) {
1830 if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid) {
1831 $lastprojectid = $lines[$i]->fk_project;
1832 $projectstatic->id = $lines[$i]->fk_project;
1837 if (empty($workloadforid[$projectstatic->id])) {
1838 $projectstatic->loadTimeSpent($firstdaytoshow, 0, $fuser->id);
1839 $workloadforid[$projectstatic->id] = 1;
1844 $projectstatic->id = $lines[$i]->fk_project;
1845 $projectstatic->ref = $lines[$i]->projectref;
1846 $projectstatic->title = $lines[$i]->projectlabel;
1847 $projectstatic->public = $lines[$i]->public;
1848 $projectstatic->thirdparty_name = $lines[$i]->thirdparty_name;
1849 $projectstatic->status = $lines[$i]->projectstatus;
1851 $taskstatic->id = $lines[$i]->id;
1852 $taskstatic->ref = ($lines[$i]->ref ? $lines[$i]->ref : $lines[$i]->id);
1853 $taskstatic->label = $lines[$i]->label;
1854 $taskstatic->date_start = $lines[$i]->date_start;
1855 $taskstatic->date_end = $lines[$i]->date_end;
1857 $thirdpartystatic->id = $lines[$i]->thirdparty_id;
1858 $thirdpartystatic->name = $lines[$i]->thirdparty_name;
1859 $thirdpartystatic->email = $lines[$i]->thirdparty_email;
1861 if (empty($oldprojectforbreak) || ($oldprojectforbreak != -1 && $oldprojectforbreak != $projectstatic->id)) {
1863 if (!empty($arrayfields[
't.planned_workload'][
'checked'])) {
1866 if (!empty($arrayfields[
't.progress'][
'checked'])) {
1869 foreach ($arrayfields as $key => $val) {
1870 if ($val[
'checked'] && substr($key, 0, 5) ==
'efpt.') {
1875 print
'<tr class="oddeven trforbreak nobold">'.
"\n";
1876 print
'<td colspan="'.(11 + $addcolspan).
'">';
1877 print $projectstatic->getNomUrl(1,
'', 0,
'<strong>'.$langs->transnoentitiesnoconv(
"YourRole").
':</strong> '.$projectsrole[$lines[$i]->fk_project]);
1878 if ($thirdpartystatic->id > 0) {
1879 print
' - '.$thirdpartystatic->getNomUrl(1);
1881 if ($projectstatic->title) {
1883 print
'<span class="secondary">'.$projectstatic->title.
'</span>';
1950 if ($oldprojectforbreak != -1) {
1951 $oldprojectforbreak = $projectstatic->id;
1954 print
'<tr class="oddeven" data-taskid="'.$lines[$i]->id.
'">'.
"\n";
1964 if (!empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)) {
1965 print
'<td class="nowrap">';
1966 if ($oldprojectforbreak == -1) {
1967 print $projectstatic->getNomUrl(1,
'', 0, $langs->transnoentitiesnoconv(
"YourRole").
': '.$projectsrole[$lines[$i]->fk_project]);
1973 if (!empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)) {
1974 print
'<td class="tdoverflowmax100">';
1975 if ($thirdpartystatic->id > 0) {
1976 print $thirdpartystatic->getNomUrl(1,
'project');
1982 print
'<td class="nowrap">';
1983 print
'<!-- Task id = '.$lines[$i]->id.
' -->';
1984 for ($k = 0; $k < $level; $k++) {
1985 print
'<div class="marginleftonly">';
1987 print $taskstatic->getNomUrl(1,
'withproject',
'time');
1990 print
'<span class="opacitymedium">'.$taskstatic->label.
'</span>';
1991 for ($k = 0; $k < $level; $k++) {
1997 $extrafieldsobjectkey =
'projet_task';
1998 $extrafieldsobjectprefix =
'efpt.';
1999 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
2002 if (!empty($arrayfields[
't.planned_workload'][
'checked'])) {
2003 print
'<td class="leftborder plannedworkload right">';
2004 if ($lines[$i]->planned_workload) {
2012 if (!empty($arrayfields[
't.progress'][
'checked'])) {
2014 print
'<td class="right">';
2015 print $formother->select_percent($lines[$i]->progress, $lines[$i]->
id.
'progress');
2019 if (!empty($arrayfields[
'timeconsumed'][
'checked'])) {
2021 print
'<td class="right">';
2023 if ($lines[$i]->duration_effective) {
2024 print
'<a href="'.DOL_URL_ROOT.
'/projet/tasks/time.php?id='.$lines[$i]->id.
'">';
2033 print
'<td class="right">';
2034 $tmptimespent = $taskstatic->getSummaryOfTimeSpent($fuser->id);
2035 if ($tmptimespent[
'total_duration']) {
2043 $disabledproject = 1;
2049 if ($lines[$i]->
public || !empty($projectsrole[$lines[$i]->fk_project]) || $user->rights->projet->all->creer) {
2050 $disabledproject = 0;
2054 if ($restricteditformytask && empty($tasksrole[$lines[$i]->
id])) {
2062 $modeinput =
'hours';
2063 for ($idw = 0; $idw < 7; $idw++) {
2065 if (!isset($totalforeachday[$tmpday])) $totalforeachday[$tmpday] = 0;
2067 if (!$isavailable[$tmpday][
'morning'] && !$isavailable[$tmpday][
'afternoon']) {
2068 $cssonholiday .=
'onholidayallday ';
2069 } elseif (!$isavailable[$tmpday][
'morning']) {
2070 $cssonholiday .=
'onholidaymorning ';
2071 } elseif (!$isavailable[$tmpday][
'afternoon']) {
2072 $cssonholiday .=
'onholidayafternoon ';
2076 $dayWorkLoad = (!empty($projectstatic->weekWorkLoadPerTask[$tmpday][$lines[$i]->id]) ? $projectstatic->weekWorkLoadPerTask[$tmpday][$lines[$i]->id] : 0);
2077 $totalforeachday[$tmpday] += $dayWorkLoad;
2080 if ($dayWorkLoad > 0) {
2083 $alttitle = $langs->trans(
"AddHereTimeSpentForDay", !empty($tmparray[
'day']) ? $tmparray[
'day'] : 0, $tmparray[
'mon']);
2085 global $numstartworkingday, $numendworkingday;
2087 if (($idw + 1 < $numstartworkingday) || ($idw + 1 > $numendworkingday)) {
2088 $cssweekend =
'weekend';
2091 $disabledtaskday = $disabledtask;
2093 if (! $disabledtask && $restrictBefore && $tmpday < $restrictBefore) {
2094 $disabledtaskday = 1;
2097 $tableCell =
'<td class="center hide'.$idw.($cssonholiday ?
' '.$cssonholiday :
'').($cssweekend ?
' '.$cssweekend :
'').
'">';
2100 if ($alreadyspent) {
2101 $tableCell .=
'<span class="timesheetalreadyrecorded" title="texttoreplace"><input type="text" class="center smallpadd" size="2" disabled id="timespent['.$inc.
']['.$idw.
']" name="task['.$lines[$i]->id.
']['.$idw.
']" value="'.$alreadyspent.
'"></span>';
2105 $tableCell .=
'<input type="text" alt="'.($disabledtaskday ?
'' : $alttitle).
'" title="'.($disabledtaskday ?
'' : $alttitle).
'" '.($disabledtaskday ?
'disabled' : $placeholder).
' class="center smallpadd" size="2" id="timeadded['.$inc.
']['.$idw.
']" name="task['.$lines[$i]->id.
']['.$idw.
']" value="" cols="2" maxlength="5"';
2106 $tableCell .=
' onkeypress="return regexEvent(this,event,\'timeChar\')"';
2107 $tableCell .=
' onkeyup="updateTotal('.$idw.
',\''.$modeinput.
'\')
"';
2108 $tableCell .= ' onblur="regexEvent(
this,event,\
''.$modeinput.
'\'); updateTotal(
'.$idw.',\
''.$modeinput.
'\')
" />';
2109 $tableCell .= '</td>';
2114 print '<td class="right
">';
2115 if ((!$lines[$i]->public) && $disabledproject) {
2116 print $form->textwithpicto('', $langs->trans("UserIsNotContactOfProject
"));
2117 } elseif ($disabledtask) {
2118 $titleassigntask = $langs->trans("AssignTaskToMe
");
2119 if ($fuser->id != $user->id) {
2120 $titleassigntask = $langs->trans("AssignTaskToUser
", '...');
2123 print $form->textwithpicto('', $langs->trans("TaskIsNotAssignedToUser
", $titleassigntask));
2130 // Call to show task with a lower level (task under the current task)
2133 if ($lines[$i]->id > 0) {
2134 //var_dump('totalforeachday after taskid='.$lines[$i]->id.' and previous one on level '.$level);
2135 //var_dump($totalforeachday);
2136 $ret = projectLinesPerWeek($inc, $firstdaytoshow, $fuser, $lines[$i]->id, ($parent == 0 ? $lineswithoutlevel0 : $lines), $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $isavailable, $oldprojectforbreak, $arrayfields, $extrafields);
2137 //var_dump('ret with parent='.$lines[$i]->id.' level='.$level);
2139 foreach ($ret as $key => $val) {
2140 $totalforeachday[$key] += $val;
2142 //var_dump('totalforeachday after taskid='.$lines[$i]->id.' and previous one on level '.$level.' + subtasks');
2143 //var_dump($totalforeachday);
2151 return $totalforeachday;
2172 function projectLinesPerMonth(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask, &$isavailable, $oldprojectforbreak = 0, $TWeek = array())
2174 global $conf, $db, $user, $langs;
2175 global $form, $formother, $projectstatic, $taskstatic, $thirdpartystatic;
2177 $numlines = count($lines);
2180 $workloadforid = array();
2181 $totalforeachweek = array();
2182 $lineswithoutlevel0 = array();
2184 // Create a smaller array with sublevels only to be used later. This increase dramatically performances.
2185 if ($parent == 0) { // Always and only if at first level
2186 for ($i = 0; $i < $numlines; $i++) {
2187 if ($lines[$i]->fk_task_parent) {
2188 $lineswithoutlevel0[] = $lines[$i];
2193 //dol_syslog('projectLinesPerWeek inc='.$inc.' firstdaytoshow='.$firstdaytoshow.' task parent id='.$parent.' level='.$level." count(lines)=
".$numlines." count(lineswithoutlevel0)=
".count($lineswithoutlevel0));
2195 if (empty($oldprojectforbreak)) {
2196 $oldprojectforbreak = (empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT) ? 0 : -1); // 0 = start break, -1 = never break
2199 $restrictBefore = null;
2201 if (!empty($conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS)) {
2202 require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
2203 $restrictBefore = dol_time_plus_duree(dol_now(), - $conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS, 'm');
2206 for ($i = 0; $i < $numlines; $i++) {
2211 if ($lines[$i]->fk_task_parent == $parent) {
2212 // If we want all or we have a role on task, we show it
2213 if (empty($mine) || !empty($tasksrole[$lines[$i]->id])) {
2214 //dol_syslog("projectLinesPerWeek Found line
".$i.", a qualified task (i have role or want to show all tasks) with
id=
".$lines[$i]->id." project
id=
".$lines[$i]->fk_project);
2216 // Break on a new project
2217 if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid) {
2218 $lastprojectid = $lines[$i]->fk_project;
2219 $projectstatic->id = $lines[$i]->fk_project;
2222 //var_dump('--- '.$level.' '.$firstdaytoshow.' '.$fuser->id.' '.$projectstatic->id.' '.$workloadforid[$projectstatic->id]);
2223 //var_dump($projectstatic->weekWorkLoadPerTask);
2224 if (empty($workloadforid[$projectstatic->id])) {
2225 $projectstatic->loadTimeSpentMonth($firstdaytoshow, 0, $fuser->id); // Load time spent from table element_time for the project into this->weekWorkLoad and this->weekWorkLoadPerTask for all days of a week
2226 $workloadforid[$projectstatic->id] = 1;
2228 //var_dump($projectstatic->weekWorkLoadPerTask);
2229 //var_dump('--- '.$projectstatic->id.' '.$workloadforid[$projectstatic->id]);
2231 $projectstatic->id = $lines[$i]->fk_project;
2232 $projectstatic->ref = $lines[$i]->projectref;
2233 $projectstatic->title = $lines[$i]->projectlabel;
2234 $projectstatic->public = $lines[$i]->public;
2235 $projectstatic->thirdparty_name = $lines[$i]->thirdparty_name;
2236 $projectstatic->status = $lines[$i]->projectstatus;
2238 $taskstatic->id = $lines[$i]->id;
2239 $taskstatic->ref = ($lines[$i]->ref ? $lines[$i]->ref : $lines[$i]->id);
2240 $taskstatic->label = $lines[$i]->label;
2241 $taskstatic->date_start = $lines[$i]->date_start;
2242 $taskstatic->date_end = $lines[$i]->date_end;
2244 $thirdpartystatic->id = $lines[$i]->thirdparty_id;
2245 $thirdpartystatic->name = $lines[$i]->thirdparty_name;
2246 $thirdpartystatic->email = $lines[$i]->thirdparty_email;
2248 if (empty($oldprojectforbreak) || ($oldprojectforbreak != -1 && $oldprojectforbreak != $projectstatic->id)) {
2249 print '<tr class="oddeven trforbreak nobold
">'."\n
";
2250 print '<td colspan="'.(6 + count($TWeek)).'">';
2251 print $projectstatic->getNomUrl(1, '', 0, '<strong>'.$langs->transnoentitiesnoconv("YourRole
").':</strong> '.$projectsrole[$lines[$i]->fk_project]);
2252 if ($thirdpartystatic->id > 0) {
2253 print ' - '.$thirdpartystatic->getNomUrl(1);
2255 if ($projectstatic->title) {
2257 print '<span class="secondary
">'.$projectstatic->title.'</span>';
2263 if ($oldprojectforbreak != -1) {
2264 $oldprojectforbreak = $projectstatic->id;
2266 print '<tr class="oddeven
" data-taskid="'.$lines[$i]->id.'">'."\n
";
2270 print '<td class="nowrap
">';
2271 print $fuser->getNomUrl(1, 'withproject', 'time');
2276 /*print '<td class="nowrap
">';
2277 if ($oldprojectforbreak == -1) print $projectstatic->getNomUrl(1,'',0,$langs->transnoentitiesnoconv("YourRole
").': '.$projectsrole[$lines[$i]->fk_project]);
2281 /*print '<td class="tdoverflowmax100
">';
2282 if ($thirdpartystatic->id > 0) print $thirdpartystatic->getNomUrl(1, 'project');
2286 print '<td class="nowrap
">';
2287 print '<!-- Task id = '.$lines[$i]->id.' -->';
2288 for ($k = 0; $k < $level; $k++) {
2289 print '<div class="marginleftonly
">';
2291 print $taskstatic->getNomUrl(1, 'withproject', 'time');
2294 print '<span class="opacitymedium
">'.$taskstatic->label.'</span>';
2295 for ($k = 0; $k < $level; $k++) {
2301 print '<td class="leftborder plannedworkload right
">';
2302 if ($lines[$i]->planned_workload) {
2303 print convertSecondToTime($lines[$i]->planned_workload, 'allhourmin');
2309 // Progress declared %
2310 print '<td class="right
">';
2311 print $formother->select_percent($lines[$i]->progress, $lines[$i]->id.'progress');
2314 // Time spent by everybody
2315 print '<td class="right
">';
2316 // $lines[$i]->duration_effective is a denormalised field = summ of time spent by everybody for task. What we need is time consumed by user
2317 if ($lines[$i]->duration_effective) {
2318 print '<a href="'.DOL_URL_ROOT.'/projet/tasks/time.php?
id=
'.$lines[$i]->id.'">';
2319 print convertSecondToTime($lines[$i]->duration_effective, 'allhourmin');
2326 // Time spent by user
2327 print '<td class="right
">';
2328 $tmptimespent = $taskstatic->getSummaryOfTimeSpent($fuser->id);
2329 if ($tmptimespent['total_duration']) {
2330 print convertSecondToTime($tmptimespent['total_duration'], 'allhourmin');
2336 $disabledproject = 1;
2338 //print "x
".$lines[$i]->fk_project;
2339 //var_dump($lines[$i]);
2340 //var_dump($projectsrole[$lines[$i]->fk_project]);
2341 // If at least one role for project
2342 if ($lines[$i]->public || !empty($projectsrole[$lines[$i]->fk_project]) || $user->rights->projet->all->creer) {
2343 $disabledproject = 0;
2346 // If $restricteditformytask is on and I have no role on task, i disable edit
2347 if ($restricteditformytask && empty($tasksrole[$lines[$i]->id])) {
2351 //var_dump($projectstatic->weekWorkLoadPerTask);
2353 // Fields to show current time
2355 $modeinput = 'hours';
2356 $TFirstDay = getFirstDayOfEachWeek($TWeek, date('Y', $firstdaytoshow));
2357 $TFirstDay[reset($TWeek)] = 1;
2359 $firstdaytoshowarray = dol_getdate($firstdaytoshow);
2360 $year = $firstdaytoshowarray['year'];
2361 $month = $firstdaytoshowarray['mon'];
2362 foreach ($TWeek as $weekIndex => $weekNb) {
2363 $weekWorkLoad = !empty($projectstatic->monthWorkLoadPerTask[$weekNb][$lines[$i]->id]) ? $projectstatic->monthWorkLoadPerTask[$weekNb][$lines[$i]->id] : 0 ;
2364 if (!isset($totalforeachweek[$weekNb])) $totalforeachweek[$weekNb] = 0;
2365 $totalforeachweek[$weekNb] += $weekWorkLoad;
2368 if ($weekWorkLoad > 0) {
2369 $alreadyspent = convertSecondToTime($weekWorkLoad, 'allhourmin');
2371 $alttitle = $langs->trans("AddHereTimeSpentForWeek
", $weekNb);
2373 $disabledtaskweek = $disabledtask;
2374 $firstdayofweek = dol_mktime(0, 0, 0, $month, $TFirstDay[$weekIndex], $year);
2376 if (! $disabledtask && $restrictBefore && $firstdayofweek < $restrictBefore) {
2377 $disabledtaskweek = 1;
2380 $tableCell = '<td class="center hide weekend
">';
2382 if ($alreadyspent) {
2383 $tableCell .= '<span class="timesheetalreadyrecorded
" title="texttoreplace
"><input type="text
" class="center smallpadd
" size="2
" disabled id="timespent[
'.$inc.'][
'.((int) $weekNb).']
" name="task[
'.$lines[$i]->id.'][
'.$weekNb.']
" value="'.$alreadyspent.'"></span>';
2384 //$placeholder=' placeholder="00:00
"';
2388 $tableCell .= '<input type="text
" alt="'.($disabledtaskweek ? '' : $alttitle).'" title="'.($disabledtaskweek ? '' : $alttitle).'" '.($disabledtaskweek ? 'disabled' : $placeholder).' class="center smallpadd
" size="2
" id="timeadded[
'.$inc.'][
'.((int) $weekNb).']
" name="task[
'.$lines[$i]->id.'][
'.($TFirstDay[$weekNb] - 1).']
" value="" cols="2
" maxlength="5
"';
2389 $tableCell .= ' onkeypress="return regexEvent(
this,event,\
'timeChar\')"';
2390 $tableCell .=
' onkeyup="updateTotal('.$weekNb.
',\''.$modeinput.
'\')
"';
2391 $tableCell .= ' onblur="regexEvent(
this,event,\
''.$modeinput.
'\'); updateTotal(
'.$weekNb.',\
''.$modeinput.
'\')
" />';
2392 $tableCell .= '</td>';
2397 print '<td class="right
">';
2398 if ((!$lines[$i]->public) && $disabledproject) {
2399 print $form->textwithpicto('', $langs->trans("UserIsNotContactOfProject
"));
2400 } elseif ($disabledtask) {
2401 $titleassigntask = $langs->trans("AssignTaskToMe
");
2402 if ($fuser->id != $user->id) {
2403 $titleassigntask = $langs->trans("AssignTaskToUser
", '...');
2406 print $form->textwithpicto('', $langs->trans("TaskIsNotAssignedToUser
", $titleassigntask));
2413 // Call to show task with a lower level (task under the current task)
2416 if ($lines[$i]->id > 0) {
2417 //var_dump('totalforeachday after taskid='.$lines[$i]->id.' and previous one on level '.$level);
2418 //var_dump($totalforeachday);
2419 $ret = projectLinesPerMonth($inc, $firstdaytoshow, $fuser, $lines[$i]->id, ($parent == 0 ? $lineswithoutlevel0 : $lines), $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $isavailable, $oldprojectforbreak, $TWeek);
2420 //var_dump('ret with parent='.$lines[$i]->id.' level='.$level);
2422 foreach ($ret as $key => $val) {
2423 $totalforeachweek[$key] += $val;
2425 //var_dump('totalforeachday after taskid='.$lines[$i]->id.' and previous one on level '.$level.' + subtasks');
2426 //var_dump($totalforeachday);
2434 return $totalforeachweek;
2447 function searchTaskInChild(&$inc, $parent, &$lines, &$taskrole)
2449 //print 'Search in line with parent id = '.$parent.'<br>';
2450 $numlines = count($lines);
2451 for ($i = 0; $i < $numlines; $i++) {
2452 // Process line $lines[$i]
2453 if ($lines[$i]->fk_task_parent == $parent && $lines[$i]->id != $lines[$i]->fk_task_parent) {
2454 // If task is legitimate to show, no more need to search deeper
2455 if (isset($taskrole[$lines[$i]->id])) {
2456 //print 'Found a legitimate task id='.$lines[$i]->id.'<br>';
2461 searchTaskInChild($inc, $lines[$i]->id, $lines, $taskrole);
2462 //print 'Found inc='.$inc.'<br>';
2487 function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks = 0, $status = -1, $listofoppstatus = array(), $hiddenfields = array(), $max = 0)
2489 global $langs, $conf, $user;
2490 global $theme_datacolor;
2492 $maxofloop = (empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD);
2494 require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
2496 $listofstatus = array_keys($listofoppstatus);
2498 if (is_array($listofstatus) && !empty($conf->global->USE_COLOR_FOR_PROSPECTION_STATUS)) {
2499 // Define $themeColorId and array $statusOppList for each $listofstatus
2501 $statusOppList = array();
2502 foreach ($listofstatus as $oppStatus) {
2503 $oppStatusCode = dol_getIdFromCode($db, $oppStatus, 'c_lead_status', 'rowid', 'code');
2504 if ($oppStatusCode) {
2505 $statusOppList[$oppStatus]['code'] = $oppStatusCode;
2506 $statusOppList[$oppStatus]['color'] = isset($theme_datacolor[$themeColorId]) ? implode(', ', $theme_datacolor[$themeColorId]) : '';
2512 $projectstatic = new Project($db);
2513 $thirdpartystatic = new Societe($db);
2517 $project_year_filter = 0;
2519 $title = $langs->trans("Projects");
2520 if (strcmp($status, '') && $status >= 0) {
2521 $title = $langs->trans("Projects").' '.$langs->trans($projectstatic->statuts_long[$status]);
2524 print '<!-- print_projecttasks_array -->';
2525 print '<div class="div-table-responsive-no-min
">';
2526 print '<table class="noborder centpercent
">';
2528 $sql = " FROM
".MAIN_DB_PREFIX."projet as p
";
2530 $sql .= ",
".MAIN_DB_PREFIX."projet_task as t
";
2531 $sql .= ",
".MAIN_DB_PREFIX."element_contact as ec
";
2532 $sql .= ",
".MAIN_DB_PREFIX."c_type_contact as ctc
";
2534 $sql .= " LEFT JOIN
".MAIN_DB_PREFIX."projet_task as t ON p.rowid = t.fk_projet
";
2536 $sql .= " WHERE p.entity IN (
".getEntity('project').")
";
2537 $sql .= " AND p.rowid IN (
".$db->sanitize($projectsListId).")
";
2539 $sql .= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc =
".((int) $socid).")
";
2542 $sql .= " AND p.rowid = t.fk_projet
";
2543 $sql .= " AND ec.element_id = t.rowid
";
2544 $sql .= " AND ec.fk_socpeople =
".((int) $user->id);
2545 $sql .= " AND ec.fk_c_type_contact = ctc.rowid
"; // Replace the 2 lines with ec.fk_c_type_contact in $arrayidtypeofcontact
2546 $sql .= " AND ctc.element =
'project_task'";
2549 $sql .= " AND p.fk_statut =
".(int) $status;
2551 if (!empty($conf->global->PROJECT_LIMIT_YEAR_RANGE)) {
2552 $project_year_filter = GETPOST("project_year_filter
");
2553 //Check if empty or invalid year. Wildcard ignores the sql check
2554 if ($project_year_filter != "*
") {
2555 if (empty($project_year_filter) || !ctype_digit($project_year_filter)) {
2556 $project_year_filter = date("Y
");
2558 $sql .= " AND (p.dateo IS NULL OR p.dateo <=
".$db->idate(dol_get_last_day($project_year_filter, 12, false)).")
";
2559 $sql .= " AND (p.datee IS NULL OR p.datee >=
".$db->idate(dol_get_first_day($project_year_filter, 1, false)).")
";
2563 // Get id of project we must show tasks
2564 $arrayidofprojects = array();
2565 $sql1 = "SELECT p.rowid as projectid
";
2567 $resql = $db->query($sql1);
2570 $num = $db->num_rows($resql);
2572 $objp = $db->fetch_object($resql);
2573 $arrayidofprojects[$objp->projectid] = $objp->projectid;
2577 dol_print_error($db);
2579 if (empty($arrayidofprojects)) {
2580 $arrayidofprojects[0] = -1;
2583 // Get list of project with calculation on tasks
2584 $sql2 = "SELECT p.rowid as projectid, p.ref, p.title, p.fk_soc,
";
2585 $sql2 .= " s.rowid as socid, s.nom as socname, s.name_alias,
";
2586 $sql2 .= " s.code_client, s.code_compta, s.client,
";
2587 $sql2 .= " s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur,
";
2588 $sql2 .= " s.logo, s.email, s.entity,
";
2589 $sql2 .= " p.fk_user_creat, p.public, p.fk_statut as status, p.fk_opp_status as opp_status, p.opp_percent, p.opp_amount,
";
2590 $sql2 .= " p.dateo, p.datee,
";
2591 $sql2 .= " COUNT(t.rowid) as nb, SUM(t.planned_workload) as planned_workload, SUM(t.planned_workload * t.progress / 100) as declared_progess_workload";
2592 $sql2 .= " FROM ".MAIN_DB_PREFIX."projet as p";
2593 $sql2 .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.
rowid = p.fk_soc";
2594 $sql2 .= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task as t ON p.
rowid = t.fk_projet";
2595 $sql2 .= " WHERE p.
rowid IN (".$db->sanitize(join(',', $arrayidofprojects)).")";
2596 $sql2 .= " GROUP BY p.
rowid, p.
ref, p.title, p.fk_soc, s.
rowid, s.nom, s.name_alias, s.code_client, s.code_compta, s.client, s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur,";
2597 $sql2 .= " s.logo, s.email, s.entity, p.fk_user_creat, p.public, p.fk_statut, p.fk_opp_status, p.opp_percent, p.opp_amount, p.dateo, p.datee";
2598 $sql2 .= " ORDER BY p.title, p.
ref";
2600 $resql = $db->query($sql2);
2604 $total_opp_amount = 0;
2605 $ponderated_opp_amount = 0;
2606 $total_plannedworkload = 0;
2607 $total_declaredprogressworkload = 0;
2609 $num = $db->num_rows($resql);
2610 $nbofloop = min($num, (empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD));
2613 print
'<tr class="liste_titre">';
2614 print_liste_field_titre($title.
'<a href="'.DOL_URL_ROOT.
'/projet/list.php?search_status='.((
int) $status).
'"><span class="badge marginleftonlyshort">'.$num.
'</span></a>', $_SERVER[
"PHP_SELF"],
"",
"",
"",
"", $sortfield, $sortorder);
2616 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
2617 if (!in_array(
'prospectionstatus', $hiddenfields)) {
2618 print_liste_field_titre(
"OpportunityStatus",
"",
"",
"",
"",
'style="max-width: 100px"', $sortfield, $sortorder,
'center ');
2620 print_liste_field_titre(
$form->textwithpicto($langs->trans(
"Amount"), $langs->trans(
"OpportunityAmount").
' ('.$langs->trans(
"Tooltip").
' = '.$langs->trans(
"OpportunityWeightedAmount").
')'),
"",
"",
"",
"",
'style="max-width: 100px"', $sortfield, $sortorder,
'right ');
2623 if (empty($conf->global->PROJECT_HIDE_TASKS)) {
2625 if (!in_array(
'plannedworkload', $hiddenfields)) {
2626 print_liste_field_titre(
"PlannedWorkload",
"",
"",
"",
"",
'style="max-width: 100px"', $sortfield, $sortorder,
'right ');
2628 if (!in_array(
'declaredprogress', $hiddenfields)) {
2629 print_liste_field_titre(
"%",
"",
"",
"",
"",
'', $sortfield, $sortorder,
'right ', $langs->trans(
"ProgressDeclared"));
2632 if (!in_array(
'projectstatus', $hiddenfields)) {
2637 while ($i < $nbofloop) {
2638 $objp = $db->fetch_object($resql);
2640 if ($max && $i >= $max) {
2643 $total_task += $objp->nb;
2644 $total_opp_amount += $objp->opp_amount;
2645 $opp_weighted_amount = $objp->opp_percent * $objp->opp_amount / 100;
2646 $ponderated_opp_amount +=
price2num($opp_weighted_amount);
2647 $plannedworkload = $objp->planned_workload;
2648 $total_plannedworkload += $plannedworkload;
2649 $declaredprogressworkload = $objp->declared_progess_workload;
2650 $total_declaredprogressworkload += $declaredprogressworkload;
2654 $projectstatic->id = $objp->projectid;
2655 $projectstatic->user_author_id = $objp->fk_user_creat;
2656 $projectstatic->public = $objp->public;
2659 $userAccess = $projectstatic->restrictedProjectArea($user);
2660 if ($userAccess >= 0) {
2661 $projectstatic->ref = $objp->ref;
2662 $projectstatic->status = $objp->status;
2663 $projectstatic->title = $objp->title;
2664 $projectstatic->date_end = $db->jdate($objp->datee);
2665 $projectstatic->date_start = $db->jdate($objp->dateo);
2667 print
'<tr class="oddeven">';
2669 print
'<td class="tdoverflowmax150">';
2670 print $projectstatic->getNomUrl(1,
'', 0,
'',
'-', 0, -1,
'nowraponall');
2671 if (!in_array(
'projectlabel', $hiddenfields)) {
2672 print
'<br><span class="opacitymedium small">'.dol_escape_htmltag($objp->title).
'</span>';
2676 print
'<td class="nowraponall tdoverflowmax100">';
2677 if ($objp->fk_soc > 0) {
2678 $thirdpartystatic->id = $objp->socid;
2679 $thirdpartystatic->name = $objp->socname;
2682 $thirdpartystatic->code_compta = $objp->code_compta;
2683 $thirdpartystatic->client = $objp->client;
2685 $thirdpartystatic->code_compta_fournisseur = $objp->code_compta_fournisseur;
2686 $thirdpartystatic->fournisseur = $objp->fournisseur;
2687 $thirdpartystatic->logo = $objp->logo;
2688 $thirdpartystatic->email = $objp->email;
2689 $thirdpartystatic->entity = $objp->entity;
2690 print $thirdpartystatic->getNomUrl(1);
2694 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
2695 if (!in_array(
'prospectionstatus', $hiddenfields)) {
2696 print
'<td class="center tdoverflowmax75">';
2698 if (empty($conf->global->USE_COLOR_FOR_PROSPECTION_STATUS)) {
2699 $oppStatusCode =
dol_getIdFromCode($db, $objp->opp_status,
'c_lead_status',
'rowid',
'code');
2700 if ($langs->trans(
"OppStatus".$oppStatusCode) !=
"OppStatus".$oppStatusCode) {
2701 print $langs->trans(
"OppStatus".$oppStatusCode);
2704 if (isset($statusOppList[$objp->opp_status])) {
2705 $oppStatusCode = $statusOppList[$objp->opp_status][
'code'];
2706 $oppStatusColor = $statusOppList[$objp->opp_status][
'color'];
2708 $oppStatusCode =
dol_getIdFromCode($db, $objp->opp_status,
'c_lead_status',
'rowid',
'code');
2709 $oppStatusColor =
'';
2711 if ($oppStatusCode) {
2712 if (!empty($oppStatusColor)) {
2713 print
'<a href="'.dol_buildpath(
'/projet/list.php?search_opp_status='.$objp->opp_status, 1).
'" style="display: inline-block; width: 4px; border: 5px solid rgb('.$oppStatusColor.
'); border-radius: 2px;" title="'.$langs->trans(
"OppStatus".$oppStatusCode).
'"></a>';
2715 print
'<a href="'.dol_buildpath(
'/projet/list.php?search_opp_status='.$objp->opp_status, 1).
'" title="'.$langs->trans(
"OppStatus".$oppStatusCode).
'">'.$oppStatusCode.
'</a>';
2722 print
'<td class="right">';
2723 if ($objp->opp_percent && $objp->opp_amount) {
2724 $opp_weighted_amount = $objp->opp_percent * $objp->opp_amount / 100;
2725 $alttext = $langs->trans(
"OpportunityWeightedAmount").
' '.
price($opp_weighted_amount, 0,
'', 1, -1, 0, $conf->currency);
2726 $ponderated_opp_amount +=
price2num($opp_weighted_amount);
2728 if ($objp->opp_amount) {
2729 print
'<span class="amount" title="'.$alttext.
'">'.
$form->textwithpicto(
price($objp->opp_amount, 0,
'', 1, -1, 0), $alttext).
'</span>';
2734 if (empty($conf->global->PROJECT_HIDE_TASKS)) {
2735 print
'<td class="right">'.$objp->nb.
'</td>';
2737 $plannedworkload = $objp->planned_workload;
2738 $total_plannedworkload += $plannedworkload;
2739 if (!in_array(
'plannedworkload', $hiddenfields)) {
2740 print
'<td class="right nowraponall">'.($plannedworkload ?
convertSecondToTime($plannedworkload) :
'').
'</td>';
2742 if (!in_array(
'declaredprogress', $hiddenfields)) {
2743 $declaredprogressworkload = $objp->declared_progess_workload;
2744 $total_declaredprogressworkload += $declaredprogressworkload;
2745 print
'<td class="right nowraponall">';
2747 print ($plannedworkload ?round(100 * $declaredprogressworkload / $plannedworkload, 0).
'%' :
'');
2752 if (!in_array(
'projectstatus', $hiddenfields)) {
2753 print
'<td class="right">';
2754 print $projectstatic->getLibStatut(3);
2760 $total_task += $objp->nb;
2761 $total_opp_amount += $objp->opp_amount;
2768 print
'<tr class="oddeven">';
2769 print
'<td class="nowrap" colspan="5">';
2770 print
'<span class="opacitymedium">'.$langs->trans(
"More").
'...'.($othernb < $maxofloop ?
' ('.$othernb.
')' :
'').
'</span>';
2775 print
'<tr class="liste_total">';
2776 print
'<td>'.$langs->trans(
"Total").
"</td><td></td>";
2777 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
2778 if (!in_array(
'prospectionstatus', $hiddenfields)) {
2779 print
'<td class="liste_total"></td>';
2781 print
'<td class="liste_total right">';
2783 print
$form->textwithpicto(
price($total_opp_amount, 0,
'', 1, -1, 0), $langs->trans(
"OpportunityPonderatedAmountDesc").
' : '.
price($ponderated_opp_amount, 0,
'', 1, -1, 0, $conf->currency));
2786 if (empty($conf->global->PROJECT_HIDE_TASKS)) {
2787 print
'<td class="liste_total right">'.$total_task.
'</td>';
2788 if (!in_array(
'plannedworkload', $hiddenfields)) {
2789 print
'<td class="liste_total right">'.($total_plannedworkload ?
convertSecondToTime($total_plannedworkload) :
'').
'</td>';
2791 if (!in_array(
'declaredprogress', $hiddenfields)) {
2792 print
'<td class="liste_total right">'.($total_plannedworkload ?round(100 * $total_declaredprogressworkload / $total_plannedworkload, 0).
'%' :
'').
'</td>';
2795 if (!in_array(
'projectstatus', $hiddenfields)) {
2796 print
'<td class="liste_total"></td>';
2808 if (!empty($conf->global->PROJECT_LIMIT_YEAR_RANGE)) {
2810 print
'<form method="get" action="'.$_SERVER[
"PHP_SELF"].
'">';
2811 print
'<table width="100%">';
2813 print
'<td>'.$langs->trans(
"Year").
'</td>';
2814 print
'<td class="right"><input type="text" size="4" class="flat" name="project_year_filter" value="'.$project_year_filter.
'"/>';
2816 print
'</table></form>';
2829 function getTaskProgressView($task, $label =
true, $progressNumber =
true, $hideOnProgressNull =
false, $spaced =
false)
2831 global $langs, $conf;
2835 $plannedworkloadoutputformat =
'allhourmin';
2836 $timespentoutputformat =
'allhourmin';
2837 if (!empty($conf->global->PROJECT_PLANNED_WORKLOAD_FORMAT)) {
2838 $plannedworkloadoutputformat = $conf->global->PROJECT_PLANNED_WORKLOAD_FORMAT;
2840 if (!empty($conf->global->PROJECT_TIMES_SPENT_FORMAT)) {
2841 $timespentoutputformat = $conf->global->PROJECT_TIME_SPENT_FORMAT;
2844 if (empty($task->progress) && !empty($hideOnProgressNull)) {
2848 $spaced = !empty($spaced) ?
'spaced' :
'';
2853 $progressBarClass =
'progress-bar-info';
2854 $progressCalculated = 0;
2855 if ($task->planned_workload) {
2856 $progressCalculated = round(100 * floatval($task->duration_effective) / floatval($task->planned_workload), 2);
2859 $warningRatio = !empty($conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT) ? (1 + $conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT / 100) : 1.10;
2861 $diffTitle =
'<br>'.$langs->trans(
'ProgressDeclared').
' : '.$task->progress.(isset($task->progress) ?
'%' :
'');
2862 $diffTitle .=
'<br>'.$langs->trans(
'ProgressCalculated').
' : '.$progressCalculated.(isset($progressCalculated) ?
'%' :
'');
2865 if (floatval($progressCalculated) > floatval($task->progress * $warningRatio)) {
2866 $progressBarClass =
'progress-bar-danger';
2867 $title = $langs->trans(
'TheReportedProgressIsLessThanTheCalculatedProgressionByX', abs($task->progress - $progressCalculated).
' '.$langs->trans(
"point"));
2868 $diff =
'<span class="text-danger classfortooltip paddingrightonly" title="'.dol_htmlentities($title.$diffTitle).
'" ><i class="fa fa-caret-down"></i> '.($task->progress - $progressCalculated).
'%</span>';
2869 } elseif (floatval($progressCalculated) > floatval($task->progress)) {
2870 $progressBarClass =
'progress-bar-warning';
2871 $title = $langs->trans(
'TheReportedProgressIsLessThanTheCalculatedProgressionByX', abs($task->progress - $progressCalculated).
' '.$langs->trans(
"point"));
2872 $diff =
'<span class="text-warning classfortooltip paddingrightonly" title="'.dol_htmlentities($title.$diffTitle).
'" ><i class="fa fa-caret-left"></i> '.($task->progress - $progressCalculated).
'%</span>';
2874 $progressBarClass =
'progress-bar-success';
2875 $title = $langs->trans(
'TheReportedProgressIsMoreThanTheCalculatedProgressionByX', ($task->progress - $progressCalculated).
' '.$langs->trans(
"point"));
2876 $diff =
'<span class="text-success classfortooltip paddingrightonly" title="'.dol_htmlentities($title.$diffTitle).
'" ><i class="fa fa-caret-up"></i> '.($task->progress - $progressCalculated).
'%</span>';
2880 $out .=
'<div class="progress-group">';
2882 if ($label !==
false) {
2883 $out .=
' <span class="progress-text">';
2885 if ($label !==
true) {
2894 if ($progressNumber !==
false) {
2895 $out .=
' <span class="progress-number">';
2896 if ($progressNumber !==
true) {
2897 $out .= $progressNumber;
2899 if ($task->hasDelay()) {
2903 $url = DOL_URL_ROOT.
'/projet/tasks/time.php?id='.$task->id;
2905 $out .= !empty($diff) ? $diff.
' ' :
'';
2906 $out .=
'<a href="'.$url.
'" >';
2907 $out .=
'<b title="'.$langs->trans(
'TimeSpent').
'" >';
2908 if ($task->duration_effective) {
2918 $out .=
'<a href="'.$url.
'" >';
2919 $out .=
'<span title="'.$langs->trans(
'PlannedWorkload').
'" >';
2920 if ($task->planned_workload) {
2932 $out .=
' <div class="progress sm '.$spaced.
'">';
2933 $diffval = floatval($task->progress) - floatval($progressCalculated);
2934 if ($diffval >= 0) {
2936 $out .=
' <div class="progress-bar '.$progressBarClass.
'" style="width: '.floatval($task->progress).
'%" title="'.floatval($task->progress).
'%">';
2937 if (!empty($task->progress)) {
2938 $out .=
' <div class="progress-bar progress-bar-consumed" style="width: '.floatval($progressCalculated / (floatval($task->progress) == 0 ? 1 : $task->progress) * 100).
'%" title="'.floatval($progressCalculated).
'%"></div>';
2943 $out .=
' <div class="progress-bar progress-bar-consumed-late" style="width: '.floatval($progressCalculated).
'%" title="'.floatval($progressCalculated).
'%">';
2944 $out .=
' <div class="progress-bar '.$progressBarClass.
'" style="width: '.($task->progress ? floatval($task->progress / (floatval($progressCalculated) == 0 ? 1 : $progressCalculated) * 100).
'%' :
'1px').
'" title="'.floatval($task->progress).
'%"></div>';
2963 global $conf, $langs;
2967 if ($task->progress !=
'') {
2971 $badgeClass =
'badge ';
2972 if ($task->planned_workload) {
2973 $progressCalculated = round(100 * floatval($task->duration_effective) / floatval($task->planned_workload), 2);
2976 $warningRatio = !empty($conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT) ? (1 + $conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT / 100) : 1.10;
2978 if (floatval($progressCalculated) > floatval($task->progress * $warningRatio)) {
2979 $badgeClass .=
'badge-danger';
2980 if (empty($tooltip)) {
2981 $tooltip = $task->progress.
'% < '.$langs->trans(
"TimeConsumed").
' '.$progressCalculated.
'%';
2983 } elseif (floatval($progressCalculated) > floatval($task->progress)) {
2984 $badgeClass .=
'badge-warning';
2985 if (empty($tooltip)) {
2986 $tooltip = $task->progress.
'% < '.$langs->trans(
"TimeConsumed").
' '.$progressCalculated.
'%';
2989 $badgeClass .=
'badge-success';
2990 if (empty($tooltip)) {
2991 $tooltip = $task->progress.
'% >= '.$langs->trans(
"TimeConsumed").
' '.$progressCalculated.
'%';
2998 if (!empty($tooltip)) {
2999 $badgeClass .=
' classfortooltip';
3000 $title =
'title="'.dol_htmlentities($tooltip).
'"';
3003 if (empty($label)) {
3004 $label = $task->progress.
' %';
3007 if (!empty($label)) {
3008 $out =
'<span class="'.$badgeClass.
'" '.$title.
' >'.$label.
'</span>';
Class for ConferenceOrBoothAttendee.
Class for ConferenceOrBooth.
static count($dbs, $objecttype, $objectid)
Return nb of links.
Class to manage projects.
Class to manage Dolibarr users.
if(isModEnabled('facture') && $user->hasRight('facture', 'lire')) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') && $user->hasRight('don', 'lire')) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $sql
Social contributions to pay.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
dol_time_plus_duree($time, $duration_value, $duration_unit, $ruleforendofmonth=0)
Add a delay to a date.
convertSecondToTime($iSecond, $format='all', $lengthOfDay=86400, $lengthOfWeek=7)
Return, in clear text, value of a number of seconds in days, hours and minutes.
print *****$script_file(".$version.") pid cd cd cd description as description
Only used if Module[ID]Desc translation string is not found.
print *****$script_file(".$version.") pid c cd cd cd description as p label as s rowid
dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0, $nbsecondsold=0)
Scan a directory and return a list of files/directories.
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_now($mode='auto')
Return date for now.
dol_getIdFromCode($db, $key, $tablename, $fieldkey='code', $fieldid='id', $entityfilter=0, $filters='')
Return an id or code from a code or id.
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
dol_htmlentities($string, $flags=ENT_QUOTES|ENT_SUBSTITUTE, $encoding='UTF-8', $double_encode=false)
Replace htmlentities functions.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, $mode='add', $filterorigmodule='')
Complete or removed entries into a head array (used to build tabs).
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
dol_getdate($timestamp, $fast=false, $forcetimezone='')
Return an array with locale date info.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
if(!defined( 'CSRFCHECK_WITH_TOKEN'))
dol_setcache($memoryid, $data, $expire=0)
Save data into a memory area shared by all users, all sessions on server.
dol_getcache($memoryid)
Read a memory area shared by all users, all sessions on server.
Class to generate the form for creating a new ticket.
projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask, $preselectedday, &$isavailable, $oldprojectforbreak=0, $arrayfields=array(), $extrafields=null)
Output a task line into a pertime intput mode.
task_prepare_head($object)
Prepare array with list of tabs.
searchTaskInChild(&$inc, $parent, &$lines, &$taskrole)
Search in task lines with a particular parent if there is a task for a particular user (in taskrole)
getTaskProgressView($task, $label=true, $progressNumber=true, $hideOnProgressNull=false, $spaced=false)
projectLinesPerAction(&$inc, $parent, $fuser, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask, $preselectedday, &$isavailable, $oldprojectforbreak=0)
Output a task line into a pertime intput mode.
project_timesheet_prepare_head($mode, $fuser=null)
Prepare array with list of tabs.
project_admin_prepare_head()
Prepare array with list of tabs.
getTaskProgressBadge($task, $label='', $tooltip='')
projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask, &$isavailable, $oldprojectforbreak=0, $arrayfields=array(), $extrafields=null)
Output a task line into a perday intput mode.
projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$taskrole, $projectsListId='', $addordertick=0, $projectidfortotallink=0, $dummy='', $showbilltime=0, $arrayfields=array(), $arrayofselected=array())
Show task lines with a particular parent.
project_prepare_head(Project $project, $moreparam='')
Prepare array with list of tabs.