From 57c84089fe2578430295c6c8ba7abdbe5b4ac1ba Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@destailleur.fr> Date: Sun, 25 Jan 2015 22:29:36 +0100 Subject: [PATCH] Introduce warning to remind to do a backup before migration. Required because we discovered, during beta, serious bugs into some databases system loosing data. --- htdocs/core/lib/functions.lib.php | 6 ++++-- htdocs/core/modules/modAdherent.class.php | 4 ++-- htdocs/install/check.php | 14 +++++++++----- htdocs/langs/en_US/admin.lang | 6 +++--- htdocs/langs/en_US/install.lang | 1 + 5 files changed, 19 insertions(+), 12 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index b9a663d1e48..dc4da48b6f5 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -488,13 +488,15 @@ function dolEscapeXML($string) * * @param string $stringtoescape String to escape * @param string $mode 0=Escape also ' and " into ', 1=Escape ' but not " for usage into 'string', 2=Escape " but not ' for usage into "string", 3=Escape ' and " with \ + * @param string $noescapebackslashn 0=Escape also \n. 1=Do not escape \n. * @return string Escaped string. Both ' and " are escaped into ' if they are escaped. */ -function dol_escape_js($stringtoescape, $mode=0) +function dol_escape_js($stringtoescape, $mode=0, $noescapebackslashn=0) { // escape quotes and backslashes, newlines, etc. - $substitjs=array("'"=>"\\'",'\\'=>'\\\\',"\r"=>'\\r',"\n"=>'\\n'); + $substitjs=array("'"=>"\\'","\r"=>'\\r'); //$substitjs['</']='<\/'; // We removed this. Should be useless. + if (empty($noescapebackslashn)) { $substitjs["\n"]='\\n'; $substitjs['\\']='\\\\'; } if (empty($mode)) { $substitjs["'"]="\\'"; $substitjs['"']="\\'"; } else if ($mode == 1) $substitjs["'"]="\\'"; else if ($mode == 2) { $substitjs['"']='\\"'; } diff --git a/htdocs/core/modules/modAdherent.class.php b/htdocs/core/modules/modAdherent.class.php index 8cec64f2d20..56037c9fb16 100644 --- a/htdocs/core/modules/modAdherent.class.php +++ b/htdocs/core/modules/modAdherent.class.php @@ -50,7 +50,7 @@ class modAdherent extends DolibarrModules $this->family = "hr"; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); - $this->description = "Gestion des adhérents d'une association"; + $this->description = "Management of members of a foundation or association"; $this->version = 'dolibarr'; // 'experimental' or 'dolibarr' or version $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); $this->special = 0; @@ -137,7 +137,7 @@ class modAdherent extends DolibarrModules $r++; $this->rights[$r][0] = 75; - $this->rights[$r][1] = 'Setup types and attributes of members'; + $this->rights[$r][1] = 'Setup types of membership'; $this->rights[$r][2] = 'w'; $this->rights[$r][3] = 0; $this->rights[$r][4] = 'configurer'; diff --git a/htdocs/install/check.php b/htdocs/install/check.php index 1f233e9f551..671c3660594 100644 --- a/htdocs/install/check.php +++ b/htdocs/install/check.php @@ -1,6 +1,6 @@ <?php /* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> - * Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net> + * Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2013-2014 Juanjo Menent <jmenent@2byte.es> @@ -349,7 +349,7 @@ else { $choice .= '<br>'; //print $langs->trans("InstallChoiceRecommanded",DOL_VERSION,$conf->global->MAIN_VERSION_LAST_UPGRADE); - $choice .= '<center><div class="ok">'.$langs->trans("InstallChoiceSuggested").'</div></center>'; + $choice .= '<div class="center"><div class="ok">'.$langs->trans("InstallChoiceSuggested").'</div></div>'; // <img src="../theme/eldy/img/tick.png" alt="Ok"> '; $foundrecommandedchoice=1; // To show only once } @@ -449,12 +449,12 @@ else { $choice .= '<br>'; //print $langs->trans("InstallChoiceRecommanded",DOL_VERSION,$conf->global->MAIN_VERSION_LAST_UPGRADE); - $choice .= '<center><div class="ok">'.$langs->trans("InstallChoiceSuggested").'</div>'; + $choice .= '<div class="center"><div class="ok">'.$langs->trans("InstallChoiceSuggested").'</div>'; if ($count < count($migarray)) // There is other choices after { print $langs->trans("MigrateIsDoneStepByStep",DOL_VERSION); } - $choice .= '</center>'; + $choice .= '</div>'; } $choice .= '</td>'; @@ -462,7 +462,7 @@ else if ($allowupgrade) { // If it's not last updagre script, action = upgrade_tmp, if last action = upgrade - $choice .= '<a class="button" href="upgrade.php?action=upgrade'.($count<count($migrationscript)?'_'.$versionto:'').'&selectlang='.$setuplang.'&versionfrom='.$versionfrom.'&versionto='.$versionto.'">'.$langs->trans("Start").'</a>'; + $choice .= '<a class="button runupgrade" href="upgrade.php?action=upgrade'.($count<count($migrationscript)?'_'.$versionto:'').'&selectlang='.$setuplang.'&versionfrom='.$versionfrom.'&versionto='.$versionto.'">'.$langs->trans("Start").'</a>'; } else { @@ -531,6 +531,10 @@ $("div#AShowChoices a").click(function() { }); +$(".runupgrade").click(function() { + return confirm("'.dol_escape_js($langs->transnoentitiesnoconv("WarningUpgrade"), 0, 1).'"); +}); + </script>'; pFooter(true); // Never display next button diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 1527126f95b..98d25118126 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -568,7 +568,7 @@ Permission67=Export interventions Permission71=Read members Permission72=Create/modify members Permission74=Delete members -Permission75=Setup types and attributes for members +Permission75=Setup types of membership Permission76=Export datas Permission78=Read subscriptions Permission79=Create/modify subscriptions @@ -591,8 +591,8 @@ Permission106=Export sendings Permission109=Delete sendings Permission111=Read financial accounts Permission112=Create/modify/delete and compare transactions -Permission113=Setup financiel accounts (create, manage categories) -Permission114=Consolidate transactions +Permission113=Setup financial accounts (create, manage categories) +Permission114=Reconciliate transactions Permission115=Export transactions and account statements Permission116=Transfers between accounts Permission117=Manage cheques dispatching diff --git a/htdocs/langs/en_US/install.lang b/htdocs/langs/en_US/install.lang index c296bd788e8..ef5b7e20ca6 100644 --- a/htdocs/langs/en_US/install.lang +++ b/htdocs/langs/en_US/install.lang @@ -155,6 +155,7 @@ MigrationFinished=Migration finished LastStepDesc=<strong>Last step</strong>: Define here login and password you plan to use to connect to software. Do not loose this as it is the account to administer all others. ActivateModule=Activate module %s ShowEditTechnicalParameters=Click here to show/edit advanced parameters (expert mode) +WarningUpgrade=Warning:\nDid your run a database backup first ?\nThis is highly recommanded: for example, due to some bugs into databases systems (for example mysql version 5.5.40), some data or tables may be lost during this process, so it is highly recommanded to have a complete dump of your database before starting migration.\n\nClick OK to start migration process... ######### # upgrade -- GitLab