diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 81f14683383..faa7c5ee6c2 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -2669,7 +2669,8 @@ function getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $m
$sortorder=strtoupper($sortorder);
$out='';
-
+ $sortimg='';
+
$tag='th';
if ($thead==2) $tag='div';
@@ -2678,25 +2679,33 @@ function getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $m
if ($field && ($sortfield == $field || $sortfield == preg_replace("/^[^\.]+\./","",$field))) $out.= '<'.$tag.' class="'.$prefix.'liste_titre_sel" '. $moreattrib.'>';
else $out.= '<'.$tag.' class="'.$prefix.'liste_titre" '. $moreattrib.'>';
- if (! empty($conf->dol_optimize_smallscreen) && empty($thead) && $field) // If this is a sort field
+ if (empty($thead) && $field) // If this is a sort field
{
$options=preg_replace('/sortfield=([a-zA-Z0-9,\s\.]+)/i','',$moreparam);
$options=preg_replace('/sortorder=([a-zA-Z0-9,\s\.]+)/i','',$options);
$options=preg_replace('/&+/i','&',$options);
if (! preg_match('/^&/',$options)) $options='&'.$options;
- if ($sortorder == 'DESC' ) $out.= '';
- if ($sortorder == 'ASC' ) $out.= '';
+ if ($field != $sortfield)
+ {
+ if ($sortorder == 'DESC') $out.= '';
+ if ($sortorder == 'ASC' || ! $sortorder) $out.= '';
+ }
+ else
+ {
+ if ($sortorder == 'DESC' || ! $sortorder) $out.= '';
+ if ($sortorder == 'ASC') $out.= '';
+ }
}
$out.=$name;
- if (! empty($conf->dol_optimize_smallscreen) && empty($thead) && $field) // If this is a sort field
+ if (empty($thead) && $field) // If this is a sort field
{
$out.='';
}
- if (empty($conf->dol_optimize_smallscreen) && empty($thead) && $field) // If this is a sort field
+ if (empty($thead) && $field) // If this is a sort field
{
$options=preg_replace('/sortfield=([a-zA-Z0-9,\s\.]+)/i','',$moreparam);
$options=preg_replace('/sortorder=([a-zA-Z0-9,\s\.]+)/i','',$options);
@@ -2704,27 +2713,33 @@ function getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $m
if (! preg_match('/^&/',$options)) $options='&'.$options;
//print " ";
- $out.= '
';
+ $sortimg.= '
';
+ $sortimg.= '';
if (! $sortorder || $field != $sortfield)
{
- $out.= ''.img_down("A-Z",0).'';
- $out.= ''.img_up("Z-A",0).'';
+ //$out.= ''.img_down("A-Z",0).'';
+ //$out.= ''.img_up("Z-A",0).'';
}
else
{
if ($sortorder == 'DESC' ) {
- $out.= ''.img_down("A-Z",0).'';
- $out.= ''.img_up("Z-A",1).'';
+ //$out.= ''.img_down("A-Z",0).'';
+ //$out.= ''.img_up("Z-A",1).'';
+ $sortimg.= img_up("Z-A",0);
}
if ($sortorder == 'ASC' ) {
- $out.= ''.img_down("A-Z",1).'';
- $out.= ''.img_up("Z-A",0).'';
+ //$out.= ''.img_down("A-Z",1).'';
+ //$out.= ''.img_up("Z-A",0).'';
+ $sortimg.= img_down("A-Z",0);
}
}
- $out.= '';
+ $sortimg.= '';
}
+
+ $out.=$sortimg;
+
$out.=''.$tag.'>';
return $out;
diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php
index 5e73552e231..80e4c553dc1 100644
--- a/htdocs/societe/list.php
+++ b/htdocs/societe/list.php
@@ -333,13 +333,6 @@ if ($resql)
$moreforfilter.=$langs->trans('SalesRepresentatives'). ': ';
$moreforfilter.=$htmlother->select_salesrepresentatives($search_sale,'search_sale',$user);
$moreforfilter.='';
- }
- if ($moreforfilter)
- {
- print '