// 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;
}
/*
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 "))
$_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)