From 15ede98fe771fba3263353dbc8fb96dba512f231 Mon Sep 17 00:00:00 2001 From: simnandez Date: Sat, 4 May 2013 01:22:09 +0200 Subject: [PATCH] New: [ task #877 ] Reorganize menus. Init works Add migration script 3.4 to 3.5 --- ChangeLog | 6 +++ htdocs/core/menus/standard/eldy.lib.php | 41 +++++++++++++++++++ htdocs/core/modules/modHoliday.class.php | 8 +++- htdocs/install/check.php | 4 +- .../install/mysql/migration/3.4.0-3.5.0.sql | 21 ++++++++++ htdocs/langs/ca_ES/holiday.lang | 1 + htdocs/langs/en_US/holiday.lang | 1 + htdocs/langs/es_ES/holiday.lang | 1 + htdocs/langs/fr_FR/holiday.lang | 1 + 9 files changed, 81 insertions(+), 3 deletions(-) create mode 100755 htdocs/install/mysql/migration/3.4.0-3.5.0.sql diff --git a/ChangeLog b/ChangeLog index 05db29b146b..ea8c4b39b6a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,12 @@ English Dolibarr ChangeLog -------------------------------------------------------------- +***** ChangeLog for 3.5 compared to 3.4 ***** +For users: +- New: [ task #877 ] Reorganize menus + + + ***** ChangeLog for 3.4 compared to 3.3.2 ***** For users: - New: Can use ODS templates as document templates. diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 6c423d7d2f7..9bf34382819 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -192,6 +192,28 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0) if (empty($noout)) print_end_menu_entry($showmode); $menu->add('/projet/index.php?mainmenu=project&leftmenu=', $langs->trans("Projects"), 0, $showmode, $atarget, "project", ''); } + + // HRM + $tmpentry=array('enabled'=>(! empty($conf->holiday->enabled)), + 'perms'=>(! empty($user->rights->holiday->write)), + 'module'=>'holiday'); + $showmode=dol_eldy_showmenu($type_user, $tmpentry, $listofmodulesforexternal); + if ($showmode) + { + $langs->load("holiday"); + + $classname=""; + if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "hrm") { $classname='class="tmenusel"'; $_SESSION['idmenu']=''; } + else $classname = 'class="tmenu"'; + $idsel='hrm'; + + if (empty($noout)) print_start_menu_entry($idsel,$classname,$showmode); + if (empty($noout)) print_text_menu_entry($langs->trans("HRM"), $showmode, DOL_URL_ROOT.'/holiday/index.php?mainmenu=hrm&leftmenu=', $id, $idsel, $classname, $atarget); + if (empty($noout)) print_end_menu_entry($showmode); + $menu->add('/holiday/index.php?mainmenu=holiday&leftmenu=', $langs->trans("HRM"), 0, $showmode, $atarget, "hrm", ''); + } + + // Tools $tmpentry=array('enabled'=>(! empty($conf->mailing->enabled) || ! empty($conf->export->enabled) || ! empty($conf->import->enabled)), @@ -1077,6 +1099,25 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu $newmenu->add("/projet/activity/list.php", $langs->trans("NewTimeSpent"), 1, $user->rights->projet->creer && $user->rights->projet->creer); } } + + /* + * Menu HRM + */ + if ($mainmenu == 'hrm') + { + if (! empty($conf->holiday->enabled)) + { + $langs->load("holiday"); + + // Project affected to user + $newmenu->add("/holiday/index.php?&leftmenu=hrm", $langs->trans("CPTitreMenu"), 0, $user->rights->holiday->write, '', $mainmenu, 'hrm'); + $newmenu->add("/holiday/fiche.php?&action=request", $langs->trans("MenuAddCP"), 1,$user->rights->holiday->write); + $newmenu->add("/holiday/define_holiday.php?&action=request", $langs->trans("MenuConfCP"), 1, $user->rights->holiday->define_holiday); + $newmenu->add("/holiday/view_log.php?&action=request", $langs->trans("MenuLogCP"), 1, $user->rights->holiday->view_log); + $newmenu->add("/holiday/month_report.php?&action=request", $langs->trans("MenuReportMonth"), 1, $user->rights->holiday->view_log); + + } + } /* diff --git a/htdocs/core/modules/modHoliday.class.php b/htdocs/core/modules/modHoliday.class.php index 63dfe3d3fd5..573d1c41af9 100644 --- a/htdocs/core/modules/modHoliday.class.php +++ b/htdocs/core/modules/modHoliday.class.php @@ -2,7 +2,8 @@ /* Copyright (C) 2003 Rodolphe Quiedeville * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005-2010 Regis Houssin - * Copyright (C) 2011 Dimitri Mouillard + * Copyright (C) 2011 Dimitri Mouillard + * Copyright (C) 2013 Juanjo Menent * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -178,6 +179,8 @@ class modHoliday extends DolibarrModules $this->menus = array(); // List of menus to add $r=0; + + /* Move to HRM menu // Add here entries to declare new menus $this->menu[$r]=array( 'fk_menu'=>0, // Put 0 if this is a top menu 'type'=>'top', // This is a Top menu entry @@ -257,7 +260,8 @@ class modHoliday extends DolibarrModules 'target'=>'', 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both $r++; - +*/ + // Exports $r=1; diff --git a/htdocs/install/check.php b/htdocs/install/check.php index 40210e83b58..097ee22817a 100644 --- a/htdocs/install/check.php +++ b/htdocs/install/check.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2012 Laurent Destailleur * Copyright (C) 2005 Marc Barilley / Ocebo * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2013 Juanjo Menent * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -384,7 +385,8 @@ else array('from'=>'3.0.0', 'to'=>'3.1.0'), array('from'=>'3.1.0', 'to'=>'3.2.0'), array('from'=>'3.2.0', 'to'=>'3.3.0'), - array('from'=>'3.3.0', 'to'=>'3.4.0') + array('from'=>'3.3.0', 'to'=>'3.4.0'), + array('from'=>'3.4.0', 'to'=>'3.5.0') ); $count=0; diff --git a/htdocs/install/mysql/migration/3.4.0-3.5.0.sql b/htdocs/install/mysql/migration/3.4.0-3.5.0.sql new file mode 100755 index 00000000000..5dd2ae69142 --- /dev/null +++ b/htdocs/install/mysql/migration/3.4.0-3.5.0.sql @@ -0,0 +1,21 @@ +-- +-- Be carefull to requests order. +-- This file must be loaded by calling /install/index.php page +-- when current version is 3.5.0 or higher. +-- +-- To rename a table: ALTER TABLE llx_table RENAME TO llx_table_new; +-- To add a column: ALTER TABLE llx_table ADD COLUMN newcol varchar(60) NOT NULL DEFAULT '0' AFTER existingcol; +-- To rename a column: ALTER TABLE llx_table CHANGE COLUMN oldname newname varchar(60); +-- To drop a column: ALTER TABLE llx_table DROP COLUMN oldname; +-- To change type of field: ALTER TABLE llx_table MODIFY COLUMN name varchar(60); +-- To drop a foreign key: ALTER TABLE llx_table DROP FOREIGN KEY fk_name; +-- To restrict request to Mysql version x.y use -- VMYSQLx.y +-- To restrict request to Pgsql version x.y use -- VPGSQLx.y +-- To make pk to be auto increment (mysql): VMYSQL4.3 ALTER TABLE llx_c_shipment_mode CHANGE COLUMN rowid rowid INTEGER NOT NULL AUTO_INCREMENT; +-- To make pk to be auto increment (postgres) VPGSQL8.2 NOT POSSIBLE. MUST DELETE/CREATE TABLE + +-- -- VPGSQL8.2 DELETE FROM llx_usergroup_user WHERE fk_user NOT IN (SELECT rowid from llx_user); +-- -- VMYSQL4.1 DELETE FROM llx_usergroup_user WHERE fk_usergroup NOT IN (SELECT rowid from llx_usergroup); + + +DELETE FROM llx_menu where module='holiday'; \ No newline at end of file diff --git a/htdocs/langs/ca_ES/holiday.lang b/htdocs/langs/ca_ES/holiday.lang index 60adaa8faf3..32313bc82a6 100644 --- a/htdocs/langs/ca_ES/holiday.lang +++ b/htdocs/langs/ca_ES/holiday.lang @@ -1,6 +1,7 @@ # Dolibarr language file - ca_ES - holiday CHARSET= UTF-8 +HRM=RRHH Holidays=Vacacions CPTitreMenu=Vacacions MenuReportMonth=Estat mensual diff --git a/htdocs/langs/en_US/holiday.lang b/htdocs/langs/en_US/holiday.lang index 5453b2b88e6..1937625e4ae 100644 --- a/htdocs/langs/en_US/holiday.lang +++ b/htdocs/langs/en_US/holiday.lang @@ -1,6 +1,7 @@ # Dolibarr language file - en_US - holiday CHARSET= UTF-8 +HRM=HRM Holidays=Holidays CPTitreMenu=Holidays MenuReportMonth=Monthly statement diff --git a/htdocs/langs/es_ES/holiday.lang b/htdocs/langs/es_ES/holiday.lang index 5c234575d25..21b9f1cfbe7 100644 --- a/htdocs/langs/es_ES/holiday.lang +++ b/htdocs/langs/es_ES/holiday.lang @@ -1,6 +1,7 @@ # Dolibarr language file - es_ES - holiday CHARSET= UTF-8 +HRM=RRHH Holidays=Vacaciones CPTitreMenu=Vacaciones MenuReportMonth=Estado mensual diff --git a/htdocs/langs/fr_FR/holiday.lang b/htdocs/langs/fr_FR/holiday.lang index 938ffaa155d..42e755ece07 100644 --- a/htdocs/langs/fr_FR/holiday.lang +++ b/htdocs/langs/fr_FR/holiday.lang @@ -1,6 +1,7 @@ # Dolibarr language file - fr_FR - holiday CHARSET= UTF-8 +HRM=GRH Holidays=Congés CPTitreMenu=Congés MenuReportMonth=Etat mensuel