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';
284$form =
new Form($db);
287$projectstatic =
new Project($db);
288$puser =
new User($db);
289$tuser =
new User($db);
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,
getDolGlobalString(
'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$distinct =
'DISTINCT';
358$sql =
"SELECT ".$distinct.
" 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'));
765$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);
770if ($search_task_user == $user->id) {
771 $htmltooltip .= $langs->trans(
"MyTasksDesc");
773 if ($user->hasRight(
'projet',
'all',
'lire') && !$socid) {
774 $htmltooltip .= $langs->trans(
"TasksOnProjectsDesc");
776 $htmltooltip .= $langs->trans(
"TasksOnProjectsPublicDesc");
780print_barre_liste($form->textwithpicto($title, $htmltooltip), $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'projecttask', 0, $newcardbutton,
'', $limit, 0, 0, 1);
782$topicmail =
"Information";
784$objecttmp =
new Task($db);
785$trackid =
'tas'.$object->id;
786include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
790 foreach ($fieldstosearchall as $key => $val) {
791 $fieldstosearchall[$key] = $langs->trans($val);
792 $setupstring .= $key.
"=".$val.
";";
794 print
'<!-- Search done like if TASK_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
795 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>'.
"\n";
801if (
isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
802 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
803 $moreforfilter .=
'<div class="divsearchfield">';
804 $tmptitle = $langs->trans(
'ProjectCategories');
805 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"').$formother->select_categories(
'project', (
int) $search_categ,
'search_categ', 1, $tmptitle,
'maxwidth300');
806 $moreforfilter .=
'</div>';
810$moreforfilter .=
'<div class="divsearchfield">';
811$tmptitle = $langs->trans(
'ProjectsWithThisUserAsContact');
813if (!$user->hasRight(
'user',
'user',
'lire')) {
814 $includeonly = array($user->id);
816$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');
817$moreforfilter .=
'</div>';
820$moreforfilter .=
'<div class="divsearchfield">';
821$tmptitle = $langs->trans(
'TasksWithThisUserAsContact');
823if (!$user->hasRight(
'user',
'user',
'lire')) {
824 $includeonly = array($user->id);
826$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');
827$moreforfilter .=
'</div>';
832 $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_CUSTOMER, $searchCategoryCustomerList,
'minwidth300', $searchCategoryCustomerList ? $searchCategoryCustomerList : 0);
835if (!empty($moreforfilter)) {
836 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
837 print $moreforfilter;
838 $parameters = array();
839 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
840 print $hookmanager->resPrint;
844$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
845$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
846$selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
847$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
849print
'<div class="div-table-responsive">';
850print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'" id="tablelines3">'.
"\n";
854print
'<tr class="liste_titre_filter">';
857 print
'<td class="liste_titre center maxwidthsearch">';
858 $searchpicto = $form->showFilterButtons(
'left');
862if (!empty($arrayfields[
't.ref'][
'checked'])) {
863 print
'<td class="liste_titre">';
864 print
'<input type="text" class="flat" name="search_task_ref" value="'.dol_escape_htmltag($search_task_ref).
'" size="4">';
867if (!empty($arrayfields[
't.fk_task_parent'][
'checked'])) {
868 print
'<td class="liste_titre">';
869 print
'<input type="text" class="flat" name="search_task_ref_parent" value="'.dol_escape_htmltag($search_task_ref_parent).
'" size="4">';
872if (!empty($arrayfields[
't.label'][
'checked'])) {
873 print
'<td class="liste_titre">';
874 print
'<input type="text" class="flat" name="search_task_label" value="'.dol_escape_htmltag($search_task_label).
'" size="8">';
878if (!empty($arrayfields[
't.description'][
'checked'])) {
879 print
'<td class="liste_titre">';
880 print
'<input type="text" class="flat" name="search_task_description" value="'.dol_escape_htmltag($search_task_description).
'" size="8">';
884if (!empty($arrayfields[
't.dateo'][
'checked'])) {
885 print
'<td class="liste_titre center">';
886 print
'<div class="nowrapfordate">';
887 print $form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
889 print
'<div class="nowrapfordate">';
890 print $form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
895if (!empty($arrayfields[
't.datee'][
'checked'])) {
896 print
'<td class="liste_titre center">';
897 print
'<div class="nowrapfordate">';
898 print $form->selectDate($search_datelimit_start ? $search_datelimit_start : -1,
'search_datelimit_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
900 print
'<div class="nowrapfordate">';
901 print $form->selectDate($search_datelimit_end ? $search_datelimit_end : -1,
'search_datelimit_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
907if (!empty($arrayfields[
'p.ref'][
'checked'])) {
908 print
'<td class="liste_titre">';
909 print
'<input type="text" class="flat" name="search_project_ref" value="'.$search_project_ref.
'" size="4">';
912if (!empty($arrayfields[
'p.title'][
'checked'])) {
913 print
'<td class="liste_titre">';
914 print
'<input type="text" class="flat" name="search_project_title" value="'.$search_project_title.
'" size="6">';
917if (!empty($arrayfields[
's.nom'][
'checked'])) {
918 print
'<td class="liste_titre">';
919 print
'<input type="text" class="flat" name="search_societe" value="'.dol_escape_htmltag($search_societe).
'" size="4">';
922if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
923 print
'<td class="liste_titre">';
924 print
'<input type="text" class="flat" name="search_societe_alias" value="'.dol_escape_htmltag($search_societe_alias).
'" size="4">';
927if (!empty($arrayfields[
'p.fk_statut'][
'checked'])) {
928 print
'<td class="liste_titre center">';
929 $arrayofstatus = array();
930 foreach ($projectstatic->labelStatusShort as $key => $val) {
931 $arrayofstatus[$key] = $langs->trans($val);
933 $arrayofstatus[
'99'] = $langs->trans(
"NotClosed").
' ('.$langs->trans(
'Draft').
'+'.$langs->trans(
'Opened').
')';
934 print $form->selectarray(
'search_projectstatus', $arrayofstatus, $search_projectstatus, 1, 0, 0,
'', 0, 0, 0,
'',
'maxwidth100');
937if (!empty($arrayfields[
't.planned_workload'][
'checked'])) {
938 print
'<td class="liste_titre"></td>';
940if (!empty($arrayfields[
't.duration_effective'][
'checked'])) {
941 print
'<td class="liste_titre"></td>';
943if (!empty($arrayfields[
't.progress_calculated'][
'checked'])) {
944 print
'<td class="liste_titre"></td>';
946if (!empty($arrayfields[
't.progress'][
'checked'])) {
947 print
'<td class="liste_titre center">';
948 print
'<input type="text" class="flat" name="search_task_progress" value="'.$search_task_progress.
'" size="4">';
952if (!empty($arrayfields[
't.progress_summary'][
'checked'])) {
953 print
'<td class="liste_titre"></td>';
955if (!empty($arrayfields[
't.fk_statut'][
'checked'])) {
956 print
'<td class="liste_titre center">';
957 $arrayofstatus = array();
958 foreach (
$object->labelStatusShort as $key => $val) {
959 $arrayofstatus[$key] = $langs->trans($val);
961 print $form->selectarray(
'search_task_status', $arrayofstatus, $search_task_status, 1, 0, 0,
'', 0, 0, 0,
'',
'maxwidth100');
965if (!empty($arrayfields[
't.budget_amount'][
'checked'])) {
966 print
'<td class="liste_titre center">';
967 print
'<input type="text" class="flat" name="search_task_budget_amount" value="'.$search_task_budget_amount.
'" size="4">';
971if (!empty($arrayfields[
't.tobill'][
'checked'])) {
972 print
'<td class="liste_titre"></td>';
974if (!empty($arrayfields[
't.billed'][
'checked'])) {
975 print
'<td class="liste_titre"></td>';
978include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
980$parameters = array(
'arrayfields' => $arrayfields);
981$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
982print $hookmanager->resPrint;
983if (!empty($arrayfields[
't.datec'][
'checked'])) {
985 print
'<td class="liste_titre">';
988if (!empty($arrayfields[
't.tms'][
'checked'])) {
990 print
'<td class="liste_titre">';
995 print
'<td class="liste_titre center maxwidthsearch">';
996 $searchpicto = $form->showFilterButtons();
1006 't.planned_workload' => 0,
1007 't.duration_effective' => 0,
1009 't.budget_amount' => 0,
1011 'totalplannedworkload' => 0,
1012 'totaldurationeffective' => 0,
1013 'totaldurationdeclared' => 0,
1014 'totaltobillfield' => 0,
1015 'totalbilledfield' => 0,
1016 'totalbudget_amountfield' => 0,
1017 'totalbudgetamount' => 0,
1021 'totalizable' => [],
1026print
'<tr class="liste_titre">';
1029 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
1032if (!empty($arrayfields[
't.ref'][
'checked'])) {
1033 print_liste_field_titre($arrayfields[
't.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"t.ref",
"", $param,
"", $sortfield, $sortorder);
1036if (!empty($arrayfields[
't.fk_task_parent'][
'checked'])) {
1037 print_liste_field_titre($arrayfields[
't.fk_task_parent'][
'label'], $_SERVER[
"PHP_SELF"],
"t.fk_task_parent",
"", $param,
"", $sortfield, $sortorder);
1040if (!empty($arrayfields[
't.label'][
'checked'])) {
1041 print_liste_field_titre($arrayfields[
't.label'][
'label'], $_SERVER[
"PHP_SELF"],
"t.label",
"", $param,
"", $sortfield, $sortorder);
1044if (!empty($arrayfields[
't.description'][
'checked'])) {
1045 print_liste_field_titre($arrayfields[
't.description'][
'label'], $_SERVER[
"PHP_SELF"],
"t.description",
"", $param,
"", $sortfield, $sortorder);
1048if (!empty($arrayfields[
't.dateo'][
'checked'])) {
1049 print_liste_field_titre($arrayfields[
't.dateo'][
'label'], $_SERVER[
"PHP_SELF"],
"t.dateo",
"", $param,
'', $sortfield, $sortorder,
'center ');
1052if (!empty($arrayfields[
't.datee'][
'checked'])) {
1053 print_liste_field_titre($arrayfields[
't.datee'][
'label'], $_SERVER[
"PHP_SELF"],
"t.datee",
"", $param,
'', $sortfield, $sortorder,
'center ');
1056if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1057 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"p.ref",
"", $param,
"", $sortfield, $sortorder);
1060if (!empty($arrayfields[
'p.title'][
'checked'])) {
1061 print_liste_field_titre($arrayfields[
'p.title'][
'label'], $_SERVER[
"PHP_SELF"],
"p.title",
"", $param,
"", $sortfield, $sortorder);
1064if (!empty($arrayfields[
's.nom'][
'checked'])) {
1065 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"s.nom",
"", $param,
"", $sortfield, $sortorder);
1068if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1069 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
"PHP_SELF"],
"s.name_alias",
"", $param,
"", $sortfield, $sortorder);
1072if (!empty($arrayfields[
'p.fk_statut'][
'checked'])) {
1073 print_liste_field_titre($arrayfields[
'p.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_statut",
"", $param,
'', $sortfield, $sortorder,
'center ');
1076if (!empty($arrayfields[
't.planned_workload'][
'checked'])) {
1077 print_liste_field_titre($arrayfields[
't.planned_workload'][
'label'], $_SERVER[
"PHP_SELF"],
"t.planned_workload",
"", $param,
'', $sortfield, $sortorder,
'center ');
1080if (!empty($arrayfields[
't.duration_effective'][
'checked'])) {
1081 print_liste_field_titre($arrayfields[
't.duration_effective'][
'label'], $_SERVER[
"PHP_SELF"],
"t.duration_effective",
"", $param,
'', $sortfield, $sortorder,
'center ');
1084if (!empty($arrayfields[
't.progress_calculated'][
'checked'])) {
1085 print_liste_field_titre($arrayfields[
't.progress_calculated'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"", $param,
'',
'',
'',
'center ');
1088if (!empty($arrayfields[
't.progress'][
'checked'])) {
1089 print_liste_field_titre($arrayfields[
't.progress'][
'label'], $_SERVER[
"PHP_SELF"],
"t.progress",
"", $param,
'', $sortfield, $sortorder,
'center ');
1092if (!empty($arrayfields[
't.progress_summary'][
'checked'])) {
1093 print_liste_field_titre($arrayfields[
't.progress_summary'][
'label'], $_SERVER[
"PHP_SELF"],
"t.progress",
"", $param,
'', $sortfield, $sortorder,
'center ');
1096if (!empty($arrayfields[
't.fk_statut'][
'checked'])) {
1097 print_liste_field_titre($arrayfields[
't.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"t.fk_statut",
"", $param,
'', $sortfield, $sortorder,
'center ');
1100if (!empty($arrayfields[
't.budget_amount'][
'checked'])) {
1101 print_liste_field_titre($arrayfields[
't.budget_amount'][
'label'], $_SERVER[
"PHP_SELF"],
"t.budget_amount",
"", $param,
'', $sortfield, $sortorder,
'center ');
1104if (!empty($arrayfields[
't.tobill'][
'checked'])) {
1106 print_liste_field_titre($arrayfields[
't.tobill'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"", $param,
'', $sortfield, $sortorder,
'center ');
1109if (!empty($arrayfields[
't.billed'][
'checked'])) {
1110 print_liste_field_titre($arrayfields[
't.billed'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"", $param,
'', $sortfield, $sortorder,
'center ');
1114include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1117 'arrayfields' => $arrayfields,
1119 'sortfield' => $sortfield,
1120 'sortorder' => $sortorder,
1121 'totalarray' => &$totalarray,
1123$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
1124print $hookmanager->resPrint;
1125if (!empty($arrayfields[
't.datec'][
'checked'])) {
1126 print_liste_field_titre($arrayfields[
't.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"t.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1129if (!empty($arrayfields[
't.tms'][
'checked'])) {
1130 print_liste_field_titre($arrayfields[
't.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"t.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1135 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
1140$plannedworkloadoutputformat =
'allhourmin';
1141$timespentoutputformat =
'allhourmin';
1143 $plannedworkloadoutputformat =
getDolGlobalString(
'PROJECT_PLANNED_WORKLOAD_FORMAT');
1155$imaxinloop = ($limit ? min($num, $limit) : $num);
1156while ($i < $imaxinloop) {
1157 $obj = $db->fetch_object($resql);
1166 $object->description = $obj->description;
1167 $object->status = $obj->status;
1168 $object->progress = $obj->progress;
1169 $object->budget_amount = $obj->budget_amount;
1170 $object->date_start = $db->jdate($obj->date_start);
1171 $object->date_end = $db->jdate($obj->date_end);
1172 $object->planned_workload = $obj->planned_workload;
1173 $object->duration_effective = $obj->duration_effective;
1174 $object->fk_task_parent = $obj->fk_task_parent;
1176 $projectstatic->id = $obj->projectid;
1177 $projectstatic->ref = $obj->projectref;
1178 $projectstatic->title = $obj->projecttitle;
1179 $projectstatic->public = $obj->public;
1180 $projectstatic->statut = $obj->projectstatus;
1181 $projectstatic->datee = $db->jdate($obj->projectdatee);
1184 $socstatic->id = $obj->socid;
1185 $socstatic->name = $obj->name;
1186 $socstatic->name_alias = $obj->alias;
1188 if ($mode ==
'kanban') {
1190 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
1191 print
'<div class="box-flex-container kanban">';
1194 if ($massactionbutton || $massaction) {
1196 if (in_array(
$object->id, $arrayofselected)) {
1201 $arraydata = array();
1202 $arraydata[
'projectlink'] = $projectstatic->getNomUrl(1);
1203 $arraydata[
'selected'] = in_array(
$object->id, $arrayofselected);
1205 print
$object->getKanbanView(
'', $arraydata);
1206 if ($i == ($imaxinloop - 1)) {
1211 $userAccess = $projectstatic->restrictedProjectArea($user);
1212 if ($userAccess >= 0) {
1215 print
'<tr data-rowid="'.$object->id.
'" class="oddeven row-with-select">';
1219 print
'<td class="nowrap center">';
1220 if ($massactionbutton || $massaction) {
1222 if (in_array(
$object->id, $arrayofselected)) {
1225 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1233 if (!empty($arrayfields[
't.ref'][
'checked'])) {
1234 print
'<td class="nowraponall">';
1235 print
$object->getNomUrl(1,
'withproject');
1245 if (!empty($arrayfields[
't.fk_task_parent'][
'checked'])) {
1246 print
'<td class="nowraponall">';
1247 if (!empty(
$object->fk_task_parent)) {
1248 $object_parent =
new Task($db);
1249 $result = $object_parent->fetch(
$object->fk_task_parent);
1253 print $object_parent->getNomUrl(1,
'withproject');
1254 if ($object_parent->hasDelay()) {
1265 if (!empty($arrayfields[
't.label'][
'checked'])) {
1266 print
'<td class="tdoverflowmax200" title="'.dol_escape_htmltag(
$object->label).
'">';
1274 if (!empty($arrayfields[
't.description'][
'checked'])) {
1284 if (!empty($arrayfields[
't.dateo'][
'checked'])) {
1285 print
'<td class="center">';
1293 if (!empty($arrayfields[
't.datee'][
'checked'])) {
1294 print
'<td class="center">';
1302 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1303 print
'<td class="nowraponall tdoverflowmax150">';
1304 print $projectstatic->getNomUrl(1,
'task');
1305 if ($projectstatic->hasDelay()) {
1314 if (!empty($arrayfields[
'p.title'][
'checked'])) {
1315 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->projecttitle).
'">';
1323 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1324 print
'<td class="tdoverflowmax125">';
1326 print $socstatic->getNomUrl(1,
'', 0, 0, -1, empty($arrayfields[
's.name_alias'][
'checked']) ? 0 : 1);
1336 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1339 $name_alias = $socstatic->name_alias;
1341 print
'<td class="tdoverflowmax125" title="'.dol_escape_htmltag($name_alias).
'">';
1349 if (!empty($arrayfields[
'p.fk_statut'][
'checked'])) {
1350 print
'<td class="center">';
1351 print $projectstatic->getLibStatut(1);
1359 if (!empty($arrayfields[
't.planned_workload'][
'checked'])) {
1360 print
'<td class="center">';
1363 if ($obj->planned_workload !=
'') {
1376 if (!isset($totalarray[
'val'][
't.planned_workload'])) {
1379 $totalarray[
'val'][
't.planned_workload'] += $obj->planned_workload;
1383 if (!isset($totalarray[
'totalplannedworkload'])) {
1386 $totalarray[
'totalplannedworkload'] += $obj->planned_workload;
1389 if (!empty($arrayfields[
't.duration_effective'][
'checked'])) {
1390 $showlineingray = 0;
1392 print
'<td class="center">';
1393 if ($showlineingray) {
1396 print
'<a href="'.DOL_URL_ROOT.
'/projet/tasks/time.php?id='.
$object->id.($showproject ?
'' :
'&withproject=1').
'">';
1398 if ($obj->duration_effective) {
1403 if ($showlineingray) {
1408 if (empty($arrayfields[
't.progress_calculated'][
'checked'])) {
1409 if ($obj->planned_workload || $obj->duration_effective) {
1410 if ($obj->planned_workload) {
1411 print
' <span class="opacitymedium">('.round(100 * $obj->duration_effective / $obj->planned_workload, 2).
' %)</span>';
1413 print $form->textwithpicto(
'', $langs->trans(
'WorkloadNotDefined'), 1,
'help');
1424 if (!isset($totalarray[
'val'][
't.duration_effective'])) {
1427 $totalarray[
'val'][
't.duration_effective'] += $obj->duration_effective;
1431 if (!isset($totalarray[
'totaldurationeffective'])) {
1434 $totalarray[
'totaldurationeffective'] += $obj->duration_effective;
1437 if (!empty($arrayfields[
't.progress_calculated'][
'checked'])) {
1438 print
'<td class="center">';
1439 if ($obj->planned_workload || $obj->duration_effective) {
1440 if ($obj->planned_workload) {
1441 print round(100 * $obj->duration_effective / $obj->planned_workload, 2).
' %';
1443 print $form->textwithpicto(
'', $langs->trans(
'WorkloadNotDefined'), 1,
'help');
1455 if (!empty($arrayfields[
't.progress'][
'checked'])) {
1456 print
'<td class="center">';
1457 if ($obj->progress !=
'') {
1467 if (!isset($totalarray[
'val'][
't.progress'])) {
1470 $totalarray[
'val'][
't.progress'] += ($obj->planned_workload * $obj->progress / 100);
1474 if (!isset($totalarray[
'totaldurationdeclared'])) {
1477 $totalarray[
'totaldurationdeclared'] += $obj->planned_workload * $obj->progress / 100;
1480 if (!empty($arrayfields[
't.progress_summary'][
'checked'])) {
1481 print
'<td class="center">';
1494 if (!empty($arrayfields[
't.fk_statut'][
'checked'])) {
1495 print
'<td class="center">';
1496 print
$object->getLibStatut(4);
1503 if (!empty($arrayfields[
't.budget_amount'][
'checked'])) {
1504 print
'<td class="center">';
1506 print
'<span class="amount">'.price(
$object->budget_amount, 0, $langs, 1, 0, 0, $conf->currency).
'</span>';
1515 $totalarray[
'val'][
't.budget_amount'] += $obj->budget_amount;
1519 $totalarray[
'totalbudgetamount'] += $obj->budget_amount;
1522 if (!empty($arrayfields[
't.tobill'][
'checked'])) {
1523 print
'<td class="center">';
1524 if ($obj->usage_bill_time) {
1529 print
'<span class="opacitymedium">'.$langs->trans(
"NA").
'</span>';
1543 if (!empty($arrayfields[
't.billed'][
'checked'])) {
1544 print
'<td class="center">';
1545 if ($obj->usage_bill_time) {
1550 print
'<span class="opacitymedium">'.$langs->trans(
"NA").
'</span>';
1564 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
1566 $parameters = array(
'arrayfields' => $arrayfields,
'object' => $object,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
1567 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
1568 print $hookmanager->resPrint;
1570 if (!empty($arrayfields[
't.datec'][
'checked'])) {
1571 print
'<td class="center">';
1572 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
1579 if (!empty($arrayfields[
't.tms'][
'checked'])) {
1580 print
'<td class="center">';
1581 print
dol_print_date($db->jdate($obj->date_modification),
'dayhour',
'tzuser');
1594 print
'<td class="nowrap center">';
1595 if ($massactionbutton || $massaction) {
1597 if (in_array(
$object->id, $arrayofselected)) {
1600 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1616if (!empty($totalarray[
'totalizable']) && is_array($totalarray[
'totalizable'])) {
1617 foreach ($totalarray[
'totalizable'] as $keytotalizable => $valtotalizable) {
1618 $totalarray[
'pos'][$valtotalizable[
'pos']] = $keytotalizable;
1619 $totalarray[
'val'][$keytotalizable] = $valtotalizable[
'total'];
1625if (isset($totalarray[
'totaldurationeffectivefield']) || isset($totalarray[
'totalplannedworkloadfield']) || isset($totalarray[
'totalprogress_calculatedfield'])
1626 || isset($totalarray[
'totaltobill']) || isset($totalarray[
'totalbilled']) || isset($totalarray[
'totalbudget'])) {
1627 print
'<tr class="liste_total">';
1629 while ($i < $totalarray[
'nbfield']) {
1632 if ((is_null($limit) || $num < $limit) && empty($offset)) {
1633 print
'<td>'.$langs->trans(
"Total").
'</td>';
1636 if (is_object($form)) {
1637 print $form->textwithpicto($langs->trans(
"Total"), $langs->transnoentitiesnoconv(
"Totalforthispage"));
1639 print $langs->trans(
"Totalforthispage");
1649 } elseif (isset($totalarray[
'totalplannedworkloadfield']) && $totalarray[
'totalplannedworkloadfield'] == $i) {
1650 print
'<td class="center">'.convertSecondToTime($totalarray[
'totalplannedworkload'], $plannedworkloadoutputformat).
'</td>';
1651 } elseif (isset($totalarray[
'totaldurationeffectivefield']) && $totalarray[
'totaldurationeffectivefield'] == $i) {
1652 print
'<td class="center">'.convertSecondToTime($totalarray[
'totaldurationeffective'], $timespentoutputformat).
'</td>';
1653 } elseif (isset($totalarray[
'totalprogress_calculatedfield']) && $totalarray[
'totalprogress_calculatedfield'] == $i) {
1654 print
'<td class="center">'.($totalarray[
'totalplannedworkload'] > 0 ? round(100 * $totalarray[
'totaldurationeffective'] / $totalarray[
'totalplannedworkload'], 2).
' %' :
'').
'</td>';
1655 } elseif (isset($totalarray[
'totalprogress_declaredfield']) && $totalarray[
'totalprogress_declaredfield'] == $i) {
1656 print
'<td class="center">'.($totalarray[
'totalplannedworkload'] > 0 ? round(100 * $totalarray[
'totaldurationdeclared'] / $totalarray[
'totalplannedworkload'], 2).
' %' :
'').
'</td>';
1657 } elseif (isset($totalarray[
'totaltobillfield']) && $totalarray[
'totaltobillfield'] == $i) {
1658 print
'<td class="center">'.convertSecondToTime($totalarray[
'totaltobill'], $plannedworkloadoutputformat).
'</td>';
1659 } elseif (isset($totalarray[
'totalbilledfield']) && $totalarray[
'totalbilledfield'] == $i) {
1660 print
'<td class="center">'.convertSecondToTime($totalarray[
'totalbilled'], $plannedworkloadoutputformat).
'</td>';
1661 } elseif (isset($totalarray[
'totalbudget_amountfield']) && $totalarray[
'totalbudget_amountfield'] == $i) {
1662 print
'<td class="center">'.price((
float) $totalarray[
'totalbudgetamount'], 0, $langs, 1, 0, 0, $conf->currency).
'</td>';
1663 } elseif (!empty($totalarray[
'pos'][$i])) {
1664 print
'<td class="right">';
1666 if (isset($totalarray[
'type']) && $totalarray[
'type'][$i] ==
'duration') {
1667 print(!empty($totalarray[
'val'][$totalarray[
'pos'][$i]]) ?
convertSecondToTime($totalarray[
'val'][$totalarray[
'pos'][$i]],
'allhourmin') : 0);
1669 print
price(!empty($totalarray[
'val'][$totalarray[
'pos'][$i]]) ? $totalarray[
'val'][$totalarray[
'pos'][$i]] : 0);
1680 print
'<tr><td colspan="'.$savnbfield.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
1685$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
1686$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
1687print $hookmanager->resPrint;
1689print
'</table>'.
"\n";
1692print
'</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.
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
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.
dolGetButtonTitleSeparator($moreClass="")
Add space between dolGetButtonTitle.
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.