mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Merge branch 'master' into save-locale
This commit is contained in:
commit
373dee3410
@ -275,6 +275,7 @@ class TransactionsTable extends Table
|
||||
'type' => 'decay',
|
||||
'balance' => $balance,
|
||||
'decay_duration' => $duration,
|
||||
'last_decay' => true,
|
||||
'memo' => ''
|
||||
];
|
||||
}
|
||||
|
||||
@ -11,7 +11,11 @@ $body['decay'] = $this->element('centToFloat', ['cent' => $body['decay'], 'preci
|
||||
$body['gdtSum'] = $this->element('centToFloat', ['cent' => $body['gdtSum'], 'precision' => 2]);
|
||||
|
||||
foreach($body['transactions'] as $i => $transaction) {
|
||||
$body['transactions'][$i]['balance'] = $this->element('centToFloat', ['cent' => $transaction['balance'], 'precision' => 4]);
|
||||
$useCeil = false;
|
||||
if(isset($transaction['last_decay']) && $transaction['last_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]);
|
||||
}
|
||||
|
||||
@ -9,7 +9,11 @@
|
||||
$cut_places = $precision - 2;
|
||||
$transformAmount = $cent;
|
||||
if($cut_places > 0) {
|
||||
$transformAmount = floor($cent / pow(10, $cut_places));
|
||||
if(isset($useCeil) && $useCeil) {
|
||||
$transformAmount = ceil($cent / pow(10, $cut_places));
|
||||
} else {
|
||||
$transformAmount = floor($cent / pow(10, $cut_places));
|
||||
}
|
||||
}
|
||||
if($cut_places < 0) {
|
||||
$cut_places = 0;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user