From 500f192a05d8f5f838c58aafe190af0c077e3495 Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Thu, 4 Mar 2021 10:15:41 +0100 Subject: [PATCH] Fix #16523 : New column Contact assigned --- htdocs/contact/class/contact.class.php | 9 +++++++-- htdocs/core/lib/project.lib.php | 16 ++++++++++++---- htdocs/projet/tasks.php | 10 ++++++---- 3 files changed, 25 insertions(+), 10 deletions(-) diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 0c7f3ac73aa..67c098210f5 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -1469,9 +1469,14 @@ 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 { + $picto = $this->picto; + $result .= img_object(($notooltip ? '' : $label), ($picto ? $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..4e2efcecd26 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -807,8 +807,8 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t } // Contacts of task - if (!empty($conf->global->PROJECT_SHOW_CONTACTS_IN_LIST)) { - print ''; + 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); @@ -821,7 +821,15 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t $c = new Contact($db); } $c->fetch($contacttask['id']); - print $c->getNomUrl(1).' ('.$contacttask['libelle'].')
'; + 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);//.' '; + } + } } } } @@ -966,7 +974,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t } } // Contacts of task - if (!empty($conf->global->PROJECT_SHOW_CONTACTS_IN_LIST)) { + if (count($arrayfields) > 0 && !empty($arrayfields['c.assigned']['checked'])) { print ''; } print ''; diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index fe333a2d01e..ec62952ff30 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); @@ -809,8 +810,9 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third } } - if (!empty($conf->global->PROJECT_SHOW_CONTACTS_IN_LIST)) { - print ''; + if (!empty($arrayfields['c.assigned']['checked'])) { + print ''; + print ''; } $extrafieldsobjectkey = $taskstatic->table_element; @@ -863,8 +865,8 @@ 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 '); } } - 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;