/** @param Category $p_oldCategory http://pety.homelinux.org/CloudBank/LedgerAccountService @param Category $p_newCategory http://pety.homelinux.org/CloudBank/LedgerAccountService @return boolean Success */ public function modifyCategory($p_oldCategory, $p_newCategory) { CloudBankServer::AssertIDsMatch($p_newCategory['id'], $p_oldCategory['id']); $this->r_cloudBankServer->beginTransaction(); $this->assertSameCategoryAsCurrent($p_oldCategory); $this->createOrUpdateLedgerAccount($p_newCategory['name'], CloudBankConsts::LedgerAccountType_Category, $p_newCategory['id']); $this->r_cloudBankServer->commitTransaction(); return true; }
/** @param string $p_accountID The account the event is started from @param Event $p_oldEvent http://pety.homelinux.org/CloudBank/EventService @param Event $p_newEvent http://pety.homelinux.org/CloudBank/EventService @return boolean Success */ public function modifyEvent($p_accountID, $p_oldEvent, $p_newEvent) { Debug::Singleton()->log('modifyEvent(' . var_export($p_accountID, true) . ', ' . var_export($p_oldEvent, true) . ', ' . var_export($p_newEvent, true) . ')'); CloudBankServer::AssertIDsMatch($p_newEvent['id'], $p_oldEvent['id']); $this->r_cloudBankServer->beginTransaction(); $v_oldEvent = $p_oldEvent; self::ApplyDefaults($v_oldEvent); $this->assertSameAsCurrent($p_accountID, $v_oldEvent); $v_newEvent = $p_newEvent; self::ApplyDefaults($v_newEvent); $this->createOrUpdateEvent($v_newEvent['date'], $v_newEvent['description'], $p_accountID, $v_newEvent['other_account_id'], $v_newEvent['amount'], isset($v_newEvent['statement_item_id']) ? $v_newEvent['statement_item_id'] : NULL, $v_newEvent['is_cleared'], $v_newEvent['id']); $this->r_cloudBankServer->commitTransaction(); return true; }