Skip to content

Commit

Permalink
Transaction model: valueDate could be equal to zero '0'
Browse files Browse the repository at this point in the history
Tobia Zanarella committed Apr 7, 2021
1 parent 2870b0d commit 6833c0b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Models/Transaction.php
Original file line number Diff line number Diff line change
@@ -100,7 +100,12 @@ protected function hydrateData( stdClass $data ) {
$this->AccountingDate = new DateTime( $data->accountingDate );
}

$this->ValueDate = new DateTime( $data->valueDate );
if( isset( $data->valueDate ) and !empty( $data->valueDate ) ) {
$this->ValueDate = new DateTime( $data->valueDate );

} else {
$this->ValueDate = new DateTime();
}

$this->Currency = (string)$data->currency;
$this->Amount = (float)$data->amount;

0 comments on commit 6833c0b

Please sign in to comment.