From: Joe Hunt Date: Sat, 5 Apr 2008 08:54:12 +0000 (+0000) Subject: Fixed a bug when creating subfolder for new companies. Should be company id and not... X-Git-Tag: v2.4.2~19^2~2116 X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=commitdiff_plain;h=1bcf988071670424e8bc88eb98156ecda13c3488;p=fa-stable.git Fixed a bug when creating subfolder for new companies. Should be company id and not the table pref counter. --- diff --git a/CHANGELOG.txt b/CHANGELOG.txt index bced9063..d8e59a4d 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -19,6 +19,10 @@ Legend: ! -> Note $ -> Affected files +05-Apr-2008 Joe Hunt +# Fixed a bug when creating subfolder for new companies. Should be company id and not the table pref counter. +$ /admin/create_coy.php + 05-Apr-2008 Joe Hunt # Removed annoying warnings in several reports. $ config.php diff --git a/admin/create_coy.php b/admin/create_coy.php index b43224ab..ddce8db2 100644 --- a/admin/create_coy.php +++ b/admin/create_coy.php @@ -113,19 +113,22 @@ function handle_submit() display_error(_("Cannot write to the configuration file - ") . $path_to_root . "/config_db.php"); else if ($error == -3) display_error(_("The configuration file ") . $path_to_root . "/config_db.php" . _(" is not writable. Change its permissions so it is, then re-run the operation.")); - if ($error != 0) { + if ($error != 0) + { return false; } $index = ""; - - if ($new) { - $cdir = $comp_path.'/'.($tb_pref_counter-1); - @mkdir($cdir); + + if ($new) + { + $cdir = $comp_path.'/'.$id; + @mkdir($cdir); save_to_file($cdir.'/'.'index.php', 0, $index); - - foreach($comp_subdirs as $dir) { - @mkdir($cdir.'/'.$dir); - save_to_file($cdir.'/'.$dir.'/'.'index.php', 0, $index); + + foreach($comp_subdirs as $dir) + { + @mkdir($cdir.'/'.$dir); + save_to_file($cdir.'/'.$dir.'/'.'index.php', 0, $index); } } return true; @@ -139,10 +142,6 @@ function handle_delete() $id = $_GET['id']; - $pref = $db_connections[$id]['tbpref']; - if($pref!='') - $pref = substr($pref, 0, strlen($pref)-1); - $err = remove_connection($id); if ($err == 0) display_error(_("Error removing Database: ") . $dbase . _(", please remove it manuallly")); @@ -159,13 +158,14 @@ function handle_delete() if ($error != 0) return; - $cdir = $comp_path.'/'.$pref; + $cdir = $comp_path.'/'.$id; flush_dir($cdir); - if (!rmdir($cdir)) { + if (!rmdir($cdir)) + { display_error(_("Cannot remove company data directory ") . $cdir); return; } - + meta_forward($_SERVER['PHP_SELF']); }