include_once($path_to_root . "/inventory/includes/inventory_db.inc");
$user_comp = user_company();
-$new_item = get_post('stock_id')=='';
+$new_item = get_post('stock_id')=='' || get_post('cancel');
//------------------------------------------------------------------------------------
if (isset($_GET['stock_id']))
$Ajax->activate('details');
$Ajax->activate('controls');
}
+
+if (get_post('cancel')) {
+ $_POST['NewStockID'] = $_POST['stock_id'] = '';
+ clear_data();
+ set_focus('stock_id');
+ $Ajax->activate('_page_body');
+}
+
if (list_updated('category_id') || list_updated('mb_flag')) {
$Ajax->activate('details');
}
if ($new_item)
{
-
-/*If the page was called without $_POST['NewStockID'] passed to page then assume a new item is to be entered show a form with a part Code field other wise the form showing the fields with the existing entries against the part will show for editing with only a hidden stock_id field. New is set to flag that the page may have called itself and still be entering a new part, in which case the page needs to know not to go looking up details for an existing part*/
-
text_row(_("Item Code:"), 'NewStockID', null, 21, 20);
-
- $_POST['long_description'] = '';
- $_POST['description'] = '';
-
}
else
{ // Must be modifying an existing item
}
else
{
- submit_center_first('addupdate', _("Update Item"), '', 'default');
+ submit_center_first('addupdate', _("Update Item"), '',
+ count($_SESSION['Context']) ? true : 'default');
submit_return('select', _("Return"), _("Select this items and return to document entry."), 'default');
- submit_center_last('delete', _("Delete This Item"), '', true);
+ submit('delete', _("Delete This Item"), true, '', true);
+ submit_center_last('cancel', _("Cancel"), _("Cancel Edition"), 'cancel');
}
div_end();