Beispiel #1
0
 private function assertStatementItemIsValid($p_statement_item_arr, $p_line_no, $p_statement_line)
 {
     if (count($p_statement_item_arr) < 6) {
         throw new Exception("Statement file: line #{$p_line_no} is incomplete (" . "{$p_statement_line})");
     }
     if (!SchemaDef::IsValidStatementItemID($p_statement_item_arr[0])) {
         throw new Exception("Statement file: line #{$p_line_no}: invalid item ID (" . "{$p_statement_item_arr['0']})");
     }
     if (!$this->r_ledgerAccountService->doesExistAndNotThis($p_statement_item_arr[1], CloudBankConsts::LedgerAccountType_Account)) {
         throw new Exception("Statement file: line #{$p_line_no}: account (" . "{$p_statement_item_arr['1']}) does not exist");
     }
     if (!SchemaDef::IsValidStatementItemType($p_statement_item_arr[2])) {
         throw new Exception("Statement file: line #{$p_line_no}: invalid item type (" . "{$p_statement_item_arr['2']})");
     }
     if (!SchemaDef::IsValidDate($p_statement_item_arr[3])) {
         throw new Exception("Statement file: line #{$p_line_no}: invalid date (" . "{$p_statement_item_arr['3']})");
     }
     if (!SchemaDef::IsValidStatementItemDescription($p_statement_item_arr[4])) {
         throw new Exception("Statement file: line #{$p_line_no}: invalid description (" . "{$p_statement_item_arr['4']})");
     }
     if (!SchemaDef::IsValidAmount($p_statement_item_arr[5])) {
         throw new Exception("Statement file: line #{$p_line_no}: invalid amount (" . "{$p_statement_item_arr['4']})");
     }
 }