예제 #1
0
 private function assertSameCategoryAsCurrent($p_oldCategory)
 {
     $v_currentCategory = $this->r_cloudBankServer->execQuery('SELECT name FROM ledger_account WHERE id = :accountID', array(':accountID' => $p_oldCategory['id']));
     if (!CloudBankServer::IsEqual($p_oldCategory, $v_currentCategory[0], array('name' => 'name'))) {
         throw new Exception("The Category to be modified ({$p_oldCategory['id']}) does " . "not exist or has been modified by another session. Please " . "try again.");
     }
 }
예제 #2
0
    private function assertSameAsCurrent($p_accountID, $p_oldEvent)
    {
        Debug::Singleton()->log('assertSameAsCurrent(' . var_export($p_accountID, true) . ', ' . var_export($p_oldEvent, true) . ')');
        $v_currentEvent = $this->r_cloudBankServer->execQuery('
		  SELECT
		     date, description, other_ledger_account_id, amount,
		     statement_item_id, is_cleared
		  FROM account_events
		  WHERE ledger_account_id = :account_id AND id = :id
	       ', array(':account_id' => $p_accountID, ':id' => $p_oldEvent['id']));
        $v_mapping = array('date' => 'date', 'description' => 'description', 'other_account_id' => 'other_ledger_account_id', 'amount' => 'amount', 'is_cleared' => 'is_cleared');
        if (isset($p_oldEvent['statement_item_id'])) {
            $v_mapping['is_cleared'] = 'is_cleared';
        }
        if (!CloudBankServer::IsEqual($p_oldEvent, $v_currentEvent[0], $v_mapping)) {
            throw new Exception("The event to be modified ({$p_oldEvent['id']}) does not " . "exist or has been modified by another session. Please try " . "again.");
        }
    }