31require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
48 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT.
'/projet/card.php', [
'id' => $project->id]).($moreparam ?
'&'.$moreparam :
'');
49 $head[$h][1] = $langs->trans(
"Project");
50 $head[$h][2] =
'project';
54 require_once DOL_DOCUMENT_ROOT.
'/core/lib/memory.lib.php';
55 $cachekey =
'count_contacts_project_'.$project->id;
58 if (!is_null($dataretrieved)) {
59 $nbContacts = $dataretrieved;
61 $nbContacts = count($project->liste_contact(-1,
'internal')) + count($project->liste_contact(-1,
'external'));
64 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT.
'/projet/contact.php', [
'id' => $project->id]).($moreparam ?
'&'.$moreparam :
'');
65 $head[$h][1] = $langs->trans(
"ProjectContact");
66 if ($nbContacts > 0) {
67 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbContacts.
'</span>';
69 $head[$h][2] =
'contact';
76 require_once DOL_DOCUMENT_ROOT.
'/core/lib/memory.lib.php';
77 $cachekey =
'count_tasks_project_'.$project->id;
80 if (!is_null($dataretrieved)) {
81 $nbTasks = $dataretrieved;
83 require_once DOL_DOCUMENT_ROOT.
'/projet/class/task.class.php';
85 $nbTasks = count($taskstatic->getTasksArray(
null,
null, $project->id, 0, 0));
88 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT.
'/projet/tasks.php', [
'id' => $project->id]).($moreparam ?
'&'.$moreparam :
'');
89 $head[$h][1] = $langs->trans(
"Tasks");
91 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.($nbTasks).
'</span>';
93 $head[$h][2] =
'tasks';
98 $cachekey =
'count_timespent_project_'.$project->id;
100 if (!is_null($dataretrieved)) {
101 $nbTimeSpent = $dataretrieved;
103 $sql =
"SELECT t.rowid";
106 $sql .=
" FROM ".MAIN_DB_PREFIX.
"element_time as t, ".MAIN_DB_PREFIX.
"projet_task as pt";
107 $sql .=
" WHERE t.fk_element = pt.rowid";
108 $sql .=
" AND t.elementtype = 'task'";
109 $sql .=
" AND pt.fk_projet =".((int) $project->id);
110 $resql =
$db->query($sql);
112 $obj =
$db->fetch_object($resql);
122 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT.
'/projet/tasks/time.php', [
'withproject' => 1,
'projectid' => $project->id]).($moreparam ?
'&'.$moreparam :
'');
123 $head[$h][1] = $langs->trans(
"TimeSpent");
124 if ($nbTimeSpent > 0) {
125 $head[$h][1] .=
'<span class="badge marginleftonlyshort">...</span>';
127 $head[$h][2] =
'timespent';
137 $cachekey =
'count_elements_project_'.$project->id;
139 if (!is_null($dataretrieved)) {
140 $nbElements = $dataretrieved;
143 $nbElements += $project->getElementCount(
'stock',
'entrepot',
'fk_project');
146 $nbElements += $project->getElementCount(
'propal',
'propal');
149 $nbElements += $project->getElementCount(
'order',
'commande');
152 $nbElements += $project->getElementCount(
'invoice',
'facture');
155 $nbElements += $project->getElementCount(
'invoice_predefined',
'facture_rec');
158 $nbElements += $project->getElementCount(
'proposal_supplier',
'supplier_proposal');
161 $nbElements += $project->getElementCount(
'order_supplier',
'commande_fournisseur');
164 $nbElements += $project->getElementCount(
'invoice_supplier',
'facture_fourn');
167 $nbElements += $project->getElementCount(
'contract',
'contrat');
170 $nbElements += $project->getElementCount(
'intervention',
'fichinter');
173 $nbElements += $project->getElementCount(
'shipping',
'expedition');
176 $nbElements += $project->getElementCount(
'mrp',
'mrp_mo',
'fk_project');
179 $nbElements += $project->getElementCount(
'trip',
'deplacement');
182 $nbElements += $project->getElementCount(
'expensereport',
'expensereport');
185 $nbElements += $project->getElementCount(
'donation',
'don');
188 $nbElements += $project->getElementCount(
'loan',
'loan');
191 $nbElements += $project->getElementCount(
'chargesociales',
'chargesociales');
194 $nbElements += $project->getElementCount(
'project_task',
'projet_task');
197 $nbElements += $project->getElementCount(
'stocktransfer',
'stocktransfer_stocktransfer',
'fk_project');
200 $nbElements += $project->getElementCount(
'stock_mouvement',
'stock');
203 $nbElements += $project->getElementCount(
'salaries',
'payment_salary');
206 $nbElements += $project->getElementCount(
'variouspayment',
'payment_various');
210 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT.
'/projet/element.php', [
'id' => $project->id]);
211 $head[$h][1] = $langs->trans(
"ProjectOverview");
212 if ($nbElements > 0) {
213 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbElements.
'</span>';
215 $head[$h][2] =
'element';
219 if (
isModEnabled(
'ticket') && $user->hasRight(
'ticket',
'read')) {
220 require_once DOL_DOCUMENT_ROOT.
'/ticket/class/ticket.class.php';
222 $nbTicket = $Tickettatic->getCountOfItemsLinkedByObjectID($project->id,
'fk_project',
'ticket');
223 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT.
'/ticket/list.php', [
'projectid' => $project->id]);
224 $head[$h][1] = $langs->trans(
"Ticket");
226 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.($nbTicket).
'</span>';
228 $head[$h][2] =
'ticket';
232 if (
isModEnabled(
'eventorganization') && !empty($project->usage_organize_event)) {
233 $langs->load(
'eventorganization');
234 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT .
'/eventorganization/conferenceorbooth_list.php', [
'projectid' => $project->id]);
235 $head[$h][1] = $langs->trans(
"EventOrganization");
240 require_once DOL_DOCUMENT_ROOT.
'/core/lib/memory.lib.php';
241 $cachekey =
'count_conferenceorbooth_'.$project->id;
243 if (!is_null($dataretrieved)) {
244 $nbConfOrBooth = $dataretrieved;
246 require_once DOL_DOCUMENT_ROOT.
'/eventorganization/class/conferenceorbooth.class.php';
248 $result = $conforbooth->fetchAll(
'',
'', 0, 0,
'(t.fk_project:=:'.((
int) $project->id).
")");
250 if (!is_array($result) && $result < 0) {
253 $nbConfOrBooth = count($result);
257 $cachekey =
'count_attendees_'.$project->id;
259 if (!is_null($dataretrieved)) {
260 $nbAttendees = $dataretrieved;
262 require_once DOL_DOCUMENT_ROOT.
'/eventorganization/class/conferenceorboothattendee.class.php';
264 $result = $conforboothattendee->fetchAll(
'',
'', 0, 0,
'(t.fk_project:=:'.((
int) $project->id).
')');
266 if (!is_array($result) && $result < 0) {
267 setEventMessages($conforboothattendee->error, $conforboothattendee->errors,
'errors');
269 $nbAttendees = count($result);
273 if ($nbConfOrBooth > 0 || $nbAttendees > 0) {
274 $head[$h][1] .=
'<span class="badge marginleftonlyshort">';
275 $head[$h][1] .=
'<span title="'.dol_escape_htmltag($langs->trans(
"ConferenceOrBooth")).
'">'.$nbConfOrBooth.
'</span>';
276 $head[$h][1] .=
' + ';
277 $head[$h][1] .=
'<span title="'.dol_escape_htmltag($langs->trans(
"Attendees")).
'">'.$nbAttendees.
'</span>';
278 $head[$h][1] .=
'</span>';
280 $head[$h][2] =
'eventorganisation';
285 $langs->load(
'mails');
286 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT .
'/comm/mailing/list.php', [
'projectid' => $project->id]);
287 $head[$h][1] = $langs->trans(
"EMailings");
291 require_once DOL_DOCUMENT_ROOT.
'/core/lib/memory.lib.php';
292 $cachekey =
'count_mass_mailing_'.$project->id;
294 if (!is_null($dataretrieved)) {
295 $nbMassMailing = $dataretrieved;
297 require_once DOL_DOCUMENT_ROOT.
'/comm/mailing/class/mailing.class.php';
299 $result = $massMailing->fetchAll(
'',
'', 0, 0,
'(t.fk_project:=:'.((
int) $project->id).
")");
301 if (!is_array($result) && $result < 0) {
304 $nbMassMailing = count($result);
308 if ($nbMassMailing > 0) {
309 $head[$h][1] .=
'<span class="badge marginleftonlyshort">';
310 $head[$h][1] .=
'<span title="'.dol_escape_htmltag($langs->trans(
"EMailings")).
'">'.$nbMassMailing.
'</span>';
311 $head[$h][1] .=
'</span>';
313 $head[$h][2] =
'mailing';
326 if (!empty($project->note_private)) {
329 if (!empty($project->note_public)) {
332 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT.
'/projet/note.php', [
'id' => $project->id]);
333 $head[$h][1] = $langs->trans(
'Notes');
335 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbNote.
'</span>';
337 $head[$h][2] =
'notes';
344 require_once DOL_DOCUMENT_ROOT.
'/core/lib/memory.lib.php';
345 $cachekey =
'count_attached_project_'.$project->id;
347 if (!is_null($dataretrieved)) {
348 $totalAttached = $dataretrieved;
350 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
351 require_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
352 $upload_dir =
$conf->project->multidir_output[empty($project->entity) ? 1 : $project->entity].
"/".
dol_sanitizeFileName($project->ref);
353 $nbFiles = count(
dol_dir_list($upload_dir,
'files', 0,
'',
'(\.meta|_preview.*\.png)$'));
355 $totalAttached = $nbFiles + $nbLinks;
358 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT.
'/projet/document.php', [
'id' => $project->id]);
359 $head[$h][1] = $langs->trans(
'Documents');
360 if (($totalAttached) > 0) {
361 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.($totalAttached).
'</span>';
363 $head[$h][2] =
'document';
370 require_once DOL_DOCUMENT_ROOT.
'/core/lib/memory.lib.php';
371 $cachekey =
'count_attached_project_'.$project->id;
373 if (!is_null($dataretrieved)) {
374 $nbComments = $dataretrieved;
376 $nbComments = $project->getNbComments();
379 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT.
'/projet/comment.php', [
'id' => $project->id]);
380 $head[$h][1] = $langs->trans(
"CommentLink");
381 if ($nbComments > 0) {
382 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbComments.
'</span>';
384 $head[$h][2] =
'project_comment';
388 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT.
'/projet/messaging.php', [
'id' => $project->id]);
389 $head[$h][1] = $langs->trans(
"Events");
390 if (
isModEnabled(
'agenda') && ($user->hasRight(
'agenda',
'myactions',
'read') || $user->hasRight(
'agenda',
'allactions',
'read'))) {
393 require_once DOL_DOCUMENT_ROOT.
'/core/lib/memory.lib.php';
394 $cachekey =
'count_events_project_'.$project->id;
396 if (!is_null($dataretrieved)) {
397 $nbEvent = $dataretrieved;
399 $sql =
"SELECT COUNT(id) as nb";
400 $sql .=
" FROM ".MAIN_DB_PREFIX.
"actioncomm";
401 $sql .=
" WHERE fk_project = ".((int) $project->id);
402 $resql =
$db->query($sql);
404 $obj =
$db->fetch_object($resql);
407 dol_syslog(
'Failed to count actioncomm '.
$db->lasterror(), LOG_ERR);
413 $head[$h][1] .= $langs->trans(
"Agenda");
415 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbEvent.
'</span>';
418 $head[$h][2] =
'agenda';
441 $head[$h][0] = DOL_URL_ROOT.
'/projet/tasks/task.php?id='.
$object->id.(GETPOST(
'withproject') ?
'&withproject=1' :
'');
442 $head[$h][1] = $langs->trans(
"Task");
443 $head[$h][2] =
'task_task';
446 $nbContact = count(
$object->liste_contact(-1,
'internal')) + count(
$object->liste_contact(-1,
'external'));
447 $head[$h][0] = DOL_URL_ROOT.
'/projet/tasks/contact.php?id='.
$object->id.(GETPOST(
'withproject') ?
'&withproject=1' :
'');
448 $head[$h][1] = $langs->trans(
"TaskRessourceLinks");
449 if ($nbContact > 0) {
450 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbContact.
'</span>';
452 $head[$h][2] =
'task_contact';
457 $sql =
"SELECT t.rowid";
460 $sql .=
" FROM ".MAIN_DB_PREFIX.
"element_time as t";
461 $sql .=
" WHERE t.elementtype='task' AND t.fk_element = ".((int)
$object->id);
462 $resql =
$db->query($sql);
464 $obj =
$db->fetch_object($resql);
472 $head[$h][0] = DOL_URL_ROOT.
'/projet/tasks/time.php?id='.urlencode((
string)
$object->id).(GETPOST(
'withproject') ?
'&withproject=1' :
'');
473 $head[$h][1] = $langs->trans(
"TimeSpent");
474 if ($nbTimeSpent > 0) {
475 $head[$h][1] .=
'<span class="badge marginleftonlyshort">...</span>';
477 $head[$h][2] =
'task_time';
488 if (!empty(
$object->note_private)) {
491 if (!empty(
$object->note_public)) {
494 $head[$h][0] = DOL_URL_ROOT.
'/projet/tasks/note.php?id='.urlencode((
string)
$object->id).(GETPOST(
'withproject') ?
'&withproject=1' :
'');
495 $head[$h][1] = $langs->trans(
'Notes');
497 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbNote.
'</span>';
499 $head[$h][2] =
'task_notes';
503 $head[$h][0] = DOL_URL_ROOT.
'/projet/tasks/document.php?id='.
$object->id.(GETPOST(
'withproject') ?
'&withproject=1' :
'');
505 include_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
506 include_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
507 $nbFiles = count(
dol_dir_list($filesdir,
'files', 0,
'',
'(\.meta|_preview.*\.png)$'));
509 $head[$h][1] = $langs->trans(
'Documents');
510 if (($nbFiles + $nbLinks) > 0) {
511 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).
'</span>';
513 $head[$h][2] =
'task_document';
518 $nbComments =
$object->getNbComments();
519 $head[$h][0] = DOL_URL_ROOT.
'/projet/tasks/comment.php?id='.
$object->id.(GETPOST(
'withproject') ?
'&withproject=1' :
'');
520 $head[$h][1] = $langs->trans(
"CommentLink");
521 if ($nbComments > 0) {
522 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbComments.
'</span>';
524 $head[$h][2] =
'task_comment';
544 global $langs,
$conf, $user;
549 $param .= ($mode ?
'&mode='.$mode :
'');
550 if (is_object($fuser) && $fuser->id > 0 && $fuser->id != $user->id) {
551 $param .=
'&search_usertoprocessid='.$fuser->id;
555 $head[$h][0] = DOL_URL_ROOT.
"/projet/activity/permonth.php".($param ?
'?'.$param :
'');
556 $head[$h][1] = $langs->trans(
"InputPerMonth");
557 $head[$h][2] =
'inputpermonth';
562 $head[$h][0] = DOL_URL_ROOT.
"/projet/activity/perweek.php".($param ?
'?'.$param :
'');
563 $head[$h][1] = $langs->trans(
"InputPerWeek");
564 $head[$h][2] =
'inputperweek';
569 $head[$h][0] = DOL_URL_ROOT.
"/projet/activity/perday.php".($param ?
'?'.$param :
'');
570 $head[$h][1] = $langs->trans(
"InputPerDay");
571 $head[$h][2] =
'inputperday';
590 global $langs,
$conf, $user, $extrafields;
592 $extrafields->fetch_name_optionals_label(
'projet');
593 $extrafields->fetch_name_optionals_label(
'projet_task');
598 $head[$h][0] = DOL_URL_ROOT.
"/projet/admin/project.php";
599 $head[$h][1] = $langs->trans(
"Projects");
600 $head[$h][2] =
'project';
605 $head[$h][0] = DOL_URL_ROOT.
"/projet/admin/project_extrafields.php";
606 $head[$h][1] = $langs->trans(
"ExtraFieldsProject");
607 $nbExtrafields = $extrafields->attributes[
'projet'][
'count'];
608 if ($nbExtrafields > 0) {
609 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
611 $head[$h][2] =
'attributes';
615 $head[$h][0] = DOL_URL_ROOT .
'/projet/admin/project_task_extrafields.php';
616 $head[$h][1] = $langs->trans(
"ExtraFieldsProjectTask");
617 $nbExtrafields = $extrafields->attributes[
'projet_task'][
'count'];
618 if ($nbExtrafields > 0) {
619 $head[$h][1] .=
'<span class="badge marginleftonlyshort">' . $nbExtrafields .
'</span>';
621 $head[$h][2] =
'attributes_task';
626 $langs->load(
"members");
628 $head[$h][0] = DOL_URL_ROOT.
'/projet/admin/website.php';
629 $head[$h][1] = $langs->trans(
"BlankSubscriptionForm");
630 $head[$h][2] =
'website';
659function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$taskrole, $projectsListId =
'', $addordertick = 0, $projectidfortotallink = 0, $dummy =
'', $showbilltime = 0, $arrayfields = array(), $arrayofselected = array())
661 global $user, $langs,
$conf,
$db, $hookmanager;
662 global $projectstatic, $taskstatic, $extrafields;
663 global $objectoffield;
666 @phan-var-force Project $projectstatic
667 @phan-var-force Task $taskstatic
668 @phan-var-force ExtraFields $extrafields
673 $projectsArrayId = array();
674 if ($projectsListId) {
675 $projectsArrayId = explode(
',', $projectsListId);
678 $numlines = count($lines);
681 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;
685 $total_projectlinesa_spent = 0;
686 $total_projectlinesa_planned = 0;
687 $total_projectlinesa_spent_if_planned = 0;
688 $total_projectlinesa_declared_if_planned = 0;
689 $total_projectlinesa_tobill = 0;
690 $total_projectlinesa_billed = 0;
691 $total_budget_amount = 0;
695 for ($i = 0; $i < $numlines; $i++) {
696 if ($parent == 0 && $level >= 0) {
702 if ($lines[$i]->fk_task_parent == $parent || $level < 0) {
708 if (is_array($taskrole)) {
710 if (!isset($taskrole[$lines[$i]->
id]) && $lines[$i]->
id != $lines[$i]->fk_task_parent) {
712 $foundtaskforuserdeeper = 0;
715 if ($foundtaskforuserdeeper > 0) {
724 if (!$user->hasRight(
'projet',
'all',
'lire')) {
726 if (!in_array($lines[$i]->fk_project, $projectsArrayId)) {
737 if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid) {
738 $lastprojectid = $lines[$i]->fk_project;
741 print
'<tr class="oddeven" id="row-'.$lines[$i]->id.
'">'.
"\n";
743 $projectstatic->id = $lines[$i]->fk_project;
744 $projectstatic->ref = $lines[$i]->projectref;
745 $projectstatic->public = $lines[$i]->public;
746 $projectstatic->title = $lines[$i]->projectlabel;
747 $projectstatic->usage_bill_time = $lines[$i]->usage_bill_time;
748 $projectstatic->status = $lines[$i]->projectstatus;
750 $taskstatic->id = $lines[$i]->id;
751 $taskstatic->ref = $lines[$i]->ref;
752 $taskstatic->label = (!empty($taskrole[$lines[$i]->
id]) ? $langs->trans(
"YourRole").
': '.$taskrole[$lines[$i]->id] :
'');
753 $taskstatic->projectstatus = $lines[$i]->projectstatus;
754 $taskstatic->progress = $lines[$i]->progress;
755 $taskstatic->fk_statut = $lines[$i]->status;
756 $taskstatic->status = $lines[$i]->status;
757 $taskstatic->date_start = $lines[$i]->date_start;
758 $taskstatic->date_end = $lines[$i]->date_end;
759 $taskstatic->datee = $lines[$i]->date_end;
760 $taskstatic->planned_workload = $lines[$i]->planned_workload;
761 $taskstatic->duration_effective = $lines[$i]->duration_effective;
762 $taskstatic->budget_amount = $lines[$i]->budget_amount;
763 $taskstatic->billable = $lines[$i]->billable;
764 $taskstatic->status = $lines[$i]->status;
765 $taskstatic->fk_statut = $lines[$i]->fk_statut;
768 if (
$conf->main_checkbox_left_column) {
769 print
'<td class="nowrap center">';
771 if (in_array($lines[$i]->
id, $arrayofselected)) {
774 print
'<input id="cb' . $lines[$i]->id .
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="' . $lines[$i]->id .
'"' . ($selected ?
' checked="checked"' :
'') .
'>';
780 print
'<td class="nowraponall">';
782 if ($lines[$i]->
public || in_array($lines[$i]->fk_project, $projectsArrayId) || $user->hasRight(
'projet',
'all',
'lire')) {
783 print $projectstatic->getNomUrl(1);
785 print $projectstatic->getNomUrl(1,
'nolink');
792 $projectstatic->statut = $lines[$i]->projectstatus;
793 print $projectstatic->getLibStatut(2);
798 if (count($arrayfields) > 0 && !empty($arrayfields[
't.ref'][
'checked'])) {
799 print
'<td class="nowraponall">';
800 if ($showlineingray) {
801 print
'<i>'.img_object(
'',
'projecttask').
' '.$lines[$i]->ref.
'</i>';
803 print $taskstatic->getNomUrl(1,
'withproject');
809 if (count($arrayfields) > 0 && !empty($arrayfields[
't.label'][
'checked'])) {
811 if ($showlineingray) {
812 $labeltoshow .=
'<i>';
815 for ($k = 0; $k < $level; $k++) {
816 $labeltoshow .=
'<div class="marginleftonly">';
819 for ($k = 0; $k < $level; $k++) {
820 $labeltoshow .=
'</div>';
822 if ($showlineingray) {
823 $labeltoshow .=
'</i>';
825 print
'<td class="tdoverflowmax200" title="'.dol_escape_htmltag($labeltoshow).
'">';
830 if (count($arrayfields) > 0 && !empty($arrayfields[
't.description'][
'checked'])) {
831 print
'<td class="tdoverflowmax200" title="'.dol_escape_htmltag($lines[$i]->
description).
'">';
832 print $lines[$i]->description;
837 if (count($arrayfields) > 0 && !empty($arrayfields[
't.dateo'][
'checked'])) {
838 print
'<td class="center nowraponall">';
844 if (count($arrayfields) > 0 && !empty($arrayfields[
't.datee'][
'checked'])) {
845 print
'<td class="center nowraponall">';
847 if ($taskstatic->hasDelay()) {
853 $plannedworkloadoutputformat =
'allhourmin';
854 $timespentoutputformat =
'allhourmin';
863 if (count($arrayfields) > 0 && !empty($arrayfields[
't.planned_workload'][
'checked'])) {
864 print
'<td class="right">';
865 $fullhour =
convertSecondToTime($lines[$i]->planned_workload, $plannedworkloadoutputformat);
867 if ($lines[$i]->planned_workload !=
'') {
877 if (count($arrayfields) > 0 && !empty($arrayfields[
't.duration_effective'][
'checked'])) {
878 print
'<td class="right">';
879 if ($showlineingray) {
882 print
'<a href="'.DOL_URL_ROOT.
'/projet/tasks/time.php?id='.$lines[$i]->id.($showproject ?
'' :
'&withproject=1').
'">';
884 if ($lines[$i]->duration_effective) {
889 if ($showlineingray) {
898 if (count($arrayfields) > 0 && !empty($arrayfields[
't.progress_calculated'][
'checked'])) {
901 if ($lines[$i]->planned_workload || $lines[$i]->duration_effective) {
902 if ($lines[$i]->planned_workload) {
903 $s = round(100 * (
float) $lines[$i]->duration_effective / (
float) $lines[$i]->planned_workload, 2).
' %';
906 $s = $langs->trans(
'WorkloadNotDefined');
907 $shtml =
'<span class="opacitymedium">'.$s.
'</span>';
910 print
'<td class="right tdoverflowmax100" title="'.dol_escape_htmltag($s).
'">';
916 if (count($arrayfields) > 0 && !empty($arrayfields[
't.progress'][
'checked'])) {
917 print
'<td class="right">';
918 if ($lines[$i]->progress !=
'') {
925 if (count($arrayfields) > 0 && !empty($arrayfields[
't.progress_summary'][
'checked'])) {
926 print
'<td class="right">';
927 if ($lines[$i]->progress !=
'' && $lines[$i]->duration_effective) {
934 if (count($arrayfields) > 0 && !empty($arrayfields[
't.fk_statut'][
'checked'])) {
935 print
'<td class="center">';
936 print $taskstatic->getLibStatut(4);
942 if (count($arrayfields) > 0 && !empty($arrayfields[
't.tobill'][
'checked'])) {
943 print
'<td class="right">';
944 if ($lines[$i]->usage_bill_time) {
946 $total_projectlinesa_tobill += $lines[$i]->tobill;
948 print
'<span class="opacitymedium">'.$langs->trans(
"NA").
'</span>';
954 if (count($arrayfields) > 0 && !empty($arrayfields[
't.billed'][
'checked'])) {
955 print
'<td class="right">';
956 if ($lines[$i]->usage_bill_time) {
958 $total_projectlinesa_billed += $lines[$i]->billed;
960 print
'<span class="opacitymedium">'.$langs->trans(
"NA").
'</span>';
967 if (count($arrayfields) > 0 && !empty($arrayfields[
't.budget_amount'][
'checked'])) {
968 print
'<td class="center">';
969 if ($lines[$i]->budget_amount) {
970 print
'<span class="amount">'.price($lines[$i]->budget_amount, 0, $langs, 1, 0, 0,
$conf->currency).
'</span>';
971 $total_budget_amount += $lines[$i]->budget_amount;
977 if (count($arrayfields) > 0 && !empty($arrayfields[
'c.assigned'][
'checked'])) {
978 print
'<td class="center">';
980 foreach (array(
'internal',
'external') as $source) {
982 $tab = $lines[$i]->liste_contact(-1, $source, 0,
'', 1);
984 $numcontact = count($tab);
985 if (!empty($numcontact)) {
986 foreach ($tab as $contacttask) {
987 if ($source ==
'internal') {
992 $c->fetch($contacttask[
'id']);
993 if (!empty(
$c->photo)) {
994 if (get_class(
$c) ==
'User') {
996 '@phan-var-force User $c';
997 print
$c->getNomUrl(-2,
'', 0, 0, 24, 1,
'', ($ifisrt ?
'' :
'notfirst'));
1000 '@phan-var-force Contact $c';
1001 print
$c->getNomUrl(-2,
'', 0,
'', -1, 0, ($ifisrt ?
'' :
'notfirst'));
1004 if (get_class(
$c) ==
'User') {
1006 '@phan-var-force User $c';
1007 print
$c->getNomUrl(2,
'', 0, 0, 24, 1,
'', ($ifisrt ?
'' :
'notfirst'));
1010 '@phan-var-force Contact $c';
1011 print
$c->getNomUrl(2,
'', 0,
'', -1, 0, ($ifisrt ?
'' :
'notfirst'));
1022 if (count($arrayfields) > 0 && !empty($arrayfields[
't.billable'][
'checked'])) {
1023 print
'<td class="center">';
1024 if ($lines[$i]->billable) {
1025 print
'<span>'.$langs->trans(
'Yes').
'</span>';
1027 print
'<span>'.$langs->trans(
'No').
'</span>';
1033 $extrafieldsobjectkey = $taskstatic->table_element;
1034 $extrafieldsobjectprefix =
'efpt.';
1037 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
1039 $parameters = array(
'arrayfields' => $arrayfields,
'obj' => $lines[$i]);
1040 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters);
1041 print $hookmanager->resPrint;
1044 print
'<td class="tdlineupdown center"></td>';
1047 if (!
$conf->main_checkbox_left_column) {
1048 print
'<td class="nowrap center">';
1050 if (in_array($lines[$i]->
id, $arrayofselected)) {
1053 print
'<input id="cb' . $lines[$i]->id .
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="' . $lines[$i]->id .
'"' . ($selected ?
' checked="checked"' :
'') .
'>';
1060 if (!$showlineingray) {
1066 if ($lines[$i]->
id) {
1067 projectLinesa($inc, $lines[$i]->
id, $lines, $level,
'', $showproject, $taskrole, $projectsListId, $addordertick, $projectidfortotallink,
'', $showbilltime, $arrayfields);
1072 $total_projectlinesa_spent += $lines[$i]->duration_effective;
1073 $total_projectlinesa_planned += $lines[$i]->planned_workload;
1074 if ($lines[$i]->planned_workload) {
1075 $total_projectlinesa_spent_if_planned += $lines[$i]->duration_effective;
1077 if ($lines[$i]->planned_workload) {
1078 $total_projectlinesa_declared_if_planned += (float) $lines[$i]->planned_workload * $lines[$i]->progress / 100;
1087 if (($total_projectlinesa_planned > 0 || $total_projectlinesa_spent > 0 || $total_projectlinesa_tobill > 0 || $total_projectlinesa_billed > 0 || $total_budget_amount > 0)
1089 print
'<tr class="liste_total nodrag nodrop">';
1091 if (
$conf->main_checkbox_left_column) {
1092 print
'<td class="liste_total"></td>';
1095 print
'<td class="liste_total">'.$langs->trans(
"Total").
'</td>';
1097 print
'<td></td><td></td>';
1099 if (count($arrayfields) > 0 && !empty($arrayfields[
't.label'][
'checked'])) {
1102 if (count($arrayfields) > 0 && !empty($arrayfields[
't.description'][
'checked'])) {
1105 if (count($arrayfields) > 0 && !empty($arrayfields[
't.dateo'][
'checked'])) {
1108 if (count($arrayfields) > 0 && !empty($arrayfields[
't.datee'][
'checked'])) {
1111 if (count($arrayfields) > 0 && !empty($arrayfields[
't.planned_workload'][
'checked'])) {
1112 print
'<td class="nowrap liste_total right">';
1116 if (count($arrayfields) > 0 && !empty($arrayfields[
't.duration_effective'][
'checked'])) {
1117 print
'<td class="nowrap liste_total right">';
1118 if ($projectidfortotallink > 0) {
1119 print
'<a href="'.DOL_URL_ROOT.
'/projet/tasks/time.php?projectid='.$projectidfortotallink.($showproject ?
'' :
'&withproject=1').
'">';
1122 if ($projectidfortotallink > 0) {
1128 $totalCalculatedProgress = 0;
1129 $totalAverageDeclaredProgress = 0;
1131 $progressBarClass =
'';
1132 if ($total_projectlinesa_planned) {
1133 $totalAverageDeclaredProgress = round(100 * $total_projectlinesa_declared_if_planned / $total_projectlinesa_planned, 2);
1134 $totalCalculatedProgress = round(100 * $total_projectlinesa_spent / $total_projectlinesa_planned, 2);
1137 $warningRatio =
getDolGlobalString(
'PROJECT_TIME_SPEND_WARNING_PERCENT') ? (1 +
$conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT / 100) : 1.10;
1140 $progressBarClass =
'progress-bar-info';
1141 $badgeClass =
'badge ';
1143 if ($totalCalculatedProgress > $totalAverageDeclaredProgress) {
1144 $progressBarClass =
'progress-bar-danger';
1145 $badgeClass .=
'badge-danger';
1146 } elseif ($totalCalculatedProgress * $warningRatio >= $totalAverageDeclaredProgress) {
1147 $progressBarClass =
'progress-bar-warning';
1148 $badgeClass .=
'badge-warning';
1150 $progressBarClass =
'progress-bar-success';
1151 $badgeClass .=
'badge-success';
1156 if (count($arrayfields) > 0 && !empty($arrayfields[
't.progress_calculated'][
'checked'])) {
1157 print
'<td class="nowrap liste_total right">';
1158 if ($total_projectlinesa_planned) {
1159 print $totalCalculatedProgress.
' %';
1165 if (count($arrayfields) > 0 && !empty($arrayfields[
't.progress'][
'checked'])) {
1166 print
'<td class="nowrap liste_total right">';
1167 if ($total_projectlinesa_planned) {
1168 print
'<span class="'.$badgeClass.
'" >'.$totalAverageDeclaredProgress.
' %</span>';
1175 if (count($arrayfields) > 0 && !empty($arrayfields[
't.progress_summary'][
'checked'])) {
1176 print
'<td class="right">';
1177 if ($total_projectlinesa_planned) {
1179 print
' <div class="progress sm" title="'.$totalAverageDeclaredProgress.
'%" >';
1180 print
' <div class="progress-bar '.$progressBarClass.
'" style="width: '.$totalAverageDeclaredProgress.
'%"></div>';
1187 if ($showbilltime) {
1188 if (count($arrayfields) > 0 && !empty($arrayfields[
't.tobill'][
'checked'])) {
1189 print
'<td class="nowrap liste_total right">';
1193 if (count($arrayfields) > 0 && !empty($arrayfields[
't.billed'][
'checked'])) {
1194 print
'<td class="nowrap liste_total right">';
1201 if (count($arrayfields) > 0 && !empty($arrayfields[
't.budget_amount'][
'checked'])) {
1202 print
'<td class="nowrap liste_total center">';
1203 if (strcmp((
string) $total_budget_amount,
'')) {
1204 print
price($total_budget_amount, 0, $langs, 1, 0, 0,
$conf->currency);
1214 if (count($arrayfields) > 0 && !empty($arrayfields[
'c.assigned'][
'checked'])) {
1219 if (!empty($extrafields->attributes[
'projet_task'][
'totalizable'])) {
1220 foreach ($extrafields->attributes[
'projet_task'][
'totalizable'] as $key => $value) {
1221 if (!empty($arrayfields[
'efpt.'.$key][
'checked']) && $arrayfields[
'efpt.'.$key][
'checked'] == 1) {
1222 print
'<td class="right">';
1232 print
'<td class="liste_total"></td>';
1234 if (!
$conf->main_checkbox_left_column) {
1235 print
'<td class="liste_total"></td>';
1262function projectLinesPerAction(&$inc, $parent, $fuser, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask, $preselectedday, &$isavailable, $oldprojectforbreak = 0)
1265 global $form, $formother, $projectstatic, $taskstatic, $thirdpartystatic;
1267 @phan-var-force FormOther $formother
1268 @phan-var-force Project $projectstatic
1269 @phan-var-force Task $taskstatic
1270 @phan-var-force Societe $thirdpartystatic
1274 $totalforeachline = array();
1275 $workloadforid = array();
1276 $lineswithoutlevel0 = array();
1278 $numlines = count($lines);
1282 for ($i = 0; $i < $numlines; $i++) {
1283 if ($lines[$i]->fk_task_parent) {
1284 $lineswithoutlevel0[] = $lines[$i];
1289 if (empty($oldprojectforbreak)) {
1290 $oldprojectforbreak = (!
getDolGlobalString(
'PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT') ? 0 : -1);
1294 for ($i = 0; $i < $numlines; $i++) {
1302 if (empty($mine) || !empty($tasksrole[$lines[$i]->
id])) {
1306 if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid) {
1307 $lastprojectid = $lines[$i]->fk_project;
1308 if ($preselectedday) {
1309 $projectstatic->id = $lines[$i]->fk_project;
1313 if (empty($workloadforid[$projectstatic->id])) {
1314 if ($preselectedday) {
1315 $projectstatic->loadTimeSpent($preselectedday, 0, $fuser->id);
1316 $workloadforid[$projectstatic->id] = 1;
1320 $projectstatic->id = $lines[$i]->fk_project;
1321 $projectstatic->ref = $lines[$i]->project_ref;
1322 $projectstatic->title = $lines[$i]->project_label;
1323 $projectstatic->public = $lines[$i]->public;
1324 $projectstatic->status = $lines[$i]->project->status;
1326 $taskstatic->id = $lines[$i]->fk_statut;
1327 $taskstatic->ref = ($lines[$i]->task_ref ? $lines[$i]->task_ref : $lines[$i]->task_id);
1328 $taskstatic->label = $lines[$i]->task_label;
1329 $taskstatic->date_start = $lines[$i]->date_start;
1330 $taskstatic->date_end = $lines[$i]->date_end;
1332 $thirdpartystatic->id = $lines[$i]->socid;
1333 $thirdpartystatic->name = $lines[$i]->thirdparty_name;
1334 $thirdpartystatic->email = $lines[$i]->thirdparty_email;
1336 if (empty($oldprojectforbreak) || ($oldprojectforbreak != -1 && $oldprojectforbreak != $projectstatic->id)) {
1337 print
'<tr class="oddeven trforbreak nobold">'.
"\n";
1338 print
'<td colspan="11">';
1339 print $projectstatic->getNomUrl(1,
'', 0, $langs->transnoentitiesnoconv(
"YourRole").
': '.$projectsrole[$lines[$i]->fk_project]);
1340 if ($projectstatic->title) {
1342 print $projectstatic->title;
1348 if ($oldprojectforbreak != -1) {
1349 $oldprojectforbreak = $projectstatic->id;
1352 print
'<tr class="oddeven">'.
"\n";
1363 if ($oldprojectforbreak == -1) {
1364 print $projectstatic->getNomUrl(1,
'', 0, $langs->transnoentitiesnoconv(
"YourRole").
': '.$projectsrole[$lines[$i]->fk_project]);
1365 print
'<br>'.$projectstatic->title;
1370 print
'<td class="tdoverflowmax100">';
1371 if ($thirdpartystatic->id > 0) {
1372 print $thirdpartystatic->getNomUrl(1,
'project', 10);
1378 print
'<!-- Task id = '.$lines[$i]->id.
' (projectlinesperaction) -->';
1379 for ($k = 0; $k < $level; $k++) {
1380 print
'<div class="marginleftonly">';
1382 print $taskstatic->getNomUrl(1,
'withproject',
'time');
1385 print
'<div class="opacitymedium tdoverflowmax400 small" title="'.dol_escape_htmltag($taskstatic->label).
'">'.
dol_escape_htmltag($taskstatic->label).
'</div>';
1386 for ($k = 0; $k < $level; $k++) {
1392 print
'<td class="center">';
1396 $disabledproject = 1;
1402 if ($lines[$i]->
public || !empty($projectsrole[$lines[$i]->fk_project]) || $user->hasRight(
'projet',
'all',
'creer')) {
1403 $disabledproject = 0;
1407 if ($restricteditformytask && empty($tasksrole[$lines[$i]->
id])) {
1412 print
'<td class="nowrap center">';
1417 if (!$isavailable[$preselectedday][
'morning'] && !$isavailable[$preselectedday][
'afternoon']) {
1418 $cssonholiday .=
'onholidayallday ';
1419 } elseif (!$isavailable[$preselectedday][
'morning']) {
1420 $cssonholiday .=
'onholidaymorning ';
1421 } elseif (!$isavailable[$preselectedday][
'afternoon']) {
1422 $cssonholiday .=
'onholidayafternoon ';
1426 print
'<td class="duration'.($cssonholiday ?
' '.$cssonholiday :
'').
' center">';
1428 $dayWorkLoad = $lines[$i]->timespent_duration;
1429 if (!array_key_exists($preselectedday, $totalforeachline)) {
1430 $totalforeachline[$preselectedday] = 0;
1432 $totalforeachline[$preselectedday] += $lines[$i]->timespent_duration;
1435 if ($dayWorkLoad > 0) {
1444 print
'<td class="center">';
1445 print
'<textarea name="'.$lines[$i]->id.
'note" rows="'.ROWS_2.
'" id="'.$lines[$i]->id.
'note"'.($disabledtask ?
' disabled="disabled"' :
'').
'>';
1446 print $lines[$i]->timespent_note;
1447 print
'</textarea>';
1451 print
'<td class="right">';
1471 return $totalforeachline;
1494function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask, $preselectedday, &$isavailable, $oldprojectforbreak = 0, $arrayfields = array(), $extrafields =
null)
1497 global $form, $formother, $projectstatic, $taskstatic, $thirdpartystatic;
1499 @phan-var-force FormOther $formother
1500 @phan-var-force Project $projectstatic
1501 @phan-var-force Task $taskstatic
1502 @phan-var-force Societe $thirdpartystatic
1506 $totalforeachday = array();
1507 $workloadforid = array();
1508 $lineswithoutlevel0 = array();
1510 $numlines = count($lines);
1514 for ($i = 0; $i < $numlines; $i++) {
1515 if ($lines[$i]->fk_task_parent) {
1516 $lineswithoutlevel0[] = $lines[$i];
1521 if (empty($oldprojectforbreak)) {
1522 $oldprojectforbreak = (!
getDolGlobalString(
'PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT') ? 0 : -1);
1525 $restrictBefore =
null;
1528 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
1533 for ($i = 0; $i < $numlines; $i++) {
1538 if ($lines[$i]->fk_task_parent == $parent) {
1542 if (empty($mine) || !empty($tasksrole[$lines[$i]->
id])) {
1545 if ($restricteditformytask == 2 && empty($tasksrole[$lines[$i]->
id])) {
1550 if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid) {
1551 $lastprojectid = $lines[$i]->fk_project;
1552 if ($preselectedday) {
1553 $projectstatic->id = $lines[$i]->fk_project;
1557 if (empty($workloadforid[$projectstatic->id])) {
1558 if ($preselectedday) {
1559 $projectstatic->loadTimeSpent($preselectedday, 0, $fuser->id);
1560 $workloadforid[$projectstatic->id] = 1;
1564 $projectstatic->id = $lines[$i]->fk_project;
1565 $projectstatic->ref = $lines[$i]->projectref;
1566 $projectstatic->title = $lines[$i]->projectlabel;
1567 $projectstatic->public = $lines[$i]->public;
1568 $projectstatic->status = $lines[$i]->projectstatus;
1570 $taskstatic->id = $lines[$i]->id;
1571 $taskstatic->ref = ($lines[$i]->ref ? $lines[$i]->ref : $lines[$i]->id);
1572 $taskstatic->label = $lines[$i]->label;
1573 $taskstatic->date_start = $lines[$i]->date_start;
1574 $taskstatic->date_end = $lines[$i]->date_end;
1576 $thirdpartystatic->id = $lines[$i]->socid;
1577 $thirdpartystatic->name = $lines[$i]->thirdparty_name;
1578 $thirdpartystatic->email = $lines[$i]->thirdparty_email;
1580 if (empty($oldprojectforbreak) || ($oldprojectforbreak != -1 && $oldprojectforbreak != $projectstatic->id)) {
1582 if (!empty($arrayfields[
't.planned_workload'][
'checked'])) {
1585 if (!empty($arrayfields[
't.progress'][
'checked'])) {
1588 foreach ($arrayfields as $key => $val) {
1589 if ($val[
'checked'] && substr($key, 0, 5) ==
'efpt.') {
1594 print
'<tr class="oddeven trforbreak nobold">'.
"\n";
1595 print
'<td colspan="'.(7 + $addcolspan).
'">';
1596 print $projectstatic->getNomUrl(1,
'', 0,
'<strong>'.$langs->transnoentitiesnoconv(
"YourRole").
':</strong> '.$projectsrole[$lines[$i]->fk_project]);
1597 if ($thirdpartystatic->id > 0) {
1598 print
' - '.$thirdpartystatic->getNomUrl(1);
1600 if ($projectstatic->title) {
1602 print
'<span class="secondary">'.$projectstatic->title.
'</span>';
1669 if ($oldprojectforbreak != -1) {
1670 $oldprojectforbreak = $projectstatic->id;
1673 print
'<tr class="oddeven" data-taskid="'.$lines[$i]->id.
'">'.
"\n";
1685 if ($oldprojectforbreak == -1) {
1686 print $projectstatic->getNomUrl(1,
'', 0, $langs->transnoentitiesnoconv(
"YourRole").
': '.$projectsrole[$lines[$i]->fk_project]);
1693 print
'<td class="tdoverflowmax100">';
1694 if ($thirdpartystatic->id > 0) {
1695 print $thirdpartystatic->getNomUrl(1,
'project', 10);
1702 print
'<!-- Task id = '.$lines[$i]->id.
' (projectlinesperday) -->';
1703 for ($k = 0; $k < $level; $k++) {
1704 print
'<div class="marginleftonly">';
1706 print $taskstatic->getNomUrl(1,
'withproject',
'time');
1709 print
'<div class="opacitymedium tdoverflowmax400 small" title="'.dol_escape_htmltag($taskstatic->label).
'">'.
dol_escape_htmltag($taskstatic->label).
'</div>';
1710 for ($k = 0; $k < $level; $k++) {
1716 $extrafieldsobjectkey =
'projet_task';
1717 $extrafieldsobjectprefix =
'efpt.';
1718 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
1721 if (!empty($arrayfields[
't.planned_workload'][
'checked'])) {
1722 print
'<td class="leftborder plannedworkload right">';
1723 if ($lines[$i]->planned_workload) {
1732 if (!empty($arrayfields[
't.progress'][
'checked'])) {
1733 print
'<td class="right">';
1734 print $formother->select_percent($lines[$i]->progress, $lines[$i]->
id.
'progress');
1738 if (!empty($arrayfields[
'timeconsumed'][
'checked'])) {
1740 print
'<td class="right">';
1742 if ($lines[$i]->duration_effective) {
1743 print
'<a href="'.DOL_URL_ROOT.
'/projet/tasks/time.php?id='.$lines[$i]->id.
'">';
1752 print
'<td class="right">';
1753 $tmptimespent = $taskstatic->getSummaryOfTimeSpent($fuser->id);
1754 if ($tmptimespent[
'total_duration']) {
1762 $disabledproject = 1;
1768 if ($lines[$i]->
public || !empty($projectsrole[$lines[$i]->fk_project]) || $user->hasRight(
'projet',
'all',
'creer')) {
1769 $disabledproject = 0;
1773 if ($restricteditformytask && empty($tasksrole[$lines[$i]->
id])) {
1777 if ($restrictBefore && $preselectedday < $restrictBefore) {
1782 print
'<td class="nowraponall leftborder center minwidth150imp borderleft">';
1783 $tableCell = $form->selectDate($preselectedday, (
string) $lines[$i]->
id, 1, 1, 2,
"addtime", 0, 0, $disabledtask);
1788 if (!$isavailable[$preselectedday][
'morning'] && !$isavailable[$preselectedday][
'afternoon']) {
1789 $cssonholiday .=
'onholidayallday ';
1790 } elseif (!$isavailable[$preselectedday][
'morning']) {
1791 $cssonholiday .=
'onholidaymorning ';
1792 } elseif (!$isavailable[$preselectedday][
'afternoon']) {
1793 $cssonholiday .=
'onholidayafternoon ';
1800 global $numstartworkingday, $numendworkingday;
1802 if ((($idw + 1) < $numstartworkingday) || (($idw + 1) > $numendworkingday)) {
1803 $cssweekend =
'weekend';
1807 print
'<td class="center duration'.($cssonholiday ?
' '.$cssonholiday :
'').($cssweekend ?
' '.$cssweekend :
'').
'">';
1808 $dayWorkLoad = empty($projectstatic->weekWorkLoadPerTask[$preselectedday][$lines[$i]->id]) ? 0 : (int) $projectstatic->weekWorkLoadPerTask[$preselectedday][$lines[$i]->id];
1809 if (!isset($totalforeachday[$preselectedday])) {
1810 $totalforeachday[$preselectedday] = 0;
1812 $totalforeachday[$preselectedday] += $dayWorkLoad;
1815 if ($dayWorkLoad > 0) {
1822 $tableCell .=
'<span class="timesheetalreadyrecorded" title="texttoreplace"><input type="text" class="center width50" disabled id="timespent['.$inc.
']['.$idw.
']" name="task['.$lines[$i]->id.
']['.$idw.
']" value="'.$alreadyspent.
'"></span>';
1823 $tableCell .=
'<span class="hideonsmartphone"> + </span>';
1825 $tableCell .= $form->select_duration($lines[$i]->
id.
'duration',
'', $disabledtask,
'text', 0, 1);
1832 print
'<td class="center">';
1833 print
'<textarea class="padding3" name="'.$lines[$i]->id.
'note" rows="'.ROWS_2.
'" id="'.$lines[$i]->id.
'note"'.($disabledtask ?
' disabled="disabled"' :
'').
'>';
1834 print
'</textarea>';
1838 print
'<td class="right">';
1839 if ((!$lines[$i]->
public) && $disabledproject) {
1840 print $form->textwithpicto(
'', $langs->trans(
"UserIsNotContactOfProject"));
1841 } elseif ($disabledtask) {
1842 $titleassigntask = $langs->trans(
"AssignTaskToMe");
1843 if ($fuser->id != $user->id) {
1844 $titleassigntask = $langs->trans(
"AssignTaskToUser",
'...');
1847 print $form->textwithpicto(
'', $langs->trans(
"TaskIsNotAssignedToUser", $titleassigntask));
1856 if ($lines[$i]->
id > 0) {
1859 $ret =
projectLinesPerDay($inc, $lines[$i]->
id, $fuser, ($parent == 0 ? $lineswithoutlevel0 : $lines), $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $preselectedday, $isavailable, $oldprojectforbreak, $arrayfields, $extrafields);
1862 foreach ($ret as $key => $val) {
1863 $totalforeachday[$key] += $val;
1874 return $totalforeachday;
1897function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask, &$isavailable, $oldprojectforbreak = 0, $arrayfields = array(), $extrafields =
null)
1900 global $form, $formother, $projectstatic, $taskstatic, $thirdpartystatic;
1902 @phan-var-force FormOther $formother
1903 @phan-var-force Project $projectstatic
1904 @phan-var-force Task $taskstatic
1905 @phan-var-force Societe $thirdpartystatic
1908 $numlines = count($lines);
1911 $workloadforid = array();
1912 $totalforeachday = array();
1913 $lineswithoutlevel0 = array();
1917 for ($i = 0; $i < $numlines; $i++) {
1918 if ($lines[$i]->fk_task_parent) {
1919 $lineswithoutlevel0[] = $lines[$i];
1926 if (empty($oldprojectforbreak)) {
1927 $oldprojectforbreak = (!
getDolGlobalString(
'PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT') ? 0 : -1);
1930 $restrictBefore =
null;
1933 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
1937 for ($i = 0; $i < $numlines; $i++) {
1942 if ($lines[$i]->fk_task_parent == $parent) {
1946 if (empty($mine) || !empty($tasksrole[$lines[$i]->
id])) {
1949 if ($restricteditformytask == 2 && empty($tasksrole[$lines[$i]->
id])) {
1954 if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid) {
1955 $lastprojectid = $lines[$i]->fk_project;
1956 $projectstatic->id = $lines[$i]->fk_project;
1961 if (empty($workloadforid[$projectstatic->id])) {
1962 $projectstatic->loadTimeSpent($firstdaytoshow, 0, $fuser->id);
1963 $workloadforid[$projectstatic->id] = 1;
1968 $projectstatic->id = $lines[$i]->fk_project;
1969 $projectstatic->ref = $lines[$i]->projectref;
1970 $projectstatic->title = $lines[$i]->projectlabel;
1971 $projectstatic->public = $lines[$i]->public;
1972 $projectstatic->thirdparty_name = $lines[$i]->thirdparty_name;
1973 $projectstatic->status = $lines[$i]->projectstatus;
1975 $taskstatic->id = $lines[$i]->id;
1976 $taskstatic->ref = ($lines[$i]->ref ? $lines[$i]->ref : $lines[$i]->id);
1977 $taskstatic->label = $lines[$i]->label;
1978 $taskstatic->date_start = $lines[$i]->date_start;
1979 $taskstatic->date_end = $lines[$i]->date_end;
1981 $thirdpartystatic->id = $lines[$i]->thirdparty_id;
1982 $thirdpartystatic->name = $lines[$i]->thirdparty_name;
1983 $thirdpartystatic->email = $lines[$i]->thirdparty_email;
1985 if (empty($oldprojectforbreak) || ($oldprojectforbreak != -1 && $oldprojectforbreak != $projectstatic->id)) {
1987 if (!empty($arrayfields[
't.planned_workload'][
'checked'])) {
1990 if (!empty($arrayfields[
't.progress'][
'checked'])) {
1993 foreach ($arrayfields as $key => $val) {
1994 if ($val[
'checked'] && substr($key, 0, 5) ==
'efpt.') {
1999 print
'<tr class="oddeven trforbreak nobold">'.
"\n";
2000 print
'<td colspan="'.(11 + $addcolspan).
'">';
2001 print $projectstatic->getNomUrl(1,
'', 0,
'<strong>'.$langs->transnoentitiesnoconv(
"YourRole").
':</strong> '.$projectsrole[$lines[$i]->fk_project]);
2002 if ($thirdpartystatic->id > 0) {
2003 print
' - '.$thirdpartystatic->getNomUrl(1);
2005 if ($projectstatic->title) {
2007 print
'<span class="secondary">'.$projectstatic->title.
'</span>';
2074 if ($oldprojectforbreak != -1) {
2075 $oldprojectforbreak = $projectstatic->id;
2078 print
'<tr class="oddeven" data-taskid="'.$lines[$i]->id.
'">'.
"\n";
2089 print
'<td class="nowrap">';
2090 if ($oldprojectforbreak == -1) {
2091 print $projectstatic->getNomUrl(1,
'', 0, $langs->transnoentitiesnoconv(
"YourRole").
': '.$projectsrole[$lines[$i]->fk_project]);
2098 print
'<td class="tdoverflowmax100">';
2099 if ($thirdpartystatic->id > 0) {
2100 print $thirdpartystatic->getNomUrl(1,
'project');
2107 print
'<!-- Task id = '.$lines[$i]->id.
' (projectlinesperweek) -->';
2108 for ($k = 0; $k < $level; $k++) {
2109 print
'<div class="marginleftonly">';
2111 print $taskstatic->getNomUrl(1,
'withproject',
'time');
2114 print
'<div class="opacitymedium tdoverflowmax400 small" title="'.dol_escape_htmltag($taskstatic->label).
'">'.
dol_escape_htmltag($taskstatic->label).
'</div>';
2115 for ($k = 0; $k < $level; $k++) {
2121 $extrafieldsobjectkey =
'projet_task';
2122 $extrafieldsobjectprefix =
'efpt.';
2123 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
2126 if (!empty($arrayfields[
't.planned_workload'][
'checked'])) {
2127 print
'<td class="leftborder plannedworkload right">';
2128 if ($lines[$i]->planned_workload) {
2136 if (!empty($arrayfields[
't.progress'][
'checked'])) {
2138 print
'<td class="right">';
2139 print $formother->select_percent($lines[$i]->progress, $lines[$i]->
id.
'progress');
2143 if (!empty($arrayfields[
'timeconsumed'][
'checked'])) {
2145 print
'<td class="right">';
2147 if ($lines[$i]->duration_effective) {
2148 print
'<a href="'.DOL_URL_ROOT.
'/projet/tasks/time.php?id='.((int) $lines[$i]->
id).
'">';
2157 print
'<td class="right">';
2158 $tmptimespent = $taskstatic->getSummaryOfTimeSpent($fuser->id);
2159 if ($tmptimespent[
'total_duration']) {
2160 print
'<a href="'.DOL_URL_ROOT.
'/projet/tasks/time.php?id='.((int) $lines[$i]->
id).
'&search_user='.((int) $fuser->id).
'">';
2169 $disabledproject = 1;
2175 if ($lines[$i]->
public || !empty($projectsrole[$lines[$i]->fk_project]) || $user->hasRight(
'projet',
'all',
'creer')) {
2176 $disabledproject = 0;
2180 if ($restricteditformytask && empty($tasksrole[$lines[$i]->
id])) {
2188 $modeinput =
'hours';
2190 for ($idw = 0; $idw < 7; $idw++) {
2193 if (!isset($totalforeachday[$tmpday])) {
2194 $totalforeachday[$tmpday] = 0;
2197 if (!$isavailable[$tmpday][
'morning'] && !$isavailable[$tmpday][
'afternoon']) {
2198 $cssonholiday .=
'onholidayallday ';
2199 } elseif (!$isavailable[$tmpday][
'morning']) {
2200 $cssonholiday .=
'onholidaymorning ';
2201 } elseif (!$isavailable[$tmpday][
'afternoon']) {
2202 $cssonholiday .=
'onholidayafternoon ';
2206 $dayWorkLoad = (!empty($projectstatic->weekWorkLoadPerTask[$tmpday][$lines[$i]->id]) ? (int) $projectstatic->weekWorkLoadPerTask[$tmpday][$lines[$i]->id] : 0);
2207 $totalforeachday[$tmpday] += $dayWorkLoad;
2210 if ($dayWorkLoad > 0) {
2213 $alttitle = $langs->trans(
"AddHereTimeSpentForDay", !empty($tmparray[
'day']) ? $tmparray[
'day'] : 0, $tmparray[
'mon']);
2215 global $numstartworkingday, $numendworkingday;
2217 if (($idw + 1 < $numstartworkingday) || ($idw + 1 > $numendworkingday)) {
2218 $cssweekend =
'weekend';
2221 $disabledtaskday = $disabledtask;
2223 if (! $disabledtask && $restrictBefore && $tmpday < $restrictBefore) {
2224 $disabledtaskday = 1;
2227 $tableCell =
'<td class="center hide'.$idw.($cssonholiday ?
' '.$cssonholiday :
'').($cssweekend ?
' '.$cssweekend :
'').($j <= 1 ?
' borderleft' :
'').
'">';
2230 if ($alreadyspent) {
2231 $tableCell .=
'<span class="timesheetalreadyrecorded" title="texttoreplace"><input type="text" class="center smallpadd width50" disabled id="timespent['.$inc.
']['.$idw.
']" name="task['.$lines[$i]->id.
']['.$idw.
']" value="'.$alreadyspent.
'"></span>';
2235 $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"';
2236 $tableCell .=
' onkeypress="return regexEvent(this,event,\'timeChar\')"';
2237 $tableCell .=
' onkeyup="updateTotal('.$idw.
',\''.$modeinput.
'\')
"';
2238 $tableCell .= ' onblur="regexEvent(
this,event,\
''.$modeinput.
'\'); updateTotal(
'.$idw.',\
''.$modeinput.
'\')
" />';
2239 $tableCell .= '</td>';
2244 print '<td class="right
">';
2245 if ((!$lines[$i]->public) && $disabledproject) {
2246 print $form->textwithpicto('', $langs->trans("UserIsNotContactOfProject
"));
2247 } elseif ($disabledtask) {
2248 $titleassigntask = $langs->trans("AssignTaskToMe
");
2249 if ($fuser->id != $user->id) {
2250 $titleassigntask = $langs->trans("AssignTaskToUser
", '...');
2253 print $form->textwithpicto('', $langs->trans("TaskIsNotAssignedToUser
", $titleassigntask));
2260 // Call to show task with a lower level (task under the current task)
2263 if ($lines[$i]->id > 0) {
2264 //var_dump('totalforeachday after taskid='.$lines[$i]->id.' and previous one on level '.$level);
2265 //var_dump($totalforeachday);
2266 $ret = projectLinesPerWeek($inc, $firstdaytoshow, $fuser, $lines[$i]->id, ($parent == 0 ? $lineswithoutlevel0 : $lines), $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $isavailable, $oldprojectforbreak, $arrayfields, $extrafields);
2267 //var_dump('ret with parent='.$lines[$i]->id.' level='.$level);
2269 foreach ($ret as $key => $val) {
2270 $totalforeachday[$key] += $val;
2272 //var_dump('totalforeachday after taskid='.$lines[$i]->id.' and previous one on level '.$level.' + subtasks');
2273 //var_dump($totalforeachday);
2281 return $totalforeachday;
2304function projectLinesPerMonth(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask, &$isavailable, $oldprojectforbreak = 0, $TWeek = array(), $arrayfields = array(), $extrafields = null)
2306 global $conf, $db, $user, $langs;
2307 global $form, $formother, $projectstatic, $taskstatic, $thirdpartystatic;
2309 @phan-var-force FormOther $formother
2310 @phan-var-force Project $projectstatic
2311 @phan-var-force Task $taskstatic
2312 @phan-var-force Societe $thirdpartystatic
2315 $numlines = count($lines);
2318 $workloadforid = array();
2319 $totalforeachweek = array();
2320 $lineswithoutlevel0 = array();
2322 // Create a smaller array with sublevels only to be used later. This increase dramatically performances.
2323 if ($parent == 0) { // Always and only if at first level
2324 for ($i = 0; $i < $numlines; $i++) {
2325 if ($lines[$i]->fk_task_parent) {
2326 $lineswithoutlevel0[] = $lines[$i];
2331 //dol_syslog('projectLinesPerWeek inc='.$inc.' firstdaytoshow='.$firstdaytoshow.' task parent id='.$parent.' level='.$level." count(lines)=
".$numlines." count(lineswithoutlevel0)=
".count($lineswithoutlevel0));
2333 if (empty($oldprojectforbreak)) {
2334 $oldprojectforbreak = (!getDolGlobalString('PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT') ? 0 : -1); // 0 = start break, -1 = never break
2337 $restrictBefore = null;
2339 if (getDolGlobalInt('PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS')) {
2340 require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
2341 $restrictBefore = dol_time_plus_duree(dol_now(), -1 * getDolGlobalInt('PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS'), 'm');
2344 for ($i = 0; $i < $numlines; $i++) {
2349 if ($lines[$i]->fk_task_parent == $parent) {
2350 // If we want all or we have a role on task, we show it
2351 if (empty($mine) || !empty($tasksrole[$lines[$i]->id])) {
2352 //dol_syslog("projectLinesPerWeek Found line
".$i.", a qualified task (i have role or want to show all tasks) with
id=
".$lines[$i]->id." project
id=
".$lines[$i]->fk_project);
2354 if ($restricteditformytask == 2 && empty($tasksrole[$lines[$i]->id])) { // we have no role on task and we request to hide such cases
2358 // Break on a new project
2359 if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid) {
2360 $lastprojectid = $lines[$i]->fk_project;
2361 $projectstatic->id = $lines[$i]->fk_project;
2364 //var_dump('--- '.$level.' '.$firstdaytoshow.' '.$fuser->id.' '.$projectstatic->id.' '.$workloadforid[$projectstatic->id]);
2365 //var_dump($projectstatic->weekWorkLoadPerTask);
2366 if (empty($workloadforid[$projectstatic->id])) {
2367 $projectstatic->loadTimeSpentMonth($firstdaytoshow, 0, $fuser->id); // Load time spent from table element_time for the project into this->weekWorkLoad and this->weekWorkLoadPerTask for all days of a week
2368 $workloadforid[$projectstatic->id] = 1;
2370 //var_dump($projectstatic->weekWorkLoadPerTask);
2371 //var_dump('--- '.$projectstatic->id.' '.$workloadforid[$projectstatic->id]);
2373 $projectstatic->id = $lines[$i]->fk_project;
2374 $projectstatic->ref = $lines[$i]->projectref;
2375 $projectstatic->title = $lines[$i]->projectlabel;
2376 $projectstatic->public = $lines[$i]->public;
2377 $projectstatic->thirdparty_name = $lines[$i]->thirdparty_name;
2378 $projectstatic->status = $lines[$i]->projectstatus;
2380 $taskstatic->id = $lines[$i]->id;
2381 $taskstatic->ref = ($lines[$i]->ref ? $lines[$i]->ref : $lines[$i]->id);
2382 $taskstatic->label = $lines[$i]->label;
2383 $taskstatic->date_start = $lines[$i]->date_start;
2384 $taskstatic->date_end = $lines[$i]->date_end;
2386 $thirdpartystatic->id = $lines[$i]->thirdparty_id;
2387 $thirdpartystatic->name = $lines[$i]->thirdparty_name;
2388 $thirdpartystatic->email = $lines[$i]->thirdparty_email;
2390 if (empty($oldprojectforbreak) || ($oldprojectforbreak != -1 && $oldprojectforbreak != $projectstatic->id)) {
2391 print '<tr class="oddeven trforbreak nobold
">'."\n
";
2392 print '<td colspan="'.(6 + count($TWeek)).'">';
2393 print $projectstatic->getNomUrl(1, '', 0, '<strong>'.$langs->transnoentitiesnoconv("YourRole
").':</strong> '.$projectsrole[$lines[$i]->fk_project]);
2394 if ($thirdpartystatic->id > 0) {
2395 print ' - '.$thirdpartystatic->getNomUrl(1);
2397 if ($projectstatic->title) {
2399 print '<span class="secondary
">'.$projectstatic->title.'</span>';
2405 if ($oldprojectforbreak != -1) {
2406 $oldprojectforbreak = $projectstatic->id;
2408 print '<tr class="oddeven
" data-taskid="'.$lines[$i]->id.'">'."\n
";
2412 print '<td class="nowrap
">';
2413 print $fuser->getNomUrl(1, 'withproject', 'time');
2418 /*print '<td class="nowrap
">';
2419 if ($oldprojectforbreak == -1) print $projectstatic->getNomUrl(1,'',0,$langs->transnoentitiesnoconv("YourRole
").': '.$projectsrole[$lines[$i]->fk_project]);
2423 /*print '<td class="tdoverflowmax100
">';
2424 if ($thirdpartystatic->id > 0) print $thirdpartystatic->getNomUrl(1, 'project');
2428 print '<td class="nowrap
">';
2429 print '<!-- Task id = '.$lines[$i]->id.' (projectlinespermonth) -->';
2430 for ($k = 0; $k < $level; $k++) {
2431 print '<div class="marginleftonly
">';
2433 print $taskstatic->getNomUrl(1, 'withproject', 'time');
2436 print '<div class="opacitymedium tdoverflowmax400 small
" title="'.dol_escape_htmltag($taskstatic->label).'">'.dol_escape_htmltag($taskstatic->label).'</div>';
2437 for ($k = 0; $k < $level; $k++) {
2443 if (!empty($arrayfields['t.planned_workload']['checked'])) {
2444 print '<td class="leftborder plannedworkload right
">';
2445 if ($lines[$i]->planned_workload) {
2446 print convertSecondToTime($lines[$i]->planned_workload, 'allhourmin');
2453 // Progress declared %
2454 if (!empty($arrayfields['t.progress']['checked'])) {
2455 print '<td class="right
">';
2456 print $formother->select_percent($lines[$i]->progress, $lines[$i]->id.'progress');
2460 // Time spent by everybody
2461 if (!empty($arrayfields['timeconsumed']['checked'])) {
2462 print '<td class="right
">';
2463 // $lines[$i]->duration_effective is a denormalised field = summ of time spent by everybody for task. What we need is time consumed by user
2464 if ($lines[$i]->duration_effective) {
2465 print '<a href="'.DOL_URL_ROOT.'/projet/tasks/time.php?
id=
'.$lines[$i]->id.'">';
2466 print convertSecondToTime($lines[$i]->duration_effective, 'allhourmin');
2473 // Time spent by user
2474 print '<td class="right
">';
2475 $tmptimespent = $taskstatic->getSummaryOfTimeSpent($fuser->id);
2476 if ($tmptimespent['total_duration']) {
2477 print convertSecondToTime($tmptimespent['total_duration'], 'allhourmin');
2484 $disabledproject = 1;
2486 //print "x
".$lines[$i]->fk_project;
2487 //var_dump($lines[$i]);
2488 //var_dump($projectsrole[$lines[$i]->fk_project]);
2489 // If at least one role for project
2490 if ($lines[$i]->public || !empty($projectsrole[$lines[$i]->fk_project]) || $user->hasRight('projet', 'all', 'creer')) {
2491 $disabledproject = 0;
2494 // If $restricteditformytask is on and I have no role on task, i disable edit
2495 if ($restricteditformytask && empty($tasksrole[$lines[$i]->id])) {
2499 //var_dump($projectstatic->weekWorkLoadPerTask);
2501 // Fields to show current time
2503 $modeinput = 'hours';
2504 $TFirstDay = getFirstDayOfEachWeek($TWeek, (int) date('Y', $firstdaytoshow));
2505 $TFirstDay[reset($TWeek)] = 1;
2507 $firstdaytoshowarray = dol_getdate($firstdaytoshow);
2508 $year = $firstdaytoshowarray['year'];
2509 $month = $firstdaytoshowarray['mon'];
2511 foreach ($TWeek as $weekIndex => $weekNb) {
2513 $weekWorkLoad = !empty($projectstatic->monthWorkLoadPerTask[$weekNb][$lines[$i]->id]) ? (int) $projectstatic->monthWorkLoadPerTask[$weekNb][$lines[$i]->id] : 0 ;
2514 if (!isset($totalforeachweek[$weekNb])) {
2515 $totalforeachweek[$weekNb] = 0;
2517 $totalforeachweek[$weekNb] += $weekWorkLoad;
2520 if ($weekWorkLoad > 0) {
2521 $alreadyspent = convertSecondToTime($weekWorkLoad, 'allhourmin');
2523 $alttitle = $langs->trans("AddHereTimeSpentForWeek
", $weekNb);
2525 $disabledtaskweek = $disabledtask;
2526 $firstdayofweek = dol_mktime(0, 0, 0, $month, $TFirstDay[$weekIndex], $year);
2528 if (! $disabledtask && $restrictBefore && $firstdayofweek < $restrictBefore) {
2529 $disabledtaskweek = 1;
2532 $tableCell = '<td class="center hide
'.($j <= 1 ? ' borderleft
' : '').'">';
2534 if ($alreadyspent) {
2535 $tableCell .= '<span class="timesheetalreadyrecorded
" title="texttoreplace
"><input type="text
" class="center smallpadd width50
" disabled id="timespent[
'.$inc.'][
'.((int) $weekNb).']
" name="task[
'.$lines[$i]->id.'][
'.$weekNb.']
" value="'.$alreadyspent.'"></span>';
2536 //$placeholder=' placeholder="00:00
"';
2540 $tableCell .= '<input type="text
" alt="'.($disabledtaskweek ? '' : $alttitle).'" title="'.($disabledtaskweek ? '' : $alttitle).'" '.($disabledtaskweek ? 'disabled' : $placeholder).' class="center smallpadd width40
" id="timeadded[
'.$inc.'][
'.((int) $weekNb).']
" name="task[
'.$lines[$i]->id.'][
'.($TFirstDay[$weekNb] - 1).']
" value="" cols="2
" maxlength="5
"';
2541 $tableCell .= ' onkeypress="return regexEvent(
this,event,\
'timeChar\')"';
2542 $tableCell .=
' onkeyup="updateTotal('.$weekNb.
',\''.$modeinput.
'\')
"';
2543 $tableCell .= ' onblur="regexEvent(
this,event,\
''.$modeinput.
'\'); updateTotal(
'.$weekNb.',\
''.$modeinput.
'\')
" />';
2544 $tableCell .= '</td>';
2549 print '<td class="right
">';
2550 if ((!$lines[$i]->public) && $disabledproject) {
2551 print $form->textwithpicto('', $langs->trans("UserIsNotContactOfProject
"));
2552 } elseif ($disabledtask) {
2553 $titleassigntask = $langs->trans("AssignTaskToMe
");
2554 if ($fuser->id != $user->id) {
2555 $titleassigntask = $langs->trans("AssignTaskToUser
", '...');
2558 print $form->textwithpicto('', $langs->trans("TaskIsNotAssignedToUser
", $titleassigntask));
2565 // Call to show task with a lower level (task under the current task)
2568 if ($lines[$i]->id > 0) {
2569 //var_dump('totalforeachday after taskid='.$lines[$i]->id.' and previous one on level '.$level);
2570 //var_dump($totalforeachday);
2571 $ret = projectLinesPerMonth($inc, $firstdaytoshow, $fuser, $lines[$i]->id, ($parent == 0 ? $lineswithoutlevel0 : $lines), $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $isavailable, $oldprojectforbreak, $TWeek, $arrayfields);
2572 //var_dump('ret with parent='.$lines[$i]->id.' level='.$level);
2574 foreach ($ret as $key => $val) {
2575 $totalforeachweek[$key] += $val;
2577 //var_dump('totalforeachday after taskid='.$lines[$i]->id.' and previous one on level '.$level.' + subtasks');
2578 //var_dump($totalforeachday);
2586 return $totalforeachweek;
2599function searchTaskInChild(&$inc, $parent, &$lines, &$taskrole)
2601 //print 'Search in line with parent id = '.$parent.'<br>';
2602 $numlines = count($lines);
2603 for ($i = 0; $i < $numlines; $i++) {
2604 // Process line $lines[$i]
2605 if ($lines[$i]->fk_task_parent == $parent && $lines[$i]->id != $lines[$i]->fk_task_parent) {
2606 // If task is legitimate to show, no more need to search deeper
2607 if (isset($taskrole[$lines[$i]->id])) {
2608 //print 'Found a legitimate task id='.$lines[$i]->id.'<br>';
2613 searchTaskInChild($inc, $lines[$i]->id, $lines, $taskrole);
2614 //print 'Found inc='.$inc.'<br>';
2639function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks = 0, $status = -1, $listofoppstatus = array(), $hiddenfields = array(), $max = 0)
2641 global $langs, $conf, $user;
2642 global $theme_datacolor;
2644 $maxofloop = getDolGlobalString('MAIN_MAXLIST_OVERLOAD', 500);
2646 require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
2648 $listofstatus = array_keys($listofoppstatus);
2650 if (is_array($listofstatus) && getDolGlobalString('USE_COLOR_FOR_PROSPECTION_STATUS')) {
2651 // Define $themeColorId and array $statusOppList for each $listofstatus
2653 $statusOppList = array();
2654 foreach ($listofstatus as $oppStatus) {
2655 $oppStatusCode = dol_getIdFromCode($db, $oppStatus, 'c_lead_status', 'rowid', 'code');
2656 if ($oppStatusCode) {
2657 $statusOppList[$oppStatus]['code'] = $oppStatusCode;
2658 $statusOppList[$oppStatus]['color'] = isset($theme_datacolor[$themeColorId]) ? implode(', ', $theme_datacolor[$themeColorId]) : '';
2664 $projectstatic = new Project($db);
2665 $thirdpartystatic = new Societe($db);
2669 $project_year_filter = 0;
2671 $title = $langs->trans("
Projects");
2672 if (strcmp((string) $status, '') && $status >= 0) {
2673 $title = $langs->trans("Projects").' '.$langs->trans($projectstatic->labelStatus[$status]);
2676 print '<!-- print_projecttasks_array -->';
2677 print '<div class="div-
table-responsive-no-min
">';
2678 print '<table class="noborder centpercent
">';
2680 $sql = " FROM
".MAIN_DB_PREFIX."projet as p
";
2682 $sql .= ",
".MAIN_DB_PREFIX."projet_task as t
";
2683 $sql .= ",
".MAIN_DB_PREFIX."element_contact as ec
";
2684 $sql .= ",
".MAIN_DB_PREFIX."c_type_contact as ctc
";
2686 $sql .= " LEFT JOIN
".MAIN_DB_PREFIX."projet_task as t ON p.rowid = t.fk_projet
";
2688 $sql .= " WHERE p.entity IN (
".getEntity('project').")
";
2689 $sql .= " AND p.rowid IN (
".$db->sanitize((string) $projectsListId).")
";
2691 $sql .= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc =
".((int) $socid).")
";
2694 $sql .= " AND p.rowid = t.fk_projet
";
2695 $sql .= " AND ec.element_id = t.rowid
";
2696 $sql .= " AND ec.fk_socpeople =
".((int) $user->id);
2697 $sql .= " AND ec.fk_c_type_contact = ctc.rowid
"; // Replace the 2 lines with ec.fk_c_type_contact in $arrayidtypeofcontact
2698 $sql .= " AND ctc.element =
'project_task'";
2701 $sql .= " AND p.fk_statut =
".(int) $status;
2703 if (getDolGlobalString('PROJECT_LIMIT_YEAR_RANGE')) {
2704 $project_year_filter = GETPOST("project_year_filter
", 'alpha'); // '*' seems allowed
2705 //Check if empty or invalid year. Wildcard ignores the sql check
2706 if ($project_year_filter != "*
") {
2707 if (empty($project_year_filter) || !is_numeric($project_year_filter)) {
2708 $project_year_filter = date("Y
");
2710 $sql .= " AND (p.dateo IS NULL OR p.dateo <=
".$db->idate(dol_get_last_day((int) $project_year_filter, 12, false)).")
";
2711 $sql .= " AND (p.datee IS NULL OR p.datee >=
".$db->idate(dol_get_first_day((int) $project_year_filter, 1, false)).")
";
2715 // Get id of project we must show tasks
2716 $arrayidofprojects = array();
2718 $sql1 = "SELECT p.rowid as projectid
";
2720 $resql = $db->query($sql1);
2723 $num = $db->num_rows($resql);
2725 $objp = $db->fetch_object($resql);
2726 $arrayidofprojects[$objp->projectid] = $objp->projectid;
2730 dol_print_error($db);
2732 if (empty($arrayidofprojects)) {
2733 $arrayidofprojects[0] = -1;
2736 // Get list of project with calculation on tasks
2737 $sql2 = "SELECT p.rowid as projectid, p.ref, p.title, p.fk_soc,
";
2738 $sql2 .= " s.rowid as socid, s.nom as socname, s.name_alias,
";
2739 $sql2 .= " s.code_client, s.code_compta, s.client,
";
2740 $sql2 .= " s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur,
";
2741 $sql2 .= " s.logo, s.email, s.entity,
";
2742 $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,
";
2743 $sql2 .= " p.dateo, p.datee,
";
2744 $sql2 .= " COUNT(t.rowid) as nb, SUM(t.planned_workload) as planned_workload, SUM(t.planned_workload * t.progress / 100) as declared_progess_workload";
2745 $sql2 .= " FROM ".MAIN_DB_PREFIX."projet as p";
2746 $sql2 .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = p.fk_soc";
2747 $sql2 .= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task as t ON p.rowid = t.fk_projet";
2748 $sql2 .= " WHERE p.rowid IN (".
$db->sanitize(implode(',', $arrayidofprojects)).")";
2749 $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,";
2750 $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";
2751 $sql2 .= " ORDER BY p.title, p.
ref";
2753 $resql =
$db->query($sql2);
2757 $total_opp_amount = 0;
2758 $ponderated_opp_amount = 0;
2759 $total_plannedworkload = 0;
2760 $total_declaredprogressworkload = 0;
2762 $num =
$db->num_rows($resql);
2766 print
'<tr class="liste_titre">';
2767 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);
2770 if (!in_array(
'prospectionstatus', $hiddenfields)) {
2771 print_liste_field_titre(
"OpportunityStatus",
"",
"",
"",
"",
'style="max-width: 100px"', $sortfield, $sortorder,
'center ');
2773 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 ');
2778 if (!in_array(
'plannedworkload', $hiddenfields)) {
2779 print_liste_field_titre(
"PlannedWorkload",
"",
"",
"",
"",
'style="max-width: 100px"', $sortfield, $sortorder,
'right ');
2781 if (!in_array(
'declaredprogress', $hiddenfields)) {
2782 print_liste_field_titre(
"%",
"",
"",
"",
"",
'', $sortfield, $sortorder,
'right ', $langs->trans(
"ProgressDeclared"));
2785 if (!in_array(
'projectstatus', $hiddenfields)) {
2790 while ($i < $nbofloop) {
2791 $objp =
$db->fetch_object($resql);
2793 if ($max && $i >= $max) {
2796 $total_task += $objp->nb;
2797 $total_opp_amount += $objp->opp_amount;
2798 $opp_weighted_amount = $objp->opp_percent * $objp->opp_amount / 100;
2799 $ponderated_opp_amount +=
price2num($opp_weighted_amount);
2800 $plannedworkload = $objp->planned_workload;
2801 $total_plannedworkload += $plannedworkload;
2802 $declaredprogressworkload = $objp->declared_progess_workload;
2803 $total_declaredprogressworkload += $declaredprogressworkload;
2807 $projectstatic->id = $objp->projectid;
2808 $projectstatic->user_author_id = $objp->fk_user_creat;
2809 $projectstatic->public = $objp->public;
2812 $userAccess = $projectstatic->restrictedProjectArea($user);
2813 if ($userAccess >= 0) {
2814 $projectstatic->ref = $objp->ref;
2815 $projectstatic->status = $objp->status;
2816 $projectstatic->title = $objp->title;
2817 $projectstatic->date_end =
$db->jdate($objp->datee);
2818 $projectstatic->date_start =
$db->jdate($objp->dateo);
2820 print
'<tr class="oddeven">';
2822 print
'<td class="tdoverflowmax150">';
2823 print $projectstatic->getNomUrl(1,
'', 0,
'',
'-', 0, -1,
'nowraponall');
2824 if (!in_array(
'projectlabel', $hiddenfields)) {
2825 print
'<br><span class="opacitymedium small">'.dol_escape_htmltag($objp->title).
'</span>';
2829 print
'<td class="nowraponall tdoverflowmax100">';
2830 if ($objp->fk_soc > 0) {
2831 $thirdpartystatic->id = $objp->socid;
2832 $thirdpartystatic->name = $objp->socname;
2835 $thirdpartystatic->code_compta = $objp->code_compta;
2836 $thirdpartystatic->code_compta_client = $objp->code_compta;
2837 $thirdpartystatic->client = $objp->client;
2839 $thirdpartystatic->code_compta_fournisseur = $objp->code_compta_fournisseur;
2840 $thirdpartystatic->fournisseur = $objp->fournisseur;
2841 $thirdpartystatic->logo = $objp->logo;
2842 $thirdpartystatic->email = $objp->email;
2843 $thirdpartystatic->entity = $objp->entity;
2844 print $thirdpartystatic->getNomUrl(1);
2849 if (!in_array(
'prospectionstatus', $hiddenfields)) {
2850 print
'<td class="center tdoverflowmax75">';
2854 if ($langs->trans(
"OppStatus".$oppStatusCode) !=
"OppStatus".$oppStatusCode) {
2855 print $langs->trans(
"OppStatus".$oppStatusCode);
2858 if (isset($statusOppList[$objp->opp_status])) {
2859 $oppStatusCode = $statusOppList[$objp->opp_status][
'code'];
2860 $oppStatusColor = $statusOppList[$objp->opp_status][
'color'];
2863 $oppStatusColor =
'';
2865 if ($oppStatusCode) {
2866 if (!empty($oppStatusColor)) {
2867 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>';
2869 print
'<a href="'.dol_buildpath(
'/projet/list.php?search_opp_status='.$objp->opp_status, 1).
'" title="'.$langs->trans(
"OppStatus".$oppStatusCode).
'">'.$oppStatusCode.
'</a>';
2876 print
'<td class="right">';
2878 if ($objp->opp_percent && $objp->opp_amount) {
2879 $opp_weighted_amount = $objp->opp_percent * $objp->opp_amount / 100;
2880 $alttext = $langs->trans(
"OpportunityWeightedAmount").
' '.
price($opp_weighted_amount, 0,
'', 1, -1, 0,
$conf->currency);
2881 $ponderated_opp_amount +=
price2num($opp_weighted_amount);
2883 if ($objp->opp_amount) {
2884 print
'<span class="amount" title="'.$alttext.
'">'.$form->textwithpicto(
price($objp->opp_amount, 0,
'', 1, -1, 0), $alttext).
'</span>';
2890 print
'<td class="right">'.$objp->nb.
'</td>';
2892 $plannedworkload = $objp->planned_workload;
2893 $total_plannedworkload += $plannedworkload;
2894 if (!in_array(
'plannedworkload', $hiddenfields)) {
2895 print
'<td class="right nowraponall">'.($plannedworkload ?
convertSecondToTime($plannedworkload) :
'').
'</td>';
2897 if (!in_array(
'declaredprogress', $hiddenfields)) {
2898 $declaredprogressworkload = $objp->declared_progess_workload;
2899 $total_declaredprogressworkload += $declaredprogressworkload;
2900 print
'<td class="right nowraponall">';
2902 print($plannedworkload ? round(100 * $declaredprogressworkload / $plannedworkload, 0).
'%' :
'');
2907 if (!in_array(
'projectstatus', $hiddenfields)) {
2908 print
'<td class="right">';
2909 print $projectstatic->getLibStatut(3);
2915 $total_task += $objp->nb;
2916 $total_opp_amount += $objp->opp_amount;
2923 print
'<tr class="oddeven">';
2924 print
'<td class="nowrap" colspan="5">';
2925 print
'<span class="opacitymedium">'.$langs->trans(
"More").
'...'.($othernb < $maxofloop ?
' ('.$othernb.
')' :
'').
'</span>';
2930 print
'<tr class="liste_total">';
2931 print
'<td>'.$langs->trans(
"Total").
"</td><td></td>";
2933 if (!in_array(
'prospectionstatus', $hiddenfields)) {
2934 print
'<td class="liste_total"></td>';
2936 print
'<td class="liste_total right">';
2938 print $form->textwithpicto(
price($total_opp_amount, 0,
'', 1, -1, 0), $langs->trans(
"OpportunityPonderatedAmountDesc").
' : '.
price($ponderated_opp_amount, 0,
'', 1, -1, 0,
$conf->currency));
2942 print
'<td class="liste_total right">'.$total_task.
'</td>';
2943 if (!in_array(
'plannedworkload', $hiddenfields)) {
2944 print
'<td class="liste_total right">'.($total_plannedworkload ?
convertSecondToTime($total_plannedworkload) :
'').
'</td>';
2946 if (!in_array(
'declaredprogress', $hiddenfields)) {
2947 print
'<td class="liste_total right">'.($total_plannedworkload ? round(100 * $total_declaredprogressworkload / $total_plannedworkload, 0).
'%' :
'').
'</td>';
2950 if (!in_array(
'projectstatus', $hiddenfields)) {
2951 print
'<td class="liste_total"></td>';
2965 print
'<form method="GET" action="'.dolBuildUrl($_SERVER[
"PHP_SELF"]).
'">';
2966 print
'<table class="centpercent">';
2968 print
'<td>'.$langs->trans(
"Year").
'</td>';
2969 print
'<td class="right"><input type="text" size="4" class="flat" name="project_year_filter" value="'.((int) $project_year_filter).
'"/>';
2985function getTaskProgressView($task, $label =
true, $progressNumber =
true, $hideOnProgressNull =
false, $spaced =
false)
2987 global $langs,
$conf;
2991 $plannedworkloadoutputformat =
'allhourmin';
2992 $timespentoutputformat =
'allhourmin';
2994 $plannedworkloadoutputformat =
getDolGlobalString(
'PROJECT_PLANNED_WORKLOAD_FORMAT');
3000 if (empty($task->progress) && !empty($hideOnProgressNull)) {
3004 $spaced = !empty($spaced) ?
'spaced' :
'';
3009 $progressBarClass =
'progress-bar-info';
3010 $progressCalculated = 0;
3011 if ($task->planned_workload) {
3012 $progressCalculated = round(100 * (
float) $task->duration_effective / (
float) $task->planned_workload, 2);
3015 $warningRatio =
getDolGlobalString(
'PROJECT_TIME_SPEND_WARNING_PERCENT') ? (1 +
$conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT / 100) : 1.10;
3017 $diffTitle =
'<br>'.$langs->trans(
'ProgressDeclared').
' : '.$task->progress.(isset($task->progress) ?
'%' :
'');
3018 $diffTitle .=
'<br>'.$langs->trans(
'ProgressCalculated').
' : '.$progressCalculated.(isset($progressCalculated) ?
'%' :
'');
3021 if ((
float) $progressCalculated > (float) ($task->progress * $warningRatio)) {
3022 $progressBarClass =
'progress-bar-danger';
3023 $title = $langs->trans(
'TheReportedProgressIsLessThanTheCalculatedProgressionByX', abs($task->progress - $progressCalculated).
' '.$langs->trans(
"point"));
3024 $diff =
'<span class="text-danger classfortooltip paddingrightonly" title="'.dol_htmlentities($title.$diffTitle).
'" ><i class="fa fa-caret-down"></i> '.($task->progress - $progressCalculated).
'%</span>';
3025 } elseif ((
float) $progressCalculated > (
float) $task->progress) {
3026 $progressBarClass =
'progress-bar-warning';
3027 $title = $langs->trans(
'TheReportedProgressIsLessThanTheCalculatedProgressionByX', abs($task->progress - $progressCalculated).
' '.$langs->trans(
"point"));
3028 $diff =
'<span class="text-warning classfortooltip paddingrightonly" title="'.dol_htmlentities($title.$diffTitle).
'" ><i class="fa fa-caret-left"></i> '.($task->progress - $progressCalculated).
'%</span>';
3030 $progressBarClass =
'progress-bar-success';
3031 $title = $langs->trans(
'TheReportedProgressIsMoreThanTheCalculatedProgressionByX', ($task->progress - $progressCalculated).
' '.$langs->trans(
"point"));
3032 $diff =
'<span class="text-success classfortooltip paddingrightonly" title="'.dol_htmlentities($title.$diffTitle).
'" ><i class="fa fa-caret-up"></i> '.($task->progress - $progressCalculated).
'%</span>';
3036 $out .=
'<div class="progress-group">';
3038 if ($label !==
false) {
3039 $out .=
' <span class="progress-text">';
3041 if ($label !==
true) {
3050 if ($progressNumber !==
false) {
3051 $out .=
' <span class="progress-number">';
3052 if ($progressNumber !==
true) {
3053 $out .= $progressNumber;
3055 if ($task->hasDelay()) {
3059 $url = DOL_URL_ROOT.
'/projet/tasks/time.php?id='.$task->id;
3061 $out .= !empty($diff) ? $diff.
' ' :
'';
3062 $out .=
'<a href="'.$url.
'" >';
3063 $out .=
'<b title="'.$langs->trans(
'TimeSpent').
'" >';
3064 if ($task->duration_effective) {
3074 $out .=
'<a href="'.$url.
'" >';
3075 $out .=
'<span title="'.$langs->trans(
'PlannedWorkload').
'" >';
3076 if ($task->planned_workload) {
3088 $out .=
' <div class="progress sm'.($spaced ? $spaced :
'').
'">';
3089 $diffval = (float) $task->progress - (
float) $progressCalculated;
3090 if ($diffval >= 0) {
3092 $out .=
' <div class="progress-bar '.$progressBarClass.
'" style="width: '.(float) $task->progress.
'%" title="'.(
float) $task->progress.
'%">';
3093 if (!empty($task->progress)) {
3094 $out .=
' <div class="progress-bar progress-bar-consumed" style="width: '.(float) ($progressCalculated / ((
float) $task->progress == 0 ? 1 : $task->progress) * 100).
'%" title="'.(float) $progressCalculated.
'%"></div>';
3099 $out .=
' <div class="progress-bar progress-bar-consumed-late" style="width: '.(float) $progressCalculated.
'%" title="'.(
float) $progressCalculated.
'%">';
3100 $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>';
3119 global
$conf, $langs;
3123 if ($task->progress !=
'') {
3127 $badgeClass =
'badge ';
3128 if ($task->planned_workload) {
3129 $progressCalculated = round(100 * (
float) $task->duration_effective / (
float) $task->planned_workload, 2);
3132 $warningRatio =
getDolGlobalString(
'PROJECT_TIME_SPEND_WARNING_PERCENT') ? (1 +
$conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT / 100) : 1.10;
3134 if ((
float) $progressCalculated > (
float) ($task->progress * $warningRatio)) {
3135 $badgeClass .=
'badge-danger';
3136 if (empty($tooltip)) {
3137 $tooltip = $task->progress.
'% < '.$langs->trans(
"TimeConsumed").
' '.$progressCalculated.
'%';
3139 } elseif ((
float) $progressCalculated > (
float) $task->progress) {
3140 $badgeClass .=
'badge-warning';
3141 if (empty($tooltip)) {
3142 $tooltip = $task->progress.
'% < '.$langs->trans(
"TimeConsumed").
' '.$progressCalculated.
'%';
3145 $badgeClass .=
'badge-success';
3146 if (empty($tooltip)) {
3147 $tooltip = $task->progress.
'% >= '.$langs->trans(
"TimeConsumed").
' '.$progressCalculated.
'%';
3154 if (!empty($tooltip)) {
3155 $badgeClass .=
' classfortooltip';
3156 $title =
'title="'.dol_htmlentities($tooltip).
'"';
3159 if (empty($label)) {
3160 $label = $task->progress.
' %';
3163 if (!empty($label)) {
3164 $out =
'<span class="'.$badgeClass.
'" '.$title.
' >'.$label.
'</span>';
if(! $sortfield) if(! $sortorder) $object
Class for ConferenceOrBoothAttendee.
Class for ConferenceOrBooth.
static count($dbs, $objecttype, $objectid)
Return nb of links.
Class to manage emailings module.
Class to manage projects.
Class to manage Dolibarr users.
print $langs trans("Ref").' m titre as m m statut as status
Or an array listing all the potential status of the object: array: int of the status => translated la...
dol_time_plus_duree($time, $duration_value, $duration_unit, $ruleforendofmonth=0)
Add a delay to a date.
convertSecondToTime($iSecond, $format='all', $lengthOfDay=86400, $lengthOfWeek=7)
Return, in clear text, value of a number of seconds in days, hours and minutes.
print $script_file $mode $langs defaultlang(is_numeric($duration_value) ? " delay=". $duration_value :"").(is_numeric($duration_value2) ? " after cd cd cd description as p label as s rowid as s nom as s email
Sender: Who sends the email ("Sender" has sent emails on behalf of "From").
print $script_file $mode $langs defaultlang(is_numeric($duration_value) ? " delay=". $duration_value :"").(is_numeric($duration_value2) ? " after cd cd cd description as description
Only used if Module[ID]Desc translation string is not found.
dol_dir_list($utf8_path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0, $nbsecondsold=0)
Scan a directory and return a list of files/directories.
dol_now($mode='gmt')
Return date for now.
dol_getIdFromCode($db, $key, $tablename, $fieldkey='code', $fieldid='id', $entityfilter=0, $filters='', $useCache=true)
Return an id or code from a code or id.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
print_liste_field_titre($name, $file="", $field="", $begin="", $param="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dolBuildUrl($url, $params=[], $addtoken=false, $anchor='')
Return path of url.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0, $allowdash=0)
Clean a string to use it as a file name.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_htmlentities($string, $flags=ENT_QUOTES|ENT_SUBSTITUTE, $encoding='UTF-8', $double_encode=false)
Replace htmlentities functions.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, $mode='add', $filterorigmodule='')
Complete or removed entries into a head array (used to build tabs).
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_getdate($timestamp, $fast=false, $forcetimezone='')
Return an array with locale date info.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
treeview li table
No Email.
if(!defined( 'CSRFCHECK_WITH_TOKEN'))
Abort invoice creation with a given error message.
dol_setcache($memoryid, $data, $expire=0, $filecache=0, $replace=0)
Save data into a memory area shared by all users, all sessions on server.
dol_getcache($memoryid, $filecache=0)
Read a memory area shared by all users, all sessions on server.
Class to generate the form for creating a new ticket.
projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask, $preselectedday, &$isavailable, $oldprojectforbreak=0, $arrayfields=array(), $extrafields=null)
Output a task line into a pertime input mode.
task_prepare_head($object)
Prepare array with list of tabs.
searchTaskInChild(&$inc, $parent, &$lines, &$taskrole)
Search in task lines with a particular parent if there is a task for a particular user (in taskrole)
getTaskProgressView($task, $label=true, $progressNumber=true, $hideOnProgressNull=false, $spaced=false)
projectLinesPerAction(&$inc, $parent, $fuser, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask, $preselectedday, &$isavailable, $oldprojectforbreak=0)
Output a task line into a pertime input mode.
project_timesheet_prepare_head($mode, $fuser=null)
Prepare array with list of tabs.
project_admin_prepare_head()
Prepare array with list of tabs.
getTaskProgressBadge($task, $label='', $tooltip='')
projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask, &$isavailable, $oldprojectforbreak=0, $arrayfields=array(), $extrafields=null)
Output a task line into a perday input mode.
project_prepare_head(Project $project, $moreparam='')
Prepare array with list of tabs.