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');
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_societe =
GETPOST(
'search_societe');
74$search_societe_alias =
GETPOST(
'search_societe_alias');
75$search_opp_status =
GETPOST(
"search_opp_status",
'alpha');
76$searchCategoryCustomerOperator = 0;
77if (GETPOSTISSET(
'formfilteraction')) {
78 $searchCategoryCustomerOperator =
GETPOSTINT(
'search_category_customer_operator');
82$searchCategoryCustomerList =
GETPOST(
'search_category_customer_list',
'array');
84if (!isset($search_projectstatus) || $search_projectstatus ===
'') {
85 if ($search_all !=
'') {
86 $search_projectstatus = -1;
88 $search_projectstatus = 1;
92$mine =
GETPOST(
'mode',
'alpha') ==
'mine' ? 1 : 0;
94 $search_task_user = $user->id;
99$search_date_startday =
GETPOSTINT(
'search_date_startday');
100$search_date_startmonth =
GETPOSTINT(
'search_date_startmonth');
101$search_date_startyear =
GETPOSTINT(
'search_date_startyear');
102$search_date_endday =
GETPOSTINT(
'search_date_endday');
103$search_date_endmonth =
GETPOSTINT(
'search_date_endmonth');
104$search_date_endyear =
GETPOSTINT(
'search_date_endyear');
105$search_date_start =
dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear);
106$search_date_end =
dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
107$search_datelimit_startday =
GETPOSTINT(
'search_datelimit_startday');
108$search_datelimit_startmonth =
GETPOSTINT(
'search_datelimit_startmonth');
109$search_datelimit_startyear =
GETPOSTINT(
'search_datelimit_startyear');
110$search_datelimit_endday =
GETPOSTINT(
'search_datelimit_endday');
111$search_datelimit_endmonth =
GETPOSTINT(
'search_datelimit_endmonth');
112$search_datelimit_endyear =
GETPOSTINT(
'search_datelimit_endyear');
113$search_datelimit_start =
dol_mktime(0, 0, 0, $search_datelimit_startmonth, $search_datelimit_startday, $search_datelimit_startyear);
114$search_datelimit_end =
dol_mktime(23, 59, 59, $search_datelimit_endmonth, $search_datelimit_endday, $search_datelimit_endyear);
117$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'tasklist';
121$hookmanager->initHooks(array(
'tasklist'));
125$extrafields->fetch_name_optionals_label(
$object->table_element);
126$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
131if (!$user->hasRight(
'projet',
'lire')) {
135$diroutputmassaction =
$conf->project->dir_output.
'/tasks/temp/massgeneration/'.$user->id;
138$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
139$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
141if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
145$offset = $limit * $page;
146$pageprev = $page - 1;
147$pagenext = $page + 1;
149 $sortfield =
'p.ref';
156$fieldstosearchall = array(
158 't.label' =>
"Label",
159 't.description' =>
"Description",
160 't.note_public' =>
"NotePublic",
162if (empty($user->socid)) {
163 $fieldstosearchall[
't.note_private'] =
"NotePrivate";
167 't.ref' => array(
'label' =>
"RefTask",
'checked' => 1,
'position' => 50),
168 't.fk_task_parent' => array(
'label' =>
"RefTaskParent",
'checked' => 0,
'position' => 70),
169 't.label' => array(
'label' =>
"LabelTask",
'checked' => 1,
'position' => 75),
170 't.description' => array(
'label' =>
"Description",
'checked' => 0,
'position' => 80),
171 't.dateo' => array(
'label' =>
"DateStart",
'checked' => 1,
'position' => 100),
172 't.datee' => array(
'label' =>
"Deadline",
'checked' => 1,
'position' => 101),
173 'p.ref' => array(
'label' =>
"ProjectRef",
'checked' => 1,
'position' => 151),
174 'p.title' => array(
'label' =>
"ProjectLabel",
'checked' => 0,
'position' => 152),
175 's.nom' => array(
'label' =>
"ThirdParty",
'checked' => -1,
'csslist' =>
'tdoverflowmax125',
'position' => 200),
176 's.name_alias' => array(
'label' =>
"AliasNameShort",
'checked' => 0,
'csslist' =>
'tdoverflowmax125',
'position' => 201),
177 'p.fk_statut' => array(
'label' =>
"ProjectStatus",
'checked' => 1,
'position' => 205),
178 't.planned_workload' => array(
'label' =>
"PlannedWorkload",
'checked' => 1,
'position' => 302),
179 't.duration_effective' => array(
'label' =>
"TimeSpent",
'checked' => 1,
'position' => 303),
180 't.progress_calculated' => array(
'label' =>
"ProgressCalculated",
'checked' => -1,
'position' => 304),
181 't.progress' => array(
'label' =>
"ProgressDeclared",
'checked' => 1,
'position' => 305),
182 't.progress_summary' => array(
'label' =>
"TaskProgressSummary",
'checked' => 1,
'position' => 306),
183 't.budget_amount' => array(
'label' =>
"Budget",
'checked' => 0,
'position' => 307),
184 't.tobill' => array(
'label' =>
"TimeToBill",
'checked' => 0,
'position' => 310),
185 't.billed' => array(
'label' =>
"TimeBilled",
'checked' => 0,
'position' => 311),
186 't.datec' => array(
'label' =>
"DateCreation",
'checked' => 0,
'position' => 500),
187 't.tms' => array(
'label' =>
"DateModificationShort",
'checked' => 0,
'position' => 501),
191include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
195'@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields';
197$permissiontoread = $user->hasRight(
'projet',
'lire');
198$permissiontocreate = $user->hasRight(
'projet',
'creer');
199$permissiontodelete = $user->hasRight(
'projet',
'supprimer');
201if (!$permissiontoread) {
210if (
GETPOST(
'cancel',
'alpha')) {
214if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
218$parameters = array(
'socid' => $socid);
219$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
224if (empty($reshook)) {
226 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
229 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
232 $search_projectstatus = -1;
233 $search_project_ref =
"";
234 $search_societe =
"";
235 $search_societe_alias =
"";
236 $search_project_title =
"";
237 $search_task_ref =
"";
238 $search_task_label =
"";
239 $search_task_description =
"";
240 $search_task_ref_parent =
"";
241 $search_task_progress =
"";
242 $search_task_budget_amount =
"";
243 $search_task_user = -1;
244 $search_project_user = -1;
245 $search_date_startday =
'';
246 $search_date_startmonth =
'';
247 $search_date_startyear =
'';
248 $search_date_endday =
'';
249 $search_date_endmonth =
'';
250 $search_date_endyear =
'';
251 $search_date_start =
'';
252 $search_date_end =
'';
253 $search_datelimit_startday =
'';
254 $search_datelimit_startmonth =
'';
255 $search_datelimit_startyear =
'';
256 $search_datelimit_endday =
'';
257 $search_datelimit_endmonth =
'';
258 $search_datelimit_endyear =
'';
259 $search_datelimit_start =
'';
260 $search_datelimit_end =
'';
262 $searchCategoryCustomerList = array();
263 $search_array_options = array();
267 $objectclass =
'Task';
268 $objectlabel =
'Tasks';
269 $uploaddir =
$conf->project->dir_output.
'/tasks';
270 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
273if (empty($search_projectstatus) && $search_projectstatus ==
'') {
274 $search_projectstatus = 1;
281$form =
new Form($db);
284$projectstatic =
new Project($db);
285$puser =
new User($db);
286$tuser =
new User($db);
290$title = $langs->trans(
"Activities");
291$help_url =
"EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos";
295if ($search_project_user > 0) {
296 $puser->fetch($search_project_user);
298if ($search_task_user > 0) {
299 $tuser->fetch($search_task_user);
303$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
304$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
308 $projectstatic->fetch(
$id);
309 $projectstatic->fetch_thirdparty();
313if (!$user->hasRight(
'projet',
'all',
'lire')) {
314 $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1, $socid);
319$listofprojectcontacttype = array();
320$sql =
"SELECT ctc.rowid, ctc.code FROM ".MAIN_DB_PREFIX.
"c_type_contact as ctc";
321$sql .=
" WHERE ctc.element = '".$db->escape($projectstatic->element).
"'";
322$sql .=
" AND ctc.source = 'internal'";
323$resql = $db->query($sql);
325 while ($obj = $db->fetch_object($resql)) {
326 $listofprojectcontacttype[$obj->rowid] = $obj->code;
331if (count($listofprojectcontacttype) == 0) {
332 $listofprojectcontacttype[0] =
'0';
335$listoftaskcontacttype = array();
336$sql =
"SELECT ctc.rowid, ctc.code FROM ".MAIN_DB_PREFIX.
"c_type_contact as ctc";
337$sql .=
" WHERE ctc.element = '".$db->escape(
$object->element).
"'";
338$sql .=
" AND ctc.source = 'internal'";
339$resql = $db->query($sql);
341 while ($obj = $db->fetch_object($resql)) {
342 $listoftaskcontacttype[$obj->rowid] = $obj->code;
347if (count($listoftaskcontacttype) == 0) {
348 $listoftaskcontacttype[0] =
'0';
353$distinct =
'DISTINCT';
354$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,";
355$sql .=
" s.nom as name, s.name_alias as alias, s.rowid as socid,";
356$sql .=
" t.datec as date_creation, t.dateo as date_start, t.datee as date_end, t.tms as date_modification,";
357$sql .=
" t.rowid as id, t.ref, t.label, t.planned_workload, t.duration_effective, t.progress, t.fk_statut as status,";
358$sql .=
" t.description, t.fk_task_parent, t.budget_amount";
360if (!empty($arrayfields[
't.tobill'][
'checked']) || !empty($arrayfields[
't.billed'][
'checked'])) {
361 $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";
364if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
365 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
366 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
370$parameters = array();
371$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
372$sql .= $hookmanager->resPrint;
373$sql = preg_replace(
'/,\s*$/',
'', $sql);
377$sql .=
" FROM ".MAIN_DB_PREFIX.
"projet as p";
378$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s on p.fk_soc = s.rowid";
379$sql .=
", ".MAIN_DB_PREFIX.
"projet_task as t";
380if (!empty($arrayfields[
't.tobill'][
'checked']) || !empty($arrayfields[
't.billed'][
'checked'])) {
381 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"element_time as tt ON (tt.fk_element = t.rowid AND tt.elementtype = 'task')";
383if (isset($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
384 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (t.rowid = ef.fk_object)";
386if ($search_project_user > 0) {
387 $sql .=
", ".MAIN_DB_PREFIX.
"element_contact as ecp";
389if ($search_task_user > 0) {
390 $sql .=
", ".MAIN_DB_PREFIX.
"element_contact as ect";
392$sql .=
" WHERE t.fk_projet = p.rowid";
393$sql .=
" AND p.entity IN (".getEntity(
'project').
')';
394if (!$user->hasRight(
'projet',
'all',
'lire')) {
395 $sql .=
" AND p.rowid IN (".$db->sanitize($projectsListId ? $projectsListId :
'0').
")";
397if (is_object($projectstatic) && $projectstatic->id > 0) {
398 $sql .=
" AND p.rowid = ".((int) $projectstatic->id);
402 $sql .=
" AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".((int) $socid).
")";
404if ($search_project_ref) {
407if ($search_project_title) {
410if ($search_task_ref) {
413if ($search_task_label) {
416if ($search_task_description) {
417 $sql .=
natural_search(
't.description', $search_task_description);
419if ($search_task_ref_parent) {
420 $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).
')';
422if ($search_task_progress) {
425if ($search_task_budget_amount) {
426 $sql .=
natural_search(
't.budget_amount', $search_task_budget_amount, 1);
428if (empty($arrayfields[
's.name_alias'][
'checked']) && $search_societe) {
429 $sql .=
natural_search(array(
"s.nom",
"s.name_alias"), $search_societe);
431 if ($search_societe) {
434 if ($search_societe_alias) {
438if ($search_date_start) {
439 $sql .=
" AND t.dateo >= '".$db->idate($search_date_start).
"'";
441if ($search_date_end) {
442 $sql .=
" AND t.dateo <= '".$db->idate($search_date_end).
"'";
444if ($search_datelimit_start) {
445 $sql .=
" AND t.datee >= '".$db->idate($search_datelimit_start).
"'";
447if ($search_datelimit_end) {
448 $sql .=
" AND t.datee <= '".$db->idate($search_datelimit_end).
"'";
451 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
453if ($search_projectstatus >= 0) {
454 if ($search_projectstatus == 99) {
455 $sql .=
" AND p.fk_statut <> 2";
457 $sql .=
" AND p.fk_statut = ".((int) $search_projectstatus);
460if ($search_project_user > 0) {
461 $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);
463if ($search_task_user > 0) {
464 $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);
467$searchCategoryProjectList = array($search_categ);
468$searchCategoryProjectOperator = 0;
469if (!empty($searchCategoryProjectList)) {
470 $searchCategoryProjectSqlList = array();
471 $listofcategoryid =
'';
472 foreach ($searchCategoryProjectList as $searchCategoryProject) {
473 if (intval($searchCategoryProject) == -2) {
474 $searchCategoryProjectSqlList[] =
"NOT EXISTS (SELECT ck.fk_project FROM ".MAIN_DB_PREFIX.
"categorie_project as ck WHERE p.rowid = ck.fk_project)";
475 } elseif (intval($searchCategoryProject) > 0) {
476 if ($searchCategoryProjectOperator == 0) {
477 $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).
")";
479 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryProject);
483 if ($listofcategoryid) {
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 IN (".$db->sanitize($listofcategoryid).
"))";
486 if ($searchCategoryProjectOperator == 1) {
487 if (!empty($searchCategoryProjectSqlList)) {
488 $sql .=
" AND (".implode(
' OR ', $searchCategoryProjectSqlList).
")";
491 if (!empty($searchCategoryProjectSqlList)) {
492 $sql .=
" AND (".implode(
' AND ', $searchCategoryProjectSqlList).
")";
496$searchCategoryCustomerSqlList = array();
497if ($searchCategoryCustomerOperator == 1) {
498 $existsCategoryCustomerList = array();
499 foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
500 if (intval($searchCategoryCustomer) == -2) {
501 $sqlCategoryCustomerNotExists =
" NOT EXISTS (";
502 $sqlCategoryCustomerNotExists .=
" SELECT cat_cus.fk_soc";
503 $sqlCategoryCustomerNotExists .=
" FROM ".$db->prefix().
"categorie_societe AS cat_cus";
504 $sqlCategoryCustomerNotExists .=
" WHERE cat_cus.fk_soc = p.fk_soc";
505 $sqlCategoryCustomerNotExists .=
" )";
506 $searchCategoryCustomerSqlList[] = $sqlCategoryCustomerNotExists;
507 } elseif (intval($searchCategoryCustomer) > 0) {
508 $existsCategoryCustomerList[] = $db->escape($searchCategoryCustomer);
511 if (!empty($existsCategoryCustomerList)) {
512 $sqlCategoryCustomerExists =
" EXISTS (";
513 $sqlCategoryCustomerExists .=
" SELECT cat_cus.fk_soc";
514 $sqlCategoryCustomerExists .=
" FROM ".$db->prefix().
"categorie_societe AS cat_cus";
515 $sqlCategoryCustomerExists .=
" WHERE cat_cus.fk_soc = p.fk_soc";
516 $sqlCategoryCustomerExists .=
" AND cat_cus.fk_categorie IN (".$db->sanitize(implode(
',', $existsCategoryCustomerList)).
")";
517 $sqlCategoryCustomerExists .=
" )";
518 $searchCategoryCustomerSqlList[] = $sqlCategoryCustomerExists;
520 if (!empty($searchCategoryCustomerSqlList)) {
521 $sql .=
" AND (".implode(
' OR ', $searchCategoryCustomerSqlList).
")";
524 foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
525 if (intval($searchCategoryCustomer) == -2) {
526 $sqlCategoryCustomerNotExists =
" NOT EXISTS (";
527 $sqlCategoryCustomerNotExists .=
" SELECT cat_cus.fk_soc";
528 $sqlCategoryCustomerNotExists .=
" FROM ".$db->prefix().
"categorie_societe AS cat_cus";
529 $sqlCategoryCustomerNotExists .=
" WHERE cat_cus.fk_soc = p.fk_soc";
530 $sqlCategoryCustomerNotExists .=
" )";
531 $searchCategoryCustomerSqlList[] = $sqlCategoryCustomerNotExists;
532 } elseif (intval($searchCategoryCustomer) > 0) {
533 $searchCategoryCustomerSqlList[] =
"p.fk_soc IN (SELECT fk_soc FROM ".$db->prefix().
"categorie_societe WHERE fk_categorie = ".((int) $searchCategoryCustomer).
")";
536 if (!empty($searchCategoryCustomerSqlList)) {
537 $sql .=
" AND (".implode(
' AND ', $searchCategoryCustomerSqlList).
")";
541include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
543$parameters = array();
544$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
545$sql .= $hookmanager->resPrint;
546if (!empty($arrayfields[
't.tobill'][
'checked']) || !empty($arrayfields[
't.billed'][
'checked'])) {
547 $sql .=
" GROUP BY p.rowid, p.ref, p.title, p.fk_statut, p.datee, p.fk_opp_status, p.public, p.fk_user_creat,";
548 $sql .=
" s.nom, s.rowid,";
549 $sql .=
" t.datec, t.dateo, t.datee, t.tms,";
550 $sql .=
" t.rowid, t.ref, t.label, t.planned_workload, t.duration_effective, t.progress,t.budget_amount, t.fk_statut";
552 if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
553 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
554 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key :
'');
560$nbtotalofrecords =
'';
563 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
564 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
565 $resql = $db->query($sqlforcount);
567 $objforcount = $db->fetch_object($resql);
568 $nbtotalofrecords = $objforcount->nbtotalofrecords;
573 if (($page * $limit) > $nbtotalofrecords) {
581$sql .= $db->order($sortfield, $sortorder);
583 $sql .= $db->plimit($limit + 1, $offset);
586$resql = $db->query($sql);
592$num = $db->num_rows($resql);
596if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all) {
597 $obj = $db->fetch_object($resql);
599 header(
"Location: ".DOL_URL_ROOT.
'/projet/tasks/task.php?id='.
$id.
'&withproject=1');
607llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'bodyforlist mod-project project-tasks page-list');
609$arrayofselected = is_array($toselect) ? $toselect : array();
613 $param .=
'&mode='.urlencode($mode);
615if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
616 $param .=
'&contextpage='.urlencode($contextpage);
618if ($limit > 0 && $limit !=
$conf->liste_limit) {
619 $param .=
'&limit='.((int) $limit);
621if ($search_date_startday) {
622 $param .=
'&search_date_startday='.urlencode((
string) ($search_date_startday));
624if ($search_date_startmonth) {
625 $param .=
'&search_date_startmonth='.urlencode((
string) ($search_date_startmonth));
627if ($search_date_startyear) {
628 $param .=
'&search_date_startyear='.urlencode((
string) ($search_date_startyear));
630if ($search_date_endday) {
631 $param .=
'&search_date_endday='.urlencode((
string) ($search_date_endday));
633if ($search_date_endmonth) {
634 $param .=
'&search_date_endmonth='.urlencode((
string) ($search_date_endmonth));
636if ($search_date_endyear) {
637 $param .=
'&search_date_endyear='.urlencode((
string) ($search_date_endyear));
639if ($search_datelimit_startday) {
640 $param .=
'&search_datelimit_startday='.urlencode((
string) ($search_datelimit_startday));
642if ($search_datelimit_startmonth) {
643 $param .=
'&search_datelimit_startmonth='.urlencode((
string) ($search_datelimit_startmonth));
645if ($search_datelimit_startyear) {
646 $param .=
'&search_datelimit_startyear='.urlencode((
string) ($search_datelimit_startyear));
648if ($search_datelimit_endday) {
649 $param .=
'&search_datelimit_endday='.urlencode((
string) ($search_datelimit_endday));
651if ($search_datelimit_endmonth) {
652 $param .=
'&search_datelimit_endmonth='.urlencode((
string) ($search_datelimit_endmonth));
654if ($search_datelimit_endyear) {
655 $param .=
'&search_datelimit_endyear='.urlencode((
string) ($search_datelimit_endyear));
657if ($search_task_budget_amount) {
658 $param .=
'&search_task_budget_amount='.urlencode($search_task_budget_amount);
661 $param .=
'&socid='.urlencode($socid);
663if ($search_all !=
'') {
664 $param .=
'&search_all='.urlencode($search_all);
666if ($search_project_ref !=
'') {
667 $param .=
'&search_project_ref='.urlencode($search_project_ref);
669if ($search_project_title !=
'') {
670 $param .=
'&search_project_title='.urlencode($search_project_title);
672if ($search_task_ref !=
'') {
673 $param .=
'&search_task_ref='.urlencode($search_task_ref);
675if ($search_task_label !=
'') {
676 $param .=
'&search_task_label='.urlencode($search_task_label);
678if ($search_task_description !=
'') {
679 $param .=
'&search_task_description='.urlencode($search_task_description);
681if ($search_task_ref_parent !=
'') {
682 $param .=
'&search_task_ref_parent='.urlencode($search_task_ref_parent);
684if ($search_task_progress !=
'') {
685 $param .=
'&search_task_progress='.urlencode($search_task_progress);
687if ($search_societe !=
'') {
688 $param .=
'&search_societe='.urlencode($search_societe);
690if ($search_societe !=
'') {
691 $param .=
'&search_societe_alias='.urlencode($search_societe_alias);
693if ($search_projectstatus !=
'') {
694 $param .=
'&search_projectstatus='.urlencode($search_projectstatus);
696if ((is_numeric($search_opp_status) && $search_opp_status >= 0) || in_array($search_opp_status, array(
'all',
'none'))) {
697 $param .=
'&search_opp_status='.urlencode($search_opp_status);
699if ($search_project_user !=
'') {
700 $param .=
'&search_project_user='.urlencode((
string) ($search_project_user));
702if ($search_task_user > 0) {
703 $param .=
'&search_task_user='.urlencode($search_task_user);
705if ($optioncss !=
'') {
706 $param .=
'&optioncss='.urlencode($optioncss);
708foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
709 $param .=
"&search_category_customer_list[]=".urlencode($searchCategoryCustomer);
712include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
714$parameters = array(
'param' => &$param);
715$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
716$param .= $hookmanager->resPrint;
719$arrayofmassactions = array(
724if (!empty($permissiontodelete)) {
725 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
727if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'presend',
'predelete'))) {
728 $arrayofmassactions = array();
730$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
732print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
733if ($optioncss !=
'') {
734 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
736print
'<input type="hidden" name="token" value="'.newToken().
'">';
737print
'<input type="hidden" name="action" value="list">';
738print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
739print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
740print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
741print
'<input type="hidden" name="page" value="'.$page.
'">';
743 print
'<input type="hidden" name="type" value="'.$type.
'">';
745print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
746print
'<input type="hidden" name="page_y" value="">';
747print
'<input type="hidden" name="mode" value="'.$mode.
'">';
752$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'));
753$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'));
755$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);
760if ($search_task_user == $user->id) {
761 $texthelp .= $langs->trans(
"MyTasksDesc");
763 if ($user->hasRight(
'projet',
'all',
'lire') && !$socid) {
764 $texthelp .= $langs->trans(
"TasksOnProjectsDesc");
766 $texthelp .= $langs->trans(
"TasksOnProjectsPublicDesc");
770print_barre_liste($form->textwithpicto($title, $texthelp), $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'projecttask', 0, $newcardbutton,
'', $limit, 0, 0, 1);
772$topicmail =
"Information";
774$objecttmp =
new Task($db);
775$trackid =
'tas'.$object->id;
776include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
780 foreach ($fieldstosearchall as $key => $val) {
781 $fieldstosearchall[$key] = $langs->trans($val);
782 $setupstring .= $key.
"=".$val.
";";
784 print
'<!-- Search done like if TASK_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
785 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>'.
"\n";
791if (isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
792 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
793 $moreforfilter .=
'<div class="divsearchfield">';
794 $tmptitle = $langs->trans(
'ProjectCategories');
795 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"').$formother->select_categories(
'project', $search_categ,
'search_categ', 1, $tmptitle,
'maxwidth300');
796 $moreforfilter .=
'</div>';
800$moreforfilter .=
'<div class="divsearchfield">';
801$tmptitle = $langs->trans(
'ProjectsWithThisUserAsContact');
803if (!$user->hasRight(
'user',
'user',
'lire')) {
804 $includeonly = array($user->id);
806$moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$form->select_dolusers($search_project_user ? $search_project_user :
'',
'search_project_user', $tmptitle,
'', 0, $includeonly,
'', 0, 0, 0,
'', 0,
'',
'maxwidth250');
807$moreforfilter .=
'</div>';
810$moreforfilter .=
'<div class="divsearchfield">';
811$tmptitle = $langs->trans(
'TasksWithThisUserAsContact');
813if (!$user->hasRight(
'user',
'user',
'lire')) {
814 $includeonly = array($user->id);
816$moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$form->select_dolusers($search_task_user,
'search_task_user', $tmptitle,
'', 0, $includeonly,
'', 0, 0, 0,
'', 0,
'',
'maxwidth250');
817$moreforfilter .=
'</div>';
820if (
getDolGlobalString(
'MAIN_SEARCH_CATEGORY_CUSTOMER_ON_TASK_LIST') && isModEnabled(
"category") && $user->hasRight(
'categorie',
'lire')) {
822 $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,
getDolGlobalString(
'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">';
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).
'" size="4">';
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).
'" size="4">';
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).
'" size="8">';
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).
'" size="8">';
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>';
957if (!empty($arrayfields[
't.budget_amount'][
'checked'])) {
958 print
'<td class="liste_titre center">';
959 print
'<input type="text" class="flat" name="search_task_budget_amount" value="'.$search_task_budget_amount.
'" size="4">';
963if (!empty($arrayfields[
't.tobill'][
'checked'])) {
964 print
'<td class="liste_titre"></td>';
966if (!empty($arrayfields[
't.billed'][
'checked'])) {
967 print
'<td class="liste_titre"></td>';
970include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
972$parameters = array(
'arrayfields' => $arrayfields);
973$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
974print $hookmanager->resPrint;
975if (!empty($arrayfields[
't.datec'][
'checked'])) {
977 print
'<td class="liste_titre">';
980if (!empty($arrayfields[
't.tms'][
'checked'])) {
982 print
'<td class="liste_titre">';
987 print
'<td class="liste_titre center maxwidthsearch">';
988 $searchpicto = $form->showFilterButtons();
998 't.planned_workload' => 0,
999 't.duration_effective' => 0,
1001 't.budget_amount' => 0,
1003 'totalplannedworkload' => 0,
1004 'totaldurationeffective' => 0,
1005 'totaldurationdeclared' => 0,
1006 'totaltobillfield' => 0,
1007 'totalbilledfield' => 0,
1008 'totalbudget_amountfield' => 0,
1009 'totalbudgetamount' => 0,
1013 'totalizable' => [],
1018print
'<tr class="liste_titre">';
1021 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
1022 $totalarray[
'nbfield']++;
1024if (!empty($arrayfields[
't.ref'][
'checked'])) {
1025 print_liste_field_titre($arrayfields[
't.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"t.ref",
"", $param,
"", $sortfield, $sortorder);
1026 $totalarray[
'nbfield']++;
1028if (!empty($arrayfields[
't.fk_task_parent'][
'checked'])) {
1029 print_liste_field_titre($arrayfields[
't.fk_task_parent'][
'label'], $_SERVER[
"PHP_SELF"],
"t.fk_task_parent",
"", $param,
"", $sortfield, $sortorder);
1030 $totalarray[
'nbfield']++;
1032if (!empty($arrayfields[
't.label'][
'checked'])) {
1033 print_liste_field_titre($arrayfields[
't.label'][
'label'], $_SERVER[
"PHP_SELF"],
"t.label",
"", $param,
"", $sortfield, $sortorder);
1034 $totalarray[
'nbfield']++;
1036if (!empty($arrayfields[
't.description'][
'checked'])) {
1037 print_liste_field_titre($arrayfields[
't.description'][
'label'], $_SERVER[
"PHP_SELF"],
"t.description",
"", $param,
"", $sortfield, $sortorder);
1038 $totalarray[
'nbfield']++;
1040if (!empty($arrayfields[
't.dateo'][
'checked'])) {
1041 print_liste_field_titre($arrayfields[
't.dateo'][
'label'], $_SERVER[
"PHP_SELF"],
"t.dateo",
"", $param,
'', $sortfield, $sortorder,
'center ');
1042 $totalarray[
'nbfield']++;
1044if (!empty($arrayfields[
't.datee'][
'checked'])) {
1045 print_liste_field_titre($arrayfields[
't.datee'][
'label'], $_SERVER[
"PHP_SELF"],
"t.datee",
"", $param,
'', $sortfield, $sortorder,
'center ');
1046 $totalarray[
'nbfield']++;
1048if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1049 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"p.ref",
"", $param,
"", $sortfield, $sortorder);
1050 $totalarray[
'nbfield']++;
1052if (!empty($arrayfields[
'p.title'][
'checked'])) {
1053 print_liste_field_titre($arrayfields[
'p.title'][
'label'], $_SERVER[
"PHP_SELF"],
"p.title",
"", $param,
"", $sortfield, $sortorder);
1054 $totalarray[
'nbfield']++;
1056if (!empty($arrayfields[
's.nom'][
'checked'])) {
1057 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"s.nom",
"", $param,
"", $sortfield, $sortorder);
1058 $totalarray[
'nbfield']++;
1060if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1061 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
"PHP_SELF"],
"s.name_alias",
"", $param,
"", $sortfield, $sortorder);
1062 $totalarray[
'nbfield']++;
1064if (!empty($arrayfields[
'p.fk_statut'][
'checked'])) {
1065 print_liste_field_titre($arrayfields[
'p.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_statut",
"", $param,
'', $sortfield, $sortorder,
'center ');
1066 $totalarray[
'nbfield']++;
1068if (!empty($arrayfields[
't.planned_workload'][
'checked'])) {
1069 print_liste_field_titre($arrayfields[
't.planned_workload'][
'label'], $_SERVER[
"PHP_SELF"],
"t.planned_workload",
"", $param,
'', $sortfield, $sortorder,
'center ');
1070 $totalarray[
'nbfield']++;
1072if (!empty($arrayfields[
't.duration_effective'][
'checked'])) {
1073 print_liste_field_titre($arrayfields[
't.duration_effective'][
'label'], $_SERVER[
"PHP_SELF"],
"t.duration_effective",
"", $param,
'', $sortfield, $sortorder,
'center ');
1074 $totalarray[
'nbfield']++;
1076if (!empty($arrayfields[
't.progress_calculated'][
'checked'])) {
1077 print_liste_field_titre($arrayfields[
't.progress_calculated'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"", $param,
'',
'',
'',
'center ');
1078 $totalarray[
'nbfield']++;
1080if (!empty($arrayfields[
't.progress'][
'checked'])) {
1081 print_liste_field_titre($arrayfields[
't.progress'][
'label'], $_SERVER[
"PHP_SELF"],
"t.progress",
"", $param,
'', $sortfield, $sortorder,
'center ');
1082 $totalarray[
'nbfield']++;
1084if (!empty($arrayfields[
't.progress_summary'][
'checked'])) {
1085 print_liste_field_titre($arrayfields[
't.progress_summary'][
'label'], $_SERVER[
"PHP_SELF"],
"t.progress",
"", $param,
'', $sortfield, $sortorder,
'center ');
1086 $totalarray[
'nbfield']++;
1088if (!empty($arrayfields[
't.budget_amount'][
'checked'])) {
1089 print_liste_field_titre($arrayfields[
't.budget_amount'][
'label'], $_SERVER[
"PHP_SELF"],
"t.budget_amount",
"", $param,
'', $sortfield, $sortorder,
'center ');
1090 $totalarray[
'nbfield']++;
1092if (!empty($arrayfields[
't.tobill'][
'checked'])) {
1094 print_liste_field_titre($arrayfields[
't.tobill'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"", $param,
'', $sortfield, $sortorder,
'center ');
1095 $totalarray[
'nbfield']++;
1097if (!empty($arrayfields[
't.billed'][
'checked'])) {
1098 print_liste_field_titre($arrayfields[
't.billed'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"", $param,
'', $sortfield, $sortorder,
'center ');
1099 $totalarray[
'nbfield']++;
1102include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1105 'arrayfields' => $arrayfields,
1107 'sortfield' => $sortfield,
1108 'sortorder' => $sortorder,
1109 'totalarray' => &$totalarray,
1111$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
1112print $hookmanager->resPrint;
1113if (!empty($arrayfields[
't.datec'][
'checked'])) {
1114 print_liste_field_titre($arrayfields[
't.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"t.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1115 $totalarray[
'nbfield']++;
1117if (!empty($arrayfields[
't.tms'][
'checked'])) {
1118 print_liste_field_titre($arrayfields[
't.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"t.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1119 $totalarray[
'nbfield']++;
1123 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
1124 $totalarray[
'nbfield']++;
1128$plannedworkloadoutputformat =
'allhourmin';
1129$timespentoutputformat =
'allhourmin';
1131 $plannedworkloadoutputformat =
getDolGlobalString(
'PROJECT_PLANNED_WORKLOAD_FORMAT');
1140$savnbfield = $totalarray[
'nbfield'];
1142$totalarray[
'nbfield'] = 0;
1143$imaxinloop = ($limit ? min($num, $limit) : $num);
1144while ($i < $imaxinloop) {
1145 $obj = $db->fetch_object($resql);
1154 $object->description = $obj->description;
1155 $object->status = $obj->status;
1156 $object->progress = $obj->progress;
1157 $object->budget_amount = $obj->budget_amount;
1158 $object->date_start = $db->jdate($obj->date_start);
1159 $object->date_end = $db->jdate($obj->date_end);
1160 $object->planned_workload = $obj->planned_workload;
1161 $object->duration_effective = $obj->duration_effective;
1162 $object->fk_task_parent = $obj->fk_task_parent;
1164 $projectstatic->id = $obj->projectid;
1165 $projectstatic->ref = $obj->projectref;
1166 $projectstatic->title = $obj->projecttitle;
1167 $projectstatic->public = $obj->public;
1168 $projectstatic->statut = $obj->projectstatus;
1169 $projectstatic->datee = $db->jdate($obj->projectdatee);
1172 $socstatic->id = $obj->socid;
1173 $socstatic->name = $obj->name;
1174 $socstatic->name_alias = $obj->alias;
1176 if ($mode ==
'kanban') {
1178 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
1179 print
'<div class="box-flex-container kanban">';
1182 if ($massactionbutton || $massaction) {
1184 if (in_array(
$object->id, $arrayofselected)) {
1189 $arraydata = array();
1190 $arraydata[
'projectlink'] = $projectstatic->getNomUrl(1);
1191 $arraydata[
'selected'] = in_array(
$object->id, $arrayofselected);
1193 print
$object->getKanbanView(
'', $arraydata);
1194 if ($i == ($imaxinloop - 1)) {
1199 $userAccess = $projectstatic->restrictedProjectArea($user);
1200 if ($userAccess >= 0) {
1203 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
1207 print
'<td class="nowrap center">';
1208 if ($massactionbutton || $massaction) {
1210 if (in_array(
$object->id, $arrayofselected)) {
1213 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1217 $totalarray[
'nbfield']++;
1221 if (!empty($arrayfields[
't.ref'][
'checked'])) {
1222 print
'<td class="nowraponall">';
1223 print
$object->getNomUrl(1,
'withproject');
1229 $totalarray[
'nbfield']++;
1233 if (!empty($arrayfields[
't.fk_task_parent'][
'checked'])) {
1234 print
'<td class="nowraponall">';
1235 if (!empty(
$object->fk_task_parent)) {
1236 $object_parent =
new Task($db);
1237 $result = $object_parent->fetch(
$object->fk_task_parent);
1241 print $object_parent->getNomUrl(1,
'withproject');
1242 if ($object_parent->hasDelay()) {
1249 $totalarray[
'nbfield']++;
1253 if (!empty($arrayfields[
't.label'][
'checked'])) {
1254 print
'<td class="tdoverflowmax200" title="'.dol_escape_htmltag(
$object->label).
'">';
1258 $totalarray[
'nbfield']++;
1262 if (!empty($arrayfields[
't.description'][
'checked'])) {
1267 $totalarray[
'nbfield']++;
1272 if (!empty($arrayfields[
't.dateo'][
'checked'])) {
1273 print
'<td class="center">';
1277 $totalarray[
'nbfield']++;
1281 if (!empty($arrayfields[
't.datee'][
'checked'])) {
1282 print
'<td class="center">';
1286 $totalarray[
'nbfield']++;
1290 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1291 print
'<td class="nowraponall tdoverflowmax150">';
1292 print $projectstatic->getNomUrl(1,
'task');
1293 if ($projectstatic->hasDelay()) {
1298 $totalarray[
'nbfield']++;
1302 if (!empty($arrayfields[
'p.title'][
'checked'])) {
1303 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->projecttitle).
'">';
1307 $totalarray[
'nbfield']++;
1311 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1312 print
'<td class="tdoverflowmax125">';
1314 print $socstatic->getNomUrl(1,
'', 0, 0, -1, empty($arrayfields[
's.name_alias'][
'checked']) ? 0 : 1);
1320 $totalarray[
'nbfield']++;
1324 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1327 $name_alias = $socstatic->name_alias;
1329 print
'<td class="tdoverflowmax125" title="'.dol_escape_htmltag($name_alias).
'">';
1333 $totalarray[
'nbfield']++;
1337 if (!empty($arrayfields[
'p.fk_statut'][
'checked'])) {
1338 print
'<td class="center">';
1339 print $projectstatic->getLibStatut(1);
1342 $totalarray[
'nbfield']++;
1347 if (!empty($arrayfields[
't.planned_workload'][
'checked'])) {
1348 print
'<td class="center">';
1351 if ($obj->planned_workload !=
'') {
1359 $totalarray[
'nbfield']++;
1362 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.planned_workload';
1364 if (!isset($totalarray[
'val'][
't.planned_workload'])) {
1365 $totalarray[
'val'][
't.planned_workload'] = 0;
1367 $totalarray[
'val'][
't.planned_workload'] += $obj->planned_workload;
1369 $totalarray[
'totalplannedworkloadfield'] = $totalarray[
'nbfield'];
1371 if (!isset($totalarray[
'totalplannedworkload'])) {
1372 $totalarray[
'totalplannedworkload'] = 0;
1374 $totalarray[
'totalplannedworkload'] += $obj->planned_workload;
1377 if (!empty($arrayfields[
't.duration_effective'][
'checked'])) {
1378 $showlineingray = 0;
1380 print
'<td class="center">';
1381 if ($showlineingray) {
1384 print
'<a href="'.DOL_URL_ROOT.
'/projet/tasks/time.php?id='.
$object->id.($showproject ?
'' :
'&withproject=1').
'">';
1386 if ($obj->duration_effective) {
1391 if ($showlineingray) {
1396 if (empty($arrayfields[
't.progress_calculated'][
'checked'])) {
1397 if ($obj->planned_workload || $obj->duration_effective) {
1398 if ($obj->planned_workload) {
1399 print
' <span class="opacitymedium">('.round(100 * $obj->duration_effective / $obj->planned_workload, 2).
' %)</span>';
1401 print $form->textwithpicto(
'', $langs->trans(
'WorkloadNotDefined'), 1,
'help');
1407 $totalarray[
'nbfield']++;
1410 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.duration_effective';
1412 if (!isset($totalarray[
'val'][
't.duration_effective'])) {
1413 $totalarray[
'val'][
't.duration_effective'] = 0;
1415 $totalarray[
'val'][
't.duration_effective'] += $obj->duration_effective;
1417 $totalarray[
'totaldurationeffectivefield'] = $totalarray[
'nbfield'];
1419 if (!isset($totalarray[
'totaldurationeffective'])) {
1420 $totalarray[
'totaldurationeffective'] = 0;
1422 $totalarray[
'totaldurationeffective'] += $obj->duration_effective;
1425 if (!empty($arrayfields[
't.progress_calculated'][
'checked'])) {
1426 print
'<td class="center">';
1427 if ($obj->planned_workload || $obj->duration_effective) {
1428 if ($obj->planned_workload) {
1429 print round(100 * $obj->duration_effective / $obj->planned_workload, 2).
' %';
1431 print $form->textwithpicto(
'', $langs->trans(
'WorkloadNotDefined'), 1,
'help');
1436 $totalarray[
'nbfield']++;
1439 $totalarray[
'totalprogress_calculatedfield'] = $totalarray[
'nbfield'];
1443 if (!empty($arrayfields[
't.progress'][
'checked'])) {
1444 print
'<td class="center">';
1445 if ($obj->progress !=
'') {
1450 $totalarray[
'nbfield']++;
1453 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.progress';
1455 if (!isset($totalarray[
'val'][
't.progress'])) {
1456 $totalarray[
'val'][
't.progress'] = 0;
1458 $totalarray[
'val'][
't.progress'] += ($obj->planned_workload * $obj->progress / 100);
1460 $totalarray[
'totalprogress_declaredfield'] = $totalarray[
'nbfield'];
1462 if (!isset($totalarray[
'totaldurationdeclared'])) {
1463 $totalarray[
'totaldurationdeclared'] = 0;
1465 $totalarray[
'totaldurationdeclared'] += $obj->planned_workload * $obj->progress / 100;
1468 if (!empty($arrayfields[
't.progress_summary'][
'checked'])) {
1469 print
'<td class="center">';
1475 $totalarray[
'nbfield']++;
1478 $totalarray[
'totalprogress_summary'] = $totalarray[
'nbfield'];
1482 if (!empty($arrayfields[
't.budget_amount'][
'checked'])) {
1483 print
'<td class="center">';
1485 print
'<span class="amount">'.price(
$object->budget_amount, 0, $langs, 1, 0, 0,
$conf->currency).
'</span>';
1489 $totalarray[
'nbfield']++;
1492 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.budget_amount';
1494 $totalarray[
'val'][
't.budget_amount'] += $obj->budget_amount;
1496 $totalarray[
'totalbudget_amountfield'] = $totalarray[
'nbfield'];
1498 $totalarray[
'totalbudgetamount'] += $obj->budget_amount;
1501 if (!empty($arrayfields[
't.tobill'][
'checked'])) {
1502 print
'<td class="center">';
1503 if ($obj->usage_bill_time) {
1505 $totalarray[
'val'][
't.tobill'] += $obj->tobill;
1506 $totalarray[
'totaltobill'] += $obj->tobill;
1508 print
'<span class="opacitymedium">'.$langs->trans(
"NA").
'</span>';
1512 $totalarray[
'nbfield']++;
1515 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.tobill';
1518 $totalarray[
'totaltobillfield'] = $totalarray[
'nbfield'];
1522 if (!empty($arrayfields[
't.billed'][
'checked'])) {
1523 print
'<td class="center">';
1524 if ($obj->usage_bill_time) {
1526 $totalarray[
'val'][
't.billed'] += $obj->billed;
1527 $totalarray[
'totalbilled'] += $obj->billed;
1529 print
'<span class="opacitymedium">'.$langs->trans(
"NA").
'</span>';
1533 $totalarray[
'nbfield']++;
1536 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.billed';
1539 $totalarray[
'totalbilledfield'] = $totalarray[
'nbfield'];
1543 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
1545 $parameters = array(
'arrayfields' => $arrayfields,
'object' => $object,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
1546 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
1547 print $hookmanager->resPrint;
1549 if (!empty($arrayfields[
't.datec'][
'checked'])) {
1550 print
'<td class="center">';
1551 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
1554 $totalarray[
'nbfield']++;
1558 if (!empty($arrayfields[
't.tms'][
'checked'])) {
1559 print
'<td class="center">';
1560 print
dol_print_date($db->jdate($obj->date_modification),
'dayhour',
'tzuser');
1563 $totalarray[
'nbfield']++;
1574 print
'<td class="nowrap center">';
1575 if ($massactionbutton || $massaction) {
1577 if (in_array(
$object->id, $arrayofselected)) {
1580 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1584 $totalarray[
'nbfield']++;
1596if (!empty($totalarray[
'totalizable']) && is_array($totalarray[
'totalizable'])) {
1597 foreach ($totalarray[
'totalizable'] as $keytotalizable => $valtotalizable) {
1598 $totalarray[
'pos'][$valtotalizable[
'pos']] = $keytotalizable;
1599 $totalarray[
'val'][$keytotalizable] = $valtotalizable[
'total'];
1605if (isset($totalarray[
'totaldurationeffectivefield']) || isset($totalarray[
'totalplannedworkloadfield']) || isset($totalarray[
'totalprogress_calculatedfield'])
1606 || isset($totalarray[
'totaltobill']) || isset($totalarray[
'totalbilled']) || isset($totalarray[
'totalbudget'])) {
1607 print
'<tr class="liste_total">';
1609 while ($i < $totalarray[
'nbfield']) {
1612 if ((is_null($limit) || $num < $limit) && empty($offset)) {
1613 print
'<td>'.$langs->trans(
"Total").
'</td>';
1616 if (is_object($form)) {
1617 print $form->textwithpicto($langs->trans(
"Total"), $langs->transnoentitiesnoconv(
"Totalforthispage"));
1619 print $langs->trans(
"Totalforthispage");
1629 } elseif (isset($totalarray[
'totalplannedworkloadfield']) && $totalarray[
'totalplannedworkloadfield'] == $i) {
1630 print
'<td class="center">'.convertSecondToTime($totalarray[
'totalplannedworkload'], $plannedworkloadoutputformat).
'</td>';
1631 } elseif (isset($totalarray[
'totaldurationeffectivefield']) && $totalarray[
'totaldurationeffectivefield'] == $i) {
1632 print
'<td class="center">'.convertSecondToTime($totalarray[
'totaldurationeffective'], $timespentoutputformat).
'</td>';
1633 } elseif (isset($totalarray[
'totalprogress_calculatedfield']) && $totalarray[
'totalprogress_calculatedfield'] == $i) {
1634 print
'<td class="center">'.($totalarray[
'totalplannedworkload'] > 0 ? round(100 * $totalarray[
'totaldurationeffective'] / $totalarray[
'totalplannedworkload'], 2).
' %' :
'').
'</td>';
1635 } elseif (isset($totalarray[
'totalprogress_declaredfield']) && $totalarray[
'totalprogress_declaredfield'] == $i) {
1636 print
'<td class="center">'.($totalarray[
'totalplannedworkload'] > 0 ? round(100 * $totalarray[
'totaldurationdeclared'] / $totalarray[
'totalplannedworkload'], 2).
' %' :
'').
'</td>';
1637 } elseif (isset($totalarray[
'totaltobillfield']) && $totalarray[
'totaltobillfield'] == $i) {
1638 print
'<td class="center">'.convertSecondToTime($totalarray[
'totaltobill'], $plannedworkloadoutputformat).
'</td>';
1639 } elseif (isset($totalarray[
'totalbilledfield']) && $totalarray[
'totalbilledfield'] == $i) {
1640 print
'<td class="center">'.convertSecondToTime($totalarray[
'totalbilled'], $plannedworkloadoutputformat).
'</td>';
1641 } elseif (isset($totalarray[
'totalbudget_amountfield']) && $totalarray[
'totalbudget_amountfield'] == $i) {
1642 print
'<td class="center">'.price((
float) $totalarray[
'totalbudgetamount'], 0, $langs, 1, 0, 0,
$conf->currency).
'</td>';
1643 } elseif (!empty($totalarray[
'pos'][$i])) {
1644 print
'<td class="right">';
1646 if (isset($totalarray[
'type']) && $totalarray[
'type'][$i] ==
'duration') {
1647 print(!empty($totalarray[
'val'][$totalarray[
'pos'][$i]]) ?
convertSecondToTime($totalarray[
'val'][$totalarray[
'pos'][$i]],
'allhourmin') : 0);
1649 print
price(!empty($totalarray[
'val'][$totalarray[
'pos'][$i]]) ? $totalarray[
'val'][$totalarray[
'pos'][$i]] : 0);
1661$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
1662$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
1663print $hookmanager->resPrint;
1665print
'</table>'.
"\n";
1668print
'</form>'.
"\n";
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
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_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_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_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
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.
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
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.
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
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...
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
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_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.
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...
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
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.