mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
check if type is set
This commit is contained in:
parent
8ddec8e067
commit
89bf681f48
@ -12,15 +12,19 @@ $body['gdtSum'] = $this->element('centToFloat', ['cent' => $body['gdtSum'], 'pre
|
||||
|
||||
foreach($body['transactions'] as $i => $transaction) {
|
||||
$useCeil = false;
|
||||
if($transaction['type'] == 'decay') {
|
||||
$useCeil = true;
|
||||
}
|
||||
$body['transactions'][$i]['balance'] = $this->element('centToFloat', ['cent' => $transaction['balance'], 'precision' => 4, 'useCeil' => $useCeil]);
|
||||
if(isset($transaction['creation_amount'])) {
|
||||
$body['transactions'][$i]['creation_amount'] = $this->element('centToFloat', ['cent' => $transaction['creation_amount'], 'precision' => 4]);
|
||||
}
|
||||
if(isset($transaction['decay'])) {
|
||||
$body['transactions'][$i]['decay']['balance'] = $this->element('centToFloat', ['cent' => $transaction['decay']['balance'], 'precision' => 4]);
|
||||
if(!isset($transaction['type'])) {
|
||||
$body = ['state' => 'error', 'msg' => 'transaction without type found', 'details' => $transaction];
|
||||
} else {
|
||||
if($transaction['type'] == 'decay') {
|
||||
$useCeil = true;
|
||||
}
|
||||
$body['transactions'][$i]['balance'] = $this->element('centToFloat', ['cent' => $transaction['balance'], 'precision' => 4, 'useCeil' => $useCeil]);
|
||||
if(isset($transaction['creation_amount'])) {
|
||||
$body['transactions'][$i]['creation_amount'] = $this->element('centToFloat', ['cent' => $transaction['creation_amount'], 'precision' => 4]);
|
||||
}
|
||||
if(isset($transaction['decay'])) {
|
||||
$body['transactions'][$i]['decay']['balance'] = $this->element('centToFloat', ['cent' => $transaction['decay']['balance'], 'precision' => 4]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user