From 4dd84122a6528d100eacf89f5c770ebaf8be9f33 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@users.sourceforge.net>
Date: Sat, 18 Dec 2010 23:49:40 +0000
Subject: [PATCH] Fix: New product status was not visible on all tabs.

---
 htdocs/admin/fournisseur.php                     |  2 +-
 htdocs/admin/modules.php                         | 16 ++++++++++++----
 htdocs/compta/paiement/rapport.php               |  2 +-
 .../includes/modules/export/modules_export.php   |  2 +-
 4 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/htdocs/admin/fournisseur.php b/htdocs/admin/fournisseur.php
index fe2d577478c..7feb6078153 100644
--- a/htdocs/admin/fournisseur.php
+++ b/htdocs/admin/fournisseur.php
@@ -549,7 +549,7 @@ if (is_resource($handle))
     		print "</tr>\n";
     	}
     }
-    close($handle);
+    closedir($handle);
 }
 
 print '</table><br/>';
diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php
index 7b9a69256d9..86c6b0aefa8 100644
--- a/htdocs/admin/modules.php
+++ b/htdocs/admin/modules.php
@@ -149,7 +149,8 @@ foreach ($conf->file->dol_document_root as $dirroot)
 
 asort($orders);
 //var_dump($orders);
-
+//var_dump($categ);
+//var_dump($modules);
 
 // Affichage debut page
 
@@ -246,6 +247,7 @@ if ($mode != 4)
     'technic'=>$langs->trans("ModuleFamilyTechnic"),
     'other'=>$langs->trans("ModuleFamilyOther")
     );
+    
     foreach ($orders as $key => $value)
     {
         $tab=explode('_',$value);
@@ -253,9 +255,15 @@ if ($mode != 4)
 
         $modName = $filename[$key];
     	$objMod  = $modules[$key];
-
-        if ($objMod->special != $mode) continue;    // Discard if not for tab
-
+    	//var_dump($objMod);
+    	
+    	if ($objMod->special != $mode) continue;    // Discard if not for tab
+        if (! $objMod->getName())
+        {
+        	dol_syslog("Error for module ".$key." - Property name of module looks empty", LOG_WARNING);
+      		continue;  	
+        }
+    	
         $const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i','',get_class($objMod)));
 
         // Load all lang files of module
diff --git a/htdocs/compta/paiement/rapport.php b/htdocs/compta/paiement/rapport.php
index fe25de6f5ac..0f5a4cc5f4f 100644
--- a/htdocs/compta/paiement/rapport.php
+++ b/htdocs/compta/paiement/rapport.php
@@ -181,7 +181,7 @@ if ($year)
                     print '<td align="right">'.dol_print_date(dol_filemtime($tfile),"dayhour").'</td></tr>';
                 }
             }
-            close($handle);
+            closedir($handle);
         }
         print '</table>';
     }
diff --git a/htdocs/includes/modules/export/modules_export.php b/htdocs/includes/modules/export/modules_export.php
index 814e45ccdab..8c5d62a7e3b 100644
--- a/htdocs/includes/modules/export/modules_export.php
+++ b/htdocs/includes/modules/export/modules_export.php
@@ -92,7 +92,7 @@ class ModeleExports
     				$i++;
     			}
     		}
-    		close($handle);
+    		closedir($handle);
         }
 		return $this->driverlabel;
 	}
-- 
GitLab