Fixed point of sale handling and terms selection
[fa-stable.git] / sql / alter2.1.php
index ddfb6fe2a6506fd5414779c37c4db929e00261c8..ff9467a292f4fa1e3446f3008e5cfa7a3c3d3335 100644 (file)
@@ -1,18 +1,22 @@
 <?php
 /**********************************************************************
     Copyright (C) FrontAccounting, LLC.
-       Released under the terms of the GNU Affero General Public License,
-       AGPL, as published by the Free Software Foundation, either version 
-       of the License, or (at your option) any later version.
+       Released under the terms of the GNU General Public License, GPL, 
+       as published by the Free Software Foundation, either version 3 
+       of the License, or (at your option) any later version.
     This program is distributed in the hope that it will be useful,
     but WITHOUT ANY WARRANTY; without even the implied warranty of
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-    See the License here <http://www.gnu.org/licenses/agpl-3.0.html>.
+    See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
 ***********************************************************************/
 class fa2_1 {
        var $version = '2.1';   // version installed
-       var $description = 'Version 2.1';
+       var $description;
        var $sql = 'alter2.1.sql';
+
+       function fa2_1() {
+               $this->description = _('Upgrade from version 2.0 to 2.1');
+       }
        //
        //      Install procedure. All additional changes 
        //      not included in sql file should go here.
@@ -146,13 +150,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 = 4; // 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;
        }
 };