Recurrent Invoices: fixed buggy call to non existing function and payment terms type...
[fa-stable.git] / sql / alter2.5.php
1 <?php
2 /**********************************************************************
3     Copyright (C) FrontAccounting, LLC.
4         Released under the terms of the GNU General Public License, GPL, 
5         as published by the Free Software Foundation, either version 3 
6         of the License, or (at your option) any later version.
7     This program is distributed in the hope that it will be useful,
8     but WITHOUT ANY WARRANTY; without even the implied warranty of
9     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
10     See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
11 ***********************************************************************/
12
13 class fa2_5 extends fa_patch {
14         var $previous = '2.4.1';                // applicable database version
15         var $version = '2.5.0'; // version installed
16         var $description;
17         var $sql = 'alter2.5.sql';
18         var     $max_upgrade_time = 900;
19         
20         function __construct() {
21                 parent::__construct();
22                 $this->description = _('Upgrade from version 2.4 to 2.5');
23         }
24
25     /*
26             Shows parameters to be selected before upgrade (if any)
27         */
28     function show_params($company)
29         {
30
31                 display_note(_('Check upgrade parameters below and start upgrade.'));
32                 start_table(TABLESTYLE);
33                 table_section(1);
34                 table_section_title(_("Shipments category default settings"));
35                 text_row(_("Category Name:"), 'shipping_cat_description', _('Shippment'), 30, 30);
36                 item_tax_types_list_row(_('Item Tax Type:'), 'shipping_tax_type');
37                 stock_units_list_row(_('Unit of measure:'), 'shipping_units');
38                 gl_all_accounts_list_row(_("Sales Account:"), 'shipping_sales_act', get_company_pref('freight_act'));
39                 gl_all_accounts_list_row(_("C.O.G.S. Account:"), 'shipping_cogs_act', get_company_pref('default_cogs_act'));
40                 end_table();
41                 br();
42
43     }
44
45     /*
46             Fetch & check upgrade parameters, check additional upgrade pre-conditions, set SQL variables.
47                 This function is run after successfull switching to target database connection, before sql upgrade script is run.
48     */
49         function prepare()
50     {
51         // set upgrade script parameters
52         foreach( array('shipping_cat_description', 'shipping_tax_type', 'shipping_units', 'shipping_sales_act', 'shipping_cogs_act') as $name)
53                         db_query("SET @$name=".db_escape(get_post($name)));
54                 return true;
55         }
56
57
58         /*
59                 Install procedure. All additional changes 
60                 not included in sql file should go here.
61         */
62         function install($company, $force=false)
63         {
64                 return true;
65         }
66
67         /*
68                 Optional procedure done after upgrade fail, before backup is restored
69         */
70         function post_fail($company)
71         {
72         }
73
74 }
75
76 $install = new fa2_5;