From 1ea913786375746e064618c9e394f6095108329e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 25 Nov 2017 16:21:44 +0100 Subject: [PATCH] Fix sort order --- htdocs/core/class/html.formactions.class.php | 33 +++++++++++++------- htdocs/core/db/DoliDB.class.php | 6 ++-- 2 files changed, 24 insertions(+), 15 deletions(-) diff --git a/htdocs/core/class/html.formactions.class.php b/htdocs/core/class/html.formactions.class.php index 1f259bbee7a..de3c600af11 100644 --- a/htdocs/core/class/html.formactions.class.php +++ b/htdocs/core/class/html.formactions.class.php @@ -168,7 +168,7 @@ class FormActions require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; $sortfield='a.datep,a.id'; - $sortorder='DESC'; + $sortorder='DESC,DESC'; $listofactions=ActionComm::getActions($this->db, $socid, $object->id, $typeelement, '', $sortfield, $sortorder, ($max?($max+1):0)); if (! is_array($listofactions)) dol_print_error($this->db,'FailedToGetActions'); @@ -227,7 +227,9 @@ class FormActions $label=$action->getNomUrl(0,38); print ''; + // Ref print ''.$ref.''; + // Onwer print ''; if (! empty($action->userownerid)) { @@ -235,20 +237,27 @@ class FormActions print $userstatic->getNomUrl(-1, '', 0, 0, 16, 0, '', ''); } print ''; - print ''; - if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) - { - if ($action->type_picto) print img_picto('', $action->type_picto); - else { - if ($action->type_code == 'AC_RDV') print img_picto('', 'object_group').' '; - if ($action->type_code == 'AC_TEL') print img_picto('', 'object_phoning').' '; - if ($action->type_code == 'AC_FAX') print img_picto('', 'object_phoning_fax').' '; - if ($action->type_code == 'AC_EMAIL') print img_picto('', 'object_email').' '; - } - } + // Type + print ''; + $imgpicto=''; + if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) + { + if ($action->type_picto) $imgpicto=img_picto('', $action->type_picto); + else { + if ($action->type_code == 'AC_RDV') $imgpicto=img_picto('', 'object_group', '', false, 0, 0, '', 'paddingright').' '; + elseif ($action->type_code == 'AC_TEL') $imgpicto=img_picto('', 'object_phoning', '', false, 0, 0, '', 'paddingright').' '; + elseif ($action->type_code == 'AC_FAX') $imgpicto=img_picto('', 'object_phoning_fax', '', false, 0, 0, '', 'paddingright').' '; + elseif ($action->type_code == 'AC_EMAIL') $imgpicto=img_picto('', 'object_email', '', false, 0, 0, '', 'paddingright').' '; + elseif ($action->type_code == 'AC_INT') $imgpicto=img_picto('', 'object_intervention', '', false, 0, 0, '', 'paddingright').' '; + elseif (! preg_match('/_AUTO/', $action->type_code)) $imgpicto=img_picto('', 'object_action', '', false, 0, 0, '', 'paddingright').' '; + } + } + print $imgpicto; print $action->type_short ? $action->type_short : $action->type; print ''; + // Label print ''.$label.''; + // Date print ''.dol_print_date($action->datep, 'dayhour', 'tzuserrel'); if ($action->datef) { diff --git a/htdocs/core/db/DoliDB.class.php b/htdocs/core/db/DoliDB.class.php index fa87fb3a4d6..64f84471e40 100644 --- a/htdocs/core/db/DoliDB.class.php +++ b/htdocs/core/db/DoliDB.class.php @@ -220,9 +220,9 @@ abstract class DoliDB implements Database /** * Define sort criteria of request * - * @param string $sortfield List of sort fields, separated by comma. Example: 't1.fielda, t2.fieldb' - * @param 'ASC'|'DESC' $sortorder Sort order - * @return string String to provide syntax of a sort sql string + * @param string $sortfield List of sort fields, separated by comma. Example: 't1.fielda, t2.fieldb' + * @param string $sortorder Sort order, separated by comma. Example: 'ASC, DESC'; + * @return string String to provide syntax of a sort sql string */ function order($sortfield=null,$sortorder=null) {