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';
40$langs->loadLangs(array(
'projects',
'users',
'companies'));
42$action =
GETPOST(
'action',
'aZ09');
43$massaction =
GETPOST(
'massaction',
'alpha');
45$confirm =
GETPOST(
'confirm',
'alpha');
46$toselect =
GETPOST(
'toselect',
'array');
47$optioncss =
GETPOST(
'optioncss',
'aZ09');
52$search_all = trim((
GETPOST(
'search_all',
'alphanohtml') !=
'') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml'));
53$search_categ =
GETPOST(
"search_categ",
'intcomma');
54$search_projectstatus =
GETPOST(
'search_projectstatus',
'intcomma');
55$search_project_ref =
GETPOST(
'search_project_ref');
56$search_project_title =
GETPOST(
'search_project_title');
57$search_task_ref =
GETPOST(
'search_task_ref');
58$search_task_label =
GETPOST(
'search_task_label');
59$search_task_description =
GETPOST(
'search_task_description');
60$search_task_ref_parent =
GETPOST(
'search_task_ref_parent');
61$search_project_user =
GETPOST(
'search_project_user',
'intcomma');
62$search_task_user =
GETPOST(
'search_task_user',
'intcomma');
63$search_task_progress =
GETPOST(
'search_task_progress');
64$search_task_budget_amount =
GETPOST(
'search_task_budget_amount');
65$search_societe =
GETPOST(
'search_societe');
66$search_societe_alias =
GETPOST(
'search_societe_alias');
67$search_opp_status =
GETPOST(
"search_opp_status",
'alpha');
68$searchCategoryCustomerOperator = 0;
69if (GETPOSTISSET(
'formfilteraction')) {
70 $searchCategoryCustomerOperator =
GETPOSTINT(
'search_category_customer_operator');
74$searchCategoryCustomerList =
GETPOST(
'search_category_customer_list',
'array');
76if (!isset($search_projectstatus) || $search_projectstatus ===
'') {
77 if ($search_all !=
'') {
78 $search_projectstatus = -1;
80 $search_projectstatus = 1;
84$mine =
GETPOST(
'mode',
'alpha') ==
'mine' ? 1 : 0;
86 $search_task_user = $user->id;
91$search_date_startday =
GETPOSTINT(
'search_date_startday');
92$search_date_startmonth =
GETPOSTINT(
'search_date_startmonth');
93$search_date_startyear =
GETPOSTINT(
'search_date_startyear');
94$search_date_endday =
GETPOSTINT(
'search_date_endday');
95$search_date_endmonth =
GETPOSTINT(
'search_date_endmonth');
96$search_date_endyear =
GETPOSTINT(
'search_date_endyear');
97$search_date_start =
dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear);
98$search_date_end =
dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
99$search_datelimit_startday =
GETPOSTINT(
'search_datelimit_startday');
100$search_datelimit_startmonth =
GETPOSTINT(
'search_datelimit_startmonth');
101$search_datelimit_startyear =
GETPOSTINT(
'search_datelimit_startyear');
102$search_datelimit_endday =
GETPOSTINT(
'search_datelimit_endday');
103$search_datelimit_endmonth =
GETPOSTINT(
'search_datelimit_endmonth');
104$search_datelimit_endyear =
GETPOSTINT(
'search_datelimit_endyear');
105$search_datelimit_start =
dol_mktime(0, 0, 0, $search_datelimit_startmonth, $search_datelimit_startday, $search_datelimit_startyear);
106$search_datelimit_end =
dol_mktime(23, 59, 59, $search_datelimit_endmonth, $search_datelimit_endday, $search_datelimit_endyear);
109$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'tasklist';
113$hookmanager->initHooks(array(
'tasklist'));
117$extrafields->fetch_name_optionals_label(
$object->table_element);
118$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
123if (!$user->hasRight(
'projet',
'lire')) {
127$diroutputmassaction = $conf->project->dir_output.
'/tasks/temp/massgeneration/'.$user->id;
130$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
131$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
133if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
137$offset = $limit * $page;
138$pageprev = $page - 1;
139$pagenext = $page + 1;
141 $sortfield =
'p.ref';
148$fieldstosearchall = array(
150 't.label' =>
"Label",
151 't.description' =>
"Description",
152 't.note_public' =>
"NotePublic",
154if (empty($user->socid)) {
155 $fieldstosearchall[
't.note_private'] =
"NotePrivate";
159 't.ref' => array(
'label' =>
"RefTask",
'checked' => 1,
'position' => 50),
160 't.fk_task_parent' => array(
'label' =>
"RefTaskParent",
'checked' => 0,
'position' => 70),
161 't.label' => array(
'label' =>
"LabelTask",
'checked' => 1,
'position' => 75),
162 't.description' => array(
'label' =>
"Description",
'checked' => 0,
'position' => 80),
163 't.dateo' => array(
'label' =>
"DateStart",
'checked' => 1,
'position' => 100),
164 't.datee' => array(
'label' =>
"Deadline",
'checked' => 1,
'position' => 101),
165 'p.ref' => array(
'label' =>
"ProjectRef",
'checked' => 1,
'position' => 151),
166 'p.title' => array(
'label' =>
"ProjectLabel",
'checked' => 0,
'position' => 152),
167 's.nom' => array(
'label' =>
"ThirdParty",
'checked' => -1,
'csslist' =>
'tdoverflowmax125',
'position' => 200),
168 's.name_alias' => array(
'label' =>
"AliasNameShort",
'checked' => 0,
'csslist' =>
'tdoverflowmax125',
'position' => 201),
169 'p.fk_statut' => array(
'label' =>
"ProjectStatus",
'checked' => 1,
'position' => 205),
170 't.planned_workload' => array(
'label' =>
"PlannedWorkload",
'checked' => 1,
'position' => 302),
171 't.duration_effective' => array(
'label' =>
"TimeSpent",
'checked' => 1,
'position' => 303),
172 't.progress_calculated' => array(
'label' =>
"ProgressCalculated",
'checked' => -1,
'position' => 304),
173 't.progress' => array(
'label' =>
"ProgressDeclared",
'checked' => 1,
'position' => 305),
174 't.progress_summary' => array(
'label' =>
"TaskProgressSummary",
'checked' => 1,
'position' => 306),
175 't.budget_amount' => array(
'label' =>
"Budget",
'checked' => 0,
'position' => 307),
176 't.tobill' => array(
'label' =>
"TimeToBill",
'checked' => 0,
'position' => 310),
177 't.billed' => array(
'label' =>
"TimeBilled",
'checked' => 0,
'position' => 311),
178 't.datec' => array(
'label' =>
"DateCreation",
'checked' => 0,
'position' => 500),
179 't.tms' => array(
'label' =>
"DateModificationShort",
'checked' => 0,
'position' => 501),
183include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
187'@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields';
189$permissiontoread = $user->hasRight(
'projet',
'lire');
190$permissiontocreate = $user->hasRight(
'projet',
'creer');
191$permissiontodelete = $user->hasRight(
'projet',
'supprimer');
193if (!$permissiontoread) {
202if (
GETPOST(
'cancel',
'alpha')) {
206if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
210$parameters = array(
'socid' => $socid);
211$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
216if (empty($reshook)) {
218 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
221 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
224 $search_projectstatus = -1;
225 $search_project_ref =
"";
226 $search_societe =
"";
227 $search_societe_alias =
"";
228 $search_project_title =
"";
229 $search_task_ref =
"";
230 $search_task_label =
"";
231 $search_task_description =
"";
232 $search_task_ref_parent =
"";
233 $search_task_progress =
"";
234 $search_task_budget_amount =
"";
235 $search_task_user = -1;
236 $search_project_user = -1;
237 $search_date_startday =
'';
238 $search_date_startmonth =
'';
239 $search_date_startyear =
'';
240 $search_date_endday =
'';
241 $search_date_endmonth =
'';
242 $search_date_endyear =
'';
243 $search_date_start =
'';
244 $search_date_end =
'';
245 $search_datelimit_startday =
'';
246 $search_datelimit_startmonth =
'';
247 $search_datelimit_startyear =
'';
248 $search_datelimit_endday =
'';
249 $search_datelimit_endmonth =
'';
250 $search_datelimit_endyear =
'';
251 $search_datelimit_start =
'';
252 $search_datelimit_end =
'';
254 $searchCategoryCustomerList = array();
255 $search_array_options = array();
259 $objectclass =
'Task';
260 $objectlabel =
'Tasks';
261 $uploaddir = $conf->project->dir_output.
'/tasks';
262 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
265if (empty($search_projectstatus) && $search_projectstatus ==
'') {
266 $search_projectstatus = 1;
273$form =
new Form($db);
276$projectstatic =
new Project($db);
277$puser =
new User($db);
278$tuser =
new User($db);
282$title = $langs->trans(
"Activities");
283$help_url =
"EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos";
287if ($search_project_user > 0) {
288 $puser->fetch($search_project_user);
290if ($search_task_user > 0) {
291 $tuser->fetch($search_task_user);
295$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
296$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
300 $projectstatic->fetch(
$id);
301 $projectstatic->fetch_thirdparty();
305if (!$user->hasRight(
'projet',
'all',
'lire')) {
306 $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1, $socid);
311$listofprojectcontacttype = array();
312$sql =
"SELECT ctc.rowid, ctc.code FROM ".MAIN_DB_PREFIX.
"c_type_contact as ctc";
313$sql .=
" WHERE ctc.element = '".$db->escape($projectstatic->element).
"'";
314$sql .=
" AND ctc.source = 'internal'";
315$resql = $db->query($sql);
317 while ($obj = $db->fetch_object($resql)) {
318 $listofprojectcontacttype[$obj->rowid] = $obj->code;
323if (count($listofprojectcontacttype) == 0) {
324 $listofprojectcontacttype[0] =
'0';
327$listoftaskcontacttype = array();
328$sql =
"SELECT ctc.rowid, ctc.code FROM ".MAIN_DB_PREFIX.
"c_type_contact as ctc";
329$sql .=
" WHERE ctc.element = '".$db->escape(
$object->element).
"'";
330$sql .=
" AND ctc.source = 'internal'";
331$resql = $db->query($sql);
333 while ($obj = $db->fetch_object($resql)) {
334 $listoftaskcontacttype[$obj->rowid] = $obj->code;
339if (count($listoftaskcontacttype) == 0) {
340 $listoftaskcontacttype[0] =
'0';
345$distinct =
'DISTINCT';
346$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,";
347$sql .=
" s.nom as name, s.name_alias as alias, s.rowid as socid,";
348$sql .=
" t.datec as date_creation, t.dateo as date_start, t.datee as date_end, t.tms as date_modification,";
349$sql .=
" t.rowid as id, t.ref, t.label, t.planned_workload, t.duration_effective, t.progress, t.fk_statut as status,";
350$sql .=
" t.description, t.fk_task_parent, t.budget_amount";
352if (!empty($arrayfields[
't.tobill'][
'checked']) || !empty($arrayfields[
't.billed'][
'checked'])) {
353 $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";
356if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
357 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
358 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
362$parameters = array();
363$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
364$sql .= $hookmanager->resPrint;
365$sql = preg_replace(
'/,\s*$/',
'', $sql);
369$sql .=
" FROM ".MAIN_DB_PREFIX.
"projet as p";
370$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s on p.fk_soc = s.rowid";
371$sql .=
", ".MAIN_DB_PREFIX.
"projet_task as t";
372if (!empty($arrayfields[
't.tobill'][
'checked']) || !empty($arrayfields[
't.billed'][
'checked'])) {
373 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"element_time as tt ON (tt.fk_element = t.rowid AND tt.elementtype = 'task')";
375if (isset($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
376 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (t.rowid = ef.fk_object)";
378if ($search_project_user > 0) {
379 $sql .=
", ".MAIN_DB_PREFIX.
"element_contact as ecp";
381if ($search_task_user > 0) {
382 $sql .=
", ".MAIN_DB_PREFIX.
"element_contact as ect";
384$sql .=
" WHERE t.fk_projet = p.rowid";
385$sql .=
" AND p.entity IN (".getEntity(
'project').
')';
386if (!$user->hasRight(
'projet',
'all',
'lire')) {
387 $sql .=
" AND p.rowid IN (".$db->sanitize($projectsListId ? $projectsListId :
'0').
")";
389if (is_object($projectstatic) && $projectstatic->id > 0) {
390 $sql .=
" AND p.rowid = ".((int) $projectstatic->id);
394 $sql .=
" AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".((int) $socid).
")";
396if ($search_project_ref) {
399if ($search_project_title) {
402if ($search_task_ref) {
405if ($search_task_label) {
408if ($search_task_description) {
409 $sql .=
natural_search(
't.description', $search_task_description);
411if ($search_task_ref_parent) {
412 $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).
')';
414if ($search_task_progress) {
417if ($search_task_budget_amount) {
418 $sql .=
natural_search(
't.budget_amount', $search_task_budget_amount, 1);
420if (empty($arrayfields[
's.name_alias'][
'checked']) && $search_societe) {
421 $sql .=
natural_search(array(
"s.nom",
"s.name_alias"), $search_societe);
423 if ($search_societe) {
426 if ($search_societe_alias) {
430if ($search_date_start) {
431 $sql .=
" AND t.dateo >= '".$db->idate($search_date_start).
"'";
433if ($search_date_end) {
434 $sql .=
" AND t.dateo <= '".$db->idate($search_date_end).
"'";
436if ($search_datelimit_start) {
437 $sql .=
" AND t.datee >= '".$db->idate($search_datelimit_start).
"'";
439if ($search_datelimit_end) {
440 $sql .=
" AND t.datee <= '".$db->idate($search_datelimit_end).
"'";
443 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
445if ($search_projectstatus >= 0) {
446 if ($search_projectstatus == 99) {
447 $sql .=
" AND p.fk_statut <> 2";
449 $sql .=
" AND p.fk_statut = ".((int) $search_projectstatus);
452if ($search_project_user > 0) {
453 $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);
455if ($search_task_user > 0) {
456 $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);
459$searchCategoryProjectList = array($search_categ);
460$searchCategoryProjectOperator = 0;
461if (!empty($searchCategoryProjectList)) {
462 $searchCategoryProjectSqlList = array();
463 $listofcategoryid =
'';
464 foreach ($searchCategoryProjectList as $searchCategoryProject) {
465 if (intval($searchCategoryProject) == -2) {
466 $searchCategoryProjectSqlList[] =
"NOT EXISTS (SELECT ck.fk_project FROM ".MAIN_DB_PREFIX.
"categorie_project as ck WHERE p.rowid = ck.fk_project)";
467 } elseif (intval($searchCategoryProject) > 0) {
468 if ($searchCategoryProjectOperator == 0) {
469 $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).
")";
471 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryProject);
475 if ($listofcategoryid) {
476 $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).
"))";
478 if ($searchCategoryProjectOperator == 1) {
479 if (!empty($searchCategoryProjectSqlList)) {
480 $sql .=
" AND (".implode(
' OR ', $searchCategoryProjectSqlList).
")";
483 if (!empty($searchCategoryProjectSqlList)) {
484 $sql .=
" AND (".implode(
' AND ', $searchCategoryProjectSqlList).
")";
488$searchCategoryCustomerSqlList = array();
489if ($searchCategoryCustomerOperator == 1) {
490 $existsCategoryCustomerList = array();
491 foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
492 if (intval($searchCategoryCustomer) == -2) {
493 $sqlCategoryCustomerNotExists =
" NOT EXISTS (";
494 $sqlCategoryCustomerNotExists .=
" SELECT cat_cus.fk_soc";
495 $sqlCategoryCustomerNotExists .=
" FROM ".$db->prefix().
"categorie_societe AS cat_cus";
496 $sqlCategoryCustomerNotExists .=
" WHERE cat_cus.fk_soc = p.fk_soc";
497 $sqlCategoryCustomerNotExists .=
" )";
498 $searchCategoryCustomerSqlList[] = $sqlCategoryCustomerNotExists;
499 } elseif (intval($searchCategoryCustomer) > 0) {
500 $existsCategoryCustomerList[] = $db->escape($searchCategoryCustomer);
503 if (!empty($existsCategoryCustomerList)) {
504 $sqlCategoryCustomerExists =
" EXISTS (";
505 $sqlCategoryCustomerExists .=
" SELECT cat_cus.fk_soc";
506 $sqlCategoryCustomerExists .=
" FROM ".$db->prefix().
"categorie_societe AS cat_cus";
507 $sqlCategoryCustomerExists .=
" WHERE cat_cus.fk_soc = p.fk_soc";
508 $sqlCategoryCustomerExists .=
" AND cat_cus.fk_categorie IN (".$db->sanitize(implode(
',', $existsCategoryCustomerList)).
")";
509 $sqlCategoryCustomerExists .=
" )";
510 $searchCategoryCustomerSqlList[] = $sqlCategoryCustomerExists;
512 if (!empty($searchCategoryCustomerSqlList)) {
513 $sql .=
" AND (".implode(
' OR ', $searchCategoryCustomerSqlList).
")";
516 foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
517 if (intval($searchCategoryCustomer) == -2) {
518 $sqlCategoryCustomerNotExists =
" NOT EXISTS (";
519 $sqlCategoryCustomerNotExists .=
" SELECT cat_cus.fk_soc";
520 $sqlCategoryCustomerNotExists .=
" FROM ".$db->prefix().
"categorie_societe AS cat_cus";
521 $sqlCategoryCustomerNotExists .=
" WHERE cat_cus.fk_soc = p.fk_soc";
522 $sqlCategoryCustomerNotExists .=
" )";
523 $searchCategoryCustomerSqlList[] = $sqlCategoryCustomerNotExists;
524 } elseif (intval($searchCategoryCustomer) > 0) {
525 $searchCategoryCustomerSqlList[] =
"p.fk_soc IN (SELECT fk_soc FROM ".$db->prefix().
"categorie_societe WHERE fk_categorie = ".((int) $searchCategoryCustomer).
")";
528 if (!empty($searchCategoryCustomerSqlList)) {
529 $sql .=
" AND (".implode(
' AND ', $searchCategoryCustomerSqlList).
")";
533include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
535$parameters = array();
536$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
537$sql .= $hookmanager->resPrint;
538if (!empty($arrayfields[
't.tobill'][
'checked']) || !empty($arrayfields[
't.billed'][
'checked'])) {
539 $sql .=
" GROUP BY p.rowid, p.ref, p.title, p.fk_statut, p.datee, p.fk_opp_status, p.public, p.fk_user_creat,";
540 $sql .=
" s.nom, s.rowid,";
541 $sql .=
" t.datec, t.dateo, t.datee, t.tms,";
542 $sql .=
" t.rowid, t.ref, t.label, t.planned_workload, t.duration_effective, t.progress,t.budget_amount, t.fk_statut as status";
544 if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
545 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
546 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key :
'');
552$nbtotalofrecords =
'';
555 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
556 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
557 $resql = $db->query($sqlforcount);
559 $objforcount = $db->fetch_object($resql);
560 $nbtotalofrecords = $objforcount->nbtotalofrecords;
565 if (($page * $limit) > $nbtotalofrecords) {
573$sql .= $db->order($sortfield, $sortorder);
575 $sql .= $db->plimit($limit + 1, $offset);
578$resql = $db->query($sql);
584$num = $db->num_rows($resql);
588if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all) {
589 $obj = $db->fetch_object($resql);
591 header(
"Location: ".DOL_URL_ROOT.
'/projet/tasks/task.php?id='.
$id.
'&withproject=1');
599llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'bodyforlist mod-project project-tasks page-list');
601$arrayofselected = is_array($toselect) ? $toselect : array();
605 $param .=
'&mode='.urlencode($mode);
607if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
608 $param .=
'&contextpage='.urlencode($contextpage);
610if ($limit > 0 && $limit != $conf->liste_limit) {
611 $param .=
'&limit='.((int) $limit);
613if ($search_date_startday) {
614 $param .=
'&search_date_startday='.urlencode((
string) ($search_date_startday));
616if ($search_date_startmonth) {
617 $param .=
'&search_date_startmonth='.urlencode((
string) ($search_date_startmonth));
619if ($search_date_startyear) {
620 $param .=
'&search_date_startyear='.urlencode((
string) ($search_date_startyear));
622if ($search_date_endday) {
623 $param .=
'&search_date_endday='.urlencode((
string) ($search_date_endday));
625if ($search_date_endmonth) {
626 $param .=
'&search_date_endmonth='.urlencode((
string) ($search_date_endmonth));
628if ($search_date_endyear) {
629 $param .=
'&search_date_endyear='.urlencode((
string) ($search_date_endyear));
631if ($search_datelimit_startday) {
632 $param .=
'&search_datelimit_startday='.urlencode((
string) ($search_datelimit_startday));
634if ($search_datelimit_startmonth) {
635 $param .=
'&search_datelimit_startmonth='.urlencode((
string) ($search_datelimit_startmonth));
637if ($search_datelimit_startyear) {
638 $param .=
'&search_datelimit_startyear='.urlencode((
string) ($search_datelimit_startyear));
640if ($search_datelimit_endday) {
641 $param .=
'&search_datelimit_endday='.urlencode((
string) ($search_datelimit_endday));
643if ($search_datelimit_endmonth) {
644 $param .=
'&search_datelimit_endmonth='.urlencode((
string) ($search_datelimit_endmonth));
646if ($search_datelimit_endyear) {
647 $param .=
'&search_datelimit_endyear='.urlencode((
string) ($search_datelimit_endyear));
649if ($search_task_budget_amount) {
650 $param .=
'&search_task_budget_amount='.urlencode($search_task_budget_amount);
653 $param .=
'&socid='.urlencode($socid);
655if ($search_all !=
'') {
656 $param .=
'&search_all='.urlencode($search_all);
658if ($search_project_ref !=
'') {
659 $param .=
'&search_project_ref='.urlencode($search_project_ref);
661if ($search_project_title !=
'') {
662 $param .=
'&search_project_title='.urlencode($search_project_title);
664if ($search_task_ref !=
'') {
665 $param .=
'&search_task_ref='.urlencode($search_task_ref);
667if ($search_task_label !=
'') {
668 $param .=
'&search_task_label='.urlencode($search_task_label);
670if ($search_task_description !=
'') {
671 $param .=
'&search_task_description='.urlencode($search_task_description);
673if ($search_task_ref_parent !=
'') {
674 $param .=
'&search_task_ref_parent='.urlencode($search_task_ref_parent);
676if ($search_task_progress !=
'') {
677 $param .=
'&search_task_progress='.urlencode($search_task_progress);
679if ($search_societe !=
'') {
680 $param .=
'&search_societe='.urlencode($search_societe);
682if ($search_societe !=
'') {
683 $param .=
'&search_societe_alias='.urlencode($search_societe_alias);
685if ($search_projectstatus !=
'') {
686 $param .=
'&search_projectstatus='.urlencode($search_projectstatus);
688if ((is_numeric($search_opp_status) && $search_opp_status >= 0) || in_array($search_opp_status, array(
'all',
'none'))) {
689 $param .=
'&search_opp_status='.urlencode($search_opp_status);
691if ($search_project_user !=
'') {
692 $param .=
'&search_project_user='.urlencode((
string) ($search_project_user));
694if ($search_task_user > 0) {
695 $param .=
'&search_task_user='.urlencode($search_task_user);
697if ($optioncss !=
'') {
698 $param .=
'&optioncss='.urlencode($optioncss);
700foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
701 $param .=
"&search_category_customer_list[]=".urlencode($searchCategoryCustomer);
704include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
706$parameters = array(
'param' => &$param);
707$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
708$param .= $hookmanager->resPrint;
711$arrayofmassactions = array(
716if (!empty($permissiontodelete)) {
717 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
719if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'presend',
'predelete'))) {
720 $arrayofmassactions = array();
722$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
724print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
725if ($optioncss !=
'') {
726 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
728print
'<input type="hidden" name="token" value="'.newToken().
'">';
729print
'<input type="hidden" name="action" value="list">';
730print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
731print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
732print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
733print
'<input type="hidden" name="page" value="'.$page.
'">';
735 print
'<input type="hidden" name="type" value="'.$type.
'">';
737print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
738print
'<input type="hidden" name="page_y" value="">';
739print
'<input type="hidden" name="mode" value="'.$mode.
'">';
744$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'));
745$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'));
747$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);
752if ($search_task_user == $user->id) {
753 $texthelp .= $langs->trans(
"MyTasksDesc");
755 if ($user->hasRight(
'projet',
'all',
'lire') && !$socid) {
756 $texthelp .= $langs->trans(
"TasksOnProjectsDesc");
758 $texthelp .= $langs->trans(
"TasksOnProjectsPublicDesc");
762print_barre_liste($form->textwithpicto($title, $texthelp), $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'projecttask', 0, $newcardbutton,
'', $limit, 0, 0, 1);
764$topicmail =
"Information";
766$objecttmp =
new Task($db);
767$trackid =
'tas'.$object->id;
768include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
772 foreach ($fieldstosearchall as $key => $val) {
773 $fieldstosearchall[$key] = $langs->trans($val);
774 $setupstring .= $key.
"=".$val.
";";
776 print
'<!-- Search done like if TASK_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
777 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>'.
"\n";
783if (isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
784 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
785 $moreforfilter .=
'<div class="divsearchfield">';
786 $tmptitle = $langs->trans(
'ProjectCategories');
787 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"').$formother->select_categories(
'project', $search_categ,
'search_categ', 1, $tmptitle,
'maxwidth300');
788 $moreforfilter .=
'</div>';
792$moreforfilter .=
'<div class="divsearchfield">';
793$tmptitle = $langs->trans(
'ProjectsWithThisUserAsContact');
795if (!$user->hasRight(
'user',
'user',
'lire')) {
796 $includeonly = array($user->id);
798$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');
799$moreforfilter .=
'</div>';
802$moreforfilter .=
'<div class="divsearchfield">';
803$tmptitle = $langs->trans(
'TasksWithThisUserAsContact');
805if (!$user->hasRight(
'user',
'user',
'lire')) {
806 $includeonly = array($user->id);
808$moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$form->select_dolusers($search_task_user,
'search_task_user', $tmptitle,
'', 0, $includeonly,
'', 0, 0, 0,
'', 0,
'',
'maxwidth250');
809$moreforfilter .=
'</div>';
812if (
getDolGlobalString(
'MAIN_SEARCH_CATEGORY_CUSTOMER_ON_TASK_LIST') && isModEnabled(
"category") && $user->hasRight(
'categorie',
'lire')) {
814 $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_CUSTOMER, $searchCategoryCustomerList,
'minwidth300', $searchCategoryCustomerList ? $searchCategoryCustomerList : 0);
828if (!empty($moreforfilter)) {
829 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
830 print $moreforfilter;
831 $parameters = array();
832 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
833 print $hookmanager->resPrint;
837$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
838$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
839$selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
840$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
842print
'<div class="div-table-responsive">';
843print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'" id="tablelines3">'.
"\n";
847print
'<tr class="liste_titre_filter">';
850 print
'<td class="liste_titre center maxwidthsearch">';
851 $searchpicto = $form->showFilterButtons(
'left');
855if (!empty($arrayfields[
't.ref'][
'checked'])) {
856 print
'<td class="liste_titre">';
857 print
'<input type="text" class="flat" name="search_task_ref" value="'.dol_escape_htmltag($search_task_ref).
'" size="4">';
860if (!empty($arrayfields[
't.fk_task_parent'][
'checked'])) {
861 print
'<td class="liste_titre">';
862 print
'<input type="text" class="flat" name="search_task_ref_parent" value="'.dol_escape_htmltag($search_task_ref_parent).
'" size="4">';
865if (!empty($arrayfields[
't.label'][
'checked'])) {
866 print
'<td class="liste_titre">';
867 print
'<input type="text" class="flat" name="search_task_label" value="'.dol_escape_htmltag($search_task_label).
'" size="8">';
871if (!empty($arrayfields[
't.description'][
'checked'])) {
872 print
'<td class="liste_titre">';
873 print
'<input type="text" class="flat" name="search_task_description" value="'.dol_escape_htmltag($search_task_description).
'" size="8">';
877if (!empty($arrayfields[
't.dateo'][
'checked'])) {
878 print
'<td class="liste_titre center">';
879 print
'<div class="nowrapfordate">';
880 print $form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
882 print
'<div class="nowrapfordate">';
883 print $form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
888if (!empty($arrayfields[
't.datee'][
'checked'])) {
889 print
'<td class="liste_titre center">';
890 print
'<div class="nowrapfordate">';
891 print $form->selectDate($search_datelimit_start ? $search_datelimit_start : -1,
'search_datelimit_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
893 print
'<div class="nowrapfordate">';
894 print $form->selectDate($search_datelimit_end ? $search_datelimit_end : -1,
'search_datelimit_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
900if (!empty($arrayfields[
'p.ref'][
'checked'])) {
901 print
'<td class="liste_titre">';
902 print
'<input type="text" class="flat" name="search_project_ref" value="'.$search_project_ref.
'" size="4">';
905if (!empty($arrayfields[
'p.title'][
'checked'])) {
906 print
'<td class="liste_titre">';
907 print
'<input type="text" class="flat" name="search_project_title" value="'.$search_project_title.
'" size="6">';
910if (!empty($arrayfields[
's.nom'][
'checked'])) {
911 print
'<td class="liste_titre">';
912 print
'<input type="text" class="flat" name="search_societe" value="'.dol_escape_htmltag($search_societe).
'" size="4">';
915if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
916 print
'<td class="liste_titre">';
917 print
'<input type="text" class="flat" name="search_societe_alias" value="'.dol_escape_htmltag($search_societe_alias).
'" size="4">';
920if (!empty($arrayfields[
'p.fk_statut'][
'checked'])) {
921 print
'<td class="liste_titre center">';
922 $arrayofstatus = array();
923 foreach ($projectstatic->labelStatusShort as $key => $val) {
924 $arrayofstatus[$key] = $langs->trans($val);
926 $arrayofstatus[
'99'] = $langs->trans(
"NotClosed").
' ('.$langs->trans(
'Draft').
'+'.$langs->trans(
'Opened').
')';
927 print $form->selectarray(
'search_projectstatus', $arrayofstatus, $search_projectstatus, 1, 0, 0,
'', 0, 0, 0,
'',
'maxwidth100');
930if (!empty($arrayfields[
't.planned_workload'][
'checked'])) {
931 print
'<td class="liste_titre"></td>';
933if (!empty($arrayfields[
't.duration_effective'][
'checked'])) {
934 print
'<td class="liste_titre"></td>';
936if (!empty($arrayfields[
't.progress_calculated'][
'checked'])) {
937 print
'<td class="liste_titre"></td>';
939if (!empty($arrayfields[
't.progress'][
'checked'])) {
940 print
'<td class="liste_titre center">';
941 print
'<input type="text" class="flat" name="search_task_progress" value="'.$search_task_progress.
'" size="4">';
945if (!empty($arrayfields[
't.progress_summary'][
'checked'])) {
946 print
'<td class="liste_titre"></td>';
949if (!empty($arrayfields[
't.budget_amount'][
'checked'])) {
950 print
'<td class="liste_titre center">';
951 print
'<input type="text" class="flat" name="search_task_budget_amount" value="'.$search_task_budget_amount.
'" size="4">';
955if (!empty($arrayfields[
't.tobill'][
'checked'])) {
956 print
'<td class="liste_titre"></td>';
958if (!empty($arrayfields[
't.billed'][
'checked'])) {
959 print
'<td class="liste_titre"></td>';
962include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
964$parameters = array(
'arrayfields' => $arrayfields);
965$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
966print $hookmanager->resPrint;
967if (!empty($arrayfields[
't.datec'][
'checked'])) {
969 print
'<td class="liste_titre">';
972if (!empty($arrayfields[
't.tms'][
'checked'])) {
974 print
'<td class="liste_titre">';
979 print
'<td class="liste_titre center maxwidthsearch">';
980 $searchpicto = $form->showFilterButtons();
990 't.planned_workload' => 0,
991 't.duration_effective' => 0,
993 't.budget_amount' => 0,
995 'totalplannedworkload' => 0,
996 'totaldurationeffective' => 0,
997 'totaldurationdeclared' => 0,
998 'totaltobillfield' => 0,
999 'totalbilledfield' => 0,
1000 'totalbudget_amountfield' => 0,
1001 'totalbudgetamount' => 0,
1005 'totalizable' => [],
1010print
'<tr class="liste_titre">';
1013 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
1014 $totalarray[
'nbfield']++;
1016if (!empty($arrayfields[
't.ref'][
'checked'])) {
1017 print_liste_field_titre($arrayfields[
't.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"t.ref",
"", $param,
"", $sortfield, $sortorder);
1018 $totalarray[
'nbfield']++;
1020if (!empty($arrayfields[
't.fk_task_parent'][
'checked'])) {
1021 print_liste_field_titre($arrayfields[
't.fk_task_parent'][
'label'], $_SERVER[
"PHP_SELF"],
"t.fk_task_parent",
"", $param,
"", $sortfield, $sortorder);
1022 $totalarray[
'nbfield']++;
1024if (!empty($arrayfields[
't.label'][
'checked'])) {
1025 print_liste_field_titre($arrayfields[
't.label'][
'label'], $_SERVER[
"PHP_SELF"],
"t.label",
"", $param,
"", $sortfield, $sortorder);
1026 $totalarray[
'nbfield']++;
1028if (!empty($arrayfields[
't.description'][
'checked'])) {
1029 print_liste_field_titre($arrayfields[
't.description'][
'label'], $_SERVER[
"PHP_SELF"],
"t.description",
"", $param,
"", $sortfield, $sortorder);
1030 $totalarray[
'nbfield']++;
1032if (!empty($arrayfields[
't.dateo'][
'checked'])) {
1033 print_liste_field_titre($arrayfields[
't.dateo'][
'label'], $_SERVER[
"PHP_SELF"],
"t.dateo",
"", $param,
'', $sortfield, $sortorder,
'center ');
1034 $totalarray[
'nbfield']++;
1036if (!empty($arrayfields[
't.datee'][
'checked'])) {
1037 print_liste_field_titre($arrayfields[
't.datee'][
'label'], $_SERVER[
"PHP_SELF"],
"t.datee",
"", $param,
'', $sortfield, $sortorder,
'center ');
1038 $totalarray[
'nbfield']++;
1040if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1041 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"p.ref",
"", $param,
"", $sortfield, $sortorder);
1042 $totalarray[
'nbfield']++;
1044if (!empty($arrayfields[
'p.title'][
'checked'])) {
1045 print_liste_field_titre($arrayfields[
'p.title'][
'label'], $_SERVER[
"PHP_SELF"],
"p.title",
"", $param,
"", $sortfield, $sortorder);
1046 $totalarray[
'nbfield']++;
1048if (!empty($arrayfields[
's.nom'][
'checked'])) {
1049 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"s.nom",
"", $param,
"", $sortfield, $sortorder);
1050 $totalarray[
'nbfield']++;
1052if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1053 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
"PHP_SELF"],
"s.name_alias",
"", $param,
"", $sortfield, $sortorder);
1054 $totalarray[
'nbfield']++;
1056if (!empty($arrayfields[
'p.fk_statut'][
'checked'])) {
1057 print_liste_field_titre($arrayfields[
'p.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"p.fk_statut",
"", $param,
'', $sortfield, $sortorder,
'center ');
1058 $totalarray[
'nbfield']++;
1060if (!empty($arrayfields[
't.planned_workload'][
'checked'])) {
1061 print_liste_field_titre($arrayfields[
't.planned_workload'][
'label'], $_SERVER[
"PHP_SELF"],
"t.planned_workload",
"", $param,
'', $sortfield, $sortorder,
'center ');
1062 $totalarray[
'nbfield']++;
1064if (!empty($arrayfields[
't.duration_effective'][
'checked'])) {
1065 print_liste_field_titre($arrayfields[
't.duration_effective'][
'label'], $_SERVER[
"PHP_SELF"],
"t.duration_effective",
"", $param,
'', $sortfield, $sortorder,
'center ');
1066 $totalarray[
'nbfield']++;
1068if (!empty($arrayfields[
't.progress_calculated'][
'checked'])) {
1069 print_liste_field_titre($arrayfields[
't.progress_calculated'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"", $param,
'',
'',
'',
'center ');
1070 $totalarray[
'nbfield']++;
1072if (!empty($arrayfields[
't.progress'][
'checked'])) {
1073 print_liste_field_titre($arrayfields[
't.progress'][
'label'], $_SERVER[
"PHP_SELF"],
"t.progress",
"", $param,
'', $sortfield, $sortorder,
'center ');
1074 $totalarray[
'nbfield']++;
1076if (!empty($arrayfields[
't.progress_summary'][
'checked'])) {
1077 print_liste_field_titre($arrayfields[
't.progress_summary'][
'label'], $_SERVER[
"PHP_SELF"],
"t.progress",
"", $param,
'', $sortfield, $sortorder,
'center ');
1078 $totalarray[
'nbfield']++;
1080if (!empty($arrayfields[
't.budget_amount'][
'checked'])) {
1081 print_liste_field_titre($arrayfields[
't.budget_amount'][
'label'], $_SERVER[
"PHP_SELF"],
"t.budget_amount",
"", $param,
'', $sortfield, $sortorder,
'center ');
1082 $totalarray[
'nbfield']++;
1084if (!empty($arrayfields[
't.tobill'][
'checked'])) {
1086 print_liste_field_titre($arrayfields[
't.tobill'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"", $param,
'', $sortfield, $sortorder,
'center ');
1087 $totalarray[
'nbfield']++;
1089if (!empty($arrayfields[
't.billed'][
'checked'])) {
1090 print_liste_field_titre($arrayfields[
't.billed'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"", $param,
'', $sortfield, $sortorder,
'center ');
1091 $totalarray[
'nbfield']++;
1094include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1097 'arrayfields' => $arrayfields,
1099 'sortfield' => $sortfield,
1100 'sortorder' => $sortorder,
1101 'totalarray' => &$totalarray,
1103$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
1104print $hookmanager->resPrint;
1105if (!empty($arrayfields[
't.datec'][
'checked'])) {
1106 print_liste_field_titre($arrayfields[
't.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"t.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1107 $totalarray[
'nbfield']++;
1109if (!empty($arrayfields[
't.tms'][
'checked'])) {
1110 print_liste_field_titre($arrayfields[
't.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"t.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1111 $totalarray[
'nbfield']++;
1115 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
1116 $totalarray[
'nbfield']++;
1120$plannedworkloadoutputformat =
'allhourmin';
1121$timespentoutputformat =
'allhourmin';
1123 $plannedworkloadoutputformat =
getDolGlobalString(
'PROJECT_PLANNED_WORKLOAD_FORMAT');
1132$savnbfield = $totalarray[
'nbfield'];
1134$totalarray[
'nbfield'] = 0;
1135$imaxinloop = ($limit ? min($num, $limit) : $num);
1136while ($i < $imaxinloop) {
1137 $obj = $db->fetch_object($resql);
1146 $object->description = $obj->description;
1147 $object->status = $obj->status;
1148 $object->progress = $obj->progress;
1149 $object->budget_amount = $obj->budget_amount;
1150 $object->date_start = $db->jdate($obj->date_start);
1151 $object->date_end = $db->jdate($obj->date_end);
1152 $object->planned_workload = $obj->planned_workload;
1153 $object->duration_effective = $obj->duration_effective;
1154 $object->fk_task_parent = $obj->fk_task_parent;
1156 $projectstatic->id = $obj->projectid;
1157 $projectstatic->ref = $obj->projectref;
1158 $projectstatic->title = $obj->projecttitle;
1159 $projectstatic->public = $obj->public;
1160 $projectstatic->statut = $obj->projectstatus;
1161 $projectstatic->datee = $db->jdate($obj->projectdatee);
1164 $socstatic->id = $obj->socid;
1165 $socstatic->name = $obj->name;
1166 $socstatic->name_alias = $obj->alias;
1168 if ($mode ==
'kanban') {
1170 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
1171 print
'<div class="box-flex-container kanban">';
1174 if ($massactionbutton || $massaction) {
1176 if (in_array(
$object->id, $arrayofselected)) {
1181 $arraydata = array();
1182 $arraydata[
'projectlink'] = $projectstatic->getNomUrl(1);
1183 $arraydata[
'selected'] = in_array(
$object->id, $arrayofselected);
1185 print
$object->getKanbanView(
'', $arraydata);
1186 if ($i == ($imaxinloop - 1)) {
1191 $userAccess = $projectstatic->restrictedProjectArea($user);
1192 if ($userAccess >= 0) {
1195 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
1199 print
'<td class="nowrap center">';
1200 if ($massactionbutton || $massaction) {
1202 if (in_array(
$object->id, $arrayofselected)) {
1205 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1209 $totalarray[
'nbfield']++;
1213 if (!empty($arrayfields[
't.ref'][
'checked'])) {
1214 print
'<td class="nowraponall">';
1215 print
$object->getNomUrl(1,
'withproject');
1221 $totalarray[
'nbfield']++;
1225 if (!empty($arrayfields[
't.fk_task_parent'][
'checked'])) {
1226 print
'<td class="nowraponall">';
1227 if (!empty(
$object->fk_task_parent)) {
1228 $object_parent =
new Task($db);
1229 $result = $object_parent->fetch(
$object->fk_task_parent);
1233 print $object_parent->getNomUrl(1,
'withproject');
1234 if ($object_parent->hasDelay()) {
1241 $totalarray[
'nbfield']++;
1245 if (!empty($arrayfields[
't.label'][
'checked'])) {
1246 print
'<td class="tdoverflowmax200" title="'.dol_escape_htmltag(
$object->label).
'">';
1250 $totalarray[
'nbfield']++;
1254 if (!empty($arrayfields[
't.description'][
'checked'])) {
1259 $totalarray[
'nbfield']++;
1264 if (!empty($arrayfields[
't.dateo'][
'checked'])) {
1265 print
'<td class="center">';
1269 $totalarray[
'nbfield']++;
1273 if (!empty($arrayfields[
't.datee'][
'checked'])) {
1274 print
'<td class="center">';
1278 $totalarray[
'nbfield']++;
1282 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1283 print
'<td class="nowraponall tdoverflowmax150">';
1284 print $projectstatic->getNomUrl(1,
'task');
1285 if ($projectstatic->hasDelay()) {
1290 $totalarray[
'nbfield']++;
1294 if (!empty($arrayfields[
'p.title'][
'checked'])) {
1295 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->projecttitle).
'">';
1299 $totalarray[
'nbfield']++;
1303 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1304 print
'<td class="tdoverflowmax125">';
1306 print $socstatic->getNomUrl(1,
'', 0, 0, -1, empty($arrayfields[
's.name_alias'][
'checked']) ? 0 : 1);
1312 $totalarray[
'nbfield']++;
1316 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1319 $name_alias = $socstatic->name_alias;
1321 print
'<td class="tdoverflowmax125" title="'.dol_escape_htmltag($name_alias).
'">';
1325 $totalarray[
'nbfield']++;
1329 if (!empty($arrayfields[
'p.fk_statut'][
'checked'])) {
1330 print
'<td class="center">';
1331 print $projectstatic->getLibStatut(1);
1334 $totalarray[
'nbfield']++;
1339 if (!empty($arrayfields[
't.planned_workload'][
'checked'])) {
1340 print
'<td class="center">';
1343 if ($obj->planned_workload !=
'') {
1351 $totalarray[
'nbfield']++;
1354 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.planned_workload';
1356 if (!isset($totalarray[
'val'][
't.planned_workload'])) {
1357 $totalarray[
'val'][
't.planned_workload'] = 0;
1359 $totalarray[
'val'][
't.planned_workload'] += $obj->planned_workload;
1361 $totalarray[
'totalplannedworkloadfield'] = $totalarray[
'nbfield'];
1363 if (!isset($totalarray[
'totalplannedworkload'])) {
1364 $totalarray[
'totalplannedworkload'] = 0;
1366 $totalarray[
'totalplannedworkload'] += $obj->planned_workload;
1369 if (!empty($arrayfields[
't.duration_effective'][
'checked'])) {
1370 $showlineingray = 0;
1372 print
'<td class="center">';
1373 if ($showlineingray) {
1376 print
'<a href="'.DOL_URL_ROOT.
'/projet/tasks/time.php?id='.
$object->id.($showproject ?
'' :
'&withproject=1').
'">';
1378 if ($obj->duration_effective) {
1383 if ($showlineingray) {
1388 if (empty($arrayfields[
't.progress_calculated'][
'checked'])) {
1389 if ($obj->planned_workload || $obj->duration_effective) {
1390 if ($obj->planned_workload) {
1391 print
' <span class="opacitymedium">('.round(100 * $obj->duration_effective / $obj->planned_workload, 2).
' %)</span>';
1393 print $form->textwithpicto(
'', $langs->trans(
'WorkloadNotDefined'), 1,
'help');
1399 $totalarray[
'nbfield']++;
1402 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.duration_effective';
1404 if (!isset($totalarray[
'val'][
't.duration_effective'])) {
1405 $totalarray[
'val'][
't.duration_effective'] = 0;
1407 $totalarray[
'val'][
't.duration_effective'] += $obj->duration_effective;
1409 $totalarray[
'totaldurationeffectivefield'] = $totalarray[
'nbfield'];
1411 if (!isset($totalarray[
'totaldurationeffective'])) {
1412 $totalarray[
'totaldurationeffective'] = 0;
1414 $totalarray[
'totaldurationeffective'] += $obj->duration_effective;
1417 if (!empty($arrayfields[
't.progress_calculated'][
'checked'])) {
1418 print
'<td class="center">';
1419 if ($obj->planned_workload || $obj->duration_effective) {
1420 if ($obj->planned_workload) {
1421 print round(100 * $obj->duration_effective / $obj->planned_workload, 2).
' %';
1423 print $form->textwithpicto(
'', $langs->trans(
'WorkloadNotDefined'), 1,
'help');
1428 $totalarray[
'nbfield']++;
1431 $totalarray[
'totalprogress_calculatedfield'] = $totalarray[
'nbfield'];
1435 if (!empty($arrayfields[
't.progress'][
'checked'])) {
1436 print
'<td class="center">';
1437 if ($obj->progress !=
'') {
1442 $totalarray[
'nbfield']++;
1445 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.progress';
1447 if (!isset($totalarray[
'val'][
't.progress'])) {
1448 $totalarray[
'val'][
't.progress'] = 0;
1450 $totalarray[
'val'][
't.progress'] += ($obj->planned_workload * $obj->progress / 100);
1452 $totalarray[
'totalprogress_declaredfield'] = $totalarray[
'nbfield'];
1454 if (!isset($totalarray[
'totaldurationdeclared'])) {
1455 $totalarray[
'totaldurationdeclared'] = 0;
1457 $totalarray[
'totaldurationdeclared'] += $obj->planned_workload * $obj->progress / 100;
1460 if (!empty($arrayfields[
't.progress_summary'][
'checked'])) {
1461 print
'<td class="center">';
1467 $totalarray[
'nbfield']++;
1470 $totalarray[
'totalprogress_summary'] = $totalarray[
'nbfield'];
1474 if (!empty($arrayfields[
't.budget_amount'][
'checked'])) {
1475 print
'<td class="center">';
1477 print
'<span class="amount">'.price(
$object->budget_amount, 0, $langs, 1, 0, 0, $conf->currency).
'</span>';
1481 $totalarray[
'nbfield']++;
1484 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.budget_amount';
1486 $totalarray[
'val'][
't.budget_amount'] += $obj->budget_amount;
1488 $totalarray[
'totalbudget_amountfield'] = $totalarray[
'nbfield'];
1490 $totalarray[
'totalbudgetamount'] += $obj->budget_amount;
1493 if (!empty($arrayfields[
't.tobill'][
'checked'])) {
1494 print
'<td class="center">';
1495 if ($obj->usage_bill_time) {
1497 $totalarray[
'val'][
't.tobill'] += $obj->tobill;
1498 $totalarray[
'totaltobill'] += $obj->tobill;
1500 print
'<span class="opacitymedium">'.$langs->trans(
"NA").
'</span>';
1504 $totalarray[
'nbfield']++;
1507 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.tobill';
1510 $totalarray[
'totaltobillfield'] = $totalarray[
'nbfield'];
1514 if (!empty($arrayfields[
't.billed'][
'checked'])) {
1515 print
'<td class="center">';
1516 if ($obj->usage_bill_time) {
1518 $totalarray[
'val'][
't.billed'] += $obj->billed;
1519 $totalarray[
'totalbilled'] += $obj->billed;
1521 print
'<span class="opacitymedium">'.$langs->trans(
"NA").
'</span>';
1525 $totalarray[
'nbfield']++;
1528 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.billed';
1531 $totalarray[
'totalbilledfield'] = $totalarray[
'nbfield'];
1535 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
1537 $parameters = array(
'arrayfields' => $arrayfields,
'object' => $object,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
1538 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
1539 print $hookmanager->resPrint;
1541 if (!empty($arrayfields[
't.datec'][
'checked'])) {
1542 print
'<td class="center">';
1543 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
1546 $totalarray[
'nbfield']++;
1550 if (!empty($arrayfields[
't.tms'][
'checked'])) {
1551 print
'<td class="center">';
1552 print
dol_print_date($db->jdate($obj->date_modification),
'dayhour',
'tzuser');
1555 $totalarray[
'nbfield']++;
1566 print
'<td class="nowrap center">';
1567 if ($massactionbutton || $massaction) {
1569 if (in_array(
$object->id, $arrayofselected)) {
1572 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1576 $totalarray[
'nbfield']++;
1588if (!empty($totalarray[
'totalizable']) && is_array($totalarray[
'totalizable'])) {
1589 foreach ($totalarray[
'totalizable'] as $keytotalizable => $valtotalizable) {
1590 $totalarray[
'pos'][$valtotalizable[
'pos']] = $keytotalizable;
1591 $totalarray[
'val'][$keytotalizable] = $valtotalizable[
'total'];
1597if (isset($totalarray[
'totaldurationeffectivefield']) || isset($totalarray[
'totalplannedworkloadfield']) || isset($totalarray[
'totalprogress_calculatedfield'])
1598 || isset($totalarray[
'totaltobill']) || isset($totalarray[
'totalbilled']) || isset($totalarray[
'totalbudget'])) {
1599 print
'<tr class="liste_total">';
1601 while ($i < $totalarray[
'nbfield']) {
1604 if ((is_null($limit) || $num < $limit) && empty($offset)) {
1605 print
'<td>'.$langs->trans(
"Total").
'</td>';
1608 if (is_object($form)) {
1609 print $form->textwithpicto($langs->trans(
"Total"), $langs->transnoentitiesnoconv(
"Totalforthispage"));
1611 print $langs->trans(
"Totalforthispage");
1621 } elseif (isset($totalarray[
'totalplannedworkloadfield']) && $totalarray[
'totalplannedworkloadfield'] == $i) {
1622 print
'<td class="center">'.convertSecondToTime($totalarray[
'totalplannedworkload'], $plannedworkloadoutputformat).
'</td>';
1623 } elseif (isset($totalarray[
'totaldurationeffectivefield']) && $totalarray[
'totaldurationeffectivefield'] == $i) {
1624 print
'<td class="center">'.convertSecondToTime($totalarray[
'totaldurationeffective'], $timespentoutputformat).
'</td>';
1625 } elseif (isset($totalarray[
'totalprogress_calculatedfield']) && $totalarray[
'totalprogress_calculatedfield'] == $i) {
1626 print
'<td class="center">'.($totalarray[
'totalplannedworkload'] > 0 ? round(100 * $totalarray[
'totaldurationeffective'] / $totalarray[
'totalplannedworkload'], 2).
' %' :
'').
'</td>';
1627 } elseif (isset($totalarray[
'totalprogress_declaredfield']) && $totalarray[
'totalprogress_declaredfield'] == $i) {
1628 print
'<td class="center">'.($totalarray[
'totalplannedworkload'] > 0 ? round(100 * $totalarray[
'totaldurationdeclared'] / $totalarray[
'totalplannedworkload'], 2).
' %' :
'').
'</td>';
1629 } elseif (isset($totalarray[
'totaltobillfield']) && $totalarray[
'totaltobillfield'] == $i) {
1630 print
'<td class="center">'.convertSecondToTime($totalarray[
'totaltobill'], $plannedworkloadoutputformat).
'</td>';
1631 } elseif (isset($totalarray[
'totalbilledfield']) && $totalarray[
'totalbilledfield'] == $i) {
1632 print
'<td class="center">'.convertSecondToTime($totalarray[
'totalbilled'], $plannedworkloadoutputformat).
'</td>';
1633 } elseif (isset($totalarray[
'totalbudget_amountfield']) && $totalarray[
'totalbudget_amountfield'] == $i) {
1634 print
'<td class="center">'.price((
float) $totalarray[
'totalbudgetamount'], 0, $langs, 1, 0, 0, $conf->currency).
'</td>';
1635 } elseif (!empty($totalarray[
'pos'][$i])) {
1636 print
'<td class="right">';
1638 if (isset($totalarray[
'type']) && $totalarray[
'type'][$i] ==
'duration') {
1639 print(!empty($totalarray[
'val'][$totalarray[
'pos'][$i]]) ?
convertSecondToTime($totalarray[
'val'][$totalarray[
'pos'][$i]],
'allhourmin') : 0);
1641 print
price(!empty($totalarray[
'val'][$totalarray[
'pos'][$i]]) ? $totalarray[
'val'][$totalarray[
'pos'][$i]] : 0);
1653$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
1654$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
1655print $hookmanager->resPrint;
1657print
'</table>'.
"\n";
1660print
'</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.
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.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
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...
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.