Hi,

This patch adds an hidden option ( PROJECT_HIDE_UNSELECTABLES / 1 is active) to hide unselectables projects (linked to another 3rd) in dropdown list. Previously, they were displayed as greyed entries, which, in case of numerous projects, makes the selection not easy at all.

Not sure if i'll not add, later, a product/third-party like options (a textfield with dynamic search, after x characters) but for now it is doing the job.

Graveen
# This patch file was generated by NetBeans IDE
# It uses platform neutral UTF-8 encoding and \n newlines.
--- HEAD
+++ Modified In Working Tree
@@ -155,6 +155,9 @@
 {
        global $db,$user,$conf,$langs;
 
+   $hideunselectables = false;
+   if ($conf->global->PROJECT_HIDE_UNSELECTABLES == 1) $hideunselectables = 
true;
+
        $projectstatic=new Project($db);
        $projectsListId = '';
        if (empty($user->rights->projet->all->lire))
@@ -203,7 +206,6 @@
                                        else
                                        {
                                                $disabled=0;
-                                               print '<option 
value="'.$obj->rowid.'"';
                                                if (! $obj->fk_statut > 0)
                                                {
                                                        $disabled=1;
@@ -214,11 +216,17 @@
                                                        $disabled=1;
                                                        $labeltoshow.=' - 
'.$langs->trans("LinkedToAnotherCompany");
                                                }
-                                               if ($disabled==1) print ' 
disabled="disabled"';
+                                               $resultat = '<option 
value="'.$obj->rowid.'"';
+                                               if ($disabled==1) $resultat .=' 
disabled="disabled"';
                                                else $labeltoshow.=' - 
'.dol_trunc($obj->title,12);
+
                                                //if ($obj->public) 
$labeltoshow.=' ('.$langs->trans("Public").')';
                                                //else $labeltoshow.=' 
('.$langs->trans("Private").')';
-                                               print 
'>'.$labeltoshow.'</option>';
\ No newline at end of file
+                                               
+                       if ($hideunselectables && $disabled==1) $resultat="";
+                       else $resultat.='>'.$labeltoshow.'</option>';
+
+                       print $resultat;
\ No newline at end of file
                                        }
                                }
                                $i++;
_______________________________________________
Dolibarr-dev mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/dolibarr-dev

Répondre à