function can_commit() { global $Refs; if (!get_post('supplier_id')) { display_error(_("There is no supplier selected.")); set_focus('supplier_id'); return false; } if (!is_date($_POST['OrderDate'])) { display_error(_("The entered order date is invalid.")); set_focus('OrderDate'); return false; } if ($_SESSION['PO']->trans_type != ST_PURCHORDER && !is_date_in_fiscalyear($_POST['OrderDate'])) { display_error(_("The entered date is not in fiscal year")); set_focus('OrderDate'); return false; } if ($_SESSION['PO']->trans_type == ST_SUPPINVOICE && !is_date($_POST['due_date'])) { display_error(_("The entered due date is invalid.")); set_focus('due_date'); return false; } if (!$_SESSION['PO']->order_no) { if (!$Refs->is_valid(get_post('ref'))) { display_error(_("There is no reference entered for this purchase order.")); set_focus('ref'); return false; } if (!is_new_reference(get_post('ref'), $_SESSION['PO']->trans_type)) { display_error(_("The entered reference is already in use.")); set_focus('ref'); return false; } } if ($_SESSION['PO']->trans_type == ST_SUPPINVOICE && !$Refs->is_valid(get_post('supp_ref'))) { display_error(_("You must enter a supplier's invoice reference.")); set_focus('supp_ref'); return false; } if ($_SESSION['PO']->trans_type == ST_SUPPINVOICE && is_reference_already_there($_SESSION['PO']->supplier_id, get_post('supp_ref'), $_SESSION['PO']->order_no)) { display_error(_("This invoice number has already been entered. It cannot be entered again.") . " (" . get_post('supp_ref') . ")"); set_focus('supp_ref'); return false; } if ($_SESSION['PO']->trans_type == ST_PURCHORDER && get_post('delivery_address') == '') { display_error(_("There is no delivery address specified.")); set_focus('delivery_address'); return false; } if (get_post('StkLocation') == '') { display_error(_("There is no location specified to move any items into.")); set_focus('StkLocation'); return false; } if (!db_has_currency_rates($_SESSION['PO']->curr_code, $_POST['OrderDate'])) { return false; } if ($_SESSION['PO']->order_has_items() == false) { display_error(_("The order cannot be placed because there are no lines entered on this order.")); return false; } return true; }
function check_data() { global $Refs; if (!$_SESSION['supp_trans']->is_valid_trans_to_post()) { display_error(_("The invoice cannot be processed because the there are no items or values on the invoice. Invoices are expected to have a charge.")); return false; } if (!$Refs->is_valid($_SESSION['supp_trans']->reference)) { display_error(_("You must enter an invoice reference.")); set_focus('reference'); return false; } if (!is_new_reference($_SESSION['supp_trans']->reference, ST_SUPPINVOICE)) { display_error(_("The entered reference is already in use.")); set_focus('reference'); return false; } if (!$Refs->is_valid($_SESSION['supp_trans']->supp_reference)) { display_error(_("You must enter a supplier's invoice reference.")); set_focus('supp_reference'); return false; } if (!is_date($_SESSION['supp_trans']->tran_date)) { display_error(_("The invoice as entered cannot be processed because the invoice date is in an incorrect format.")); set_focus('trans_date'); return false; } elseif (!is_date_in_fiscalyear($_SESSION['supp_trans']->tran_date)) { display_error(_("The entered date is not in fiscal year.")); set_focus('trans_date'); return false; } if (!is_date($_SESSION['supp_trans']->due_date)) { display_error(_("The invoice as entered cannot be processed because the due date is in an incorrect format.")); set_focus('due_date'); return false; } if (is_reference_already_there($_SESSION['supp_trans']->supplier_id, $_POST['supp_reference'])) { /*Transaction reference already entered */ display_error(_("This invoice number has already been entered. It cannot be entered again.") . " (" . $_POST['supp_reference'] . ")"); return false; } return true; }