Factorize code
This commit is contained in:
parent
bd58e96430
commit
8de1b4c94e
@ -743,7 +743,7 @@ class ActionComm extends CommonObject
|
||||
$sql .= " a.fk_element as elementid, a.elementtype,";
|
||||
$sql .= " a.priority, a.fulldayevent, a.location, a.transparency,";
|
||||
$sql .= " a.email_msgid, a.email_subject, a.email_from, a.email_to, a.email_tocc, a.email_tobcc, a.errors_to,";
|
||||
$sql .= " c.id as type_id, c.code as type_code, c.libelle as type_label, c.color as type_color, c.picto as type_picto,";
|
||||
$sql .= " c.id as type_id, c.type as type_type, c.code as type_code, c.libelle as type_label, c.color as type_color, c.picto as type_picto,";
|
||||
$sql .= " s.nom as socname,";
|
||||
$sql .= " u.firstname, u.lastname as lastname,";
|
||||
$sql .= " num_vote, event_paid, a.status";
|
||||
@ -779,8 +779,9 @@ class ActionComm extends CommonObject
|
||||
$this->type_code = $obj->type_code;
|
||||
$this->type_color = $obj->type_color;
|
||||
$this->type_picto = $obj->type_picto;
|
||||
$transcode = $langs->trans("Action".$obj->type_code);
|
||||
$this->type = (($transcode != "Action".$obj->type_code) ? $transcode : $obj->type_label);
|
||||
$this->type = $obj->type_type;
|
||||
/*$transcode = $langs->trans("Action".$obj->type_code);
|
||||
$this->type = (($transcode != "Action".$obj->type_code) ? $transcode : $obj->type_label); */
|
||||
$transcode = $langs->trans("Action".$obj->type_code.'Short');
|
||||
$this->type_short = (($transcode != "Action".$obj->type_code.'Short') ? $transcode : '');
|
||||
|
||||
|
||||
@ -183,6 +183,10 @@ class FormActions
|
||||
dol_print_error($this->db, 'FailedToGetActions');
|
||||
}
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/cactioncomm.class.php';
|
||||
$caction = new CActionComm($this->db);
|
||||
$arraylist = $caction->liste_array(1, 'code', '', (empty($conf->global->AGENDA_USE_EVENT_TYPE) ? 1 : 0), '', 1);
|
||||
|
||||
$num = count($listofactions);
|
||||
if ($num || $forceshowtitle) {
|
||||
if ($typeelement == 'invoice') {
|
||||
@ -275,14 +279,25 @@ class FormActions
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
$actionstatic = $actioncomm;
|
||||
// Type
|
||||
print '<td>';
|
||||
print $actioncomm->getTypePicto();
|
||||
if ($actioncomm->type_code == 'AC_OTH' && $actioncomm->code == 'TICKET_MSG') {
|
||||
print $langs->trans("Message");
|
||||
} else {
|
||||
print $actioncomm->type_short ? $actioncomm->type_short : $actioncomm->type;
|
||||
$labeltype = $actionstatic->type_code;
|
||||
if (empty($conf->global->AGENDA_USE_EVENT_TYPE) && empty($arraylist[$labeltype])) {
|
||||
$labeltype = 'AC_OTH';
|
||||
}
|
||||
if ($actionstatic->type_code == 'AC_OTH' && $actionstatic->code == 'TICKET_MSG') {
|
||||
$labeltype = $langs->trans("Message");
|
||||
} else {
|
||||
if (!empty($arraylist[$labeltype])) {
|
||||
$labeltype = $arraylist[$labeltype];
|
||||
}
|
||||
if ($actionstatic->type_code == 'AC_OTH_AUTO' && ($actionstatic->type_code != $actionstatic->code) && $labeltype && !empty($arraylist[$actionstatic->code])) {
|
||||
$labeltype .= ' - '.$arraylist[$actionstatic->code]; // Use code in priority on type_code
|
||||
}
|
||||
}
|
||||
print '<td class="tdoverflowmax100" title="'.$labeltype.'">';
|
||||
print $actioncomm->getTypePicto();
|
||||
print $labeltype;
|
||||
print '</td>';
|
||||
|
||||
// Label
|
||||
|
||||
@ -1783,31 +1783,6 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
|
||||
$out .= '</td>';
|
||||
|
||||
// Type
|
||||
$out .= '<td>';
|
||||
// TODO Code common with code into showactions
|
||||
$imgpicto = '';
|
||||
if (!empty($conf->global->AGENDA_USE_EVENT_TYPE)) {
|
||||
if ($actionstatic->type_picto) {
|
||||
$imgpicto .= img_picto('', $actionstatic->type_picto);
|
||||
} else {
|
||||
if ($actionstatic->type_code == 'AC_RDV') {
|
||||
$imgpicto .= img_picto('', 'object_group', '', false, 0, 0, '', 'paddingright').' ';
|
||||
} elseif ($actionstatic->type_code == 'AC_TEL') {
|
||||
$imgpicto .= img_picto('', 'object_phoning', '', false, 0, 0, '', 'paddingright').' ';
|
||||
} elseif ($actionstatic->type_code == 'AC_FAX') {
|
||||
$imgpicto .= img_picto('', 'object_phoning_fax', '', false, 0, 0, '', 'paddingright').' ';
|
||||
} elseif ($actionstatic->type_code == 'AC_EMAIL' || $actionstatic->type_code == 'AC_EMAIL_IN') {
|
||||
$imgpicto .= img_picto('', 'object_email', '', false, 0, 0, '', 'paddingright').' ';
|
||||
} elseif ($actionstatic->type_code == 'AC_INT') {
|
||||
$imgpicto .= img_picto('', 'object_intervention', '', false, 0, 0, '', 'paddingright').' ';
|
||||
} elseif ($actionstatic->type_code == 'AC_OTH' && $actionstatic->code == 'TICKET_MSG') {
|
||||
$imgpicto = img_picto('', 'object_conversation', '', false, 0, 0, '', 'paddingright').' ';
|
||||
} elseif (!preg_match('/_AUTO/', $actionstatic->type_code)) {
|
||||
$imgpicto .= img_picto('', 'object_action', '', false, 0, 0, '', 'paddingright').' ';
|
||||
}
|
||||
}
|
||||
}
|
||||
$out .= $imgpicto;
|
||||
$labeltype = $actionstatic->type_code;
|
||||
if (empty($conf->global->AGENDA_USE_EVENT_TYPE) && empty($arraylist[$labeltype])) {
|
||||
$labeltype = 'AC_OTH';
|
||||
@ -1822,7 +1797,9 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
|
||||
$labeltype .= ' - '.$arraylist[$actionstatic->code]; // Use code in priority on type_code
|
||||
}
|
||||
}
|
||||
$out .= dol_trunc($labeltype, 28);
|
||||
$out .= '<td class="tdoverflowmax200" title="'.$labeltype.'">';
|
||||
$out .= $actionstatic->getTypePicto();
|
||||
$out .= $labeltype;
|
||||
$out .= '</td>';
|
||||
|
||||
// Title
|
||||
|
||||
Loading…
Reference in New Issue
Block a user