31require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
43 global $db, $langs,
$conf, $user;
48 $head[$h][0] = DOL_URL_ROOT.
'/projet/card.php?id='.((int) $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] = DOL_URL_ROOT.
'/projet/contact.php?id='.((int) $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';
84 $taskstatic =
new Task($db);
85 $nbTasks = count($taskstatic->getTasksArray(
null,
null, $project->id, 0, 0));
88 $head[$h][0] = DOL_URL_ROOT.
'/projet/tasks.php?id='.((int) $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] = DOL_URL_ROOT.
'/projet/tasks/time.php?withproject=1&projectid='.((int) $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';
131 if (isModEnabled(
"supplier_proposal") || isModEnabled(
"supplier_order") || isModEnabled(
"supplier_invoice")
132 || isModEnabled(
"propal") || isModEnabled(
'order')
133 || isModEnabled(
'invoice') || isModEnabled(
'contract')
134 || isModEnabled(
'intervention') || isModEnabled(
'agenda') || isModEnabled(
'deplacement') || isModEnabled(
'stock')) {
137 $cachekey =
'count_elements_project_'.$project->id;
139 if (!is_null($dataretrieved)) {
140 $nbElements = $dataretrieved;
142 if (isModEnabled(
'stock')) {
143 $nbElements += $project->getElementCount(
'stock',
'entrepot',
'fk_project');
145 if (isModEnabled(
"propal")) {
146 $nbElements += $project->getElementCount(
'propal',
'propal');
148 if (isModEnabled(
'order')) {
149 $nbElements += $project->getElementCount(
'order',
'commande');
151 if (isModEnabled(
'invoice')) {
152 $nbElements += $project->getElementCount(
'invoice',
'facture');
154 if (isModEnabled(
'invoice')) {
155 $nbElements += $project->getElementCount(
'invoice_predefined',
'facture_rec');
157 if (isModEnabled(
'supplier_proposal')) {
158 $nbElements += $project->getElementCount(
'proposal_supplier',
'supplier_proposal');
160 if (isModEnabled(
"supplier_order")) {
161 $nbElements += $project->getElementCount(
'order_supplier',
'commande_fournisseur');
163 if (isModEnabled(
"supplier_invoice")) {
164 $nbElements += $project->getElementCount(
'invoice_supplier',
'facture_fourn');
166 if (isModEnabled(
'contract')) {
167 $nbElements += $project->getElementCount(
'contract',
'contrat');
169 if (isModEnabled(
'intervention')) {
170 $nbElements += $project->getElementCount(
'intervention',
'fichinter');
172 if (isModEnabled(
"shipping")) {
173 $nbElements += $project->getElementCount(
'shipping',
'expedition');
175 if (isModEnabled(
'mrp')) {
176 $nbElements += $project->getElementCount(
'mrp',
'mrp_mo',
'fk_project');
178 if (isModEnabled(
'deplacement')) {
179 $nbElements += $project->getElementCount(
'trip',
'deplacement');
181 if (isModEnabled(
'expensereport')) {
182 $nbElements += $project->getElementCount(
'expensereport',
'expensereport');
184 if (isModEnabled(
'don')) {
185 $nbElements += $project->getElementCount(
'donation',
'don');
187 if (isModEnabled(
'loan')) {
188 $nbElements += $project->getElementCount(
'loan',
'loan');
190 if (isModEnabled(
'tax')) {
191 $nbElements += $project->getElementCount(
'chargesociales',
'chargesociales');
193 if (isModEnabled(
'project')) {
194 $nbElements += $project->getElementCount(
'project_task',
'projet_task');
196 if (isModEnabled(
'stock')) {
197 $nbElements += $project->getElementCount(
'stock_mouvement',
'stock');
199 if (isModEnabled(
'salaries')) {
200 $nbElements += $project->getElementCount(
'salaries',
'payment_salary');
202 if (isModEnabled(
"bank")) {
203 $nbElements += $project->getElementCount(
'variouspayment',
'payment_various');
207 $head[$h][0] = DOL_URL_ROOT.
'/projet/element.php?id='.$project->id;
208 $head[$h][1] = $langs->trans(
"ProjectOverview");
209 if ($nbElements > 0) {
210 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbElements.
'</span>';
212 $head[$h][2] =
'element';
216 if (isModEnabled(
'ticket') && $user->hasRight(
'ticket',
'read')) {
217 require_once DOL_DOCUMENT_ROOT.
'/ticket/class/ticket.class.php';
218 $Tickettatic =
new Ticket($db);
219 $nbTicket = $Tickettatic->getCountOfItemsLinkedByObjectID($project->id,
'fk_project',
'ticket');
220 $head[$h][0] = DOL_URL_ROOT.
'/ticket/list.php?projectid='.((int) $project->id);
221 $head[$h][1] = $langs->trans(
"Ticket");
223 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.($nbTicket).
'</span>';
225 $head[$h][2] =
'ticket';
229 if (isModEnabled(
'eventorganization') && !empty($project->usage_organize_event)) {
230 $langs->load(
'eventorganization');
231 $head[$h][0] = DOL_URL_ROOT .
'/eventorganization/conferenceorbooth_list.php?projectid=' . $project->id;
232 $head[$h][1] = $langs->trans(
"EventOrganization");
237 require_once DOL_DOCUMENT_ROOT.
'/core/lib/memory.lib.php';
238 $cachekey =
'count_conferenceorbooth_'.$project->id;
240 if (!is_null($dataretrieved)) {
241 $nbConfOrBooth = $dataretrieved;
243 require_once DOL_DOCUMENT_ROOT.
'/eventorganization/class/conferenceorbooth.class.php';
245 $result = $conforbooth->fetchAll(
'',
'', 0, 0,
'(t.fk_project:=:'.((
int) $project->id).
")");
247 if (!is_array($result) && $result < 0) {
250 $nbConfOrBooth = count($result);
254 $cachekey =
'count_attendees_'.$project->id;
256 if (!is_null($dataretrieved)) {
257 $nbAttendees = $dataretrieved;
259 require_once DOL_DOCUMENT_ROOT.
'/eventorganization/class/conferenceorboothattendee.class.php';
261 $result = $conforboothattendee->fetchAll(
'',
'', 0, 0,
'(t.fk_project:=:'.((
int) $project->id).
')');
263 if (!is_array($result) && $result < 0) {
264 setEventMessages($conforboothattendee->error, $conforboothattendee->errors,
'errors');
266 $nbAttendees = count($result);
270 if ($nbConfOrBooth > 0 || $nbAttendees > 0) {
271 $head[$h][1] .=
'<span class="badge marginleftonlyshort">';
272 $head[$h][1] .=
'<span title="'.dol_escape_htmltag($langs->trans(
"ConferenceOrBooth")).
'">'.$nbConfOrBooth.
'</span>';
273 $head[$h][1] .=
' + ';
274 $head[$h][1] .=
'<span title="'.dol_escape_htmltag($langs->trans(
"Attendees")).
'">'.$nbAttendees.
'</span>';
275 $head[$h][1] .=
'</span>';
277 $head[$h][2] =
'eventorganisation';
290 if (!empty($project->note_private)) {
293 if (!empty($project->note_public)) {
296 $head[$h][0] = DOL_URL_ROOT.
'/projet/note.php?id='.$project->id;
297 $head[$h][1] = $langs->trans(
'Notes');
299 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbNote.
'</span>';
301 $head[$h][2] =
'notes';
308 require_once DOL_DOCUMENT_ROOT.
'/core/lib/memory.lib.php';
309 $cachekey =
'count_attached_project_'.$project->id;
311 if (!is_null($dataretrieved)) {
312 $totalAttached = $dataretrieved;
314 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
315 require_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
316 $upload_dir =
$conf->project->multidir_output[empty($project->entity) ? 1 : $project->entity].
"/".
dol_sanitizeFileName($project->ref);
317 $nbFiles = count(
dol_dir_list($upload_dir,
'files', 0,
'',
'(\.meta|_preview.*\.png)$'));
318 $nbLinks =
Link::count($db, $project->element, $project->id);
319 $totalAttached = $nbFiles + $nbLinks;
322 $head[$h][0] = DOL_URL_ROOT.
'/projet/document.php?id='.$project->id;
323 $head[$h][1] = $langs->trans(
'Documents');
324 if (($totalAttached) > 0) {
325 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.($totalAttached).
'</span>';
327 $head[$h][2] =
'document';
334 require_once DOL_DOCUMENT_ROOT.
'/core/lib/memory.lib.php';
335 $cachekey =
'count_attached_project_'.$project->id;
337 if (!is_null($dataretrieved)) {
338 $nbComments = $dataretrieved;
340 $nbComments = $project->getNbComments();
343 $head[$h][0] = DOL_URL_ROOT.
'/projet/comment.php?id='.$project->id;
344 $head[$h][1] = $langs->trans(
"CommentLink");
345 if ($nbComments > 0) {
346 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbComments.
'</span>';
348 $head[$h][2] =
'project_comment';
352 $head[$h][0] = DOL_URL_ROOT.
'/projet/messaging.php?id='.$project->id;
353 $head[$h][1] = $langs->trans(
"Events");
354 if (isModEnabled(
'agenda') && ($user->hasRight(
'agenda',
'myactions',
'read') || $user->hasRight(
'agenda',
'allactions',
'read'))) {
356 $head[$h][1] .= $langs->trans(
"Agenda");
358 $head[$h][2] =
'agenda';
377 global $db, $langs,
$conf, $user;
381 $head[$h][0] = DOL_URL_ROOT.
'/projet/tasks/task.php?id='.
$object->id.(GETPOST(
'withproject') ?
'&withproject=1' :
'');
382 $head[$h][1] = $langs->trans(
"Task");
383 $head[$h][2] =
'task_task';
386 $nbContact = count(
$object->liste_contact(-1,
'internal')) + count(
$object->liste_contact(-1,
'external'));
387 $head[$h][0] = DOL_URL_ROOT.
'/projet/tasks/contact.php?id='.
$object->id.(GETPOST(
'withproject') ?
'&withproject=1' :
'');
388 $head[$h][1] = $langs->trans(
"TaskRessourceLinks");
389 if ($nbContact > 0) {
390 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbContact.
'</span>';
392 $head[$h][2] =
'task_contact';
397 $sql =
"SELECT t.rowid";
400 $sql .=
" FROM ".MAIN_DB_PREFIX.
"element_time as t";
401 $sql .=
" WHERE t.elementtype='task' AND t.fk_element = ".((int)
$object->id);
402 $resql = $db->query($sql);
404 $obj = $db->fetch_object($resql);
412 $head[$h][0] = DOL_URL_ROOT.
'/projet/tasks/time.php?id='.urlencode((
string)
$object->id).(GETPOST(
'withproject') ?
'&withproject=1' :
'');
413 $head[$h][1] = $langs->trans(
"TimeSpent");
414 if ($nbTimeSpent > 0) {
415 $head[$h][1] .=
'<span class="badge marginleftonlyshort">...</span>';
417 $head[$h][2] =
'task_time';
428 if (!empty(
$object->note_private)) {
431 if (!empty(
$object->note_public)) {
434 $head[$h][0] = DOL_URL_ROOT.
'/projet/tasks/note.php?id='.urlencode((
string)
$object->id).(GETPOST(
'withproject') ?
'&withproject=1' :
'');
435 $head[$h][1] = $langs->trans(
'Notes');
437 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbNote.
'</span>';
439 $head[$h][2] =
'task_notes';
443 $head[$h][0] = DOL_URL_ROOT.
'/projet/tasks/document.php?id='.
$object->id.(GETPOST(
'withproject') ?
'&withproject=1' :
'');
445 include_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
446 include_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
447 $nbFiles = count(
dol_dir_list($filesdir,
'files', 0,
'',
'(\.meta|_preview.*\.png)$'));
449 $head[$h][1] = $langs->trans(
'Documents');
450 if (($nbFiles + $nbLinks) > 0) {
451 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).
'</span>';
453 $head[$h][2] =
'task_document';
458 $nbComments =
$object->getNbComments();
459 $head[$h][0] = DOL_URL_ROOT.
'/projet/tasks/comment.php?id='.
$object->id.(GETPOST(
'withproject') ?
'&withproject=1' :
'');
460 $head[$h][1] = $langs->trans(
"CommentLink");
461 if ($nbComments > 0) {
462 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbComments.
'</span>';
464 $head[$h][2] =
'task_comment';
484 global $langs,
$conf, $user;
489 $param .= ($mode ?
'&mode='.$mode :
'');
490 if (is_object($fuser) && $fuser->id > 0 && $fuser->id != $user->id) {
491 $param .=
'&search_usertoprocessid='.$fuser->id;
495 $head[$h][0] = DOL_URL_ROOT.
"/projet/activity/permonth.php".($param ?
'?'.$param :
'');
496 $head[$h][1] = $langs->trans(
"InputPerMonth");
497 $head[$h][2] =
'inputpermonth';
502 $head[$h][0] = DOL_URL_ROOT.
"/projet/activity/perweek.php".($param ?
'?'.$param :
'');
503 $head[$h][1] = $langs->trans(
"InputPerWeek");
504 $head[$h][2] =
'inputperweek';
509 $head[$h][0] = DOL_URL_ROOT.
"/projet/activity/perday.php".($param ?
'?'.$param :
'');
510 $head[$h][1] = $langs->trans(
"InputPerDay");
511 $head[$h][2] =
'inputperday';
530 global $langs,
$conf, $user, $db;
533 $extrafields->fetch_name_optionals_label(
'projet');
534 $extrafields->fetch_name_optionals_label(
'projet_task');
539 $head[$h][0] = DOL_URL_ROOT.
"/projet/admin/project.php";
540 $head[$h][1] = $langs->trans(
"Projects");
541 $head[$h][2] =
'project';
546 $head[$h][0] = DOL_URL_ROOT.
"/projet/admin/project_extrafields.php";
547 $head[$h][1] = $langs->trans(
"ExtraFieldsProject");
548 $nbExtrafields = $extrafields->attributes[
'projet'][
'count'];
549 if ($nbExtrafields > 0) {
550 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
552 $head[$h][2] =
'attributes';
555 if (empty(
$conf->global->PROJECT_HIDE_TASKS)) {
556 $head[$h][0] = DOL_URL_ROOT .
'/projet/admin/project_task_extrafields.php';
557 $head[$h][1] = $langs->trans(
"ExtraFieldsProjectTask");
558 $nbExtrafields = $extrafields->attributes[
'projet_task'][
'count'];
559 if ($nbExtrafields > 0) {
560 $head[$h][1] .=
'<span class="badge marginleftonlyshort">' . $nbExtrafields .
'</span>';
562 $head[$h][2] =
'attributes_task';
567 $langs->load(
"members");
569 $head[$h][0] = DOL_URL_ROOT.
'/projet/admin/website.php';
570 $head[$h][1] = $langs->trans(
"BlankSubscriptionForm");
571 $head[$h][2] =
'website';
600function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$taskrole, $projectsListId =
'', $addordertick = 0, $projectidfortotallink = 0, $dummy =
'', $showbilltime = 0, $arrayfields = array(), $arrayofselected = array())
602 global $user, $langs,
$conf, $db, $hookmanager;
603 global $projectstatic, $taskstatic, $extrafields;
604 global $objectoffield;
607 @phan-var-force Project $projectstatic
608 @phan-var-force Task $taskstatic
609 @phan-var-force ExtraFields $extrafields
614 $projectsArrayId = array();
615 if ($projectsListId) {
616 $projectsArrayId = explode(
',', $projectsListId);
619 $numlines = count($lines);
622 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;
626 $total_projectlinesa_spent = 0;
627 $total_projectlinesa_planned = 0;
628 $total_projectlinesa_spent_if_planned = 0;
629 $total_projectlinesa_declared_if_planned = 0;
630 $total_projectlinesa_tobill = 0;
631 $total_projectlinesa_billed = 0;
632 $total_budget_amount = 0;
633 $totalarray = array();
636 for ($i = 0; $i < $numlines; $i++) {
637 if ($parent == 0 && $level >= 0) {
643 if ($lines[$i]->fk_task_parent == $parent || $level < 0) {
649 if (is_array($taskrole)) {
651 if (!isset($taskrole[$lines[$i]->
id]) && $lines[$i]->
id != $lines[$i]->fk_task_parent) {
653 $foundtaskforuserdeeper = 0;
656 if ($foundtaskforuserdeeper > 0) {
665 if (!$user->hasRight(
'projet',
'all',
'lire')) {
667 if (!in_array($lines[$i]->fk_project, $projectsArrayId)) {
678 if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid) {
679 $lastprojectid = $lines[$i]->fk_project;
682 print
'<tr class="oddeven" id="row-'.$lines[$i]->id.
'">'.
"\n";
684 $projectstatic->id = $lines[$i]->fk_project;
685 $projectstatic->ref = $lines[$i]->projectref;
686 $projectstatic->public = $lines[$i]->public;
687 $projectstatic->title = $lines[$i]->projectlabel;
688 $projectstatic->usage_bill_time = $lines[$i]->usage_bill_time;
689 $projectstatic->status = $lines[$i]->projectstatus;
691 $taskstatic->id = $lines[$i]->id;
692 $taskstatic->ref = $lines[$i]->ref;
693 $taskstatic->label = (!empty($taskrole[$lines[$i]->
id]) ? $langs->trans(
"YourRole").
': '.$taskrole[$lines[$i]->id] :
'');
694 $taskstatic->projectstatus = $lines[$i]->projectstatus;
695 $taskstatic->progress = $lines[$i]->progress;
696 $taskstatic->fk_statut = $lines[$i]->status;
697 $taskstatic->status = $lines[$i]->status;
698 $taskstatic->date_start = $lines[$i]->date_start;
699 $taskstatic->date_end = $lines[$i]->date_end;
700 $taskstatic->datee = $lines[$i]->date_end;
701 $taskstatic->planned_workload = $lines[$i]->planned_workload;
702 $taskstatic->duration_effective = $lines[$i]->duration_effective;
703 $taskstatic->budget_amount = $lines[$i]->budget_amount;
704 $taskstatic->billable = $lines[$i]->billable;
708 print
'<td class="nowrap center">';
710 if (in_array($lines[$i]->
id, $arrayofselected)) {
713 print
'<input id="cb' . $lines[$i]->id .
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="' . $lines[$i]->id .
'"' . ($selected ?
' checked="checked"' :
'') .
'>';
719 print
'<td class="nowraponall">';
721 if ($lines[$i]->
public || in_array($lines[$i]->fk_project, $projectsArrayId) || $user->hasRight(
'projet',
'all',
'lire')) {
722 print $projectstatic->getNomUrl(1);
724 print $projectstatic->getNomUrl(1,
'nolink');
731 $projectstatic->statut = $lines[$i]->projectstatus;
732 print $projectstatic->getLibStatut(2);
737 if (count($arrayfields) > 0 && !empty($arrayfields[
't.ref'][
'checked'])) {
738 print
'<td class="nowraponall">';
739 if ($showlineingray) {
740 print
'<i>'.img_object(
'',
'projecttask').
' '.$lines[$i]->ref.
'</i>';
742 print $taskstatic->getNomUrl(1,
'withproject');
748 if (count($arrayfields) > 0 && !empty($arrayfields[
't.label'][
'checked'])) {
750 if ($showlineingray) {
751 $labeltoshow .=
'<i>';
754 for ($k = 0; $k < $level; $k++) {
755 $labeltoshow .=
'<div class="marginleftonly">';
758 for ($k = 0; $k < $level; $k++) {
759 $labeltoshow .=
'</div>';
761 if ($showlineingray) {
762 $labeltoshow .=
'</i>';
764 print
'<td class="tdoverflowmax200" title="'.dol_escape_htmltag($labeltoshow).
'">';
769 if (count($arrayfields) > 0 && !empty($arrayfields[
't.description'][
'checked'])) {
770 print
'<td class="tdoverflowmax200" title="'.dol_escape_htmltag($lines[$i]->
description).
'">';
771 print $lines[$i]->description;
776 if (count($arrayfields) > 0 && !empty($arrayfields[
't.dateo'][
'checked'])) {
777 print
'<td class="center nowraponall">';
783 if (count($arrayfields) > 0 && !empty($arrayfields[
't.datee'][
'checked'])) {
784 print
'<td class="center nowraponall">';
786 if ($taskstatic->hasDelay()) {
792 $plannedworkloadoutputformat =
'allhourmin';
793 $timespentoutputformat =
'allhourmin';
802 if (count($arrayfields) > 0 && !empty($arrayfields[
't.planned_workload'][
'checked'])) {
803 print
'<td class="right">';
804 $fullhour =
convertSecondToTime($lines[$i]->planned_workload, $plannedworkloadoutputformat);
806 if ($lines[$i]->planned_workload !=
'') {
816 if (count($arrayfields) > 0 && !empty($arrayfields[
't.duration_effective'][
'checked'])) {
817 print
'<td class="right">';
818 if ($showlineingray) {
821 print
'<a href="'.DOL_URL_ROOT.
'/projet/tasks/time.php?id='.$lines[$i]->id.($showproject ?
'' :
'&withproject=1').
'">';
823 if ($lines[$i]->duration_effective) {
828 if ($showlineingray) {
837 if (count($arrayfields) > 0 && !empty($arrayfields[
't.progress_calculated'][
'checked'])) {
840 if ($lines[$i]->planned_workload || $lines[$i]->duration_effective) {
841 if ($lines[$i]->planned_workload) {
842 $s = round(100 * (
float) $lines[$i]->duration_effective / (
float) $lines[$i]->planned_workload, 2).
' %';
845 $s = $langs->trans(
'WorkloadNotDefined');
846 $shtml =
'<span class="opacitymedium">'.$s.
'</span>';
849 print
'<td class="right tdoverflowmax100" title="'.dol_escape_htmltag($s).
'">';
855 if (count($arrayfields) > 0 && !empty($arrayfields[
't.progress'][
'checked'])) {
856 print
'<td class="right">';
857 if ($lines[$i]->progress !=
'') {
864 if (count($arrayfields) > 0 && !empty($arrayfields[
't.progress_summary'][
'checked'])) {
865 print
'<td class="right">';
866 if ($lines[$i]->progress !=
'' && $lines[$i]->duration_effective) {
874 if (count($arrayfields) > 0 && !empty($arrayfields[
't.tobill'][
'checked'])) {
875 print
'<td class="right">';
876 if ($lines[$i]->usage_bill_time) {
878 $total_projectlinesa_tobill += $lines[$i]->tobill;
880 print
'<span class="opacitymedium">'.$langs->trans(
"NA").
'</span>';
886 if (count($arrayfields) > 0 && !empty($arrayfields[
't.billed'][
'checked'])) {
887 print
'<td class="right">';
888 if ($lines[$i]->usage_bill_time) {
890 $total_projectlinesa_billed += $lines[$i]->billed;
892 print
'<span class="opacitymedium">'.$langs->trans(
"NA").
'</span>';
899 if (count($arrayfields) > 0 && !empty($arrayfields[
't.budget_amount'][
'checked'])) {
900 print
'<td class="center">';
901 if ($lines[$i]->budget_amount) {
902 print
'<span class="amount">'.price($lines[$i]->budget_amount, 0, $langs, 1, 0, 0,
$conf->currency).
'</span>';
903 $total_budget_amount += $lines[$i]->budget_amount;
909 if (count($arrayfields) > 0 && !empty($arrayfields[
'c.assigned'][
'checked'])) {
910 print
'<td class="center">';
912 foreach (array(
'internal',
'external') as $source) {
914 $tab = $lines[$i]->liste_contact(-1, $source, 0,
'', 1);
916 $numcontact = count($tab);
917 if (!empty($numcontact)) {
918 foreach ($tab as $contacttask) {
919 if ($source ==
'internal') {
924 $c->fetch($contacttask[
'id']);
925 if (!empty(
$c->photo)) {
926 if (get_class(
$c) ==
'User') {
928 '@phan-var-force User $c';
929 print
$c->getNomUrl(-2,
'', 0, 0, 24, 1,
'', ($ifisrt ?
'' :
'notfirst'));
932 '@phan-var-force Contact $c';
933 print
$c->getNomUrl(-2,
'', 0,
'', -1, 0, ($ifisrt ?
'' :
'notfirst'));
936 if (get_class(
$c) ==
'User') {
938 '@phan-var-force User $c';
939 print
$c->getNomUrl(2,
'', 0, 0, 24, 1,
'', ($ifisrt ?
'' :
'notfirst'));
942 '@phan-var-force Contact $c';
943 print
$c->getNomUrl(2,
'', 0,
'', -1, 0, ($ifisrt ?
'' :
'notfirst'));
954 if (count($arrayfields) > 0 && !empty($arrayfields[
't.billable'][
'checked'])) {
955 print
'<td class="center">';
956 if ($lines[$i]->billable) {
957 print
'<span>'.$langs->trans(
'Yes').
'</span>';
959 print
'<span>'.$langs->trans(
'No').
'</span>';
965 $extrafieldsobjectkey = $taskstatic->table_element;
966 $extrafieldsobjectprefix =
'efpt.';
969 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
971 $parameters = array(
'arrayfields' => $arrayfields,
'obj' => $lines[$i]);
972 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters);
973 print $hookmanager->resPrint;
976 print
'<td class="tdlineupdown center"></td>';
980 print
'<td class="nowrap center">';
982 if (in_array($lines[$i]->
id, $arrayofselected)) {
985 print
'<input id="cb' . $lines[$i]->id .
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="' . $lines[$i]->id .
'"' . ($selected ?
' checked="checked"' :
'') .
'>';
992 if (!$showlineingray) {
998 if ($lines[$i]->
id) {
999 projectLinesa($inc, $lines[$i]->
id, $lines, $level,
'', $showproject, $taskrole, $projectsListId, $addordertick, $projectidfortotallink,
'', $showbilltime, $arrayfields);
1004 $total_projectlinesa_spent += $lines[$i]->duration_effective;
1005 $total_projectlinesa_planned += $lines[$i]->planned_workload;
1006 if ($lines[$i]->planned_workload) {
1007 $total_projectlinesa_spent_if_planned += $lines[$i]->duration_effective;
1009 if ($lines[$i]->planned_workload) {
1010 $total_projectlinesa_declared_if_planned += (float) $lines[$i]->planned_workload * $lines[$i]->progress / 100;
1019 if (($total_projectlinesa_planned > 0 || $total_projectlinesa_spent > 0 || $total_projectlinesa_tobill > 0 || $total_projectlinesa_billed > 0 || $total_budget_amount > 0)
1021 print
'<tr class="liste_total nodrag nodrop">';
1024 print
'<td class="liste_total"></td>';
1027 print
'<td class="liste_total">'.$langs->trans(
"Total").
'</td>';
1029 print
'<td></td><td></td>';
1031 if (count($arrayfields) > 0 && !empty($arrayfields[
't.label'][
'checked'])) {
1034 if (count($arrayfields) > 0 && !empty($arrayfields[
't.description'][
'checked'])) {
1037 if (count($arrayfields) > 0 && !empty($arrayfields[
't.dateo'][
'checked'])) {
1040 if (count($arrayfields) > 0 && !empty($arrayfields[
't.datee'][
'checked'])) {
1043 if (count($arrayfields) > 0 && !empty($arrayfields[
't.planned_workload'][
'checked'])) {
1044 print
'<td class="nowrap liste_total right">';
1048 if (count($arrayfields) > 0 && !empty($arrayfields[
't.duration_effective'][
'checked'])) {
1049 print
'<td class="nowrap liste_total right">';
1050 if ($projectidfortotallink > 0) {
1051 print
'<a href="'.DOL_URL_ROOT.
'/projet/tasks/time.php?projectid='.$projectidfortotallink.($showproject ?
'' :
'&withproject=1').
'">';
1054 if ($projectidfortotallink > 0) {
1060 $totalCalculatedProgress = 0;
1061 $totalAverageDeclaredProgress = 0;
1063 $progressBarClass =
'';
1064 if ($total_projectlinesa_planned) {
1065 $totalAverageDeclaredProgress = round(100 * $total_projectlinesa_declared_if_planned / $total_projectlinesa_planned, 2);
1066 $totalCalculatedProgress = round(100 * $total_projectlinesa_spent / $total_projectlinesa_planned, 2);
1069 $warningRatio =
getDolGlobalString(
'PROJECT_TIME_SPEND_WARNING_PERCENT') ? (1 +
$conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT / 100) : 1.10;
1072 $progressBarClass =
'progress-bar-info';
1073 $badgeClass =
'badge ';
1075 if ($totalCalculatedProgress > $totalAverageDeclaredProgress) {
1076 $progressBarClass =
'progress-bar-danger';
1077 $badgeClass .=
'badge-danger';
1078 } elseif ($totalCalculatedProgress * $warningRatio >= $totalAverageDeclaredProgress) {
1079 $progressBarClass =
'progress-bar-warning';
1080 $badgeClass .=
'badge-warning';
1082 $progressBarClass =
'progress-bar-success';
1083 $badgeClass .=
'badge-success';
1088 if (count($arrayfields) > 0 && !empty($arrayfields[
't.progress_calculated'][
'checked'])) {
1089 print
'<td class="nowrap liste_total right">';
1090 if ($total_projectlinesa_planned) {
1091 print $totalCalculatedProgress.
' %';
1097 if (count($arrayfields) > 0 && !empty($arrayfields[
't.progress'][
'checked'])) {
1098 print
'<td class="nowrap liste_total right">';
1099 if ($total_projectlinesa_planned) {
1100 print
'<span class="'.$badgeClass.
'" >'.$totalAverageDeclaredProgress.
' %</span>';
1107 if (count($arrayfields) > 0 && !empty($arrayfields[
't.progress_summary'][
'checked'])) {
1108 print
'<td class="right">';
1109 if ($total_projectlinesa_planned) {
1111 print
' <div class="progress sm" title="'.$totalAverageDeclaredProgress.
'%" >';
1112 print
' <div class="progress-bar '.$progressBarClass.
'" style="width: '.$totalAverageDeclaredProgress.
'%"></div>';
1119 if ($showbilltime) {
1120 if (count($arrayfields) > 0 && !empty($arrayfields[
't.tobill'][
'checked'])) {
1121 print
'<td class="nowrap liste_total right">';
1125 if (count($arrayfields) > 0 && !empty($arrayfields[
't.billed'][
'checked'])) {
1126 print
'<td class="nowrap liste_total right">';
1133 if (count($arrayfields) > 0 && !empty($arrayfields[
't.budget_amount'][
'checked'])) {
1134 print
'<td class="nowrap liste_total center">';
1135 if (strcmp((
string) $total_budget_amount,
'')) {
1136 print
price($total_budget_amount, 0, $langs, 1, 0, 0,
$conf->currency);
1146 if (count($arrayfields) > 0 && !empty($arrayfields[
'c.assigned'][
'checked'])) {
1151 if (!empty($extrafields->attributes[
'projet_task'][
'totalizable'])) {
1152 foreach ($extrafields->attributes[
'projet_task'][
'totalizable'] as $key => $value) {
1153 if (!empty($arrayfields[
'efpt.'.$key][
'checked']) && $arrayfields[
'efpt.'.$key][
'checked'] == 1) {
1154 print
'<td class="right">';
1156 print empty($totalarray[
'totalizable'][$key][
'total']) ?
'' : $totalarray[
'totalizable'][$key][
'total'];
1164 print
'<td class="liste_total"></td>';
1167 print
'<td class="liste_total"></td>';
1194function projectLinesPerAction(&$inc, $parent, $fuser, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask, $preselectedday, &$isavailable, $oldprojectforbreak = 0)
1196 global
$conf, $db, $user, $langs;
1197 global $form, $formother, $projectstatic, $taskstatic, $thirdpartystatic;
1199 @phan-var-force FormOther $formother
1200 @phan-var-force Project $projectstatic
1201 @phan-var-force Task $taskstatic
1202 @phan-var-force Societe $thirdpartystatic
1206 $totalforeachline = array();
1207 $workloadforid = array();
1208 $lineswithoutlevel0 = array();
1210 $numlines = count($lines);
1214 for ($i = 0; $i < $numlines; $i++) {
1215 if ($lines[$i]->fk_task_parent) {
1216 $lineswithoutlevel0[] = $lines[$i];
1221 if (empty($oldprojectforbreak)) {
1222 $oldprojectforbreak = (!
getDolGlobalString(
'PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT') ? 0 : -1);
1226 for ($i = 0; $i < $numlines; $i++) {
1234 if (empty($mine) || !empty($tasksrole[$lines[$i]->
id])) {
1238 if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid) {
1239 $lastprojectid = $lines[$i]->fk_project;
1240 if ($preselectedday) {
1241 $projectstatic->id = $lines[$i]->fk_project;
1245 if (empty($workloadforid[$projectstatic->id])) {
1246 if ($preselectedday) {
1247 $projectstatic->loadTimeSpent($preselectedday, 0, $fuser->id);
1248 $workloadforid[$projectstatic->id] = 1;
1252 $projectstatic->id = $lines[$i]->fk_project;
1253 $projectstatic->ref = $lines[$i]->project_ref;
1254 $projectstatic->title = $lines[$i]->project_label;
1255 $projectstatic->public = $lines[$i]->public;
1256 $projectstatic->status = $lines[$i]->project->status;
1258 $taskstatic->id = $lines[$i]->fk_statut;
1259 $taskstatic->ref = ($lines[$i]->task_ref ? $lines[$i]->task_ref : $lines[$i]->task_id);
1260 $taskstatic->label = $lines[$i]->task_label;
1261 $taskstatic->date_start = $lines[$i]->date_start;
1262 $taskstatic->date_end = $lines[$i]->date_end;
1264 $thirdpartystatic->id = $lines[$i]->socid;
1265 $thirdpartystatic->name = $lines[$i]->thirdparty_name;
1266 $thirdpartystatic->email = $lines[$i]->thirdparty_email;
1268 if (empty($oldprojectforbreak) || ($oldprojectforbreak != -1 && $oldprojectforbreak != $projectstatic->id)) {
1269 print
'<tr class="oddeven trforbreak nobold">'.
"\n";
1270 print
'<td colspan="11">';
1271 print $projectstatic->getNomUrl(1,
'', 0, $langs->transnoentitiesnoconv(
"YourRole").
': '.$projectsrole[$lines[$i]->fk_project]);
1272 if ($projectstatic->title) {
1274 print $projectstatic->title;
1280 if ($oldprojectforbreak != -1) {
1281 $oldprojectforbreak = $projectstatic->id;
1284 print
'<tr class="oddeven">'.
"\n";
1295 if ($oldprojectforbreak == -1) {
1296 print $projectstatic->getNomUrl(1,
'', 0, $langs->transnoentitiesnoconv(
"YourRole").
': '.$projectsrole[$lines[$i]->fk_project]);
1297 print
'<br>'.$projectstatic->title;
1302 print
'<td class="tdoverflowmax100">';
1303 if ($thirdpartystatic->id > 0) {
1304 print $thirdpartystatic->getNomUrl(1,
'project', 10);
1310 print
'<!-- Task id = '.$lines[$i]->id.
' (projectlinesperaction) -->';
1311 for ($k = 0; $k < $level; $k++) {
1312 print
'<div class="marginleftonly">';
1314 print $taskstatic->getNomUrl(1,
'withproject',
'time');
1317 print
'<div class="opacitymedium tdoverflowmax500" title="'.dol_escape_htmltag($taskstatic->label).
'">'.
dol_escape_htmltag($taskstatic->label).
'</div>';
1318 for ($k = 0; $k < $level; $k++) {
1324 print
'<td class="center">';
1328 $disabledproject = 1;
1334 if ($lines[$i]->
public || !empty($projectsrole[$lines[$i]->fk_project]) || $user->hasRight(
'projet',
'all',
'creer')) {
1335 $disabledproject = 0;
1339 if ($restricteditformytask && empty($tasksrole[$lines[$i]->
id])) {
1344 print
'<td class="nowrap center">';
1349 if (!$isavailable[$preselectedday][
'morning'] && !$isavailable[$preselectedday][
'afternoon']) {
1350 $cssonholiday .=
'onholidayallday ';
1351 } elseif (!$isavailable[$preselectedday][
'morning']) {
1352 $cssonholiday .=
'onholidaymorning ';
1353 } elseif (!$isavailable[$preselectedday][
'afternoon']) {
1354 $cssonholiday .=
'onholidayafternoon ';
1358 print
'<td class="duration'.($cssonholiday ?
' '.$cssonholiday :
'').
' center">';
1360 $dayWorkLoad = $lines[$i]->timespent_duration;
1361 if (!array_key_exists($preselectedday, $totalforeachline)) {
1362 $totalforeachline[$preselectedday] = 0;
1364 $totalforeachline[$preselectedday] += $lines[$i]->timespent_duration;
1367 if ($dayWorkLoad > 0) {
1376 print
'<td class="center">';
1377 print
'<textarea name="'.$lines[$i]->id.
'note" rows="'.ROWS_2.
'" id="'.$lines[$i]->id.
'note"'.($disabledtask ?
' disabled="disabled"' :
'').
'>';
1378 print $lines[$i]->timespent_note;
1379 print
'</textarea>';
1383 print
'<td class="right">';
1403 return $totalforeachline;
1426function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask, $preselectedday, &$isavailable, $oldprojectforbreak = 0, $arrayfields = array(), $extrafields =
null)
1428 global
$conf, $db, $user, $langs;
1429 global $form, $formother, $projectstatic, $taskstatic, $thirdpartystatic;
1431 @phan-var-force FormOther $formother
1432 @phan-var-force Project $projectstatic
1433 @phan-var-force Task $taskstatic
1434 @phan-var-force Societe $thirdpartystatic
1438 $totalforeachday = array();
1439 $workloadforid = array();
1440 $lineswithoutlevel0 = array();
1442 $numlines = count($lines);
1446 for ($i = 0; $i < $numlines; $i++) {
1447 if ($lines[$i]->fk_task_parent) {
1448 $lineswithoutlevel0[] = $lines[$i];
1453 if (empty($oldprojectforbreak)) {
1454 $oldprojectforbreak = (!
getDolGlobalString(
'PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT') ? 0 : -1);
1457 $restrictBefore =
null;
1460 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
1465 for ($i = 0; $i < $numlines; $i++) {
1470 if ($lines[$i]->fk_task_parent == $parent) {
1474 if (empty($mine) || !empty($tasksrole[$lines[$i]->
id])) {
1477 if ($restricteditformytask == 2 && empty($tasksrole[$lines[$i]->
id])) {
1482 if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid) {
1483 $lastprojectid = $lines[$i]->fk_project;
1484 if ($preselectedday) {
1485 $projectstatic->id = $lines[$i]->fk_project;
1489 if (empty($workloadforid[$projectstatic->id])) {
1490 if ($preselectedday) {
1491 $projectstatic->loadTimeSpent($preselectedday, 0, $fuser->id);
1492 $workloadforid[$projectstatic->id] = 1;
1496 $projectstatic->id = $lines[$i]->fk_project;
1497 $projectstatic->ref = $lines[$i]->projectref;
1498 $projectstatic->title = $lines[$i]->projectlabel;
1499 $projectstatic->public = $lines[$i]->public;
1500 $projectstatic->status = $lines[$i]->projectstatus;
1502 $taskstatic->id = $lines[$i]->id;
1503 $taskstatic->ref = ($lines[$i]->ref ? $lines[$i]->ref : $lines[$i]->id);
1504 $taskstatic->label = $lines[$i]->label;
1505 $taskstatic->date_start = $lines[$i]->date_start;
1506 $taskstatic->date_end = $lines[$i]->date_end;
1508 $thirdpartystatic->id = $lines[$i]->socid;
1509 $thirdpartystatic->name = $lines[$i]->thirdparty_name;
1510 $thirdpartystatic->email = $lines[$i]->thirdparty_email;
1512 if (empty($oldprojectforbreak) || ($oldprojectforbreak != -1 && $oldprojectforbreak != $projectstatic->id)) {
1514 if (!empty($arrayfields[
't.planned_workload'][
'checked'])) {
1517 if (!empty($arrayfields[
't.progress'][
'checked'])) {
1520 foreach ($arrayfields as $key => $val) {
1521 if ($val[
'checked'] && substr($key, 0, 5) ==
'efpt.') {
1526 print
'<tr class="oddeven trforbreak nobold">'.
"\n";
1527 print
'<td colspan="'.(7 + $addcolspan).
'">';
1528 print $projectstatic->getNomUrl(1,
'', 0,
'<strong>'.$langs->transnoentitiesnoconv(
"YourRole").
':</strong> '.$projectsrole[$lines[$i]->fk_project]);
1529 if ($thirdpartystatic->id > 0) {
1530 print
' - '.$thirdpartystatic->getNomUrl(1);
1532 if ($projectstatic->title) {
1534 print
'<span class="secondary">'.$projectstatic->title.
'</span>';
1601 if ($oldprojectforbreak != -1) {
1602 $oldprojectforbreak = $projectstatic->id;
1605 print
'<tr class="oddeven" data-taskid="'.$lines[$i]->id.
'">'.
"\n";
1617 if ($oldprojectforbreak == -1) {
1618 print $projectstatic->getNomUrl(1,
'', 0, $langs->transnoentitiesnoconv(
"YourRole").
': '.$projectsrole[$lines[$i]->fk_project]);
1625 print
'<td class="tdoverflowmax100">';
1626 if ($thirdpartystatic->id > 0) {
1627 print $thirdpartystatic->getNomUrl(1,
'project', 10);
1634 print
'<!-- Task id = '.$lines[$i]->id.
' (projectlinesperday) -->';
1635 for ($k = 0; $k < $level; $k++) {
1636 print
'<div class="marginleftonly">';
1638 print $taskstatic->getNomUrl(1,
'withproject',
'time');
1641 print
'<div class="opacitymedium tdoverflowmax500" title="'.dol_escape_htmltag($taskstatic->label).
'">'.
dol_escape_htmltag($taskstatic->label).
'</div>';
1642 for ($k = 0; $k < $level; $k++) {
1648 $extrafieldsobjectkey =
'projet_task';
1649 $extrafieldsobjectprefix =
'efpt.';
1650 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
1653 if (!empty($arrayfields[
't.planned_workload'][
'checked'])) {
1654 print
'<td class="leftborder plannedworkload right">';
1655 if ($lines[$i]->planned_workload) {
1664 if (!empty($arrayfields[
't.progress'][
'checked'])) {
1665 print
'<td class="right">';
1666 print $formother->select_percent($lines[$i]->progress, $lines[$i]->
id.
'progress');
1670 if (!empty($arrayfields[
'timeconsumed'][
'checked'])) {
1672 print
'<td class="right">';
1674 if ($lines[$i]->duration_effective) {
1675 print
'<a href="'.DOL_URL_ROOT.
'/projet/tasks/time.php?id='.$lines[$i]->id.
'">';
1684 print
'<td class="right">';
1685 $tmptimespent = $taskstatic->getSummaryOfTimeSpent($fuser->id);
1686 if ($tmptimespent[
'total_duration']) {
1694 $disabledproject = 1;
1700 if ($lines[$i]->
public || !empty($projectsrole[$lines[$i]->fk_project]) || $user->hasRight(
'projet',
'all',
'creer')) {
1701 $disabledproject = 0;
1705 if ($restricteditformytask && empty($tasksrole[$lines[$i]->
id])) {
1709 if ($restrictBefore && $preselectedday < $restrictBefore) {
1714 print
'<td class="nowraponall leftborder center minwidth150imp borderleft">';
1715 $tableCell = $form->selectDate($preselectedday, $lines[$i]->
id, 1, 1, 2,
"addtime", 0, 0, $disabledtask);
1720 if (!$isavailable[$preselectedday][
'morning'] && !$isavailable[$preselectedday][
'afternoon']) {
1721 $cssonholiday .=
'onholidayallday ';
1722 } elseif (!$isavailable[$preselectedday][
'morning']) {
1723 $cssonholiday .=
'onholidaymorning ';
1724 } elseif (!$isavailable[$preselectedday][
'afternoon']) {
1725 $cssonholiday .=
'onholidayafternoon ';
1732 global $numstartworkingday, $numendworkingday;
1734 if ((($idw + 1) < $numstartworkingday) || (($idw + 1) > $numendworkingday)) {
1735 $cssweekend =
'weekend';
1739 print
'<td class="center duration'.($cssonholiday ?
' '.$cssonholiday :
'').($cssweekend ?
' '.$cssweekend :
'').
'">';
1740 $dayWorkLoad = empty($projectstatic->weekWorkLoadPerTask[$preselectedday][$lines[$i]->id]) ? 0 : $projectstatic->weekWorkLoadPerTask[$preselectedday][$lines[$i]->id];
1741 if (!isset($totalforeachday[$preselectedday])) {
1742 $totalforeachday[$preselectedday] = 0;
1744 $totalforeachday[$preselectedday] += $dayWorkLoad;
1747 if ($dayWorkLoad > 0) {
1754 $tableCell .=
'<span class="timesheetalreadyrecorded" title="texttoreplace"><input type="text" class="center width40" disabled id="timespent['.$inc.
']['.$idw.
']" name="task['.$lines[$i]->id.
']['.$idw.
']" value="'.$alreadyspent.
'"></span>';
1755 $tableCell .=
'<span class="hideonsmartphone"> + </span>';
1757 $tableCell .= $form->select_duration($lines[$i]->
id.
'duration',
'', $disabledtask,
'text', 0, 1);
1764 print
'<td class="center">';
1765 print
'<textarea name="'.$lines[$i]->id.
'note" rows="'.ROWS_2.
'" id="'.$lines[$i]->id.
'note"'.($disabledtask ?
' disabled="disabled"' :
'').
'>';
1766 print
'</textarea>';
1770 print
'<td class="right">';
1771 if ((!$lines[$i]->
public) && $disabledproject) {
1772 print $form->textwithpicto(
'', $langs->trans(
"UserIsNotContactOfProject"));
1773 } elseif ($disabledtask) {
1774 $titleassigntask = $langs->trans(
"AssignTaskToMe");
1775 if ($fuser->id != $user->id) {
1776 $titleassigntask = $langs->trans(
"AssignTaskToUser",
'...');
1779 print $form->textwithpicto(
'', $langs->trans(
"TaskIsNotAssignedToUser", $titleassigntask));
1788 if ($lines[$i]->
id > 0) {
1791 $ret =
projectLinesPerDay($inc, $lines[$i]->
id, $fuser, ($parent == 0 ? $lineswithoutlevel0 : $lines), $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $preselectedday, $isavailable, $oldprojectforbreak, $arrayfields, $extrafields);
1794 foreach ($ret as $key => $val) {
1795 $totalforeachday[$key] += $val;
1806 return $totalforeachday;
1829function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask, &$isavailable, $oldprojectforbreak = 0, $arrayfields = array(), $extrafields =
null)
1831 global
$conf, $db, $user, $langs;
1832 global $form, $formother, $projectstatic, $taskstatic, $thirdpartystatic;
1834 @phan-var-force FormOther $formother
1835 @phan-var-force Project $projectstatic
1836 @phan-var-force Task $taskstatic
1837 @phan-var-force Societe $thirdpartystatic
1840 $numlines = count($lines);
1843 $workloadforid = array();
1844 $totalforeachday = array();
1845 $lineswithoutlevel0 = array();
1849 for ($i = 0; $i < $numlines; $i++) {
1850 if ($lines[$i]->fk_task_parent) {
1851 $lineswithoutlevel0[] = $lines[$i];
1858 if (empty($oldprojectforbreak)) {
1859 $oldprojectforbreak = (!
getDolGlobalString(
'PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT') ? 0 : -1);
1862 $restrictBefore =
null;
1865 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
1869 for ($i = 0; $i < $numlines; $i++) {
1874 if ($lines[$i]->fk_task_parent == $parent) {
1878 if (empty($mine) || !empty($tasksrole[$lines[$i]->
id])) {
1881 if ($restricteditformytask == 2 && empty($tasksrole[$lines[$i]->
id])) {
1886 if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid) {
1887 $lastprojectid = $lines[$i]->fk_project;
1888 $projectstatic->id = $lines[$i]->fk_project;
1893 if (empty($workloadforid[$projectstatic->id])) {
1894 $projectstatic->loadTimeSpent($firstdaytoshow, 0, $fuser->id);
1895 $workloadforid[$projectstatic->id] = 1;
1900 $projectstatic->id = $lines[$i]->fk_project;
1901 $projectstatic->ref = $lines[$i]->projectref;
1902 $projectstatic->title = $lines[$i]->projectlabel;
1903 $projectstatic->public = $lines[$i]->public;
1904 $projectstatic->thirdparty_name = $lines[$i]->thirdparty_name;
1905 $projectstatic->status = $lines[$i]->projectstatus;
1907 $taskstatic->id = $lines[$i]->id;
1908 $taskstatic->ref = ($lines[$i]->ref ? $lines[$i]->ref : $lines[$i]->id);
1909 $taskstatic->label = $lines[$i]->label;
1910 $taskstatic->date_start = $lines[$i]->date_start;
1911 $taskstatic->date_end = $lines[$i]->date_end;
1913 $thirdpartystatic->id = $lines[$i]->thirdparty_id;
1914 $thirdpartystatic->name = $lines[$i]->thirdparty_name;
1915 $thirdpartystatic->email = $lines[$i]->thirdparty_email;
1917 if (empty($oldprojectforbreak) || ($oldprojectforbreak != -1 && $oldprojectforbreak != $projectstatic->id)) {
1919 if (!empty($arrayfields[
't.planned_workload'][
'checked'])) {
1922 if (!empty($arrayfields[
't.progress'][
'checked'])) {
1925 foreach ($arrayfields as $key => $val) {
1926 if ($val[
'checked'] && substr($key, 0, 5) ==
'efpt.') {
1931 print
'<tr class="oddeven trforbreak nobold">'.
"\n";
1932 print
'<td colspan="'.(11 + $addcolspan).
'">';
1933 print $projectstatic->getNomUrl(1,
'', 0,
'<strong>'.$langs->transnoentitiesnoconv(
"YourRole").
':</strong> '.$projectsrole[$lines[$i]->fk_project]);
1934 if ($thirdpartystatic->id > 0) {
1935 print
' - '.$thirdpartystatic->getNomUrl(1);
1937 if ($projectstatic->title) {
1939 print
'<span class="secondary">'.$projectstatic->title.
'</span>';
2006 if ($oldprojectforbreak != -1) {
2007 $oldprojectforbreak = $projectstatic->id;
2010 print
'<tr class="oddeven" data-taskid="'.$lines[$i]->id.
'">'.
"\n";
2021 print
'<td class="nowrap">';
2022 if ($oldprojectforbreak == -1) {
2023 print $projectstatic->getNomUrl(1,
'', 0, $langs->transnoentitiesnoconv(
"YourRole").
': '.$projectsrole[$lines[$i]->fk_project]);
2030 print
'<td class="tdoverflowmax100">';
2031 if ($thirdpartystatic->id > 0) {
2032 print $thirdpartystatic->getNomUrl(1,
'project');
2038 print
'<td class="tdoverflowmax300">';
2039 print
'<!-- Task id = '.$lines[$i]->id.
' (projectlinesperweek) -->';
2040 for ($k = 0; $k < $level; $k++) {
2041 print
'<div class="marginleftonly">';
2043 print $taskstatic->getNomUrl(1,
'withproject',
'time');
2046 print
'<div class="opacitymedium tdoverflowmax500" title="'.dol_escape_htmltag($taskstatic->label).
'">'.
dol_escape_htmltag($taskstatic->label).
'</div>';
2047 for ($k = 0; $k < $level; $k++) {
2053 $extrafieldsobjectkey =
'projet_task';
2054 $extrafieldsobjectprefix =
'efpt.';
2055 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
2058 if (!empty($arrayfields[
't.planned_workload'][
'checked'])) {
2059 print
'<td class="leftborder plannedworkload right">';
2060 if ($lines[$i]->planned_workload) {
2068 if (!empty($arrayfields[
't.progress'][
'checked'])) {
2070 print
'<td class="right">';
2071 print $formother->select_percent($lines[$i]->progress, $lines[$i]->
id.
'progress');
2075 if (!empty($arrayfields[
'timeconsumed'][
'checked'])) {
2077 print
'<td class="right">';
2079 if ($lines[$i]->duration_effective) {
2080 print
'<a href="'.DOL_URL_ROOT.
'/projet/tasks/time.php?id='.((int) $lines[$i]->
id).
'">';
2089 print
'<td class="right">';
2090 $tmptimespent = $taskstatic->getSummaryOfTimeSpent($fuser->id);
2091 if ($tmptimespent[
'total_duration']) {
2092 print
'<a href="'.DOL_URL_ROOT.
'/projet/tasks/time.php?id='.((int) $lines[$i]->
id).
'&search_user='.((int) $fuser->id).
'">';
2101 $disabledproject = 1;
2107 if ($lines[$i]->
public || !empty($projectsrole[$lines[$i]->fk_project]) || $user->hasRight(
'projet',
'all',
'creer')) {
2108 $disabledproject = 0;
2112 if ($restricteditformytask && empty($tasksrole[$lines[$i]->
id])) {
2120 $modeinput =
'hours';
2122 for ($idw = 0; $idw < 7; $idw++) {
2125 if (!isset($totalforeachday[$tmpday])) {
2126 $totalforeachday[$tmpday] = 0;
2129 if (!$isavailable[$tmpday][
'morning'] && !$isavailable[$tmpday][
'afternoon']) {
2130 $cssonholiday .=
'onholidayallday ';
2131 } elseif (!$isavailable[$tmpday][
'morning']) {
2132 $cssonholiday .=
'onholidaymorning ';
2133 } elseif (!$isavailable[$tmpday][
'afternoon']) {
2134 $cssonholiday .=
'onholidayafternoon ';
2138 $dayWorkLoad = (!empty($projectstatic->weekWorkLoadPerTask[$tmpday][$lines[$i]->id]) ? $projectstatic->weekWorkLoadPerTask[$tmpday][$lines[$i]->id] : 0);
2139 $totalforeachday[$tmpday] += $dayWorkLoad;
2142 if ($dayWorkLoad > 0) {
2145 $alttitle = $langs->trans(
"AddHereTimeSpentForDay", !empty($tmparray[
'day']) ? $tmparray[
'day'] : 0, $tmparray[
'mon']);
2147 global $numstartworkingday, $numendworkingday;
2149 if (($idw + 1 < $numstartworkingday) || ($idw + 1 > $numendworkingday)) {
2150 $cssweekend =
'weekend';
2153 $disabledtaskday = $disabledtask;
2155 if (! $disabledtask && $restrictBefore && $tmpday < $restrictBefore) {
2156 $disabledtaskday = 1;
2159 $tableCell =
'<td class="center hide'.$idw.($cssonholiday ?
' '.$cssonholiday :
'').($cssweekend ?
' '.$cssweekend :
'').($j <= 1 ?
' borderleft' :
'').
'">';
2162 if ($alreadyspent) {
2163 $tableCell .=
'<span class="timesheetalreadyrecorded" title="texttoreplace"><input type="text" class="center smallpadd width40" disabled id="timespent['.$inc.
']['.$idw.
']" name="task['.$lines[$i]->id.
']['.$idw.
']" value="'.$alreadyspent.
'"></span>';
2167 $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"';
2168 $tableCell .=
' onkeypress="return regexEvent(this,event,\'timeChar\')"';
2169 $tableCell .=
' onkeyup="updateTotal('.$idw.
',\''.$modeinput.
'\')
"';
2170 $tableCell .= ' onblur="regexEvent(
this,event,\
''.$modeinput.
'\'); updateTotal(
'.$idw.',\
''.$modeinput.
'\')
" />';
2171 $tableCell .= '</td>';
2176 print '<td class="right
">';
2177 if ((!$lines[$i]->public) && $disabledproject) {
2178 print $form->textwithpicto('', $langs->trans("UserIsNotContactOfProject
"));
2179 } elseif ($disabledtask) {
2180 $titleassigntask = $langs->trans("AssignTaskToMe
");
2181 if ($fuser->id != $user->id) {
2182 $titleassigntask = $langs->trans("AssignTaskToUser
", '...');
2185 print $form->textwithpicto('', $langs->trans("TaskIsNotAssignedToUser
", $titleassigntask));
2192 // Call to show task with a lower level (task under the current task)
2195 if ($lines[$i]->id > 0) {
2196 //var_dump('totalforeachday after taskid='.$lines[$i]->id.' and previous one on level '.$level);
2197 //var_dump($totalforeachday);
2198 $ret = projectLinesPerWeek($inc, $firstdaytoshow, $fuser, $lines[$i]->id, ($parent == 0 ? $lineswithoutlevel0 : $lines), $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $isavailable, $oldprojectforbreak, $arrayfields, $extrafields);
2199 //var_dump('ret with parent='.$lines[$i]->id.' level='.$level);
2201 foreach ($ret as $key => $val) {
2202 $totalforeachday[$key] += $val;
2204 //var_dump('totalforeachday after taskid='.$lines[$i]->id.' and previous one on level '.$level.' + subtasks');
2205 //var_dump($totalforeachday);
2213 return $totalforeachday;
2236function projectLinesPerMonth(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask, &$isavailable, $oldprojectforbreak = 0, $TWeek = array(), $arrayfields = array(), $extrafields = null)
2238 global $conf, $db, $user, $langs;
2239 global $form, $formother, $projectstatic, $taskstatic, $thirdpartystatic;
2241 @phan-var-force FormOther $formother
2242 @phan-var-force Project $projectstatic
2243 @phan-var-force Task $taskstatic
2244 @phan-var-force Societe $thirdpartystatic
2247 $numlines = count($lines);
2250 $workloadforid = array();
2251 $totalforeachweek = array();
2252 $lineswithoutlevel0 = array();
2254 // Create a smaller array with sublevels only to be used later. This increase dramatically performances.
2255 if ($parent == 0) { // Always and only if at first level
2256 for ($i = 0; $i < $numlines; $i++) {
2257 if ($lines[$i]->fk_task_parent) {
2258 $lineswithoutlevel0[] = $lines[$i];
2263 //dol_syslog('projectLinesPerWeek inc='.$inc.' firstdaytoshow='.$firstdaytoshow.' task parent id='.$parent.' level='.$level." count(lines)=
".$numlines." count(lineswithoutlevel0)=
".count($lineswithoutlevel0));
2265 if (empty($oldprojectforbreak)) {
2266 $oldprojectforbreak = (!getDolGlobalString('PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT') ? 0 : -1); // 0 = start break, -1 = never break
2269 $restrictBefore = null;
2271 if (getDolGlobalInt('PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS')) {
2272 require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
2273 $restrictBefore = dol_time_plus_duree(dol_now(), -1 * getDolGlobalInt('PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS'), 'm');
2276 for ($i = 0; $i < $numlines; $i++) {
2281 if ($lines[$i]->fk_task_parent == $parent) {
2282 // If we want all or we have a role on task, we show it
2283 if (empty($mine) || !empty($tasksrole[$lines[$i]->id])) {
2284 //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);
2286 if ($restricteditformytask == 2 && empty($tasksrole[$lines[$i]->id])) { // we have no role on task and we request to hide such cases
2290 // Break on a new project
2291 if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid) {
2292 $lastprojectid = $lines[$i]->fk_project;
2293 $projectstatic->id = $lines[$i]->fk_project;
2296 //var_dump('--- '.$level.' '.$firstdaytoshow.' '.$fuser->id.' '.$projectstatic->id.' '.$workloadforid[$projectstatic->id]);
2297 //var_dump($projectstatic->weekWorkLoadPerTask);
2298 if (empty($workloadforid[$projectstatic->id])) {
2299 $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
2300 $workloadforid[$projectstatic->id] = 1;
2302 //var_dump($projectstatic->weekWorkLoadPerTask);
2303 //var_dump('--- '.$projectstatic->id.' '.$workloadforid[$projectstatic->id]);
2305 $projectstatic->id = $lines[$i]->fk_project;
2306 $projectstatic->ref = $lines[$i]->projectref;
2307 $projectstatic->title = $lines[$i]->projectlabel;
2308 $projectstatic->public = $lines[$i]->public;
2309 $projectstatic->thirdparty_name = $lines[$i]->thirdparty_name;
2310 $projectstatic->status = $lines[$i]->projectstatus;
2312 $taskstatic->id = $lines[$i]->id;
2313 $taskstatic->ref = ($lines[$i]->ref ? $lines[$i]->ref : $lines[$i]->id);
2314 $taskstatic->label = $lines[$i]->label;
2315 $taskstatic->date_start = $lines[$i]->date_start;
2316 $taskstatic->date_end = $lines[$i]->date_end;
2318 $thirdpartystatic->id = $lines[$i]->thirdparty_id;
2319 $thirdpartystatic->name = $lines[$i]->thirdparty_name;
2320 $thirdpartystatic->email = $lines[$i]->thirdparty_email;
2322 if (empty($oldprojectforbreak) || ($oldprojectforbreak != -1 && $oldprojectforbreak != $projectstatic->id)) {
2323 print '<tr class="oddeven trforbreak nobold
">'."\n
";
2324 print '<td colspan="'.(6 + count($TWeek)).'">';
2325 print $projectstatic->getNomUrl(1, '', 0, '<strong>'.$langs->transnoentitiesnoconv("YourRole
").':</strong> '.$projectsrole[$lines[$i]->fk_project]);
2326 if ($thirdpartystatic->id > 0) {
2327 print ' - '.$thirdpartystatic->getNomUrl(1);
2329 if ($projectstatic->title) {
2331 print '<span class="secondary
">'.$projectstatic->title.'</span>';
2337 if ($oldprojectforbreak != -1) {
2338 $oldprojectforbreak = $projectstatic->id;
2340 print '<tr class="oddeven
" data-taskid="'.$lines[$i]->id.'">'."\n
";
2344 print '<td class="nowrap
">';
2345 print $fuser->getNomUrl(1, 'withproject', 'time');
2350 /*print '<td class="nowrap
">';
2351 if ($oldprojectforbreak == -1) print $projectstatic->getNomUrl(1,'',0,$langs->transnoentitiesnoconv("YourRole
").': '.$projectsrole[$lines[$i]->fk_project]);
2355 /*print '<td class="tdoverflowmax100
">';
2356 if ($thirdpartystatic->id > 0) print $thirdpartystatic->getNomUrl(1, 'project');
2360 print '<td class="nowrap
">';
2361 print '<!-- Task id = '.$lines[$i]->id.' (projectlinespermonth) -->';
2362 for ($k = 0; $k < $level; $k++) {
2363 print '<div class="marginleftonly
">';
2365 print $taskstatic->getNomUrl(1, 'withproject', 'time');
2368 print '<div class="opacitymedium tdoverflowmax500
" title="'.dol_escape_htmltag($taskstatic->label).'">'.dol_escape_htmltag($taskstatic->label).'</div>';
2369 for ($k = 0; $k < $level; $k++) {
2375 if (!empty($arrayfields['t.planned_workload']['checked'])) {
2376 print '<td class="leftborder plannedworkload right
">';
2377 if ($lines[$i]->planned_workload) {
2378 print convertSecondToTime($lines[$i]->planned_workload, 'allhourmin');
2385 // Progress declared %
2386 if (!empty($arrayfields['t.progress']['checked'])) {
2387 print '<td class="right
">';
2388 print $formother->select_percent($lines[$i]->progress, $lines[$i]->id.'progress');
2392 // Time spent by everybody
2393 if (!empty($arrayfields['timeconsumed']['checked'])) {
2394 print '<td class="right
">';
2395 // $lines[$i]->duration_effective is a denormalised field = summ of time spent by everybody for task. What we need is time consumed by user
2396 if ($lines[$i]->duration_effective) {
2397 print '<a href="'.DOL_URL_ROOT.'/projet/tasks/time.php?
id=
'.$lines[$i]->id.'">';
2398 print convertSecondToTime($lines[$i]->duration_effective, 'allhourmin');
2405 // Time spent by user
2406 print '<td class="right
">';
2407 $tmptimespent = $taskstatic->getSummaryOfTimeSpent($fuser->id);
2408 if ($tmptimespent['total_duration']) {
2409 print convertSecondToTime($tmptimespent['total_duration'], 'allhourmin');
2416 $disabledproject = 1;
2418 //print "x
".$lines[$i]->fk_project;
2419 //var_dump($lines[$i]);
2420 //var_dump($projectsrole[$lines[$i]->fk_project]);
2421 // If at least one role for project
2422 if ($lines[$i]->public || !empty($projectsrole[$lines[$i]->fk_project]) || $user->hasRight('projet', 'all', 'creer')) {
2423 $disabledproject = 0;
2426 // If $restricteditformytask is on and I have no role on task, i disable edit
2427 if ($restricteditformytask && empty($tasksrole[$lines[$i]->id])) {
2431 //var_dump($projectstatic->weekWorkLoadPerTask);
2433 // Fields to show current time
2435 $modeinput = 'hours';
2436 $TFirstDay = getFirstDayOfEachWeek($TWeek, (int) date('Y', $firstdaytoshow));
2437 $TFirstDay[reset($TWeek)] = 1;
2439 $firstdaytoshowarray = dol_getdate($firstdaytoshow);
2440 $year = $firstdaytoshowarray['year'];
2441 $month = $firstdaytoshowarray['mon'];
2443 foreach ($TWeek as $weekIndex => $weekNb) {
2445 $weekWorkLoad = !empty($projectstatic->monthWorkLoadPerTask[$weekNb][$lines[$i]->id]) ? $projectstatic->monthWorkLoadPerTask[$weekNb][$lines[$i]->id] : 0 ;
2446 if (!isset($totalforeachweek[$weekNb])) {
2447 $totalforeachweek[$weekNb] = 0;
2449 $totalforeachweek[$weekNb] += $weekWorkLoad;
2452 if ($weekWorkLoad > 0) {
2453 $alreadyspent = convertSecondToTime($weekWorkLoad, 'allhourmin');
2455 $alttitle = $langs->trans("AddHereTimeSpentForWeek
", $weekNb);
2457 $disabledtaskweek = $disabledtask;
2458 $firstdayofweek = dol_mktime(0, 0, 0, $month, $TFirstDay[$weekIndex], $year);
2460 if (! $disabledtask && $restrictBefore && $firstdayofweek < $restrictBefore) {
2461 $disabledtaskweek = 1;
2464 $tableCell = '<td class="center hide
'.($j <= 1 ? ' borderleft
' : '').'">';
2466 if ($alreadyspent) {
2467 $tableCell .= '<span class="timesheetalreadyrecorded
" title="texttoreplace
"><input type="text
" class="center smallpadd width40
" disabled id="timespent[
'.$inc.'][
'.((int) $weekNb).']
" name="task[
'.$lines[$i]->id.'][
'.$weekNb.']
" value="'.$alreadyspent.'"></span>';
2468 //$placeholder=' placeholder="00:00
"';
2472 $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
"';
2473 $tableCell .= ' onkeypress="return regexEvent(
this,event,\
'timeChar\')"';
2474 $tableCell .=
' onkeyup="updateTotal('.$weekNb.
',\''.$modeinput.
'\')
"';
2475 $tableCell .= ' onblur="regexEvent(
this,event,\
''.$modeinput.
'\'); updateTotal(
'.$weekNb.',\
''.$modeinput.
'\')
" />';
2476 $tableCell .= '</td>';
2481 print '<td class="right
">';
2482 if ((!$lines[$i]->public) && $disabledproject) {
2483 print $form->textwithpicto('', $langs->trans("UserIsNotContactOfProject
"));
2484 } elseif ($disabledtask) {
2485 $titleassigntask = $langs->trans("AssignTaskToMe
");
2486 if ($fuser->id != $user->id) {
2487 $titleassigntask = $langs->trans("AssignTaskToUser
", '...');
2490 print $form->textwithpicto('', $langs->trans("TaskIsNotAssignedToUser
", $titleassigntask));
2497 // Call to show task with a lower level (task under the current task)
2500 if ($lines[$i]->id > 0) {
2501 //var_dump('totalforeachday after taskid='.$lines[$i]->id.' and previous one on level '.$level);
2502 //var_dump($totalforeachday);
2503 $ret = projectLinesPerMonth($inc, $firstdaytoshow, $fuser, $lines[$i]->id, ($parent == 0 ? $lineswithoutlevel0 : $lines), $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $isavailable, $oldprojectforbreak, $TWeek);
2504 //var_dump('ret with parent='.$lines[$i]->id.' level='.$level);
2506 foreach ($ret as $key => $val) {
2507 $totalforeachweek[$key] += $val;
2509 //var_dump('totalforeachday after taskid='.$lines[$i]->id.' and previous one on level '.$level.' + subtasks');
2510 //var_dump($totalforeachday);
2518 return $totalforeachweek;
2531function searchTaskInChild(&$inc, $parent, &$lines, &$taskrole)
2533 //print 'Search in line with parent id = '.$parent.'<br>';
2534 $numlines = count($lines);
2535 for ($i = 0; $i < $numlines; $i++) {
2536 // Process line $lines[$i]
2537 if ($lines[$i]->fk_task_parent == $parent && $lines[$i]->id != $lines[$i]->fk_task_parent) {
2538 // If task is legitimate to show, no more need to search deeper
2539 if (isset($taskrole[$lines[$i]->id])) {
2540 //print 'Found a legitimate task id='.$lines[$i]->id.'<br>';
2545 searchTaskInChild($inc, $lines[$i]->id, $lines, $taskrole);
2546 //print 'Found inc='.$inc.'<br>';
2571function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks = 0, $status = -1, $listofoppstatus = array(), $hiddenfields = array(), $max = 0)
2573 global $langs, $conf, $user;
2574 global $theme_datacolor;
2576 $maxofloop = (!getDolGlobalString('MAIN_MAXLIST_OVERLOAD') ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD);
2578 require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
2580 $listofstatus = array_keys($listofoppstatus);
2582 if (is_array($listofstatus) && getDolGlobalString('USE_COLOR_FOR_PROSPECTION_STATUS')) {
2583 // Define $themeColorId and array $statusOppList for each $listofstatus
2585 $statusOppList = array();
2586 foreach ($listofstatus as $oppStatus) {
2587 $oppStatusCode = dol_getIdFromCode($db, $oppStatus, 'c_lead_status', 'rowid', 'code');
2588 if ($oppStatusCode) {
2589 $statusOppList[$oppStatus]['code'] = $oppStatusCode;
2590 $statusOppList[$oppStatus]['color'] = isset($theme_datacolor[$themeColorId]) ? implode(', ', $theme_datacolor[$themeColorId]) : '';
2596 $projectstatic = new Project($db);
2597 $thirdpartystatic = new Societe($db);
2601 $project_year_filter = 0;
2603 $title = $langs->trans("
Projects");
2604 if (strcmp((string) $status, '') && $status >= 0) {
2605 $title = $langs->trans("Projects").' '.$langs->trans($projectstatic->labelStatus[$status]);
2608 print '<!-- print_projecttasks_array -->';
2609 print '<div class="div-
table-responsive-no-min
">';
2610 print '<table class="noborder centpercent
">';
2612 $sql = " FROM
".MAIN_DB_PREFIX."projet as p
";
2614 $sql .= ",
".MAIN_DB_PREFIX."projet_task as t
";
2615 $sql .= ",
".MAIN_DB_PREFIX."element_contact as ec
";
2616 $sql .= ",
".MAIN_DB_PREFIX."c_type_contact as ctc
";
2618 $sql .= " LEFT JOIN
".MAIN_DB_PREFIX."projet_task as t ON p.rowid = t.fk_projet
";
2620 $sql .= " WHERE p.entity IN (
".getEntity('project').")
";
2621 $sql .= " AND p.rowid IN (
".$db->sanitize((string) $projectsListId).")
";
2623 $sql .= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc =
".((int) $socid).")
";
2626 $sql .= " AND p.rowid = t.fk_projet
";
2627 $sql .= " AND ec.element_id = t.rowid
";
2628 $sql .= " AND ec.fk_socpeople =
".((int) $user->id);
2629 $sql .= " AND ec.fk_c_type_contact = ctc.rowid
"; // Replace the 2 lines with ec.fk_c_type_contact in $arrayidtypeofcontact
2630 $sql .= " AND ctc.element =
'project_task'";
2633 $sql .= " AND p.fk_statut =
".(int) $status;
2635 if (getDolGlobalString('PROJECT_LIMIT_YEAR_RANGE')) {
2636 $project_year_filter = GETPOST("project_year_filter
", 'alpha'); // '*' seems allowed
2637 //Check if empty or invalid year. Wildcard ignores the sql check
2638 if ($project_year_filter != "*
") {
2639 if (empty($project_year_filter) || !is_numeric($project_year_filter)) {
2640 $project_year_filter = date("Y
");
2642 $sql .= " AND (p.dateo IS NULL OR p.dateo <=
".$db->idate(dol_get_last_day((int) $project_year_filter, 12, false)).")
";
2643 $sql .= " AND (p.datee IS NULL OR p.datee >=
".$db->idate(dol_get_first_day((int) $project_year_filter, 1, false)).")
";
2647 // Get id of project we must show tasks
2648 $arrayidofprojects = array();
2650 $sql1 = "SELECT p.rowid as projectid
";
2652 $resql = $db->query($sql1);
2655 $num = $db->num_rows($resql);
2657 $objp = $db->fetch_object($resql);
2658 $arrayidofprojects[$objp->projectid] = $objp->projectid;
2662 dol_print_error($db);
2664 if (empty($arrayidofprojects)) {
2665 $arrayidofprojects[0] = -1;
2668 // Get list of project with calculation on tasks
2669 $sql2 = "SELECT p.rowid as projectid, p.ref, p.title, p.fk_soc,
";
2670 $sql2 .= " s.rowid as socid, s.nom as socname, s.name_alias,
";
2671 $sql2 .= " s.code_client, s.code_compta, s.client,
";
2672 $sql2 .= " s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur,
";
2673 $sql2 .= " s.logo, s.email, s.entity,
";
2674 $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,
";
2675 $sql2 .= " p.dateo, p.datee,
";
2676 $sql2 .= " COUNT(t.rowid) as nb, SUM(t.planned_workload) as planned_workload, SUM(t.planned_workload * t.progress / 100) as declared_progess_workload";
2677 $sql2 .= " FROM ".MAIN_DB_PREFIX."projet as p";
2678 $sql2 .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = p.fk_soc";
2679 $sql2 .= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task as t ON p.rowid = t.fk_projet";
2680 $sql2 .= " WHERE p.rowid IN (".$db->sanitize(implode(',', $arrayidofprojects)).")";
2681 $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,";
2682 $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";
2683 $sql2 .= " ORDER BY p.title, p.
ref";
2685 $resql = $db->query($sql2);
2689 $total_opp_amount = 0;
2690 $ponderated_opp_amount = 0;
2691 $total_plannedworkload = 0;
2692 $total_declaredprogressworkload = 0;
2694 $num = $db->num_rows($resql);
2695 $nbofloop = min($num, (!
getDolGlobalString(
'MAIN_MAXLIST_OVERLOAD') ? 500 :
$conf->global->MAIN_MAXLIST_OVERLOAD));
2698 print
'<tr class="liste_titre">';
2699 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);
2702 if (!in_array(
'prospectionstatus', $hiddenfields)) {
2703 print_liste_field_titre(
"OpportunityStatus",
"",
"",
"",
"",
'style="max-width: 100px"', $sortfield, $sortorder,
'center ');
2705 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 ');
2710 if (!in_array(
'plannedworkload', $hiddenfields)) {
2711 print_liste_field_titre(
"PlannedWorkload",
"",
"",
"",
"",
'style="max-width: 100px"', $sortfield, $sortorder,
'right ');
2713 if (!in_array(
'declaredprogress', $hiddenfields)) {
2714 print_liste_field_titre(
"%",
"",
"",
"",
"",
'', $sortfield, $sortorder,
'right ', $langs->trans(
"ProgressDeclared"));
2717 if (!in_array(
'projectstatus', $hiddenfields)) {
2722 while ($i < $nbofloop) {
2723 $objp = $db->fetch_object($resql);
2725 if ($max && $i >= $max) {
2728 $total_task += $objp->nb;
2729 $total_opp_amount += $objp->opp_amount;
2730 $opp_weighted_amount = $objp->opp_percent * $objp->opp_amount / 100;
2731 $ponderated_opp_amount +=
price2num($opp_weighted_amount);
2732 $plannedworkload = $objp->planned_workload;
2733 $total_plannedworkload += $plannedworkload;
2734 $declaredprogressworkload = $objp->declared_progess_workload;
2735 $total_declaredprogressworkload += $declaredprogressworkload;
2739 $projectstatic->id = $objp->projectid;
2740 $projectstatic->user_author_id = $objp->fk_user_creat;
2741 $projectstatic->public = $objp->public;
2744 $userAccess = $projectstatic->restrictedProjectArea($user);
2745 if ($userAccess >= 0) {
2746 $projectstatic->ref = $objp->ref;
2747 $projectstatic->status = $objp->status;
2748 $projectstatic->title = $objp->title;
2749 $projectstatic->date_end = $db->jdate($objp->datee);
2750 $projectstatic->date_start = $db->jdate($objp->dateo);
2752 print
'<tr class="oddeven">';
2754 print
'<td class="tdoverflowmax150">';
2755 print $projectstatic->getNomUrl(1,
'', 0,
'',
'-', 0, -1,
'nowraponall');
2756 if (!in_array(
'projectlabel', $hiddenfields)) {
2757 print
'<br><span class="opacitymedium small">'.dol_escape_htmltag($objp->title).
'</span>';
2761 print
'<td class="nowraponall tdoverflowmax100">';
2762 if ($objp->fk_soc > 0) {
2763 $thirdpartystatic->id = $objp->socid;
2764 $thirdpartystatic->name = $objp->socname;
2767 $thirdpartystatic->code_compta = $objp->code_compta;
2768 $thirdpartystatic->code_compta_client = $objp->code_compta;
2769 $thirdpartystatic->client = $objp->client;
2771 $thirdpartystatic->code_compta_fournisseur = $objp->code_compta_fournisseur;
2772 $thirdpartystatic->fournisseur = $objp->fournisseur;
2773 $thirdpartystatic->logo = $objp->logo;
2774 $thirdpartystatic->email = $objp->email;
2775 $thirdpartystatic->entity = $objp->entity;
2776 print $thirdpartystatic->getNomUrl(1);
2781 if (!in_array(
'prospectionstatus', $hiddenfields)) {
2782 print
'<td class="center tdoverflowmax75">';
2785 $oppStatusCode =
dol_getIdFromCode($db, $objp->opp_status,
'c_lead_status',
'rowid',
'code');
2786 if ($langs->trans(
"OppStatus".$oppStatusCode) !=
"OppStatus".$oppStatusCode) {
2787 print $langs->trans(
"OppStatus".$oppStatusCode);
2790 if (isset($statusOppList[$objp->opp_status])) {
2791 $oppStatusCode = $statusOppList[$objp->opp_status][
'code'];
2792 $oppStatusColor = $statusOppList[$objp->opp_status][
'color'];
2794 $oppStatusCode =
dol_getIdFromCode($db, $objp->opp_status,
'c_lead_status',
'rowid',
'code');
2795 $oppStatusColor =
'';
2797 if ($oppStatusCode) {
2798 if (!empty($oppStatusColor)) {
2799 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>';
2801 print
'<a href="'.dol_buildpath(
'/projet/list.php?search_opp_status='.$objp->opp_status, 1).
'" title="'.$langs->trans(
"OppStatus".$oppStatusCode).
'">'.$oppStatusCode.
'</a>';
2808 print
'<td class="right">';
2810 if ($objp->opp_percent && $objp->opp_amount) {
2811 $opp_weighted_amount = $objp->opp_percent * $objp->opp_amount / 100;
2812 $alttext = $langs->trans(
"OpportunityWeightedAmount").
' '.
price($opp_weighted_amount, 0,
'', 1, -1, 0,
$conf->currency);
2813 $ponderated_opp_amount +=
price2num($opp_weighted_amount);
2815 if ($objp->opp_amount) {
2816 print
'<span class="amount" title="'.$alttext.
'">'.$form->textwithpicto(
price($objp->opp_amount, 0,
'', 1, -1, 0), $alttext).
'</span>';
2822 print
'<td class="right">'.$objp->nb.
'</td>';
2824 $plannedworkload = $objp->planned_workload;
2825 $total_plannedworkload += $plannedworkload;
2826 if (!in_array(
'plannedworkload', $hiddenfields)) {
2827 print
'<td class="right nowraponall">'.($plannedworkload ?
convertSecondToTime($plannedworkload) :
'').
'</td>';
2829 if (!in_array(
'declaredprogress', $hiddenfields)) {
2830 $declaredprogressworkload = $objp->declared_progess_workload;
2831 $total_declaredprogressworkload += $declaredprogressworkload;
2832 print
'<td class="right nowraponall">';
2834 print($plannedworkload ? round(100 * $declaredprogressworkload / $plannedworkload, 0).
'%' :
'');
2839 if (!in_array(
'projectstatus', $hiddenfields)) {
2840 print
'<td class="right">';
2841 print $projectstatic->getLibStatut(3);
2847 $total_task += $objp->nb;
2848 $total_opp_amount += $objp->opp_amount;
2855 print
'<tr class="oddeven">';
2856 print
'<td class="nowrap" colspan="5">';
2857 print
'<span class="opacitymedium">'.$langs->trans(
"More").
'...'.($othernb < $maxofloop ?
' ('.$othernb.
')' :
'').
'</span>';
2862 print
'<tr class="liste_total">';
2863 print
'<td>'.$langs->trans(
"Total").
"</td><td></td>";
2865 if (!in_array(
'prospectionstatus', $hiddenfields)) {
2866 print
'<td class="liste_total"></td>';
2868 print
'<td class="liste_total right">';
2870 print $form->textwithpicto(
price($total_opp_amount, 0,
'', 1, -1, 0), $langs->trans(
"OpportunityPonderatedAmountDesc").
' : '.
price($ponderated_opp_amount, 0,
'', 1, -1, 0,
$conf->currency));
2874 print
'<td class="liste_total right">'.$total_task.
'</td>';
2875 if (!in_array(
'plannedworkload', $hiddenfields)) {
2876 print
'<td class="liste_total right">'.($total_plannedworkload ?
convertSecondToTime($total_plannedworkload) :
'').
'</td>';
2878 if (!in_array(
'declaredprogress', $hiddenfields)) {
2879 print
'<td class="liste_total right">'.($total_plannedworkload ? round(100 * $total_declaredprogressworkload / $total_plannedworkload, 0).
'%' :
'').
'</td>';
2882 if (!in_array(
'projectstatus', $hiddenfields)) {
2883 print
'<td class="liste_total"></td>';
2897 print
'<form method="get" action="'.$_SERVER[
"PHP_SELF"].
'">';
2898 print
'<table width="100%">';
2900 print
'<td>'.$langs->trans(
"Year").
'</td>';
2901 print
'<td class="right"><input type="text" size="4" class="flat" name="project_year_filter" value="'.((int) $project_year_filter).
'"/>';
2903 print
'</table></form>';
2916function getTaskProgressView($task, $label =
true, $progressNumber =
true, $hideOnProgressNull =
false, $spaced =
false)
2918 global $langs,
$conf;
2922 $plannedworkloadoutputformat =
'allhourmin';
2923 $timespentoutputformat =
'allhourmin';
2925 $plannedworkloadoutputformat =
getDolGlobalString(
'PROJECT_PLANNED_WORKLOAD_FORMAT');
2931 if (empty($task->progress) && !empty($hideOnProgressNull)) {
2935 $spaced = !empty($spaced) ?
'spaced' :
'';
2940 $progressBarClass =
'progress-bar-info';
2941 $progressCalculated = 0;
2942 if ($task->planned_workload) {
2943 $progressCalculated = round(100 * (
float) $task->duration_effective / (
float) $task->planned_workload, 2);
2946 $warningRatio =
getDolGlobalString(
'PROJECT_TIME_SPEND_WARNING_PERCENT') ? (1 +
$conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT / 100) : 1.10;
2948 $diffTitle =
'<br>'.$langs->trans(
'ProgressDeclared').
' : '.$task->progress.(isset($task->progress) ?
'%' :
'');
2949 $diffTitle .=
'<br>'.$langs->trans(
'ProgressCalculated').
' : '.$progressCalculated.(isset($progressCalculated) ?
'%' :
'');
2952 if ((
float) $progressCalculated > (float) ($task->progress * $warningRatio)) {
2953 $progressBarClass =
'progress-bar-danger';
2954 $title = $langs->trans(
'TheReportedProgressIsLessThanTheCalculatedProgressionByX', abs($task->progress - $progressCalculated).
' '.$langs->trans(
"point"));
2955 $diff =
'<span class="text-danger classfortooltip paddingrightonly" title="'.dol_htmlentities($title.$diffTitle).
'" ><i class="fa fa-caret-down"></i> '.($task->progress - $progressCalculated).
'%</span>';
2956 } elseif ((
float) $progressCalculated > (
float) $task->progress) {
2957 $progressBarClass =
'progress-bar-warning';
2958 $title = $langs->trans(
'TheReportedProgressIsLessThanTheCalculatedProgressionByX', abs($task->progress - $progressCalculated).
' '.$langs->trans(
"point"));
2959 $diff =
'<span class="text-warning classfortooltip paddingrightonly" title="'.dol_htmlentities($title.$diffTitle).
'" ><i class="fa fa-caret-left"></i> '.($task->progress - $progressCalculated).
'%</span>';
2961 $progressBarClass =
'progress-bar-success';
2962 $title = $langs->trans(
'TheReportedProgressIsMoreThanTheCalculatedProgressionByX', ($task->progress - $progressCalculated).
' '.$langs->trans(
"point"));
2963 $diff =
'<span class="text-success classfortooltip paddingrightonly" title="'.dol_htmlentities($title.$diffTitle).
'" ><i class="fa fa-caret-up"></i> '.($task->progress - $progressCalculated).
'%</span>';
2967 $out .=
'<div class="progress-group">';
2969 if ($label !==
false) {
2970 $out .=
' <span class="progress-text">';
2972 if ($label !==
true) {
2981 if ($progressNumber !==
false) {
2982 $out .=
' <span class="progress-number">';
2983 if ($progressNumber !==
true) {
2984 $out .= $progressNumber;
2986 if ($task->hasDelay()) {
2990 $url = DOL_URL_ROOT.
'/projet/tasks/time.php?id='.$task->id;
2992 $out .= !empty($diff) ? $diff.
' ' :
'';
2993 $out .=
'<a href="'.$url.
'" >';
2994 $out .=
'<b title="'.$langs->trans(
'TimeSpent').
'" >';
2995 if ($task->duration_effective) {
3005 $out .=
'<a href="'.$url.
'" >';
3006 $out .=
'<span title="'.$langs->trans(
'PlannedWorkload').
'" >';
3007 if ($task->planned_workload) {
3019 $out .=
' <div class="progress sm'.($spaced ? $spaced :
'').
'">';
3020 $diffval = (float) $task->progress - (
float) $progressCalculated;
3021 if ($diffval >= 0) {
3023 $out .=
' <div class="progress-bar '.$progressBarClass.
'" style="width: '.(float) $task->progress.
'%" title="'.(
float) $task->progress.
'%">';
3024 if (!empty($task->progress)) {
3025 $out .=
' <div class="progress-bar progress-bar-consumed" style="width: '.(float) ($progressCalculated / ((
float) $task->progress == 0 ? 1 : $task->progress) * 100).
'%" title="'.(float) $progressCalculated.
'%"></div>';
3030 $out .=
' <div class="progress-bar progress-bar-consumed-late" style="width: '.(float) $progressCalculated.
'%" title="'.(
float) $progressCalculated.
'%">';
3031 $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>';
3050 global
$conf, $langs;
3054 if ($task->progress !=
'') {
3058 $badgeClass =
'badge ';
3059 if ($task->planned_workload) {
3060 $progressCalculated = round(100 * (
float) $task->duration_effective / (
float) $task->planned_workload, 2);
3063 $warningRatio =
getDolGlobalString(
'PROJECT_TIME_SPEND_WARNING_PERCENT') ? (1 +
$conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT / 100) : 1.10;
3065 if ((
float) $progressCalculated > (
float) ($task->progress * $warningRatio)) {
3066 $badgeClass .=
'badge-danger';
3067 if (empty($tooltip)) {
3068 $tooltip = $task->progress.
'% < '.$langs->trans(
"TimeConsumed").
' '.$progressCalculated.
'%';
3070 } elseif ((
float) $progressCalculated > (
float) $task->progress) {
3071 $badgeClass .=
'badge-warning';
3072 if (empty($tooltip)) {
3073 $tooltip = $task->progress.
'% < '.$langs->trans(
"TimeConsumed").
' '.$progressCalculated.
'%';
3076 $badgeClass .=
'badge-success';
3077 if (empty($tooltip)) {
3078 $tooltip = $task->progress.
'% >= '.$langs->trans(
"TimeConsumed").
' '.$progressCalculated.
'%';
3085 if (!empty($tooltip)) {
3086 $badgeClass .=
' classfortooltip';
3087 $title =
'title="'.dol_htmlentities($tooltip).
'"';
3090 if (empty($label)) {
3091 $label = $task->progress.
' %';
3094 if (!empty($label)) {
3095 $out =
'<span class="'.$badgeClass.
'" '.$title.
' >'.$label.
'</span>';
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Class for ConferenceOrBoothAttendee.
Class for ConferenceOrBooth.
static count($dbs, $objecttype, $objectid)
Return nb of links.
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_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.
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 '.
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.
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
dol_htmlentities($string, $flags=ENT_QUOTES|ENT_SUBSTITUTE, $encoding='UTF-8', $double_encode=false)
Replace htmlentities functions.
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).
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0)
Clean a string to use it as a file name.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
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'))
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
dol_setcache($memoryid, $data, $expire=0, $filecache=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.