31require
"../../main.inc.php";
32require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcategory.class.php';
33require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
34require_once DOL_DOCUMENT_ROOT.
'/core/lib/project.lib.php';
35require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
36require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
37require_once DOL_DOCUMENT_ROOT.
'/projet/class/task.class.php';
48$langs->loadLangs(array(
'projects',
'users',
'companies'));
50$action =
GETPOST(
'action',
'aZ09');
51$massaction =
GETPOST(
'massaction',
'alpha');
53$confirm =
GETPOST(
'confirm',
'alpha');
54$toselect =
GETPOST(
'toselect',
'array:int');
55$optioncss =
GETPOST(
'optioncss',
'aZ09');
60$search_all = trim(
GETPOST(
'search_all',
'alphanohtml'));
61$search_categ =
GETPOST(
"search_categ",
'intcomma');
62$search_projectstatus =
GETPOST(
'search_projectstatus',
'intcomma');
63$search_project_ref =
GETPOST(
'search_project_ref');
64$search_project_title =
GETPOST(
'search_project_title');
65$search_task_ref =
GETPOST(
'search_task_ref');
66$search_task_label =
GETPOST(
'search_task_label');
67$search_task_description =
GETPOST(
'search_task_description');
68$search_task_ref_parent =
GETPOST(
'search_task_ref_parent');
69$search_project_user =
GETPOST(
'search_project_user',
'intcomma');
70$search_task_user =
GETPOST(
'search_task_user',
'intcomma');
71$search_task_progress =
GETPOST(
'search_task_progress');
72$search_task_budget_amount =
GETPOST(
'search_task_budget_amount');
73$search_task_status = GETPOSTISSET(
'search_task_status') ?
GETPOSTINT(
'search_task_status') : -1;
74$search_societe =
GETPOST(
'search_societe');
75$search_societe_alias =
GETPOST(
'search_societe_alias');
76$search_opp_status =
GETPOST(
"search_opp_status",
'alpha');
77$searchCategoryCustomerOperator = 0;
78if (GETPOSTISSET(
'formfilteraction')) {
79 $searchCategoryCustomerOperator =
GETPOSTINT(
'search_category_customer_operator');
83$searchCategoryCustomerList =
GETPOST(
'search_category_customer_list',
'array:int');
85if (!isset($search_projectstatus) || $search_projectstatus ===
'') {
86 if ($search_all !=
'') {
87 $search_projectstatus = -1;
89 $search_projectstatus = 1;
93$mine =
GETPOST(
'mode',
'alpha') ==
'mine' ? 1 : 0;
95 $search_task_user = $user->id;
100$search_date_startday =
GETPOSTINT(
'search_date_startday');
101$search_date_startmonth =
GETPOSTINT(
'search_date_startmonth');
102$search_date_startyear =
GETPOSTINT(
'search_date_startyear');
103$search_date_endday =
GETPOSTINT(
'search_date_endday');
104$search_date_endmonth =
GETPOSTINT(
'search_date_endmonth');
105$search_date_endyear =
GETPOSTINT(
'search_date_endyear');
106$search_date_start =
dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear);
107$search_date_end =
dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
108$search_datelimit_startday =
GETPOSTINT(
'search_datelimit_startday');
109$search_datelimit_startmonth =
GETPOSTINT(
'search_datelimit_startmonth');
110$search_datelimit_startyear =
GETPOSTINT(
'search_datelimit_startyear');
111$search_datelimit_endday =
GETPOSTINT(
'search_datelimit_endday');
112$search_datelimit_endmonth =
GETPOSTINT(
'search_datelimit_endmonth');
113$search_datelimit_endyear =
GETPOSTINT(
'search_datelimit_endyear');
114$search_datelimit_start =
dol_mktime(0, 0, 0, $search_datelimit_startmonth, $search_datelimit_startday, $search_datelimit_startyear);
115$search_datelimit_end =
dol_mktime(23, 59, 59, $search_datelimit_endmonth, $search_datelimit_endday, $search_datelimit_endyear);
118$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'tasklist';
122$hookmanager->initHooks(array(
'tasklist'));
126$extrafields->fetch_name_optionals_label(
$object->table_element);
127$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
132if (!$user->hasRight(
'projet',
'lire')) {
136$diroutputmassaction =
$conf->project->dir_output.
'/tasks/temp/massgeneration/'.$user->id;
139$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
140$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
142if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
146$offset = $limit * $page;
147$pageprev = $page - 1;
148$pagenext = $page + 1;
150 $sortfield =
'p.ref';
157$fieldstosearchall = array(
159 't.label' =>
"Label",
160 't.description' =>
"Description",
161 't.note_public' =>
"NotePublic",
163if (empty($user->socid)) {
164 $fieldstosearchall[
't.note_private'] =
"NotePrivate";
168 't.ref' => array(
'label' =>
"RefTask",
'checked' =>
'1',
'position' => 50),
169 't.fk_task_parent' => array(
'label' =>
"RefTaskParent",
'checked' =>
'0',
'position' => 70),
170 't.label' => array(
'label' =>
"LabelTask",
'checked' =>
'1',
'position' => 75),
171 't.description' => array(
'label' =>
"Description",
'checked' =>
'0',
'position' => 80),
172 't.dateo' => array(
'label' =>
"DateStart",
'checked' =>
'1',
'position' => 100),
173 't.datee' => array(
'label' =>
"Deadline",
'checked' =>
'1',
'position' => 101),
174 'p.ref' => array(
'label' =>
"ProjectRef",
'checked' =>
'1',
'position' => 151),
175 'p.title' => array(
'label' =>
"ProjectLabel",
'checked' =>
'0',
'position' => 152),
176 's.nom' => array(
'label' =>
"ThirdParty",
'checked' =>
'-1',
'csslist' =>
'tdoverflowmax125',
'position' => 200),
177 's.name_alias' => array(
'label' =>
"AliasNameShort",
'checked' =>
'0',
'csslist' =>
'tdoverflowmax125',
'position' => 201),
178 'p.fk_statut' => array(
'label' =>
"ProjectStatus",
'checked' =>
'1',
'position' => 205),
179 't.planned_workload' => array(
'label' =>
"PlannedWorkload",
'checked' =>
'1',
'position' => 302),
180 't.duration_effective' => array(
'label' =>
"TimeSpent",
'checked' =>
'1',
'position' => 303),
181 't.progress_calculated' => array(
'label' =>
"ProgressCalculated",
'checked' =>
'-1',
'position' => 304),
182 't.progress' => array(
'label' =>
"ProgressDeclared",
'checked' =>
'1',
'position' => 305),
183 't.progress_summary' => array(
'label' =>
"TaskProgressSummary",
'checked' =>
'1',
'position' => 306),
184 't.budget_amount' => array(
'label' =>
"Budget",
'checked' =>
'0',
'position' => 307),
185 't.fk_statut' => array(
'label' =>
"TaskStatus",
'checked' =>
'0',
'position' => 308),
186 't.tobill' => array(
'label' =>
"TimeToBill",
'checked' =>
'0',
'position' => 310),
187 't.billed' => array(
'label' =>
"TimeBilled",
'checked' =>
'0',
'position' => 311),
188 't.datec' => array(
'label' =>
"DateCreation",
'checked' =>
'0',
'position' => 500),
189 't.tms' => array(
'label' =>
"DateModificationShort",
'checked' =>
'0',
'position' => 501),
193include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
198$permissiontoread = $user->hasRight(
'projet',
'lire');
199$permissiontocreate = $user->hasRight(
'projet',
'creer');
200$permissiontodelete = $user->hasRight(
'projet',
'supprimer');
202if (!$permissiontoread) {
211if (
GETPOST(
'cancel',
'alpha')) {
215if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
219$parameters = array(
'socid' => $socid);
220$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
225if (empty($reshook)) {
227 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
230 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
233 $search_projectstatus = -1;
234 $search_project_ref =
"";
235 $search_societe =
"";
236 $search_societe_alias =
"";
237 $search_project_title =
"";
238 $search_task_ref =
"";
239 $search_task_label =
"";
240 $search_task_description =
"";
241 $search_task_ref_parent =
"";
242 $search_task_progress =
"";
243 $search_task_budget_amount =
"";
244 $search_task_user = -1;
245 $search_task_status = -1;
246 $search_project_user = -1;
247 $search_date_startday =
'';
248 $search_date_startmonth =
'';
249 $search_date_startyear =
'';
250 $search_date_endday =
'';
251 $search_date_endmonth =
'';
252 $search_date_endyear =
'';
253 $search_date_start =
'';
254 $search_date_end =
'';
255 $search_datelimit_startday =
'';
256 $search_datelimit_startmonth =
'';
257 $search_datelimit_startyear =
'';
258 $search_datelimit_endday =
'';
259 $search_datelimit_endmonth =
'';
260 $search_datelimit_endyear =
'';
261 $search_datelimit_start =
'';
262 $search_datelimit_end =
'';
264 $searchCategoryCustomerList = array();
265 $search_array_options = array();
269 $objectclass =
'Task';
270 $objectlabel =
'Tasks';
271 $uploaddir =
$conf->project->dir_output.
'/tasks';
272 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
293$title = $langs->trans(
"Activities");
294$help_url =
"EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos";
298if ($search_project_user > 0) {
299 $puser->fetch((
int) $search_project_user);
301if ($search_task_user > 0) {
302 $tuser->fetch((
int) $search_task_user);
306$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
307$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
$conf->main_checkbox_left_column);
311 $projectstatic->fetch(
$id);
312 $projectstatic->fetch_thirdparty();
315$projectsListId =
'0';
317if (!$user->hasRight(
'projet',
'all',
'lire')) {
318 $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1, $socid);
323$listofprojectcontacttype = array();
324$sql =
"SELECT ctc.rowid, ctc.code FROM ".MAIN_DB_PREFIX.
"c_type_contact as ctc";
325$sql .=
" WHERE ctc.element = '".$db->escape($projectstatic->element).
"'";
326$sql .=
" AND ctc.source = 'internal'";
327$resql =
$db->query($sql);
329 while ($obj =
$db->fetch_object($resql)) {
330 $listofprojectcontacttype[$obj->rowid] = $obj->code;
335if (count($listofprojectcontacttype) == 0) {
336 $listofprojectcontacttype[0] =
'0';
339$listoftaskcontacttype = array();
340$sql =
"SELECT ctc.rowid, ctc.code FROM ".MAIN_DB_PREFIX.
"c_type_contact as ctc";
341$sql .=
" WHERE ctc.element = '".$db->escape(
$object->element).
"'";
342$sql .=
" AND ctc.source = 'internal'";
343$resql =
$db->query($sql);
345 while ($obj =
$db->fetch_object($resql)) {
346 $listoftaskcontacttype[$obj->rowid] = $obj->code;
351if (count($listoftaskcontacttype) == 0) {
352 $listoftaskcontacttype[0] =
'0';
357$sanitizeddistinct =
'DISTINCT';
358$sql =
"SELECT ".$sanitizeddistinct.
" p.rowid as projectid, p.ref as projectref, p.title as projecttitle, p.fk_statut as projectstatus, p.datee as projectdatee, p.fk_opp_status, p.public, p.fk_user_creat as projectusercreate, p.usage_bill_time,";
359$sql .=
" s.nom as name, s.name_alias as alias, s.rowid as socid,";
360$sql .=
" t.datec as date_creation, t.dateo as date_start, t.datee as date_end, t.tms as date_modification,";
361$sql .=
" t.rowid as id, t.ref, t.label, t.planned_workload, t.duration_effective, t.progress, t.fk_statut as status,";
362$sql .=
" t.description, t.fk_task_parent, t.budget_amount";
364if (!empty($arrayfields[
't.tobill'][
'checked']) || !empty($arrayfields[
't.billed'][
'checked'])) {
365 $sql .=
" , SUM(tt.element_duration * ".$db->ifsql(
"invoice_id IS NULL",
"1",
"0").
") as tobill, SUM(tt.element_duration * ".
$db->ifsql(
"invoice_id IS NULL",
"0",
"1").
") as billed";
368if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
369 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
370 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
374$parameters = array();
375$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
376$sql .= $hookmanager->resPrint;
377$sql = preg_replace(
'/,\s*$/',
'', $sql);
381$sql .=
" FROM ".MAIN_DB_PREFIX.
"projet as p";
382$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s on p.fk_soc = s.rowid";
383$sql .=
", ".MAIN_DB_PREFIX.
"projet_task as t";
384if (!empty($arrayfields[
't.tobill'][
'checked']) || !empty($arrayfields[
't.billed'][
'checked'])) {
385 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"element_time as tt ON (tt.fk_element = t.rowid AND tt.elementtype = 'task')";
387if (isset($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
388 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (t.rowid = ef.fk_object)";
390if ($search_project_user > 0) {
391 $sql .=
", ".MAIN_DB_PREFIX.
"element_contact as ecp";
393if ($search_task_user > 0) {
394 $sql .=
", ".MAIN_DB_PREFIX.
"element_contact as ect";
396$sql .=
" WHERE t.fk_projet = p.rowid";
397$sql .=
" AND p.entity IN (".getEntity(
'project').
')';
398if (!$user->hasRight(
'projet',
'all',
'lire')) {
399 $sql .=
" AND p.rowid IN (".$db->sanitize($projectsListId ? $projectsListId :
'0').
")";
401if (is_object($projectstatic) && $projectstatic->id > 0) {
402 $sql .=
" AND p.rowid = ".((int) $projectstatic->id);
406 $sql .=
" AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".((int) $socid).
")";
408if ($search_project_ref) {
411if ($search_project_title) {
414if ($search_task_ref) {
417if ($search_task_label) {
420if ($search_task_description) {
421 $sql .=
natural_search(
't.description', $search_task_description);
423if ($search_task_ref_parent) {
424 $sql .=
' AND t.fk_task_parent IN (SELECT ipt.rowid FROM '.MAIN_DB_PREFIX.
'projet_task as ipt WHERE '.
natural_search(
'ipt.ref', $search_task_ref_parent, 0, 1).
')';
426if ($search_task_progress) {
429if ($search_task_budget_amount) {
430 $sql .=
natural_search(
't.budget_amount', $search_task_budget_amount, 1);
432if (empty($arrayfields[
's.name_alias'][
'checked']) && $search_societe) {
433 $sql .=
natural_search(array(
"s.nom",
"s.name_alias"), $search_societe);
435 if ($search_societe) {
438 if ($search_societe_alias) {
442if ($search_date_start) {
443 $sql .=
" AND t.dateo >= '".$db->idate($search_date_start).
"'";
445if ($search_date_end) {
446 $sql .=
" AND t.dateo <= '".$db->idate($search_date_end).
"'";
448if ($search_datelimit_start) {
449 $sql .=
" AND t.datee >= '".$db->idate($search_datelimit_start).
"'";
451if ($search_datelimit_end) {
452 $sql .=
" AND t.datee <= '".$db->idate($search_datelimit_end).
"'";
455 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
457if ($search_projectstatus >= 0) {
458 if ($search_projectstatus == 99) {
459 $sql .=
" AND p.fk_statut <> 2";
461 $sql .=
" AND p.fk_statut = ".((int) $search_projectstatus);
464if ($search_project_user > 0) {
465 $sql .=
" AND ecp.fk_c_type_contact IN (".$db->sanitize(implode(
',', array_keys($listofprojectcontacttype))).
") AND ecp.element_id = p.rowid AND ecp.fk_socpeople = ".((int) $search_project_user);
467if ($search_task_user > 0) {
468 $sql .=
" AND ect.fk_c_type_contact IN (".$db->sanitize(implode(
',', array_keys($listoftaskcontacttype))).
") AND ect.element_id = t.rowid AND ect.fk_socpeople = ".((int) $search_task_user);
470if ($search_task_status > -1) {
471 $sql .=
" AND t.fk_statut = ".((int) $search_task_status);
474$searchCategoryProjectList = array($search_categ);
475$searchCategoryProjectOperator = 0;
476if (!empty($searchCategoryProjectList)) {
477 $searchCategoryProjectSqlList = array();
478 $listofcategoryid =
'';
479 foreach ($searchCategoryProjectList as $searchCategoryProject) {
480 if (intval($searchCategoryProject) == -2) {
481 $searchCategoryProjectSqlList[] =
"NOT EXISTS (SELECT ck.fk_project FROM ".MAIN_DB_PREFIX.
"categorie_project as ck WHERE p.rowid = ck.fk_project)";
482 } elseif (intval($searchCategoryProject) > 0) {
483 if ($searchCategoryProjectOperator == 0) {
484 $searchCategoryProjectSqlList[] =
" EXISTS (SELECT ck.fk_project FROM ".MAIN_DB_PREFIX.
"categorie_project as ck WHERE p.rowid = ck.fk_project AND ck.fk_categorie = ".((int) $searchCategoryProject).
")";
486 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryProject);
490 if ($listofcategoryid) {
491 $searchCategoryProjectSqlList[] =
" EXISTS (SELECT ck.fk_project FROM ".MAIN_DB_PREFIX.
"categorie_project as ck WHERE p.rowid = ck.fk_project AND ck.fk_categorie IN (".
$db->sanitize($listofcategoryid).
"))";
493 if ($searchCategoryProjectOperator == 1) {
494 if (!empty($searchCategoryProjectSqlList)) {
495 $sql .=
" AND (".implode(
' OR ', $searchCategoryProjectSqlList).
")";
498 if (!empty($searchCategoryProjectSqlList)) {
499 $sql .=
" AND (".implode(
' AND ', $searchCategoryProjectSqlList).
")";
503$searchCategoryCustomerSqlList = array();
504if ($searchCategoryCustomerOperator == 1) {
505 $existsCategoryCustomerList = array();
506 foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
507 if (intval($searchCategoryCustomer) == -2) {
508 $sqlCategoryCustomerNotExists =
" NOT EXISTS (";
509 $sqlCategoryCustomerNotExists .=
" SELECT cat_cus.fk_soc";
510 $sqlCategoryCustomerNotExists .=
" FROM ".$db->prefix().
"categorie_societe AS cat_cus";
511 $sqlCategoryCustomerNotExists .=
" WHERE cat_cus.fk_soc = p.fk_soc";
512 $sqlCategoryCustomerNotExists .=
" )";
513 $searchCategoryCustomerSqlList[] = $sqlCategoryCustomerNotExists;
514 } elseif (intval($searchCategoryCustomer) > 0) {
515 $existsCategoryCustomerList[] =
$db->escape($searchCategoryCustomer);
518 if (!empty($existsCategoryCustomerList)) {
519 $sqlCategoryCustomerExists =
" EXISTS (";
520 $sqlCategoryCustomerExists .=
" SELECT cat_cus.fk_soc";
521 $sqlCategoryCustomerExists .=
" FROM ".$db->prefix().
"categorie_societe AS cat_cus";
522 $sqlCategoryCustomerExists .=
" WHERE cat_cus.fk_soc = p.fk_soc";
523 $sqlCategoryCustomerExists .=
" AND cat_cus.fk_categorie IN (".$db->sanitize(implode(
',', $existsCategoryCustomerList)).
")";
524 $sqlCategoryCustomerExists .=
" )";
525 $searchCategoryCustomerSqlList[] = $sqlCategoryCustomerExists;
527 if (!empty($searchCategoryCustomerSqlList)) {
528 $sql .=
" AND (".implode(
' OR ', $searchCategoryCustomerSqlList).
")";
531 foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
532 if (intval($searchCategoryCustomer) == -2) {
533 $sqlCategoryCustomerNotExists =
" NOT EXISTS (";
534 $sqlCategoryCustomerNotExists .=
" SELECT cat_cus.fk_soc";
535 $sqlCategoryCustomerNotExists .=
" FROM ".$db->prefix().
"categorie_societe AS cat_cus";
536 $sqlCategoryCustomerNotExists .=
" WHERE cat_cus.fk_soc = p.fk_soc";
537 $sqlCategoryCustomerNotExists .=
" )";
538 $searchCategoryCustomerSqlList[] = $sqlCategoryCustomerNotExists;
539 } elseif (intval($searchCategoryCustomer) > 0) {
540 $searchCategoryCustomerSqlList[] =
"p.fk_soc IN (SELECT fk_soc FROM ".$db->prefix().
"categorie_societe WHERE fk_categorie = ".((int) $searchCategoryCustomer).
")";
543 if (!empty($searchCategoryCustomerSqlList)) {
544 $sql .=
" AND (".implode(
' AND ', $searchCategoryCustomerSqlList).
")";
548include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
550$parameters = array();
551$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
552$sql .= $hookmanager->resPrint;
553if (!empty($arrayfields[
't.tobill'][
'checked']) || !empty($arrayfields[
't.billed'][
'checked'])) {
554 $sql .=
" GROUP BY p.rowid, p.ref, p.title, p.fk_statut, p.datee, p.fk_opp_status, p.public, p.fk_user_creat,";
555 $sql .=
" s.nom, s.rowid,";
556 $sql .=
" t.datec, t.dateo, t.datee, t.tms,";
557 $sql .=
" t.rowid, t.ref, t.label, t.planned_workload, t.duration_effective, t.progress,t.budget_amount, t.fk_statut";
559 if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
560 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
561 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key :
'');
567$nbtotalofrecords =
'';
570 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
571 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
572 $resql =
$db->query($sqlforcount);
574 $objforcount =
$db->fetch_object($resql);
575 $nbtotalofrecords = $objforcount->nbtotalofrecords;
580 if (($page * $limit) > (
int) $nbtotalofrecords) {
588$sql .=
$db->order($sortfield, $sortorder);
590 $sql .=
$db->plimit($limit + 1, $offset);
593$resql =
$db->query($sql);
599$num =
$db->num_rows($resql);
603if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all) {
604 $obj =
$db->fetch_object($resql);
606 header(
"Location: ".DOL_URL_ROOT.
'/projet/tasks/task.php?id='.
$id.
'&withproject=1');
614llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'bodyforlist mod-project project-tasks page-list');
616$arrayofselected = is_array($toselect) ? $toselect : array();
620 $param .=
'&mode='.urlencode($mode);
622if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
623 $param .=
'&contextpage='.urlencode($contextpage);
625if ($limit > 0 && $limit !=
$conf->liste_limit) {
626 $param .=
'&limit='.((int) $limit);
628if ($search_date_startday) {
629 $param .=
'&search_date_startday='.urlencode((
string) ($search_date_startday));
631if ($search_date_startmonth) {
632 $param .=
'&search_date_startmonth='.urlencode((
string) ($search_date_startmonth));
634if ($search_date_startyear) {
635 $param .=
'&search_date_startyear='.urlencode((
string) ($search_date_startyear));
637if ($search_date_endday) {
638 $param .=
'&search_date_endday='.urlencode((
string) ($search_date_endday));
640if ($search_date_endmonth) {
641 $param .=
'&search_date_endmonth='.urlencode((
string) ($search_date_endmonth));
643if ($search_date_endyear) {
644 $param .=
'&search_date_endyear='.urlencode((
string) ($search_date_endyear));
646if ($search_datelimit_startday) {
647 $param .=
'&search_datelimit_startday='.urlencode((
string) ($search_datelimit_startday));
649if ($search_datelimit_startmonth) {
650 $param .=
'&search_datelimit_startmonth='.urlencode((
string) ($search_datelimit_startmonth));
652if ($search_datelimit_startyear) {
653 $param .=
'&search_datelimit_startyear='.urlencode((
string) ($search_datelimit_startyear));
655if ($search_datelimit_endday) {
656 $param .=
'&search_datelimit_endday='.urlencode((
string) ($search_datelimit_endday));
658if ($search_datelimit_endmonth) {
659 $param .=
'&search_datelimit_endmonth='.urlencode((
string) ($search_datelimit_endmonth));
661if ($search_datelimit_endyear) {
662 $param .=
'&search_datelimit_endyear='.urlencode((
string) ($search_datelimit_endyear));
664if ($search_task_budget_amount) {
665 $param .=
'&search_task_budget_amount='.urlencode($search_task_budget_amount);
668 $param .=
'&socid='.urlencode($socid);
670if ($search_all !=
'') {
671 $param .=
'&search_all='.urlencode($search_all);
673if ($search_project_ref !=
'') {
674 $param .=
'&search_project_ref='.urlencode($search_project_ref);
676if ($search_project_title !=
'') {
677 $param .=
'&search_project_title='.urlencode($search_project_title);
679if ($search_task_ref !=
'') {
680 $param .=
'&search_task_ref='.urlencode($search_task_ref);
682if ($search_task_label !=
'') {
683 $param .=
'&search_task_label='.urlencode($search_task_label);
685if ($search_task_description !=
'') {
686 $param .=
'&search_task_description='.urlencode($search_task_description);
688if ($search_task_ref_parent !=
'') {
689 $param .=
'&search_task_ref_parent='.urlencode($search_task_ref_parent);
691if ($search_task_progress !=
'') {
692 $param .=
'&search_task_progress='.urlencode($search_task_progress);
694if ($search_task_status !=
'') {
695 $param .=
'&search_task_status='.urlencode((
string) ($search_task_status));
697if ($search_societe !=
'') {
698 $param .=
'&search_societe='.urlencode($search_societe);
700if ($search_societe !=
'') {
701 $param .=
'&search_societe_alias='.urlencode($search_societe_alias);
703if ($search_projectstatus !=
'') {
704 $param .=
'&search_projectstatus='.urlencode($search_projectstatus);
706if ((is_numeric($search_opp_status) && $search_opp_status >= 0) || in_array($search_opp_status, array(
'all',
'none'))) {
707 $param .=
'&search_opp_status='.urlencode($search_opp_status);
709if ($search_project_user !=
'') {
710 $param .=
'&search_project_user='.urlencode((
string) ($search_project_user));
712if ($search_task_user > 0) {
713 $param .=
'&search_task_user='.urlencode($search_task_user);
715if ($optioncss !=
'') {
716 $param .=
'&optioncss='.urlencode($optioncss);
718foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
719 $param .=
"&search_category_customer_list[]=".urlencode($searchCategoryCustomer);
722include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
724$parameters = array(
'param' => &$param);
725$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
726$param .= $hookmanager->resPrint;
729$arrayofmassactions = array(
734if (!empty($permissiontodelete)) {
735 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
737if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'presend',
'predelete'))) {
738 $arrayofmassactions = array();
740$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
742print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
743if ($optioncss !=
'') {
744 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
746print
'<input type="hidden" name="token" value="'.newToken().
'">';
747print
'<input type="hidden" name="action" value="list">';
748print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
749print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
750print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
751print
'<input type="hidden" name="page" value="'.$page.
'">';
753 print
'<input type="hidden" name="type" value="'.$type.
'">';
755print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
756print
'<input type="hidden" name="page_y" value="">';
757print
'<input type="hidden" name="mode" value="'.$mode.
'">';
762$newcardbutton .= dolGetButtonTitle($langs->trans(
'ViewList'),
'',
'fa fa-bars imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=common'.preg_replace(
'/(&|\?)*mode=[^&]+/',
'', $param),
'', ((empty($mode) || $mode ==
'common') ? 2 : 1), array(
'morecss' =>
'reposition'));
763$newcardbutton .= dolGetButtonTitle($langs->trans(
'ViewKanban'),
'',
'fa fa-th-list imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=kanban'.preg_replace(
'/(&|\?)*mode=[^&]+/',
'', $param),
'', ($mode ==
'kanban' ? 2 : 1), array(
'morecss' =>
'reposition'));
764$newcardbutton .= dolGetButtonTitle($langs->trans(
'Statistics'),
'',
'fa fa-chart-bar imgforviewmode', DOL_URL_ROOT.
'/projet/tasks/stats/index.php?mode=statistics&contextpage='.$contextpage.preg_replace(
'/(&|\?)*(mode|groupby)=[^&]+/',
'', $param),
'', ($mode ==
'statistics' ? 2 : 1), array(
'morecss' =>
'reposition'));
765$newcardbutton .= dolGetButtonTitleSeparator();
766$newcardbutton .= dolGetButtonTitle($langs->trans(
'NewTask'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/projet/tasks.php?action=create&backtopage='.urlencode(DOL_URL_ROOT.
'/projet/tasks/list.php'),
'', $permissiontocreate);
771if ($search_task_user == $user->id) {
772 $htmltooltip .= $langs->trans(
"MyTasksDesc");
774 if ($user->hasRight(
'projet',
'all',
'lire') && !$socid) {
775 $htmltooltip .= $langs->trans(
"TasksOnProjectsDesc");
777 $htmltooltip .= $langs->trans(
"TasksOnProjectsPublicDesc");
781print_barre_liste($form->textwithpicto($title, $htmltooltip), $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'projecttask', 0, $newcardbutton,
'', $limit, 0, 0, 1);
783$topicmail =
"Information";
786$trackid =
'tas'.$object->id;
787include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
791 foreach ($fieldstosearchall as $key => $val) {
792 $fieldstosearchall[$key] = $langs->trans($val);
793 $setupstring .= $key.
"=".$val.
";";
795 print
'<!-- Search done like if TASK_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
796 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>'.
"\n";
802if (
isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
803 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
804 $moreforfilter .=
'<div class="divsearchfield">';
805 $tmptitle = $langs->trans(
'ProjectCategories');
806 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"').$formother->select_categories(
'project', (
int) $search_categ,
'search_categ', 1, $tmptitle,
'maxwidth300');
807 $moreforfilter .=
'</div>';
811$moreforfilter .=
'<div class="divsearchfield">';
812$tmptitle = $langs->trans(
'ProjectsWithThisUserAsContact');
814if (!$user->hasRight(
'user',
'user',
'lire')) {
815 $includeonly = array($user->id);
817$moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$form->select_dolusers($search_project_user ? $search_project_user :
'',
'search_project_user', $tmptitle, null, 0, $includeonly,
'',
'0', 0, 0,
'', 0,
'',
'maxwidth250');
818$moreforfilter .=
'</div>';
821$moreforfilter .=
'<div class="divsearchfield">';
822$tmptitle = $langs->trans(
'TasksWithThisUserAsContact');
824if (!$user->hasRight(
'user',
'user',
'lire')) {
825 $includeonly = array($user->id);
827$moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$form->select_dolusers($search_task_user,
'search_task_user', $tmptitle,
null, 0, $includeonly,
'',
'0', 0, 0,
'', 0,
'',
'maxwidth250');
828$moreforfilter .=
'</div>';
833 $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_CUSTOMER, $searchCategoryCustomerList,
'minwidth300', $searchCategoryCustomerList ? $searchCategoryCustomerList : 0);
836if (!empty($moreforfilter)) {
837 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
838 print $moreforfilter;
839 $parameters = array();
840 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
841 print $hookmanager->resPrint;
845$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
846$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
$conf->main_checkbox_left_column);
847$selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
848$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
850print
'<div class="div-table-responsive">';
851print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'" id="tablelines3">'.
"\n";
855print
'<tr class="liste_titre_filter">';
857if (
$conf->main_checkbox_left_column) {
858 print
'<td class="liste_titre center maxwidthsearch">';
859 $searchpicto = $form->showFilterButtons(
'left');
863if (!empty($arrayfields[
't.ref'][
'checked'])) {
864 print
'<td class="liste_titre">';
865 print
'<input type="text" class="flat" name="search_task_ref" value="'.dol_escape_htmltag($search_task_ref).
'" class="width75">';
868if (!empty($arrayfields[
't.fk_task_parent'][
'checked'])) {
869 print
'<td class="liste_titre">';
870 print
'<input type="text" class="flat" name="search_task_ref_parent" value="'.dol_escape_htmltag($search_task_ref_parent).
'" class="maxwidth75">';
873if (!empty($arrayfields[
't.label'][
'checked'])) {
874 print
'<td class="liste_titre">';
875 print
'<input type="text" class="flat" name="search_task_label" value="'.dol_escape_htmltag($search_task_label).
'" class="maxwidth75">';
879if (!empty($arrayfields[
't.description'][
'checked'])) {
880 print
'<td class="liste_titre">';
881 print
'<input type="text" class="flat" name="search_task_description" value="'.dol_escape_htmltag($search_task_description).
'" class="maxwidth75">';
885if (!empty($arrayfields[
't.dateo'][
'checked'])) {
886 print
'<td class="liste_titre center">';
887 print
'<div class="nowrapfordate">';
888 print $form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
890 print
'<div class="nowrapfordate">';
891 print $form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
896if (!empty($arrayfields[
't.datee'][
'checked'])) {
897 print
'<td class="liste_titre center">';
898 print
'<div class="nowrapfordate">';
899 print $form->selectDate($search_datelimit_start ? $search_datelimit_start : -1,
'search_datelimit_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
901 print
'<div class="nowrapfordate">';
902 print $form->selectDate($search_datelimit_end ? $search_datelimit_end : -1,
'search_datelimit_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
908if (!empty($arrayfields[
'p.ref'][
'checked'])) {
909 print
'<td class="liste_titre">';
910 print
'<input type="text" class="flat" name="search_project_ref" value="'.$search_project_ref.
'" size="4">';
913if (!empty($arrayfields[
'p.title'][
'checked'])) {
914 print
'<td class="liste_titre">';
915 print
'<input type="text" class="flat" name="search_project_title" value="'.$search_project_title.
'" size="6">';
918if (!empty($arrayfields[
's.nom'][
'checked'])) {
919 print
'<td class="liste_titre">';
920 print
'<input type="text" class="flat" name="search_societe" value="'.dol_escape_htmltag($search_societe).
'" size="4">';
923if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
924 print
'<td class="liste_titre">';
925 print
'<input type="text" class="flat" name="search_societe_alias" value="'.dol_escape_htmltag($search_societe_alias).
'" size="4">';
928if (!empty($arrayfields[
'p.fk_statut'][
'checked'])) {
929 print
'<td class="liste_titre center">';
930 $arrayofstatus = array();
931 foreach ($projectstatic->labelStatusShort as $key => $val) {
932 $arrayofstatus[$key] = $langs->trans($val);
934 $arrayofstatus[
'99'] = $langs->trans(
"NotClosed").
' ('.$langs->trans(
'Draft').
'+'.$langs->trans(
'Opened').
')';
935 print $form->selectarray(
'search_projectstatus', $arrayofstatus, $search_projectstatus, 1, 0, 0,
'', 0, 0, 0,
'',
'maxwidth100');
938if (!empty($arrayfields[
't.planned_workload'][
'checked'])) {
939 print
'<td class="liste_titre"></td>';
941if (!empty($arrayfields[
't.duration_effective'][
'checked'])) {
942 print
'<td class="liste_titre"></td>';
944if (!empty($arrayfields[
't.progress_calculated'][
'checked'])) {
945 print
'<td class="liste_titre"></td>';
947if (!empty($arrayfields[
't.progress'][
'checked'])) {
948 print
'<td class="liste_titre center">';
949 print
'<input type="text" class="flat" name="search_task_progress" value="'.$search_task_progress.
'" size="4">';
953if (!empty($arrayfields[
't.progress_summary'][
'checked'])) {
954 print
'<td class="liste_titre"></td>';
956if (!empty($arrayfields[
't.fk_statut'][
'checked'])) {
957 print
'<td class="liste_titre center">';
958 $arrayofstatus = array();
959 foreach (
$object->labelStatusShort as $key => $val) {
960 $arrayofstatus[$key] = $langs->trans($val);
962 print $form->selectarray(
'search_task_status', $arrayofstatus, $search_task_status, 1, 0, 0,
'', 0, 0, 0,
'',
'maxwidth100');
966if (!empty($arrayfields[
't.budget_amount'][
'checked'])) {
967 print
'<td class="liste_titre center">';
968 print
'<input type="text" class="flat" name="search_task_budget_amount" value="'.$search_task_budget_amount.
'" size="4">';
972if (!empty($arrayfields[
't.tobill'][
'checked'])) {
973 print
'<td class="liste_titre"></td>';
975if (!empty($arrayfields[
't.billed'][
'checked'])) {
976 print
'<td class="liste_titre"></td>';
979include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
981$parameters = array(
'arrayfields' => $arrayfields);
982$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
983print $hookmanager->resPrint;
984if (!empty($arrayfields[
't.datec'][
'checked'])) {
986 print
'<td class="liste_titre">';
989if (!empty($arrayfields[
't.tms'][
'checked'])) {
991 print
'<td class="liste_titre">';
995if (!
$conf->main_checkbox_left_column) {
996 print
'<td class="liste_titre center maxwidthsearch">';
997 $searchpicto = $form->showFilterButtons();
1007 't.planned_workload' => 0,
1008 't.duration_effective' => 0,
1010 't.budget_amount' => 0,
1012 'totalplannedworkload' => 0,
1013 'totaldurationeffective' => 0,
1014 'totaldurationdeclared' => 0,
1015 'totaltobillfield' => 0,
1016 'totalbilledfield' => 0,
1017 'totalbudget_amountfield' => 0,
1018 'totalbudgetamount' => 0,
1022 'totalizable' => [],
1027print
'<tr class="liste_titre">';
1029if (
$conf->main_checkbox_left_column) {
1030 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
1033if (!empty($arrayfields[
't.ref'][
'checked'])) {
1034 print_liste_field_titre($arrayfields[
't.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"t.ref",
"", $param,
"", $sortfield, $sortorder);
1037if (!empty($arrayfields[
't.fk_task_parent'][
'checked'])) {
1038 print_liste_field_titre($arrayfields[
't.fk_task_parent'][
'label'], $_SERVER[
"PHP_SELF"],
"t.fk_task_parent",
"", $param,
"", $sortfield, $sortorder);
1041if (!empty($arrayfields[
't.label'][
'checked'])) {
1042 print_liste_field_titre($arrayfields[
't.label'][
'label'], $_SERVER[
"PHP_SELF"],
"t.label",
"", $param,
"", $sortfield, $sortorder);
1045if (!empty($arrayfields[
't.description'][
'checked'])) {
1046 print_liste_field_titre($arrayfields[
't.description'][
'label'], $_SERVER[
"PHP_SELF"],
"t.description",
"", $param,
"", $sortfield, $sortorder);
1049if (!empty($arrayfields[
't.dateo'][
'checked'])) {
1050 print_liste_field_titre($arrayfields[
't.dateo'][
'label'], $_SERVER[
"PHP_SELF"],
"t.dateo",
"", $param,
'', $sortfield, $sortorder,
'center ');
1053if (!empty($arrayfields[
't.datee'][
'checked'])) {
1054 print_liste_field_titre($arrayfields[
't.datee'][
'label'], $_SERVER[
"PHP_SELF"],
"t.datee",
"", $param,
'', $sortfield, $sortorder,
'center ');
1057if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1058 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"p.ref",
"", $param,
"", $sortfield, $sortorder);
1061if (!empty($arrayfields[
'p.title'][
'checked'])) {
1062 print_liste_field_titre($arrayfields[
'p.title'][
'label'], $_SERVER[
"PHP_SELF"],
"p.title",
"", $param,
"", $sortfield, $sortorder);
1065if (!empty($arrayfields[
's.nom'][
'checked'])) {
1066 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"s.nom",
"", $param,
"", $sortfield, $sortorder);
1069if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1070 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
"PHP_SELF"],
"s.name_alias",
"", $param,
"", $sortfield, $sortorder);
1073if (!empty($arrayfields[
'p.fk_statut'][
'checked'])) {
1074 print_liste_field_titre($arrayfields[
'p.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_statut",
"", $param,
'', $sortfield, $sortorder,
'center ');
1077if (!empty($arrayfields[
't.planned_workload'][
'checked'])) {
1078 print_liste_field_titre($arrayfields[
't.planned_workload'][
'label'], $_SERVER[
"PHP_SELF"],
"t.planned_workload",
"", $param,
'', $sortfield, $sortorder,
'center ');
1081if (!empty($arrayfields[
't.duration_effective'][
'checked'])) {
1082 print_liste_field_titre($arrayfields[
't.duration_effective'][
'label'], $_SERVER[
"PHP_SELF"],
"t.duration_effective",
"", $param,
'', $sortfield, $sortorder,
'center ');
1085if (!empty($arrayfields[
't.progress_calculated'][
'checked'])) {
1086 print_liste_field_titre($arrayfields[
't.progress_calculated'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"", $param,
'',
'',
'',
'center ');
1089if (!empty($arrayfields[
't.progress'][
'checked'])) {
1090 print_liste_field_titre($arrayfields[
't.progress'][
'label'], $_SERVER[
"PHP_SELF"],
"t.progress",
"", $param,
'', $sortfield, $sortorder,
'center ');
1093if (!empty($arrayfields[
't.progress_summary'][
'checked'])) {
1094 print_liste_field_titre($arrayfields[
't.progress_summary'][
'label'], $_SERVER[
"PHP_SELF"],
"t.progress",
"", $param,
'', $sortfield, $sortorder,
'center ');
1097if (!empty($arrayfields[
't.fk_statut'][
'checked'])) {
1098 print_liste_field_titre($arrayfields[
't.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"t.fk_statut",
"", $param,
'', $sortfield, $sortorder,
'center ');
1101if (!empty($arrayfields[
't.budget_amount'][
'checked'])) {
1102 print_liste_field_titre($arrayfields[
't.budget_amount'][
'label'], $_SERVER[
"PHP_SELF"],
"t.budget_amount",
"", $param,
'', $sortfield, $sortorder,
'center ');
1105if (!empty($arrayfields[
't.tobill'][
'checked'])) {
1107 print_liste_field_titre($arrayfields[
't.tobill'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"", $param,
'', $sortfield, $sortorder,
'center ');
1110if (!empty($arrayfields[
't.billed'][
'checked'])) {
1111 print_liste_field_titre($arrayfields[
't.billed'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"", $param,
'', $sortfield, $sortorder,
'center ');
1115include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1118 'arrayfields' => $arrayfields,
1120 'sortfield' => $sortfield,
1121 'sortorder' => $sortorder,
1124$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
1125print $hookmanager->resPrint;
1126if (!empty($arrayfields[
't.datec'][
'checked'])) {
1127 print_liste_field_titre($arrayfields[
't.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"t.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1130if (!empty($arrayfields[
't.tms'][
'checked'])) {
1131 print_liste_field_titre($arrayfields[
't.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"t.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1135if (!
$conf->main_checkbox_left_column) {
1136 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
1141$plannedworkloadoutputformat =
'allhourmin';
1142$timespentoutputformat =
'allhourmin';
1144 $plannedworkloadoutputformat =
getDolGlobalString(
'PROJECT_PLANNED_WORKLOAD_FORMAT');
1156$imaxinloop = ($limit ? min($num, $limit) : $num);
1157while ($i < $imaxinloop) {
1158 $obj =
$db->fetch_object($resql);
1167 $object->description = $obj->description;
1168 $object->status = $obj->status;
1169 $object->progress = $obj->progress;
1170 $object->budget_amount = $obj->budget_amount;
1171 $object->date_start =
$db->jdate($obj->date_start);
1172 $object->date_end =
$db->jdate($obj->date_end);
1173 $object->planned_workload = $obj->planned_workload;
1174 $object->duration_effective = $obj->duration_effective;
1175 $object->fk_task_parent = $obj->fk_task_parent;
1177 $projectstatic->id = $obj->projectid;
1178 $projectstatic->ref = $obj->projectref;
1179 $projectstatic->title = $obj->projecttitle;
1180 $projectstatic->public = $obj->public;
1181 $projectstatic->statut = $obj->projectstatus;
1182 $projectstatic->datee =
$db->jdate($obj->projectdatee);
1185 $socstatic->id = $obj->socid;
1186 $socstatic->name = $obj->name;
1187 $socstatic->name_alias = $obj->alias;
1189 if ($mode ==
'kanban') {
1191 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
1192 print
'<div class="box-flex-container kanban">';
1195 if ($massactionbutton || $massaction) {
1197 if (in_array(
$object->id, $arrayofselected)) {
1202 $arraydata = array();
1203 $arraydata[
'projectlink'] = $projectstatic->getNomUrl(1);
1204 $arraydata[
'selected'] = in_array(
$object->id, $arrayofselected);
1206 print
$object->getKanbanView(
'', $arraydata);
1207 if ($i == ($imaxinloop - 1)) {
1212 $userAccess = $projectstatic->restrictedProjectArea($user);
1213 if ($userAccess >= 0) {
1216 print
'<tr data-rowid="'.$object->id.
'" class="oddeven row-with-select">';
1219 if (
$conf->main_checkbox_left_column) {
1220 print
'<td class="nowrap center">';
1221 if ($massactionbutton || $massaction) {
1223 if (in_array(
$object->id, $arrayofselected)) {
1226 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1234 if (!empty($arrayfields[
't.ref'][
'checked'])) {
1235 print
'<td class="nowraponall">';
1236 print
$object->getNomUrl(1,
'withproject');
1246 if (!empty($arrayfields[
't.fk_task_parent'][
'checked'])) {
1247 print
'<td class="nowraponall">';
1248 if (!empty(
$object->fk_task_parent)) {
1249 $object_parent =
new Task(
$db);
1250 $result = $object_parent->fetch(
$object->fk_task_parent);
1254 print $object_parent->getNomUrl(1,
'withproject');
1255 if ($object_parent->hasDelay()) {
1266 if (!empty($arrayfields[
't.label'][
'checked'])) {
1267 print
'<td class="tdoverflowmax200" title="'.dol_escape_htmltag(
$object->label).
'">';
1275 if (!empty($arrayfields[
't.description'][
'checked'])) {
1285 if (!empty($arrayfields[
't.dateo'][
'checked'])) {
1286 print
'<td class="center">';
1294 if (!empty($arrayfields[
't.datee'][
'checked'])) {
1295 print
'<td class="center">';
1303 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1304 print
'<td class="nowraponall tdoverflowmax150">';
1305 print $projectstatic->getNomUrl(1,
'task');
1306 if ($projectstatic->hasDelay()) {
1315 if (!empty($arrayfields[
'p.title'][
'checked'])) {
1316 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->projecttitle).
'">';
1324 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1325 print
'<td class="tdoverflowmax125">';
1327 print $socstatic->getNomUrl(1,
'', 0, 0, -1, empty($arrayfields[
's.name_alias'][
'checked']) ? 0 : 1);
1337 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1340 $name_alias = $socstatic->name_alias;
1342 print
'<td class="tdoverflowmax125" title="'.dol_escape_htmltag($name_alias).
'">';
1350 if (!empty($arrayfields[
'p.fk_statut'][
'checked'])) {
1351 print
'<td class="center">';
1352 print $projectstatic->getLibStatut(1);
1360 if (!empty($arrayfields[
't.planned_workload'][
'checked'])) {
1361 print
'<td class="center">';
1364 if ($obj->planned_workload !=
'') {
1377 if (!isset(
$totalarray[
'val'][
't.planned_workload'])) {
1380 $totalarray[
'val'][
't.planned_workload'] += $obj->planned_workload;
1384 if (!isset(
$totalarray[
'totalplannedworkload'])) {
1387 $totalarray[
'totalplannedworkload'] += $obj->planned_workload;
1390 if (!empty($arrayfields[
't.duration_effective'][
'checked'])) {
1391 $showlineingray = 0;
1393 print
'<td class="center">';
1394 if ($showlineingray) {
1397 print
'<a href="'.DOL_URL_ROOT.
'/projet/tasks/time.php?id='.
$object->id.($showproject ?
'' :
'&withproject=1').
'">';
1399 if ($obj->duration_effective) {
1404 if ($showlineingray) {
1409 if (empty($arrayfields[
't.progress_calculated'][
'checked'])) {
1410 if ($obj->planned_workload || $obj->duration_effective) {
1411 if ($obj->planned_workload) {
1412 print
' <span class="opacitymedium">('.round(100 * $obj->duration_effective / $obj->planned_workload, 2).
' %)</span>';
1414 print $form->textwithpicto(
'', $langs->trans(
'WorkloadNotDefined'), 1,
'help');
1425 if (!isset(
$totalarray[
'val'][
't.duration_effective'])) {
1428 $totalarray[
'val'][
't.duration_effective'] += $obj->duration_effective;
1432 if (!isset(
$totalarray[
'totaldurationeffective'])) {
1435 $totalarray[
'totaldurationeffective'] += $obj->duration_effective;
1438 if (!empty($arrayfields[
't.progress_calculated'][
'checked'])) {
1439 print
'<td class="center">';
1440 if ($obj->planned_workload || $obj->duration_effective) {
1441 if ($obj->planned_workload) {
1442 print round(100 * $obj->duration_effective / $obj->planned_workload, 2).
' %';
1444 print $form->textwithpicto(
'', $langs->trans(
'WorkloadNotDefined'), 1,
'help');
1456 if (!empty($arrayfields[
't.progress'][
'checked'])) {
1457 print
'<td class="center">';
1458 if ($obj->progress !=
'') {
1471 $totalarray[
'val'][
't.progress'] += ($obj->planned_workload * $obj->progress / 100);
1475 if (!isset(
$totalarray[
'totaldurationdeclared'])) {
1478 $totalarray[
'totaldurationdeclared'] += $obj->planned_workload * $obj->progress / 100;
1481 if (!empty($arrayfields[
't.progress_summary'][
'checked'])) {
1482 print
'<td class="center">';
1495 if (!empty($arrayfields[
't.fk_statut'][
'checked'])) {
1496 print
'<td class="center">';
1497 print
$object->getLibStatut(4);
1504 if (!empty($arrayfields[
't.budget_amount'][
'checked'])) {
1505 print
'<td class="center">';
1507 print
'<span class="amount">'.price(
$object->budget_amount, 0, $langs, 1, 0, 0,
$conf->currency).
'</span>';
1516 $totalarray[
'val'][
't.budget_amount'] += $obj->budget_amount;
1520 $totalarray[
'totalbudgetamount'] += $obj->budget_amount;
1523 if (!empty($arrayfields[
't.tobill'][
'checked'])) {
1524 print
'<td class="center">';
1525 if ($obj->usage_bill_time) {
1530 print
'<span class="opacitymedium">'.$langs->trans(
"NA").
'</span>';
1544 if (!empty($arrayfields[
't.billed'][
'checked'])) {
1545 print
'<td class="center">';
1546 if ($obj->usage_bill_time) {
1551 print
'<span class="opacitymedium">'.$langs->trans(
"NA").
'</span>';
1565 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
1567 $parameters = array(
'arrayfields' => $arrayfields,
'object' => $object,
'obj' => $obj,
'i' => $i,
'totalarray' => &
$totalarray);
1568 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
1569 print $hookmanager->resPrint;
1571 if (!empty($arrayfields[
't.datec'][
'checked'])) {
1572 print
'<td class="center">';
1580 if (!empty($arrayfields[
't.tms'][
'checked'])) {
1581 print
'<td class="center">';
1594 if (!
$conf->main_checkbox_left_column) {
1595 print
'<td class="nowrap center">';
1596 if ($massactionbutton || $massaction) {
1598 if (in_array(
$object->id, $arrayofselected)) {
1601 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1618 foreach (
$totalarray[
'totalizable'] as $keytotalizable => $valtotalizable) {
1619 $totalarray[
'pos'][$valtotalizable[
'pos']] = $keytotalizable;
1620 $totalarray[
'val'][$keytotalizable] = $valtotalizable[
'total'];
1628 print
'<tr class="liste_total">';
1633 if ((is_null($limit) || $num < $limit) && empty($offset)) {
1634 print
'<td>'.$langs->trans(
"Total").
'</td>';
1637 if (is_object($form)) {
1638 print $form->textwithpicto($langs->trans(
"Total"), $langs->transnoentitiesnoconv(
"Totalforthispage"));
1640 print $langs->trans(
"Totalforthispage");
1650 } elseif (isset(
$totalarray[
'totalplannedworkloadfield']) &&
$totalarray[
'totalplannedworkloadfield'] == $i) {
1651 print
'<td class="center">'.convertSecondToTime(
$totalarray[
'totalplannedworkload'], $plannedworkloadoutputformat).
'</td>';
1652 } elseif (isset(
$totalarray[
'totaldurationeffectivefield']) &&
$totalarray[
'totaldurationeffectivefield'] == $i) {
1653 print
'<td class="center">'.convertSecondToTime(
$totalarray[
'totaldurationeffective'], $timespentoutputformat).
'</td>';
1654 } elseif (isset(
$totalarray[
'totalprogress_calculatedfield']) &&
$totalarray[
'totalprogress_calculatedfield'] == $i) {
1655 print
'<td class="center">'.($totalarray[
'totalplannedworkload'] > 0 ? round(100 *
$totalarray[
'totaldurationeffective'] /
$totalarray[
'totalplannedworkload'], 2).
' %' :
'').
'</td>';
1656 } elseif (isset(
$totalarray[
'totalprogress_declaredfield']) &&
$totalarray[
'totalprogress_declaredfield'] == $i) {
1657 print
'<td class="center">'.($totalarray[
'totalplannedworkload'] > 0 ? round(100 *
$totalarray[
'totaldurationdeclared'] /
$totalarray[
'totalplannedworkload'], 2).
' %' :
'').
'</td>';
1659 print
'<td class="center">'.convertSecondToTime(
$totalarray[
'totaltobill'], $plannedworkloadoutputformat).
'</td>';
1661 print
'<td class="center">'.convertSecondToTime(
$totalarray[
'totalbilled'], $plannedworkloadoutputformat).
'</td>';
1662 } elseif (isset(
$totalarray[
'totalbudget_amountfield']) &&
$totalarray[
'totalbudget_amountfield'] == $i) {
1663 print
'<td class="center">'.price((
float)
$totalarray[
'totalbudgetamount'], 0, $langs, 1, 0, 0,
$conf->currency).
'</td>';
1665 print
'<td class="right">';
1681 print
'<tr><td colspan="'.$savnbfield.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
1686$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
1687$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
1688print $hookmanager->resPrint;
1690print
'</table>'.
"\n";
1693print
'</form>'.
"\n";
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage projects.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage Dolibarr users.
convertSecondToTime($iSecond, $format='all', $lengthOfDay=86400, $lengthOfWeek=7)
Return, in clear text, value of a number of seconds in days, hours and minutes.
dol_now($mode='gmt')
Return date for now.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
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.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dolGetFirstLineOfText($text, $nboflines=1, $charset='UTF-8')
Return first line of text.
setEventMessage($mesgs, $style='mesgs', $noduplicate=0, $attop=0)
Set event message in dol_events session object.
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.
natural_search($fields, $value, $mode=0, $nofirstand=0, $sqltoadd='')
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by the value of a given key, which produces ascending (default) or descending out...
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
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...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
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...
getTaskProgressView($task, $label=true, $progressNumber=true, $hideOnProgressNull=false, $spaced=false)
getTaskProgressBadge($task, $label='', $tooltip='')
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.