/** * Редактирует транзакцию * * @param int $type Тип операции: 0 - расход, 1 - доход * @param int $id Ид транзакции * @param float $money Сумма транзакции * @param string $date Дата транзакции в формате Y.m.d * @param int $category Ид категории * @param string $comment Комментарий транзакции * @param int $account_id Ид счета * @param array $tags Теги * @param int $accepted Подтверждена ли операция * @param array $notifications * * @return bool true - Регистрация прошла успешно */ function edit($type, $id, $money = 0, $date = '', $category = null, $comment = '', $account = 0, array $tags = array(), $accepted = null, $notifications = array()) { $values = array('money' => $money, 'date' => $date, 'cat_id' => $category, 'account_id' => $account, 'comment' => $comment, 'tags' => implode(', ', $tags), 'type' => $type); if ($accepted) { $values['accepted'] = '1'; } $this->_addNotifications($id, $date, $notifications, $this->_user); $this->_updateOperation($this->_user, $id, $values); // Обновляем данные о счетах пользователя $this->_user->initUserAccounts(); $this->_user->save(); $this->save(); return '[]'; }