From 6afe8962bf2f8ac03eb4f920ac6aa50a5dcc62f0 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@users.sourceforge.net>
Date: Wed, 29 Sep 2010 08:45:45 +0000
Subject: [PATCH] Removed specific code for auguria

---
 htdocs/admin/menus.php                        | 69 +++++++++----------
 ...it_menu_base.sql => init_menu_auguria.sql} |  0
 2 files changed, 34 insertions(+), 35 deletions(-)
 rename htdocs/includes/menus/{init_menu_base.sql => init_menu_auguria.sql} (100%)

diff --git a/htdocs/admin/menus.php b/htdocs/admin/menus.php
index ac862a4b51e..088181b4b79 100644
--- a/htdocs/admin/menus.php
+++ b/htdocs/admin/menus.php
@@ -75,27 +75,20 @@ if (isset($_POST["action"]) && $_POST["action"] == 'update' && empty($_POST["can
 	$listofmenuhandler[preg_replace('/((_back|_front)office)?\.php/i','',$_POST["main_menufront_barretop"])]=1;
 	$listofmenuhandler[preg_replace('/((_back|_front)office)?\.php/i','',$_POST["main_menu_barreleft"])]=1;
 	$listofmenuhandler[preg_replace('/((_back|_front)office)?\.php/i','',$_POST["main_menufront_barreleft"])]=1;
-	$listofmenuhandler[preg_replace('/((_back|_front)office)?\.php/i','',$_POST["main_menu_smartphone"])]=1;
-	$listofmenuhandler[preg_replace('/((_back|_front)office)?\.php/i','',$_POST["main_menufront_smartphone"])]=1;
+	if (isset($_POST["main_menu_smartphone"]))      $listofmenuhandler[preg_replace('/((_back|_front)office)?\.php/i','',$_POST["main_menu_smartphone"])]=1;
+	if (isset($_POST["main_menufront_smartphone"])) $listofmenuhandler[preg_replace('/((_back|_front)office)?\.php/i','',$_POST["main_menufront_smartphone"])]=1;
+
+	// Initialize menu handlers
 	foreach ($listofmenuhandler as $key => $val)
 	{
 		$dir = DOL_DOCUMENT_ROOT."/includes/menus/";
 
-		if ($key == 'auguria')
+		// Load sql init_menu_handler.sql file
+		$file='init_menu_'.$key.'.sql';
+		if (file_exists($dir.$file))
 		{
-			// Load sql init_menu_base.sql file
-			$file='init_menu_base.sql';
 			$result=run_sql($dir.$file,1,'',1,$key);
 		}
-		else
-		{
-			// Load sql init_menu_handler.sql file
-			$file='init_menu_'.$key.'.sql';
-			if (file_exists($dir.$file))
-			{
-				$result=run_sql($dir.$file,1,'',1,$key);
-			}
-		}
 	}
 
 	// We make a header redirect because we need to change menu NOW.
@@ -179,15 +172,18 @@ if (isset($_GET["action"]) && $_GET["action"] == 'edit')
 	print '</tr>';
 
 	// Menu smartphone
-	$var=!$var;
-	print '<tr '.$bc[$var].'><td>'.$langs->trans("DefaultMenuSmartphoneManager").'</td>';
-	print '<td>';
-	print $htmladmin->select_menu($conf->global->MAIN_MENU_SMARTPHONE,'main_menu_smartphone',$dirsmartphone);
-	print '</td>';
-	print '<td>';
-	print $htmladmin->select_menu($conf->global->MAIN_MENUFRONT_SMARTPHONE,'main_menufront_smartphone',$dirsmartphone);
-	print '</td>';
-	print '</tr>';
+	if ($conf->global->MAIN_FEATURES_LEVEL >= 1)
+	{
+    	$var=!$var;
+    	print '<tr '.$bc[$var].'><td>'.$langs->trans("DefaultMenuSmartphoneManager").'</td>';
+    	print '<td>';
+    	print $htmladmin->select_menu($conf->global->MAIN_MENU_SMARTPHONE,'main_menu_smartphone',$dirsmartphone);
+    	print '</td>';
+    	print '<td>';
+    	print $htmladmin->select_menu($conf->global->MAIN_MENUFRONT_SMARTPHONE,'main_menufront_smartphone',$dirsmartphone);
+    	print '</td>';
+    	print '</tr>';
+	}
 
 	print '</table>';
 
@@ -239,18 +235,21 @@ else
 	print '</td>';
 	print '</tr>';
 
-	$var=!$var;
-	print '<tr '.$bc[$var].'>';
-	print '<td>'.$langs->trans("DefaultMenuSmartphoneManager").'</td>';
-	print '<td>';
-	$filelib=preg_replace('/.php$/i','',$conf->global->MAIN_MENU_SMARTPHONE);
-	print $filelib;
-	print '</td>';
-	print '<td>';
-	$filelib=preg_replace('/.php$/i','',$conf->global->MAIN_MENUFRONT_SMARTPHONE);
-	print $filelib;
-	print '</td>';
-	print '</tr>';
+    if ($conf->global->MAIN_FEATURES_LEVEL >= 1)
+    {
+    	$var=!$var;
+    	print '<tr '.$bc[$var].'>';
+    	print '<td>'.$langs->trans("DefaultMenuSmartphoneManager").'</td>';
+    	print '<td>';
+    	$filelib=preg_replace('/.php$/i','',$conf->global->MAIN_MENU_SMARTPHONE);
+    	print $filelib;
+    	print '</td>';
+    	print '<td>';
+    	$filelib=preg_replace('/.php$/i','',$conf->global->MAIN_MENUFRONT_SMARTPHONE);
+    	print $filelib;
+    	print '</td>';
+    	print '</tr>';
+    }
 
 	print '</table>';
 }
diff --git a/htdocs/includes/menus/init_menu_base.sql b/htdocs/includes/menus/init_menu_auguria.sql
similarity index 100%
rename from htdocs/includes/menus/init_menu_base.sql
rename to htdocs/includes/menus/init_menu_auguria.sql
-- 
GitLab