From d10c9cf565349c691b7f3de3d987606d046f004b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 Jun 2018 23:47:48 +0200 Subject: [PATCH] FIX dir for modules must not have s at end (fix contracts into contract) --- htdocs/core/class/conf.class.php | 4 ++-- htdocs/core/lib/functions.lib.php | 6 +++--- htdocs/install/upgrade2.php | 33 ++++++++++++++++++++----------- 3 files changed, 26 insertions(+), 17 deletions(-) diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 0ee73799bcb..17d4c549d0d 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -387,8 +387,8 @@ class Conf $this->productbatch->multidir_temp =array($this->entity => $rootfordata."/produitlot/temp"); // Module contrat - $this->contrat->dir_output=$rootfordata."/contracts"; - $this->contrat->dir_temp =$rootfordata."/contracts/temp"; + $this->contrat->dir_output=$rootfordata."/contract"; + $this->contrat->dir_temp =$rootfordata."/contract/temp"; // Module bank $this->bank->dir_output=$rootfordata."/bank"; $this->bank->dir_temp =$rootfordata."/bank/temp"; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 9051343eb00..ea2e9088d71 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1390,11 +1390,11 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r $dir_output = $conf->$modulepart->multidir_output[$entity] . "/"; if (in_array($modulepart, array('invoice_supplier', 'supplier_invoice'))) { - $subdir = get_exdir($object->id, 2, 0, 0, $object, $modulepart).$objectref; // the objectref dir is not include into get_exdir when used with level=2, so we add it here + $subdir = get_exdir($object->id, 2, 0, 1, $object, $modulepart).$objectref; // the objectref dir is not included into get_exdir when used with level=2, so we add it here } else { - $subdir = get_exdir($object->id, 0, 0, 0, $object, $modulepart); + $subdir = get_exdir($object->id, 0, 0, 1, $object, $modulepart); } $filepath = $dir_output . $subdir . "/"; @@ -5331,7 +5331,7 @@ function get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart) // TODO // We will enhance here a common way of forging path for document storage // Here, object->id, object->ref and modulepart are required. - if (in_array($modulepart, array('thirdparty','contact','member','propal','proposal','commande','order','facture','invoice','shipment','expensereport'))) + if (in_array($modulepart, array('thirdparty','contact','member','propal','proposal','commande','order','facture','invoice','shipment','contract','expensereport'))) { $path=($object->ref?$object->ref:$object->id); } diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index 1a40d2eb9c5..ac2bead992f 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -254,7 +254,7 @@ if (! GETPOST('action','aZ09') || preg_match('/upgrade/i',GETPOST('action','aZ09 migrate_rename_directories($db,$langs,$conf,'/societe','/mycompany'); } - // Script for VX (X<2.8) -> V2.8 + // Script for 2.8 $afterversionarray=explode('.','2.7.9'); $beforeversionarray=explode('.','2.8.9'); //print $versionto.' '.versioncompare($versiontoarray,$afterversionarray).' '.versioncompare($versiontoarray,$beforeversionarray); @@ -281,7 +281,7 @@ if (! GETPOST('action','aZ09') || preg_match('/upgrade/i',GETPOST('action','aZ09 migrate_project_task_actors($db,$langs,$conf); } - // Script for VX (X<2.9) -> V2.9 + // Script for 2.9 $afterversionarray=explode('.','2.8.9'); $beforeversionarray=explode('.','2.9.9'); if (versioncompare($versiontoarray,$afterversionarray) >= 0 && versioncompare($versiontoarray,$beforeversionarray) <= 0) @@ -295,7 +295,7 @@ if (! GETPOST('action','aZ09') || preg_match('/upgrade/i',GETPOST('action','aZ09 migrate_shipping_delivery2($db,$langs,$conf); } - // Script for VX (X<3.0) -> V3.0 + // Script for 3.0 $afterversionarray=explode('.','2.9.9'); $beforeversionarray=explode('.','3.0.9'); if (versioncompare($versiontoarray,$afterversionarray) >= 0 && versioncompare($versiontoarray,$beforeversionarray) <= 0) @@ -303,7 +303,7 @@ if (! GETPOST('action','aZ09') || preg_match('/upgrade/i',GETPOST('action','aZ09 // No particular code } - // Script for VX (X<3.1) -> V3.1 + // Script for 3.1 $afterversionarray=explode('.','3.0.9'); $beforeversionarray=explode('.','3.1.9'); if (versioncompare($versiontoarray,$afterversionarray) >= 0 && versioncompare($versiontoarray,$beforeversionarray) <= 0) @@ -313,7 +313,7 @@ if (! GETPOST('action','aZ09') || preg_match('/upgrade/i',GETPOST('action','aZ09 migrate_actioncomm_element($db,$langs,$conf); } - // Script for VX (X<3.2) -> V3.2 + // Script for 3.2 $afterversionarray=explode('.','3.1.9'); $beforeversionarray=explode('.','3.2.9'); if (versioncompare($versiontoarray,$afterversionarray) >= 0 && versioncompare($versiontoarray,$beforeversionarray) <= 0) @@ -325,7 +325,7 @@ if (! GETPOST('action','aZ09') || preg_match('/upgrade/i',GETPOST('action','aZ09 migrate_clean_association($db,$langs,$conf); } - // Script for VX (X<3.3) -> V3.3 + // Script for 3.3 $afterversionarray=explode('.','3.2.9'); $beforeversionarray=explode('.','3.3.9'); if (versioncompare($versiontoarray,$afterversionarray) >= 0 && versioncompare($versiontoarray,$beforeversionarray) <= 0) @@ -333,7 +333,7 @@ if (! GETPOST('action','aZ09') || preg_match('/upgrade/i',GETPOST('action','aZ09 migrate_categorie_association($db,$langs,$conf); } - // Script for VX (X<3.4) -> V3.4 + // Script for 3.4 // No specific scripts // Tasks to do always and only into last targeted version @@ -344,7 +344,7 @@ if (! GETPOST('action','aZ09') || preg_match('/upgrade/i',GETPOST('action','aZ09 migrate_event_assignement($db,$langs,$conf); } - // Scripts for last version + // Scripts for 3.9 $afterversionarray=explode('.','3.7.9'); $beforeversionarray=explode('.','3.8.9'); if (versioncompare($versiontoarray,$afterversionarray) >= 0 && versioncompare($versiontoarray,$beforeversionarray) <= 0) @@ -352,7 +352,7 @@ if (! GETPOST('action','aZ09') || preg_match('/upgrade/i',GETPOST('action','aZ09 // No particular code } - // Scripts for last version + // Scripts for 4.0 $afterversionarray=explode('.','3.9.9'); $beforeversionarray=explode('.','4.0.9'); if (versioncompare($versiontoarray,$afterversionarray) >= 0 && versioncompare($versiontoarray,$beforeversionarray) <= 0) @@ -360,7 +360,7 @@ if (! GETPOST('action','aZ09') || preg_match('/upgrade/i',GETPOST('action','aZ09 migrate_rename_directories($db,$langs,$conf,'/fckeditor','/medias'); } - // Scripts for last version + // Scripts for 5.0 $afterversionarray=explode('.','4.0.9'); $beforeversionarray=explode('.','5.0.9'); if (versioncompare($versiontoarray,$afterversionarray) >= 0 && versioncompare($versiontoarray,$beforeversionarray) <= 0) @@ -372,7 +372,7 @@ if (! GETPOST('action','aZ09') || preg_match('/upgrade/i',GETPOST('action','aZ09 migrate_remise_except_entity($db,$langs,$conf); } - // Scripts for last version + // Scripts for 6.0 $afterversionarray=explode('.','5.0.9'); $beforeversionarray=explode('.','6.0.9'); if (versioncompare($versiontoarray,$afterversionarray) >= 0 && versioncompare($versiontoarray,$beforeversionarray) <= 0) @@ -393,7 +393,7 @@ if (! GETPOST('action','aZ09') || preg_match('/upgrade/i',GETPOST('action','aZ09 } } - // Scripts for last version + // Scripts for 7.0 $afterversionarray=explode('.','6.0.9'); $beforeversionarray=explode('.','7.0.9'); if (versioncompare($versiontoarray,$afterversionarray) >= 0 && versioncompare($versiontoarray,$beforeversionarray) <= 0) @@ -403,6 +403,15 @@ if (! GETPOST('action','aZ09') || preg_match('/upgrade/i',GETPOST('action','aZ09 migrate_reset_blocked_log($db,$langs,$conf); } + + // Scripts for 8.0 + $afterversionarray=explode('.','7.0.9'); + $beforeversionarray=explode('.','8.0.9'); + if (versioncompare($versiontoarray,$afterversionarray) >= 0 && versioncompare($versiontoarray,$beforeversionarray) <= 0) + { + migrate_rename_directories($db,$langs,$conf,'/contracts','/contract'); + } + } // Code executed only if migration is LAST ONE. Must always be done.