Bug in presenting ST_JOURNAL in AR/AP Reports.
[fa-stable.git] / sales / sales_order_entry.php
index 3517196df208c18965e70d7b915fde0269af05be..58958eb15ecd70b72e2b11137d0c8a472486867d 100644 (file)
@@ -101,6 +101,11 @@ if (isset($_GET['NewDelivery']) && is_numeric($_GET['NewDelivery'])) {
 
 page($_SESSION['page_title'], false, false, "", $js);
 
+if (isset($_GET['ModifyOrderNumber']) && is_prepaid_order_open($_GET['ModifyOrderNumber']))
+{
+       display_error(_("This order cannot be edited because there are invoices or payments related to it, and prepayment terms were used."));
+       end_page(); exit;
+}
 if (isset($_GET['ModifyOrderNumber']))
        check_is_editable(ST_SALESORDER, $_GET['ModifyOrderNumber']);
 elseif (isset($_GET['ModifyQuotationNumber']))
@@ -385,7 +390,7 @@ function can_process() {
                return false;
        }
        if ($_SESSION['Items']->payment_terms['cash_sale'] == 0) {
-               if (!$_SESSION['Items']->is_started() && ($_SESSION['Items']->payment_terms['days_before_due'] < 0) && ((input_num('prep_amount')<=0) ||
+               if (!$_SESSION['Items']->is_started() && ($_SESSION['Items']->payment_terms['days_before_due'] == -1) && ((input_num('prep_amount')<=0) ||
                        input_num('prep_amount')>$_SESSION['Items']->get_trans_total())) {
                        display_error(_("Pre-payment required have to be positive and less than total amount."));
                        set_focus('prep_amount');