41 global $db, $langs, $conf, $user;
46 $head[$h][0] = DOL_URL_ROOT.
'/projet/card.php?id='.((int) $project->id).($moreparam ?
'&'.$moreparam :
'');
47 $head[$h][1] = $langs->trans(
"Project");
48 $head[$h][2] =
'project';
52 require_once DOL_DOCUMENT_ROOT.
'/core/lib/memory.lib.php';
53 $cachekey =
'count_contacts_project_'.$project->id;
56 if (!is_null($dataretrieved)) {
57 $nbContacts = $dataretrieved;
59 $nbContacts = count($project->liste_contact(-1,
'internal')) + count($project->liste_contact(-1,
'external'));
62 $head[$h][0] = DOL_URL_ROOT.
'/projet/contact.php?id='.((int) $project->id).($moreparam ?
'&'.$moreparam :
'');
63 $head[$h][1] = $langs->trans(
"ProjectContact");
64 if ($nbContacts > 0) {
65 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbContacts.
'</span>';
67 $head[$h][2] =
'contact';
70 if (empty($conf->global->PROJECT_HIDE_TASKS)) {
74 require_once DOL_DOCUMENT_ROOT.
'/core/lib/memory.lib.php';
75 $cachekey =
'count_tasks_project_'.$project->id;
78 if (!is_null($dataretrieved)) {
79 $nbTasks = $dataretrieved;
81 require_once DOL_DOCUMENT_ROOT.
'/projet/class/task.class.php';
82 $taskstatic =
new Task($db);
83 $nbTasks = count($taskstatic->getTasksArray(0, 0, $project->id, 0, 0));
86 $head[$h][0] = DOL_URL_ROOT.
'/projet/tasks.php?id='.((int) $project->id).($moreparam ?
'&'.$moreparam :
'');
87 $head[$h][1] = $langs->trans(
"Tasks");
89 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.($nbTasks).
'</span>';
91 $head[$h][2] =
'tasks';
96 $cachekey =
'count_timespent_project_'.$project->id;
98 if (!is_null($dataretrieved)) {
99 $nbTimeSpent = $dataretrieved;
101 $sql =
"SELECT t.rowid";
104 $sql .=
" FROM ".MAIN_DB_PREFIX.
"element_time as t, ".MAIN_DB_PREFIX.
"projet_task as pt";
105 $sql .=
" WHERE t.fk_element = pt.rowid";
106 $sql .=
" AND t.elementtype = 'task'";
107 $sql .=
" AND pt.fk_projet =".((int) $project->id);
108 $resql = $db->query($sql);
110 $obj = $db->fetch_object($resql);
120 $head[$h][0] = DOL_URL_ROOT.
'/projet/tasks/time.php?withproject=1&projectid='.((int) $project->id).($moreparam ?
'&'.$moreparam :
'');
121 $head[$h][1] = $langs->trans(
"TimeSpent");
122 if ($nbTimeSpent > 0) {
123 $head[$h][1] .=
'<span class="badge marginleftonlyshort">...</span>';
125 $head[$h][2] =
'timespent';
129 if (isModEnabled(
"supplier_proposal") || isModEnabled(
"supplier_order") || isModEnabled(
"supplier_invoice")
130 || isModEnabled(
"propal") || isModEnabled(
'commande')
131 || isModEnabled(
'facture') || isModEnabled(
'contrat')
132 || isModEnabled(
'ficheinter') || isModEnabled(
'agenda') || isModEnabled(
'deplacement') || isModEnabled(
'stock')) {
135 $cachekey =
'count_elements_project_'.$project->id;
137 if (!is_null($dataretrieved)) {
138 $nbElements = $dataretrieved;
140 if (isModEnabled(
'stock')) {
141 $nbElements += $project->getElementCount(
'stock',
'entrepot',
'fk_project');
143 if (isModEnabled(
"propal")) {
144 $nbElements += $project->getElementCount(
'propal',
'propal');
146 if (isModEnabled(
'commande')) {
147 $nbElements += $project->getElementCount(
'order',
'commande');
149 if (isModEnabled(
'facture')) {
150 $nbElements += $project->getElementCount(
'invoice',
'facture');
152 if (isModEnabled(
'facture')) {
153 $nbElements += $project->getElementCount(
'invoice_predefined',
'facture_rec');
155 if (isModEnabled(
'supplier_proposal')) {
156 $nbElements += $project->getElementCount(
'proposal_supplier',
'supplier_proposal');
158 if (isModEnabled(
"supplier_order")) {
159 $nbElements += $project->getElementCount(
'order_supplier',
'commande_fournisseur');
161 if (isModEnabled(
"supplier_invoice")) {
162 $nbElements += $project->getElementCount(
'invoice_supplier',
'facture_fourn');
164 if (isModEnabled(
'contrat')) {
165 $nbElements += $project->getElementCount(
'contract',
'contrat');
167 if (isModEnabled(
'ficheinter')) {
168 $nbElements += $project->getElementCount(
'intervention',
'fichinter');
170 if (isModEnabled(
"expedition")) {
171 $nbElements += $project->getElementCount(
'shipping',
'expedition');
173 if (isModEnabled(
'mrp')) {
174 $nbElements += $project->getElementCount(
'mrp',
'mrp_mo',
'fk_project');
176 if (isModEnabled(
'deplacement')) {
177 $nbElements += $project->getElementCount(
'trip',
'deplacement');
179 if (isModEnabled(
'expensereport')) {
180 $nbElements += $project->getElementCount(
'expensereport',
'expensereport');
182 if (isModEnabled(
'don')) {
183 $nbElements += $project->getElementCount(
'donation',
'don');
185 if (isModEnabled(
'loan')) {
186 $nbElements += $project->getElementCount(
'loan',
'loan');
188 if (isModEnabled(
'tax')) {
189 $nbElements += $project->getElementCount(
'chargesociales',
'chargesociales');
191 if (isModEnabled(
'project')) {
192 $nbElements += $project->getElementCount(
'project_task',
'projet_task');
194 if (isModEnabled(
'stock')) {
195 $nbElements += $project->getElementCount(
'stock_mouvement',
'stock');
197 if (isModEnabled(
'salaries')) {
198 $nbElements += $project->getElementCount(
'salaries',
'payment_salary');
200 if (isModEnabled(
"banque")) {
201 $nbElements += $project->getElementCount(
'variouspayment',
'payment_various');
205 $head[$h][0] = DOL_URL_ROOT.
'/projet/element.php?id='.$project->id;
206 $head[$h][1] = $langs->trans(
"ProjectOverview");
207 if ($nbElements > 0) {
208 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbElements.
'</span>';
210 $head[$h][2] =
'element';
214 if (isModEnabled(
'ticket') && $user->hasRight(
'ticket',
'read')) {
215 require_once DOL_DOCUMENT_ROOT.
'/ticket/class/ticket.class.php';
216 $Tickettatic =
new Ticket($db);
217 $nbTicket = count($Tickettatic->getAllItemsLinkedByObjectID($project->id,
'*',
'fk_project',
'ticket'));
218 $head[$h][0] = DOL_URL_ROOT.
'/ticket/list.php?projectid='.((int) $project->id);
219 $head[$h][1] = $langs->trans(
"Ticket");
221 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.($nbTicket).
'</span>';
223 $head[$h][2] =
'ticket';
227 if (isModEnabled(
'eventorganization') && !empty($project->usage_organize_event)) {
228 $langs->load(
'eventorganization');
229 $head[$h][0] = DOL_URL_ROOT .
'/eventorganization/conferenceorbooth_list.php?projectid=' . $project->id;
230 $head[$h][1] = $langs->trans(
"EventOrganization");
233 $nbConfOrBooth = 0; $nbAttendees = 0;
234 require_once DOL_DOCUMENT_ROOT.
'/core/lib/memory.lib.php';
235 $cachekey =
'count_conferenceorbooth_'.$project->id;
237 if (!is_null($dataretrieved)) {
238 $nbConfOrBooth = $dataretrieved;
240 require_once DOL_DOCUMENT_ROOT.
'/eventorganization/class/conferenceorbooth.class.php';
242 $result = $conforbooth->fetchAll(
'',
'', 0, 0, array(
't.fk_project'=>$project->id));
244 if (!is_array($result) && $result<0) {
247 $nbConfOrBooth = count($result);
251 $cachekey =
'count_attendees_'.$project->id;
253 if (!is_null($dataretrieved)) {
254 $nbAttendees = $dataretrieved;
256 require_once DOL_DOCUMENT_ROOT.
'/eventorganization/class/conferenceorboothattendee.class.php';
258 $result = $conforboothattendee->fetchAll(
'',
'', 0, 0, array(
't.fk_project'=>$project->id));
260 if (!is_array($result) && $result<0) {
261 setEventMessages($conforboothattendee->error, $conforboothattendee->errors,
'errors');
263 $nbAttendees = count($result);
267 if ($nbConfOrBooth > 0 || $nbAttendees > 0) {
268 $head[$h][1] .=
'<span class="badge marginleftonlyshort">';
269 $head[$h][1] .=
'<span title="'.dol_escape_htmltag($langs->trans(
"ConferenceOrBooth")).
'">'.$nbConfOrBooth.
'</span>';
270 if ($nbConfOrBooth > 0 && $nbAttendees > 0) {
271 $head[$h][1] .=
' + ';
273 $head[$h][1] .=
'<span title="'.dol_escape_htmltag($langs->trans(
"Attendees")).
'">'.$nbAttendees.
'</span>';
274 $head[$h][1] .=
'</span>';
276 $head[$h][2] =
'eventorganisation';
287 if (empty($conf->global->MAIN_DISABLE_NOTES_TAB)) {
289 if (!empty($project->note_private)) {
292 if (!empty($project->note_public)) {
295 $head[$h][0] = DOL_URL_ROOT.
'/projet/note.php?id='.$project->id;
296 $head[$h][1] = $langs->trans(
'Notes');
298 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbNote.
'</span>';
300 $head[$h][2] =
'notes';
307 require_once DOL_DOCUMENT_ROOT.
'/core/lib/memory.lib.php';
308 $cachekey =
'count_attached_project_'.$project->id;
310 if (!is_null($dataretrieved)) {
311 $totalAttached = $dataretrieved;
313 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
314 require_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
315 $upload_dir = $conf->project->multidir_output[$project->entity].
"/".
dol_sanitizeFileName($project->ref);
316 $nbFiles = count(
dol_dir_list($upload_dir,
'files', 0,
'',
'(\.meta|_preview.*\.png)$'));
317 $nbLinks =
Link::count($db, $project->element, $project->id);
318 $totalAttached = $nbFiles + $nbLinks;
321 $head[$h][0] = DOL_URL_ROOT.
'/projet/document.php?id='.$project->id;
322 $head[$h][1] = $langs->trans(
'Documents');
323 if (($totalAttached) > 0) {
324 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.($totalAttached).
'</span>';
326 $head[$h][2] =
'document';
330 if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT)) {
333 require_once DOL_DOCUMENT_ROOT.
'/core/lib/memory.lib.php';
334 $cachekey =
'count_attached_project_'.$project->id;
336 if (!is_null($dataretrieved)) {
337 $nbComments = $dataretrieved;
339 $nbComments = $project->getNbComments();
342 $head[$h][0] = DOL_URL_ROOT.
'/projet/comment.php?id='.$project->id;
343 $head[$h][1] = $langs->trans(
"CommentLink");
344 if ($nbComments > 0) {
345 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbComments.
'</span>';
347 $head[$h][2] =
'project_comment';
351 $head[$h][0] = DOL_URL_ROOT.
'/projet/messaging.php?id='.$project->id;
352 $head[$h][1] = $langs->trans(
"Events");
353 if (isModEnabled(
'agenda') && ($user->hasRight(
'agenda',
'myactions',
'read') || $user->hasRight(
'agenda',
'allactions',
'read'))) {
355 $head[$h][1] .= $langs->trans(
"Agenda");
357 $head[$h][2] =
'agenda';
376 global $db, $langs, $conf, $user;
380 $head[$h][0] = DOL_URL_ROOT.
'/projet/tasks/task.php?id='.$object->id.(GETPOST(
'withproject') ?
'&withproject=1' :
'');
381 $head[$h][1] = $langs->trans(
"Task");
382 $head[$h][2] =
'task_task';
385 $nbContact = count($object->liste_contact(-1,
'internal')) + count($object->liste_contact(-1,
'external'));
386 $head[$h][0] = DOL_URL_ROOT.
'/projet/tasks/contact.php?id='.$object->id.(GETPOST(
'withproject') ?
'&withproject=1' :
'');
387 $head[$h][1] = $langs->trans(
"TaskRessourceLinks");
388 if ($nbContact > 0) {
389 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbContact.
'</span>';
391 $head[$h][2] =
'task_contact';
396 $sql =
"SELECT t.rowid";
399 $sql .=
" FROM ".MAIN_DB_PREFIX.
"element_time as t";
400 $sql .=
" WHERE t.elementtype='task' AND t.fk_element = ".((int) $object->id);
401 $resql = $db->query($sql);
403 $obj = $db->fetch_object($resql);
411 $head[$h][0] = DOL_URL_ROOT.
'/projet/tasks/time.php?id='.urlencode($object->id).(GETPOST(
'withproject') ?
'&withproject=1' :
'');
412 $head[$h][1] = $langs->trans(
"TimeSpent");
413 if ($nbTimeSpent > 0) {
414 $head[$h][1] .=
'<span class="badge marginleftonlyshort">...</span>';
416 $head[$h][2] =
'task_time';
425 if (empty($conf->global->MAIN_DISABLE_NOTES_TAB)) {
427 if (!empty($object->note_private)) {
430 if (!empty($object->note_public)) {
433 $head[$h][0] = DOL_URL_ROOT.
'/projet/tasks/note.php?id='.urlencode($object->id).(GETPOST(
'withproject') ?
'&withproject=1' :
'');
434 $head[$h][1] = $langs->trans(
'Notes');
436 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbNote.
'</span>';
438 $head[$h][2] =
'task_notes';
442 $head[$h][0] = DOL_URL_ROOT.
'/projet/tasks/document.php?id='.$object->id.(GETPOST(
'withproject') ?
'&withproject=1' :
'');
444 include_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
445 include_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
446 $nbFiles = count(
dol_dir_list($filesdir,
'files', 0,
'',
'(\.meta|_preview.*\.png)$'));
447 $nbLinks =
Link::count($db, $object->element, $object->id);
448 $head[$h][1] = $langs->trans(
'Documents');
449 if (($nbFiles + $nbLinks) > 0) {
450 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).
'</span>';
452 $head[$h][2] =
'task_document';
456 if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_TASK)) {
457 $nbComments = $object->getNbComments();
458 $head[$h][0] = DOL_URL_ROOT.
'/projet/tasks/comment.php?id='.$object->id.(GETPOST(
'withproject') ?
'&withproject=1' :
'');
459 $head[$h][1] = $langs->trans(
"CommentLink");
460 if ($nbComments > 0) {
461 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbComments.
'</span>';
463 $head[$h][2] =
'task_comment';
601function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$taskrole, $projectsListId =
'', $addordertick = 0, $projectidfortotallink = 0, $dummy =
'', $showbilltime = 0, $arrayfields = array(), $arrayofselected = array())
603 global $user, $langs, $conf, $db, $hookmanager;
604 global $projectstatic, $taskstatic, $extrafields;
608 $projectsArrayId = explode(
',', $projectsListId);
610 $numlines = count($lines);
613 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;
617 $total_projectlinesa_spent = 0;
618 $total_projectlinesa_planned = 0;
619 $total_projectlinesa_spent_if_planned = 0;
620 $total_projectlinesa_declared_if_planned = 0;
621 $total_projectlinesa_tobill = 0;
622 $total_projectlinesa_billed = 0;
623 $total_budget_amount = 0;
624 $totalarray = array();
627 for ($i = 0; $i < $numlines; $i++) {
628 if ($parent == 0 && $level >= 0) {
634 if ($lines[$i]->fk_task_parent == $parent || $level < 0) {
640 if (is_array($taskrole)) {
642 if (!isset($taskrole[$lines[$i]->
id]) && $lines[$i]->
id != $lines[$i]->fk_task_parent) {
644 $foundtaskforuserdeeper = 0;
647 if ($foundtaskforuserdeeper > 0) {
656 if (empty($user->rights->projet->all->lire)) {
658 if (!in_array($lines[$i]->fk_project, $projectsArrayId)) {
669 if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid) {
671 $lastprojectid = $lines[$i]->fk_project;
674 print
'<tr class="oddeven" id="row-'.$lines[$i]->id.
'">'.
"\n";
676 $projectstatic->id = $lines[$i]->fk_project;
677 $projectstatic->ref = $lines[$i]->projectref;
678 $projectstatic->public = $lines[$i]->public;
679 $projectstatic->title = $lines[$i]->projectlabel;
680 $projectstatic->usage_bill_time = $lines[$i]->usage_bill_time;
681 $projectstatic->status = $lines[$i]->projectstatus;
683 $taskstatic->id = $lines[$i]->id;
684 $taskstatic->ref = $lines[$i]->ref;
685 $taskstatic->label = (!empty($taskrole[$lines[$i]->
id]) ? $langs->trans(
"YourRole").
': '.$taskrole[$lines[$i]->id] :
'');
686 $taskstatic->projectstatus = $lines[$i]->projectstatus;
687 $taskstatic->progress = $lines[$i]->progress;
688 $taskstatic->fk_statut = $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) || !empty($user->rights->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';
784 if (!empty($conf->global->PROJECT_PLANNED_WORKLOAD_FORMAT)) {
785 $plannedworkloadoutputformat = $conf->global->PROJECT_PLANNED_WORKLOAD_FORMAT;
787 if (!empty($conf->global->PROJECT_TIMES_SPENT_FORMAT)) {
788 $timespentoutputformat = $conf->global->PROJECT_TIME_SPENT_FORMAT;
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'])) {
828 $s =
''; $shtml =
'';
829 if ($lines[$i]->planned_workload || $lines[$i]->duration_effective) {
830 if ($lines[$i]->planned_workload) {
831 $s = round(100 * $lines[$i]->duration_effective / $lines[$i]->planned_workload, 2).
' %';
834 $s = $langs->trans(
'WorkloadNotDefined');
835 $shtml =
'<span class="opacitymedium">'.$s.
'</span>';
838 print
'<td class="right tdoverflowmax100" title="'.dol_escape_htmltag($s).
'">';
844 if (count($arrayfields) > 0 && !empty($arrayfields[
't.progress'][
'checked'])) {
845 print
'<td class="right">';
846 if ($lines[$i]->progress !=
'') {
853 if (count($arrayfields) > 0 && !empty($arrayfields[
't.progress_summary'][
'checked'])) {
854 print
'<td class="right">';
855 if ($lines[$i]->progress !=
'' && $lines[$i]->duration_effective) {
863 if (count($arrayfields) > 0 && !empty($arrayfields[
't.tobill'][
'checked'])) {
864 print
'<td class="right">';
865 if ($lines[$i]->usage_bill_time) {
867 $total_projectlinesa_tobill += $lines[$i]->tobill;
869 print
'<span class="opacitymedium">'.$langs->trans(
"NA").
'</span>';
875 if (count($arrayfields) > 0 && !empty($arrayfields[
't.billed'][
'checked'])) {
876 print
'<td class="right">';
877 if ($lines[$i]->usage_bill_time) {
879 $total_projectlinesa_billed += $lines[$i]->billed;
881 print
'<span class="opacitymedium">'.$langs->trans(
"NA").
'</span>';
888 if (count($arrayfields) > 0 && !empty($arrayfields[
't.budget_amount'][
'checked'])) {
889 print
'<td class="center">';
890 if ($lines[$i]->budget_amount) {
891 print
'<span class="amount">'.price($lines[$i]->budget_amount, 0, $langs, 1, 0, 0, $conf->currency).
'</span>';
892 $total_budget_amount += $lines[$i]->budget_amount;
898 if (count($arrayfields) > 0 && !empty($arrayfields[
'c.assigned'][
'checked'])) {
899 print
'<td class="center">';
901 foreach (array(
'internal',
'external') as $source) {
903 $tab = $lines[$i]->liste_contact(-1, $source, 0,
'', 1);
905 $numcontact = count($tab);
906 if (!empty($numcontact)) {
907 foreach ($tab as $contacttask) {
909 if ($source ==
'internal') {
914 $c->fetch($contacttask[
'id']);
915 if (!empty($c->photo)) {
916 if (get_class($c) ==
'User') {
917 print $c->getNomUrl(-2,
'', 0, 0, 24, 1,
'', ($ifisrt ?
'' :
'notfirst'));
919 print $c->getNomUrl(-2,
'', 0,
'', -1, 0, ($ifisrt ?
'' :
'notfirst'));
922 if (get_class($c) ==
'User') {
923 print $c->getNomUrl(2,
'', 0, 0, 24, 1,
'', ($ifisrt ?
'' :
'notfirst'));
925 print $c->getNomUrl(2,
'', 0,
'', -1, 0, ($ifisrt ?
'' :
'notfirst'));
936 $extrafieldsobjectkey = $taskstatic->table_element;
937 $extrafieldsobjectprefix =
'efpt.';
938 $obj = $lines[$i]->obj;
939 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
941 $parameters = array(
'arrayfields'=>$arrayfields,
'obj'=>$lines[$i]);
942 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters);
943 print $hookmanager->resPrint;
946 print
'<td class="tdlineupdown center"></td>';
950 print
'<td class="nowrap center">';
952 if (in_array($lines[$i]->
id, $arrayofselected)) {
955 print
'<input id="cb' . $lines[$i]->id .
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="' . $lines[$i]->id .
'"' . ($selected ?
' checked="checked"' :
'') .
'>';
962 if (!$showlineingray) {
968 if ($lines[$i]->
id) {
969 projectLinesa($inc, $lines[$i]->
id, $lines, $level, $var, $showproject, $taskrole, $projectsListId, $addordertick, $projectidfortotallink,
'', $showbilltime, $arrayfields);
974 $total_projectlinesa_spent += $lines[$i]->duration_effective;
975 $total_projectlinesa_planned += $lines[$i]->planned_workload;
976 if ($lines[$i]->planned_workload) {
977 $total_projectlinesa_spent_if_planned += $lines[$i]->duration_effective;
979 if ($lines[$i]->planned_workload) {
980 $total_projectlinesa_declared_if_planned += $lines[$i]->planned_workload * $lines[$i]->progress / 100;
989 if (($total_projectlinesa_planned > 0 || $total_projectlinesa_spent > 0 || $total_projectlinesa_tobill > 0 || $total_projectlinesa_billed > 0 || $total_budget_amount > 0)
991 print
'<tr class="liste_total nodrag nodrop">';
994 print
'<td class="liste_total"></td>';
997 print
'<td class="liste_total">'.$langs->trans(
"Total").
'</td>';
999 print
'<td></td><td></td>';
1001 if (count($arrayfields) > 0 && !empty($arrayfields[
't.label'][
'checked'])) {
1004 if (count($arrayfields) > 0 && !empty($arrayfields[
't.description'][
'checked'])) {
1007 if (count($arrayfields) > 0 && !empty($arrayfields[
't.dateo'][
'checked'])) {
1010 if (count($arrayfields) > 0 && !empty($arrayfields[
't.datee'][
'checked'])) {
1013 if (count($arrayfields) > 0 && !empty($arrayfields[
't.planned_workload'][
'checked'])) {
1014 print
'<td class="nowrap liste_total right">';
1018 if (count($arrayfields) > 0 && !empty($arrayfields[
't.duration_effective'][
'checked'])) {
1019 print
'<td class="nowrap liste_total right">';
1020 if ($projectidfortotallink > 0) {
1021 print
'<a href="'.DOL_URL_ROOT.
'/projet/tasks/time.php?projectid='.$projectidfortotallink.($showproject ?
'' :
'&withproject=1').
'">';
1024 if ($projectidfortotallink > 0) {
1030 if ($total_projectlinesa_planned) {
1031 $totalAverageDeclaredProgress = round(100 * $total_projectlinesa_declared_if_planned / $total_projectlinesa_planned, 2);
1032 $totalCalculatedProgress = round(100 * $total_projectlinesa_spent / $total_projectlinesa_planned, 2);
1035 $warningRatio = !empty($conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT) ? (1 + $conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT / 100) : 1.10;
1038 $progressBarClass =
'progress-bar-info';
1039 $badgeClass =
'badge ';
1041 if ($totalCalculatedProgress > $totalAverageDeclaredProgress) {
1042 $progressBarClass =
'progress-bar-danger';
1043 $badgeClass .=
'badge-danger';
1044 } elseif ($totalCalculatedProgress * $warningRatio >= $totalAverageDeclaredProgress) {
1045 $progressBarClass =
'progress-bar-warning';
1046 $badgeClass .=
'badge-warning';
1048 $progressBarClass =
'progress-bar-success';
1049 $badgeClass .=
'badge-success';
1054 if (count($arrayfields) > 0 && !empty($arrayfields[
't.progress_calculated'][
'checked'])) {
1055 print
'<td class="nowrap liste_total right">';
1056 if ($total_projectlinesa_planned) {
1057 print $totalCalculatedProgress.
' %';
1063 if (count($arrayfields) > 0 && !empty($arrayfields[
't.progress'][
'checked'])) {
1064 print
'<td class="nowrap liste_total right">';
1065 if ($total_projectlinesa_planned) {
1066 print
'<span class="'.$badgeClass.
'" >'.$totalAverageDeclaredProgress.
' %</span>';
1073 if (count($arrayfields) > 0 && !empty($arrayfields[
't.progress_summary'][
'checked'])) {
1074 print
'<td class="right">';
1075 if ($total_projectlinesa_planned) {
1077 print
' <div class="progress sm" title="'.$totalAverageDeclaredProgress.
'%" >';
1078 print
' <div class="progress-bar '.$progressBarClass.
'" style="width: '.$totalAverageDeclaredProgress.
'%"></div>';
1085 if ($showbilltime) {
1086 if (count($arrayfields) > 0 && !empty($arrayfields[
't.tobill'][
'checked'])) {
1087 print
'<td class="nowrap liste_total right">';
1091 if (count($arrayfields) > 0 && !empty($arrayfields[
't.billed'][
'checked'])) {
1092 print
'<td class="nowrap liste_total right">';
1099 if (count($arrayfields) > 0 && !empty($arrayfields[
't.budget_amount'][
'checked'])) {
1100 print
'<td class="nowrap liste_total center">';
1101 if (strcmp($total_budget_amount,
'')) {
1102 print
price($total_budget_amount, 0, $langs, 1, 0, 0, $conf->currency);
1108 if (!empty($conf->global->PROJECT_SHOW_CONTACTS_IN_LIST)) {
1112 if (count($arrayfields) > 0 && !empty($arrayfields[
'c.assigned'][
'checked'])) {
1117 foreach ($extrafields->attributes[
'projet_task'][
'totalizable'] as $key => $value) {
1118 if (!empty($arrayfields[
'efpt.'.$key][
'checked']) && $arrayfields[
'efpt.'.$key][
'checked'] == 1) {
1119 print
'<td class="right">';
1121 print empty($totalarray[
'totalizable'][$key][
'total']) ?
'' : $totalarray[
'totalizable'][$key][
'total'];
1128 print
'<td class="liste_total"></td>';
1131 print
'<td class="liste_total"></td>';
1158function projectLinesPerAction(&$inc, $parent, $fuser, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask, $preselectedday, &$isavailable, $oldprojectforbreak = 0)
1160 global $conf, $db, $user, $langs;
1161 global $form, $formother, $projectstatic, $taskstatic, $thirdpartystatic;
1164 $totalforeachline = array();
1165 $workloadforid = array();
1166 $lineswithoutlevel0 = array();
1168 $numlines = count($lines);
1172 for ($i = 0; $i < $numlines; $i++) {
1173 if ($lines[$i]->fk_task_parent) {
1174 $lineswithoutlevel0[] = $lines[$i];
1179 if (empty($oldprojectforbreak)) {
1180 $oldprojectforbreak = (empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT) ? 0 : -1);
1184 for ($i = 0; $i < $numlines; $i++) {
1192 if (empty($mine) || !empty($tasksrole[$lines[$i]->
id])) {
1196 if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid) {
1197 $lastprojectid = $lines[$i]->fk_project;
1198 if ($preselectedday) {
1199 $projectstatic->id = $lines[$i]->fk_project;
1203 if (empty($workloadforid[$projectstatic->id])) {
1204 if ($preselectedday) {
1205 $projectstatic->loadTimeSpent($preselectedday, 0, $fuser->id);
1206 $workloadforid[$projectstatic->id] = 1;
1210 $projectstatic->id = $lines[$i]->fk_project;
1211 $projectstatic->ref = $lines[$i]->project_ref;
1212 $projectstatic->title = $lines[$i]->project_label;
1213 $projectstatic->public = $lines[$i]->public;
1214 $projectstatic->status = $lines[$i]->project->status;
1216 $taskstatic->id = $lines[$i]->fk_statut;
1217 $taskstatic->ref = ($lines[$i]->task_ref ? $lines[$i]->task_ref : $lines[$i]->task_id);
1218 $taskstatic->label = $lines[$i]->task_label;
1219 $taskstatic->date_start = $lines[$i]->date_start;
1220 $taskstatic->date_end = $lines[$i]->date_end;
1222 $thirdpartystatic->id = $lines[$i]->socid;
1223 $thirdpartystatic->name = $lines[$i]->thirdparty_name;
1224 $thirdpartystatic->email = $lines[$i]->thirdparty_email;
1226 if (empty($oldprojectforbreak) || ($oldprojectforbreak != -1 && $oldprojectforbreak != $projectstatic->id)) {
1227 print
'<tr class="oddeven trforbreak nobold">'.
"\n";
1228 print
'<td colspan="11">';
1229 print $projectstatic->getNomUrl(1,
'', 0, $langs->transnoentitiesnoconv(
"YourRole").
': '.$projectsrole[$lines[$i]->fk_project]);
1230 if ($projectstatic->title) {
1232 print $projectstatic->title;
1238 if ($oldprojectforbreak != -1) {
1239 $oldprojectforbreak = $projectstatic->id;
1242 print
'<tr class="oddeven">'.
"\n";
1253 if ($oldprojectforbreak == -1) {
1254 print $projectstatic->getNomUrl(1,
'', 0, $langs->transnoentitiesnoconv(
"YourRole").
': '.$projectsrole[$lines[$i]->fk_project]);
1255 print
'<br>'.$projectstatic->title;
1260 print
'<td class="tdoverflowmax100">';
1261 if ($thirdpartystatic->id > 0) {
1262 print $thirdpartystatic->getNomUrl(1,
'project', 10);
1268 print
'<!-- Task id = '.$lines[$i]->id.
' -->';
1269 for ($k = 0; $k < $level; $k++) {
1270 print
" ";
1272 print $taskstatic->getNomUrl(1,
'withproject',
'time');
1275 for ($k = 0; $k < $level; $k++) {
1276 print
" ";
1278 print $taskstatic->label;
1285 print
'<td class="center">';
1289 $disabledproject = 1;
1295 if ($lines[$i]->
public || !empty($projectsrole[$lines[$i]->fk_project]) || $user->rights->projet->all->creer) {
1296 $disabledproject = 0;
1300 if ($restricteditformytask && empty($tasksrole[$lines[$i]->
id])) {
1305 print
'<td class="nowrap center">';
1310 if (!$isavailable[$preselectedday][
'morning'] && !$isavailable[$preselectedday][
'afternoon']) {
1311 $cssonholiday .=
'onholidayallday ';
1312 } elseif (!$isavailable[$preselectedday][
'morning']) {
1313 $cssonholiday .=
'onholidaymorning ';
1314 } elseif (!$isavailable[$preselectedday][
'afternoon']) {
1315 $cssonholiday .=
'onholidayafternoon ';
1319 print
'<td class="duration'.($cssonholiday ?
' '.$cssonholiday :
'').
' center">';
1321 $dayWorkLoad = $lines[$i]->timespent_duration;
1322 $totalforeachline[$preselectedday] += $lines[$i]->timespent_duration;
1325 if ($dayWorkLoad > 0) {
1334 print
'<td class="center">';
1335 print
'<textarea name="'.$lines[$i]->id.
'note" rows="'.ROWS_2.
'" id="'.$lines[$i]->id.
'note"'.($disabledtask ?
' disabled="disabled"' :
'').
'>';
1336 print $lines[$i]->timespent_note;
1337 print
'</textarea>';
1341 print
'<td class="right">';
1361 return $totalforeachline;
1384function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask, $preselectedday, &$isavailable, $oldprojectforbreak = 0, $arrayfields = array(), $extrafields =
null)
1386 global $conf, $db, $user, $langs;
1387 global $form, $formother, $projectstatic, $taskstatic, $thirdpartystatic;
1390 $totalforeachday = array();
1391 $workloadforid = array();
1392 $lineswithoutlevel0 = array();
1394 $numlines = count($lines);
1398 for ($i = 0; $i < $numlines; $i++) {
1399 if ($lines[$i]->fk_task_parent) {
1400 $lineswithoutlevel0[] = $lines[$i];
1405 if (empty($oldprojectforbreak)) {
1406 $oldprojectforbreak = (empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT) ? 0 : -1);
1409 $restrictBefore =
null;
1411 if (!empty($conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS)) {
1412 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
1417 for ($i = 0; $i < $numlines; $i++) {
1422 if ($lines[$i]->fk_task_parent == $parent) {
1426 if (empty($mine) || !empty($tasksrole[$lines[$i]->
id])) {
1429 if ($restricteditformytask == 2 && empty($tasksrole[$lines[$i]->
id])) {
1434 if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid) {
1435 $lastprojectid = $lines[$i]->fk_project;
1436 if ($preselectedday) {
1437 $projectstatic->id = $lines[$i]->fk_project;
1441 if (empty($workloadforid[$projectstatic->id])) {
1442 if ($preselectedday) {
1443 $projectstatic->loadTimeSpent($preselectedday, 0, $fuser->id);
1444 $workloadforid[$projectstatic->id] = 1;
1448 $projectstatic->id = $lines[$i]->fk_project;
1449 $projectstatic->ref = $lines[$i]->projectref;
1450 $projectstatic->title = $lines[$i]->projectlabel;
1451 $projectstatic->public = $lines[$i]->public;
1452 $projectstatic->status = $lines[$i]->projectstatus;
1454 $taskstatic->id = $lines[$i]->id;
1455 $taskstatic->ref = ($lines[$i]->ref ? $lines[$i]->ref : $lines[$i]->id);
1456 $taskstatic->label = $lines[$i]->label;
1457 $taskstatic->date_start = $lines[$i]->date_start;
1458 $taskstatic->date_end = $lines[$i]->date_end;
1460 $thirdpartystatic->id = $lines[$i]->socid;
1461 $thirdpartystatic->name = $lines[$i]->thirdparty_name;
1462 $thirdpartystatic->email = $lines[$i]->thirdparty_email;
1464 if (empty($oldprojectforbreak) || ($oldprojectforbreak != -1 && $oldprojectforbreak != $projectstatic->id)) {
1466 if (!empty($arrayfields[
't.planned_workload'][
'checked'])) {
1469 if (!empty($arrayfields[
't.progress'][
'checked'])) {
1472 foreach ($arrayfields as $key => $val) {
1473 if ($val[
'checked'] && substr($key, 0, 5) ==
'efpt.') {
1478 print
'<tr class="oddeven trforbreak nobold">'.
"\n";
1479 print
'<td colspan="'.(7 + $addcolspan).
'">';
1480 print $projectstatic->getNomUrl(1,
'', 0,
'<strong>'.$langs->transnoentitiesnoconv(
"YourRole").
':</strong> '.$projectsrole[$lines[$i]->fk_project]);
1481 if ($thirdpartystatic->id > 0) {
1482 print
' - '.$thirdpartystatic->getNomUrl(1);
1484 if ($projectstatic->title) {
1486 print
'<span class="secondary">'.$projectstatic->title.
'</span>';
1553 if ($oldprojectforbreak != -1) {
1554 $oldprojectforbreak = $projectstatic->id;
1557 print
'<tr class="oddeven" data-taskid="'.$lines[$i]->id.
'">'.
"\n";
1567 if (!empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)) {
1569 if ($oldprojectforbreak == -1) {
1570 print $projectstatic->getNomUrl(1,
'', 0, $langs->transnoentitiesnoconv(
"YourRole").
': '.$projectsrole[$lines[$i]->fk_project]);
1576 if (!empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)) {
1577 print
'<td class="tdoverflowmax100">';
1578 if ($thirdpartystatic->id > 0) {
1579 print $thirdpartystatic->getNomUrl(1,
'project', 10);
1586 print
'<!-- Task id = '.$lines[$i]->id.
' -->';
1587 for ($k = 0; $k < $level; $k++) {
1588 print
'<div class="marginleftonly">';
1590 print $taskstatic->getNomUrl(1,
'withproject',
'time');
1593 print
'<span class="opacitymedium">'.$taskstatic->label.
'</a>';
1594 for ($k = 0; $k < $level; $k++) {
1600 $extrafieldsobjectkey =
'projet_task';
1601 $extrafieldsobjectprefix =
'efpt.';
1602 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
1605 if (!empty($arrayfields[
't.planned_workload'][
'checked'])) {
1606 print
'<td class="leftborder plannedworkload right">';
1607 if ($lines[$i]->planned_workload) {
1616 if (!empty($arrayfields[
't.progress'][
'checked'])) {
1617 print
'<td class="right">';
1618 print $formother->select_percent($lines[$i]->progress, $lines[$i]->
id.
'progress');
1622 if (!empty($arrayfields[
'timeconsumed'][
'checked'])) {
1624 print
'<td class="right">';
1626 if ($lines[$i]->duration_effective) {
1627 print
'<a href="'.DOL_URL_ROOT.
'/projet/tasks/time.php?id='.$lines[$i]->id.
'">';
1636 print
'<td class="right">';
1637 $tmptimespent = $taskstatic->getSummaryOfTimeSpent($fuser->id);
1638 if ($tmptimespent[
'total_duration']) {
1646 $disabledproject = 1;
1652 if ($lines[$i]->
public || !empty($projectsrole[$lines[$i]->fk_project]) || $user->rights->projet->all->creer) {
1653 $disabledproject = 0;
1657 if ($restricteditformytask && empty($tasksrole[$lines[$i]->
id])) {
1661 if ($restrictBefore && $preselectedday < $restrictBefore) {
1666 print
'<td class="nowraponall leftborder center minwidth150imp">';
1667 $tableCell = $form->selectDate($preselectedday, $lines[$i]->
id, 1, 1, 2,
"addtime", 0, 0, $disabledtask);
1672 if (!$isavailable[$preselectedday][
'morning'] && !$isavailable[$preselectedday][
'afternoon']) {
1673 $cssonholiday .=
'onholidayallday ';
1674 } elseif (!$isavailable[$preselectedday][
'morning']) {
1675 $cssonholiday .=
'onholidaymorning ';
1676 } elseif (!$isavailable[$preselectedday][
'afternoon']) {
1677 $cssonholiday .=
'onholidayafternoon ';
1683 $idw = ($tmparray[
'wday'] - (empty($conf->global->MAIN_START_WEEK) ? 0 : 1));
1684 global $numstartworkingday, $numendworkingday;
1686 if ((($idw + 1) < $numstartworkingday) || (($idw + 1) > $numendworkingday)) {
1687 $cssweekend =
'weekend';
1691 print
'<td class="center duration'.($cssonholiday ?
' '.$cssonholiday :
'').($cssweekend ?
' '.$cssweekend :
'').
'">';
1692 $dayWorkLoad = empty($projectstatic->weekWorkLoadPerTask[$preselectedday][$lines[$i]->id]) ? 0 : $projectstatic->weekWorkLoadPerTask[$preselectedday][$lines[$i]->id];
1693 if (!isset($totalforeachday[$preselectedday])) {
1694 $totalforeachday[$preselectedday] = 0;
1696 $totalforeachday[$preselectedday] += $dayWorkLoad;
1699 if ($dayWorkLoad > 0) {
1706 $tableCell .=
'<span class="timesheetalreadyrecorded" title="texttoreplace"><input type="text" class="center" size="2" disabled id="timespent['.$inc.
']['.$idw.
']" name="task['.$lines[$i]->id.
']['.$idw.
']" value="'.$alreadyspent.
'"></span>';
1707 $tableCell .=
'<span class="hideonsmartphone"> + </span>';
1709 $tableCell .= $form->select_duration($lines[$i]->
id.
'duration',
'', $disabledtask,
'text', 0, 1);
1716 print
'<td class="center">';
1717 print
'<textarea name="'.$lines[$i]->id.
'note" rows="'.ROWS_2.
'" id="'.$lines[$i]->id.
'note"'.($disabledtask ?
' disabled="disabled"' :
'').
'>';
1718 print
'</textarea>';
1722 print
'<td class="right">';
1723 if ((!$lines[$i]->
public) && $disabledproject) {
1724 print $form->textwithpicto(
'', $langs->trans(
"UserIsNotContactOfProject"));
1725 } elseif ($disabledtask) {
1726 $titleassigntask = $langs->trans(
"AssignTaskToMe");
1727 if ($fuser->id != $user->id) {
1728 $titleassigntask = $langs->trans(
"AssignTaskToUser",
'...');
1731 print $form->textwithpicto(
'', $langs->trans(
"TaskIsNotAssignedToUser", $titleassigntask));
1740 if ($lines[$i]->
id > 0) {
1743 $ret =
projectLinesPerDay($inc, $lines[$i]->
id, $fuser, ($parent == 0 ? $lineswithoutlevel0 : $lines), $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $preselectedday, $isavailable, $oldprojectforbreak, $arrayfields, $extrafields);
1746 foreach ($ret as $key => $val) {
1747 $totalforeachday[$key] += $val;
1758 return $totalforeachday;
1781function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask, &$isavailable, $oldprojectforbreak = 0, $arrayfields = array(), $extrafields =
null)
1783 global $conf, $db, $user, $langs;
1784 global $form, $formother, $projectstatic, $taskstatic, $thirdpartystatic;
1786 $numlines = count($lines);
1789 $workloadforid = array();
1790 $totalforeachday = array();
1791 $lineswithoutlevel0 = array();
1795 for ($i = 0; $i < $numlines; $i++) {
1796 if ($lines[$i]->fk_task_parent) {
1797 $lineswithoutlevel0[] = $lines[$i];
1804 if (empty($oldprojectforbreak)) {
1805 $oldprojectforbreak = (empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT) ? 0 : -1);
1808 $restrictBefore =
null;
1810 if (!empty($conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS)) {
1811 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
1815 for ($i = 0; $i < $numlines; $i++) {
1820 if ($lines[$i]->fk_task_parent == $parent) {
1824 if (empty($mine) || !empty($tasksrole[$lines[$i]->
id])) {
1827 if ($restricteditformytask == 2 && empty($tasksrole[$lines[$i]->
id])) {
1832 if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid) {
1833 $lastprojectid = $lines[$i]->fk_project;
1834 $projectstatic->id = $lines[$i]->fk_project;
1839 if (empty($workloadforid[$projectstatic->id])) {
1840 $projectstatic->loadTimeSpent($firstdaytoshow, 0, $fuser->id);
1841 $workloadforid[$projectstatic->id] = 1;
1846 $projectstatic->id = $lines[$i]->fk_project;
1847 $projectstatic->ref = $lines[$i]->projectref;
1848 $projectstatic->title = $lines[$i]->projectlabel;
1849 $projectstatic->public = $lines[$i]->public;
1850 $projectstatic->thirdparty_name = $lines[$i]->thirdparty_name;
1851 $projectstatic->status = $lines[$i]->projectstatus;
1853 $taskstatic->id = $lines[$i]->id;
1854 $taskstatic->ref = ($lines[$i]->ref ? $lines[$i]->ref : $lines[$i]->id);
1855 $taskstatic->label = $lines[$i]->label;
1856 $taskstatic->date_start = $lines[$i]->date_start;
1857 $taskstatic->date_end = $lines[$i]->date_end;
1859 $thirdpartystatic->id = $lines[$i]->thirdparty_id;
1860 $thirdpartystatic->name = $lines[$i]->thirdparty_name;
1861 $thirdpartystatic->email = $lines[$i]->thirdparty_email;
1863 if (empty($oldprojectforbreak) || ($oldprojectforbreak != -1 && $oldprojectforbreak != $projectstatic->id)) {
1865 if (!empty($arrayfields[
't.planned_workload'][
'checked'])) {
1868 if (!empty($arrayfields[
't.progress'][
'checked'])) {
1871 foreach ($arrayfields as $key => $val) {
1872 if ($val[
'checked'] && substr($key, 0, 5) ==
'efpt.') {
1877 print
'<tr class="oddeven trforbreak nobold">'.
"\n";
1878 print
'<td colspan="'.(11 + $addcolspan).
'">';
1879 print $projectstatic->getNomUrl(1,
'', 0,
'<strong>'.$langs->transnoentitiesnoconv(
"YourRole").
':</strong> '.$projectsrole[$lines[$i]->fk_project]);
1880 if ($thirdpartystatic->id > 0) {
1881 print
' - '.$thirdpartystatic->getNomUrl(1);
1883 if ($projectstatic->title) {
1885 print
'<span class="secondary">'.$projectstatic->title.
'</span>';
1952 if ($oldprojectforbreak != -1) {
1953 $oldprojectforbreak = $projectstatic->id;
1956 print
'<tr class="oddeven" data-taskid="'.$lines[$i]->id.
'">'.
"\n";
1966 if (!empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)) {
1967 print
'<td class="nowrap">';
1968 if ($oldprojectforbreak == -1) {
1969 print $projectstatic->getNomUrl(1,
'', 0, $langs->transnoentitiesnoconv(
"YourRole").
': '.$projectsrole[$lines[$i]->fk_project]);
1975 if (!empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)) {
1976 print
'<td class="tdoverflowmax100">';
1977 if ($thirdpartystatic->id > 0) {
1978 print $thirdpartystatic->getNomUrl(1,
'project');
1984 print
'<td class="nowrap">';
1985 print
'<!-- Task id = '.$lines[$i]->id.
' -->';
1986 for ($k = 0; $k < $level; $k++) {
1987 print
'<div class="marginleftonly">';
1989 print $taskstatic->getNomUrl(1,
'withproject',
'time');
1992 print
'<span class="opacitymedium">'.$taskstatic->label.
'</span>';
1993 for ($k = 0; $k < $level; $k++) {
1999 $extrafieldsobjectkey =
'projet_task';
2000 $extrafieldsobjectprefix =
'efpt.';
2001 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
2004 if (!empty($arrayfields[
't.planned_workload'][
'checked'])) {
2005 print
'<td class="leftborder plannedworkload right">';
2006 if ($lines[$i]->planned_workload) {
2014 if (!empty($arrayfields[
't.progress'][
'checked'])) {
2016 print
'<td class="right">';
2017 print $formother->select_percent($lines[$i]->progress, $lines[$i]->
id.
'progress');
2021 if (!empty($arrayfields[
'timeconsumed'][
'checked'])) {
2023 print
'<td class="right">';
2025 if ($lines[$i]->duration_effective) {
2026 print
'<a href="'.DOL_URL_ROOT.
'/projet/tasks/time.php?id='.$lines[$i]->id.
'">';
2035 print
'<td class="right">';
2036 $tmptimespent = $taskstatic->getSummaryOfTimeSpent($fuser->id);
2037 if ($tmptimespent[
'total_duration']) {
2045 $disabledproject = 1;
2051 if ($lines[$i]->
public || !empty($projectsrole[$lines[$i]->fk_project]) || $user->rights->projet->all->creer) {
2052 $disabledproject = 0;
2056 if ($restricteditformytask && empty($tasksrole[$lines[$i]->
id])) {
2064 $modeinput =
'hours';
2065 for ($idw = 0; $idw < 7; $idw++) {
2067 if (!isset($totalforeachday[$tmpday])) $totalforeachday[$tmpday] = 0;
2069 if (!$isavailable[$tmpday][
'morning'] && !$isavailable[$tmpday][
'afternoon']) {
2070 $cssonholiday .=
'onholidayallday ';
2071 } elseif (!$isavailable[$tmpday][
'morning']) {
2072 $cssonholiday .=
'onholidaymorning ';
2073 } elseif (!$isavailable[$tmpday][
'afternoon']) {
2074 $cssonholiday .=
'onholidayafternoon ';
2078 $dayWorkLoad = (!empty($projectstatic->weekWorkLoadPerTask[$tmpday][$lines[$i]->id]) ? $projectstatic->weekWorkLoadPerTask[$tmpday][$lines[$i]->id] : 0);
2079 $totalforeachday[$tmpday] += $dayWorkLoad;
2082 if ($dayWorkLoad > 0) {
2085 $alttitle = $langs->trans(
"AddHereTimeSpentForDay", !empty($tmparray[
'day']) ? $tmparray[
'day'] : 0, $tmparray[
'mon']);
2087 global $numstartworkingday, $numendworkingday;
2089 if (($idw + 1 < $numstartworkingday) || ($idw + 1 > $numendworkingday)) {
2090 $cssweekend =
'weekend';
2093 $disabledtaskday = $disabledtask;
2095 if (! $disabledtask && $restrictBefore && $tmpday < $restrictBefore) {
2096 $disabledtaskday = 1;
2099 $tableCell =
'<td class="center hide'.$idw.($cssonholiday ?
' '.$cssonholiday :
'').($cssweekend ?
' '.$cssweekend :
'').
'">';
2102 if ($alreadyspent) {
2103 $tableCell .=
'<span class="timesheetalreadyrecorded" title="texttoreplace"><input type="text" class="center smallpadd" size="2" disabled id="timespent['.$inc.
']['.$idw.
']" name="task['.$lines[$i]->id.
']['.$idw.
']" value="'.$alreadyspent.
'"></span>';
2107 $tableCell .=
'<input type="text" alt="'.($disabledtaskday ?
'' : $alttitle).
'" title="'.($disabledtaskday ?
'' : $alttitle).
'" '.($disabledtaskday ?
'disabled' : $placeholder).
' class="center smallpadd" size="2" id="timeadded['.$inc.
']['.$idw.
']" name="task['.$lines[$i]->id.
']['.$idw.
']" value="" cols="2" maxlength="5"';
2108 $tableCell .=
' onkeypress="return regexEvent(this,event,\'timeChar\')"';
2109 $tableCell .=
' onkeyup="updateTotal('.$idw.
',\''.$modeinput.
'\')
"';
2110 $tableCell .= ' onblur="regexEvent(
this,event,\
''.$modeinput.
'\'); updateTotal(
'.$idw.',\
''.$modeinput.
'\')
" />';
2111 $tableCell .= '</td>';
2116 print '<td class="right
">';
2117 if ((!$lines[$i]->public) && $disabledproject) {
2118 print $form->textwithpicto('', $langs->trans("UserIsNotContactOfProject
"));
2119 } elseif ($disabledtask) {
2120 $titleassigntask = $langs->trans("AssignTaskToMe
");
2121 if ($fuser->id != $user->id) {
2122 $titleassigntask = $langs->trans("AssignTaskToUser
", '...');
2125 print $form->textwithpicto('', $langs->trans("TaskIsNotAssignedToUser
", $titleassigntask));
2132 // Call to show task with a lower level (task under the current task)
2135 if ($lines[$i]->id > 0) {
2136 //var_dump('totalforeachday after taskid='.$lines[$i]->id.' and previous one on level '.$level);
2137 //var_dump($totalforeachday);
2138 $ret = projectLinesPerWeek($inc, $firstdaytoshow, $fuser, $lines[$i]->id, ($parent == 0 ? $lineswithoutlevel0 : $lines), $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $isavailable, $oldprojectforbreak, $arrayfields, $extrafields);
2139 //var_dump('ret with parent='.$lines[$i]->id.' level='.$level);
2141 foreach ($ret as $key => $val) {
2142 $totalforeachday[$key] += $val;
2144 //var_dump('totalforeachday after taskid='.$lines[$i]->id.' and previous one on level '.$level.' + subtasks');
2145 //var_dump($totalforeachday);
2153 return $totalforeachday;
2489function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks = 0, $status = -1, $listofoppstatus = array(), $hiddenfields = array(), $max = 0)
2491 global $langs, $conf, $user;
2492 global $theme_datacolor;
2494 $maxofloop = (empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD);
2496 require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
2498 $listofstatus = array_keys($listofoppstatus);
2500 if (is_array($listofstatus) && !empty($conf->global->USE_COLOR_FOR_PROSPECTION_STATUS)) {
2501 // Define $themeColorId and array $statusOppList for each $listofstatus
2503 $statusOppList = array();
2504 foreach ($listofstatus as $oppStatus) {
2505 $oppStatusCode = dol_getIdFromCode($db, $oppStatus, 'c_lead_status', 'rowid', 'code');
2506 if ($oppStatusCode) {
2507 $statusOppList[$oppStatus]['code'] = $oppStatusCode;
2508 $statusOppList[$oppStatus]['color'] = isset($theme_datacolor[$themeColorId]) ? implode(', ', $theme_datacolor[$themeColorId]) : '';
2514 $projectstatic = new Project($db);
2515 $thirdpartystatic = new Societe($db);
2519 $project_year_filter = 0;
2521 $title = $langs->trans("
Projects");
2522 if (strcmp($status, '') && $status >= 0) {
2523 $title = $langs->trans("Projects").' '.$langs->trans($projectstatic->statuts_long[$status]);
2526 print '<!-- print_projecttasks_array -->';
2527 print '<div class="div-table-responsive-no-min
">';
2528 print '<table class="noborder centpercent
">';
2530 $sql = " FROM
".MAIN_DB_PREFIX."projet as p
";
2532 $sql .= ",
".MAIN_DB_PREFIX."projet_task as t
";
2533 $sql .= ",
".MAIN_DB_PREFIX."element_contact as ec
";
2534 $sql .= ",
".MAIN_DB_PREFIX."c_type_contact as ctc
";
2536 $sql .= " LEFT JOIN
".MAIN_DB_PREFIX."projet_task as t ON p.rowid = t.fk_projet
";
2538 $sql .= " WHERE p.entity IN (
".getEntity('project').")
";
2539 $sql .= " AND p.rowid IN (
".$db->sanitize($projectsListId).")
";
2541 $sql .= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc =
".((int) $socid).")
";
2544 $sql .= " AND p.rowid = t.fk_projet
";
2545 $sql .= " AND ec.element_id = t.rowid
";
2546 $sql .= " AND ec.fk_socpeople =
".((int) $user->id);
2547 $sql .= " AND ec.fk_c_type_contact = ctc.rowid
"; // Replace the 2 lines with ec.fk_c_type_contact in $arrayidtypeofcontact
2548 $sql .= " AND ctc.element =
'project_task'";
2551 $sql .= " AND p.fk_statut =
".(int) $status;
2553 if (!empty($conf->global->PROJECT_LIMIT_YEAR_RANGE)) {
2554 $project_year_filter = GETPOST("project_year_filter
");
2555 //Check if empty or invalid year. Wildcard ignores the sql check
2556 if ($project_year_filter != "*
") {
2557 if (empty($project_year_filter) || !ctype_digit($project_year_filter)) {
2558 $project_year_filter = date("Y
");
2560 $sql .= " AND (p.dateo IS NULL OR p.dateo <=
".$db->idate(dol_get_last_day($project_year_filter, 12, false)).")
";
2561 $sql .= " AND (p.datee IS NULL OR p.datee >=
".$db->idate(dol_get_first_day($project_year_filter, 1, false)).")
";
2565 // Get id of project we must show tasks
2566 $arrayidofprojects = array();
2567 $sql1 = "SELECT p.rowid as projectid
";
2569 $resql = $db->query($sql1);
2572 $num = $db->num_rows($resql);
2574 $objp = $db->fetch_object($resql);
2575 $arrayidofprojects[$objp->projectid] = $objp->projectid;
2579 dol_print_error($db);
2581 if (empty($arrayidofprojects)) {
2582 $arrayidofprojects[0] = -1;
2585 // Get list of project with calculation on tasks
2586 $sql2 = "SELECT p.rowid as projectid, p.ref, p.title, p.fk_soc,
";
2587 $sql2 .= " s.rowid as socid, s.nom as socname, s.name_alias,
";
2588 $sql2 .= " s.code_client, s.code_compta, s.client,
";
2589 $sql2 .= " s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur,
";
2590 $sql2 .= " s.logo, s.email, s.entity,
";
2591 $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,
";
2592 $sql2 .= " p.dateo, p.datee,
";
2593 $sql2 .= " COUNT(t.rowid) as nb, SUM(t.planned_workload) as planned_workload, SUM(t.planned_workload * t.progress / 100) as declared_progess_workload";
2594 $sql2 .= " FROM ".MAIN_DB_PREFIX."projet as p";
2595 $sql2 .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.
rowid = p.fk_soc";
2596 $sql2 .= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task as t ON p.
rowid = t.fk_projet";
2597 $sql2 .= " WHERE p.
rowid IN (".$db->sanitize(join(',', $arrayidofprojects)).")";
2598 $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,";
2599 $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";
2600 $sql2 .= " ORDER BY p.title, p.
ref";
2602 $resql = $db->query($sql2);
2606 $total_opp_amount = 0;
2607 $ponderated_opp_amount = 0;
2608 $total_plannedworkload = 0;
2609 $total_declaredprogressworkload = 0;
2611 $num = $db->num_rows($resql);
2612 $nbofloop = min($num, (empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD));
2615 print
'<tr class="liste_titre">';
2616 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);
2618 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
2619 if (!in_array(
'prospectionstatus', $hiddenfields)) {
2620 print_liste_field_titre(
"OpportunityStatus",
"",
"",
"",
"",
'style="max-width: 100px"', $sortfield, $sortorder,
'center ');
2622 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 ');
2625 if (empty($conf->global->PROJECT_HIDE_TASKS)) {
2627 if (!in_array(
'plannedworkload', $hiddenfields)) {
2628 print_liste_field_titre(
"PlannedWorkload",
"",
"",
"",
"",
'style="max-width: 100px"', $sortfield, $sortorder,
'right ');
2630 if (!in_array(
'declaredprogress', $hiddenfields)) {
2631 print_liste_field_titre(
"%",
"",
"",
"",
"",
'', $sortfield, $sortorder,
'right ', $langs->trans(
"ProgressDeclared"));
2634 if (!in_array(
'projectstatus', $hiddenfields)) {
2639 while ($i < $nbofloop) {
2640 $objp = $db->fetch_object($resql);
2642 if ($max && $i >= $max) {
2645 $total_task += $objp->nb;
2646 $total_opp_amount += $objp->opp_amount;
2647 $opp_weighted_amount = $objp->opp_percent * $objp->opp_amount / 100;
2648 $ponderated_opp_amount +=
price2num($opp_weighted_amount);
2649 $plannedworkload = $objp->planned_workload;
2650 $total_plannedworkload += $plannedworkload;
2651 $declaredprogressworkload = $objp->declared_progess_workload;
2652 $total_declaredprogressworkload += $declaredprogressworkload;
2656 $projectstatic->id = $objp->projectid;
2657 $projectstatic->user_author_id = $objp->fk_user_creat;
2658 $projectstatic->public = $objp->public;
2661 $userAccess = $projectstatic->restrictedProjectArea($user);
2662 if ($userAccess >= 0) {
2663 $projectstatic->ref = $objp->ref;
2664 $projectstatic->status = $objp->status;
2665 $projectstatic->title = $objp->title;
2666 $projectstatic->date_end = $db->jdate($objp->datee);
2667 $projectstatic->date_start = $db->jdate($objp->dateo);
2669 print
'<tr class="oddeven">';
2671 print
'<td class="tdoverflowmax150">';
2672 print $projectstatic->getNomUrl(1,
'', 0,
'',
'-', 0, -1,
'nowraponall');
2673 if (!in_array(
'projectlabel', $hiddenfields)) {
2674 print
'<br><span class="opacitymedium small">'.dol_escape_htmltag($objp->title).
'</span>';
2678 print
'<td class="nowraponall tdoverflowmax100">';
2679 if ($objp->fk_soc > 0) {
2680 $thirdpartystatic->id = $objp->socid;
2681 $thirdpartystatic->name = $objp->socname;
2684 $thirdpartystatic->code_compta = $objp->code_compta;
2685 $thirdpartystatic->client = $objp->client;
2687 $thirdpartystatic->code_compta_fournisseur = $objp->code_compta_fournisseur;
2688 $thirdpartystatic->fournisseur = $objp->fournisseur;
2689 $thirdpartystatic->logo = $objp->logo;
2690 $thirdpartystatic->email = $objp->email;
2691 $thirdpartystatic->entity = $objp->entity;
2692 print $thirdpartystatic->getNomUrl(1);
2696 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
2697 if (!in_array(
'prospectionstatus', $hiddenfields)) {
2698 print
'<td class="center tdoverflowmax75">';
2700 if (empty($conf->global->USE_COLOR_FOR_PROSPECTION_STATUS)) {
2701 $oppStatusCode =
dol_getIdFromCode($db, $objp->opp_status,
'c_lead_status',
'rowid',
'code');
2702 if ($langs->trans(
"OppStatus".$oppStatusCode) !=
"OppStatus".$oppStatusCode) {
2703 print $langs->trans(
"OppStatus".$oppStatusCode);
2706 if (isset($statusOppList[$objp->opp_status])) {
2707 $oppStatusCode = $statusOppList[$objp->opp_status][
'code'];
2708 $oppStatusColor = $statusOppList[$objp->opp_status][
'color'];
2710 $oppStatusCode =
dol_getIdFromCode($db, $objp->opp_status,
'c_lead_status',
'rowid',
'code');
2711 $oppStatusColor =
'';
2713 if ($oppStatusCode) {
2714 if (!empty($oppStatusColor)) {
2715 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>';
2717 print
'<a href="'.dol_buildpath(
'/projet/list.php?search_opp_status='.$objp->opp_status, 1).
'" title="'.$langs->trans(
"OppStatus".$oppStatusCode).
'">'.$oppStatusCode.
'</a>';
2724 print
'<td class="right">';
2725 if ($objp->opp_percent && $objp->opp_amount) {
2726 $opp_weighted_amount = $objp->opp_percent * $objp->opp_amount / 100;
2727 $alttext = $langs->trans(
"OpportunityWeightedAmount").
' '.
price($opp_weighted_amount, 0,
'', 1, -1, 0, $conf->currency);
2728 $ponderated_opp_amount +=
price2num($opp_weighted_amount);
2730 if ($objp->opp_amount) {
2731 print
'<span class="amount" title="'.$alttext.
'">'.$form->textwithpicto(
price($objp->opp_amount, 0,
'', 1, -1, 0), $alttext).
'</span>';
2736 if (empty($conf->global->PROJECT_HIDE_TASKS)) {
2737 print
'<td class="right">'.$objp->nb.
'</td>';
2739 $plannedworkload = $objp->planned_workload;
2740 $total_plannedworkload += $plannedworkload;
2741 if (!in_array(
'plannedworkload', $hiddenfields)) {
2742 print
'<td class="right nowraponall">'.($plannedworkload ?
convertSecondToTime($plannedworkload) :
'').
'</td>';
2744 if (!in_array(
'declaredprogress', $hiddenfields)) {
2745 $declaredprogressworkload = $objp->declared_progess_workload;
2746 $total_declaredprogressworkload += $declaredprogressworkload;
2747 print
'<td class="right nowraponall">';
2749 print ($plannedworkload ?round(100 * $declaredprogressworkload / $plannedworkload, 0).
'%' :
'');
2754 if (!in_array(
'projectstatus', $hiddenfields)) {
2755 print
'<td class="right">';
2756 print $projectstatic->getLibStatut(3);
2762 $total_task += $objp->nb;
2763 $total_opp_amount += $objp->opp_amount;
2770 print
'<tr class="oddeven">';
2771 print
'<td class="nowrap" colspan="5">';
2772 print
'<span class="opacitymedium">'.$langs->trans(
"More").
'...'.($othernb < $maxofloop ?
' ('.$othernb.
')' :
'').
'</span>';
2777 print
'<tr class="liste_total">';
2778 print
'<td>'.$langs->trans(
"Total").
"</td><td></td>";
2779 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
2780 if (!in_array(
'prospectionstatus', $hiddenfields)) {
2781 print
'<td class="liste_total"></td>';
2783 print
'<td class="liste_total right">';
2785 print $form->textwithpicto(
price($total_opp_amount, 0,
'', 1, -1, 0), $langs->trans(
"OpportunityPonderatedAmountDesc").
' : '.
price($ponderated_opp_amount, 0,
'', 1, -1, 0, $conf->currency));
2788 if (empty($conf->global->PROJECT_HIDE_TASKS)) {
2789 print
'<td class="liste_total right">'.$total_task.
'</td>';
2790 if (!in_array(
'plannedworkload', $hiddenfields)) {
2791 print
'<td class="liste_total right">'.($total_plannedworkload ?
convertSecondToTime($total_plannedworkload) :
'').
'</td>';
2793 if (!in_array(
'declaredprogress', $hiddenfields)) {
2794 print
'<td class="liste_total right">'.($total_plannedworkload ?round(100 * $total_declaredprogressworkload / $total_plannedworkload, 0).
'%' :
'').
'</td>';
2797 if (!in_array(
'projectstatus', $hiddenfields)) {
2798 print
'<td class="liste_total"></td>';
2810 if (!empty($conf->global->PROJECT_LIMIT_YEAR_RANGE)) {
2812 print
'<form method="get" action="'.$_SERVER[
"PHP_SELF"].
'">';
2813 print
'<table width="100%">';
2815 print
'<td>'.$langs->trans(
"Year").
'</td>';
2816 print
'<td class="right"><input type="text" size="4" class="flat" name="project_year_filter" value="'.$project_year_filter.
'"/>';
2818 print
'</table></form>';
2831function getTaskProgressView($task, $label =
true, $progressNumber =
true, $hideOnProgressNull =
false, $spaced =
false)
2833 global $langs, $conf;
2837 $plannedworkloadoutputformat =
'allhourmin';
2838 $timespentoutputformat =
'allhourmin';
2839 if (!empty($conf->global->PROJECT_PLANNED_WORKLOAD_FORMAT)) {
2840 $plannedworkloadoutputformat = $conf->global->PROJECT_PLANNED_WORKLOAD_FORMAT;
2842 if (!empty($conf->global->PROJECT_TIMES_SPENT_FORMAT)) {
2843 $timespentoutputformat = $conf->global->PROJECT_TIME_SPENT_FORMAT;
2846 if (empty($task->progress) && !empty($hideOnProgressNull)) {
2850 $spaced = !empty($spaced) ?
'spaced' :
'';
2855 $progressBarClass =
'progress-bar-info';
2856 $progressCalculated = 0;
2857 if ($task->planned_workload) {
2858 $progressCalculated = round(100 * floatval($task->duration_effective) / floatval($task->planned_workload), 2);
2861 $warningRatio = !empty($conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT) ? (1 + $conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT / 100) : 1.10;
2863 $diffTitle =
'<br>'.$langs->trans(
'ProgressDeclared').
' : '.$task->progress.(isset($task->progress) ?
'%' :
'');
2864 $diffTitle .=
'<br>'.$langs->trans(
'ProgressCalculated').
' : '.$progressCalculated.(isset($progressCalculated) ?
'%' :
'');
2867 if (floatval($progressCalculated) > floatval($task->progress * $warningRatio)) {
2868 $progressBarClass =
'progress-bar-danger';
2869 $title = $langs->trans(
'TheReportedProgressIsLessThanTheCalculatedProgressionByX', abs($task->progress - $progressCalculated).
' '.$langs->trans(
"point"));
2870 $diff =
'<span class="text-danger classfortooltip paddingrightonly" title="'.dol_htmlentities($title.$diffTitle).
'" ><i class="fa fa-caret-down"></i> '.($task->progress - $progressCalculated).
'%</span>';
2871 } elseif (floatval($progressCalculated) > floatval($task->progress)) {
2872 $progressBarClass =
'progress-bar-warning';
2873 $title = $langs->trans(
'TheReportedProgressIsLessThanTheCalculatedProgressionByX', abs($task->progress - $progressCalculated).
' '.$langs->trans(
"point"));
2874 $diff =
'<span class="text-warning classfortooltip paddingrightonly" title="'.dol_htmlentities($title.$diffTitle).
'" ><i class="fa fa-caret-left"></i> '.($task->progress - $progressCalculated).
'%</span>';
2876 $progressBarClass =
'progress-bar-success';
2877 $title = $langs->trans(
'TheReportedProgressIsMoreThanTheCalculatedProgressionByX', ($task->progress - $progressCalculated).
' '.$langs->trans(
"point"));
2878 $diff =
'<span class="text-success classfortooltip paddingrightonly" title="'.dol_htmlentities($title.$diffTitle).
'" ><i class="fa fa-caret-up"></i> '.($task->progress - $progressCalculated).
'%</span>';
2882 $out .=
'<div class="progress-group">';
2884 if ($label !==
false) {
2885 $out .=
' <span class="progress-text">';
2887 if ($label !==
true) {
2896 if ($progressNumber !==
false) {
2897 $out .=
' <span class="progress-number">';
2898 if ($progressNumber !==
true) {
2899 $out .= $progressNumber;
2901 if ($task->hasDelay()) {
2905 $url = DOL_URL_ROOT.
'/projet/tasks/time.php?id='.$task->id;
2907 $out .= !empty($diff) ? $diff.
' ' :
'';
2908 $out .=
'<a href="'.$url.
'" >';
2909 $out .=
'<b title="'.$langs->trans(
'TimeSpent').
'" >';
2910 if ($task->duration_effective) {
2920 $out .=
'<a href="'.$url.
'" >';
2921 $out .=
'<span title="'.$langs->trans(
'PlannedWorkload').
'" >';
2922 if ($task->planned_workload) {
2934 $out .=
' <div class="progress sm '.$spaced.
'">';
2935 $diffval = floatval($task->progress) - floatval($progressCalculated);
2936 if ($diffval >= 0) {
2938 $out .=
' <div class="progress-bar '.$progressBarClass.
'" style="width: '.floatval($task->progress).
'%" title="'.floatval($task->progress).
'%">';
2939 if (!empty($task->progress)) {
2940 $out .=
' <div class="progress-bar progress-bar-consumed" style="width: '.floatval($progressCalculated / (floatval($task->progress) == 0 ? 1 : $task->progress) * 100).
'%" title="'.floatval($progressCalculated).
'%"></div>';
2945 $out .=
' <div class="progress-bar progress-bar-consumed-late" style="width: '.floatval($progressCalculated).
'%" title="'.floatval($progressCalculated).
'%">';
2946 $out .=
' <div class="progress-bar '.$progressBarClass.
'" style="width: '.($task->progress ? floatval($task->progress / (floatval($progressCalculated) == 0 ? 1 : $progressCalculated) * 100).
'%' :
'1px').
'" title="'.floatval($task->progress).
'%"></div>';