From: Janusz Dobrowolski Date: Tue, 8 Sep 2009 14:28:31 +0000 (+0000) Subject: Added detection of partial db upgrade. X-Git-Tag: v2.4.2~19^2~1270 X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=commitdiff_plain;h=b6b3aa61949d948e12f8f1b85ad0b3babbc3dd9b;p=fa-stable.git Added detection of partial db upgrade. --- diff --git a/sql/alter2.1.php b/sql/alter2.1.php index 371c3d6a..2d5be22d 100644 --- a/sql/alter2.1.php +++ b/sql/alter2.1.php @@ -146,13 +146,14 @@ class fa2_1 { // Test if patch was applied before. // function installed($pref) { - if (check_table($pref, 'item_codes')) return false; - if (check_table($pref, 'company', 'foreign_codes')) return false; - if (check_table($pref, 'suppliers', 'credit_limit')) return false; - if (check_table($pref, 'bank_trans', 'reconciled', - array('Type'=>'date'))) return false; - if (check_table($pref, 'trans_tax_details')) return false; - return true; + $n = 5; // number of features to be installed + if (!check_table($pref, 'item_codes')) $n--; + if (!check_table($pref, 'company', 'foreign_codes')) $n--; + if (!check_table($pref, 'suppliers', 'credit_limit')) $n--; + if (!check_table($pref, 'bank_trans', 'reconciled', + array('Type'=>'date'))) $n--; + if (!check_table($pref, 'trans_tax_details')) $n--; + return $n == 0 ? true : 5 - $n; } };