diff --git a/apps/maarch_entreprise/documents_list_copies.php b/apps/maarch_entreprise/documents_list_copies.php
index 224a3135ccc1fd21b5c1e13b2495f52826a27421..54e840ec009ed46423f7e9ab06e6d08ebfb12547 100755
--- a/apps/maarch_entreprise/documents_list_copies.php
+++ b/apps/maarch_entreprise/documents_list_copies.php
@@ -159,8 +159,19 @@ if (!empty($order_field) && !empty($order)) {
 } else {
     if (!empty($_SESSION['current_basket']['basket_res_order'])) {
         if (count($arr_order) == 1) {
-            $list->setOrder();
-            $list->setOrderField($arr_order[0]);
+            $orders = explode(' ', $arr_order[0]);
+            if (!empty($orders[1])) {
+                $list->setOrder($orders[1]);
+            } else {
+                $list->setOrder();
+            }
+            $list->setOrderField($orders[0]);
+        }
+        $orderstr = 'order by '.str_replace('alt_identifier', 'order_alphanum(alt_identifier)', $_SESSION['current_basket']['basket_res_order']);
+        if (strpos($_SESSION['current_basket']['basket_res_order'], 'priority') !== false) {
+            $where .= ' and '.$table.'.priority = priorities.id';
+            $select['priorities'] = ['order', 'id'];
+            $orderstr = 'order by priorities.order '.$order;
         }
         $_SESSION['last_order_basket'] = $_SESSION['current_basket']['basket_res_order'];
     } else {
@@ -176,7 +187,7 @@ if (isset($_REQUEST['lines'])) {
     $limit = 'default';
 }
 //Request
-$tab = $request->PDOselect($select, $where, $arrayPDO, $orderstr, $_SESSION['config']['databasetype'], $limit, false, '', '', '', false, false, false, $_SESSION['save_list']['start']);
+$tab = $request->PDOselect($select, $where, $arrayPDO, $orderstr, $_SESSION['config']['databasetype'], $limit, false, '', '', '', false, false, 'distinct', $_SESSION['save_list']['start']);
 
 $_SESSION['current_basket']['last_query'] = array();
 $_SESSION['current_basket']['last_query']['select'] = $select;
diff --git a/apps/maarch_entreprise/documents_list_with_attachments.php b/apps/maarch_entreprise/documents_list_with_attachments.php
index e03355a86949655ddd207070c1cd768080be642f..0d3c577cb504d46bb6af7c4c60111ade75eee19f 100755
--- a/apps/maarch_entreprise/documents_list_with_attachments.php
+++ b/apps/maarch_entreprise/documents_list_with_attachments.php
@@ -158,10 +158,20 @@ if (!empty($order_field) && !empty($order)) {
 } else {
     if (!empty($_SESSION['current_basket']['basket_res_order'])) {
         if (count($arr_order) == 1) {
-            $list->setOrder();
-            $list->setOrderField($arr_order[0]);
+            $orders = explode(' ', $arr_order[0]);
+            if (!empty($orders[1])) {
+                $list->setOrder($orders[1]);
+            } else {
+                $list->setOrder();
+            }
+            $list->setOrderField($orders[0]);
         }
         $orderstr = 'order by '.str_replace('alt_identifier', 'order_alphanum(alt_identifier)', $_SESSION['current_basket']['basket_res_order']);
+        if (strpos($_SESSION['current_basket']['basket_res_order'], 'priority') !== false) {
+            $where .= ' and '.$table.'.priority = priorities.id';
+            $select['priorities'] = ['order', 'id'];
+            $orderstr = 'order by priorities.order '.$order;
+        }
         $_SESSION['last_order_basket'] = $_SESSION['current_basket']['basket_res_order'];
     } else {
         $list->setOrder();
diff --git a/modules/attachments/frame_list_attachments.php b/modules/attachments/frame_list_attachments.php
index 7357f4327602aef1c62e9b742ba9e4fa1cddf08b..f827b9a1b2ae0060c5c2a52af9a0edb477eab5df 100755
--- a/modules/attachments/frame_list_attachments.php
+++ b/modules/attachments/frame_list_attachments.php
@@ -115,8 +115,9 @@ if (!empty($order_field) && !empty($order)) {
     if ($_REQUEST['order_field'] == 'identifier') {
         $orderstr = "order by order_alphanum(identifier)"." ".$order;
     } else if ($_REQUEST['order_field'] == 'priority') {
+        $where .= ' and res_view_attachments.priority = priorities.id';
         $select['priorities'] = ['order', 'id'];
-        $orderstr = 'order by (select priorities.order from priorities where priorities.id = priority) '.$order;
+        $orderstr = 'order by priorities.order '.$order;
     } else {
         $orderstr = "order by ".$order_field." ".$order;
     }
diff --git a/modules/avis/documents_list_with_avis.php b/modules/avis/documents_list_with_avis.php
index 4c8476c8274c43dacbd7908c8de82affb25dd4b4..ba8d7eeaa5359b3e45bf372c98ce7c5a38b43314 100755
--- a/modules/avis/documents_list_with_avis.php
+++ b/modules/avis/documents_list_with_avis.php
@@ -152,10 +152,29 @@ if (!empty($order_field) && !empty($order)) {
     }
     $_SESSION['last_order_basket'] = $orderstr;
 } else {
-    $list->setOrder();
-    $list->setOrderField('modification_date');
-    $orderstr = 'order by modification_date desc';
-    $_SESSION['last_order_basket'] = $orderstr;
+    if (!empty($_SESSION['current_basket']['basket_res_order'])) {
+        if (count($arr_order) == 1) {
+            $orders = explode(' ', $arr_order[0]);
+            if (!empty($orders[1])) {
+                $list->setOrder($orders[1]);
+            } else {
+                $list->setOrder();
+            }
+            $list->setOrderField($orders[0]);
+        }
+        $orderstr = 'order by '.str_replace('alt_identifier', 'order_alphanum(alt_identifier)', $_SESSION['current_basket']['basket_res_order']);
+        if (strpos($_SESSION['current_basket']['basket_res_order'], 'priority') !== false) {
+            $where .= ' and '.$table.'.priority = priorities.id';
+            $select['priorities'] = ['order', 'id'];
+            $orderstr = 'order by priorities.order '.$order;
+        }
+        $_SESSION['last_order_basket'] = $_SESSION['current_basket']['basket_res_order'];
+    } else {
+        $list->setOrder();
+        $list->setOrderField('modification_date');
+        $orderstr = 'order by modification_date desc';
+        $_SESSION['last_order_basket'] = $orderstr;
+    }
 }
 if (isset($_REQUEST['lines'])) {
     $limit = $_REQUEST['lines'];
@@ -163,7 +182,7 @@ if (isset($_REQUEST['lines'])) {
     $limit = 'default';
 }
 //Request
-$tab = $request->PDOselect($select, $where, $arrayPDO, $orderstr, $_SESSION['config']['databasetype'], $limit, false, '', '', '', false, false, false, $_SESSION['save_list']['start']);
+$tab = $request->PDOselect($select, $where, $arrayPDO, $orderstr, $_SESSION['config']['databasetype'], $limit, false, '', '', '', false, false, 'distinct', $_SESSION['save_list']['start']);
 
 //Templates
 $defaultTemplate = 'documents_list_with_avis';
diff --git a/modules/visa/documents_list_with_signatory.php b/modules/visa/documents_list_with_signatory.php
index 7fbb39f26d72400bf5685e33c36f27bb5ee4ca08..c886afc5675bd44067fa8861911410766a2dc5d0 100755
--- a/modules/visa/documents_list_with_signatory.php
+++ b/modules/visa/documents_list_with_signatory.php
@@ -156,10 +156,20 @@ if (!empty($order_field) && !empty($order)) {
 } else {
     if (!empty($_SESSION['current_basket']['basket_res_order'])) {
         if (count($arr_order) == 1) {
-            $list->setOrder();
-            $list->setOrderField($arr_order[0]);
+            $orders = explode(' ', $arr_order[0]);
+            if (!empty($orders[1])) {
+                $list->setOrder($orders[1]);
+            } else {
+                $list->setOrder();
+            }
+            $list->setOrderField($orders[0]);
         }
         $orderstr = 'order by '.str_replace('alt_identifier', 'order_alphanum(alt_identifier)', $_SESSION['current_basket']['basket_res_order']);
+        if (strpos($_SESSION['current_basket']['basket_res_order'], 'priority') !== false) {
+            $where .= ' and '.$table.'.priority = priorities.id';
+            $select['priorities'] = ['order', 'id'];
+            $orderstr = 'order by priorities.order '.$order;
+        }
         $_SESSION['last_order_basket'] = $_SESSION['current_basket']['basket_res_order'];
     } else {
         $list->setOrder();