check other user in case of he was deleted from db and to prevent showing warning

This commit is contained in:
Dario Rekowski on RockPI 2020-06-11 15:14:31 +00:00
parent fdea18e1e8
commit 6b08d3d5ef
2 changed files with 9 additions and 16 deletions

View File

@ -144,11 +144,18 @@ class StateBalancesController extends AppController
$otherUser = null; $otherUser = null;
if ($sendCoins->state_user_id == $user['id']) { if ($sendCoins->state_user_id == $user['id']) {
$type = 'send'; $type = 'send';
if(isset($involvedUserIndices[$sendCoins->receiver_user_id])) {
$otherUser = $involvedUserIndices[$sendCoins->receiver_user_id]; $otherUser = $involvedUserIndices[$sendCoins->receiver_user_id];
}
} else if ($sendCoins->receiver_user_id == $user['id']) { } else if ($sendCoins->receiver_user_id == $user['id']) {
$type = 'receive'; $type = 'receive';
if(isset($involvedUserIndices[$sendCoins->state_user_id])) {
$otherUser = $involvedUserIndices[$sendCoins->state_user_id]; $otherUser = $involvedUserIndices[$sendCoins->state_user_id];
} }
}
if(null == $otherUser) {
$otherUser = $this->StateBalances->StateUsers->newEntity();
}
array_push($transactions, [ array_push($transactions, [
'name' => $otherUser->first_name . ' ' . $otherUser->last_name, 'name' => $otherUser->first_name . ' ' . $otherUser->last_name,
'email' => $otherUser->email, 'email' => $otherUser->email,

View File

@ -20,20 +20,6 @@ $this->assign('header', $header);
//var_dump($transactions); //var_dump($transactions);
?> ?>
<div class="row">
<div class="col-md-8 equel-grid">
<div class="grid">
<div class="grid-body py-3">
<h3><?= __('Aktueller Kontostand: ') ?></h3>
<h2><?= $this->element('printGradido', ['number' => $balance]) ?></h2>
<?php if($gdtSum > 0) : ?>
<h2><?= $this->Html->link($this->element('printGDT', ['number' => $gdtSum]), ['action' => 'overview_gdt'], ['escape' => false]) ?> <span class="gdt-text-color">(<?= __('Testphase')?>)</span></h2>
<?php endif; ?>
</div>
</div>
</div>
</div>
<?php if($transactionExecutingCount > 0) : ?> <?php if($transactionExecutingCount > 0) : ?>
<div id="transaction-execute-display" class=""> <div id="transaction-execute-display" class="">