X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=sql%2Falter2.1.php;h=ff9467a292f4fa1e3446f3008e5cfa7a3c3d3335;hb=87af4ea9405a74c0e4be19b9076f6d6d64b20e29;hp=155aa4a4c48aa1c1fb09151f655b8db0c9478511;hpb=4e436722cb991b7273c08bdc1dc53b5390772972;p=fa-stable.git diff --git a/sql/alter2.1.php b/sql/alter2.1.php index 155aa4a4..ff9467a2 100644 --- a/sql/alter2.1.php +++ b/sql/alter2.1.php @@ -1,18 +1,22 @@ . + See the License here . ***********************************************************************/ 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. @@ -75,7 +79,8 @@ class fa2_1 { $move_sql =array( "debtor_trans_tax_details" => "SELECT tr.tran_date, tr.type, tr.trans_no, dt.tax_type_id, - dt.rate, dt.included_in_price, dt.amount, tr.reference as ref + dt.rate, dt.included_in_price, dt.amount, tr.reference as ref, + tr.rate as ex_rate FROM ".$pref."debtor_trans_tax_details dt LEFT JOIN ".$pref."trans_tax_details tt ON dt.debtor_trans_no=tt.trans_no @@ -87,7 +92,8 @@ class fa2_1 { "supp_invoice_tax_items" => "SELECT tr.tran_date, tr.type, tr.trans_no, st.tax_type_id, - st.rate, st.included_in_price, st.amount, tr.supp_reference as ref + st.rate, st.included_in_price, st.amount, tr.supp_reference as ref, + tr.rate as ex_rate FROM ".$pref."supp_invoice_tax_items st LEFT JOIN ".$pref."trans_tax_details tt ON st.supp_trans_no=tt.trans_no @@ -106,12 +112,12 @@ class fa2_1 { ($row['amount']/$row['rate']*(100-$row['rate'])) :($row['amount']/$row['rate']*100)); $sql2 = "INSERT INTO ".$pref."trans_tax_details - (trans_type,trans_no,tran_date,tax_type_id,rate, + (trans_type,trans_no,tran_date,tax_type_id,rate,ex_rate, included_in_price, net_amount, amount, memo) VALUES ('".$row['type']."','".$row['trans_no']."','" .$row['tran_date']."','".$row['tax_type_id']."','" - .$row['rate']."','".$row['included_in_price']."','" - .$net_amount + .$row['rate']."','".$row['ex_rate']."','" + .$row['included_in_price']."','".$net_amount ."','".$row['amount']."','".$row['ref']."')"; db_query($sql2, "Cannot move trans tax details from $tbl"); } @@ -144,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; } };