Merge pull request #16532 from Hystepik/develop#1

Close #16523 : New column Contact assigned
This commit is contained in:
Laurent Destailleur 2021-03-04 16:52:20 +01:00 committed by GitHub
commit 8189106627
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 58 additions and 5 deletions

View File

@ -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 .= '<!-- 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 {
$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;

View File

@ -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 '<td>';
foreach (array('internal', 'external') as $source) {
@ -826,6 +827,36 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
}
}
print '</td>';
}*/
// Contacts of task
if (count($arrayfields) > 0 && !empty($arrayfields['c.assigned']['checked'])) {
print '<td>';
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).'&nbsp;';
} else {
if (get_class($c) == 'User') {
print $c->getNomUrl(2, '', 0, 0, 24, 1);//.'&nbsp;';
} else {
print $c->getNomUrl(2);//.'&nbsp;';
}
}
}
}
}
print '</td>';
}
// Extra fields
@ -965,10 +996,14 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
print '</td>';
}
}
// Contacts of task
// Contacts of task for backward compatibility,
if (!empty($conf->global->PROJECT_SHOW_CONTACTS_IN_LIST)) {
print '<td></td>';
}
// Contacts of task
if (count($arrayfields) > 0 && !empty($arrayfields['c.assigned']['checked'])) {
print '<td></td>';
}
print '<td class=""></td>';
print '</tr>';
}

View File

@ -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 '</td>';
}
}
// Contacts of task, disabled because available by default jsut after
/*
if (!empty($conf->global->PROJECT_SHOW_CONTACTS_IN_LIST)) {
print '<td class="liste_titre"></td>';
}
*/
if (!empty($arrayfields['c.assigned']['checked'])) {
print '<td class="liste_titre right">';
print '</td>';
}
$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';