public function action_reconcilecreate() { $account_reconcile_create_data = new stdClass(); $account_reconcile_create_data->account_id = $this->request->post('account_id'); $account_reconcile_create_data->date = date("Y-m-d", strtotime($this->request->post('date'))); $account_reconcile_create_data->balance_start = preg_replace("/([^0-9\\.\\-])/i", "", $this->request->post('balance_start')); $account_reconcile_create_data->balance_end = preg_replace("/([^0-9\\.\\-])/i", "", $this->request->post('balance_end')); $account_reconcile_create_data->account_transaction_ids = array(); foreach ($this->request->post() as $key => $value) { if (strpos($key, 'include-transaction-') !== FALSE) { $account_reconcile_create_data->account_transaction_ids[] = str_replace('include-transaction-', '', $key); } } $account_reconcile_create = new Beans_Account_Reconcile_Create($this->_beans_data_auth($account_reconcile_create_data)); $account_reconcile_create_result = $account_reconcile_create->execute(); if (!$account_reconcile_create_result->success) { Session::instance()->set('account_error_message', "An error occurred when recording that statement:<br>" . $account_reconcile_create_result->auth_error . $account_reconcile_create_result->error); } else { Session::instance()->set('account_success_message', "Your statement was successfully reconciled."); } $this->request->redirect('/accounts/view/' . $account_reconcile_create_data->account_id); }
public function action_reconcilevalidate() { $account_reconcile_create_data = new stdClass(); $account_reconcile_create_data->validate_only = TRUE; $account_reconcile_create_data->account_id = $this->request->post('account_id'); $account_reconcile_create_data->date = date("Y-m-d", strtotime($this->request->post('date'))); $account_reconcile_create_data->balance_start = preg_replace("/([^0-9\\.\\-])/i", "", $this->request->post('balance_start')); $account_reconcile_create_data->balance_end = preg_replace("/([^0-9\\.\\-])/i", "", $this->request->post('balance_end')); $account_reconcile_create_data->account_transaction_ids = array(); foreach ($this->request->post() as $key => $value) { if (strpos($key, 'include-transaction-') !== FALSE) { $account_reconcile_create_data->account_transaction_ids[] = str_replace('include-transaction-', '', $key); } } $account_reconcile_create = new Beans_Account_Reconcile_Create($this->_beans_data_auth($account_reconcile_create_data)); $account_reconcile_create_result = $account_reconcile_create->execute(); if (!$account_reconcile_create_result->success) { return $this->_return_error("An error occurred when recording that statement:<br>" . $this->_beans_result_get_error($account_reconcile_create_result)); } return; $this->_return_object->data->account_reconcile = $account_reconcile_create_result->data->account_reconcile; }