function can_process() { $Auth_Result = hook_authenticate($_SESSION["wa_current_user"]->username, $_POST['cur_password']); if (!isset($Auth_Result)) { // if not used external login: standard method $Auth_Result = get_user_auth($_SESSION["wa_current_user"]->username, md5($_POST['cur_password'])); } if (!$Auth_Result) { display_error(_("Invalid password entered.")); set_focus('cur_password'); return false; } if (strlen($_POST['password']) < 4) { display_error(_("The password entered must be at least 4 characters long.")); set_focus('password'); return false; } if (strstr($_POST['password'], $_SESSION["wa_current_user"]->username) != false) { display_error(_("The password cannot contain the user login.")); set_focus('password'); return false; } if ($_POST['password'] != $_POST['passwordConfirm']) { display_error(_("The passwords entered are not the same.")); set_focus('password'); return false; } return true; }
function on_submit($selected_parent, $selected_component = -1) { if (!check_num('quantity', 0)) { display_error(_("The quantity entered must be numeric and greater than zero.")); set_focus('quantity'); return; } if ($selected_component != -1) { update_bom($selected_parent, $selected_component, $_POST['workcentre_added'], $_POST['loc_code'], input_num('quantity')); display_notification(_('Selected component has been updated')); $Mode = 'RESET'; } else { /*Selected component is null cos no item selected on first time round so must be adding a record must be Submitting new entries in the new component form */ //need to check not recursive bom component of itself! if (!check_for_recursive_bom($selected_parent, $_POST['component'])) { /*Now check to see that the component is not already on the bom */ if (!is_component_already_on_bom($_POST['component'], $_POST['workcentre_added'], $_POST['loc_code'], $selected_parent)) { add_bom($selected_parent, $_POST['component'], $_POST['workcentre_added'], $_POST['loc_code'], input_num('quantity')); display_notification(_("A new component part has been added to the bill of material for this item.")); $Mode = 'RESET'; } else { /*The component must already be on the bom */ display_error(_("The selected component is already on this bom. You can modify it's quantity but it cannot appear more than once on the same bom.")); } } else { display_error(_("The selected component is a parent of the current item. Recursive BOMs are not allowed.")); } } }
function handle_submit() { global $selected_id, $Mode; $ok = true; if ($selected_id != -1) { // make from_date start of month and to_date a year minus one day later $_POST['from_date'] = start_month($_POST['from_date']); $_POST['to_date'] = end_month(add_months($_POST['from_date'], 11)); if ($_POST['closed'] == 1) { if (check_years_before($_POST['from_date'], false)) { display_error(_("Cannot CLOSE this year because there are open fiscal years before")); set_focus('closed'); return false; } $ok = close_year($selected_id); } else { open_year($selected_id); } if ($ok) { update_fiscalyear($selected_id, $_POST['from_date'], $_POST['to_date'], $_POST['closed']); display_notification(_('Selected fiscal year has been updated')); } } else { if (!check_data()) { return false; } add_fiscalyear($_POST['from_date'], $_POST['to_date'], $_POST['closed']); display_notification(_('New fiscal year has been added')); } $Mode = 'RESET'; }
function can_process() { if (strlen($_POST['CustName']) == 0) { display_error(_("The customer name cannot be empty.")); set_focus('CustName'); return false; } if (strlen($_POST['cust_ref']) == 0) { display_error(_("The customer short name cannot be empty.")); set_focus('cust_ref'); return false; } if (!check_num('credit_limit', 0)) { display_error(_("The credit limit must be numeric and not less than zero.")); set_focus('credit_limit'); return false; } if (!check_num('pymt_discount', 0, 100)) { display_error(_("The payment discount must be numeric and is expected to be less than 100% and greater than or equal to 0.")); set_focus('pymt_discount'); return false; } if (!check_num('discount', 0, 100)) { display_error(_("The discount percentage must be numeric and is expected to be less than 100% and greater than or equal to 0.")); set_focus('discount'); return false; } return true; }
function can_process() { if (!is_date($_POST['CreditDate'])) { display_error(tr("The entered date is invalid.")); set_focus('CreditDate'); return false; } elseif (!is_date_in_fiscalyear($_POST['CreditDate'])) { display_error(tr("The entered date is not in fiscal year.")); set_focus('CreditDate'); return false; } if ($_SESSION['Items']->trans_no == 0) { if (!references::is_valid($_POST['ref'])) { display_error(tr("You must enter a reference.")); set_focus('ref'); return false; } if (!is_new_reference($_POST['ref'], 11)) { display_error(tr("The entered reference is already in use.")); set_focus('ref'); return false; } } if (!check_num('ChargeFreightCost', 0)) { display_error(tr("The entered shipping cost is invalid or less than zero.")); set_focus('ChargeFreightCost'); return false; } return true; }
function can_process() { if (strlen($_POST['fname']) == 0) { display_error(_("First name cannot be empty.")); set_focus('code'); return false; } if (strlen($_POST['lname']) == 0) { display_error(_("Last name cannot be empty.")); set_focus('code'); return false; } if (strlen($_POST['address']) == 0) { display_error(_("Address cannot be empty.")); set_focus('code'); return false; } if (strlen($_POST['contact_number']) == 0) { display_error(_("Contact number cannot be empty.")); set_focus('code'); return false; } if (strlen($_POST['email_address']) == 0) { display_error(_("Email address cannot be empty.")); set_focus('code'); return false; } return true; }
function check_data() { $total_allocated = 0; for ($counter = 0; $counter < $_POST["TotalNumberOfAllocs"]; $counter++) { if (!check_num('amount' . $counter)) { display_error(tr("The entry for one or more amounts is invalid.")); set_focus('amount' . $counter); return false; } if (!check_num('amount' . $counter, 0)) { display_error(tr("The entry for an amount to allocate was negative. A positive allocation amount is expected.")); set_focus('amount' . $counter); return false; } /*Now check to see that the AllocAmt is no greater than the amount left to be allocated against the transaction under review */ if (input_num('amount' . $counter) > $_POST['un_allocated' . $counter]) { //$_POST['amount' . $counter] = $_POST['un_allocated' . $counter]; } $_SESSION['alloc']->allocs[$counter]->current_allocated = input_num('amount' . $counter); $total_allocated += input_num('amount' . $counter); } if ($total_allocated - $_SESSION['alloc']->amount > sys_prefs::allocation_settled_allowance()) { display_error(tr("These allocations cannot be processed because the amount allocated is more than the total amount left to allocate.")); //echo tr("Total allocated:") . " " . $total_allocated ; //echo " " . tr("Total amount that can be allocated:") . " " . -$_SESSION['alloc']->TransAmt . "<BR>"; return false; } return true; }
function check_data() { global $Refs; if (!is_date($_POST['date'])) { display_error(_("The entered date is invalid.")); set_focus('date'); return false; } if (!is_date_in_fiscalyear($_POST['date'])) { display_error(_("The entered date is not in fiscal year.")); set_focus('date'); return false; } if (!$Refs->is_valid($_POST['ref'])) { display_error(_("You must enter a reference.")); set_focus('ref'); return false; } if (!is_new_reference($_POST['ref'], ST_JOURNAL)) { display_error(_("The entered reference is already in use.")); set_focus('ref'); return false; } return true; }
function can_process() { if (!check_num('po_over_receive', 0, 100)) { display_error(_("The delivery over-receive allowance must be between 0 and 100.")); set_focus('po_over_receive'); return false; } if (!check_num('po_over_charge', 0, 100)) { display_error(_("The invoice over-charge allowance must be between 0 and 100.")); set_focus('po_over_charge'); return false; } if (!check_num('past_due_days', 0, 100)) { display_error(_("The past due days interval allowance must be between 0 and 100.")); set_focus('past_due_days'); return false; } $grn_act = get_company_pref('grn_clearing_act'); if (get_post('grn_clearing_act') != $grn_act && db_num_rows(get_grn_items(0, '', true))) { display_error(_("Before GRN Clearing Account can be changed all GRNs have to be invoiced")); $_POST['grn_clearing_act'] = $grn_act; set_focus('grn_clearing_account'); return false; } if (!is_account_balancesheet(get_post('retained_earnings_act')) || is_account_balancesheet(get_post('profit_loss_year_act'))) { display_error(_("The Retained Earnings Account should be a Balance Account or the Profit and Loss Year Account should be an Expense Account (preferred the last one in the Expense Class)")); return false; } return true; }
function check_data() { global $check_price_charged_vs_order_price, $check_qty_charged_vs_del_qty; if (!check_num('this_quantity_inv', 0) || input_num('this_quantity_inv') == 0) { display_error(tr("The quantity to invoice must be numeric and greater than zero.")); set_focus('this_quantity_inv'); return false; } if (!check_num('ChgPrice')) { display_error(tr("The price is not numeric.")); set_focus('ChgPrice'); return false; } if ($check_price_charged_vs_order_price == True) { if ($_POST['order_price'] != input_num('ChgPrice')) { if ($_POST['order_price'] == 0 || input_num('ChgPrice') / $_POST['order_price'] > 1 + sys_prefs::over_charge_allowance() / 100) { display_error(tr("The price being invoiced is more than the purchase order price by more than the allowed over-charge percentage. The system is set up to prohibit this. See the system administrator to modify the set up parameters if necessary.") . tr("The over-charge percentage allowance is :") . sys_prefs::over_charge_allowance() . "%"); set_focus('ChgPrice'); return false; } } } if ($check_qty_charged_vs_del_qty == True) { if (input_num('this_quantity_inv') / ($_POST['qty_recd'] - $_POST['prev_quantity_inv']) > 1 + sys_prefs::over_charge_allowance() / 100) { display_error(tr("The quantity being invoiced is more than the outstanding quantity by more than the allowed over-charge percentage. The system is set up to prohibit this. See the system administrator to modify the set up parameters if necessary.") . tr("The over-charge percentage allowance is :") . sys_prefs::over_charge_allowance() . "%"); set_focus('this_quantity_inv'); return false; } } return true; }
function on_submit($selected_parent, $selected_component = null) { if (!check_num('quantity', 0)) { display_error(tr("The quantity entered must be numeric and greater than zero.")); set_focus('quantity'); return; } if (isset($selected_parent) && isset($selected_component)) { $sql = "UPDATE bom SET workcentre_added='" . $_POST['workcentre_added'] . "',\n\t\t\tloc_code='" . $_POST['loc_code'] . "',\n\t\t\tquantity= " . input_num('quantity') . "\n\t\t\tWHERE parent='" . $selected_parent . "'\n\t\t\tAND id='" . $selected_component . "'"; check_db_error("Could not update this bom component", $sql); db_query($sql, "could not update bom"); } elseif (!isset($selected_component) && isset($selected_parent)) { /*Selected component is null cos no item selected on first time round so must be adding a record must be Submitting new entries in the new component form */ //need to check not recursive bom component of itself! if (!check_for_recursive_bom($selected_parent, $_POST['component'])) { /*Now check to see that the component is not already on the bom */ $sql = "SELECT component FROM bom\n\t\t\t\tWHERE parent='{$selected_parent}'\n\t\t\t\tAND component='" . $_POST['component'] . "'\n\t\t\t\tAND workcentre_added='" . $_POST['workcentre_added'] . "'\n\t\t\t\tAND loc_code='" . $_POST['loc_code'] . "'"; $result = db_query($sql, "check failed"); if (db_num_rows($result) == 0) { $sql = "INSERT INTO bom (parent, component, workcentre_added, loc_code, quantity)\n\t\t\t\t\tVALUES ('{$selected_parent}', '" . $_POST['component'] . "', '" . $_POST['workcentre_added'] . "', '" . $_POST['loc_code'] . "', " . input_num('quantity') . ")"; db_query($sql, "check failed"); //$msg = tr("A new component part has been added to the bill of material for this item."); } else { /*The component must already be on the bom */ display_error(tr("The selected component is already on this bom. You can modify it's quantity but it cannot appear more than once on the same bom.")); } } else { display_error(tr("The selected component is a parent of the current item. Recursive BOMs are not allowed.")); } } }
function can_process($selected_id) { if (strlen(trim($_POST['id'])) == 0) { display_error(_("The account group id cannot be empty.")); set_focus('id'); return false; } if (strlen(trim($_POST['name'])) == 0) { display_error(_("The account group name cannot be empty.")); set_focus('name'); return false; } $type = get_account_type(trim($_POST['id'])); if ($type && $type['id'] != $selected_id) { display_error(_("This account group id is already in use.")); set_focus('id'); return false; } //if (strcmp($_POST['id'], $_POST['parent']) == 0) if ($_POST['id'] === $_POST['parent']) { display_error(_("You cannot set an account group to be a subgroup of itself.")); return false; } return true; }
function update_component($kit_code, $selected_item) { global $Mode, $Ajax, $selected_kit; if (!check_num('quantity', 0)) { display_error(_("The quantity entered must be numeric and greater than zero.")); set_focus('quantity'); return; } elseif ($_POST['description'] == '') { display_error(_("Item code description cannot be empty.")); set_focus('description'); return; } elseif ($selected_item == -1) { if (get_post('item_code') == '') { // New kit/alias definition $kit = get_item_kit($_POST['kit_code']); if (db_num_rows($kit)) { $input_error = 1; display_error(_("This item code is already assigned to stock item or sale kit.")); set_focus('kit_code'); return; } if (get_post('kit_code') == '') { display_error(_("Kit/alias code cannot be empty.")); set_focus('kit_code'); return; } } } if (check_item_in_kit($selected_item, $kit_code, $_POST['component'], true)) { display_error(_("The selected component contains directly or on any lower level the kit under edition. Recursive kits are not allowed.")); set_focus('component'); return; } /*Now check to see that the component is not already in the kit */ if (check_item_in_kit($selected_item, $kit_code, $_POST['component'])) { display_error(_("The selected component is already in this kit. You can modify it's quantity but it cannot appear more than once in the same kit.")); set_focus('component'); return; } if ($selected_item == -1) { // new item alias/kit if ($_POST['item_code'] == '') { $kit_code = $_POST['kit_code']; $selected_kit = $_POST['item_code'] = $kit_code; $msg = _("New alias code has been created."); } else { $msg = _("New component has been added to selected kit."); } add_item_code($kit_code, get_post('component'), get_post('description'), get_post('category'), input_num('quantity'), 0); display_notification($msg); } else { $props = get_kit_props($_POST['item_code']); update_item_code($selected_item, $kit_code, get_post('component'), $props['description'], $props['category_id'], input_num('quantity'), 0); display_notification(_("Component of selected kit has been updated.")); } $Mode = 'RESET'; $Ajax->activate('_page_body'); }
function can_process() { if (strlen($_POST['name']) == 0) { display_error(tr("The account class name cannot be empty.")); set_focus('name'); return false; } return true; }
function can_process() { if (strlen($_POST['royalty_percentage']) == 0) { display_error(_("Percentage cannot be empty.")); set_focus('royalty_percentage'); return false; } return true; }
function can_process() { if (strlen($_POST['shipper_name']) == 0) { display_error(_("The shipping company name cannot be empty.")); set_focus('shipper_name'); return false; } return true; }
function can_process() { if (strlen($_POST['reason_description']) == 0) { display_error(_("The credit status description cannot be empty.")); set_focus('reason_description'); return false; } return true; }
function check_date() { if (!is_date(get_post('reconcile_date'))) { display_error(_("Invalid reconcile date format")); set_focus('reconcile_date'); return false; } return true; }
function can_process() { if ($_POST['typeId'] == '') { display_error(_("Please select a category")); set_focus('typeId'); return false; } return true; }
function can_process() { if (strlen($_POST['name']) == 0) { display_error(_("The POS name cannot be empty.")); set_focus('pos_name'); return false; } return true; }
function can_process() { if (strlen($_POST['name']) == 0) { display_error(tr("The tax type name cannot be empty.")); set_focus('name'); return false; } elseif (!check_num('rate', 0)) { display_error(tr("The default tax rate must be numeric and not less than zero.")); set_focus('rate'); return false; } return true; }
function check_data() { if (!check_num('This_QuantityCredited', 0)) { display_error(tr("The quantity to credit must be numeric and greater than zero.")); set_focus('This_QuantityCredited'); return false; } if (!check_num('ChgPrice', 0)) { display_error(tr("The price is either not numeric or negative.")); set_focus('ChgPrice'); return false; } return true; }
function can_process() { if (strlen($_POST['sales_type']) == 0) { display_error(_("The sales type description cannot be empty.")); set_focus('sales_type'); return false; } if (!check_num('factor', 0)) { display_error(_("Calculation factor must be valid positive number.")); set_focus('factor'); return false; } return true; }
function can_process() { global $selected_id; if (strlen($_POST['name']) == 0) { display_error(tr("The account group name cannot be empty.")); set_focus('name'); return false; } if (isset($selected_id) && $selected_id == $_POST['parent']) { display_error(tr("You cannot set an account group to be a subgroup of itself.")); return false; } return true; }
function can_process($myrow) { if ($myrow['released']) { display_error(tr("This work order has already been released.")); set_focus('released'); return false; } // make sure item has components if (!has_bom($myrow['stock_id'])) { display_error(tr("This Work Order cannot be released. The selected item to manufacture does not have a bom.")); set_focus('stock_id'); return false; } return true; }
function can_process($myrow) { if ($myrow['released']) { display_error(_("This work order has already been released.")); set_focus('released'); return false; } // make sure item has components // We don't need to stop the user to release it if it's and advanced order. // The user know what he is doing. if (!has_bom($myrow['stock_id']) && $myrow['type'] != WO_ADVANCED) { display_error(_("This Work Order cannot be released. The selected item to manufacture does not have a bom.")); set_focus('stock_id'); return false; } return true; }
function check_data() { if (!$_SESSION['supp_trans']->is_valid_trans_to_post()) { display_error(tr("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 (!references::is_valid($_SESSION['supp_trans']->reference)) { display_error(tr("You must enter an invoice reference.")); set_focus('reference'); return false; } if (!is_new_reference($_SESSION['supp_trans']->reference, 20)) { display_error(tr("The entered reference is already in use.")); set_focus('reference'); return false; } if (!references::is_valid($_SESSION['supp_trans']->supp_reference)) { display_error(tr("You must enter a supplier's invoice reference.")); set_focus('supp_reference'); return false; } if (!is_date($_SESSION['supp_trans']->tran_date)) { display_error(tr("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(tr("The entered date is not in fiscal year.")); set_focus('trans_date'); return false; } if (!is_date($_SESSION['supp_trans']->due_date)) { display_error(tr("The invoice as entered cannot be processed because the due date is in an incorrect format.")); set_focus('due_date'); return false; } $sql = "SELECT Count(*) FROM supp_trans WHERE supplier_id='" . $_SESSION['supp_trans']->supplier_id . "' AND supp_reference='" . $_POST['supp_reference'] . "'"; $result = db_query($sql, "The sql to check for the previous entry of the same invoice failed"); $myrow = db_fetch_row($result); if ($myrow[0] == 1) { /*Transaction reference already entered */ display_error(tr("This invoice number has already been entered. It cannot be entered again." . " (" . $_POST['supp_reference'] . ")")); return false; } return true; }
function can_process() { global $use_oldstyle_convert; if (strlen(trim($_POST['id'])) == 0) { display_error(_("The account class ID cannot be empty.")); set_focus('id'); return false; } if (strlen(trim($_POST['name'])) == 0) { display_error(_("The account class name cannot be empty.")); set_focus('name'); return false; } if (isset($use_oldstyle_convert) && $use_oldstyle_convert == 1) { $_POST['Balance'] = check_value('Balance'); } return true; }
function can_process() { global $wo_details; if (!references::is_valid($_POST['ref'])) { display_error(tr("You must enter a reference.")); set_focus('ref'); return false; } if (!is_new_reference($_POST['ref'], 29)) { display_error(tr("The entered reference is already in use.")); set_focus('ref'); return false; } if (!check_num('quantity', 0)) { display_error(tr("The quantity entered is not a valid number or less then zero.")); set_focus('quantity'); return false; } if (!is_date($_POST['date_'])) { display_error(tr("The entered date is invalid.")); set_focus('date_'); return false; } elseif (!is_date_in_fiscalyear($_POST['date_'])) { display_error(tr("The entered date is not in fiscal year.")); set_focus('date_'); return false; } if (date_diff(sql2date($wo_details["released_date"]), $_POST['date_'], "d") > 0) { display_error(tr("The production date cannot be before the release date of the work order.")); set_focus('date_'); return false; } // if unassembling we need to check the qoh if ($_POST['ProductionType'] == 0 && !sys_prefs::allow_negative_stock()) { $wo_details = get_work_order($_POST['selected_id']); $qoh = get_qoh_on_date($wo_details["stock_id"], $wo_details["loc_code"], $date_); if (-$_POST['quantity'] + $qoh < 0) { display_error(tr("The unassembling cannot be processed because there is insufficient stock.")); set_focus('quantity'); return false; } } return true; }
function check_data() { global $total_grn_value, $total_gl_value; if (!$_SESSION['supp_trans']->is_valid_trans_to_post()) { display_error(tr("The credit note cannot be processed because the there are no items or values on the invoice. Credit notes are expected to have a charge.")); set_focus(''); return false; } if (!references::is_valid($_SESSION['supp_trans']->reference)) { display_error(tr("You must enter an credit note reference.")); set_focus('reference'); return false; } if (!is_new_reference($_SESSION['supp_trans']->reference, 21)) { display_error(tr("The entered reference is already in use.")); set_focus('reference'); return false; } if (!references::is_valid($_SESSION['supp_trans']->supp_reference)) { display_error(tr("You must enter a supplier's credit note reference.")); set_focus('supp_reference'); return false; } if (!is_date($_SESSION['supp_trans']->tran_date)) { display_error(tr("The credit note as entered cannot be processed because the date entered is not valid.")); set_focus('tran_date'); return false; } elseif (!is_date_in_fiscalyear($_SESSION['supp_trans']->tran_date)) { display_error(tr("The entered date is not in fiscal year.")); set_focus('tran_date'); return false; } if (!is_date($_SESSION['supp_trans']->due_date)) { display_error(tr("The invoice as entered cannot be processed because the due date is in an incorrect format.")); set_focus('due_date'); return false; } if ($_SESSION['supp_trans']->ov_amount < $total_gl_value + $total_grn_value) { display_error(tr("The credit note total as entered is less than the sum of the the general ledger entires (if any) and the charges for goods received. There must be a mistake somewhere, the credit note as entered will not be processed.")); return false; } return true; }