/** * Список операций для счёта (PDA) * * @param array $args */ function account($args = array()) { // Если указан id счёта if (isset($args[0]) && (int) $args[0]) { $accountId = (int) $args[0]; // Получаем последние 10 операций по нему // На самом деле это пока невозможно, получаем все операции $operations = $this->model->getOperationList(Helper_Date::getMysql(3), Helper_Date::getMysql(time()), null, $accountId, -1, null, null, null); } else { //_Core_Router::redirect('/info' , true); } if (!is_array($operations)) { $operations = array(); } $this->_setDrain($operations); $this->tpl->assign('accountId', $accountId); $this->tpl->assign('operations', $operations); $this->tpl->assign('name_page', 'account/operations'); }
/** * Тест перевода на долговой счёт */ public function testDebtTransfer() { $this->_prepareOperation(); // Долговой счёт $options = array('user_id' => $this->userId, 'account_name' => 'Debt account', 'account_currency_id' => myMoney::RUR, 'account_type_id' => Account_Collection::ACCOUNT_TYPE_CREDIT); $account = CreateObjectHelper::makeAccount($options); $toAccountId = $account['account_id']; $options = array('user_id' => $this->userId, 'system_category_id' => Category_Model::DEBT_SYSTEM_CATEGORY_ID); $debtCategoryId = CreateObjectHelper::createCategory($options); $this->user->init(); $this->user->save(); $operation = new Operation_Model($this->user); // Перевели 100 рублей с рублёвого на долларовый $opId = $operation->addTransfer(100, 0, 0, '2010-01-01', $this->accountId, $toAccountId, 'Комментарий', array('тег 1')); $dateFrom = '2009-12-29'; $dateTo = '2010-01-02'; $list = $operation->getOperationList($dateFrom, $dateTo); $this->assertEquals($debtCategoryId, $list[0]['cat_id'], 'Expected only 1 transfer operation'); }