Fixed bug in company upgrade.
authorJanusz Dobrowolski <janusz@frontaccounting.eu>
Tue, 11 May 2010 21:48:05 +0000 (21:48 +0000)
committerJanusz Dobrowolski <janusz@frontaccounting.eu>
Tue, 11 May 2010 21:48:05 +0000 (21:48 +0000)
admin/create_coy.php
admin/db/company_db.inc

index 1ee6d4003cd34341573d1a357bad1b0dd3ed4e15..2d9242f43d1f01d5ddb8e3a4544baeec6b342d15 100644 (file)
@@ -185,7 +185,7 @@ function handle_delete()
        // Without this after operation we end up with changed per-company owners!
        for($i = $id; $i < count($db_connections); $i++) {
                        $comp_path = company_path($i);
-               if (!is_dir($comp_path.'/'.$i) || !is_writable($comp_path.'/'.$i)) {
+               if (!is_dir($comp_path) || !is_writable($comp_path)) {
                        display_error(_('Broken company subdirectories system. You have to remove this company manually.'));
                        return;
                }
index 632bab18a4775f83cf93de32571eb9612f72d860..cf20d52b8b00a65b96120d315417b5846916f8fe 100644 (file)
@@ -12,9 +12,9 @@
 /*
        Update main or gl company setup.
 */
-function update_company_prefs( $params )
+function update_company_prefs( $params, $pref = TB_PREF )
 {
-       $sql = "UPDATE ".TB_PREF."sys_prefs SET value = ";
+       $sql = "UPDATE {$pref}sys_prefs SET value = ";
        foreach($params as $name => $value) {
                if (!db_query($sql. db_escape($value). " WHERE name=".db_escape($name),
                         "The company prefferences could not be updated "))
@@ -38,7 +38,7 @@ function get_company_pref($prefs = null, $tbpref = TB_PREF)
 
                $_SESSION['SysPrefs'] = new sys_prefs();
 
-               $sql = "SELECT name, value FROM ".$tbpref."sys_prefs";
+               $sql = "SELECT name, value FROM {$tbpref}sys_prefs";
                $result = @db_query($sql); // supress errors before 2.3 db structure upgrade
 
                if(!$result)