static $cached; // retrieve values from db once a request. Some values can't be cached between requests
// to ensure prefs integrity for all usrs (e.g. gl_close_date).
- if (!$cached) { // cached preferences
+ if (!$cached || !isset($_SESSION['SysPrefs'])) { // cached preferences
$_SESSION['SysPrefs'] = new sys_prefs();
$patchcnt = 0;
if (!$this->beta) {
$n = 16;
- if (check_table($pref, 'company', 'custom1_name')) $patchcnt++;
- if (!check_table($pref, 'company', 'profit_loss_year_act')) $patchcnt++;
- if (!check_table($pref, 'company', 'login_tout')) $patchcnt++;
+ if (check_table($pref, 'company')) // skip in 2.3
+ $n -= 3;
+ else {
+ if (check_table($pref, 'company', 'custom1_name')) $patchcnt++;
+ if (!check_table($pref, 'company', 'profit_loss_year_act')) $patchcnt++;
+ if (!check_table($pref, 'company', 'login_tout')) $patchcnt++;
+ }
if (!check_table($pref, 'stock_category', 'dflt_no_sale')) $patchcnt++;
if (!check_table($pref, 'users', 'sticky_doc_date')) $patchcnt++;
if (!check_table($pref, 'users', 'startup_tab')) $patchcnt++;
}
}
+ if (empty($keys)) { // comments table have no primary key, so let's give up
+ continue;
+ }
if ($test)
error_log("Table $table (".implode(',',$keys)."):(".implode(',',$textcols)."):");
$key[] = $k.'=\''.$rec[substr($k,1,-1)].'\'';
}
$sql .= implode( ' AND ', $key);
- if ($test)
+ if ($test) {
+ error_log($sql);
error_log("\t(".implode(',',$val).") updated");
- else
+ } else
db_query($sql, 'cannot update record');
}
}