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';
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';
129 if (isModEnabled(
"supplier_proposal") || isModEnabled(
"supplier_order") || isModEnabled(
"supplier_invoice")
130 || isModEnabled(
"propal") || isModEnabled(
'commande')
131 || isModEnabled(
'facture') || isModEnabled(
'contrat')
132 || isModEnabled(
'ficheinter') || isModEnabled(
'agenda') || isModEnabled(
'deplacement') || isModEnabled(
'stock')) {
135 $cachekey =
'count_elements_project_'.$project->id;
137 if (!is_null($dataretrieved)) {
138 $nbElements = $dataretrieved;
140 if (isModEnabled(
'stock')) {
141 $nbElements += $project->getElementCount(
'stock',
'entrepot',
'fk_project');
143 if (isModEnabled(
"propal")) {
144 $nbElements += $project->getElementCount(
'propal',
'propal');
146 if (isModEnabled(
'commande')) {
147 $nbElements += $project->getElementCount(
'order',
'commande');
149 if (isModEnabled(
'facture')) {
150 $nbElements += $project->getElementCount(
'invoice',
'facture');
152 if (isModEnabled(
'facture')) {
153 $nbElements += $project->getElementCount(
'invoice_predefined',
'facture_rec');
155 if (isModEnabled(
'supplier_proposal')) {
156 $nbElements += $project->getElementCount(
'proposal_supplier',
'supplier_proposal');
158 if (isModEnabled(
"supplier_order")) {
159 $nbElements += $project->getElementCount(
'order_supplier',
'commande_fournisseur');
161 if (isModEnabled(
"supplier_invoice")) {
162 $nbElements += $project->getElementCount(
'invoice_supplier',
'facture_fourn');
164 if (isModEnabled(
'contrat')) {
165 $nbElements += $project->getElementCount(
'contract',
'contrat');
167 if (isModEnabled(
'ficheinter')) {
168 $nbElements += $project->getElementCount(
'intervention',
'fichinter');
170 if (isModEnabled(
"expedition")) {
171 $nbElements += $project->getElementCount(
'shipping',
'expedition');
173 if (isModEnabled(
'mrp')) {
174 $nbElements += $project->getElementCount(
'mrp',
'mrp_mo',
'fk_project');
176 if (isModEnabled(
'deplacement')) {
177 $nbElements += $project->getElementCount(
'trip',
'deplacement');
179 if (isModEnabled(
'expensereport')) {
180 $nbElements += $project->getElementCount(
'expensereport',
'expensereport');
182 if (isModEnabled(
'don')) {
183 $nbElements += $project->getElementCount(
'donation',
'don');
185 if (isModEnabled(
'loan')) {
186 $nbElements += $project->getElementCount(
'loan',
'loan');
188 if (isModEnabled(
'tax')) {
189 $nbElements += $project->getElementCount(
'chargesociales',
'chargesociales');
191 if (isModEnabled(
'project')) {
192 $nbElements += $project->getElementCount(
'project_task',
'projet_task');
194 if (isModEnabled(
'stock')) {
195 $nbElements += $project->getElementCount(
'stock_mouvement',
'stock');
197 if (isModEnabled(
'salaries')) {
198 $nbElements += $project->getElementCount(
'salaries',
'payment_salary');
200 if (isModEnabled(
"banque")) {
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 = $Tickettatic->getCountOfItemsLinkedByObjectID($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");
235 require_once DOL_DOCUMENT_ROOT.
'/core/lib/memory.lib.php';
236 $cachekey =
'count_conferenceorbooth_'.$project->id;
238 if (!is_null($dataretrieved)) {
239 $nbConfOrBooth = $dataretrieved;
241 require_once DOL_DOCUMENT_ROOT.
'/eventorganization/class/conferenceorbooth.class.php';
243 $result = $conforbooth->fetchAll(
'',
'', 0, 0, array(
't.fk_project'=>$project->id));
245 if (!is_array($result) && $result<0) {
248 $nbConfOrBooth = count($result);
252 $cachekey =
'count_attendees_'.$project->id;
254 if (!is_null($dataretrieved)) {
255 $nbAttendees = $dataretrieved;
257 require_once DOL_DOCUMENT_ROOT.
'/eventorganization/class/conferenceorboothattendee.class.php';
259 $result = $conforboothattendee->fetchAll(
'',
'', 0, 0, array(
't.fk_project'=>$project->id));
261 if (!is_array($result) && $result<0) {
262 setEventMessages($conforboothattendee->error, $conforboothattendee->errors,
'errors');
264 $nbAttendees = count($result);
268 if ($nbConfOrBooth > 0 || $nbAttendees > 0) {
269 $head[$h][1] .=
'<span class="badge marginleftonlyshort">';
270 $head[$h][1] .=
'<span title="'.dol_escape_htmltag($langs->trans(
"ConferenceOrBooth")).
'">'.$nbConfOrBooth.
'</span>';
271 $head[$h][1] .=
' + ';
272 $head[$h][1] .=
'<span title="'.dol_escape_htmltag($langs->trans(
"Attendees")).
'">'.$nbAttendees.
'</span>';
273 $head[$h][1] .=
'</span>';
275 $head[$h][2] =
'eventorganisation';
288 if (!empty($project->note_private)) {
291 if (!empty($project->note_public)) {
294 $head[$h][0] = DOL_URL_ROOT.
'/projet/note.php?id='.$project->id;
295 $head[$h][1] = $langs->trans(
'Notes');
297 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbNote.
'</span>';
299 $head[$h][2] =
'notes';
306 require_once DOL_DOCUMENT_ROOT.
'/core/lib/memory.lib.php';
307 $cachekey =
'count_attached_project_'.$project->id;
309 if (!is_null($dataretrieved)) {
310 $totalAttached = $dataretrieved;
312 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
313 require_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
314 $upload_dir = $conf->project->multidir_output[empty($project->entity) ? 1 : $project->entity].
"/".
dol_sanitizeFileName($project->ref);
315 $nbFiles = count(
dol_dir_list($upload_dir,
'files', 0,
'',
'(\.meta|_preview.*\.png)$'));
316 $nbLinks =
Link::count($db, $project->element, $project->id);
317 $totalAttached = $nbFiles + $nbLinks;
320 $head[$h][0] = DOL_URL_ROOT.
'/projet/document.php?id='.$project->id;
321 $head[$h][1] = $langs->trans(
'Documents');
322 if (($totalAttached) > 0) {
323 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.($totalAttached).
'</span>';
325 $head[$h][2] =
'document';
332 require_once DOL_DOCUMENT_ROOT.
'/core/lib/memory.lib.php';
333 $cachekey =
'count_attached_project_'.$project->id;
335 if (!is_null($dataretrieved)) {
336 $nbComments = $dataretrieved;
338 $nbComments = $project->getNbComments();
341 $head[$h][0] = DOL_URL_ROOT.
'/projet/comment.php?id='.$project->id;
342 $head[$h][1] = $langs->trans(
"CommentLink");
343 if ($nbComments > 0) {
344 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbComments.
'</span>';
346 $head[$h][2] =
'project_comment';
350 $head[$h][0] = DOL_URL_ROOT.
'/projet/messaging.php?id='.$project->id;
351 $head[$h][1] = $langs->trans(
"Events");
352 if (isModEnabled(
'agenda') && ($user->hasRight(
'agenda',
'myactions',
'read') || $user->hasRight(
'agenda',
'allactions',
'read'))) {
354 $head[$h][1] .= $langs->trans(
"Agenda");
356 $head[$h][2] =
'agenda';
375 global $db, $langs, $conf, $user;
379 $head[$h][0] = DOL_URL_ROOT.
'/projet/tasks/task.php?id='.$object->id.(GETPOST(
'withproject') ?
'&withproject=1' :
'');
380 $head[$h][1] = $langs->trans(
"Task");
381 $head[$h][2] =
'task_task';
384 $nbContact = count($object->liste_contact(-1,
'internal')) + count($object->liste_contact(-1,
'external'));
385 $head[$h][0] = DOL_URL_ROOT.
'/projet/tasks/contact.php?id='.$object->id.(GETPOST(
'withproject') ?
'&withproject=1' :
'');
386 $head[$h][1] = $langs->trans(
"TaskRessourceLinks");
387 if ($nbContact > 0) {
388 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbContact.
'</span>';
390 $head[$h][2] =
'task_contact';
395 $sql =
"SELECT t.rowid";
398 $sql .=
" FROM ".MAIN_DB_PREFIX.
"element_time as t";
399 $sql .=
" WHERE t.elementtype='task' AND t.fk_element = ".((int) $object->id);
400 $resql = $db->query($sql);
402 $obj = $db->fetch_object($resql);
410 $head[$h][0] = DOL_URL_ROOT.
'/projet/tasks/time.php?id='.urlencode($object->id).(GETPOST(
'withproject') ?
'&withproject=1' :
'');
411 $head[$h][1] = $langs->trans(
"TimeSpent");
412 if ($nbTimeSpent > 0) {
413 $head[$h][1] .=
'<span class="badge marginleftonlyshort">...</span>';
415 $head[$h][2] =
'task_time';
426 if (!empty($object->note_private)) {
429 if (!empty($object->note_public)) {
432 $head[$h][0] = DOL_URL_ROOT.
'/projet/tasks/note.php?id='.urlencode($object->id).(GETPOST(
'withproject') ?
'&withproject=1' :
'');
433 $head[$h][1] = $langs->trans(
'Notes');
435 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbNote.
'</span>';
437 $head[$h][2] =
'task_notes';
441 $head[$h][0] = DOL_URL_ROOT.
'/projet/tasks/document.php?id='.$object->id.(GETPOST(
'withproject') ?
'&withproject=1' :
'');
443 include_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
444 include_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
445 $nbFiles = count(
dol_dir_list($filesdir,
'files', 0,
'',
'(\.meta|_preview.*\.png)$'));
446 $nbLinks =
Link::count($db, $object->element, $object->id);
447 $head[$h][1] = $langs->trans(
'Documents');
448 if (($nbFiles + $nbLinks) > 0) {
449 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).
'</span>';
451 $head[$h][2] =
'task_document';
456 $nbComments = $object->getNbComments();
457 $head[$h][0] = DOL_URL_ROOT.
'/projet/tasks/comment.php?id='.$object->id.(GETPOST(
'withproject') ?
'&withproject=1' :
'');
458 $head[$h][1] = $langs->trans(
"CommentLink");
459 if ($nbComments > 0) {
460 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbComments.
'</span>';
462 $head[$h][2] =
'task_comment';
600function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$taskrole, $projectsListId =
'', $addordertick = 0, $projectidfortotallink = 0, $dummy =
'', $showbilltime = 0, $arrayfields = array(), $arrayofselected = array())
602 global $user, $langs, $conf, $db, $hookmanager;
603 global $projectstatic, $taskstatic, $extrafields;
607 $projectsArrayId = explode(
',', $projectsListId);
609 $numlines = count($lines);
612 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;
616 $total_projectlinesa_spent = 0;
617 $total_projectlinesa_planned = 0;
618 $total_projectlinesa_spent_if_planned = 0;
619 $total_projectlinesa_declared_if_planned = 0;
620 $total_projectlinesa_tobill = 0;
621 $total_projectlinesa_billed = 0;
622 $total_budget_amount = 0;
623 $totalarray = array();
626 for ($i = 0; $i < $numlines; $i++) {
627 if ($parent == 0 && $level >= 0) {
633 if ($lines[$i]->fk_task_parent == $parent || $level < 0) {
639 if (is_array($taskrole)) {
641 if (!isset($taskrole[$lines[$i]->
id]) && $lines[$i]->
id != $lines[$i]->fk_task_parent) {
643 $foundtaskforuserdeeper = 0;
646 if ($foundtaskforuserdeeper > 0) {
655 if (!$user->hasRight(
'projet',
'all',
'lire')) {
657 if (!in_array($lines[$i]->fk_project, $projectsArrayId)) {
668 if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid) {
670 $lastprojectid = $lines[$i]->fk_project;
673 print
'<tr class="oddeven" id="row-'.$lines[$i]->id.
'">'.
"\n";
675 $projectstatic->id = $lines[$i]->fk_project;
676 $projectstatic->ref = $lines[$i]->projectref;
677 $projectstatic->public = $lines[$i]->public;
678 $projectstatic->title = $lines[$i]->projectlabel;
679 $projectstatic->usage_bill_time = $lines[$i]->usage_bill_time;
680 $projectstatic->status = $lines[$i]->projectstatus;
682 $taskstatic->id = $lines[$i]->id;
683 $taskstatic->ref = $lines[$i]->ref;
684 $taskstatic->label = (!empty($taskrole[$lines[$i]->
id]) ? $langs->trans(
"YourRole").
': '.$taskrole[$lines[$i]->id] :
'');
685 $taskstatic->projectstatus = $lines[$i]->projectstatus;
686 $taskstatic->progress = $lines[$i]->progress;
687 $taskstatic->fk_statut = $lines[$i]->status;
688 $taskstatic->date_start = $lines[$i]->date_start;
689 $taskstatic->date_end = $lines[$i]->date_end;
690 $taskstatic->datee = $lines[$i]->date_end;
691 $taskstatic->planned_workload = $lines[$i]->planned_workload;
692 $taskstatic->duration_effective = $lines[$i]->duration_effective;
693 $taskstatic->budget_amount = $lines[$i]->budget_amount;
697 print
'<td class="nowrap center">';
699 if (in_array($lines[$i]->
id, $arrayofselected)) {
702 print
'<input id="cb' . $lines[$i]->id .
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="' . $lines[$i]->id .
'"' . ($selected ?
' checked="checked"' :
'') .
'>';
708 print
'<td class="nowraponall">';
710 if ($lines[$i]->
public || in_array($lines[$i]->fk_project, $projectsArrayId) || $user->hasRight(
'projet',
'all',
'lire')) {
711 print $projectstatic->getNomUrl(1);
713 print $projectstatic->getNomUrl(1,
'nolink');
720 $projectstatic->statut = $lines[$i]->projectstatus;
721 print $projectstatic->getLibStatut(2);
726 if (count($arrayfields) > 0 && !empty($arrayfields[
't.ref'][
'checked'])) {
727 print
'<td class="nowraponall">';
728 if ($showlineingray) {
729 print
'<i>'.img_object(
'',
'projecttask').
' '.$lines[$i]->ref.
'</i>';
731 print $taskstatic->getNomUrl(1,
'withproject');
737 if (count($arrayfields) > 0 && !empty($arrayfields[
't.label'][
'checked'])) {
739 if ($showlineingray) {
740 $labeltoshow .=
'<i>';
743 for ($k = 0; $k < $level; $k++) {
744 $labeltoshow .=
'<div class="marginleftonly">';
747 for ($k = 0; $k < $level; $k++) {
748 $labeltoshow .=
'</div>';
750 if ($showlineingray) {
751 $labeltoshow .=
'</i>';
753 print
'<td class="tdoverflowmax200" title="'.dol_escape_htmltag($labeltoshow).
'">';
758 if (count($arrayfields) > 0 && !empty($arrayfields[
't.description'][
'checked'])) {
759 print
'<td class="tdoverflowmax200" title="'.dol_escape_htmltag($lines[$i]->
description).
'">';
760 print $lines[$i]->description;
765 if (count($arrayfields) > 0 && !empty($arrayfields[
't.dateo'][
'checked'])) {
766 print
'<td class="center nowraponall">';
772 if (count($arrayfields) > 0 && !empty($arrayfields[
't.datee'][
'checked'])) {
773 print
'<td class="center nowraponall">';
775 if ($taskstatic->hasDelay()) {
781 $plannedworkloadoutputformat =
'allhourmin';
782 $timespentoutputformat =
'allhourmin';
784 $plannedworkloadoutputformat = $conf->global->PROJECT_PLANNED_WORKLOAD_FORMAT;
787 $timespentoutputformat = $conf->global->PROJECT_TIME_SPENT_FORMAT;
791 if (count($arrayfields) > 0 && !empty($arrayfields[
't.planned_workload'][
'checked'])) {
792 print
'<td class="right">';
793 $fullhour =
convertSecondToTime($lines[$i]->planned_workload, $plannedworkloadoutputformat);
795 if ($lines[$i]->planned_workload !=
'') {
805 if (count($arrayfields) > 0 && !empty($arrayfields[
't.duration_effective'][
'checked'])) {
806 print
'<td class="right">';
807 if ($showlineingray) {
810 print
'<a href="'.DOL_URL_ROOT.
'/projet/tasks/time.php?id='.$lines[$i]->id.($showproject ?
'' :
'&withproject=1').
'">';
812 if ($lines[$i]->duration_effective) {
817 if ($showlineingray) {
826 if (count($arrayfields) > 0 && !empty($arrayfields[
't.progress_calculated'][
'checked'])) {
829 if ($lines[$i]->planned_workload || $lines[$i]->duration_effective) {
830 if ($lines[$i]->planned_workload) {
831 $s = round(100 * $lines[$i]->duration_effective / $lines[$i]->planned_workload, 2).
' %';
834 $s = $langs->trans(
'WorkloadNotDefined');
835 $shtml =
'<span class="opacitymedium">'.$s.
'</span>';
838 print
'<td class="right tdoverflowmax100" title="'.dol_escape_htmltag($s).
'">';
844 if (count($arrayfields) > 0 && !empty($arrayfields[
't.progress'][
'checked'])) {
845 print
'<td class="right">';
846 if ($lines[$i]->progress !=
'') {
853 if (count($arrayfields) > 0 && !empty($arrayfields[
't.progress_summary'][
'checked'])) {
854 print
'<td class="right">';
855 if ($lines[$i]->progress !=
'' && $lines[$i]->duration_effective) {
863 if (count($arrayfields) > 0 && !empty($arrayfields[
't.tobill'][
'checked'])) {
864 print
'<td class="right">';
865 if ($lines[$i]->usage_bill_time) {
867 $total_projectlinesa_tobill += $lines[$i]->tobill;
869 print
'<span class="opacitymedium">'.$langs->trans(
"NA").
'</span>';
875 if (count($arrayfields) > 0 && !empty($arrayfields[
't.billed'][
'checked'])) {
876 print
'<td class="right">';
877 if ($lines[$i]->usage_bill_time) {
879 $total_projectlinesa_billed += $lines[$i]->billed;
881 print
'<span class="opacitymedium">'.$langs->trans(
"NA").
'</span>';
888 if (count($arrayfields) > 0 && !empty($arrayfields[
't.budget_amount'][
'checked'])) {
889 print
'<td class="center">';
890 if ($lines[$i]->budget_amount) {
891 print
'<span class="amount">'.price($lines[$i]->budget_amount, 0, $langs, 1, 0, 0, $conf->currency).
'</span>';
892 $total_budget_amount += $lines[$i]->budget_amount;
898 if (count($arrayfields) > 0 && !empty($arrayfields[
'c.assigned'][
'checked'])) {
899 print
'<td class="center">';
901 foreach (array(
'internal',
'external') as $source) {
903 $tab = $lines[$i]->liste_contact(-1, $source, 0,
'', 1);
905 $numcontact = count($tab);
906 if (!empty($numcontact)) {
907 foreach ($tab as $contacttask) {
909 if ($source ==
'internal') {
914 $c->fetch($contacttask[
'id']);
915 if (!empty($c->photo)) {
916 if (get_class($c) ==
'User') {
917 print $c->getNomUrl(-2,
'', 0, 0, 24, 1,
'', ($ifisrt ?
'' :
'notfirst'));
919 print $c->getNomUrl(-2,
'', 0,
'', -1, 0, ($ifisrt ?
'' :
'notfirst'));
922 if (get_class($c) ==
'User') {
923 print $c->getNomUrl(2,
'', 0, 0, 24, 1,
'', ($ifisrt ?
'' :
'notfirst'));
925 print $c->getNomUrl(2,
'', 0,
'', -1, 0, ($ifisrt ?
'' :
'notfirst'));
936 $extrafieldsobjectkey = $taskstatic->table_element;
937 $extrafieldsobjectprefix =
'efpt.';
938 $obj = $lines[$i]->obj;
939 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
941 $parameters = array(
'arrayfields'=>$arrayfields,
'obj'=>$lines[$i]);
942 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters);
943 print $hookmanager->resPrint;
946 print
'<td class="tdlineupdown center"></td>';
950 print
'<td class="nowrap center">';
952 if (in_array($lines[$i]->
id, $arrayofselected)) {
955 print
'<input id="cb' . $lines[$i]->id .
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="' . $lines[$i]->id .
'"' . ($selected ?
' checked="checked"' :
'') .
'>';
962 if (!$showlineingray) {
968 if ($lines[$i]->
id) {
969 projectLinesa($inc, $lines[$i]->
id, $lines, $level, $var, $showproject, $taskrole, $projectsListId, $addordertick, $projectidfortotallink,
'', $showbilltime, $arrayfields);
974 $total_projectlinesa_spent += $lines[$i]->duration_effective;
975 $total_projectlinesa_planned += $lines[$i]->planned_workload;
976 if ($lines[$i]->planned_workload) {
977 $total_projectlinesa_spent_if_planned += $lines[$i]->duration_effective;
979 if ($lines[$i]->planned_workload) {
980 $total_projectlinesa_declared_if_planned += $lines[$i]->planned_workload * $lines[$i]->progress / 100;
989 if (($total_projectlinesa_planned > 0 || $total_projectlinesa_spent > 0 || $total_projectlinesa_tobill > 0 || $total_projectlinesa_billed > 0 || $total_budget_amount > 0)
991 print
'<tr class="liste_total nodrag nodrop">';
994 print
'<td class="liste_total"></td>';
997 print
'<td class="liste_total">'.$langs->trans(
"Total").
'</td>';
999 print
'<td></td><td></td>';
1001 if (count($arrayfields) > 0 && !empty($arrayfields[
't.label'][
'checked'])) {
1004 if (count($arrayfields) > 0 && !empty($arrayfields[
't.description'][
'checked'])) {
1007 if (count($arrayfields) > 0 && !empty($arrayfields[
't.dateo'][
'checked'])) {
1010 if (count($arrayfields) > 0 && !empty($arrayfields[
't.datee'][
'checked'])) {
1013 if (count($arrayfields) > 0 && !empty($arrayfields[
't.planned_workload'][
'checked'])) {
1014 print
'<td class="nowrap liste_total right">';
1018 if (count($arrayfields) > 0 && !empty($arrayfields[
't.duration_effective'][
'checked'])) {
1019 print
'<td class="nowrap liste_total right">';
1020 if ($projectidfortotallink > 0) {
1021 print
'<a href="'.DOL_URL_ROOT.
'/projet/tasks/time.php?projectid='.$projectidfortotallink.($showproject ?
'' :
'&withproject=1').
'">';
1024 if ($projectidfortotallink > 0) {
1030 if ($total_projectlinesa_planned) {
1031 $totalAverageDeclaredProgress = round(100 * $total_projectlinesa_declared_if_planned / $total_projectlinesa_planned, 2);
1032 $totalCalculatedProgress = round(100 * $total_projectlinesa_spent / $total_projectlinesa_planned, 2);
1035 $warningRatio =
getDolGlobalString(
'PROJECT_TIME_SPEND_WARNING_PERCENT') ? (1 + $conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT / 100) : 1.10;
1038 $progressBarClass =
'progress-bar-info';
1039 $badgeClass =
'badge ';
1041 if ($totalCalculatedProgress > $totalAverageDeclaredProgress) {
1042 $progressBarClass =
'progress-bar-danger';
1043 $badgeClass .=
'badge-danger';
1044 } elseif ($totalCalculatedProgress * $warningRatio >= $totalAverageDeclaredProgress) {
1045 $progressBarClass =
'progress-bar-warning';
1046 $badgeClass .=
'badge-warning';
1048 $progressBarClass =
'progress-bar-success';
1049 $badgeClass .=
'badge-success';
1054 if (count($arrayfields) > 0 && !empty($arrayfields[
't.progress_calculated'][
'checked'])) {
1055 print
'<td class="nowrap liste_total right">';
1056 if ($total_projectlinesa_planned) {
1057 print $totalCalculatedProgress.
' %';
1063 if (count($arrayfields) > 0 && !empty($arrayfields[
't.progress'][
'checked'])) {
1064 print
'<td class="nowrap liste_total right">';
1065 if ($total_projectlinesa_planned) {
1066 print
'<span class="'.$badgeClass.
'" >'.$totalAverageDeclaredProgress.
' %</span>';
1073 if (count($arrayfields) > 0 && !empty($arrayfields[
't.progress_summary'][
'checked'])) {
1074 print
'<td class="right">';
1075 if ($total_projectlinesa_planned) {
1077 print
' <div class="progress sm" title="'.$totalAverageDeclaredProgress.
'%" >';
1078 print
' <div class="progress-bar '.$progressBarClass.
'" style="width: '.$totalAverageDeclaredProgress.
'%"></div>';
1085 if ($showbilltime) {
1086 if (count($arrayfields) > 0 && !empty($arrayfields[
't.tobill'][
'checked'])) {
1087 print
'<td class="nowrap liste_total right">';
1091 if (count($arrayfields) > 0 && !empty($arrayfields[
't.billed'][
'checked'])) {
1092 print
'<td class="nowrap liste_total right">';
1099 if (count($arrayfields) > 0 && !empty($arrayfields[
't.budget_amount'][
'checked'])) {
1100 print
'<td class="nowrap liste_total center">';
1101 if (strcmp($total_budget_amount,
'')) {
1102 print
price($total_budget_amount, 0, $langs, 1, 0, 0, $conf->currency);
1112 if (count($arrayfields) > 0 && !empty($arrayfields[
'c.assigned'][
'checked'])) {
1117 if (!empty($extrafields->attributes[
'projet_task'][
'totalizable'])) {
1118 foreach ($extrafields->attributes[
'projet_task'][
'totalizable'] as $key => $value) {
1119 if (!empty($arrayfields[
'efpt.'.$key][
'checked']) && $arrayfields[
'efpt.'.$key][
'checked'] == 1) {
1120 print
'<td class="right">';
1122 print empty($totalarray[
'totalizable'][$key][
'total']) ?
'' : $totalarray[
'totalizable'][$key][
'total'];
1130 print
'<td class="liste_total"></td>';
1133 print
'<td class="liste_total"></td>';
1160function projectLinesPerAction(&$inc, $parent, $fuser, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask, $preselectedday, &$isavailable, $oldprojectforbreak = 0)
1162 global $conf, $db, $user, $langs;
1163 global $form, $formother, $projectstatic, $taskstatic, $thirdpartystatic;
1166 $totalforeachline = array();
1167 $workloadforid = array();
1168 $lineswithoutlevel0 = array();
1170 $numlines = count($lines);
1174 for ($i = 0; $i < $numlines; $i++) {
1175 if ($lines[$i]->fk_task_parent) {
1176 $lineswithoutlevel0[] = $lines[$i];
1181 if (empty($oldprojectforbreak)) {
1182 $oldprojectforbreak = (!
getDolGlobalString(
'PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT') ? 0 : -1);
1186 for ($i = 0; $i < $numlines; $i++) {
1194 if (empty($mine) || !empty($tasksrole[$lines[$i]->
id])) {
1198 if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid) {
1199 $lastprojectid = $lines[$i]->fk_project;
1200 if ($preselectedday) {
1201 $projectstatic->id = $lines[$i]->fk_project;
1205 if (empty($workloadforid[$projectstatic->id])) {
1206 if ($preselectedday) {
1207 $projectstatic->loadTimeSpent($preselectedday, 0, $fuser->id);
1208 $workloadforid[$projectstatic->id] = 1;
1212 $projectstatic->id = $lines[$i]->fk_project;
1213 $projectstatic->ref = $lines[$i]->project_ref;
1214 $projectstatic->title = $lines[$i]->project_label;
1215 $projectstatic->public = $lines[$i]->public;
1216 $projectstatic->status = $lines[$i]->project->status;
1218 $taskstatic->id = $lines[$i]->fk_statut;
1219 $taskstatic->ref = ($lines[$i]->task_ref ? $lines[$i]->task_ref : $lines[$i]->task_id);
1220 $taskstatic->label = $lines[$i]->task_label;
1221 $taskstatic->date_start = $lines[$i]->date_start;
1222 $taskstatic->date_end = $lines[$i]->date_end;
1224 $thirdpartystatic->id = $lines[$i]->socid;
1225 $thirdpartystatic->name = $lines[$i]->thirdparty_name;
1226 $thirdpartystatic->email = $lines[$i]->thirdparty_email;
1228 if (empty($oldprojectforbreak) || ($oldprojectforbreak != -1 && $oldprojectforbreak != $projectstatic->id)) {
1229 print
'<tr class="oddeven trforbreak nobold">'.
"\n";
1230 print
'<td colspan="11">';
1231 print $projectstatic->getNomUrl(1,
'', 0, $langs->transnoentitiesnoconv(
"YourRole").
': '.$projectsrole[$lines[$i]->fk_project]);
1232 if ($projectstatic->title) {
1234 print $projectstatic->title;
1240 if ($oldprojectforbreak != -1) {
1241 $oldprojectforbreak = $projectstatic->id;
1244 print
'<tr class="oddeven">'.
"\n";
1255 if ($oldprojectforbreak == -1) {
1256 print $projectstatic->getNomUrl(1,
'', 0, $langs->transnoentitiesnoconv(
"YourRole").
': '.$projectsrole[$lines[$i]->fk_project]);
1257 print
'<br>'.$projectstatic->title;
1262 print
'<td class="tdoverflowmax100">';
1263 if ($thirdpartystatic->id > 0) {
1264 print $thirdpartystatic->getNomUrl(1,
'project', 10);
1270 print
'<!-- Task id = '.$lines[$i]->id.
' (projectlinesperaction) -->';
1271 for ($k = 0; $k < $level; $k++) {
1272 print
'<div class="marginleftonly">';
1274 print $taskstatic->getNomUrl(1,
'withproject',
'time');
1277 print
'<div class="opacitymedium tdoverflowmax500" title="'.dol_escape_htmltag($taskstatic->label).
'">'.
dol_escape_htmltag($taskstatic->label).
'</div>';
1278 for ($k = 0; $k < $level; $k++) {
1284 print
'<td class="center">';
1288 $disabledproject = 1;
1294 if ($lines[$i]->
public || !empty($projectsrole[$lines[$i]->fk_project]) || $user->hasRight(
'projet',
'all',
'creer')) {
1295 $disabledproject = 0;
1299 if ($restricteditformytask && empty($tasksrole[$lines[$i]->
id])) {
1304 print
'<td class="nowrap center">';
1309 if (!$isavailable[$preselectedday][
'morning'] && !$isavailable[$preselectedday][
'afternoon']) {
1310 $cssonholiday .=
'onholidayallday ';
1311 } elseif (!$isavailable[$preselectedday][
'morning']) {
1312 $cssonholiday .=
'onholidaymorning ';
1313 } elseif (!$isavailable[$preselectedday][
'afternoon']) {
1314 $cssonholiday .=
'onholidayafternoon ';
1318 print
'<td class="duration'.($cssonholiday ?
' '.$cssonholiday :
'').
' center">';
1320 $dayWorkLoad = $lines[$i]->timespent_duration;
1321 $totalforeachline[$preselectedday] += $lines[$i]->timespent_duration;
1324 if ($dayWorkLoad > 0) {
1333 print
'<td class="center">';
1334 print
'<textarea name="'.$lines[$i]->id.
'note" rows="'.ROWS_2.
'" id="'.$lines[$i]->id.
'note"'.($disabledtask ?
' disabled="disabled"' :
'').
'>';
1335 print $lines[$i]->timespent_note;
1336 print
'</textarea>';
1340 print
'<td class="right">';
1360 return $totalforeachline;
1383function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask, $preselectedday, &$isavailable, $oldprojectforbreak = 0, $arrayfields = array(), $extrafields =
null)
1385 global $conf, $db, $user, $langs;
1386 global $form, $formother, $projectstatic, $taskstatic, $thirdpartystatic;
1389 $totalforeachday = array();
1390 $workloadforid = array();
1391 $lineswithoutlevel0 = array();
1393 $numlines = count($lines);
1397 for ($i = 0; $i < $numlines; $i++) {
1398 if ($lines[$i]->fk_task_parent) {
1399 $lineswithoutlevel0[] = $lines[$i];
1404 if (empty($oldprojectforbreak)) {
1405 $oldprojectforbreak = (!
getDolGlobalString(
'PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT') ? 0 : -1);
1408 $restrictBefore =
null;
1411 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
1416 for ($i = 0; $i < $numlines; $i++) {
1421 if ($lines[$i]->fk_task_parent == $parent) {
1425 if (empty($mine) || !empty($tasksrole[$lines[$i]->
id])) {
1428 if ($restricteditformytask == 2 && empty($tasksrole[$lines[$i]->
id])) {
1433 if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid) {
1434 $lastprojectid = $lines[$i]->fk_project;
1435 if ($preselectedday) {
1436 $projectstatic->id = $lines[$i]->fk_project;
1440 if (empty($workloadforid[$projectstatic->id])) {
1441 if ($preselectedday) {
1442 $projectstatic->loadTimeSpent($preselectedday, 0, $fuser->id);
1443 $workloadforid[$projectstatic->id] = 1;
1447 $projectstatic->id = $lines[$i]->fk_project;
1448 $projectstatic->ref = $lines[$i]->projectref;
1449 $projectstatic->title = $lines[$i]->projectlabel;
1450 $projectstatic->public = $lines[$i]->public;
1451 $projectstatic->status = $lines[$i]->projectstatus;
1453 $taskstatic->id = $lines[$i]->id;
1454 $taskstatic->ref = ($lines[$i]->ref ? $lines[$i]->ref : $lines[$i]->id);
1455 $taskstatic->label = $lines[$i]->label;
1456 $taskstatic->date_start = $lines[$i]->date_start;
1457 $taskstatic->date_end = $lines[$i]->date_end;
1459 $thirdpartystatic->id = $lines[$i]->socid;
1460 $thirdpartystatic->name = $lines[$i]->thirdparty_name;
1461 $thirdpartystatic->email = $lines[$i]->thirdparty_email;
1463 if (empty($oldprojectforbreak) || ($oldprojectforbreak != -1 && $oldprojectforbreak != $projectstatic->id)) {
1465 if (!empty($arrayfields[
't.planned_workload'][
'checked'])) {
1468 if (!empty($arrayfields[
't.progress'][
'checked'])) {
1471 foreach ($arrayfields as $key => $val) {
1472 if ($val[
'checked'] && substr($key, 0, 5) ==
'efpt.') {
1477 print
'<tr class="oddeven trforbreak nobold">'.
"\n";
1478 print
'<td colspan="'.(7 + $addcolspan).
'">';
1479 print $projectstatic->getNomUrl(1,
'', 0,
'<strong>'.$langs->transnoentitiesnoconv(
"YourRole").
':</strong> '.$projectsrole[$lines[$i]->fk_project]);
1480 if ($thirdpartystatic->id > 0) {
1481 print
' - '.$thirdpartystatic->getNomUrl(1);
1483 if ($projectstatic->title) {
1485 print
'<span class="secondary">'.$projectstatic->title.
'</span>';
1552 if ($oldprojectforbreak != -1) {
1553 $oldprojectforbreak = $projectstatic->id;
1556 print
'<tr class="oddeven" data-taskid="'.$lines[$i]->id.
'">'.
"\n";
1568 if ($oldprojectforbreak == -1) {
1569 print $projectstatic->getNomUrl(1,
'', 0, $langs->transnoentitiesnoconv(
"YourRole").
': '.$projectsrole[$lines[$i]->fk_project]);
1576 print
'<td class="tdoverflowmax100">';
1577 if ($thirdpartystatic->id > 0) {
1578 print $thirdpartystatic->getNomUrl(1,
'project', 10);
1585 print
'<!-- Task id = '.$lines[$i]->id.
' (projectlinesperday) -->';
1586 for ($k = 0; $k < $level; $k++) {
1587 print
'<div class="marginleftonly">';
1589 print $taskstatic->getNomUrl(1,
'withproject',
'time');
1592 print
'<div class="opacitymedium tdoverflowmax500" title="'.dol_escape_htmltag($taskstatic->label).
'">'.
dol_escape_htmltag($taskstatic->label).
'</div>';
1593 for ($k = 0; $k < $level; $k++) {
1599 $extrafieldsobjectkey =
'projet_task';
1600 $extrafieldsobjectprefix =
'efpt.';
1601 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
1604 if (!empty($arrayfields[
't.planned_workload'][
'checked'])) {
1605 print
'<td class="leftborder plannedworkload right">';
1606 if ($lines[$i]->planned_workload) {
1615 if (!empty($arrayfields[
't.progress'][
'checked'])) {
1616 print
'<td class="right">';
1617 print $formother->select_percent($lines[$i]->progress, $lines[$i]->
id.
'progress');
1621 if (!empty($arrayfields[
'timeconsumed'][
'checked'])) {
1623 print
'<td class="right">';
1625 if ($lines[$i]->duration_effective) {
1626 print
'<a href="'.DOL_URL_ROOT.
'/projet/tasks/time.php?id='.$lines[$i]->id.
'">';
1635 print
'<td class="right">';
1636 $tmptimespent = $taskstatic->getSummaryOfTimeSpent($fuser->id);
1637 if ($tmptimespent[
'total_duration']) {
1645 $disabledproject = 1;
1651 if ($lines[$i]->
public || !empty($projectsrole[$lines[$i]->fk_project]) || $user->hasRight(
'projet',
'all',
'creer')) {
1652 $disabledproject = 0;
1656 if ($restricteditformytask && empty($tasksrole[$lines[$i]->
id])) {
1660 if ($restrictBefore && $preselectedday < $restrictBefore) {
1665 print
'<td class="nowraponall leftborder center minwidth150imp">';
1666 $tableCell = $form->selectDate($preselectedday, $lines[$i]->
id, 1, 1, 2,
"addtime", 0, 0, $disabledtask);
1671 if (!$isavailable[$preselectedday][
'morning'] && !$isavailable[$preselectedday][
'afternoon']) {
1672 $cssonholiday .=
'onholidayallday ';
1673 } elseif (!$isavailable[$preselectedday][
'morning']) {
1674 $cssonholiday .=
'onholidaymorning ';
1675 } elseif (!$isavailable[$preselectedday][
'afternoon']) {
1676 $cssonholiday .=
'onholidayafternoon ';
1683 global $numstartworkingday, $numendworkingday;
1685 if ((($idw + 1) < $numstartworkingday) || (($idw + 1) > $numendworkingday)) {
1686 $cssweekend =
'weekend';
1690 print
'<td class="center duration'.($cssonholiday ?
' '.$cssonholiday :
'').($cssweekend ?
' '.$cssweekend :
'').
'">';
1691 $dayWorkLoad = empty($projectstatic->weekWorkLoadPerTask[$preselectedday][$lines[$i]->id]) ? 0 : $projectstatic->weekWorkLoadPerTask[$preselectedday][$lines[$i]->id];
1692 if (!isset($totalforeachday[$preselectedday])) {
1693 $totalforeachday[$preselectedday] = 0;
1695 $totalforeachday[$preselectedday] += $dayWorkLoad;
1698 if ($dayWorkLoad > 0) {
1705 $tableCell .=
'<span class="timesheetalreadyrecorded" title="texttoreplace"><input type="text" class="center width40" disabled id="timespent['.$inc.
']['.$idw.
']" name="task['.$lines[$i]->id.
']['.$idw.
']" value="'.$alreadyspent.
'"></span>';
1706 $tableCell .=
'<span class="hideonsmartphone"> + </span>';
1708 $tableCell .= $form->select_duration($lines[$i]->
id.
'duration',
'', $disabledtask,
'text', 0, 1);
1715 print
'<td class="center">';
1716 print
'<textarea name="'.$lines[$i]->id.
'note" rows="'.ROWS_2.
'" id="'.$lines[$i]->id.
'note"'.($disabledtask ?
' disabled="disabled"' :
'').
'>';
1717 print
'</textarea>';
1721 print
'<td class="right">';
1722 if ((!$lines[$i]->
public) && $disabledproject) {
1723 print $form->textwithpicto(
'', $langs->trans(
"UserIsNotContactOfProject"));
1724 } elseif ($disabledtask) {
1725 $titleassigntask = $langs->trans(
"AssignTaskToMe");
1726 if ($fuser->id != $user->id) {
1727 $titleassigntask = $langs->trans(
"AssignTaskToUser",
'...');
1730 print $form->textwithpicto(
'', $langs->trans(
"TaskIsNotAssignedToUser", $titleassigntask));
1739 if ($lines[$i]->
id > 0) {
1742 $ret =
projectLinesPerDay($inc, $lines[$i]->
id, $fuser, ($parent == 0 ? $lineswithoutlevel0 : $lines), $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $preselectedday, $isavailable, $oldprojectforbreak, $arrayfields, $extrafields);
1745 foreach ($ret as $key => $val) {
1746 $totalforeachday[$key] += $val;
1757 return $totalforeachday;
1780function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask, &$isavailable, $oldprojectforbreak = 0, $arrayfields = array(), $extrafields =
null)
1782 global $conf, $db, $user, $langs;
1783 global $form, $formother, $projectstatic, $taskstatic, $thirdpartystatic;
1785 $numlines = count($lines);
1788 $workloadforid = array();
1789 $totalforeachday = array();
1790 $lineswithoutlevel0 = array();
1794 for ($i = 0; $i < $numlines; $i++) {
1795 if ($lines[$i]->fk_task_parent) {
1796 $lineswithoutlevel0[] = $lines[$i];
1803 if (empty($oldprojectforbreak)) {
1804 $oldprojectforbreak = (!
getDolGlobalString(
'PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT') ? 0 : -1);
1807 $restrictBefore =
null;
1810 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
1814 for ($i = 0; $i < $numlines; $i++) {
1819 if ($lines[$i]->fk_task_parent == $parent) {
1823 if (empty($mine) || !empty($tasksrole[$lines[$i]->
id])) {
1826 if ($restricteditformytask == 2 && empty($tasksrole[$lines[$i]->
id])) {
1831 if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid) {
1832 $lastprojectid = $lines[$i]->fk_project;
1833 $projectstatic->id = $lines[$i]->fk_project;
1838 if (empty($workloadforid[$projectstatic->id])) {
1839 $projectstatic->loadTimeSpent($firstdaytoshow, 0, $fuser->id);
1840 $workloadforid[$projectstatic->id] = 1;
1845 $projectstatic->id = $lines[$i]->fk_project;
1846 $projectstatic->ref = $lines[$i]->projectref;
1847 $projectstatic->title = $lines[$i]->projectlabel;
1848 $projectstatic->public = $lines[$i]->public;
1849 $projectstatic->thirdparty_name = $lines[$i]->thirdparty_name;
1850 $projectstatic->status = $lines[$i]->projectstatus;
1852 $taskstatic->id = $lines[$i]->id;
1853 $taskstatic->ref = ($lines[$i]->ref ? $lines[$i]->ref : $lines[$i]->id);
1854 $taskstatic->label = $lines[$i]->label;
1855 $taskstatic->date_start = $lines[$i]->date_start;
1856 $taskstatic->date_end = $lines[$i]->date_end;
1858 $thirdpartystatic->id = $lines[$i]->thirdparty_id;
1859 $thirdpartystatic->name = $lines[$i]->thirdparty_name;
1860 $thirdpartystatic->email = $lines[$i]->thirdparty_email;
1862 if (empty($oldprojectforbreak) || ($oldprojectforbreak != -1 && $oldprojectforbreak != $projectstatic->id)) {
1864 if (!empty($arrayfields[
't.planned_workload'][
'checked'])) {
1867 if (!empty($arrayfields[
't.progress'][
'checked'])) {
1870 foreach ($arrayfields as $key => $val) {
1871 if ($val[
'checked'] && substr($key, 0, 5) ==
'efpt.') {
1876 print
'<tr class="oddeven trforbreak nobold">'.
"\n";
1877 print
'<td colspan="'.(11 + $addcolspan).
'">';
1878 print $projectstatic->getNomUrl(1,
'', 0,
'<strong>'.$langs->transnoentitiesnoconv(
"YourRole").
':</strong> '.$projectsrole[$lines[$i]->fk_project]);
1879 if ($thirdpartystatic->id > 0) {
1880 print
' - '.$thirdpartystatic->getNomUrl(1);
1882 if ($projectstatic->title) {
1884 print
'<span class="secondary">'.$projectstatic->title.
'</span>';
1951 if ($oldprojectforbreak != -1) {
1952 $oldprojectforbreak = $projectstatic->id;
1955 print
'<tr class="oddeven" data-taskid="'.$lines[$i]->id.
'">'.
"\n";
1966 print
'<td class="nowrap">';
1967 if ($oldprojectforbreak == -1) {
1968 print $projectstatic->getNomUrl(1,
'', 0, $langs->transnoentitiesnoconv(
"YourRole").
': '.$projectsrole[$lines[$i]->fk_project]);
1975 print
'<td class="tdoverflowmax100">';
1976 if ($thirdpartystatic->id > 0) {
1977 print $thirdpartystatic->getNomUrl(1,
'project');
1983 print
'<td class="tdoverflowmax300">';
1984 print
'<!-- Task id = '.$lines[$i]->id.
' (projectlinesperweek) -->';
1985 for ($k = 0; $k < $level; $k++) {
1986 print
'<div class="marginleftonly">';
1988 print $taskstatic->getNomUrl(1,
'withproject',
'time');
1991 print
'<div class="opacitymedium tdoverflowmax500" title="'.dol_escape_htmltag($taskstatic->label).
'">'.
dol_escape_htmltag($taskstatic->label).
'</div>';
1992 for ($k = 0; $k < $level; $k++) {
1998 $extrafieldsobjectkey =
'projet_task';
1999 $extrafieldsobjectprefix =
'efpt.';
2000 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
2003 if (!empty($arrayfields[
't.planned_workload'][
'checked'])) {
2004 print
'<td class="leftborder plannedworkload right">';
2005 if ($lines[$i]->planned_workload) {
2013 if (!empty($arrayfields[
't.progress'][
'checked'])) {
2015 print
'<td class="right">';
2016 print $formother->select_percent($lines[$i]->progress, $lines[$i]->
id.
'progress');
2020 if (!empty($arrayfields[
'timeconsumed'][
'checked'])) {
2022 print
'<td class="right">';
2024 if ($lines[$i]->duration_effective) {
2025 print
'<a href="'.DOL_URL_ROOT.
'/projet/tasks/time.php?id='.((int) $lines[$i]->
id).
'">';
2034 print
'<td class="right">';
2035 $tmptimespent = $taskstatic->getSummaryOfTimeSpent($fuser->id);
2036 if ($tmptimespent[
'total_duration']) {
2037 print
'<a href="'.DOL_URL_ROOT.
'/projet/tasks/time.php?id='.((int) $lines[$i]->
id).
'&search_user='.((int) $fuser->id).
'">';
2046 $disabledproject = 1;
2052 if ($lines[$i]->
public || !empty($projectsrole[$lines[$i]->fk_project]) || $user->hasRight(
'projet',
'all',
'creer')) {
2053 $disabledproject = 0;
2057 if ($restricteditformytask && empty($tasksrole[$lines[$i]->
id])) {
2065 $modeinput =
'hours';
2066 for ($idw = 0; $idw < 7; $idw++) {
2068 if (!isset($totalforeachday[$tmpday])) {
2069 $totalforeachday[$tmpday] = 0;
2072 if (!$isavailable[$tmpday][
'morning'] && !$isavailable[$tmpday][
'afternoon']) {
2073 $cssonholiday .=
'onholidayallday ';
2074 } elseif (!$isavailable[$tmpday][
'morning']) {
2075 $cssonholiday .=
'onholidaymorning ';
2076 } elseif (!$isavailable[$tmpday][
'afternoon']) {
2077 $cssonholiday .=
'onholidayafternoon ';
2081 $dayWorkLoad = (!empty($projectstatic->weekWorkLoadPerTask[$tmpday][$lines[$i]->id]) ? $projectstatic->weekWorkLoadPerTask[$tmpday][$lines[$i]->id] : 0);
2082 $totalforeachday[$tmpday] += $dayWorkLoad;
2085 if ($dayWorkLoad > 0) {
2088 $alttitle = $langs->trans(
"AddHereTimeSpentForDay", !empty($tmparray[
'day']) ? $tmparray[
'day'] : 0, $tmparray[
'mon']);
2090 global $numstartworkingday, $numendworkingday;
2092 if (($idw + 1 < $numstartworkingday) || ($idw + 1 > $numendworkingday)) {
2093 $cssweekend =
'weekend';
2096 $disabledtaskday = $disabledtask;
2098 if (! $disabledtask && $restrictBefore && $tmpday < $restrictBefore) {
2099 $disabledtaskday = 1;
2102 $tableCell =
'<td class="center hide'.$idw.($cssonholiday ?
' '.$cssonholiday :
'').($cssweekend ?
' '.$cssweekend :
'').
'">';
2105 if ($alreadyspent) {
2106 $tableCell .=
'<span class="timesheetalreadyrecorded" title="texttoreplace"><input type="text" class="center smallpadd width40" disabled id="timespent['.$inc.
']['.$idw.
']" name="task['.$lines[$i]->id.
']['.$idw.
']" value="'.$alreadyspent.
'"></span>';
2110 $tableCell .=
'<input type="text" alt="'.($disabledtaskday ?
'' : $alttitle).
'" title="'.($disabledtaskday ?
'' : $alttitle).
'" '.($disabledtaskday ?
'disabled' : $placeholder).
' class="center smallpadd width40" id="timeadded['.$inc.
']['.$idw.
']" name="task['.$lines[$i]->id.
']['.$idw.
']" value="" cols="2" maxlength="5"';
2111 $tableCell .=
' onkeypress="return regexEvent(this,event,\'timeChar\')"';
2112 $tableCell .=
' onkeyup="updateTotal('.$idw.
',\''.$modeinput.
'\')
"';
2113 $tableCell .= ' onblur="regexEvent(
this,event,\
''.$modeinput.
'\'); updateTotal(
'.$idw.',\
''.$modeinput.
'\')
" />';
2114 $tableCell .= '</td>';
2119 print '<td class="right
">';
2120 if ((!$lines[$i]->public) && $disabledproject) {
2121 print $form->textwithpicto('', $langs->trans("UserIsNotContactOfProject
"));
2122 } elseif ($disabledtask) {
2123 $titleassigntask = $langs->trans("AssignTaskToMe
");
2124 if ($fuser->id != $user->id) {
2125 $titleassigntask = $langs->trans("AssignTaskToUser
", '...');
2128 print $form->textwithpicto('', $langs->trans("TaskIsNotAssignedToUser
", $titleassigntask));
2135 // Call to show task with a lower level (task under the current task)
2138 if ($lines[$i]->id > 0) {
2139 //var_dump('totalforeachday after taskid='.$lines[$i]->id.' and previous one on level '.$level);
2140 //var_dump($totalforeachday);
2141 $ret = projectLinesPerWeek($inc, $firstdaytoshow, $fuser, $lines[$i]->id, ($parent == 0 ? $lineswithoutlevel0 : $lines), $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $isavailable, $oldprojectforbreak, $arrayfields, $extrafields);
2142 //var_dump('ret with parent='.$lines[$i]->id.' level='.$level);
2144 foreach ($ret as $key => $val) {
2145 $totalforeachday[$key] += $val;
2147 //var_dump('totalforeachday after taskid='.$lines[$i]->id.' and previous one on level '.$level.' + subtasks');
2148 //var_dump($totalforeachday);
2156 return $totalforeachday;
2498function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks = 0, $status = -1, $listofoppstatus = array(), $hiddenfields = array(), $max = 0)
2500 global $langs, $conf, $user;
2501 global $theme_datacolor;
2503 $maxofloop = (!getDolGlobalString('MAIN_MAXLIST_OVERLOAD') ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD);
2505 require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
2507 $listofstatus = array_keys($listofoppstatus);
2509 if (is_array($listofstatus) && getDolGlobalString('USE_COLOR_FOR_PROSPECTION_STATUS')) {
2510 // Define $themeColorId and array $statusOppList for each $listofstatus
2512 $statusOppList = array();
2513 foreach ($listofstatus as $oppStatus) {
2514 $oppStatusCode = dol_getIdFromCode($db, $oppStatus, 'c_lead_status', 'rowid', 'code');
2515 if ($oppStatusCode) {
2516 $statusOppList[$oppStatus]['code'] = $oppStatusCode;
2517 $statusOppList[$oppStatus]['color'] = isset($theme_datacolor[$themeColorId]) ? implode(', ', $theme_datacolor[$themeColorId]) : '';
2523 $projectstatic = new Project($db);
2524 $thirdpartystatic = new Societe($db);
2528 $project_year_filter = 0;
2530 $title = $langs->trans("
Projects");
2531 if (strcmp($status, '') && $status >= 0) {
2532 $title = $langs->trans("Projects").' '.$langs->trans($projectstatic->labelStatus[$status]);
2535 print '<!-- print_projecttasks_array -->';
2536 print '<div class="div-table-responsive-no-min
">';
2537 print '<table class="noborder centpercent
">';
2539 $sql = " FROM
".MAIN_DB_PREFIX."projet as p
";
2541 $sql .= ",
".MAIN_DB_PREFIX."projet_task as t
";
2542 $sql .= ",
".MAIN_DB_PREFIX."element_contact as ec
";
2543 $sql .= ",
".MAIN_DB_PREFIX."c_type_contact as ctc
";
2545 $sql .= " LEFT JOIN
".MAIN_DB_PREFIX."projet_task as t ON p.rowid = t.fk_projet
";
2547 $sql .= " WHERE p.entity IN (
".getEntity('project').")
";
2548 $sql .= " AND p.rowid IN (
".$db->sanitize($projectsListId).")
";
2550 $sql .= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc =
".((int) $socid).")
";
2553 $sql .= " AND p.rowid = t.fk_projet
";
2554 $sql .= " AND ec.element_id = t.rowid
";
2555 $sql .= " AND ec.fk_socpeople =
".((int) $user->id);
2556 $sql .= " AND ec.fk_c_type_contact = ctc.rowid
"; // Replace the 2 lines with ec.fk_c_type_contact in $arrayidtypeofcontact
2557 $sql .= " AND ctc.element =
'project_task'";
2560 $sql .= " AND p.fk_statut =
".(int) $status;
2562 if (getDolGlobalString('PROJECT_LIMIT_YEAR_RANGE')) {
2563 $project_year_filter = GETPOST("project_year_filter
");
2564 //Check if empty or invalid year. Wildcard ignores the sql check
2565 if ($project_year_filter != "*
") {
2566 if (empty($project_year_filter) || !ctype_digit($project_year_filter)) {
2567 $project_year_filter = date("Y
");
2569 $sql .= " AND (p.dateo IS NULL OR p.dateo <=
".$db->idate(dol_get_last_day($project_year_filter, 12, false)).")
";
2570 $sql .= " AND (p.datee IS NULL OR p.datee >=
".$db->idate(dol_get_first_day($project_year_filter, 1, false)).")
";
2574 // Get id of project we must show tasks
2575 $arrayidofprojects = array();
2576 $sql1 = "SELECT p.rowid as projectid
";
2578 $resql = $db->query($sql1);
2581 $num = $db->num_rows($resql);
2583 $objp = $db->fetch_object($resql);
2584 $arrayidofprojects[$objp->projectid] = $objp->projectid;
2588 dol_print_error($db);
2590 if (empty($arrayidofprojects)) {
2591 $arrayidofprojects[0] = -1;
2594 // Get list of project with calculation on tasks
2595 $sql2 = "SELECT p.rowid as projectid, p.ref, p.title, p.fk_soc,
";
2596 $sql2 .= " s.rowid as socid, s.nom as socname, s.name_alias,
";
2597 $sql2 .= " s.code_client, s.code_compta, s.client,
";
2598 $sql2 .= " s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur,
";
2599 $sql2 .= " s.logo, s.email, s.entity,
";
2600 $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,
";
2601 $sql2 .= " p.dateo, p.datee,
";
2602 $sql2 .= " COUNT(t.rowid) as nb, SUM(t.planned_workload) as planned_workload, SUM(t.planned_workload * t.progress / 100) as declared_progess_workload";
2603 $sql2 .= " FROM ".MAIN_DB_PREFIX."projet as p";
2604 $sql2 .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.
rowid = p.fk_soc";
2605 $sql2 .= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task as t ON p.
rowid = t.fk_projet";
2606 $sql2 .= " WHERE p.
rowid IN (".$db->sanitize(join(',', $arrayidofprojects)).")";
2607 $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,";
2608 $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";
2609 $sql2 .= " ORDER BY p.title, p.
ref";
2611 $resql = $db->query($sql2);
2615 $total_opp_amount = 0;
2616 $ponderated_opp_amount = 0;
2617 $total_plannedworkload = 0;
2618 $total_declaredprogressworkload = 0;
2620 $num = $db->num_rows($resql);
2621 $nbofloop = min($num, (!
getDolGlobalString(
'MAIN_MAXLIST_OVERLOAD') ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD));
2624 print
'<tr class="liste_titre">';
2625 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);
2628 if (!in_array(
'prospectionstatus', $hiddenfields)) {
2629 print_liste_field_titre(
"OpportunityStatus",
"",
"",
"",
"",
'style="max-width: 100px"', $sortfield, $sortorder,
'center ');
2631 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 ');
2636 if (!in_array(
'plannedworkload', $hiddenfields)) {
2637 print_liste_field_titre(
"PlannedWorkload",
"",
"",
"",
"",
'style="max-width: 100px"', $sortfield, $sortorder,
'right ');
2639 if (!in_array(
'declaredprogress', $hiddenfields)) {
2640 print_liste_field_titre(
"%",
"",
"",
"",
"",
'', $sortfield, $sortorder,
'right ', $langs->trans(
"ProgressDeclared"));
2643 if (!in_array(
'projectstatus', $hiddenfields)) {
2648 while ($i < $nbofloop) {
2649 $objp = $db->fetch_object($resql);
2651 if ($max && $i >= $max) {
2654 $total_task += $objp->nb;
2655 $total_opp_amount += $objp->opp_amount;
2656 $opp_weighted_amount = $objp->opp_percent * $objp->opp_amount / 100;
2657 $ponderated_opp_amount +=
price2num($opp_weighted_amount);
2658 $plannedworkload = $objp->planned_workload;
2659 $total_plannedworkload += $plannedworkload;
2660 $declaredprogressworkload = $objp->declared_progess_workload;
2661 $total_declaredprogressworkload += $declaredprogressworkload;
2665 $projectstatic->id = $objp->projectid;
2666 $projectstatic->user_author_id = $objp->fk_user_creat;
2667 $projectstatic->public = $objp->public;
2670 $userAccess = $projectstatic->restrictedProjectArea($user);
2671 if ($userAccess >= 0) {
2672 $projectstatic->ref = $objp->ref;
2673 $projectstatic->status = $objp->status;
2674 $projectstatic->title = $objp->title;
2675 $projectstatic->date_end = $db->jdate($objp->datee);
2676 $projectstatic->date_start = $db->jdate($objp->dateo);
2678 print
'<tr class="oddeven">';
2680 print
'<td class="tdoverflowmax150">';
2681 print $projectstatic->getNomUrl(1,
'', 0,
'',
'-', 0, -1,
'nowraponall');
2682 if (!in_array(
'projectlabel', $hiddenfields)) {
2683 print
'<br><span class="opacitymedium small">'.dol_escape_htmltag($objp->title).
'</span>';
2687 print
'<td class="nowraponall tdoverflowmax100">';
2688 if ($objp->fk_soc > 0) {
2689 $thirdpartystatic->id = $objp->socid;
2690 $thirdpartystatic->name = $objp->socname;
2693 $thirdpartystatic->code_compta = $objp->code_compta;
2694 $thirdpartystatic->client = $objp->client;
2696 $thirdpartystatic->code_compta_fournisseur = $objp->code_compta_fournisseur;
2697 $thirdpartystatic->fournisseur = $objp->fournisseur;
2698 $thirdpartystatic->logo = $objp->logo;
2699 $thirdpartystatic->email = $objp->email;
2700 $thirdpartystatic->entity = $objp->entity;
2701 print $thirdpartystatic->getNomUrl(1);
2706 if (!in_array(
'prospectionstatus', $hiddenfields)) {
2707 print
'<td class="center tdoverflowmax75">';
2710 $oppStatusCode =
dol_getIdFromCode($db, $objp->opp_status,
'c_lead_status',
'rowid',
'code');
2711 if ($langs->trans(
"OppStatus".$oppStatusCode) !=
"OppStatus".$oppStatusCode) {
2712 print $langs->trans(
"OppStatus".$oppStatusCode);
2715 if (isset($statusOppList[$objp->opp_status])) {
2716 $oppStatusCode = $statusOppList[$objp->opp_status][
'code'];
2717 $oppStatusColor = $statusOppList[$objp->opp_status][
'color'];
2719 $oppStatusCode =
dol_getIdFromCode($db, $objp->opp_status,
'c_lead_status',
'rowid',
'code');
2720 $oppStatusColor =
'';
2722 if ($oppStatusCode) {
2723 if (!empty($oppStatusColor)) {
2724 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>';
2726 print
'<a href="'.dol_buildpath(
'/projet/list.php?search_opp_status='.$objp->opp_status, 1).
'" title="'.$langs->trans(
"OppStatus".$oppStatusCode).
'">'.$oppStatusCode.
'</a>';
2733 print
'<td class="right">';
2734 if ($objp->opp_percent && $objp->opp_amount) {
2735 $opp_weighted_amount = $objp->opp_percent * $objp->opp_amount / 100;
2736 $alttext = $langs->trans(
"OpportunityWeightedAmount").
' '.
price($opp_weighted_amount, 0,
'', 1, -1, 0, $conf->currency);
2737 $ponderated_opp_amount +=
price2num($opp_weighted_amount);
2739 if ($objp->opp_amount) {
2740 print
'<span class="amount" title="'.$alttext.
'">'.$form->textwithpicto(
price($objp->opp_amount, 0,
'', 1, -1, 0), $alttext).
'</span>';
2746 print
'<td class="right">'.$objp->nb.
'</td>';
2748 $plannedworkload = $objp->planned_workload;
2749 $total_plannedworkload += $plannedworkload;
2750 if (!in_array(
'plannedworkload', $hiddenfields)) {
2751 print
'<td class="right nowraponall">'.($plannedworkload ?
convertSecondToTime($plannedworkload) :
'').
'</td>';
2753 if (!in_array(
'declaredprogress', $hiddenfields)) {
2754 $declaredprogressworkload = $objp->declared_progess_workload;
2755 $total_declaredprogressworkload += $declaredprogressworkload;
2756 print
'<td class="right nowraponall">';
2758 print($plannedworkload ? round(100 * $declaredprogressworkload / $plannedworkload, 0).
'%' :
'');
2763 if (!in_array(
'projectstatus', $hiddenfields)) {
2764 print
'<td class="right">';
2765 print $projectstatic->getLibStatut(3);
2771 $total_task += $objp->nb;
2772 $total_opp_amount += $objp->opp_amount;
2779 print
'<tr class="oddeven">';
2780 print
'<td class="nowrap" colspan="5">';
2781 print
'<span class="opacitymedium">'.$langs->trans(
"More").
'...'.($othernb < $maxofloop ?
' ('.$othernb.
')' :
'').
'</span>';
2786 print
'<tr class="liste_total">';
2787 print
'<td>'.$langs->trans(
"Total").
"</td><td></td>";
2789 if (!in_array(
'prospectionstatus', $hiddenfields)) {
2790 print
'<td class="liste_total"></td>';
2792 print
'<td class="liste_total right">';
2794 print $form->textwithpicto(
price($total_opp_amount, 0,
'', 1, -1, 0), $langs->trans(
"OpportunityPonderatedAmountDesc").
' : '.
price($ponderated_opp_amount, 0,
'', 1, -1, 0, $conf->currency));
2798 print
'<td class="liste_total right">'.$total_task.
'</td>';
2799 if (!in_array(
'plannedworkload', $hiddenfields)) {
2800 print
'<td class="liste_total right">'.($total_plannedworkload ?
convertSecondToTime($total_plannedworkload) :
'').
'</td>';
2802 if (!in_array(
'declaredprogress', $hiddenfields)) {
2803 print
'<td class="liste_total right">'.($total_plannedworkload ? round(100 * $total_declaredprogressworkload / $total_plannedworkload, 0).
'%' :
'').
'</td>';
2806 if (!in_array(
'projectstatus', $hiddenfields)) {
2807 print
'<td class="liste_total"></td>';
2821 print
'<form method="get" action="'.$_SERVER[
"PHP_SELF"].
'">';
2822 print
'<table width="100%">';
2824 print
'<td>'.$langs->trans(
"Year").
'</td>';
2825 print
'<td class="right"><input type="text" size="4" class="flat" name="project_year_filter" value="'.((int) $project_year_filter).
'"/>';
2827 print
'</table></form>';
2840function getTaskProgressView($task, $label =
true, $progressNumber =
true, $hideOnProgressNull =
false, $spaced =
false)
2842 global $langs, $conf;
2846 $plannedworkloadoutputformat =
'allhourmin';
2847 $timespentoutputformat =
'allhourmin';
2849 $plannedworkloadoutputformat = $conf->global->PROJECT_PLANNED_WORKLOAD_FORMAT;
2852 $timespentoutputformat = $conf->global->PROJECT_TIME_SPENT_FORMAT;
2855 if (empty($task->progress) && !empty($hideOnProgressNull)) {
2859 $spaced = !empty($spaced) ?
'spaced' :
'';
2864 $progressBarClass =
'progress-bar-info';
2865 $progressCalculated = 0;
2866 if ($task->planned_workload) {
2867 $progressCalculated = round(100 * (
float) $task->duration_effective / (
float) $task->planned_workload, 2);
2870 $warningRatio =
getDolGlobalString(
'PROJECT_TIME_SPEND_WARNING_PERCENT') ? (1 + $conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT / 100) : 1.10;
2872 $diffTitle =
'<br>'.$langs->trans(
'ProgressDeclared').
' : '.$task->progress.(isset($task->progress) ?
'%' :
'');
2873 $diffTitle .=
'<br>'.$langs->trans(
'ProgressCalculated').
' : '.$progressCalculated.(isset($progressCalculated) ?
'%' :
'');
2876 if ((
float) $progressCalculated > (float) ($task->progress * $warningRatio)) {
2877 $progressBarClass =
'progress-bar-danger';
2878 $title = $langs->trans(
'TheReportedProgressIsLessThanTheCalculatedProgressionByX', abs($task->progress - $progressCalculated).
' '.$langs->trans(
"point"));
2879 $diff =
'<span class="text-danger classfortooltip paddingrightonly" title="'.dol_htmlentities($title.$diffTitle).
'" ><i class="fa fa-caret-down"></i> '.($task->progress - $progressCalculated).
'%</span>';
2880 } elseif ((
float) $progressCalculated > (
float) $task->progress) {
2881 $progressBarClass =
'progress-bar-warning';
2882 $title = $langs->trans(
'TheReportedProgressIsLessThanTheCalculatedProgressionByX', abs($task->progress - $progressCalculated).
' '.$langs->trans(
"point"));
2883 $diff =
'<span class="text-warning classfortooltip paddingrightonly" title="'.dol_htmlentities($title.$diffTitle).
'" ><i class="fa fa-caret-left"></i> '.($task->progress - $progressCalculated).
'%</span>';
2885 $progressBarClass =
'progress-bar-success';
2886 $title = $langs->trans(
'TheReportedProgressIsMoreThanTheCalculatedProgressionByX', ($task->progress - $progressCalculated).
' '.$langs->trans(
"point"));
2887 $diff =
'<span class="text-success classfortooltip paddingrightonly" title="'.dol_htmlentities($title.$diffTitle).
'" ><i class="fa fa-caret-up"></i> '.($task->progress - $progressCalculated).
'%</span>';
2891 $out .=
'<div class="progress-group">';
2893 if ($label !==
false) {
2894 $out .=
' <span class="progress-text">';
2896 if ($label !==
true) {
2905 if ($progressNumber !==
false) {
2906 $out .=
' <span class="progress-number">';
2907 if ($progressNumber !==
true) {
2908 $out .= $progressNumber;
2910 if ($task->hasDelay()) {
2914 $url = DOL_URL_ROOT.
'/projet/tasks/time.php?id='.$task->id;
2916 $out .= !empty($diff) ? $diff.
' ' :
'';
2917 $out .=
'<a href="'.$url.
'" >';
2918 $out .=
'<b title="'.$langs->trans(
'TimeSpent').
'" >';
2919 if ($task->duration_effective) {
2929 $out .=
'<a href="'.$url.
'" >';
2930 $out .=
'<span title="'.$langs->trans(
'PlannedWorkload').
'" >';
2931 if ($task->planned_workload) {
2943 $out .=
' <div class="progress sm '.$spaced.
'">';
2944 $diffval = (float) $task->progress - (
float) $progressCalculated;
2945 if ($diffval >= 0) {
2947 $out .=
' <div class="progress-bar '.$progressBarClass.
'" style="width: '.(float) $task->progress.
'%" title="'.(
float) $task->progress.
'%">';
2948 if (!empty($task->progress)) {
2949 $out .=
' <div class="progress-bar progress-bar-consumed" style="width: '.(float) ($progressCalculated / ((
float) $task->progress == 0 ? 1 : $task->progress) * 100).
'%" title="'.(float) $progressCalculated.
'%"></div>';
2954 $out .=
' <div class="progress-bar progress-bar-consumed-late" style="width: '.(float) $progressCalculated.
'%" title="'.(
float) $progressCalculated.
'%">';
2955 $out .=
' <div class="progress-bar '.$progressBarClass.
'" style="width: '.($task->progress ? (float) ($task->progress / ((
float) $progressCalculated == 0 ? 1 : $progressCalculated) * 100).
'%' :
'1px').
'" title="'.(
float) $task->progress.
'%"></div>';