function handle_submit(&$selected_id) { global $path_to_root, $Ajax, $auto_create_branch; if (!can_process()) { return; } if ($selected_id) { update_customer($_POST['customer_id'], $_POST['CustName'], $_POST['cust_ref'], $_POST['address'], $_POST['tax_id'], $_POST['curr_code'], $_POST['dimension_id'], $_POST['dimension2_id'], $_POST['credit_status'], $_POST['payment_terms'], input_num('discount') / 100, input_num('pymt_discount') / 100, input_num('credit_limit'), $_POST['sales_type'], $_POST['notes']); update_record_status($_POST['customer_id'], $_POST['inactive'], 'debtors_master', 'debtor_no'); $Ajax->activate('customer_id'); // in case of status change display_notification(_("Customer has been updated.")); } else { //it is a new customer begin_transaction(); add_customer($_POST['CustName'], $_POST['cust_ref'], $_POST['address'], $_POST['tax_id'], $_POST['curr_code'], $_POST['dimension_id'], $_POST['dimension2_id'], $_POST['credit_status'], $_POST['payment_terms'], input_num('discount') / 100, input_num('pymt_discount') / 100, input_num('credit_limit'), $_POST['sales_type'], $_POST['notes']); $selected_id = $_POST['customer_id'] = db_insert_id(); if (isset($auto_create_branch) && $auto_create_branch == 1) { add_branch($selected_id, $_POST['CustName'], $_POST['cust_ref'], $_POST['address'], $_POST['salesman'], $_POST['area'], $_POST['tax_group_id'], '', get_company_pref('default_sales_discount_act'), get_company_pref('debtors_act'), get_company_pref('default_prompt_payment_act'), $_POST['location'], $_POST['address'], 0, 0, $_POST['ship_via'], $_POST['notes']); $selected_branch = db_insert_id(); add_crm_person($_POST['CustName'], $_POST['cust_ref'], '', $_POST['address'], $_POST['phone'], $_POST['phone2'], $_POST['fax'], $_POST['email'], '', ''); add_crm_contact('cust_branch', 'general', $selected_branch, db_insert_id()); } commit_transaction(); display_notification(_("A new customer has been added.")); if (isset($auto_create_branch) && $auto_create_branch == 1) { display_notification(_("A default Branch has been automatically created, please check default Branch values by using link below.")); } $Ajax->activate('_page_body'); } }
include_once '../dao/address.php'; include_once "../includes/common_functions.php"; $consumer = consumer_findByEmail($_SESSION['consumer']['itconsumer_emailaddress']); ?> <!-- add address button --> <div class="add-new-address clearfix"> <p class="add-new-btn"><a href="javascript:void(0);" class="modalform">+ ADD NEW ADDRESS</a></p> </div> <?php $address = get_consumer_address_id($_SESSION['consumer']['itconsumer_id']); $resultt = count($address); // if no address exists then set the status to signupcomplete... if ($resultt == 0 && $consumer['recordstatus'] != 'signupcomplete') { update_record_status($_SESSION['consumer']['itconsumer_id']); // update to signupcomplete } //$resultt; $counting = 0; while ($counting < $resultt) { $address1 = get_address_from_id($address[$counting]['address_id']); ?> <!-- address box --> <div id="div_address_<?php echo $address1[0]['address_id']; ?> " class="address-box-wrap" style="float: left; margin-top: 12px;"> <div class="address-box"><div class="address-box-inner"> <p class="address-box-label">Address</p> <p class="address-box-value"><?php
//first off validate inputs sensible if (strlen($_POST['supp_name']) == 0 || $_POST['supp_name'] == "") { $input_error = 1; display_error(_("The supplier name must be entered.")); set_focus('supp_name'); } if (strlen($_POST['supp_ref']) == 0 || $_POST['supp_ref'] == "") { $input_error = 1; display_error(_("The supplier short name must be entered.")); set_focus('supp_ref'); } if ($input_error != 1) { begin_transaction(); if ($supplier_id) { update_supplier($_POST['supplier_id'], $_POST['supp_name'], $_POST['supp_ref'], $_POST['address'], $_POST['supp_address'], $_POST['gst_no'], $_POST['website'], $_POST['supp_account_no'], $_POST['bank_account'], input_num('credit_limit', 0), $_POST['dimension_id'], $_POST['dimension2_id'], $_POST['curr_code'], $_POST['payment_terms'], $_POST['payable_account'], $_POST['purchase_account'], $_POST['payment_discount_account'], $_POST['notes'], $_POST['tax_group_id'], get_post('tax_included', 0)); update_record_status($_POST['supplier_id'], $_POST['inactive'], 'suppliers', 'supplier_id'); $Ajax->activate('supplier_id'); // in case of status change display_notification(_("Supplier has been updated.")); } else { add_supplier($_POST['supp_name'], $_POST['supp_ref'], $_POST['address'], $_POST['supp_address'], $_POST['gst_no'], $_POST['website'], $_POST['supp_account_no'], $_POST['bank_account'], input_num('credit_limit', 0), $_POST['dimension_id'], $_POST['dimension2_id'], $_POST['curr_code'], $_POST['payment_terms'], $_POST['payable_account'], $_POST['purchase_account'], $_POST['payment_discount_account'], $_POST['notes'], $_POST['tax_group_id'], check_value('tax_included')); $supplier_id = $_POST['supplier_id'] = db_insert_id(); add_crm_person($_POST['supp_ref'], $_POST['contact'], '', $_POST['address'], $_POST['phone'], $_POST['phone2'], $_POST['fax'], $_POST['email'], $_POST['rep_lang'], ''); add_crm_contact('supplier', 'general', $supplier_id, db_insert_id()); display_notification(_("A new supplier has been added.")); $Ajax->activate('_page_body'); } commit_transaction(); } } elseif (isset($_POST['delete']) && $_POST['delete'] != "") { //the link to delete a selected record was clicked instead of the submit button
$input_error = 1; 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');
$input_error = 1; display_error(_("This item code is already assigned to stock item or sale kit.")); set_focus('NewStockID'); } if ($input_error != 1) { if (check_value('del_image')) { $filename = company_path() . '/images/' . item_img_name($_POST['NewStockID']) . ".jpg"; if (file_exists($filename)) { unlink($filename); } } if (!$new_item) { /*so its an existing one */ update_item($_POST['NewStockID'], $_POST['description'], $_POST['long_description'], $_POST['category_id'], $_POST['level_id'], $_POST['tax_type_id'], get_post('units'), get_post('mb_flag'), $_POST['sales_account'], $_POST['inventory_account'], $_POST['cogs_account'], $_POST['adjustment_account'], $_POST['assembly_account'], $_POST['dimension_id'], $_POST['dimension2_id'], check_value('no_sale'), check_value('editable')); update_record_status($_POST['NewStockID'], $_POST['inactive'], 'stock_master', 'stock_id'); update_record_status($_POST['NewStockID'], $_POST['inactive'], 'item_codes', 'item_code'); set_focus('stock_id'); $Ajax->activate('stock_id'); // in case of status change display_notification(_("Item has been updated.")); } else { //it is a NEW part add_item($_POST['NewStockID'], $_POST['description'], $_POST['long_description'], $_POST['level_id'], $_POST['category_id'], $_POST['tax_type_id'], $_POST['units'], $_POST['mb_flag'], $_POST['sales_account'], $_POST['inventory_account'], $_POST['cogs_account'], $_POST['adjustment_account'], $_POST['assembly_account'], $_POST['dimension_id'], $_POST['dimension2_id'], check_value('no_sale'), check_value('editable')); display_notification(_("A new item has been added.")); $_POST['stock_id'] = $_POST['NewStockID'] = $_POST['description'] = $_POST['long_description'] = ''; $_POST['no_sale'] = $_POST['editable'] = 0; set_focus('NewStockID'); } $Ajax->activate('_page_body'); } }
function inactive_control_cell($id, $value, $table, $key) { global $Ajax; if (check_value('show_inactive')) { $name = "Inactive" . $id; $value = $value ? 1 : 0; if (isset($_POST['LInact'][$id]) && (get_post('_Inactive' . $id . '_update') || get_post('Update')) && check_value('Inactive' . $id) != $value) { update_record_status($id, !$value, $table, $key); } $cellAsString = checkbox(null, $name, $value, true, '') . hidden("LInact[{$id}]", $value, false); View::get()->tableAddCell($cellAsString); } }
// add extended section for plugins } $areas[] = (int) $a; } if (substr($p, 0, 7) == 'Section') { $sections[] = (int) substr($p, 7); } } // $areas = sort_areas($areas); $sections = array_values($sections); if ($new_role) { add_security_role($_POST['name'], $_POST['description'], $sections, $areas); display_notification(_("New security role has been added.")); } else { update_security_role($_POST['role'], $_POST['name'], $_POST['description'], $sections, $areas); update_record_status($_POST['role'], get_post('inactive'), 'security_roles', 'id'); display_notification(_("Security role has been updated.")); } $new_role = true; clear_data(); $Ajax->activate('_page_body'); } } //-------------------------------------------------------------------------------------------------- if (get_post('delete')) { if (check_role_used(get_post('role'))) { display_error(_("This role is currently assigned to some users and cannot be deleted")); } else { delete_security_role(get_post('role')); display_notification(_("Security role has been sucessfully deleted.")); unset($_POST['role']);