} $fillerror = cw_error_check($record_data, $rules); if ($fillerror) { $record_saved_data = $record_data; $top_message = array('content' => $fillerror, 'type' => 'E'); cw_header_location("index.php?target={$target}&mode={$mode}&user={$user}&record_id={$record_id}"); } if (!$record_id) { $record_id = cw_array2insert('accounting_records', array('date' => cw_core_get_time())); } $to_update = array('customer_id' => $record_data['customer_id'], 'accounting_category_id' => $record_data['accounting_category_id'], 'descr' => $record_data['descr'], 'date_ref' => cw_core_strtotime($record_data['date_ref']), 'bank_code' => $record_data['bank_code'], 'payment_code' => $record_data['payment_code'], 'status' => $record_data['status']); if (!$record['reference']) { $to_update['total'] = $record_data['total']; } cw_array2update('accounting_records', $to_update, "accounting_record_id='{$record_id}'"); cw_accounting_category_recalc_subcat_count($record_data['accounting_category_id']); if (count($_FILES)) { foreach ($_FILES['enfiles']['name'] as $index => $name) { $data = array(); $data['file_path'] = cw_move_uploaded_file('enfiles', '', $index); $data['filename'] = basename($name); if ($data['file_path']) { cw_file_area_save('accounting_records_files', $record_id, $data); } } } cw_session_unregister('record_saved_data'); cw_header_location("index.php?target={$target}&mode={$mode}&user={$user}&record_id={$record_id}"); } if ($action == 'delete_enfile' && $file_id) { $record_id = cw_query_first_cell("select customer_id from {$tables['accounting_records_files']} where file_id='{$file_id}'");
<?php if ($action == 'apply' && is_array($posted_data)) { foreach ($posted_data as $k => $v) { $query_data = array('order_by' => $v['order_by']); cw_array2update('accounting_categories', $query_data, "accounting_category_id='" . $k . "'"); } $path = cw_accounting_category_get_subcategory_ids(array_keys($posted_data)); if (!empty($path)) { cw_accounting_category_recalc_subcat_count($path); } $top_message['content'] = cw_get_langvar_by_name("msg_adm_categories_upd"); $top_message['type'] = "I"; cw_header_location("index.php?target={$target}&cat={$cat}"); } if ($action == "delete") { $categories_to_delete =& cw_session_register('categories_to_delete', array()); if ($confirmed == "Y") { if (is_array($categories_to_delete)) { foreach ($categories_to_delete as $cat) { $parent_category_id = cw_accounting_category_delete($cat); } } $top_message['content'] = cw_get_langvar_by_name('msg_adm_category_del'); $top_message['type'] = 'I'; cw_header_location("index.php?target={$target}&cat={$parent_category_id}"); } else { $categories_to_delete = is_array($delete_arr) ? array_keys($delete_arr) : ""; cw_header_location("index.php?target={$target}&cat={$cat_org}&mode=delete"); } }