From: Janusz Dobrowolski Date: Sat, 14 Sep 2013 16:07:13 +0000 (+0200) Subject: Various small code cleanups. X-Git-Tag: 2.3-final~199 X-Git-Url: https://delta.frontaccounting.com/gitweb/?p=fa-stable.git;a=commitdiff_plain;h=8597db529c1b855fb886f33557f9b5a93620913a Various small code cleanups. --- diff --git a/gl/bank_transfer.php b/gl/bank_transfer.php index 6deb5fe2..281c671d 100644 --- a/gl/bank_transfer.php +++ b/gl/bank_transfer.php @@ -87,7 +87,7 @@ function gl_payment_controls() amount_row(_("Amount:"), 'amount', null, null, $from_currency); amount_row(_("Bank Charge:"), 'charge', null, null, $from_currency); - amount_row("Incomming Amount:", 'target_amount', null, '', $to_currency, 2); + amount_row(_("Incomming Amount:"), 'target_amount', null, '', $to_currency, 2); } else { diff --git a/gl/includes/db/gl_db_banking.inc b/gl/includes/db/gl_db_banking.inc index 5774de85..13fbd6de 100644 --- a/gl/includes/db/gl_db_banking.inc +++ b/gl/includes/db/gl_db_banking.inc @@ -35,7 +35,7 @@ function add_exchange_variation($trans_no, $date_, $acc_id, $account, } $amount = get_gl_trans_from_to("", $date_, $account); $diff = $amount - $for_amount; - if ($diff != 0) + if (floatcmp($diff,0)) { if ($trans_no == null) $trans_no = get_next_trans_no(ST_JOURNAL); @@ -45,8 +45,9 @@ function add_exchange_variation($trans_no, $date_, $acc_id, $account, -$diff, null, $person_type_id, $person_id); add_gl_trans(ST_JOURNAL, $trans_no, $date_, get_company_pref('exchange_diff_act'), 0, 0, _("Exchange Variance"), $diff, null, $person_type_id, $person_id); + return true; } - return ($diff != 0); + return false; } //------------- New helper functions for revaluation of customer/supplier currencies 2011-05-08 Joe Hunt. diff --git a/purchasing/supplier_payment.php b/purchasing/supplier_payment.php index c68e482f..86d102de 100644 --- a/purchasing/supplier_payment.php +++ b/purchasing/supplier_payment.php @@ -143,13 +143,6 @@ function check_inputs() } } -// if (isset($_POST['_ex_rate']) && !check_num('_ex_rate', 0.000001)) -// { -// display_error(_("The exchange rate must be numeric and greater than zero.")); -// set_focus('_ex_rate'); -// return false; -// } - if ($_POST['discount'] == "") { $_POST['discount'] = 0; @@ -162,7 +155,6 @@ function check_inputs() return false; } - //if (input_num('amount') - input_num('discount') <= 0) if (input_num('amount') <= 0) { display_error(_("The total of the amount and the discount is zero or negative. Please enter positive values.")); @@ -228,19 +220,6 @@ function check_inputs() function handle_add_payment() { - $supp_currency = get_supplier_currency($_POST['supplier_id']); - $bank_currency = get_bank_account_currency($_POST['bank_account']); - $comp_currency = get_company_currency(); - - if ($comp_currency != $bank_currency && $bank_currency != $supp_currency) - $rate = 0; - else - { - $rate = input_num('_ex_rate'); - $supplier_amount = input_num('bank_amount'); - if($supplier_amount) $rate = input_num('amount')/$supplier_amount; - } - $payment_id = write_supp_payment(0, $_POST['supplier_id'], $_POST['bank_account'], $_POST['DatePaid'], $_POST['ref'], input_num('amount'), input_num('discount'), $_POST['memo_'], input_num('charge'), input_num('bank_amount', input_num('amount'))); diff --git a/sales/customer_payments.php b/sales/customer_payments.php index 54906258..4e707158 100644 --- a/sales/customer_payments.php +++ b/sales/customer_payments.php @@ -249,14 +249,6 @@ if (isset($_POST['_customer_id_button'])) { //---------------------------------------------------------------------------------------------- if (get_post('AddPaymentItem') && can_process()) { - - $cust_currency = get_customer_currency($_POST['customer_id']); - $bank_currency = get_bank_account_currency($_POST['bank_account']); - $comp_currency = get_company_currency(); -// if ($comp_currency != $bank_currency && $bank_currency != $cust_currency) -// $rate = 0; -// else -// $rate = input_num('_ex_rate'); new_doc_date($_POST['DateBanked']); diff --git a/sales/inquiry/customer_inquiry.php b/sales/inquiry/customer_inquiry.php index 3ebc84b5..6c9a97cc 100644 --- a/sales/inquiry/customer_inquiry.php +++ b/sales/inquiry/customer_inquiry.php @@ -167,36 +167,29 @@ function credit_link($row) function edit_link($row) { - $str = ''; - - if (@$_GET['popup']) + if (@$_GET['popup'] || get_voided_entry($row['type'], $row["trans_no"]) || is_closed_trans($row['type'], $row["trans_no"])) return ''; + + $str = ''; switch($row['type']) { - case ST_SALESINVOICE: - if (get_voided_entry(ST_SALESINVOICE, $row["trans_no"]) === false && $row['Allocated'] == 0) + case ST_SALESINVOICE: $str = "/sales/customer_invoice.php?ModifyInvoice=".$row['trans_no']; break; - case ST_CUSTCREDIT: - if (get_voided_entry(ST_CUSTCREDIT, $row["trans_no"]) === false && $row['Allocated'] == 0) // 2008-11-19 Joe Hunt - { + case ST_CUSTCREDIT: if ($row['order_']==0) // free-hand credit note $str = "/sales/credit_note_entry.php?ModifyCredit=".$row['trans_no']; else // credit invoice $str = "/sales/customer_credit_invoice.php?ModifyCredit=".$row['trans_no']; - } break; - case ST_CUSTDELIVERY: - if (get_voided_entry(ST_CUSTDELIVERY, $row["trans_no"]) === false) + case ST_CUSTDELIVERY: $str = "/sales/customer_delivery.php?ModifyDelivery=".$row['trans_no']; break; - case ST_CUSTPAYMENT: - if (get_voided_entry(ST_CUSTPAYMENT, $row["trans_no"]) === false) + case ST_CUSTPAYMENT: $str = "/sales/customer_payments.php?trans_no=".$row['trans_no']; break; - } - if ($str != "" && !is_closed_trans($row['type'], $row["trans_no"])) - return pager_link(_('Edit'), $str, ICON_EDIT); - return ''; + } + + return $str ? pager_link(_('Edit'), $str, ICON_EDIT) : ''; } function prt_link($row)