Fix #16523 : New column Contact assigned

This commit is contained in:
lmarcouiller 2021-03-04 10:15:41 +01:00
parent 43e58f70a1
commit 500f192a05
3 changed files with 25 additions and 10 deletions

View File

@ -1469,9 +1469,14 @@ class Contact extends CommonObject
$result .= $linkstart; $result .= $linkstart;
if ($withpicto) { 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 .= '<!-- picto photo user --><span class="nopadding userimg'.($moreparam ? ' '.$moreparam : '').'">'.Form::showphoto('contact', $this, 0, 0, 0, 'userphoto'.($withpicto == -3 ? 'small' : ''), 'mini', 0, 1).'</span>';
}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 .= ($maxlen ?dol_trunc($this->getFullName($langs), $maxlen) : $this->getFullName($langs));
} }
$result .= $linkend; $result .= $linkend;

View File

@ -807,8 +807,8 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
} }
// Contacts of task // Contacts of task
if (!empty($conf->global->PROJECT_SHOW_CONTACTS_IN_LIST)) { if (count($arrayfields) > 0 && !empty($arrayfields['c.assigned']['checked'])) {
print '<td>'; print '<td class="right">';
foreach (array('internal', 'external') as $source) { foreach (array('internal', 'external') as $source) {
$tab = $lines[$i]->liste_contact(-1, $source); $tab = $lines[$i]->liste_contact(-1, $source);
$num = count($tab); $num = count($tab);
@ -821,7 +821,15 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
$c = new Contact($db); $c = new Contact($db);
} }
$c->fetch($contacttask['id']); $c->fetch($contacttask['id']);
print $c->getNomUrl(1).' ('.$contacttask['libelle'].')<br>'; if(!empty($c->photo)){
print $c->getNomUrl(-2).'&nbsp;';
}else {
if (get_class($c) == 'User') {
print $c->getNomUrl(2,'',0,0,24,1);//.'&nbsp;';
}else {
print $c->getNomUrl(2);//.'&nbsp;';
}
}
} }
} }
} }
@ -966,7 +974,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
} }
} }
// Contacts of task // Contacts of task
if (!empty($conf->global->PROJECT_SHOW_CONTACTS_IN_LIST)) { if (count($arrayfields) > 0 && !empty($arrayfields['c.assigned']['checked'])) {
print '<td></td>'; print '<td></td>';
} }
print '<td class=""></td>'; print '<td class=""></td>';

View File

@ -137,6 +137,7 @@ $arrayfields = array(
't.progress_calculated'=>array('label'=>$langs->trans("ProgressCalculated"), 'checked'=>1, 'position'=>8), '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'=>array('label'=>$langs->trans("ProgressDeclared"), 'checked'=>1, 'position'=>9),
't.progress_summary'=>array('label'=>$langs->trans("TaskProgressSummary"), 'checked'=>1, 'position'=>10), '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) { if ($object->usage_bill_time) {
$arrayfields['t.tobill'] = array('label'=>$langs->trans("TimeToBill"), 'checked'=>0, 'position'=>11); $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)) { if (!empty($arrayfields['c.assigned']['checked'])) {
print '<td class="liste_titre"></td>'; print '<td class="liste_titre right">';
print '</td>';
} }
$extrafieldsobjectkey = $taskstatic->table_element; $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 '); print_liste_field_titre($arrayfields['t.billed']['label'], $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'right ');
} }
} }
if (!empty($conf->global->PROJECT_SHOW_CONTACTS_IN_LIST)) { if (!empty($arrayfields['c.assigned']['checked'])) {
print_liste_field_titre("TaskRessourceLinks", $_SERVER["PHP_SELF"], '', '', $param, $sortfield, $sortorder); print_liste_field_titre($arrayfields['c.assigned']['label'], $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'right ', '');
} }
// Extra fields // Extra fields
$disablesortlink = 1; $disablesortlink = 1;