X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=sales%2Fcredit_note_entry.php;h=89a1cf05361d501dce5721001bb9437ef3f2dac1;hb=13aa48ccc9265df336a1805d2e4709365f19c956;hp=1946aca1e339a6728e548e8db38f8e039b5dedf1;hpb=61027f425da0c66e2802076d6b48472462f3cf3b;p=fa-stable.git diff --git a/sales/credit_note_entry.php b/sales/credit_note_entry.php index 1946aca1..89a1cf05 100644 --- a/sales/credit_note_entry.php +++ b/sales/credit_note_entry.php @@ -10,6 +10,7 @@ include_once($path_to_root . "/includes/session.inc"); include_once($path_to_root . "/includes/data_checks.inc"); include_once($path_to_root . "/sales/includes/sales_db.inc"); include_once($path_to_root . "/sales/includes/sales_ui.inc"); +include_once($path_to_root . "/sales/includes/db/sales_types_db.inc"); include_once($path_to_root . "/sales/includes/ui/sales_credit_ui.inc"); include_once($path_to_root . "/sales/includes/ui/sales_order_ui.inc"); @@ -39,6 +40,18 @@ check_db_has_stock_items(_("There are no items defined in the system.")); check_db_has_customer_branches(_("There are no customers, or there are no customers with branches. Please define customers and customer branches.")); //----------------------------------------------------------------------------- +if ($ret = context_restore()) { + // return from new customer add + copy_from_cn(); + if(isset($ret['customer_id'])) + $_POST['customer_id'] = $ret['customer_id']; + if(isset($ret['branch_id'])) + $_POST['branch_id'] = $ret['branch_id']; +} +if (isset($_POST['_customer_id_editor'])) { + copy_to_cn(); //store context + context_call($path_to_root.'/sales/manage/customers.php?debtor_no='.$_POST['customer_id'], 'Items'); +} if (isset($_GET['AddedID'])) { $credit_no = $_GET['AddedID']; @@ -57,7 +70,9 @@ if (isset($_GET['AddedID'])) { //-------------------------------------------------------------------------------- function line_start_focus() { - set_focus(get_company_pref('no_supplier_list') ? 'stock_id_edit' : 'StockID2'); + global $Ajax; + $Ajax->activate('items_table'); + set_focus('_stock_id_edit'); } //----------------------------------------------------------------------------- @@ -135,6 +150,7 @@ if (isset($_POST['ProcessCredit']) && can_process()) { display_note(_("For credit notes created to write off the stock, a general ledger account is required to be selected."), 1, 0); display_note(_("Please select an account to write the cost of the stock off to, then click on Process again."), 1, 0); exit; + } if (!isset($_POST['WriteOffGLCode'])) { $_POST['WriteOffGLCode'] = 0; @@ -203,27 +219,19 @@ $id = find_submit('Delete'); if ($id!=-1) handle_delete_item($id); -if (isset($_POST['AddItem']) || isset($_POST['UpdateItem'])) - copy_to_cn(); - if (isset($_POST['AddItem'])) handle_new_item(); if (isset($_POST['UpdateItem'])) handle_update_item(); -if (isset($_POST['CancelItemChanges']) || isset($_POST['UpdateItem'])) +if (isset($_POST['CancelItemChanges'])) line_start_focus(); //----------------------------------------------------------------------------- if (!processing_active()) { handle_new_credit(); -} else { - if (!isset($_POST['customer_id'])) - $_POST['customer_id'] = $_SESSION['Items']->customer_id; - if (!isset($_POST['branch_id'])) - $_POST['branch_id'] = $_SESSION['Items']->Branch; } //-----------------------------------------------------------------------------