Store booleans correctly.

This commit is contained in:
James Cole 2018-12-21 15:42:57 +01:00
parent 922c8703f5
commit a5520d45e7
No known key found for this signature in database
GPG Key ID: C16961E655E74B5E
6 changed files with 20 additions and 6 deletions

View File

@ -276,6 +276,7 @@ class CurrencyController extends Controller
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
$unfiltered = $repository->getAllBudgetLimits($this->parameters->get('start'), $this->parameters->get('end'));
// TODO replace this
// filter budget limits on currency ID
$collection = $unfiltered->filter(
function (BudgetLimit $budgetLimit) use ($currency) {

View File

@ -51,6 +51,11 @@ class BillRequest extends Request
*/
public function getAll(): array
{
$active = true;
if(null !== $this->get('active')) {
$active = $this->boolean('active');
}
$data = [
'name' => $this->string('name'),
'amount_min' => $this->string('amount_min'),
@ -60,8 +65,7 @@ class BillRequest extends Request
'date' => $this->date('date'),
'repeat_freq' => $this->string('repeat_freq'),
'skip' => $this->integer('skip'),
'automatch' => $this->boolean('automatch'),
'active' => $this->boolean('active'),
'active' => $active,
'notes' => $this->string('notes'),
];

View File

@ -49,9 +49,14 @@ class BudgetRequest extends Request
*/
public function getAll(): array
{
$active = true;
if (null !== $this->get('active')) {
$active = $this->boolean('active');
}
return [
'name' => $this->string('name'),
'active' => $this->boolean('active'),
'active' => $active,
'order' => 0,
];
}

View File

@ -211,7 +211,7 @@ class TransactionRequest extends Request
'source_name' => isset($transaction['source_name']) ? (string)$transaction['source_name'] : null,
'destination_id' => isset($transaction['destination_id']) ? (int)$transaction['destination_id'] : null,
'destination_name' => isset($transaction['destination_name']) ? (string)$transaction['destination_name'] : null,
'reconciled' => $transaction['reconciled'] ?? false,
'reconciled' => $this->convertBoolean((string)($transaction['reconciled'] ?? 'false')),
'identifier' => $index,
];
}

View File

@ -65,9 +65,13 @@ class UserRequest extends Request
*/
public function getAll(): array
{
$blocked = false;
if (null === $this->get('blocked')) {
$blocked = $this->boolean('blocked');
}
$data = [
'email' => $this->string('email'),
'blocked' => $this->boolean('blocked'),
'blocked' => $blocked,
'blocked_code' => $this->string('blocked_code'),
'role' => $this->string('role'),
];

View File

@ -80,7 +80,7 @@ class BillFactory
'date' => $data['date'],
'repeat_freq' => $data['repeat_freq'],
'skip' => $data['skip'],
'automatch' => $data['automatch'] ?? true,
'automatch' => true,
'active' => $data['active'] ?? true,
]
);