Merge pull request #628 from gradido/community_fix_type_not_found_message

fix type not found error in listTransaction Call
This commit is contained in:
einhornimmond 2021-07-13 15:29:33 +02:00 committed by GitHub
commit 0a6e7940fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -12,6 +12,9 @@ $body['gdtSum'] = $this->element('centToFloat', ['cent' => $body['gdtSum'], 'pre
foreach($body['transactions'] as $i => $transaction) { foreach($body['transactions'] as $i => $transaction) {
$useCeil = false; $useCeil = false;
if(!isset($transaction['type'])) {
$body = ['state' => 'error', 'msg' => 'transaction without type found', 'details' => $transaction];
} else {
if($transaction['type'] == 'decay') { if($transaction['type'] == 'decay') {
$useCeil = true; $useCeil = true;
} }
@ -22,6 +25,7 @@ foreach($body['transactions'] as $i => $transaction) {
if(isset($transaction['decay'])) { if(isset($transaction['decay'])) {
$body['transactions'][$i]['decay']['balance'] = $this->element('centToFloat', ['cent' => $transaction['decay']['balance'], 'precision' => 4]); $body['transactions'][$i]['decay']['balance'] = $this->element('centToFloat', ['cent' => $transaction['decay']['balance'], 'precision' => 4]);
} }
}
} }
?><?= json_encode($body) ?> ?><?= json_encode($body) ?>