From cccc7d1af3283386942dbcc1e98c5933c53ae8f1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 17 Jan 2013 13:02:34 +0100 Subject: [PATCH 1/8] Fix: comments --- htdocs/core/class/menubase.class.php | 30 +++++++++++++++++----------- 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/htdocs/core/class/menubase.class.php b/htdocs/core/class/menubase.class.php index b3b37d563de..45bd05b30b4 100644 --- a/htdocs/core/class/menubase.class.php +++ b/htdocs/core/class/menubase.class.php @@ -378,7 +378,7 @@ class Menubase * * @param string $mymainmenu Value for mainmenu to filter menu to load (always '') * @param string $myleftmenu Value for leftmenu to filter menu to load (always '') - * @param int $type_user Filter on type of user (0=Internal,1=External,2=All) + * @param int $type_user 0=Menu for backoffice, 1=Menu for front office * @param string $menu_handler Filter on name of menu_handler used (auguria, eldy...) * @param array &$tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty) * @return array Return array with menu entries for top menu @@ -415,7 +415,7 @@ class Menubase * @param array $newmenu Menu array to complete (in most cases, it's empty, may be already initialized with some menu manager like eldy) * @param string $mymainmenu Value for mainmenu to filter menu to load (often $_SESSION["mainmenu"]) * @param string $myleftmenu Value for leftmenu to filter menu to load (always '') - * @param int $type_user Filter on type of user (0=Internal,1=External,2=All) + * @param int $type_user 0=Menu for backoffice, 1=Menu for front office * @param string $menu_handler Filter on name of menu_handler used (auguria, eldy...) * @param array &$tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty) * @return array Menu array for particular mainmenu value or full tabArray @@ -425,12 +425,12 @@ class Menubase global $langs, $user, $conf; // To export to dol_eval function global $mainmenu,$leftmenu; // To export to dol_eval function - $mainmenu=$mymainmenu; // To export to dol_eval function - $leftmenu=$myleftmenu; // To export to dol_eval function - // We initialize newmenu with first already found menu entries $this->newmenu = $newmenu; + $mainmenu=$mymainmenu; // To export to dol_eval function + $leftmenu=$myleftmenu; // To export to dol_eval function + // Load datas from database into $tabMenu, later we will complete this->newmenu with values into $tabMenu if (count($tabMenu) == 0) // To avoid to read into database a second time { @@ -510,7 +510,7 @@ class Menubase * * @param string $mymainmenu Value for left that defined mainmenu * @param string $myleftmenu Value for left that defined leftmenu - * @param int $type_user 0=Internal,1=External,2=All + * @param int $type_user Looks for menu entry for 0=Internal users, 1=External users * @param string $menu_handler Name of menu_handler used ('auguria', 'eldy'...) * @param array &$tabMenu Array to store new entries found (in most cases, it's empty, but may be alreay filled) * @return int >0 if OK, <0 if KO @@ -530,9 +530,10 @@ class Menubase $sql.= " AND m.menu_handler IN ('".$menu_handler."','all')"; if ($type_user == 0) $sql.= " AND m.usertype IN (0,2)"; if ($type_user == 1) $sql.= " AND m.usertype IN (1,2)"; - // If type_user == 2, no test required $sql.= " ORDER BY m.position, m.rowid"; +//$tmp1=dol_microtime_float(); +//print '>>> 1 0
'; dol_syslog(get_class($this)."::menuLoad mymainmenu=".$mymainmenu." myleftmenu=".$myleftmenu." type_user=".$type_user." menu_handler=".$menu_handler." tabMenu size=".count($tabMenu)." sql=".$sql); $resql = $this->db->query($sql); if ($resql) @@ -567,11 +568,14 @@ class Menubase // Define $title if ($enabled) { - $title = $langs->trans($menu['titre']); +//$tmp3=dol_microtime_float(); +//print '>>> 2 '.($tmp3 - $tmp1).'
'; + $title = $langs->trans($menu['titre']); if ($title == $menu['titre']) // Translation not found { if (! empty($menu['langs'])) // If there is a dedicated translation file { + //print 'Load file '.$menu['langs'].'
'; $langs->load($menu['langs']); } @@ -580,7 +584,7 @@ class Menubase $tab_titre = explode("/",$menu['titre']); $title = $langs->trans($tab_titre[0])."/".$langs->trans($tab_titre[1]); } - else if (preg_match('/\|\|/',$menu['titre'])) // To manage different translation + else if (preg_match('/\|\|/',$menu['titre'])) // To manage different translation (Title||AltTitle@ConditionForAltTitle) { $tab_title = explode("||",$menu['titre']); $alt_title = explode("@",$tab_title[1]); @@ -592,7 +596,9 @@ class Menubase $title = $langs->trans($menu['titre']); } } - +//$tmp4=dol_microtime_float(); +//print '>>> 3 '.($tmp4 - $tmp3).'
'; + // We complete tabMenu $tabMenu[$b]['rowid'] = $menu['rowid']; $tabMenu[$b]['module'] = $menu['module']; @@ -614,10 +620,10 @@ class Menubase $tabMenu[$b]['fk_mainmenu'] = $menu['fk_mainmenu']; $tabMenu[$b]['fk_leftmenu'] = $menu['fk_leftmenu']; $tabMenu[$b]['position'] = $menu['position']; - + $b++; } - + $a++; } $this->db->free($resql); From 66921cf24abe3a7540258252fbb6d9888b7177e1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 17 Jan 2013 13:19:17 +0100 Subject: [PATCH 2/8] Prepare 3.4 --- ChangeLog | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ChangeLog b/ChangeLog index 39f8bf27724..1c9578507eb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,15 @@ English Dolibarr ChangeLog -------------------------------------------------------------- +***** ChangeLog for 3.4 compared to 3.3 ***** +For users: +- New: Some performance enhancements + +For developers: + +For translators: + + ***** ChangeLog for 3.3 compared to 3.2.3 ***** For users: From b89b74e9339b26495f47dcd9dc219f1789919a6b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 17 Jan 2013 17:40:27 +0100 Subject: [PATCH 3/8] Fix: load at wrong place --- htdocs/core/class/html.formother.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index 47cab7e5fd2..2feec9eb821 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -822,7 +822,6 @@ class FormOther $arrayboxtoactivatelabel=array(); if (! empty($user->conf->$confuserzone)) { - $langs->load("boxes"); foreach($boxactivated as $box) { if (! empty($boxidactivatedforuser[$box->id])) continue; // Already visible for user @@ -862,6 +861,8 @@ class FormOther if ($nbboxactivated) { + $langs->load("boxes"); + $emptybox=new ModeleBoxes($db); print ''; From 9d5b36b27b737597dd4d5bed26b5a559dfc15e49 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 17 Jan 2013 14:36:08 +0100 Subject: [PATCH 4/8] Fix: error set on non object --- htdocs/admin/fournisseur.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/admin/fournisseur.php b/htdocs/admin/fournisseur.php index 774009e2353..e92ef38ee97 100644 --- a/htdocs/admin/fournisseur.php +++ b/htdocs/admin/fournisseur.php @@ -357,7 +357,6 @@ foreach ($dirmodels as $reldir) // Info $htmltooltip=''; $htmltooltip.=''.$langs->trans("Version").': '.$module->getVersion().'
'; - $facture->type=0; $nextval=$module->getNextValue($mysoc,$commande); if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval { From c16269d04e4073a54ae2918914c75d31f791be86 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 17 Jan 2013 17:59:47 +0100 Subject: [PATCH 5/8] Fix: load at wrong place Conflicts: htdocs/core/class/html.formother.class.php --- htdocs/core/class/html.formother.class.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index 676ad72faea..e544a6db99a 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -822,8 +822,8 @@ class FormOther $arrayboxtoactivatelabel=array(); if (! empty($user->conf->$confuserzone)) { - foreach($boxactivated as $box) - { + foreach($boxactivated as $box) + { if (! empty($boxidactivatedforuser[$box->id])) continue; // Already visible for user $arrayboxtoactivatelabel[$box->id]=$box->boxlabel; // We keep only boxes not shown for user, to show into combo list } @@ -861,7 +861,9 @@ class FormOther if ($nbboxactivated) { - $emptybox=new ModeleBoxes($db); + $langs->load("boxes"); + + $emptybox=new ModeleBoxes($db); print '
'; print '< $var=!$var; print ''."\n"; print '
'."\n"; From f665980ef029a86462567df79a1199ca8f0582fa Mon Sep 17 00:00:00 2001 From: fhenry Date: Thu, 17 Jan 2013 18:03:10 +0100 Subject: [PATCH 6/8] Fix bug on update thirdpartty webservice --- htdocs/webservices/server_thirdparty.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/webservices/server_thirdparty.php b/htdocs/webservices/server_thirdparty.php index 1e3ee7cedca..49f303a7c1a 100755 --- a/htdocs/webservices/server_thirdparty.php +++ b/htdocs/webservices/server_thirdparty.php @@ -571,7 +571,7 @@ function updateThirdParty($authentication,$thirdparty) $db->begin(); - $result=$object->update($fuser); + $result=$object->update($thirdparty['id'],$fuser); if ($result <= 0) { $error++; } From 6091f74b13e80c2c72afa1b78bf5ae1fb5826939 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 17 Jan 2013 18:39:15 +0100 Subject: [PATCH 7/8] New: First changes to simplify/optimize menu management. --- htdocs/admin/system/dolibarr.php | 2 +- htdocs/core/class/conf.class.php | 2 +- htdocs/core/class/translate.class.php | 2 +- htdocs/core/lib/functions.lib.php | 2 +- .../menus/standard/auguria_backoffice.php | 6 +- .../menus/standard/auguria_frontoffice.php | 7 +- htdocs/core/menus/standard/eldy.lib.php | 1 - .../core/menus/standard/eldy_backoffice.php | 6 +- .../core/menus/standard/eldy_frontoffice.php | 8 +- htdocs/core/menus/standard/empty.php | 6 +- htdocs/main.inc.php | 125 ++++++++---------- 11 files changed, 66 insertions(+), 101 deletions(-) diff --git a/htdocs/admin/system/dolibarr.php b/htdocs/admin/system/dolibarr.php index a0bc8d818a7..024489c6bc8 100644 --- a/htdocs/admin/system/dolibarr.php +++ b/htdocs/admin/system/dolibarr.php @@ -89,7 +89,7 @@ print '
'.$langs->trans("CurrentTheme").'
'.$langs->trans("CurrentMenuHandler").''; if (preg_match('/^smartphone/',$conf->smart_menu) && ! empty($conf->browser->phone)) print $conf->smart_menu; -else print $conf->top_menu; +else print $conf->standard_menu; print '
'; print '
'; diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index e4be7fa308a..4c117c8d526 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -48,7 +48,7 @@ class Conf public $theme; // Contains current theme ("eldy", "auguria", ...) public $css; // Contains full path of css page ("/theme/eldy/style.css.php", ...) //! Used to store current menu handlers - public $top_menu; + public $standard_menu; public $smart_menu; public $modules = array(); // List of activated modules diff --git a/htdocs/core/class/translate.class.php b/htdocs/core/class/translate.class.php index b5df9ceb337..d4258e3bae1 100644 --- a/htdocs/core/class/translate.class.php +++ b/htdocs/core/class/translate.class.php @@ -169,7 +169,7 @@ class Translate } if ($this->defaultlang == 'none_NONE') return 0; // Special language code to not translate keys - dol_syslog("Translate::Load Start domain=".$domain." alt=".$alt." forcelangdir=".$forcelangdir." this->defaultlang=".$this->defaultlang); + //dol_syslog("Translate::Load Start domain=".$domain." alt=".$alt." forcelangdir=".$forcelangdir." this->defaultlang=".$this->defaultlang); $newdomain = $domain; $modulename = ''; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index d8a0a92084c..4e76905b9c4 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2105,7 +2105,7 @@ function dol_print_error($db='',$error='') $out.="
\n"; $out.="".$langs->trans("RequestedUrl").": ".$_SERVER["REQUEST_URI"]."
\n";; $out.="".$langs->trans("Referer").": ".(isset($_SERVER["HTTP_REFERER"])?$_SERVER["HTTP_REFERER"]:'')."
\n";; - $out.="".$langs->trans("MenuManager").": ".$conf->top_menu."
\n"; + $out.="".$langs->trans("MenuManager").": ".$conf->standard_menu."
\n"; $out.="
\n"; $syslog.="url=".$_SERVER["REQUEST_URI"]; $syslog.=", query_string=".$_SERVER["QUERY_STRING"]; diff --git a/htdocs/core/menus/standard/auguria_backoffice.php b/htdocs/core/menus/standard/auguria_backoffice.php index f4a9eaa4b3f..3c05a0f6170 100644 --- a/htdocs/core/menus/standard/auguria_backoffice.php +++ b/htdocs/core/menus/standard/auguria_backoffice.php @@ -46,14 +46,10 @@ class MenuManager * Constructor * * @param DoliDB $db Database handler - * @param array &$menu_array Table of menu entries to show before entries of menu handler - * @param array &$menu_array_after Table of menu entries to show after entries of menu handler */ - function __construct($db, &$menu_array, &$menu_array_after) + function __construct($db) { $this->db=$db; - $this->menu_array=$menu_array; - $this->menu_array_after=$menu_array_after; } diff --git a/htdocs/core/menus/standard/auguria_frontoffice.php b/htdocs/core/menus/standard/auguria_frontoffice.php index 6f6c96a7b85..151abfbe9cc 100644 --- a/htdocs/core/menus/standard/auguria_frontoffice.php +++ b/htdocs/core/menus/standard/auguria_frontoffice.php @@ -38,7 +38,6 @@ class MenuManager var $type_user=1; // Put 0 for internal users, 1 for external users var $atarget=""; // Valeur du target a utiliser dans les liens - var $menu_array; var $menu_array_after; @@ -47,14 +46,10 @@ class MenuManager * Constructor * * @param DoliDB $db Database handler - * @param array &$menu_array Table of menu entries to show before entries of menu handler - * @param array &$menu_array_after Table of menu entries to show after entries of menu handler */ - function __construct($db, &$menu_array, &$menu_array_after) + function __construct($db) { $this->db=$db; - $this->menu_array=$menu_array; - $this->menu_array_after=$menu_array_after; } diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 196fce01289..13df2dd6dd0 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1474,7 +1474,6 @@ function dol_eldy_showmenu($type_user, &$menuentry, &$listofmodulesforexternal) { //print 'type_user='.$type_user.' module='.$menuentry['module'].' enabled='.$menuentry['enabled'].' perms='.$menuentry['perms']; //print 'ok='.in_array($menuentry['module'], $listofmodulesforexternal); - if (empty($menuentry['enabled'])) return 0; // Entry disabled by condition if ($type_user && $menuentry['module']) { diff --git a/htdocs/core/menus/standard/eldy_backoffice.php b/htdocs/core/menus/standard/eldy_backoffice.php index 398cf381f32..ab00caccb3a 100644 --- a/htdocs/core/menus/standard/eldy_backoffice.php +++ b/htdocs/core/menus/standard/eldy_backoffice.php @@ -45,14 +45,10 @@ class MenuManager * Constructor * * @param DoliDB $db Database handler - * @param array &$menu_array Table of menu entries to show before entries of menu handler - * @param array &$menu_array_after Table of menu entries to show after entries of menu handler */ - function __construct($db, &$menu_array, &$menu_array_after) + function __construct($db) { $this->db=$db; - $this->menu_array=$menu_array; - $this->menu_array_after=$menu_array_after; } diff --git a/htdocs/core/menus/standard/eldy_frontoffice.php b/htdocs/core/menus/standard/eldy_frontoffice.php index 9d23affd041..5ec673afe68 100644 --- a/htdocs/core/menus/standard/eldy_frontoffice.php +++ b/htdocs/core/menus/standard/eldy_frontoffice.php @@ -45,14 +45,10 @@ class MenuManager * Constructor * * @param DoliDB $db Database handler - * @param array &$menu_array Table of menu entries to show before entries of menu handler - * @param array &$menu_array_after Table of menu entries to show after entries of menu handler */ - function __construct($db,&$menu_array,&$menu_array_after) + function __construct($db) { $this->db=$db; - $this->menu_array=$menu_array; - $this->menu_array_after=$menu_array_after; } @@ -60,7 +56,7 @@ class MenuManager * Show menu * * @param string $mode 'top' or 'left' - * @return int Number of menu entries shown + * @return int Number of menu entries shown */ function showmenu($mode) { diff --git a/htdocs/core/menus/standard/empty.php b/htdocs/core/menus/standard/empty.php index 48496aee1fc..da3eab44025 100644 --- a/htdocs/core/menus/standard/empty.php +++ b/htdocs/core/menus/standard/empty.php @@ -38,14 +38,10 @@ class MenuManager * Constructor * * @param DoliDB $db Database handler - * @param array &$menu_array Table of menu entries to show before entries of menu handler - * @param array &$menu_array_after Table of menu entries to show after entries of menu handler */ - function __construct($db, &$menu_array, &$menu_array_after) + function __construct($db) { $this->db=$db; - $this->menu_array=$menu_array; - $this->menu_array_after=$menu_array_after; } diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 65ac13bd2a6..8a5b638818c 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -773,6 +773,45 @@ if (! empty($conf->multicompany->enabled) && GETPOST('action') == 'switchentity' } } +//print 'eee'.$conf->standard_menu; + +// Init menu manager +if (empty($user->societe_id)) // If internal user or not defined +{ + $conf->standard_menu=(empty($conf->global->MAIN_MENU_STANDARD_FORCED)?$conf->global->MAIN_MENU_STANDARD:$conf->global->MAIN_MENU_STANDARD_FORCED); + $conf->smart_menu=(empty($conf->global->MAIN_MENU_SMARTPHONE_FORCED)?$conf->global->MAIN_MENU_SMARTPHONE:$conf->global->MAIN_MENU_SMARTPHONE_FORCED); +} +else // If external user +{ + $conf->standard_menu=(empty($conf->global->MAIN_MENUFRONT_STANDARD_FORCED)?$conf->global->MAIN_MENUFRONT_STANDARD:$conf->global->MAIN_MENUFRONT_STANDARD_FORCED); + $conf->smart_menu=(empty($conf->global->MAIN_MENUFRONT_SMARTPHONE_FORCED)?$conf->global->MAIN_MENUFRONT_SMARTPHONE:$conf->global->MAIN_MENUFRONT_SMARTPHONE_FORCED); +} +// For backward compatibility +if (empty($conf->standard_menu)) $conf->standard_menu ='eldy_backoffice.php'; +elseif ($conf->standard_menu == 'eldy.php') $conf->standard_menu='eldy_backoffice.php'; + +// Load the menu manager (only if not already done) +$file_menu=empty($conf->browser->phone)?$conf->standard_menu:$conf->smart_menu; +if (GETPOST('menu')) $file_menu=GETPOST('menu'); // menu=eldy_backoffice.php +if (! class_exists('MenuManager')) +{ + $menufound=0; + $dirmenus=array_merge(array("/core/menus/"),(array) $conf->modules_parts['menus']); + foreach($dirmenus as $dirmenu) + { + $menufound=dol_include_once($dirmenu."standard/".$file_menu); + if ($menufound) break; + } + if (! $menufound) // If failed to include, we try with standard + { + $file_menu='eldy_backoffice.php'; + include_once DOL_DOCUMENT_ROOT."/core/menus/standard/".$file_menu; + } +} +$menumanager = new MenuManager($db); + + + // Functions @@ -797,8 +836,11 @@ if (! function_exists("llxHeader")) function llxHeader($head = '', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='') { global $conf; + + // html header + top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); - top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); // Show html headers + // top menu and left menu area if (empty($conf->global->MAIN_HIDE_TOP_MENU)) { top_menu($head, $title, $target, $disablejs, $disablehead, $arrayofjs, $arrayofcss, $morequerystring); @@ -807,6 +849,8 @@ if (! function_exists("llxHeader")) { left_menu('', $help_url, '', '', 1, $title); } + + // main area main_area($title); } } @@ -1150,7 +1194,7 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a { global $user, $conf, $langs, $db; global $dolibarr_main_authentication; - global $hookmanager; + global $hookmanager,$menumanager; // Instantiate hooks of thirdparty module only if not already define if (! is_object($hookmanager)) @@ -1162,22 +1206,6 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a $toprightmenu=''; - // Define menu manager in setup - if (empty($user->societe_id)) // If internal user or not defined - { - $conf->top_menu=(empty($conf->global->MAIN_MENU_STANDARD_FORCED)?$conf->global->MAIN_MENU_STANDARD:$conf->global->MAIN_MENU_STANDARD_FORCED); - $conf->smart_menu=(empty($conf->global->MAIN_MENU_SMARTPHONE_FORCED)?$conf->global->MAIN_MENU_SMARTPHONE:$conf->global->MAIN_MENU_SMARTPHONE_FORCED); - } - else // If external user - { - $conf->top_menu=(empty($conf->global->MAIN_MENUFRONT_STANDARD_FORCED)?$conf->global->MAIN_MENUFRONT_STANDARD:$conf->global->MAIN_MENUFRONT_STANDARD_FORCED); - $conf->smart_menu=(empty($conf->global->MAIN_MENUFRONT_SMARTPHONE_FORCED)?$conf->global->MAIN_MENUFRONT_SMARTPHONE:$conf->global->MAIN_MENUFRONT_SMARTPHONE_FORCED); - } - // For backward compatibility - if ($conf->top_menu == 'eldy.php') $conf->top_menu='eldy_backoffice.php'; - elseif ($conf->top_menu == 'rodolphe.php') $conf->top_menu='eldy_backoffice.php'; - if (! $conf->top_menu) $conf->top_menu ='eldy_backoffice.php'; - // For backward compatibility with old modules if (empty($conf->headerdone)) top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); @@ -1267,27 +1295,7 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a /* * Top menu */ - $top_menu=empty($conf->browser->phone)?$conf->top_menu:$conf->smart_menu; - if (GETPOST('menu')) $top_menu=GETPOST('menu'); // menu=eldy_backoffice.php - - // Load the top menu manager (only if not already done) - if (! class_exists('MenuManager')) - { - $menufound=0; - $dirmenus=array_merge(array("/core/menus/"),(array) $conf->modules_parts['menus']); - foreach($dirmenus as $dirmenu) - { - $menufound=dol_include_once($dirmenu."standard/".$top_menu); - if ($menufound) break; - } - if (! $menufound) // If failed to include, we try with standard - { - $top_menu='eldy_backoffice.php'; - include_once DOL_DOCUMENT_ROOT."/core/menus/standard/".$top_menu; - } - } - - print "\n".''."\n"; + print "\n".''."\n"; if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->MAIN_MENU_USE_JQUERY_LAYOUT)) print '
'."\n"; @@ -1296,10 +1304,8 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a print '
'."\n"; // Show menu - $dummy1=array();$dummy2=array(); - $menutop = new MenuManager($db,$dummy1,$dummy2); - $menutop->atarget=$target; - $menutop->showmenu('top'); // This contains a \n + $menumanager->atarget=$target; + $menumanager->showmenu('top'); // This contains a \n print "
\n"; @@ -1313,7 +1319,7 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a $company=' ('.$langs->trans("Company").': '.$thirdpartystatic->name.')'; } $logintext=''; @@ -1349,7 +1355,7 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a && $_SESSION["dol_authmode"] != 'http') { $logouttext .='atarget?(' target="'.$menutop->atarget.'"'):''; + $logouttext .=$atarget?(' target="'.$atarget.'"'):''; $logouttext .='>'; $logouttext .= img_picto($langs->trans('Logout'), 'logout.png', 'class="login"'); $logouttext .=''; @@ -1415,7 +1421,7 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a function left_menu($menu_array_before, $helppagename='', $moresearchform='', $menu_array_after='', $leftmenuwithoutmainarea=0, $title='') { global $user, $conf, $langs, $db; - global $hookmanager; + global $hookmanager, $menumanager; $searchform=''; $bookmarks=''; @@ -1481,33 +1487,14 @@ function left_menu($menu_array_before, $helppagename='', $moresearchform='', $me $bookmarks=printBookmarksList($db, $langs); } - $left_menu=empty($conf->browser->phone)?$conf->top_menu:$conf->smart_menu; - if (GETPOST('menu')) $left_menu=GETPOST('menu'); // menu=eldy_backoffice.php - - // Load the menu manager (only if not already done) - if (! class_exists('MenuManager')) - { - $menufound=0; - $dirmenus=array_merge(array("/core/menus/"),(array) $conf->modules_parts['menus']); - foreach($dirmenus as $dirmenu) - { - $menufound=dol_include_once($dirmenu."standard/".$left_menu); - if ($menufound) break; - } - if (! $menufound) // If failed to include, we try with standard - { - $top_menu='eldy_backoffice.php'; - include_once DOL_DOCUMENT_ROOT."/core/menus/standard/".$top_menu; - } - } - // Left column - print ''."\n"; + print ''."\n"; print '
'."\n"; - $menuleft=new MenuManager($db,$menu_array_before,$menu_array_after); - $menuleft->showmenu('left'); // output menu_array and menu found in database + $menumanager->menu_array = $menu_array_before; + $menumanager->menu_array_after = $menu_array_after; + $menumanager->showmenu('left'); // output menu_array and menu found in database // Show other forms From 685400c20ede74a01469776b5428c54761e6052e Mon Sep 17 00:00:00 2001 From: fhenry Date: Thu, 17 Jan 2013 18:49:21 +0100 Subject: [PATCH 8/8] Fix bug on web service --- htdocs/webservices/server_actioncomm.php | 7 +++++-- htdocs/webservices/server_thirdparty.php | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/htdocs/webservices/server_actioncomm.php b/htdocs/webservices/server_actioncomm.php index 431974dd618..08d90357693 100644 --- a/htdocs/webservices/server_actioncomm.php +++ b/htdocs/webservices/server_actioncomm.php @@ -226,7 +226,7 @@ $server->register( // Entry values array('authentication'=>'tns:authentication','actioncomm'=>'tns:actioncomm'), // Exit values - array('result'=>'tns:result'), + array('result'=>'tns:result','id'=>'xsd:string'), $ns, $ns.'#updateActionComm', $styledoc, @@ -563,7 +563,10 @@ function updateActionComm($authentication,$actioncomm) if ((! $error) && ($objectfound)) { $db->commit(); - $objectresp=array('result'=>array('result_code'=>'OK', 'result_label'=>'')); + $objectresp=array( + 'result'=>array('result_code'=>'OK', 'result_label'=>''), + 'id'=>$object->id + ); } elseif ($objectfound) { diff --git a/htdocs/webservices/server_thirdparty.php b/htdocs/webservices/server_thirdparty.php index 5780895f764..6a4ef3d543b 100755 --- a/htdocs/webservices/server_thirdparty.php +++ b/htdocs/webservices/server_thirdparty.php @@ -233,7 +233,7 @@ $server->register( // Entry values array('authentication'=>'tns:authentication','thirdparty'=>'tns:thirdparty'), // Exit values - array('result'=>'tns:result'), + array('result'=>'tns:result','id'=>'xsd:string'), $ns, $ns.'#updateThirdParty', $styledoc, @@ -580,7 +580,10 @@ function updateThirdParty($authentication,$thirdparty) if ((! $error) && ($objectfound)) { $db->commit(); - $objectresp=array('result'=>array('result_code'=>'OK', 'result_label'=>'')); + $objectresp=array( + 'result'=>array('result_code'=>'OK', 'result_label'=>''), + 'id'=>$object->id + ); } elseif ($objectfound) {