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'); } } //------------------------------------------------------------------------------------- function can_delete($selected_account) { if ($selected_account == "") { return false; }
if (!is_date($_POST['due_date'])) { display_error(_("The required by date entered is in an invalid format.")); set_focus('due_date'); return false; } 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');