Changes in framework API introduced in FrontAccounting 2.4
----------------------------------------------------------
-The list does not contain changes made in user interface files.
+The list does not contain changes made in user interface files or local functions.
Changed functions:
company_db_inc:
add_stock_move($type, $stock_id, $trans_no, $location, $date_, $reference, $quantity, $std_cost, $person_id=0, $price=0)
sales_db.inc:
add_stock_move_customer() removed
+ items_transfer_db.inc:
+ add_stock_transfer($Items, $location_from, $location_to, $date_, $reference, $memo_)
Before 2.4:
get_tax_type_default_rate($type_id)
None
Description:
Obsolete and removed.
+
+Before 2.4:
+ add_stock_transfer($Items, $location_from, $location_to, $date_, $type, $reference, $memo_)
+Now:
+ add_stock_transfer($Items, $location_from, $location_to, $date_, $reference, $memo_)
+Description:
+ Removed obsolete $type argument.
***********************************************************************/
//-------------------------------------------------------------------------------------------------------------
-function add_stock_transfer($Items, $location_from, $location_to, $date_, $type, $reference, $memo_)
+function add_stock_transfer($Items, $location_from, $location_to, $date_, $reference, $memo_)
{
global $SysPrefs, $path_to_root, $Refs;
begin_transaction();
$args = func_get_args();
$args = (object)array_combine(array('Items', 'location_from', 'location_to',
- 'date_', 'type', 'reference', 'memo_'), $args);
+ 'date_', 'reference', 'memo_'), $args);
$args->trans_no = 0;
hook_db_prewrite($args, ST_LOCTRANSFER);
if ($SysPrefs->loc_notification() == 1)
$loc = calculate_reorder_level($location_from, $line_item, $st_ids, $st_names, $st_num, $st_reorder);
add_stock_transfer_item($transfer_id, $line_item->stock_id, $location_from,
- $location_to, $date_, $type, $reference, $line_item->quantity);
+ $location_to, $date_, $reference, $line_item->quantity);
}
add_comments(ST_LOCTRANSFER, $transfer_id, $date_, $memo_);
// it seems the standard_cost field is not used at all
function add_stock_transfer_item($transfer_id, $stock_id, $location_from, $location_to,
- $date_, $type, $reference, $quantity)
+ $date_, $reference, $quantity)
{
add_stock_move(ST_LOCTRANSFER, $stock_id, $transfer_id, $location_from,
$date_, $reference, -$quantity, 0);
locations_list_row(_("From Location:"), 'FromStockLocation', null);
locations_list_row(_("To Location:"), 'ToStockLocation', null);
- table_section(2, "33%");
-
- ref_row(_("Reference:"), 'ref', '', $Refs->get_next(ST_LOCTRANSFER));
+ table_section(2, "50%");
date_row(_("Date:"), 'AdjDate', '', true);
- table_section(3, "33%");
-
- movement_types_list_row(_("Transfer Type:"), 'type', null);
+ ref_row(_("Reference:"), 'ref', '', $Refs->get_next(ST_LOCTRANSFER));
end_outer_table(1); // outer table
}
check_db_has_costable_items(_("There are no inventory items defined in the system (Purchased or manufactured items)."));
-check_db_has_movement_types(_("There are no inventory movement types defined in the system. Please define at least one inventory adjustment type."));
-
//-----------------------------------------------------------------------------------------------
if (isset($_GET['AddedID']))
$trans_no = add_stock_transfer($_SESSION['transfer_items']->line_items,
$_POST['FromStockLocation'], $_POST['ToStockLocation'],
- $_POST['AdjDate'], $_POST['type'], $_POST['ref'], $_POST['memo_']);
+ $_POST['AdjDate'], $_POST['ref'], $_POST['memo_']);
new_doc_date($_POST['AdjDate']);
$_SESSION['transfer_items']->clear_items();
unset($_SESSION['transfer_items']);
function check_item_data()
{
- if (!check_num('qty', 0))
+ if (!check_num('qty', 0) || input_num('qty') == 0)
{
display_error(_("The quantity entered must be a positive number."));
set_focus('qty');
function handle_update_item()
{
- if($_POST['UpdateItem'] != "" && check_item_data())
- {
- $id = $_POST['LineNo'];
- if (!isset($_POST['std_cost']))
- $_POST['std_cost'] = $_SESSION['transfer_items']->line_items[$id]->standard_cost;
- $_SESSION['transfer_items']->update_cart_item($id, input_num('qty'), $_POST['std_cost']);
- }
+ $id = $_POST['LineNo'];
+ if (!isset($_POST['std_cost']))
+ $_POST['std_cost'] = $_SESSION['transfer_items']->line_items[$id]->standard_cost;
+ $_SESSION['transfer_items']->update_cart_item($id, input_num('qty'), $_POST['std_cost']);
line_start_focus();
}
function handle_new_item()
{
- if (!check_item_data())
- return;
if (!isset($_POST['std_cost']))
$_POST['std_cost'] = 0;
add_to_order($_SESSION['transfer_items'], $_POST['stock_id'], input_num('qty'), $_POST['std_cost']);
if ($id != -1)
handle_delete_item($id);
-if (isset($_POST['AddItem']))
+if (isset($_POST['AddItem']) && check_item_data())
handle_new_item();
-if (isset($_POST['UpdateItem']))
+if (isset($_POST['UpdateItem']) && check_item_data())
handle_update_item();
if (isset($_POST['CancelItemChanges'])) {
end_row();
start_row();
label_cells(_("Reference"), $from_trans['reference'], "class='tableheader2'");
-$adjustment_type = get_movement_type($from_trans['person_id']) ;
-label_cells(_("Adjustment Type"), $adjustment_type['name'], "class='tableheader2'");
label_cells(_("Date"), sql2date($from_trans['tran_date']), "class='tableheader2'");
end_row();