display_error(_("The account code must be numeric.")); set_focus('account_code'); } if ($input_error != 1) { if ($accounts_alpha == 2) { $_POST['account_code'] = strtoupper($_POST['account_code']); } if (!isset($_POST['account_tags'])) { $_POST['account_tags'] = array(); } if ($selected_account) { if (get_post('inactive') == 1 && is_bank_account($_POST['account_code'])) { display_error(_("The account belongs to a bank account and cannot be inactivated.")); } elseif (update_gl_account($_POST['account_code'], $_POST['account_name'], $_POST['account_type'], $_POST['account_code2'])) { update_record_status($_POST['account_code'], $_POST['inactive'], 'chart_master', 'account_code'); update_tag_associations(TAG_ACCOUNT, $_POST['account_code'], $_POST['account_tags']); $Ajax->activate('account_code'); // in case of status change display_notification(_("Account data has been updated.")); } } else { if (add_gl_account($_POST['account_code'], $_POST['account_name'], $_POST['account_type'], $_POST['account_code2'])) { add_tag_associations($_POST['account_code'], $_POST['account_tags']); display_notification(_("New account has been added.")); $selected_account = $_POST['AccountList'] = $_POST['account_code']; } else { display_error(_("Account not added, possible duplicate Account Code.")); } } $Ajax->activate('_page_body'); }
} return true; } //------------------------------------------------------------------------------------- if (isset($_POST['ADD_ITEM']) || isset($_POST['UPDATE_ITEM'])) { if (!isset($_POST['dimension_tags'])) { $_POST['dimension_tags'] = array(); } if (can_process()) { if ($selected_id == -1) { $id = add_dimension($_POST['ref'], $_POST['name'], $_POST['type_'], $_POST['date_'], $_POST['due_date'], $_POST['memo_']); add_tag_associations($id, $_POST['dimension_tags']); meta_forward($_SERVER['PHP_SELF'], "AddedID={$id}"); } else { update_dimension($selected_id, $_POST['name'], $_POST['type_'], $_POST['date_'], $_POST['due_date'], $_POST['memo_']); update_tag_associations(TAG_DIMENSION, $selected_id, $_POST['dimension_tags']); meta_forward($_SERVER['PHP_SELF'], "UpdatedID={$selected_id}"); } } } //-------------------------------------------------------------------------------------- if (isset($_POST['delete'])) { $cancel_delete = false; // can't delete it there are productions or issues if (dimension_has_payments($selected_id) || dimension_has_deposits($selected_id)) { display_error(_("This dimension cannot be deleted because it has already been processed.")); set_focus('ref'); $cancel_delete = true; } if ($cancel_delete == false) { //ie not cancelled the delete as a result of above tests