diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 0c7f3ac73aa..ede8e6698dd 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -1469,9 +1469,13 @@ class Contact extends CommonObject $result .= $linkstart; if ($withpicto) { - $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); + if ($withpicto == -2) { + $result .= ''.Form::showphoto('contact', $this, 0, 0, 0, 'userphoto'.($withpicto == -3 ? 'small' : ''), 'mini', 0, 1).''; + } else { + $result .= img_object(($notooltip ? '' : $label), ( $this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); + } } - if ($withpicto != 2) { + if ($withpicto != 2 && $withpicto != -2) { $result .= ($maxlen ?dol_trunc($this->getFullName($langs), $maxlen) : $this->getFullName($langs)); } $result .= $linkend; diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 2b35c2c7779..c5820b42d89 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -806,7 +806,8 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t } } - // Contacts of task + // Contacts of tasks. Disabled, because available by default just after + /* if (!empty($conf->global->PROJECT_SHOW_CONTACTS_IN_LIST)) { print ''; foreach (array('internal', 'external') as $source) { @@ -826,6 +827,36 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t } } print ''; + }*/ + + // Contacts of task + if (count($arrayfields) > 0 && !empty($arrayfields['c.assigned']['checked'])) { + print ''; + foreach (array('internal', 'external') as $source) { + $tab = $lines[$i]->liste_contact(-1, $source); + $num = count($tab); + if (!empty($num)) { + foreach ($tab as $contacttask) { + //var_dump($contacttask); + if ($source == 'internal') { + $c = new User($db); + } else { + $c = new Contact($db); + } + $c->fetch($contacttask['id']); + if (!empty($c->photo)) { + print $c->getNomUrl(-2).' '; + } else { + if (get_class($c) == 'User') { + print $c->getNomUrl(2, '', 0, 0, 24, 1);//.' '; + } else { + print $c->getNomUrl(2);//.' '; + } + } + } + } + } + print ''; } // Extra fields @@ -965,10 +996,14 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t print ''; } } - // Contacts of task + // Contacts of task for backward compatibility, if (!empty($conf->global->PROJECT_SHOW_CONTACTS_IN_LIST)) { print ''; } + // Contacts of task + if (count($arrayfields) > 0 && !empty($arrayfields['c.assigned']['checked'])) { + print ''; + } print ''; print ''; } diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index fe333a2d01e..9c642e4a03a 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -137,6 +137,7 @@ $arrayfields = array( 't.progress_calculated'=>array('label'=>$langs->trans("ProgressCalculated"), 'checked'=>1, 'position'=>8), 't.progress'=>array('label'=>$langs->trans("ProgressDeclared"), 'checked'=>1, 'position'=>9), 't.progress_summary'=>array('label'=>$langs->trans("TaskProgressSummary"), 'checked'=>1, 'position'=>10), + 'c.assigned'=>array('label'=>$langs->trans("TaskRessourceLinks"), 'checked'=>1, 'position'=>11), ); if ($object->usage_bill_time) { $arrayfields['t.tobill'] = array('label'=>$langs->trans("TimeToBill"), 'checked'=>0, 'position'=>11); @@ -808,10 +809,17 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third print ''; } } - + // Contacts of task, disabled because available by default jsut after + /* if (!empty($conf->global->PROJECT_SHOW_CONTACTS_IN_LIST)) { print ''; } + */ + + if (!empty($arrayfields['c.assigned']['checked'])) { + print ''; + print ''; + } $extrafieldsobjectkey = $taskstatic->table_element; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; @@ -863,9 +871,15 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third print_liste_field_titre($arrayfields['t.billed']['label'], $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'right '); } } + // Contacts of task, disabled because available by default jsut after + /* if (!empty($conf->global->PROJECT_SHOW_CONTACTS_IN_LIST)) { print_liste_field_titre("TaskRessourceLinks", $_SERVER["PHP_SELF"], '', '', $param, $sortfield, $sortorder); } + */ + if (!empty($arrayfields['c.assigned']['checked'])) { + print_liste_field_titre($arrayfields['c.assigned']['label'], $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'right ', ''); + } // Extra fields $disablesortlink = 1; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';