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)
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.
}
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)
{
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']);
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;
}
See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
***********************************************************************/
-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();
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_);
$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;
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
}
$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)
{