From fe71b83b4bb645382731112ae4d578a2397b4428 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 17 Jan 2008 21:25:46 +0000 Subject: [PATCH] =?UTF-8?q?New:=20L'entr=E9e=20de=20menu=20des=20modules?= =?UTF-8?q?=20phenix,=20webcalendar=20et=20mantis=20sont=20embarqu=E9es=20?= =?UTF-8?q?avec=20le=20module.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dev/skeletons/build_class_from_table.php | 2 +- .../menus/barre_top/eldy_backoffice.php | 58 ---------------- .../menus/barre_top/eldy_frontoffice.php | 58 ---------------- htdocs/includes/menus/barre_top/rodolphe.php | 66 ------------------- htdocs/includes/menus/init_menu_auguria.sql | 3 - .../modules/DolibarrModules.class.php | 4 +- htdocs/includes/modules/modMantis.class.php | 15 +++-- htdocs/includes/modules/modPhenix.class.php | 37 ++--------- .../includes/modules/modWebcalendar.class.php | 18 ++--- htdocs/install/upgrade2.php | 59 ++++++++++++----- htdocs/lib/menubase.class.php | 1 - 11 files changed, 63 insertions(+), 258 deletions(-) diff --git a/dev/skeletons/build_class_from_table.php b/dev/skeletons/build_class_from_table.php index 413861b6d4b..0c0fbb62567 100644 --- a/dev/skeletons/build_class_from_table.php +++ b/dev/skeletons/build_class_from_table.php @@ -175,7 +175,7 @@ $varprop="\n"; $cleanparam=''; foreach($property as $key => $prop) { - if (! $prop['istime']) + if ($prop['field'] != 'rowid' && ! $prop['istime']) { $varprop.="\t\t\$this->".$prop['field']."=trim(\$this->".$prop['field'].");"; $varprop.="\n"; diff --git a/htdocs/includes/menus/barre_top/eldy_backoffice.php b/htdocs/includes/menus/barre_top/eldy_backoffice.php index bee704d3444..1d5a047d307 100644 --- a/htdocs/includes/menus/barre_top/eldy_backoffice.php +++ b/htdocs/includes/menus/barre_top/eldy_backoffice.php @@ -361,65 +361,7 @@ class MenuTop { print 'atarget?" target=$this->atarget":"").'>'.$langs->trans("Members").''; } - // Webcal - if ($conf->webcal->enabled) - { - $langs->load("other"); - - $class=""; - if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "webcal") - { - $class='class="tmenu" id="sel"'; - } - else - { - $class = 'class="tmenu"'; - } - - print 'atarget?" target=$this->atarget":"").'>'.$langs->trans("Calendar").''; - } - - // Phenix - if ($conf->phenix->enabled) - { - $langs->load("other"); - - $class=""; - if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "phenix") - { - $class='class="tmenu" id="sel"'; - } - else - { - $class = 'class="tmenu"'; - } - - print 'atarget?" target=$this->atarget":"").'>'.$langs->trans("Calendar").''; - } - // Mantis - if ($conf->mantis->enabled) - { - $langs->load("other"); - - $class=""; - if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "mantis") - { - $class='class="tmenu" id="sel"'; - } - elseif (ereg("^".DOL_URL_ROOT.".*\/mantis",$_SERVER["PHP_SELF"]) || ereg("^".DOL_URL_ROOT."\/mantis\/",$_SERVER["PHP_SELF"])) - { - $class='class="tmenu" id="sel"'; - } - else - { - $class = 'class="tmenu"'; - } - - print 'atarget?" target=$this->atarget":"").'>'.$langs->trans("BugTracker").''; - } - - // Affichage des menus personnalises require_once(DOL_DOCUMENT_ROOT."/lib/menubase.class.php"); diff --git a/htdocs/includes/menus/barre_top/eldy_frontoffice.php b/htdocs/includes/menus/barre_top/eldy_frontoffice.php index 991e7821bf8..1116447d006 100644 --- a/htdocs/includes/menus/barre_top/eldy_frontoffice.php +++ b/htdocs/includes/menus/barre_top/eldy_frontoffice.php @@ -307,65 +307,7 @@ class MenuTop { print 'atarget?" target=$this->atarget":"").'>'.$langs->trans("Members").''; } - // Webcal - if ($conf->webcal->enabled) - { - $langs->load("other"); - - $class=""; - if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "webcal") - { - $class='class="tmenu" id="sel"'; - } - else - { - $class = 'class="tmenu"'; - } - -// print 'atarget?" target=$this->atarget":"").'>'.$langs->trans("Calendar").''; - } - // Phenix - if ($conf->phenix->enabled) - { - $langs->load("other"); - - $class=""; - if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "phenix") - { - $class='class="tmenu" id="sel"'; - } - else - { - $class = 'class="tmenu"'; - } - -// print 'atarget?" target=$this->atarget":"").'>'.$langs->trans("Calendar").''; - } - - // Mantis - if ($conf->mantis->enabled) - { - $langs->load("other"); - - $class=""; - if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "mantis") - { - $class='class="tmenu" id="sel"'; - } - elseif (ereg("^".DOL_URL_ROOT.".*\/mantis",$_SERVER["PHP_SELF"]) || ereg("^".DOL_URL_ROOT."\/mantis\/",$_SERVER["PHP_SELF"])) - { - $class='class="tmenu" id="sel"'; - } - else - { - $class = 'class="tmenu"'; - } - - print 'atarget?" target=$this->atarget":"").'>'.$langs->trans("BugTracker").''; - } - - // Affichage des menus personnalises require_once(DOL_DOCUMENT_ROOT."/lib/menubase.class.php"); diff --git a/htdocs/includes/menus/barre_top/rodolphe.php b/htdocs/includes/menus/barre_top/rodolphe.php index ae245c3b576..8f9f619fbca 100644 --- a/htdocs/includes/menus/barre_top/rodolphe.php +++ b/htdocs/includes/menus/barre_top/rodolphe.php @@ -300,72 +300,6 @@ class MenuTop { print 'atarget?" target=$this->atarget":"").'>'.$langs->trans("OSCommerce").''; } - // Webcal - if ($conf->webcal->enabled) - { - $langs->load("other"); - - $class=""; - if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "webcalendar") - { - $class='class="tmenu" id="sel"'; - } - elseif (ereg("^".DOL_URL_ROOT.".*\/webcal",$_SERVER["PHP_SELF"]) || ereg("^".DOL_URL_ROOT."\/webcalendar\/",$_SERVER["PHP_SELF"])) - { - $class='class="tmenu" id="sel"'; - } - else - { - $class = 'class="tmenu"'; - } - - print 'atarget?" target=$this->atarget":"").'>'.$langs->trans("Calendar").''; - } - - // Phenix - if ($conf->phenix->enabled) - { - $langs->load("other"); - - $class=""; - if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "phenix") - { - $class='class="tmenu" id="sel"'; - } - elseif (ereg("^".DOL_URL_ROOT.".*\/phenix",$_SERVER["PHP_SELF"])) - { - $class='class="tmenu" id="sel"'; - } - else - { - $class = 'class="tmenu"'; - } - - print 'atarget?" target=$this->atarget":"").'>'.$langs->trans("Calendar").''; - } - - // Mantis - if ($conf->mantis->enabled) - { - $langs->load("other"); - - $class=""; - if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "mantis") - { - $class='class="tmenu" id="sel"'; - } - elseif (ereg("^".DOL_URL_ROOT.".*\/mantis",$_SERVER["PHP_SELF"]) || ereg("^".DOL_URL_ROOT."\/mantis\/",$_SERVER["PHP_SELF"])) - { - $class='class="tmenu" id="sel"'; - } - else - { - $class = 'class="tmenu"'; - } - - print 'atarget?" target=$this->atarget":"").'>'.$langs->trans("BugTracker").''; - } - // Affichage des menus personnalises require_once(DOL_DOCUMENT_ROOT."/lib/menubase.class.php"); diff --git a/htdocs/includes/menus/init_menu_auguria.sql b/htdocs/includes/menus/init_menu_auguria.sql index 35f24b5f724..0945559526e 100644 --- a/htdocs/includes/menus/init_menu_auguria.sql +++ b/htdocs/includes/menus/init_menu_auguria.sql @@ -25,10 +25,7 @@ insert into `llx_menu` (`menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, insert into `llx_menu` (`menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position) values ('auguria', 'top', 10, 'energy', '', 0, '/energie/index.php?mainmenu=energy&leftmenu=', 'Energy', -1, 'energy', '', '', 2, 10); insert into `llx_menu` (`menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position) values ('auguria', 'top', 11, 'shop', '', 0, '/boutique/index.php?mainmenu=shop&leftmenu=', 'OSCommerce', -1, 'shop', '', '', 0, 11); insert into `llx_menu` (`menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position) values ('auguria', 'top', 12, 'shop', '', 0, '/oscommerce_ws/index.php?mainmenu=shop&leftmenu=', 'OSCommerce', -1, 'shop', '', '', 0, 12); -insert into `llx_menu` (`menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position) values ('auguria', 'top', 13, 'webcal', '', 0, '/webcal/webcal.php?mainmenu=webcal&leftmenu=', 'Calendar', -1, 'other', '', '', 0, 13); -insert into `llx_menu` (`menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position) values ('auguria', 'top', 14, 'mantis', '', 0, '/mantis/mantis.php?mainmenu=mantis', 'BugTracker', -1, 'other', '', '', 2, 14); insert into `llx_menu` (`menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position) values ('auguria', 'top', 15, 'members', '', 0, '/adherents/index.php?mainmenu=members&leftmenu=', 'Members', -1, 'members', '', '', 2, 15); -insert into `llx_menu` (`menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position) values ('auguria', 'top', 16, 'phenix', '', 0, '/phenix/phenix.php?mainmenu=phenix&leftmenu=', 'Calendar', -1, 'other', '', '', 0, 16); insert into `llx_menu` (`menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position) values ('auguria', 'left', 100, 'home', '', 1, '/admin/index.php?leftmenu=setup', 'Setup', 0, 'admin', '', '', 2, 0); insert into `llx_menu` (`menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position) values ('auguria', 'left', 101, 'home', '$leftmenu=="setup"', 100, '/admin/company.php', 'MenuCompanySetup', 1, 'admin', '', '', 2, 0); insert into `llx_menu` (`menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position) values ('auguria', 'left', 102, 'home', '$leftmenu=="setup"', 100, '/admin/ihm.php', 'GUISetup', 1, 'admin', '', '', 2, 1); diff --git a/htdocs/includes/modules/DolibarrModules.class.php b/htdocs/includes/modules/DolibarrModules.class.php index fce32831602..db627f6f0e1 100644 --- a/htdocs/includes/modules/DolibarrModules.class.php +++ b/htdocs/includes/modules/DolibarrModules.class.php @@ -405,8 +405,8 @@ class DolibarrModules foreach ($this->boxes as $key => $value) { //$titre = $this->boxes[$key][0]; - $file = $this->boxes[$key][1]; - $note = $this->boxes[$key][2]; + $file = isset($this->boxes[$key][1])?$this->boxes[$key][1]:''; + $note = isset($this->boxes[$key][2])?$this->boxes[$key][2]:''; $sql = "SELECT count(*) FROM ".MAIN_DB_PREFIX."boxes_def"; $sql.= " WHERE file ='".$file."'"; diff --git a/htdocs/includes/modules/modMantis.class.php b/htdocs/includes/modules/modMantis.class.php index 7df7550d48e..334a48e081e 100644 --- a/htdocs/includes/modules/modMantis.class.php +++ b/htdocs/includes/modules/modMantis.class.php @@ -86,13 +86,14 @@ class modMantis extends DolibarrModules // Permissions $this->rights_class = 'mantis'; // Permission key $this->rights = array(); // Permission array used by this module - // Example - // $r++; - // $this->rights[$r][0] = 1200; // Permission id (must not be already used) - // $this->rights[$r][1] = 'Permision label'; // Permission label - // $this->rights[$r][3] = 1; // Permission by default for new user (0/1) - // $this->rights[$r][4] = 'level1'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) - // $this->rights[$r][5] = 'level2'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) + + // Menus + //------ + $r=0; + + $this->menu[$r]=array('fk_menu'=>0,'type'=>'top','titre'=>'BugTracker','mainmenu'=>'mantis','leftmenu'=>'','url'=>'/mantis/mantis.php','langs'=>'other','position'=>100,'perms'=>'','target'=>'','user'=>0); + $r++; + } /** diff --git a/htdocs/includes/modules/modPhenix.class.php b/htdocs/includes/modules/modPhenix.class.php index 64cdc65664c..f91ad5e3170 100644 --- a/htdocs/includes/modules/modPhenix.class.php +++ b/htdocs/includes/modules/modPhenix.class.php @@ -92,42 +92,15 @@ class modPhenix extends DolibarrModules //$r++; // Permissions - $this->rights_class = 'webcal'; // Permission key - $this->rights = array(); // Permission array used by this module - - // Add here list of permission defined by an id, a label, a boolean and two constant strings. - // Example: - // $r++; - // $this->rights[$r][0] = 2000; // Permission id (must not be already used) - // $this->rights[$r][1] = 'Permision label'; // Permission label - // $this->rights[$r][3] = 1; // Permission by default for new user (0/1) - // $this->rights[$r][4] = 'level1'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) - // $this->rights[$r][5] = 'level2'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) - $this->rights_class = 'phenix'; // Permission key $this->rights = array(); // Permission array used by this module - // Main menu entries - $this->menus = array(); // List of menus to add + // Menus + //------ $r=0; - - // Example: - // $r++; - // insert into `llx_menu` ( - // menu_handler 'all' // Menu handler name (all to add with all menu handlers) - // type 'top' // Menu top or left - // `mainmenu`, 'webcal' // Name family/module (home, companies, ...) - // `fk_menu`, 0 // 0 or Id of mother menu line - // `order` 10 // Order of entry - // `url`, '/webcal/webcal.php?mainmenu=webcal&leftmenu=' // Relative (or absolute) url to go - // `target`, '' // Target of Url link - // `titre`, 'Calendar' // Key for menu translation - // `langs`, other // Lang file to load for translation - // `level`, -1 // deprecated - // `leftmenu`, '' // Condition to compare to $_REQUEST["leftmenu"] to show or hide menu entry - // `right`, '' // Condition to show enabled or disabled menu entry - // `user`, 0 // 0 if menu for all users, 1 for external only, 2 for internal only - + + $this->menu[$r]=array('fk_menu'=>0,'type'=>'top','titre'=>'Calendar','mainmenu'=>'phenix','leftmenu'=>'','url'=>'/phenix/phenix.php','langs'=>'other','position'=>100,'perms'=>'','target'=>'','user'=>0); + $r++; } /** diff --git a/htdocs/includes/modules/modWebcalendar.class.php b/htdocs/includes/modules/modWebcalendar.class.php index c0bdf6f71cc..1583456c502 100644 --- a/htdocs/includes/modules/modWebcalendar.class.php +++ b/htdocs/includes/modules/modWebcalendar.class.php @@ -96,19 +96,13 @@ class modWebcalendar extends DolibarrModules $this->rights_class = 'webcal'; // Permission key $this->rights = array(); // Permission array used by this module - // Add here list of permission defined by an id, a label, a boolean and two constant strings. - // Example: - // $r++; - // $this->rights[$r][0] = 2000; // Permission id (must not be already used) - // $this->rights[$r][1] = 'Permision label'; // Permission label - // $this->rights[$r][3] = 1; // Permission by default for new user (0/1) - // $this->rights[$r][4] = 'level1'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) - // $this->rights[$r][5] = 'level2'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) - - // Main menu entries - $this->menus = array(); // List of menus to add + // Menus + //------ $r=0; - + + $this->menu[$r]=array('fk_menu'=>0,'type'=>'top','titre'=>'Calendar','mainmenu'=>'webcal','leftmenu'=>'','url'=>'/webcal/webcal.php','langs'=>'other','position'=>100,'perms'=>'','target'=>'','user'=>0); + $r++; + } /** diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index 99398555a82..ccb41d7db9d 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -1,6 +1,6 @@ - * Copyright (C) 2005-2007 Laurent Destailleur + * Copyright (C) 2005-2008 Laurent Destailleur * Copyright (C) 2005-2008 Regis Houssin * * This program is free software; you can redistribute it and/or modify @@ -137,24 +137,25 @@ if (isset($_POST['action']) && $_POST['action'] == 'upgrade') $db->begin(); - // Chaque action de migration doit renvoyer une ligne sur 4 colonnes avec - // dans la 1ere colonne, la description de l'action a faire - // dans la 4eme colonne, le texte 'OK' si fait ou 'AlreadyDone' si rien n'est fait ou 'Error' + // Chaque action de migration doit renvoyer une ligne sur 4 colonnes avec + // dans la 1ere colonne, la description de l'action a faire + // dans la 4eme colonne, le texte 'OK' si fait ou 'AlreadyDone' si rien n'est fait ou 'Error' + // Script pour V2 -> V2.1 - migrate_paiements($db,$langs,$conf); + migrate_paiements($db,$langs,$conf); - migrate_contracts_det($db,$langs,$conf); + migrate_contracts_det($db,$langs,$conf); - migrate_contracts_date1($db,$langs,$conf); + migrate_contracts_date1($db,$langs,$conf); - migrate_contracts_date2($db,$langs,$conf); + migrate_contracts_date2($db,$langs,$conf); - migrate_contracts_date3($db,$langs,$conf); + migrate_contracts_date3($db,$langs,$conf); - migrate_contracts_open($db,$langs,$conf); + migrate_contracts_open($db,$langs,$conf); - migrate_modeles($db,$langs,$conf); + migrate_modeles($db,$langs,$conf); migrate_price_propal($db,$langs,$conf); @@ -164,8 +165,9 @@ if (isset($_POST['action']) && $_POST['action'] == 'upgrade') migrate_price_contrat($db,$langs,$conf); - migrate_paiementfourn_facturefourn($db,$langs,$conf); + migrate_paiementfourn_facturefourn($db,$langs,$conf); + // Script pour V2.1 -> V2.2 migrate_paiements_orphelins_1($db,$langs,$conf); @@ -175,14 +177,17 @@ if (isset($_POST['action']) && $_POST['action'] == 'upgrade') migrate_delete_old_files($db,$langs,$conf); + // Script pour V2.2 -> V2.4 migrate_commande_expedition($db,$langs,$conf); - // On commit dans tous les cas. - // La procedure etant concue pour pouvoir passer plusieurs fois quelquesoit la situation. - $db->commit(); - $db->close(); - + migrate_module_menus($db,$langs,$conf); + + + // On commit dans tous les cas. + // La procedure etant concue pour pouvoir passer plusieurs fois quelquesoit la situation. + $db->commit(); + $db->close(); } print ''; @@ -1450,12 +1455,30 @@ function migrate_delete_old_files($db,$langs,$conf) */ function migrate_module_menus($db,$langs,$conf) { - if ($conf->global->MAIN_MODULE_AGENDA) + if (! empty($conf->global->MAIN_MODULE_AGENDA)) { require_once(DOL_DOCUMENT_ROOT.'/includes/modules/modAgenda.class.php'); $mod=new modAgenda($db); $mod->init(); } + if (! empty($conf->global->MAIN_MODULE_PHENIX)) + { + require_once(DOL_DOCUMENT_ROOT.'/includes/modules/modPhenix.class.php'); + $mod=new modPhenix($db); + $mod->init(); + } + if (! empty($conf->global->MAIN_MODULE_WEBCALENDAR)) + { + require_once(DOL_DOCUMENT_ROOT.'/includes/modules/modWebcalendar.class.php'); + $mod=new modWebcalendar($db); + $mod->init(); + } + if (! empty($conf->global->MAIN_MODULE_MANTIS)) + { + require_once(DOL_DOCUMENT_ROOT.'/includes/modules/modMantis.class.php'); + $mod=new modMantis($db); + $mod->init(); + } } /* diff --git a/htdocs/lib/menubase.class.php b/htdocs/lib/menubase.class.php index 03ebf31596a..4a583243765 100644 --- a/htdocs/lib/menubase.class.php +++ b/htdocs/lib/menubase.class.php @@ -78,7 +78,6 @@ class Menubase global $conf, $langs; // Clean parameters - $this->rowid=trim($this->rowid); $this->menu_handler=trim($this->menu_handler); $this->module=trim($this->module); $this->type=trim($this->type);