From d8b0c382f91333a82d1c2a83cd9704c849c5060d Mon Sep 17 00:00:00 2001
From: Alex Orluc <alex.orluc@maarch.org>
Date: Fri, 10 Feb 2017 16:35:10 +0100
Subject: [PATCH] FIX #5207 fix order by identifier

---
 .../indexing_searching/documents_list_mlb_search_adv.php      | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/apps/maarch_entreprise/indexing_searching/documents_list_mlb_search_adv.php b/apps/maarch_entreprise/indexing_searching/documents_list_mlb_search_adv.php
index 20c8f2f0d7b..3b7d1b2301d 100644
--- a/apps/maarch_entreprise/indexing_searching/documents_list_mlb_search_adv.php
+++ b/apps/maarch_entreprise/indexing_searching/documents_list_mlb_search_adv.php
@@ -229,7 +229,7 @@ if($mode == 'normal') {
     array_push($select[$view],  "res_id", "res_id as is_labeled", "status", "subject", "category_id as category_img", 
                                 "contact_firstname", "contact_lastname", "contact_society", 
                                 "user_lastname", "user_firstname", "dest_user", "type_label", 
-                                "creation_date", "entity_label", "category_id, exp_user_id", "alt_identifier", "count_attachment", "is_multicontacts", "priority");
+                                "creation_date", "entity_label", "category_id, exp_user_id", "alt_identifier", "count_attachment", "is_multicontacts", "priority", "address_id");
     //Cases
     if($core_tools->is_module_loaded("cases") == true) {
         array_push($select[$view], "case_id", "case_label", "case_description");
@@ -312,7 +312,7 @@ if($mode == 'normal') {
 
     if (!empty($order_field) && !empty($order)){
         if($_REQUEST['order_field'] == 'alt_identifier'){
-            $orderstr = "order by regexp_replace(alt_identifier, '[^a-zA-Z]', '', 'g') ".$order.", regexp_replace(alt_identifier, '[^0-9]', '', 'g')::bigint"." ".$order;
+            $orderstr = "order by order_alphanum(alt_identifier)"." ".$order;
         }else{
             $orderstr = "order by ".$order_field." ".$order;
         }
-- 
GitLab