42 global $db, $langs, $conf, $user;
47 $head[$h][0] = DOL_URL_ROOT.
'/projet/card.php?id='.((int) $project->id).($moreparam ?
'&'.$moreparam :
'');
48 $head[$h][1] = $langs->trans(
"Project");
49 $head[$h][2] =
'project';
53 require_once DOL_DOCUMENT_ROOT.
'/core/lib/memory.lib.php';
54 $cachekey =
'count_contacts_project_'.$project->id;
57 if (!is_null($dataretrieved)) {
58 $nbContacts = $dataretrieved;
60 $nbContacts = count($project->liste_contact(-1,
'internal')) + count($project->liste_contact(-1,
'external'));
63 $head[$h][0] = DOL_URL_ROOT.
'/projet/contact.php?id='.((int) $project->id).($moreparam ?
'&'.$moreparam :
'');
64 $head[$h][1] = $langs->trans(
"ProjectContact");
65 if ($nbContacts > 0) {
66 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbContacts.
'</span>';
68 $head[$h][2] =
'contact';
75 require_once DOL_DOCUMENT_ROOT.
'/core/lib/memory.lib.php';
76 $cachekey =
'count_tasks_project_'.$project->id;
79 if (!is_null($dataretrieved)) {
80 $nbTasks = $dataretrieved;
82 require_once DOL_DOCUMENT_ROOT.
'/projet/class/task.class.php';
83 $taskstatic =
new Task($db);
84 $nbTasks = count($taskstatic->getTasksArray(0, 0, $project->id, 0, 0));
87 $head[$h][0] = DOL_URL_ROOT.
'/projet/tasks.php?id='.((int) $project->id).($moreparam ?
'&'.$moreparam :
'');
88 $head[$h][1] = $langs->trans(
"Tasks");
90 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.($nbTasks).
'</span>';
92 $head[$h][2] =
'tasks';
97 $cachekey =
'count_timespent_project_'.$project->id;
99 if (!is_null($dataretrieved)) {
100 $nbTimeSpent = $dataretrieved;
102 $sql =
"SELECT t.rowid";
105 $sql .=
" FROM ".MAIN_DB_PREFIX.
"element_time as t, ".MAIN_DB_PREFIX.
"projet_task as pt";
106 $sql .=
" WHERE t.fk_element = pt.rowid";
107 $sql .=
" AND t.elementtype = 'task'";
108 $sql .=
" AND pt.fk_projet =".((int) $project->id);
109 $resql = $db->query($sql);
111 $obj = $db->fetch_object($resql);
121 $head[$h][0] = DOL_URL_ROOT.
'/projet/tasks/time.php?withproject=1&projectid='.((int) $project->id).($moreparam ?
'&'.$moreparam :
'');
122 $head[$h][1] = $langs->trans(
"TimeSpent");
123 if ($nbTimeSpent > 0) {
124 $head[$h][1] .=
'<span class="badge marginleftonlyshort">...</span>';
126 $head[$h][2] =
'timespent';
130 if (isModEnabled(
"supplier_proposal") || isModEnabled(
"supplier_order") || isModEnabled(
"supplier_invoice")
131 || isModEnabled(
"propal") || isModEnabled(
'order')
132 || isModEnabled(
'invoice') || isModEnabled(
'contract')
133 || isModEnabled(
'intervention') || isModEnabled(
'agenda') || isModEnabled(
'deplacement') || isModEnabled(
'stock')) {
136 $cachekey =
'count_elements_project_'.$project->id;
138 if (!is_null($dataretrieved)) {
139 $nbElements = $dataretrieved;
141 if (isModEnabled(
'stock')) {
142 $nbElements += $project->getElementCount(
'stock',
'entrepot',
'fk_project');
144 if (isModEnabled(
"propal")) {
145 $nbElements += $project->getElementCount(
'propal',
'propal');
147 if (isModEnabled(
'order')) {
148 $nbElements += $project->getElementCount(
'order',
'commande');
150 if (isModEnabled(
'invoice')) {
151 $nbElements += $project->getElementCount(
'invoice',
'facture');
153 if (isModEnabled(
'invoice')) {
154 $nbElements += $project->getElementCount(
'invoice_predefined',
'facture_rec');
156 if (isModEnabled(
'supplier_proposal')) {
157 $nbElements += $project->getElementCount(
'proposal_supplier',
'supplier_proposal');
159 if (isModEnabled(
"supplier_order")) {
160 $nbElements += $project->getElementCount(
'order_supplier',
'commande_fournisseur');
162 if (isModEnabled(
"supplier_invoice")) {
163 $nbElements += $project->getElementCount(
'invoice_supplier',
'facture_fourn');
165 if (isModEnabled(
'contract')) {
166 $nbElements += $project->getElementCount(
'contract',
'contrat');
168 if (isModEnabled(
'intervention')) {
169 $nbElements += $project->getElementCount(
'intervention',
'fichinter');
171 if (isModEnabled(
"shipping")) {
172 $nbElements += $project->getElementCount(
'shipping',
'expedition');
174 if (isModEnabled(
'mrp')) {
175 $nbElements += $project->getElementCount(
'mrp',
'mrp_mo',
'fk_project');
177 if (isModEnabled(
'deplacement')) {
178 $nbElements += $project->getElementCount(
'trip',
'deplacement');
180 if (isModEnabled(
'expensereport')) {
181 $nbElements += $project->getElementCount(
'expensereport',
'expensereport');
183 if (isModEnabled(
'don')) {
184 $nbElements += $project->getElementCount(
'donation',
'don');
186 if (isModEnabled(
'loan')) {
187 $nbElements += $project->getElementCount(
'loan',
'loan');
189 if (isModEnabled(
'tax')) {
190 $nbElements += $project->getElementCount(
'chargesociales',
'chargesociales');
192 if (isModEnabled(
'project')) {
193 $nbElements += $project->getElementCount(
'project_task',
'projet_task');
195 if (isModEnabled(
'stock')) {
196 $nbElements += $project->getElementCount(
'stock_mouvement',
'stock');
198 if (isModEnabled(
'salaries')) {
199 $nbElements += $project->getElementCount(
'salaries',
'payment_salary');
201 if (isModEnabled(
"bank")) {
202 $nbElements += $project->getElementCount(
'variouspayment',
'payment_various');
206 $head[$h][0] = DOL_URL_ROOT.
'/projet/element.php?id='.$project->id;
207 $head[$h][1] = $langs->trans(
"ProjectOverview");
208 if ($nbElements > 0) {
209 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbElements.
'</span>';
211 $head[$h][2] =
'element';
215 if (isModEnabled(
'ticket') && $user->hasRight(
'ticket',
'read')) {
216 require_once DOL_DOCUMENT_ROOT.
'/ticket/class/ticket.class.php';
217 $Tickettatic =
new Ticket($db);
218 $nbTicket = $Tickettatic->getCountOfItemsLinkedByObjectID($project->id,
'fk_project',
'ticket');
219 $head[$h][0] = DOL_URL_ROOT.
'/ticket/list.php?projectid='.((int) $project->id);
220 $head[$h][1] = $langs->trans(
"Ticket");
222 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.($nbTicket).
'</span>';
224 $head[$h][2] =
'ticket';
228 if (isModEnabled(
'eventorganization') && !empty($project->usage_organize_event)) {
229 $langs->load(
'eventorganization');
230 $head[$h][0] = DOL_URL_ROOT .
'/eventorganization/conferenceorbooth_list.php?projectid=' . $project->id;
231 $head[$h][1] = $langs->trans(
"EventOrganization");
236 require_once DOL_DOCUMENT_ROOT.
'/core/lib/memory.lib.php';
237 $cachekey =
'count_conferenceorbooth_'.$project->id;
239 if (!is_null($dataretrieved)) {
240 $nbConfOrBooth = $dataretrieved;
242 require_once DOL_DOCUMENT_ROOT.
'/eventorganization/class/conferenceorbooth.class.php';
244 $result = $conforbooth->fetchAll(
'',
'', 0, 0,
'(t.fk_project:=:'.((
int) $project->id).
")");
246 if (!is_array($result) && $result < 0) {
249 $nbConfOrBooth = count($result);
253 $cachekey =
'count_attendees_'.$project->id;
255 if (!is_null($dataretrieved)) {
256 $nbAttendees = $dataretrieved;
258 require_once DOL_DOCUMENT_ROOT.
'/eventorganization/class/conferenceorboothattendee.class.php';
260 $result = $conforboothattendee->fetchAll(
'',
'', 0, 0,
'(t.fk_project:=:'.((
int) $project->id).
')');
262 if (!is_array($result) && $result < 0) {
263 setEventMessages($conforboothattendee->error, $conforboothattendee->errors,
'errors');
265 $nbAttendees = count($result);
269 if ($nbConfOrBooth > 0 || $nbAttendees > 0) {
270 $head[$h][1] .=
'<span class="badge marginleftonlyshort">';
271 $head[$h][1] .=
'<span title="'.dol_escape_htmltag($langs->trans(
"ConferenceOrBooth")).
'">'.$nbConfOrBooth.
'</span>';
272 $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';
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[empty($project->entity) ? 1 : $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';
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';
599function 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 (!$user->hasRight(
'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->status = $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';
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 * (
float) $lines[$i]->duration_effective / (
float) $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.';
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 += (float) $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((
string) $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 borderleft">';
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';
2067 for ($idw = 0; $idw < 7; $idw++) {
2070 if (!isset($totalforeachday[$tmpday])) {
2071 $totalforeachday[$tmpday] = 0;
2074 if (!$isavailable[$tmpday][
'morning'] && !$isavailable[$tmpday][
'afternoon']) {
2075 $cssonholiday .=
'onholidayallday ';
2076 } elseif (!$isavailable[$tmpday][
'morning']) {
2077 $cssonholiday .=
'onholidaymorning ';
2078 } elseif (!$isavailable[$tmpday][
'afternoon']) {
2079 $cssonholiday .=
'onholidayafternoon ';
2083 $dayWorkLoad = (!empty($projectstatic->weekWorkLoadPerTask[$tmpday][$lines[$i]->id]) ? $projectstatic->weekWorkLoadPerTask[$tmpday][$lines[$i]->id] : 0);
2084 $totalforeachday[$tmpday] += $dayWorkLoad;
2087 if ($dayWorkLoad > 0) {
2090 $alttitle = $langs->trans(
"AddHereTimeSpentForDay", !empty($tmparray[
'day']) ? $tmparray[
'day'] : 0, $tmparray[
'mon']);
2092 global $numstartworkingday, $numendworkingday;
2094 if (($idw + 1 < $numstartworkingday) || ($idw + 1 > $numendworkingday)) {
2095 $cssweekend =
'weekend';
2098 $disabledtaskday = $disabledtask;
2100 if (! $disabledtask && $restrictBefore && $tmpday < $restrictBefore) {
2101 $disabledtaskday = 1;
2104 $tableCell =
'<td class="center hide'.$idw.($cssonholiday ?
' '.$cssonholiday :
'').($cssweekend ?
' '.$cssweekend :
'').($j <= 1 ?
' borderleft' :
'').
'">';
2107 if ($alreadyspent) {
2108 $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>';
2112 $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"';
2113 $tableCell .=
' onkeypress="return regexEvent(this,event,\'timeChar\')"';
2114 $tableCell .=
' onkeyup="updateTotal('.$idw.
',\''.$modeinput.
'\')
"';
2115 $tableCell .= ' onblur="regexEvent(
this,event,\
''.$modeinput.
'\'); updateTotal(
'.$idw.',\
''.$modeinput.
'\')
" />';
2116 $tableCell .= '</td>';
2121 print '<td class="right
">';
2122 if ((!$lines[$i]->public) && $disabledproject) {
2123 print $form->textwithpicto('', $langs->trans("UserIsNotContactOfProject
"));
2124 } elseif ($disabledtask) {
2125 $titleassigntask = $langs->trans("AssignTaskToMe
");
2126 if ($fuser->id != $user->id) {
2127 $titleassigntask = $langs->trans("AssignTaskToUser
", '...');
2130 print $form->textwithpicto('', $langs->trans("TaskIsNotAssignedToUser
", $titleassigntask));
2137 // Call to show task with a lower level (task under the current task)
2140 if ($lines[$i]->id > 0) {
2141 //var_dump('totalforeachday after taskid='.$lines[$i]->id.' and previous one on level '.$level);
2142 //var_dump($totalforeachday);
2143 $ret = projectLinesPerWeek($inc, $firstdaytoshow, $fuser, $lines[$i]->id, ($parent == 0 ? $lineswithoutlevel0 : $lines), $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $isavailable, $oldprojectforbreak, $arrayfields, $extrafields);
2144 //var_dump('ret with parent='.$lines[$i]->id.' level='.$level);
2146 foreach ($ret as $key => $val) {
2147 $totalforeachday[$key] += $val;
2149 //var_dump('totalforeachday after taskid='.$lines[$i]->id.' and previous one on level '.$level.' + subtasks');
2150 //var_dump($totalforeachday);
2158 return $totalforeachday;
2510function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks = 0, $status = -1, $listofoppstatus = array(), $hiddenfields = array(), $max = 0)
2512 global $langs, $conf, $user;
2513 global $theme_datacolor;
2515 $maxofloop = (!getDolGlobalString('MAIN_MAXLIST_OVERLOAD') ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD);
2517 require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
2519 $listofstatus = array_keys($listofoppstatus);
2521 if (is_array($listofstatus) && getDolGlobalString('USE_COLOR_FOR_PROSPECTION_STATUS')) {
2522 // Define $themeColorId and array $statusOppList for each $listofstatus
2524 $statusOppList = array();
2525 foreach ($listofstatus as $oppStatus) {
2526 $oppStatusCode = dol_getIdFromCode($db, $oppStatus, 'c_lead_status', 'rowid', 'code');
2527 if ($oppStatusCode) {
2528 $statusOppList[$oppStatus]['code'] = $oppStatusCode;
2529 $statusOppList[$oppStatus]['color'] = isset($theme_datacolor[$themeColorId]) ? implode(', ', $theme_datacolor[$themeColorId]) : '';
2535 $projectstatic = new Project($db);
2536 $thirdpartystatic = new Societe($db);
2540 $project_year_filter = 0;
2542 $title = $langs->trans("
Projects");
2543 if (strcmp((string) $status, '') && $status >= 0) {
2544 $title = $langs->trans("Projects").' '.$langs->trans($projectstatic->labelStatus[$status]);
2547 print '<!-- print_projecttasks_array -->';
2548 print '<div class="div-
table-responsive-no-min
">';
2549 print '<table class="noborder centpercent
">';
2551 $sql = " FROM
".MAIN_DB_PREFIX."projet as p
";
2553 $sql .= ",
".MAIN_DB_PREFIX."projet_task as t
";
2554 $sql .= ",
".MAIN_DB_PREFIX."element_contact as ec
";
2555 $sql .= ",
".MAIN_DB_PREFIX."c_type_contact as ctc
";
2557 $sql .= " LEFT JOIN
".MAIN_DB_PREFIX."projet_task as t ON p.rowid = t.fk_projet
";
2559 $sql .= " WHERE p.entity IN (
".getEntity('project').")
";
2560 $sql .= " AND p.rowid IN (
".$db->sanitize($projectsListId).")
";
2562 $sql .= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc =
".((int) $socid).")
";
2565 $sql .= " AND p.rowid = t.fk_projet
";
2566 $sql .= " AND ec.element_id = t.rowid
";
2567 $sql .= " AND ec.fk_socpeople =
".((int) $user->id);
2568 $sql .= " AND ec.fk_c_type_contact = ctc.rowid
"; // Replace the 2 lines with ec.fk_c_type_contact in $arrayidtypeofcontact
2569 $sql .= " AND ctc.element =
'project_task'";
2572 $sql .= " AND p.fk_statut =
".(int) $status;
2574 if (getDolGlobalString('PROJECT_LIMIT_YEAR_RANGE')) {
2575 $project_year_filter = GETPOST("project_year_filter
");
2576 //Check if empty or invalid year. Wildcard ignores the sql check
2577 if ($project_year_filter != "*
") {
2578 if (empty($project_year_filter) || !ctype_digit($project_year_filter)) {
2579 $project_year_filter = date("Y
");
2581 $sql .= " AND (p.dateo IS NULL OR p.dateo <=
".$db->idate(dol_get_last_day($project_year_filter, 12, false)).")
";
2582 $sql .= " AND (p.datee IS NULL OR p.datee >=
".$db->idate(dol_get_first_day($project_year_filter, 1, false)).")
";
2586 // Get id of project we must show tasks
2587 $arrayidofprojects = array();
2588 $sql1 = "SELECT p.rowid as projectid
";
2590 $resql = $db->query($sql1);
2593 $num = $db->num_rows($resql);
2595 $objp = $db->fetch_object($resql);
2596 $arrayidofprojects[$objp->projectid] = $objp->projectid;
2600 dol_print_error($db);
2602 if (empty($arrayidofprojects)) {
2603 $arrayidofprojects[0] = -1;
2606 // Get list of project with calculation on tasks
2607 $sql2 = "SELECT p.rowid as projectid, p.ref, p.title, p.fk_soc,
";
2608 $sql2 .= " s.rowid as socid, s.nom as socname, s.name_alias,
";
2609 $sql2 .= " s.code_client, s.code_compta, s.client,
";
2610 $sql2 .= " s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur,
";
2611 $sql2 .= " s.logo, s.email, s.entity,
";
2612 $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,
";
2613 $sql2 .= " p.dateo, p.datee,
";
2614 $sql2 .= " COUNT(t.rowid) as nb, SUM(t.planned_workload) as planned_workload, SUM(t.planned_workload * t.progress / 100) as declared_progess_workload";
2615 $sql2 .= " FROM ".MAIN_DB_PREFIX."projet as p";
2616 $sql2 .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.
rowid = p.fk_soc";
2617 $sql2 .= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task as t ON p.
rowid = t.fk_projet";
2618 $sql2 .= " WHERE p.
rowid IN (".$db->sanitize(implode(',', $arrayidofprojects)).")";
2619 $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,";
2620 $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";
2621 $sql2 .= " ORDER BY p.title, p.
ref";
2623 $resql = $db->query($sql2);
2627 $total_opp_amount = 0;
2628 $ponderated_opp_amount = 0;
2629 $total_plannedworkload = 0;
2630 $total_declaredprogressworkload = 0;
2632 $num = $db->num_rows($resql);
2633 $nbofloop = min($num, (!
getDolGlobalString(
'MAIN_MAXLIST_OVERLOAD') ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD));
2636 print
'<tr class="liste_titre">';
2637 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);
2640 if (!in_array(
'prospectionstatus', $hiddenfields)) {
2641 print_liste_field_titre(
"OpportunityStatus",
"",
"",
"",
"",
'style="max-width: 100px"', $sortfield, $sortorder,
'center ');
2643 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 ');
2648 if (!in_array(
'plannedworkload', $hiddenfields)) {
2649 print_liste_field_titre(
"PlannedWorkload",
"",
"",
"",
"",
'style="max-width: 100px"', $sortfield, $sortorder,
'right ');
2651 if (!in_array(
'declaredprogress', $hiddenfields)) {
2652 print_liste_field_titre(
"%",
"",
"",
"",
"",
'', $sortfield, $sortorder,
'right ', $langs->trans(
"ProgressDeclared"));
2655 if (!in_array(
'projectstatus', $hiddenfields)) {
2660 while ($i < $nbofloop) {
2661 $objp = $db->fetch_object($resql);
2663 if ($max && $i >= $max) {
2666 $total_task += $objp->nb;
2667 $total_opp_amount += $objp->opp_amount;
2668 $opp_weighted_amount = $objp->opp_percent * $objp->opp_amount / 100;
2669 $ponderated_opp_amount +=
price2num($opp_weighted_amount);
2670 $plannedworkload = $objp->planned_workload;
2671 $total_plannedworkload += $plannedworkload;
2672 $declaredprogressworkload = $objp->declared_progess_workload;
2673 $total_declaredprogressworkload += $declaredprogressworkload;
2677 $projectstatic->id = $objp->projectid;
2678 $projectstatic->user_author_id = $objp->fk_user_creat;
2679 $projectstatic->public = $objp->public;
2682 $userAccess = $projectstatic->restrictedProjectArea($user);
2683 if ($userAccess >= 0) {
2684 $projectstatic->ref = $objp->ref;
2685 $projectstatic->status = $objp->status;
2686 $projectstatic->title = $objp->title;
2687 $projectstatic->date_end = $db->jdate($objp->datee);
2688 $projectstatic->date_start = $db->jdate($objp->dateo);
2690 print
'<tr class="oddeven">';
2692 print
'<td class="tdoverflowmax150">';
2693 print $projectstatic->getNomUrl(1,
'', 0,
'',
'-', 0, -1,
'nowraponall');
2694 if (!in_array(
'projectlabel', $hiddenfields)) {
2695 print
'<br><span class="opacitymedium small">'.dol_escape_htmltag($objp->title).
'</span>';
2699 print
'<td class="nowraponall tdoverflowmax100">';
2700 if ($objp->fk_soc > 0) {
2701 $thirdpartystatic->id = $objp->socid;
2702 $thirdpartystatic->name = $objp->socname;
2705 $thirdpartystatic->code_compta = $objp->code_compta;
2706 $thirdpartystatic->client = $objp->client;
2708 $thirdpartystatic->code_compta_fournisseur = $objp->code_compta_fournisseur;
2709 $thirdpartystatic->fournisseur = $objp->fournisseur;
2710 $thirdpartystatic->logo = $objp->logo;
2711 $thirdpartystatic->email = $objp->email;
2712 $thirdpartystatic->entity = $objp->entity;
2713 print $thirdpartystatic->getNomUrl(1);
2718 if (!in_array(
'prospectionstatus', $hiddenfields)) {
2719 print
'<td class="center tdoverflowmax75">';
2722 $oppStatusCode =
dol_getIdFromCode($db, $objp->opp_status,
'c_lead_status',
'rowid',
'code');
2723 if ($langs->trans(
"OppStatus".$oppStatusCode) !=
"OppStatus".$oppStatusCode) {
2724 print $langs->trans(
"OppStatus".$oppStatusCode);
2727 if (isset($statusOppList[$objp->opp_status])) {
2728 $oppStatusCode = $statusOppList[$objp->opp_status][
'code'];
2729 $oppStatusColor = $statusOppList[$objp->opp_status][
'color'];
2731 $oppStatusCode =
dol_getIdFromCode($db, $objp->opp_status,
'c_lead_status',
'rowid',
'code');
2732 $oppStatusColor =
'';
2734 if ($oppStatusCode) {
2735 if (!empty($oppStatusColor)) {
2736 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>';
2738 print
'<a href="'.dol_buildpath(
'/projet/list.php?search_opp_status='.$objp->opp_status, 1).
'" title="'.$langs->trans(
"OppStatus".$oppStatusCode).
'">'.$oppStatusCode.
'</a>';
2745 print
'<td class="right">';
2746 if ($objp->opp_percent && $objp->opp_amount) {
2747 $opp_weighted_amount = $objp->opp_percent * $objp->opp_amount / 100;
2748 $alttext = $langs->trans(
"OpportunityWeightedAmount").
' '.
price($opp_weighted_amount, 0,
'', 1, -1, 0, $conf->currency);
2749 $ponderated_opp_amount +=
price2num($opp_weighted_amount);
2751 if ($objp->opp_amount) {
2752 print
'<span class="amount" title="'.$alttext.
'">'.$form->textwithpicto(
price($objp->opp_amount, 0,
'', 1, -1, 0), $alttext).
'</span>';
2758 print
'<td class="right">'.$objp->nb.
'</td>';
2760 $plannedworkload = $objp->planned_workload;
2761 $total_plannedworkload += $plannedworkload;
2762 if (!in_array(
'plannedworkload', $hiddenfields)) {
2763 print
'<td class="right nowraponall">'.($plannedworkload ?
convertSecondToTime($plannedworkload) :
'').
'</td>';
2765 if (!in_array(
'declaredprogress', $hiddenfields)) {
2766 $declaredprogressworkload = $objp->declared_progess_workload;
2767 $total_declaredprogressworkload += $declaredprogressworkload;
2768 print
'<td class="right nowraponall">';
2770 print($plannedworkload ? round(100 * $declaredprogressworkload / $plannedworkload, 0).
'%' :
'');
2775 if (!in_array(
'projectstatus', $hiddenfields)) {
2776 print
'<td class="right">';
2777 print $projectstatic->getLibStatut(3);
2783 $total_task += $objp->nb;
2784 $total_opp_amount += $objp->opp_amount;
2791 print
'<tr class="oddeven">';
2792 print
'<td class="nowrap" colspan="5">';
2793 print
'<span class="opacitymedium">'.$langs->trans(
"More").
'...'.($othernb < $maxofloop ?
' ('.$othernb.
')' :
'').
'</span>';
2798 print
'<tr class="liste_total">';
2799 print
'<td>'.$langs->trans(
"Total").
"</td><td></td>";
2801 if (!in_array(
'prospectionstatus', $hiddenfields)) {
2802 print
'<td class="liste_total"></td>';
2804 print
'<td class="liste_total right">';
2806 print $form->textwithpicto(
price($total_opp_amount, 0,
'', 1, -1, 0), $langs->trans(
"OpportunityPonderatedAmountDesc").
' : '.
price($ponderated_opp_amount, 0,
'', 1, -1, 0, $conf->currency));
2810 print
'<td class="liste_total right">'.$total_task.
'</td>';
2811 if (!in_array(
'plannedworkload', $hiddenfields)) {
2812 print
'<td class="liste_total right">'.($total_plannedworkload ?
convertSecondToTime($total_plannedworkload) :
'').
'</td>';
2814 if (!in_array(
'declaredprogress', $hiddenfields)) {
2815 print
'<td class="liste_total right">'.($total_plannedworkload ? round(100 * $total_declaredprogressworkload / $total_plannedworkload, 0).
'%' :
'').
'</td>';
2818 if (!in_array(
'projectstatus', $hiddenfields)) {
2819 print
'<td class="liste_total"></td>';
2833 print
'<form method="get" action="'.$_SERVER[
"PHP_SELF"].
'">';
2834 print
'<table width="100%">';
2836 print
'<td>'.$langs->trans(
"Year").
'</td>';
2837 print
'<td class="right"><input type="text" size="4" class="flat" name="project_year_filter" value="'.((int) $project_year_filter).
'"/>';
2839 print
'</table></form>';
2852function getTaskProgressView($task, $label =
true, $progressNumber =
true, $hideOnProgressNull =
false, $spaced =
false)
2854 global $langs, $conf;
2858 $plannedworkloadoutputformat =
'allhourmin';
2859 $timespentoutputformat =
'allhourmin';
2861 $plannedworkloadoutputformat =
getDolGlobalString(
'PROJECT_PLANNED_WORKLOAD_FORMAT');
2867 if (empty($task->progress) && !empty($hideOnProgressNull)) {
2871 $spaced = !empty($spaced) ?
'spaced' :
'';
2876 $progressBarClass =
'progress-bar-info';
2877 $progressCalculated = 0;
2878 if ($task->planned_workload) {
2879 $progressCalculated = round(100 * (
float) $task->duration_effective / (
float) $task->planned_workload, 2);
2882 $warningRatio =
getDolGlobalString(
'PROJECT_TIME_SPEND_WARNING_PERCENT') ? (1 + $conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT / 100) : 1.10;
2884 $diffTitle =
'<br>'.$langs->trans(
'ProgressDeclared').
' : '.$task->progress.(isset($task->progress) ?
'%' :
'');
2885 $diffTitle .=
'<br>'.$langs->trans(
'ProgressCalculated').
' : '.$progressCalculated.(isset($progressCalculated) ?
'%' :
'');
2888 if ((
float) $progressCalculated > (float) ($task->progress * $warningRatio)) {
2889 $progressBarClass =
'progress-bar-danger';
2890 $title = $langs->trans(
'TheReportedProgressIsLessThanTheCalculatedProgressionByX', abs($task->progress - $progressCalculated).
' '.$langs->trans(
"point"));
2891 $diff =
'<span class="text-danger classfortooltip paddingrightonly" title="'.dol_htmlentities($title.$diffTitle).
'" ><i class="fa fa-caret-down"></i> '.($task->progress - $progressCalculated).
'%</span>';
2892 } elseif ((
float) $progressCalculated > (
float) $task->progress) {
2893 $progressBarClass =
'progress-bar-warning';
2894 $title = $langs->trans(
'TheReportedProgressIsLessThanTheCalculatedProgressionByX', abs($task->progress - $progressCalculated).
' '.$langs->trans(
"point"));
2895 $diff =
'<span class="text-warning classfortooltip paddingrightonly" title="'.dol_htmlentities($title.$diffTitle).
'" ><i class="fa fa-caret-left"></i> '.($task->progress - $progressCalculated).
'%</span>';
2897 $progressBarClass =
'progress-bar-success';
2898 $title = $langs->trans(
'TheReportedProgressIsMoreThanTheCalculatedProgressionByX', ($task->progress - $progressCalculated).
' '.$langs->trans(
"point"));
2899 $diff =
'<span class="text-success classfortooltip paddingrightonly" title="'.dol_htmlentities($title.$diffTitle).
'" ><i class="fa fa-caret-up"></i> '.($task->progress - $progressCalculated).
'%</span>';
2903 $out .=
'<div class="progress-group">';
2905 if ($label !==
false) {
2906 $out .=
' <span class="progress-text">';
2908 if ($label !==
true) {
2917 if ($progressNumber !==
false) {
2918 $out .=
' <span class="progress-number">';
2919 if ($progressNumber !==
true) {
2920 $out .= $progressNumber;
2922 if ($task->hasDelay()) {
2926 $url = DOL_URL_ROOT.
'/projet/tasks/time.php?id='.$task->id;
2928 $out .= !empty($diff) ? $diff.
' ' :
'';
2929 $out .=
'<a href="'.$url.
'" >';
2930 $out .=
'<b title="'.$langs->trans(
'TimeSpent').
'" >';
2931 if ($task->duration_effective) {
2941 $out .=
'<a href="'.$url.
'" >';
2942 $out .=
'<span title="'.$langs->trans(
'PlannedWorkload').
'" >';
2943 if ($task->planned_workload) {
2955 $out .=
' <div class="progress sm'.($spaced ? $spaced :
'').
'">';
2956 $diffval = (float) $task->progress - (
float) $progressCalculated;
2957 if ($diffval >= 0) {
2959 $out .=
' <div class="progress-bar '.$progressBarClass.
'" style="width: '.(float) $task->progress.
'%" title="'.(
float) $task->progress.
'%">';
2960 if (!empty($task->progress)) {
2961 $out .=
' <div class="progress-bar progress-bar-consumed" style="width: '.(float) ($progressCalculated / ((
float) $task->progress == 0 ? 1 : $task->progress) * 100).
'%" title="'.(float) $progressCalculated.
'%"></div>';
2966 $out .=
' <div class="progress-bar progress-bar-consumed-late" style="width: '.(float) $progressCalculated.
'%" title="'.(
float) $progressCalculated.
'%">';
2967 $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>';