X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=manufacturing%2Fmanage%2Fbom_edit.php;h=a10606b147d308d07986cc58a84d3da948e7199b;hb=d67d5295b9342c011697ce4df325197e29898588;hp=0e0d5a9a787e8bf3a4aef8bfa246cec8ed8674ab;hpb=735b37b5d5be8650936a76a670b0aaa9c16dbf0e;p=fa-stable.git diff --git a/manufacturing/manage/bom_edit.php b/manufacturing/manage/bom_edit.php index 0e0d5a9a..a10606b1 100644 --- a/manufacturing/manage/bom_edit.php +++ b/manufacturing/manage/bom_edit.php @@ -89,7 +89,7 @@ function display_bom_items($selected_parent) start_table("$table_style width=60%"); $th = array(_("Code"), _("Description"), _("Location"), - _("Work Centre"), _("Quantity"), _("Units")); + _("Work Centre"), _("Quantity"), _("Units"),'',''); table_header($th); $k = 0; @@ -102,7 +102,7 @@ function display_bom_items($selected_parent) label_cell($myrow["description"]); label_cell($myrow["location_name"]); label_cell($myrow["WorkCentreDescription"]); - label_cell($myrow["quantity"]); + label_cell(qty_format($myrow["quantity"])); label_cell($myrow["units"]); edit_link_cell(SID . "NewItem=$selected_parent&selected_component=" . $myrow["id"]); delete_link_cell(SID . "delete=" . $myrow["id"]. "&stock_id=" . $_POST['stock_id']); @@ -114,27 +114,21 @@ function display_bom_items($selected_parent) //-------------------------------------------------------------------------------------------------- -function on_submit($selected_parent, $selected_component) +function on_submit($selected_parent, $selected_component=null) { - if (!is_numeric($_POST['quantity'])) + if (!check_num('quantity', 0)) { - display_error(_("The quantity entered must be numeric.")); + display_error(_("The quantity entered must be numeric and greater than zero.")); + set_focus('quantity'); return; } - if ($_POST['quantity'] <= 0) - { - display_error(_("The quantity entered must be greater than zero.")); - return; - } - - if (isset($selected_parent) && isset($selected_component)) { $sql = "UPDATE ".TB_PREF."bom SET workcentre_added='" . $_POST['workcentre_added'] . "', loc_code='" . $_POST['loc_code'] . "', - quantity= " . $_POST['quantity'] . " + quantity= " . input_num('quantity') . " WHERE parent='" . $selected_parent . "' AND id='" . $selected_component . "'"; check_db_error("Could not update this bom component", $sql); @@ -145,7 +139,9 @@ function on_submit($selected_parent, $selected_component) 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 */ + /*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'])) @@ -162,7 +158,9 @@ function on_submit($selected_parent, $selected_component) if (db_num_rows($result) == 0) { $sql = "INSERT INTO ".TB_PREF."bom (parent, component, workcentre_added, loc_code, quantity) - VALUES ('$selected_parent', '" . $_POST['component'] . "', '" . $_POST['workcentre_added'] . "', '" . $_POST['loc_code'] . "', " . $_POST['quantity'] . ")"; + VALUES ('$selected_parent', '" . $_POST['component'] . "', '" + . $_POST['workcentre_added'] . "', '" . $_POST['loc_code'] . "', " + . input_num('quantity') . ")"; db_query($sql,"check failed"); @@ -202,6 +200,7 @@ start_form(false, true); echo "