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;
603 global $objectoffield;
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->status = $lines[$i]->status;
689 $taskstatic->date_start = $lines[$i]->date_start;
690 $taskstatic->date_end = $lines[$i]->date_end;
691 $taskstatic->datee = $lines[$i]->date_end;
692 $taskstatic->planned_workload = $lines[$i]->planned_workload;
693 $taskstatic->duration_effective = $lines[$i]->duration_effective;
694 $taskstatic->budget_amount = $lines[$i]->budget_amount;
698 print
'<td class="nowrap center">';
700 if (in_array($lines[$i]->
id, $arrayofselected)) {
703 print
'<input id="cb' . $lines[$i]->id .
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="' . $lines[$i]->id .
'"' . ($selected ?
' checked="checked"' :
'') .
'>';
709 print
'<td class="nowraponall">';
711 if ($lines[$i]->
public || in_array($lines[$i]->fk_project, $projectsArrayId) || $user->hasRight(
'projet',
'all',
'lire')) {
712 print $projectstatic->getNomUrl(1);
714 print $projectstatic->getNomUrl(1,
'nolink');
721 $projectstatic->statut = $lines[$i]->projectstatus;
722 print $projectstatic->getLibStatut(2);
727 if (count($arrayfields) > 0 && !empty($arrayfields[
't.ref'][
'checked'])) {
728 print
'<td class="nowraponall">';
729 if ($showlineingray) {
730 print
'<i>'.img_object(
'',
'projecttask').
' '.$lines[$i]->ref.
'</i>';
732 print $taskstatic->getNomUrl(1,
'withproject');
738 if (count($arrayfields) > 0 && !empty($arrayfields[
't.label'][
'checked'])) {
740 if ($showlineingray) {
741 $labeltoshow .=
'<i>';
744 for ($k = 0; $k < $level; $k++) {
745 $labeltoshow .=
'<div class="marginleftonly">';
748 for ($k = 0; $k < $level; $k++) {
749 $labeltoshow .=
'</div>';
751 if ($showlineingray) {
752 $labeltoshow .=
'</i>';
754 print
'<td class="tdoverflowmax200" title="'.dol_escape_htmltag($labeltoshow).
'">';
759 if (count($arrayfields) > 0 && !empty($arrayfields[
't.description'][
'checked'])) {
760 print
'<td class="tdoverflowmax200" title="'.dol_escape_htmltag($lines[$i]->
description).
'">';
761 print $lines[$i]->description;
766 if (count($arrayfields) > 0 && !empty($arrayfields[
't.dateo'][
'checked'])) {
767 print
'<td class="center nowraponall">';
773 if (count($arrayfields) > 0 && !empty($arrayfields[
't.datee'][
'checked'])) {
774 print
'<td class="center nowraponall">';
776 if ($taskstatic->hasDelay()) {
782 $plannedworkloadoutputformat =
'allhourmin';
783 $timespentoutputformat =
'allhourmin';
792 if (count($arrayfields) > 0 && !empty($arrayfields[
't.planned_workload'][
'checked'])) {
793 print
'<td class="right">';
794 $fullhour =
convertSecondToTime($lines[$i]->planned_workload, $plannedworkloadoutputformat);
796 if ($lines[$i]->planned_workload !=
'') {
806 if (count($arrayfields) > 0 && !empty($arrayfields[
't.duration_effective'][
'checked'])) {
807 print
'<td class="right">';
808 if ($showlineingray) {
811 print
'<a href="'.DOL_URL_ROOT.
'/projet/tasks/time.php?id='.$lines[$i]->id.($showproject ?
'' :
'&withproject=1').
'">';
813 if ($lines[$i]->duration_effective) {
818 if ($showlineingray) {
827 if (count($arrayfields) > 0 && !empty($arrayfields[
't.progress_calculated'][
'checked'])) {
830 if ($lines[$i]->planned_workload || $lines[$i]->duration_effective) {
831 if ($lines[$i]->planned_workload) {
832 $s = round(100 * (
float) $lines[$i]->duration_effective / (
float) $lines[$i]->planned_workload, 2).
' %';
835 $s = $langs->trans(
'WorkloadNotDefined');
836 $shtml =
'<span class="opacitymedium">'.$s.
'</span>';
839 print
'<td class="right tdoverflowmax100" title="'.dol_escape_htmltag($s).
'">';
845 if (count($arrayfields) > 0 && !empty($arrayfields[
't.progress'][
'checked'])) {
846 print
'<td class="right">';
847 if ($lines[$i]->progress !=
'') {
854 if (count($arrayfields) > 0 && !empty($arrayfields[
't.progress_summary'][
'checked'])) {
855 print
'<td class="right">';
856 if ($lines[$i]->progress !=
'' && $lines[$i]->duration_effective) {
864 if (count($arrayfields) > 0 && !empty($arrayfields[
't.tobill'][
'checked'])) {
865 print
'<td class="right">';
866 if ($lines[$i]->usage_bill_time) {
868 $total_projectlinesa_tobill += $lines[$i]->tobill;
870 print
'<span class="opacitymedium">'.$langs->trans(
"NA").
'</span>';
876 if (count($arrayfields) > 0 && !empty($arrayfields[
't.billed'][
'checked'])) {
877 print
'<td class="right">';
878 if ($lines[$i]->usage_bill_time) {
880 $total_projectlinesa_billed += $lines[$i]->billed;
882 print
'<span class="opacitymedium">'.$langs->trans(
"NA").
'</span>';
889 if (count($arrayfields) > 0 && !empty($arrayfields[
't.budget_amount'][
'checked'])) {
890 print
'<td class="center">';
891 if ($lines[$i]->budget_amount) {
892 print
'<span class="amount">'.price($lines[$i]->budget_amount, 0, $langs, 1, 0, 0, $conf->currency).
'</span>';
893 $total_budget_amount += $lines[$i]->budget_amount;
899 if (count($arrayfields) > 0 && !empty($arrayfields[
'c.assigned'][
'checked'])) {
900 print
'<td class="center">';
902 foreach (array(
'internal',
'external') as $source) {
904 $tab = $lines[$i]->liste_contact(-1, $source, 0,
'', 1);
906 $numcontact = count($tab);
907 if (!empty($numcontact)) {
908 foreach ($tab as $contacttask) {
910 if ($source ==
'internal') {
915 $c->fetch($contacttask[
'id']);
916 if (!empty($c->photo)) {
917 if (get_class($c) ==
'User') {
918 print $c->getNomUrl(-2,
'', 0, 0, 24, 1,
'', ($ifisrt ?
'' :
'notfirst'));
920 print $c->getNomUrl(-2,
'', 0,
'', -1, 0, ($ifisrt ?
'' :
'notfirst'));
923 if (get_class($c) ==
'User') {
924 print $c->getNomUrl(2,
'', 0, 0, 24, 1,
'', ($ifisrt ?
'' :
'notfirst'));
926 print $c->getNomUrl(2,
'', 0,
'', -1, 0, ($ifisrt ?
'' :
'notfirst'));
937 $extrafieldsobjectkey = $taskstatic->table_element;
938 $extrafieldsobjectprefix =
'efpt.';
941 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
943 $parameters = array(
'arrayfields' => $arrayfields,
'obj' => $lines[$i]);
944 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters);
945 print $hookmanager->resPrint;
948 print
'<td class="tdlineupdown center"></td>';
952 print
'<td class="nowrap center">';
954 if (in_array($lines[$i]->
id, $arrayofselected)) {
957 print
'<input id="cb' . $lines[$i]->id .
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="' . $lines[$i]->id .
'"' . ($selected ?
' checked="checked"' :
'') .
'>';
964 if (!$showlineingray) {
970 if ($lines[$i]->
id) {
971 projectLinesa($inc, $lines[$i]->
id, $lines, $level, $var, $showproject, $taskrole, $projectsListId, $addordertick, $projectidfortotallink,
'', $showbilltime, $arrayfields);
976 $total_projectlinesa_spent += $lines[$i]->duration_effective;
977 $total_projectlinesa_planned += $lines[$i]->planned_workload;
978 if ($lines[$i]->planned_workload) {
979 $total_projectlinesa_spent_if_planned += $lines[$i]->duration_effective;
981 if ($lines[$i]->planned_workload) {
982 $total_projectlinesa_declared_if_planned += (float) $lines[$i]->planned_workload * $lines[$i]->progress / 100;
991 if (($total_projectlinesa_planned > 0 || $total_projectlinesa_spent > 0 || $total_projectlinesa_tobill > 0 || $total_projectlinesa_billed > 0 || $total_budget_amount > 0)
993 print
'<tr class="liste_total nodrag nodrop">';
996 print
'<td class="liste_total"></td>';
999 print
'<td class="liste_total">'.$langs->trans(
"Total").
'</td>';
1001 print
'<td></td><td></td>';
1003 if (count($arrayfields) > 0 && !empty($arrayfields[
't.label'][
'checked'])) {
1006 if (count($arrayfields) > 0 && !empty($arrayfields[
't.description'][
'checked'])) {
1009 if (count($arrayfields) > 0 && !empty($arrayfields[
't.dateo'][
'checked'])) {
1012 if (count($arrayfields) > 0 && !empty($arrayfields[
't.datee'][
'checked'])) {
1015 if (count($arrayfields) > 0 && !empty($arrayfields[
't.planned_workload'][
'checked'])) {
1016 print
'<td class="nowrap liste_total right">';
1020 if (count($arrayfields) > 0 && !empty($arrayfields[
't.duration_effective'][
'checked'])) {
1021 print
'<td class="nowrap liste_total right">';
1022 if ($projectidfortotallink > 0) {
1023 print
'<a href="'.DOL_URL_ROOT.
'/projet/tasks/time.php?projectid='.$projectidfortotallink.($showproject ?
'' :
'&withproject=1').
'">';
1026 if ($projectidfortotallink > 0) {
1032 if ($total_projectlinesa_planned) {
1033 $totalAverageDeclaredProgress = round(100 * $total_projectlinesa_declared_if_planned / $total_projectlinesa_planned, 2);
1034 $totalCalculatedProgress = round(100 * $total_projectlinesa_spent / $total_projectlinesa_planned, 2);
1037 $warningRatio =
getDolGlobalString(
'PROJECT_TIME_SPEND_WARNING_PERCENT') ? (1 + $conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT / 100) : 1.10;
1040 $progressBarClass =
'progress-bar-info';
1041 $badgeClass =
'badge ';
1043 if ($totalCalculatedProgress > $totalAverageDeclaredProgress) {
1044 $progressBarClass =
'progress-bar-danger';
1045 $badgeClass .=
'badge-danger';
1046 } elseif ($totalCalculatedProgress * $warningRatio >= $totalAverageDeclaredProgress) {
1047 $progressBarClass =
'progress-bar-warning';
1048 $badgeClass .=
'badge-warning';
1050 $progressBarClass =
'progress-bar-success';
1051 $badgeClass .=
'badge-success';
1056 if (count($arrayfields) > 0 && !empty($arrayfields[
't.progress_calculated'][
'checked'])) {
1057 print
'<td class="nowrap liste_total right">';
1058 if ($total_projectlinesa_planned) {
1059 print $totalCalculatedProgress.
' %';
1065 if (count($arrayfields) > 0 && !empty($arrayfields[
't.progress'][
'checked'])) {
1066 print
'<td class="nowrap liste_total right">';
1067 if ($total_projectlinesa_planned) {
1068 print
'<span class="'.$badgeClass.
'" >'.$totalAverageDeclaredProgress.
' %</span>';
1075 if (count($arrayfields) > 0 && !empty($arrayfields[
't.progress_summary'][
'checked'])) {
1076 print
'<td class="right">';
1077 if ($total_projectlinesa_planned) {
1079 print
' <div class="progress sm" title="'.$totalAverageDeclaredProgress.
'%" >';
1080 print
' <div class="progress-bar '.$progressBarClass.
'" style="width: '.$totalAverageDeclaredProgress.
'%"></div>';
1087 if ($showbilltime) {
1088 if (count($arrayfields) > 0 && !empty($arrayfields[
't.tobill'][
'checked'])) {
1089 print
'<td class="nowrap liste_total right">';
1093 if (count($arrayfields) > 0 && !empty($arrayfields[
't.billed'][
'checked'])) {
1094 print
'<td class="nowrap liste_total right">';
1101 if (count($arrayfields) > 0 && !empty($arrayfields[
't.budget_amount'][
'checked'])) {
1102 print
'<td class="nowrap liste_total center">';
1103 if (strcmp((
string) $total_budget_amount,
'')) {
1104 print
price($total_budget_amount, 0, $langs, 1, 0, 0, $conf->currency);
1114 if (count($arrayfields) > 0 && !empty($arrayfields[
'c.assigned'][
'checked'])) {
1119 if (!empty($extrafields->attributes[
'projet_task'][
'totalizable'])) {
1120 foreach ($extrafields->attributes[
'projet_task'][
'totalizable'] as $key => $value) {
1121 if (!empty($arrayfields[
'efpt.'.$key][
'checked']) && $arrayfields[
'efpt.'.$key][
'checked'] == 1) {
1122 print
'<td class="right">';
1124 print empty($totalarray[
'totalizable'][$key][
'total']) ?
'' : $totalarray[
'totalizable'][$key][
'total'];
1132 print
'<td class="liste_total"></td>';
1135 print
'<td class="liste_total"></td>';
1162function projectLinesPerAction(&$inc, $parent, $fuser, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask, $preselectedday, &$isavailable, $oldprojectforbreak = 0)
1164 global $conf, $db, $user, $langs;
1165 global $form, $formother, $projectstatic, $taskstatic, $thirdpartystatic;
1168 $totalforeachline = array();
1169 $workloadforid = array();
1170 $lineswithoutlevel0 = array();
1172 $numlines = count($lines);
1176 for ($i = 0; $i < $numlines; $i++) {
1177 if ($lines[$i]->fk_task_parent) {
1178 $lineswithoutlevel0[] = $lines[$i];
1183 if (empty($oldprojectforbreak)) {
1184 $oldprojectforbreak = (!
getDolGlobalString(
'PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT') ? 0 : -1);
1188 for ($i = 0; $i < $numlines; $i++) {
1196 if (empty($mine) || !empty($tasksrole[$lines[$i]->
id])) {
1200 if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid) {
1201 $lastprojectid = $lines[$i]->fk_project;
1202 if ($preselectedday) {
1203 $projectstatic->id = $lines[$i]->fk_project;
1207 if (empty($workloadforid[$projectstatic->id])) {
1208 if ($preselectedday) {
1209 $projectstatic->loadTimeSpent($preselectedday, 0, $fuser->id);
1210 $workloadforid[$projectstatic->id] = 1;
1214 $projectstatic->id = $lines[$i]->fk_project;
1215 $projectstatic->ref = $lines[$i]->project_ref;
1216 $projectstatic->title = $lines[$i]->project_label;
1217 $projectstatic->public = $lines[$i]->public;
1218 $projectstatic->status = $lines[$i]->project->status;
1220 $taskstatic->id = $lines[$i]->fk_statut;
1221 $taskstatic->ref = ($lines[$i]->task_ref ? $lines[$i]->task_ref : $lines[$i]->task_id);
1222 $taskstatic->label = $lines[$i]->task_label;
1223 $taskstatic->date_start = $lines[$i]->date_start;
1224 $taskstatic->date_end = $lines[$i]->date_end;
1226 $thirdpartystatic->id = $lines[$i]->socid;
1227 $thirdpartystatic->name = $lines[$i]->thirdparty_name;
1228 $thirdpartystatic->email = $lines[$i]->thirdparty_email;
1230 if (empty($oldprojectforbreak) || ($oldprojectforbreak != -1 && $oldprojectforbreak != $projectstatic->id)) {
1231 print
'<tr class="oddeven trforbreak nobold">'.
"\n";
1232 print
'<td colspan="11">';
1233 print $projectstatic->getNomUrl(1,
'', 0, $langs->transnoentitiesnoconv(
"YourRole").
': '.$projectsrole[$lines[$i]->fk_project]);
1234 if ($projectstatic->title) {
1236 print $projectstatic->title;
1242 if ($oldprojectforbreak != -1) {
1243 $oldprojectforbreak = $projectstatic->id;
1246 print
'<tr class="oddeven">'.
"\n";
1257 if ($oldprojectforbreak == -1) {
1258 print $projectstatic->getNomUrl(1,
'', 0, $langs->transnoentitiesnoconv(
"YourRole").
': '.$projectsrole[$lines[$i]->fk_project]);
1259 print
'<br>'.$projectstatic->title;
1264 print
'<td class="tdoverflowmax100">';
1265 if ($thirdpartystatic->id > 0) {
1266 print $thirdpartystatic->getNomUrl(1,
'project', 10);
1272 print
'<!-- Task id = '.$lines[$i]->id.
' (projectlinesperaction) -->';
1273 for ($k = 0; $k < $level; $k++) {
1274 print
'<div class="marginleftonly">';
1276 print $taskstatic->getNomUrl(1,
'withproject',
'time');
1279 print
'<div class="opacitymedium tdoverflowmax500" title="'.dol_escape_htmltag($taskstatic->label).
'">'.
dol_escape_htmltag($taskstatic->label).
'</div>';
1280 for ($k = 0; $k < $level; $k++) {
1286 print
'<td class="center">';
1290 $disabledproject = 1;
1296 if ($lines[$i]->
public || !empty($projectsrole[$lines[$i]->fk_project]) || $user->hasRight(
'projet',
'all',
'creer')) {
1297 $disabledproject = 0;
1301 if ($restricteditformytask && empty($tasksrole[$lines[$i]->
id])) {
1306 print
'<td class="nowrap center">';
1311 if (!$isavailable[$preselectedday][
'morning'] && !$isavailable[$preselectedday][
'afternoon']) {
1312 $cssonholiday .=
'onholidayallday ';
1313 } elseif (!$isavailable[$preselectedday][
'morning']) {
1314 $cssonholiday .=
'onholidaymorning ';
1315 } elseif (!$isavailable[$preselectedday][
'afternoon']) {
1316 $cssonholiday .=
'onholidayafternoon ';
1320 print
'<td class="duration'.($cssonholiday ?
' '.$cssonholiday :
'').
' center">';
1322 $dayWorkLoad = $lines[$i]->timespent_duration;
1323 $totalforeachline[$preselectedday] += $lines[$i]->timespent_duration;
1326 if ($dayWorkLoad > 0) {
1335 print
'<td class="center">';
1336 print
'<textarea name="'.$lines[$i]->id.
'note" rows="'.ROWS_2.
'" id="'.$lines[$i]->id.
'note"'.($disabledtask ?
' disabled="disabled"' :
'').
'>';
1337 print $lines[$i]->timespent_note;
1338 print
'</textarea>';
1342 print
'<td class="right">';
1362 return $totalforeachline;
1385function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask, $preselectedday, &$isavailable, $oldprojectforbreak = 0, $arrayfields = array(), $extrafields =
null)
1387 global $conf, $db, $user, $langs;
1388 global $form, $formother, $projectstatic, $taskstatic, $thirdpartystatic;
1391 $totalforeachday = array();
1392 $workloadforid = array();
1393 $lineswithoutlevel0 = array();
1395 $numlines = count($lines);
1399 for ($i = 0; $i < $numlines; $i++) {
1400 if ($lines[$i]->fk_task_parent) {
1401 $lineswithoutlevel0[] = $lines[$i];
1406 if (empty($oldprojectforbreak)) {
1407 $oldprojectforbreak = (!
getDolGlobalString(
'PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT') ? 0 : -1);
1410 $restrictBefore =
null;
1413 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
1418 for ($i = 0; $i < $numlines; $i++) {
1423 if ($lines[$i]->fk_task_parent == $parent) {
1427 if (empty($mine) || !empty($tasksrole[$lines[$i]->
id])) {
1430 if ($restricteditformytask == 2 && empty($tasksrole[$lines[$i]->
id])) {
1435 if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid) {
1436 $lastprojectid = $lines[$i]->fk_project;
1437 if ($preselectedday) {
1438 $projectstatic->id = $lines[$i]->fk_project;
1442 if (empty($workloadforid[$projectstatic->id])) {
1443 if ($preselectedday) {
1444 $projectstatic->loadTimeSpent($preselectedday, 0, $fuser->id);
1445 $workloadforid[$projectstatic->id] = 1;
1449 $projectstatic->id = $lines[$i]->fk_project;
1450 $projectstatic->ref = $lines[$i]->projectref;
1451 $projectstatic->title = $lines[$i]->projectlabel;
1452 $projectstatic->public = $lines[$i]->public;
1453 $projectstatic->status = $lines[$i]->projectstatus;
1455 $taskstatic->id = $lines[$i]->id;
1456 $taskstatic->ref = ($lines[$i]->ref ? $lines[$i]->ref : $lines[$i]->id);
1457 $taskstatic->label = $lines[$i]->label;
1458 $taskstatic->date_start = $lines[$i]->date_start;
1459 $taskstatic->date_end = $lines[$i]->date_end;
1461 $thirdpartystatic->id = $lines[$i]->socid;
1462 $thirdpartystatic->name = $lines[$i]->thirdparty_name;
1463 $thirdpartystatic->email = $lines[$i]->thirdparty_email;
1465 if (empty($oldprojectforbreak) || ($oldprojectforbreak != -1 && $oldprojectforbreak != $projectstatic->id)) {
1467 if (!empty($arrayfields[
't.planned_workload'][
'checked'])) {
1470 if (!empty($arrayfields[
't.progress'][
'checked'])) {
1473 foreach ($arrayfields as $key => $val) {
1474 if ($val[
'checked'] && substr($key, 0, 5) ==
'efpt.') {
1479 print
'<tr class="oddeven trforbreak nobold">'.
"\n";
1480 print
'<td colspan="'.(7 + $addcolspan).
'">';
1481 print $projectstatic->getNomUrl(1,
'', 0,
'<strong>'.$langs->transnoentitiesnoconv(
"YourRole").
':</strong> '.$projectsrole[$lines[$i]->fk_project]);
1482 if ($thirdpartystatic->id > 0) {
1483 print
' - '.$thirdpartystatic->getNomUrl(1);
1485 if ($projectstatic->title) {
1487 print
'<span class="secondary">'.$projectstatic->title.
'</span>';
1554 if ($oldprojectforbreak != -1) {
1555 $oldprojectforbreak = $projectstatic->id;
1558 print
'<tr class="oddeven" data-taskid="'.$lines[$i]->id.
'">'.
"\n";
1570 if ($oldprojectforbreak == -1) {
1571 print $projectstatic->getNomUrl(1,
'', 0, $langs->transnoentitiesnoconv(
"YourRole").
': '.$projectsrole[$lines[$i]->fk_project]);
1578 print
'<td class="tdoverflowmax100">';
1579 if ($thirdpartystatic->id > 0) {
1580 print $thirdpartystatic->getNomUrl(1,
'project', 10);
1587 print
'<!-- Task id = '.$lines[$i]->id.
' (projectlinesperday) -->';
1588 for ($k = 0; $k < $level; $k++) {
1589 print
'<div class="marginleftonly">';
1591 print $taskstatic->getNomUrl(1,
'withproject',
'time');
1594 print
'<div class="opacitymedium tdoverflowmax500" title="'.dol_escape_htmltag($taskstatic->label).
'">'.
dol_escape_htmltag($taskstatic->label).
'</div>';
1595 for ($k = 0; $k < $level; $k++) {
1601 $extrafieldsobjectkey =
'projet_task';
1602 $extrafieldsobjectprefix =
'efpt.';
1603 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
1606 if (!empty($arrayfields[
't.planned_workload'][
'checked'])) {
1607 print
'<td class="leftborder plannedworkload right">';
1608 if ($lines[$i]->planned_workload) {
1617 if (!empty($arrayfields[
't.progress'][
'checked'])) {
1618 print
'<td class="right">';
1619 print $formother->select_percent($lines[$i]->progress, $lines[$i]->
id.
'progress');
1623 if (!empty($arrayfields[
'timeconsumed'][
'checked'])) {
1625 print
'<td class="right">';
1627 if ($lines[$i]->duration_effective) {
1628 print
'<a href="'.DOL_URL_ROOT.
'/projet/tasks/time.php?id='.$lines[$i]->id.
'">';
1637 print
'<td class="right">';
1638 $tmptimespent = $taskstatic->getSummaryOfTimeSpent($fuser->id);
1639 if ($tmptimespent[
'total_duration']) {
1647 $disabledproject = 1;
1653 if ($lines[$i]->
public || !empty($projectsrole[$lines[$i]->fk_project]) || $user->hasRight(
'projet',
'all',
'creer')) {
1654 $disabledproject = 0;
1658 if ($restricteditformytask && empty($tasksrole[$lines[$i]->
id])) {
1662 if ($restrictBefore && $preselectedday < $restrictBefore) {
1667 print
'<td class="nowraponall leftborder center minwidth150imp borderleft">';
1668 $tableCell = $form->selectDate($preselectedday, $lines[$i]->
id, 1, 1, 2,
"addtime", 0, 0, $disabledtask);
1673 if (!$isavailable[$preselectedday][
'morning'] && !$isavailable[$preselectedday][
'afternoon']) {
1674 $cssonholiday .=
'onholidayallday ';
1675 } elseif (!$isavailable[$preselectedday][
'morning']) {
1676 $cssonholiday .=
'onholidaymorning ';
1677 } elseif (!$isavailable[$preselectedday][
'afternoon']) {
1678 $cssonholiday .=
'onholidayafternoon ';
1685 global $numstartworkingday, $numendworkingday;
1687 if ((($idw + 1) < $numstartworkingday) || (($idw + 1) > $numendworkingday)) {
1688 $cssweekend =
'weekend';
1692 print
'<td class="center duration'.($cssonholiday ?
' '.$cssonholiday :
'').($cssweekend ?
' '.$cssweekend :
'').
'">';
1693 $dayWorkLoad = empty($projectstatic->weekWorkLoadPerTask[$preselectedday][$lines[$i]->id]) ? 0 : $projectstatic->weekWorkLoadPerTask[$preselectedday][$lines[$i]->id];
1694 if (!isset($totalforeachday[$preselectedday])) {
1695 $totalforeachday[$preselectedday] = 0;
1697 $totalforeachday[$preselectedday] += $dayWorkLoad;
1700 if ($dayWorkLoad > 0) {
1707 $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>';
1708 $tableCell .=
'<span class="hideonsmartphone"> + </span>';
1710 $tableCell .= $form->select_duration($lines[$i]->
id.
'duration',
'', $disabledtask,
'text', 0, 1);
1717 print
'<td class="center">';
1718 print
'<textarea name="'.$lines[$i]->id.
'note" rows="'.ROWS_2.
'" id="'.$lines[$i]->id.
'note"'.($disabledtask ?
' disabled="disabled"' :
'').
'>';
1719 print
'</textarea>';
1723 print
'<td class="right">';
1724 if ((!$lines[$i]->
public) && $disabledproject) {
1725 print $form->textwithpicto(
'', $langs->trans(
"UserIsNotContactOfProject"));
1726 } elseif ($disabledtask) {
1727 $titleassigntask = $langs->trans(
"AssignTaskToMe");
1728 if ($fuser->id != $user->id) {
1729 $titleassigntask = $langs->trans(
"AssignTaskToUser",
'...');
1732 print $form->textwithpicto(
'', $langs->trans(
"TaskIsNotAssignedToUser", $titleassigntask));
1741 if ($lines[$i]->
id > 0) {
1744 $ret =
projectLinesPerDay($inc, $lines[$i]->
id, $fuser, ($parent == 0 ? $lineswithoutlevel0 : $lines), $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $preselectedday, $isavailable, $oldprojectforbreak, $arrayfields, $extrafields);
1747 foreach ($ret as $key => $val) {
1748 $totalforeachday[$key] += $val;
1759 return $totalforeachday;
1782function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask, &$isavailable, $oldprojectforbreak = 0, $arrayfields = array(), $extrafields =
null)
1784 global $conf, $db, $user, $langs;
1785 global $form, $formother, $projectstatic, $taskstatic, $thirdpartystatic;
1787 $numlines = count($lines);
1790 $workloadforid = array();
1791 $totalforeachday = array();
1792 $lineswithoutlevel0 = array();
1796 for ($i = 0; $i < $numlines; $i++) {
1797 if ($lines[$i]->fk_task_parent) {
1798 $lineswithoutlevel0[] = $lines[$i];
1805 if (empty($oldprojectforbreak)) {
1806 $oldprojectforbreak = (!
getDolGlobalString(
'PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT') ? 0 : -1);
1809 $restrictBefore =
null;
1812 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
1816 for ($i = 0; $i < $numlines; $i++) {
1821 if ($lines[$i]->fk_task_parent == $parent) {
1825 if (empty($mine) || !empty($tasksrole[$lines[$i]->
id])) {
1828 if ($restricteditformytask == 2 && empty($tasksrole[$lines[$i]->
id])) {
1833 if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid) {
1834 $lastprojectid = $lines[$i]->fk_project;
1835 $projectstatic->id = $lines[$i]->fk_project;
1840 if (empty($workloadforid[$projectstatic->id])) {
1841 $projectstatic->loadTimeSpent($firstdaytoshow, 0, $fuser->id);
1842 $workloadforid[$projectstatic->id] = 1;
1847 $projectstatic->id = $lines[$i]->fk_project;
1848 $projectstatic->ref = $lines[$i]->projectref;
1849 $projectstatic->title = $lines[$i]->projectlabel;
1850 $projectstatic->public = $lines[$i]->public;
1851 $projectstatic->thirdparty_name = $lines[$i]->thirdparty_name;
1852 $projectstatic->status = $lines[$i]->projectstatus;
1854 $taskstatic->id = $lines[$i]->id;
1855 $taskstatic->ref = ($lines[$i]->ref ? $lines[$i]->ref : $lines[$i]->id);
1856 $taskstatic->label = $lines[$i]->label;
1857 $taskstatic->date_start = $lines[$i]->date_start;
1858 $taskstatic->date_end = $lines[$i]->date_end;
1860 $thirdpartystatic->id = $lines[$i]->thirdparty_id;
1861 $thirdpartystatic->name = $lines[$i]->thirdparty_name;
1862 $thirdpartystatic->email = $lines[$i]->thirdparty_email;
1864 if (empty($oldprojectforbreak) || ($oldprojectforbreak != -1 && $oldprojectforbreak != $projectstatic->id)) {
1866 if (!empty($arrayfields[
't.planned_workload'][
'checked'])) {
1869 if (!empty($arrayfields[
't.progress'][
'checked'])) {
1872 foreach ($arrayfields as $key => $val) {
1873 if ($val[
'checked'] && substr($key, 0, 5) ==
'efpt.') {
1878 print
'<tr class="oddeven trforbreak nobold">'.
"\n";
1879 print
'<td colspan="'.(11 + $addcolspan).
'">';
1880 print $projectstatic->getNomUrl(1,
'', 0,
'<strong>'.$langs->transnoentitiesnoconv(
"YourRole").
':</strong> '.$projectsrole[$lines[$i]->fk_project]);
1881 if ($thirdpartystatic->id > 0) {
1882 print
' - '.$thirdpartystatic->getNomUrl(1);
1884 if ($projectstatic->title) {
1886 print
'<span class="secondary">'.$projectstatic->title.
'</span>';
1953 if ($oldprojectforbreak != -1) {
1954 $oldprojectforbreak = $projectstatic->id;
1957 print
'<tr class="oddeven" data-taskid="'.$lines[$i]->id.
'">'.
"\n";
1968 print
'<td class="nowrap">';
1969 if ($oldprojectforbreak == -1) {
1970 print $projectstatic->getNomUrl(1,
'', 0, $langs->transnoentitiesnoconv(
"YourRole").
': '.$projectsrole[$lines[$i]->fk_project]);
1977 print
'<td class="tdoverflowmax100">';
1978 if ($thirdpartystatic->id > 0) {
1979 print $thirdpartystatic->getNomUrl(1,
'project');
1985 print
'<td class="tdoverflowmax300">';
1986 print
'<!-- Task id = '.$lines[$i]->id.
' (projectlinesperweek) -->';
1987 for ($k = 0; $k < $level; $k++) {
1988 print
'<div class="marginleftonly">';
1990 print $taskstatic->getNomUrl(1,
'withproject',
'time');
1993 print
'<div class="opacitymedium tdoverflowmax500" title="'.dol_escape_htmltag($taskstatic->label).
'">'.
dol_escape_htmltag($taskstatic->label).
'</div>';
1994 for ($k = 0; $k < $level; $k++) {
2000 $extrafieldsobjectkey =
'projet_task';
2001 $extrafieldsobjectprefix =
'efpt.';
2002 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
2005 if (!empty($arrayfields[
't.planned_workload'][
'checked'])) {
2006 print
'<td class="leftborder plannedworkload right">';
2007 if ($lines[$i]->planned_workload) {
2015 if (!empty($arrayfields[
't.progress'][
'checked'])) {
2017 print
'<td class="right">';
2018 print $formother->select_percent($lines[$i]->progress, $lines[$i]->
id.
'progress');
2022 if (!empty($arrayfields[
'timeconsumed'][
'checked'])) {
2024 print
'<td class="right">';
2026 if ($lines[$i]->duration_effective) {
2027 print
'<a href="'.DOL_URL_ROOT.
'/projet/tasks/time.php?id='.((int) $lines[$i]->
id).
'">';
2036 print
'<td class="right">';
2037 $tmptimespent = $taskstatic->getSummaryOfTimeSpent($fuser->id);
2038 if ($tmptimespent[
'total_duration']) {
2039 print
'<a href="'.DOL_URL_ROOT.
'/projet/tasks/time.php?id='.((int) $lines[$i]->
id).
'&search_user='.((int) $fuser->id).
'">';
2048 $disabledproject = 1;
2054 if ($lines[$i]->
public || !empty($projectsrole[$lines[$i]->fk_project]) || $user->hasRight(
'projet',
'all',
'creer')) {
2055 $disabledproject = 0;
2059 if ($restricteditformytask && empty($tasksrole[$lines[$i]->
id])) {
2067 $modeinput =
'hours';
2069 for ($idw = 0; $idw < 7; $idw++) {
2072 if (!isset($totalforeachday[$tmpday])) {
2073 $totalforeachday[$tmpday] = 0;
2076 if (!$isavailable[$tmpday][
'morning'] && !$isavailable[$tmpday][
'afternoon']) {
2077 $cssonholiday .=
'onholidayallday ';
2078 } elseif (!$isavailable[$tmpday][
'morning']) {
2079 $cssonholiday .=
'onholidaymorning ';
2080 } elseif (!$isavailable[$tmpday][
'afternoon']) {
2081 $cssonholiday .=
'onholidayafternoon ';
2085 $dayWorkLoad = (!empty($projectstatic->weekWorkLoadPerTask[$tmpday][$lines[$i]->id]) ? $projectstatic->weekWorkLoadPerTask[$tmpday][$lines[$i]->id] : 0);
2086 $totalforeachday[$tmpday] += $dayWorkLoad;
2089 if ($dayWorkLoad > 0) {
2092 $alttitle = $langs->trans(
"AddHereTimeSpentForDay", !empty($tmparray[
'day']) ? $tmparray[
'day'] : 0, $tmparray[
'mon']);
2094 global $numstartworkingday, $numendworkingday;
2096 if (($idw + 1 < $numstartworkingday) || ($idw + 1 > $numendworkingday)) {
2097 $cssweekend =
'weekend';
2100 $disabledtaskday = $disabledtask;
2102 if (! $disabledtask && $restrictBefore && $tmpday < $restrictBefore) {
2103 $disabledtaskday = 1;
2106 $tableCell =
'<td class="center hide'.$idw.($cssonholiday ?
' '.$cssonholiday :
'').($cssweekend ?
' '.$cssweekend :
'').($j <= 1 ?
' borderleft' :
'').
'">';
2109 if ($alreadyspent) {
2110 $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>';
2114 $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"';
2115 $tableCell .=
' onkeypress="return regexEvent(this,event,\'timeChar\')"';
2116 $tableCell .=
' onkeyup="updateTotal('.$idw.
',\''.$modeinput.
'\')
"';
2117 $tableCell .= ' onblur="regexEvent(
this,event,\
''.$modeinput.
'\'); updateTotal(
'.$idw.',\
''.$modeinput.
'\')
" />';
2118 $tableCell .= '</td>';
2123 print '<td class="right
">';
2124 if ((!$lines[$i]->public) && $disabledproject) {
2125 print $form->textwithpicto('', $langs->trans("UserIsNotContactOfProject
"));
2126 } elseif ($disabledtask) {
2127 $titleassigntask = $langs->trans("AssignTaskToMe
");
2128 if ($fuser->id != $user->id) {
2129 $titleassigntask = $langs->trans("AssignTaskToUser
", '...');
2132 print $form->textwithpicto('', $langs->trans("TaskIsNotAssignedToUser
", $titleassigntask));
2139 // Call to show task with a lower level (task under the current task)
2142 if ($lines[$i]->id > 0) {
2143 //var_dump('totalforeachday after taskid='.$lines[$i]->id.' and previous one on level '.$level);
2144 //var_dump($totalforeachday);
2145 $ret = projectLinesPerWeek($inc, $firstdaytoshow, $fuser, $lines[$i]->id, ($parent == 0 ? $lineswithoutlevel0 : $lines), $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $isavailable, $oldprojectforbreak, $arrayfields, $extrafields);
2146 //var_dump('ret with parent='.$lines[$i]->id.' level='.$level);
2148 foreach ($ret as $key => $val) {
2149 $totalforeachday[$key] += $val;
2151 //var_dump('totalforeachday after taskid='.$lines[$i]->id.' and previous one on level '.$level.' + subtasks');
2152 //var_dump($totalforeachday);
2160 return $totalforeachday;
2512function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks = 0, $status = -1, $listofoppstatus = array(), $hiddenfields = array(), $max = 0)
2514 global $langs, $conf, $user;
2515 global $theme_datacolor;
2517 $maxofloop = (!getDolGlobalString('MAIN_MAXLIST_OVERLOAD') ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD);
2519 require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
2521 $listofstatus = array_keys($listofoppstatus);
2523 if (is_array($listofstatus) && getDolGlobalString('USE_COLOR_FOR_PROSPECTION_STATUS')) {
2524 // Define $themeColorId and array $statusOppList for each $listofstatus
2526 $statusOppList = array();
2527 foreach ($listofstatus as $oppStatus) {
2528 $oppStatusCode = dol_getIdFromCode($db, $oppStatus, 'c_lead_status', 'rowid', 'code');
2529 if ($oppStatusCode) {
2530 $statusOppList[$oppStatus]['code'] = $oppStatusCode;
2531 $statusOppList[$oppStatus]['color'] = isset($theme_datacolor[$themeColorId]) ? implode(', ', $theme_datacolor[$themeColorId]) : '';
2537 $projectstatic = new Project($db);
2538 $thirdpartystatic = new Societe($db);
2542 $project_year_filter = 0;
2544 $title = $langs->trans("
Projects");
2545 if (strcmp((string) $status, '') && $status >= 0) {
2546 $title = $langs->trans("Projects").' '.$langs->trans($projectstatic->labelStatus[$status]);
2549 print '<!-- print_projecttasks_array -->';
2550 print '<div class="div-
table-responsive-no-min
">';
2551 print '<table class="noborder centpercent
">';
2553 $sql = " FROM
".MAIN_DB_PREFIX."projet as p
";
2555 $sql .= ",
".MAIN_DB_PREFIX."projet_task as t
";
2556 $sql .= ",
".MAIN_DB_PREFIX."element_contact as ec
";
2557 $sql .= ",
".MAIN_DB_PREFIX."c_type_contact as ctc
";
2559 $sql .= " LEFT JOIN
".MAIN_DB_PREFIX."projet_task as t ON p.rowid = t.fk_projet
";
2561 $sql .= " WHERE p.entity IN (
".getEntity('project').")
";
2562 $sql .= " AND p.rowid IN (
".$db->sanitize($projectsListId).")
";
2564 $sql .= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc =
".((int) $socid).")
";
2567 $sql .= " AND p.rowid = t.fk_projet
";
2568 $sql .= " AND ec.element_id = t.rowid
";
2569 $sql .= " AND ec.fk_socpeople =
".((int) $user->id);
2570 $sql .= " AND ec.fk_c_type_contact = ctc.rowid
"; // Replace the 2 lines with ec.fk_c_type_contact in $arrayidtypeofcontact
2571 $sql .= " AND ctc.element =
'project_task'";
2574 $sql .= " AND p.fk_statut =
".(int) $status;
2576 if (getDolGlobalString('PROJECT_LIMIT_YEAR_RANGE')) {
2577 $project_year_filter = GETPOST("project_year_filter
");
2578 //Check if empty or invalid year. Wildcard ignores the sql check
2579 if ($project_year_filter != "*
") {
2580 if (empty($project_year_filter) || !ctype_digit($project_year_filter)) {
2581 $project_year_filter = date("Y
");
2583 $sql .= " AND (p.dateo IS NULL OR p.dateo <=
".$db->idate(dol_get_last_day($project_year_filter, 12, false)).")
";
2584 $sql .= " AND (p.datee IS NULL OR p.datee >=
".$db->idate(dol_get_first_day($project_year_filter, 1, false)).")
";
2588 // Get id of project we must show tasks
2589 $arrayidofprojects = array();
2590 $sql1 = "SELECT p.rowid as projectid
";
2592 $resql = $db->query($sql1);
2595 $num = $db->num_rows($resql);
2597 $objp = $db->fetch_object($resql);
2598 $arrayidofprojects[$objp->projectid] = $objp->projectid;
2602 dol_print_error($db);
2604 if (empty($arrayidofprojects)) {
2605 $arrayidofprojects[0] = -1;
2608 // Get list of project with calculation on tasks
2609 $sql2 = "SELECT p.rowid as projectid, p.ref, p.title, p.fk_soc,
";
2610 $sql2 .= " s.rowid as socid, s.nom as socname, s.name_alias,
";
2611 $sql2 .= " s.code_client, s.code_compta, s.client,
";
2612 $sql2 .= " s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur,
";
2613 $sql2 .= " s.logo, s.email, s.entity,
";
2614 $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,
";
2615 $sql2 .= " p.dateo, p.datee,
";
2616 $sql2 .= " COUNT(t.rowid) as nb, SUM(t.planned_workload) as planned_workload, SUM(t.planned_workload * t.progress / 100) as declared_progess_workload";
2617 $sql2 .= " FROM ".MAIN_DB_PREFIX."projet as p";
2618 $sql2 .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.
rowid = p.fk_soc";
2619 $sql2 .= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task as t ON p.
rowid = t.fk_projet";
2620 $sql2 .= " WHERE p.
rowid IN (".$db->sanitize(implode(',', $arrayidofprojects)).")";
2621 $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,";
2622 $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";
2623 $sql2 .= " ORDER BY p.title, p.
ref";
2625 $resql = $db->query($sql2);
2629 $total_opp_amount = 0;
2630 $ponderated_opp_amount = 0;
2631 $total_plannedworkload = 0;
2632 $total_declaredprogressworkload = 0;
2634 $num = $db->num_rows($resql);
2635 $nbofloop = min($num, (!
getDolGlobalString(
'MAIN_MAXLIST_OVERLOAD') ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD));
2638 print
'<tr class="liste_titre">';
2639 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);
2642 if (!in_array(
'prospectionstatus', $hiddenfields)) {
2643 print_liste_field_titre(
"OpportunityStatus",
"",
"",
"",
"",
'style="max-width: 100px"', $sortfield, $sortorder,
'center ');
2645 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 ');
2650 if (!in_array(
'plannedworkload', $hiddenfields)) {
2651 print_liste_field_titre(
"PlannedWorkload",
"",
"",
"",
"",
'style="max-width: 100px"', $sortfield, $sortorder,
'right ');
2653 if (!in_array(
'declaredprogress', $hiddenfields)) {
2654 print_liste_field_titre(
"%",
"",
"",
"",
"",
'', $sortfield, $sortorder,
'right ', $langs->trans(
"ProgressDeclared"));
2657 if (!in_array(
'projectstatus', $hiddenfields)) {
2662 while ($i < $nbofloop) {
2663 $objp = $db->fetch_object($resql);
2665 if ($max && $i >= $max) {
2668 $total_task += $objp->nb;
2669 $total_opp_amount += $objp->opp_amount;
2670 $opp_weighted_amount = $objp->opp_percent * $objp->opp_amount / 100;
2671 $ponderated_opp_amount +=
price2num($opp_weighted_amount);
2672 $plannedworkload = $objp->planned_workload;
2673 $total_plannedworkload += $plannedworkload;
2674 $declaredprogressworkload = $objp->declared_progess_workload;
2675 $total_declaredprogressworkload += $declaredprogressworkload;
2679 $projectstatic->id = $objp->projectid;
2680 $projectstatic->user_author_id = $objp->fk_user_creat;
2681 $projectstatic->public = $objp->public;
2684 $userAccess = $projectstatic->restrictedProjectArea($user);
2685 if ($userAccess >= 0) {
2686 $projectstatic->ref = $objp->ref;
2687 $projectstatic->status = $objp->status;
2688 $projectstatic->title = $objp->title;
2689 $projectstatic->date_end = $db->jdate($objp->datee);
2690 $projectstatic->date_start = $db->jdate($objp->dateo);
2692 print
'<tr class="oddeven">';
2694 print
'<td class="tdoverflowmax150">';
2695 print $projectstatic->getNomUrl(1,
'', 0,
'',
'-', 0, -1,
'nowraponall');
2696 if (!in_array(
'projectlabel', $hiddenfields)) {
2697 print
'<br><span class="opacitymedium small">'.dol_escape_htmltag($objp->title).
'</span>';
2701 print
'<td class="nowraponall tdoverflowmax100">';
2702 if ($objp->fk_soc > 0) {
2703 $thirdpartystatic->id = $objp->socid;
2704 $thirdpartystatic->name = $objp->socname;
2707 $thirdpartystatic->code_compta = $objp->code_compta;
2708 $thirdpartystatic->client = $objp->client;
2710 $thirdpartystatic->code_compta_fournisseur = $objp->code_compta_fournisseur;
2711 $thirdpartystatic->fournisseur = $objp->fournisseur;
2712 $thirdpartystatic->logo = $objp->logo;
2713 $thirdpartystatic->email = $objp->email;
2714 $thirdpartystatic->entity = $objp->entity;
2715 print $thirdpartystatic->getNomUrl(1);
2720 if (!in_array(
'prospectionstatus', $hiddenfields)) {
2721 print
'<td class="center tdoverflowmax75">';
2724 $oppStatusCode =
dol_getIdFromCode($db, $objp->opp_status,
'c_lead_status',
'rowid',
'code');
2725 if ($langs->trans(
"OppStatus".$oppStatusCode) !=
"OppStatus".$oppStatusCode) {
2726 print $langs->trans(
"OppStatus".$oppStatusCode);
2729 if (isset($statusOppList[$objp->opp_status])) {
2730 $oppStatusCode = $statusOppList[$objp->opp_status][
'code'];
2731 $oppStatusColor = $statusOppList[$objp->opp_status][
'color'];
2733 $oppStatusCode =
dol_getIdFromCode($db, $objp->opp_status,
'c_lead_status',
'rowid',
'code');
2734 $oppStatusColor =
'';
2736 if ($oppStatusCode) {
2737 if (!empty($oppStatusColor)) {
2738 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>';
2740 print
'<a href="'.dol_buildpath(
'/projet/list.php?search_opp_status='.$objp->opp_status, 1).
'" title="'.$langs->trans(
"OppStatus".$oppStatusCode).
'">'.$oppStatusCode.
'</a>';
2747 print
'<td class="right">';
2749 if ($objp->opp_percent && $objp->opp_amount) {
2750 $opp_weighted_amount = $objp->opp_percent * $objp->opp_amount / 100;
2751 $alttext = $langs->trans(
"OpportunityWeightedAmount").
' '.
price($opp_weighted_amount, 0,
'', 1, -1, 0, $conf->currency);
2752 $ponderated_opp_amount +=
price2num($opp_weighted_amount);
2754 if ($objp->opp_amount) {
2755 print
'<span class="amount" title="'.$alttext.
'">'.$form->textwithpicto(
price($objp->opp_amount, 0,
'', 1, -1, 0), $alttext).
'</span>';
2761 print
'<td class="right">'.$objp->nb.
'</td>';
2763 $plannedworkload = $objp->planned_workload;
2764 $total_plannedworkload += $plannedworkload;
2765 if (!in_array(
'plannedworkload', $hiddenfields)) {
2766 print
'<td class="right nowraponall">'.($plannedworkload ?
convertSecondToTime($plannedworkload) :
'').
'</td>';
2768 if (!in_array(
'declaredprogress', $hiddenfields)) {
2769 $declaredprogressworkload = $objp->declared_progess_workload;
2770 $total_declaredprogressworkload += $declaredprogressworkload;
2771 print
'<td class="right nowraponall">';
2773 print($plannedworkload ? round(100 * $declaredprogressworkload / $plannedworkload, 0).
'%' :
'');
2778 if (!in_array(
'projectstatus', $hiddenfields)) {
2779 print
'<td class="right">';
2780 print $projectstatic->getLibStatut(3);
2786 $total_task += $objp->nb;
2787 $total_opp_amount += $objp->opp_amount;
2794 print
'<tr class="oddeven">';
2795 print
'<td class="nowrap" colspan="5">';
2796 print
'<span class="opacitymedium">'.$langs->trans(
"More").
'...'.($othernb < $maxofloop ?
' ('.$othernb.
')' :
'').
'</span>';
2801 print
'<tr class="liste_total">';
2802 print
'<td>'.$langs->trans(
"Total").
"</td><td></td>";
2804 if (!in_array(
'prospectionstatus', $hiddenfields)) {
2805 print
'<td class="liste_total"></td>';
2807 print
'<td class="liste_total right">';
2809 print $form->textwithpicto(
price($total_opp_amount, 0,
'', 1, -1, 0), $langs->trans(
"OpportunityPonderatedAmountDesc").
' : '.
price($ponderated_opp_amount, 0,
'', 1, -1, 0, $conf->currency));
2813 print
'<td class="liste_total right">'.$total_task.
'</td>';
2814 if (!in_array(
'plannedworkload', $hiddenfields)) {
2815 print
'<td class="liste_total right">'.($total_plannedworkload ?
convertSecondToTime($total_plannedworkload) :
'').
'</td>';
2817 if (!in_array(
'declaredprogress', $hiddenfields)) {
2818 print
'<td class="liste_total right">'.($total_plannedworkload ? round(100 * $total_declaredprogressworkload / $total_plannedworkload, 0).
'%' :
'').
'</td>';
2821 if (!in_array(
'projectstatus', $hiddenfields)) {
2822 print
'<td class="liste_total"></td>';
2836 print
'<form method="get" action="'.$_SERVER[
"PHP_SELF"].
'">';
2837 print
'<table width="100%">';
2839 print
'<td>'.$langs->trans(
"Year").
'</td>';
2840 print
'<td class="right"><input type="text" size="4" class="flat" name="project_year_filter" value="'.((int) $project_year_filter).
'"/>';
2842 print
'</table></form>';
2855function getTaskProgressView($task, $label =
true, $progressNumber =
true, $hideOnProgressNull =
false, $spaced =
false)
2857 global $langs, $conf;
2861 $plannedworkloadoutputformat =
'allhourmin';
2862 $timespentoutputformat =
'allhourmin';
2864 $plannedworkloadoutputformat =
getDolGlobalString(
'PROJECT_PLANNED_WORKLOAD_FORMAT');
2870 if (empty($task->progress) && !empty($hideOnProgressNull)) {
2874 $spaced = !empty($spaced) ?
'spaced' :
'';
2879 $progressBarClass =
'progress-bar-info';
2880 $progressCalculated = 0;
2881 if ($task->planned_workload) {
2882 $progressCalculated = round(100 * (
float) $task->duration_effective / (
float) $task->planned_workload, 2);
2885 $warningRatio =
getDolGlobalString(
'PROJECT_TIME_SPEND_WARNING_PERCENT') ? (1 + $conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT / 100) : 1.10;
2887 $diffTitle =
'<br>'.$langs->trans(
'ProgressDeclared').
' : '.$task->progress.(isset($task->progress) ?
'%' :
'');
2888 $diffTitle .=
'<br>'.$langs->trans(
'ProgressCalculated').
' : '.$progressCalculated.(isset($progressCalculated) ?
'%' :
'');
2891 if ((
float) $progressCalculated > (float) ($task->progress * $warningRatio)) {
2892 $progressBarClass =
'progress-bar-danger';
2893 $title = $langs->trans(
'TheReportedProgressIsLessThanTheCalculatedProgressionByX', abs($task->progress - $progressCalculated).
' '.$langs->trans(
"point"));
2894 $diff =
'<span class="text-danger classfortooltip paddingrightonly" title="'.dol_htmlentities($title.$diffTitle).
'" ><i class="fa fa-caret-down"></i> '.($task->progress - $progressCalculated).
'%</span>';
2895 } elseif ((
float) $progressCalculated > (
float) $task->progress) {
2896 $progressBarClass =
'progress-bar-warning';
2897 $title = $langs->trans(
'TheReportedProgressIsLessThanTheCalculatedProgressionByX', abs($task->progress - $progressCalculated).
' '.$langs->trans(
"point"));
2898 $diff =
'<span class="text-warning classfortooltip paddingrightonly" title="'.dol_htmlentities($title.$diffTitle).
'" ><i class="fa fa-caret-left"></i> '.($task->progress - $progressCalculated).
'%</span>';
2900 $progressBarClass =
'progress-bar-success';
2901 $title = $langs->trans(
'TheReportedProgressIsMoreThanTheCalculatedProgressionByX', ($task->progress - $progressCalculated).
' '.$langs->trans(
"point"));
2902 $diff =
'<span class="text-success classfortooltip paddingrightonly" title="'.dol_htmlentities($title.$diffTitle).
'" ><i class="fa fa-caret-up"></i> '.($task->progress - $progressCalculated).
'%</span>';
2906 $out .=
'<div class="progress-group">';
2908 if ($label !==
false) {
2909 $out .=
' <span class="progress-text">';
2911 if ($label !==
true) {
2920 if ($progressNumber !==
false) {
2921 $out .=
' <span class="progress-number">';
2922 if ($progressNumber !==
true) {
2923 $out .= $progressNumber;
2925 if ($task->hasDelay()) {
2929 $url = DOL_URL_ROOT.
'/projet/tasks/time.php?id='.$task->id;
2931 $out .= !empty($diff) ? $diff.
' ' :
'';
2932 $out .=
'<a href="'.$url.
'" >';
2933 $out .=
'<b title="'.$langs->trans(
'TimeSpent').
'" >';
2934 if ($task->duration_effective) {
2944 $out .=
'<a href="'.$url.
'" >';
2945 $out .=
'<span title="'.$langs->trans(
'PlannedWorkload').
'" >';
2946 if ($task->planned_workload) {
2958 $out .=
' <div class="progress sm'.($spaced ? $spaced :
'').
'">';
2959 $diffval = (float) $task->progress - (
float) $progressCalculated;
2960 if ($diffval >= 0) {
2962 $out .=
' <div class="progress-bar '.$progressBarClass.
'" style="width: '.(float) $task->progress.
'%" title="'.(
float) $task->progress.
'%">';
2963 if (!empty($task->progress)) {
2964 $out .=
' <div class="progress-bar progress-bar-consumed" style="width: '.(float) ($progressCalculated / ((
float) $task->progress == 0 ? 1 : $task->progress) * 100).
'%" title="'.(float) $progressCalculated.
'%"></div>';
2969 $out .=
' <div class="progress-bar progress-bar-consumed-late" style="width: '.(float) $progressCalculated.
'%" title="'.(
float) $progressCalculated.
'%">';
2970 $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>';