From: Janusz Dobrowolski Date: Sun, 5 Apr 2015 22:27:10 +0000 (+0200) Subject: Inventory Adjustment: removed obsolete increase/descrease selector from entry form... X-Git-Tag: v2.4.2~19^2~216 X-Git-Url: https://delta.frontaccounting.com/gitweb/?p=fa-stable.git;a=commitdiff_plain;h=11109ad9f0e6af3f59d72731a95e473e72fb308b Inventory Adjustment: removed obsolete increase/descrease selector from entry form (negative quantities can now be entered just with minus sign). --- diff --git a/doc/api_changes.txt b/doc/api_changes.txt index dca83c27..cab0d50b 100644 --- a/doc/api_changes.txt +++ b/doc/api_changes.txt @@ -21,7 +21,7 @@ Changed functions: items_transfer_db.inc: add_stock_transfer($Items, $location_from, $location_to, $date_, $reference, $memo_) items_adjust_db.inc: - add_stock_adjustment($items, $location, $date_, $increase, $reference, $memo_) + add_stock_adjustment($items, $location, $date_, $reference, $memo_) Before 2.4: get_tax_type_default_rate($type_id) @@ -113,6 +113,6 @@ Description: Before 2.4: add_stock_adjustment($items, $location, $date_, $type, $increase, $reference, $memo_) Now: - add_stock_adjustment($items, $location, $date_, $increase, $reference, $memo_) + add_stock_adjustment($items, $location, $date_, $reference, $memo_) Description: - Removed obsolete $type argument. + Removed obsolete $type and $increase arguments. diff --git a/inventory/adjustments.php b/inventory/adjustments.php index bacfa377..9a9a09d1 100644 --- a/inventory/adjustments.php +++ b/inventory/adjustments.php @@ -115,7 +115,7 @@ function can_process() } elseif (!$SysPrefs->allow_negative_stock()) { - $low_stock = $adj->check_qoh($_POST['StockLocation'], $_POST['AdjDate'], !$_POST['Increase']); + $low_stock = $adj->check_qoh($_POST['StockLocation'], $_POST['AdjDate']); if ($low_stock) { @@ -132,8 +132,7 @@ function can_process() if (isset($_POST['Process']) && can_process()){ $trans_no = add_stock_adjustment($_SESSION['adj_items']->line_items, - $_POST['StockLocation'], $_POST['AdjDate'], $_POST['Increase'], - $_POST['ref'], $_POST['memo_']); + $_POST['StockLocation'], $_POST['AdjDate'], $_POST['ref'], $_POST['memo_']); new_doc_date($_POST['AdjDate']); $_SESSION['adj_items']->clear_items(); unset($_SESSION['adj_items']); @@ -146,9 +145,9 @@ if (isset($_POST['Process']) && can_process()){ function check_item_data() { - if (!check_num('qty',0) || input_num('qty') == 0) + if (input_num('qty') == 0) { - display_error(_("The quantity entered is negative or invalid.")); + display_error(_("The quantity entered is invalid.")); set_focus('qty'); return false; } diff --git a/inventory/includes/db/items_adjust_db.inc b/inventory/includes/db/items_adjust_db.inc index ce108d62..205b782e 100644 --- a/inventory/includes/db/items_adjust_db.inc +++ b/inventory/includes/db/items_adjust_db.inc @@ -10,20 +10,19 @@ See the License here . ***********************************************************************/ -function add_stock_adjustment($items, $location, $date_, $increase, $reference, $memo_) +function add_stock_adjustment($items, $location, $date_, $reference, $memo_) { global $SysPrefs, $path_to_root, $Refs; begin_transaction(); $args = func_get_args(); - $args = (object)array_combine(array('items', 'location', 'date_', 'increase', - 'reference', 'memo_'), $args); + $args = (object)array_combine(array('items', 'location', 'date_', 'reference', 'memo_'), $args); $args->trans_no = 0; hook_db_prewrite($args, ST_INVADJUST); $adj_id = get_next_trans_no(ST_INVADJUST); - if ($SysPrefs->loc_notification() == 1 && !$increase) + if ($SysPrefs->loc_notification() == 1) { include_once($path_to_root . "/inventory/includes/inventory_db.inc"); $st_ids = array(); @@ -34,11 +33,11 @@ function add_stock_adjustment($items, $location, $date_, $increase, $reference, foreach ($items as $line_item) { - if ($SysPrefs->loc_notification() == 1 && !$increase) + if ($SysPrefs->loc_notification() == 1 && $line_item->qty < 0) + { + $chg = $line; $chg->qty = -$chg->qty; // calculate_reorder_level expect positive qty $loc = calculate_reorder_level($location, $line_item, $st_ids, $st_names, $st_num, $st_reorder); - - if (!$increase) - $line_item->quantity = -$line_item->quantity; + } add_stock_adjustment_item($adj_id, $line_item->stock_id, $location, $date_, $reference, $line_item->quantity, $line_item->standard_cost, $memo_); @@ -52,7 +51,7 @@ function add_stock_adjustment($items, $location, $date_, $increase, $reference, $args->trans_no = $adj_id; hook_db_postwrite($args, ST_INVADJUST); commit_transaction(); - if ($SysPrefs->loc_notification() == 1 && !$increase && count($st_ids) > 0) + if ($SysPrefs->loc_notification() == 1 && count($st_ids) > 0) send_reorder_email($loc, $st_ids, $st_names, $st_num, $st_reorder); return $adj_id; diff --git a/inventory/includes/item_adjustments_ui.inc b/inventory/includes/item_adjustments_ui.inc index bed25415..eb2f03d2 100644 --- a/inventory/includes/item_adjustments_ui.inc +++ b/inventory/includes/item_adjustments_ui.inc @@ -37,11 +37,6 @@ function display_order_header(&$order) table_section(2, "50%"); ref_row(_("Reference:"), 'ref', '', $Refs->get_next(ST_INVADJUST)); - if (!isset($_POST['Increase'])) - $_POST['Increase'] = 1; - yesno_list_row(_("Type:"), 'Increase', $_POST['Increase'], - _("Positive Adjustment"), _("Negative Adjustment")); - end_outer_table(1); // outer table } @@ -62,7 +57,7 @@ function display_adjustment_items($title, &$order) $total = 0; $k = 0; //row colour counter - $low_stock = $order->check_qoh($_POST['StockLocation'], $_POST['AdjDate'], !$_POST['Increase']); + $low_stock = $order->check_qoh($_POST['StockLocation'], $_POST['AdjDate']); $id = find_submit('Edit'); foreach ($order->line_items as $line_no=>$stock_item) {