mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-12-28 01:41:14 -06:00
Code cleanup that (hopefully) matches style CI
This commit is contained in:
parent
64462812fc
commit
e02e747f1b
@ -104,7 +104,7 @@ class AccountController extends Controller
|
||||
|
||||
// types to get, page size:
|
||||
$types = $this->mapAccountTypes($this->parameters->get('type'));
|
||||
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
$pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
|
||||
// get list of accounts. Count it and split it.
|
||||
$collection = $this->repository->getAccountsByType($types);
|
||||
@ -142,7 +142,7 @@ class AccountController extends Controller
|
||||
$manager = $this->getManager();
|
||||
|
||||
// types to get, page size:
|
||||
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
$pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
|
||||
// get list of budgets. Count it and split it.
|
||||
$collection = $this->repository->getPiggyBanks($account);
|
||||
@ -218,7 +218,7 @@ class AccountController extends Controller
|
||||
*/
|
||||
public function transactions(Request $request, Account $account): JsonResponse
|
||||
{
|
||||
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
$pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
$type = $request->get('type') ?? 'default';
|
||||
$this->parameters->set('type', $type);
|
||||
|
||||
|
@ -92,8 +92,8 @@ class AttachmentController extends Controller
|
||||
* @param Attachment $attachment
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
* @return LaravelResponse
|
||||
* @throws FireflyException
|
||||
* @return LaravelResponse
|
||||
*/
|
||||
public function download(Attachment $attachment): LaravelResponse
|
||||
{
|
||||
@ -108,7 +108,7 @@ class AttachmentController extends Controller
|
||||
if ('' === $content) {
|
||||
throw new FireflyException('200002: File is empty (zero bytes).');
|
||||
}
|
||||
$quoted = sprintf('"%s"', addcslashes(basename($attachment->filename), '"\\'));
|
||||
$quoted = sprintf('"%s"', addcslashes(basename($attachment->filename), '"\\'));
|
||||
|
||||
/** @var LaravelResponse $response */
|
||||
$response = response($content);
|
||||
@ -139,7 +139,7 @@ class AttachmentController extends Controller
|
||||
$manager = $this->getManager();
|
||||
|
||||
// types to get, page size:
|
||||
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
$pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
|
||||
// get list of accounts. Count it and split it.
|
||||
$collection = $this->repository->get();
|
||||
@ -184,8 +184,8 @@ class AttachmentController extends Controller
|
||||
*
|
||||
* @param AttachmentStoreRequest $request
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function store(AttachmentStoreRequest $request): JsonResponse
|
||||
{
|
||||
|
@ -92,7 +92,7 @@ class AvailableBudgetController extends Controller
|
||||
$manager = $this->getManager();
|
||||
|
||||
// types to get, page size:
|
||||
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
$pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
|
||||
$start = $this->parameters->get('start');
|
||||
$end = $this->parameters->get('end');
|
||||
|
@ -85,7 +85,7 @@ class BillController extends Controller
|
||||
public function attachments(Bill $bill): JsonResponse
|
||||
{
|
||||
$manager = $this->getManager();
|
||||
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
$pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
$collection = $this->repository->getAttachments($bill);
|
||||
|
||||
$count = $collection->count();
|
||||
@ -130,7 +130,7 @@ class BillController extends Controller
|
||||
{
|
||||
$bills = $this->repository->getBills();
|
||||
$manager = $this->getManager();
|
||||
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
$pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
$count = $bills->count();
|
||||
$bills = $bills->slice(($this->parameters->get('page') - 1) * $pageSize, $pageSize);
|
||||
$paginator = new LengthAwarePaginator($bills, $count, $pageSize, $this->parameters->get('page'));
|
||||
@ -158,7 +158,7 @@ class BillController extends Controller
|
||||
$manager = $this->getManager();
|
||||
|
||||
// types to get, page size:
|
||||
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
$pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
|
||||
// get list of budgets. Count it and split it.
|
||||
$collection = $this->repository->getRulesForBill($bill);
|
||||
@ -206,8 +206,8 @@ class BillController extends Controller
|
||||
*
|
||||
* @param BillRequest $request
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function store(BillRequest $request): JsonResponse
|
||||
{
|
||||
@ -235,7 +235,7 @@ class BillController extends Controller
|
||||
*/
|
||||
public function transactions(Request $request, Bill $bill): JsonResponse
|
||||
{
|
||||
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
$pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
$type = $request->get('type') ?? 'default';
|
||||
$this->parameters->set('type', $type);
|
||||
|
||||
|
@ -90,7 +90,7 @@ class BudgetController extends Controller
|
||||
public function budgetLimits(Budget $budget): JsonResponse
|
||||
{
|
||||
$manager = $this->getManager();
|
||||
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
$pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
$this->parameters->set('budget_id', $budget->id);
|
||||
$collection = $this->blRepository->getBudgetLimits($budget, $this->parameters->get('start'), $this->parameters->get('end'));
|
||||
$count = $collection->count();
|
||||
@ -135,7 +135,7 @@ class BudgetController extends Controller
|
||||
$manager = $this->getManager();
|
||||
|
||||
// types to get, page size:
|
||||
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
$pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
|
||||
// get list of budgets. Count it and split it.
|
||||
$collection = $this->repository->getBudgets();
|
||||
@ -182,9 +182,9 @@ class BudgetController extends Controller
|
||||
*
|
||||
* @param BudgetStoreRequest $request
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function store(BudgetStoreRequest $request): JsonResponse
|
||||
{
|
||||
@ -206,8 +206,8 @@ class BudgetController extends Controller
|
||||
* @param BudgetLimitRequest $request
|
||||
* @param Budget $budget
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @throws Exception
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function storeBudgetLimit(BudgetLimitRequest $request, Budget $budget): JsonResponse
|
||||
{
|
||||
@ -237,7 +237,7 @@ class BudgetController extends Controller
|
||||
*/
|
||||
public function transactions(Request $request, Budget $budget): JsonResponse
|
||||
{
|
||||
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
$pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
|
||||
// user can overrule page size with limit parameter.
|
||||
$limit = $this->parameters->get('limit');
|
||||
@ -293,7 +293,7 @@ class BudgetController extends Controller
|
||||
* Update a budget.
|
||||
*
|
||||
* @param BudgetUpdateRequest $request
|
||||
* @param Budget $budget
|
||||
* @param Budget $budget
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
|
@ -102,9 +102,9 @@ class BudgetLimitController extends Controller
|
||||
public function index(Request $request): JsonResponse
|
||||
{
|
||||
$manager = $this->getManager();
|
||||
$budgetId = (int)($request->get('budget_id') ?? 0);
|
||||
$budgetId = (int) ($request->get('budget_id') ?? 0);
|
||||
$budget = $this->repository->findNull($budgetId);
|
||||
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
$pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
$this->parameters->set('budget_id', $budgetId);
|
||||
|
||||
$collection = new Collection;
|
||||
@ -156,9 +156,9 @@ class BudgetLimitController extends Controller
|
||||
*
|
||||
* @param BudgetLimitRequest $request
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function store(BudgetLimitRequest $request): JsonResponse
|
||||
{
|
||||
@ -191,7 +191,7 @@ class BudgetLimitController extends Controller
|
||||
*/
|
||||
public function transactions(Request $request, BudgetLimit $budgetLimit): JsonResponse
|
||||
{
|
||||
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
$pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
$type = $request->get('type') ?? 'default';
|
||||
$this->parameters->set('type', $type);
|
||||
|
||||
|
@ -97,7 +97,7 @@ class CategoryController extends Controller
|
||||
$manager = $this->getManager();
|
||||
|
||||
// types to get, page size:
|
||||
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
$pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
|
||||
// get list of budgets. Count it and split it.
|
||||
$collection = $this->repository->getCategories();
|
||||
@ -146,13 +146,13 @@ class CategoryController extends Controller
|
||||
*
|
||||
* @param CategoryRequest $request
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function store(CategoryRequest $request): JsonResponse
|
||||
{
|
||||
$category = $this->repository->store($request->getAll());
|
||||
$manager = $this->getManager();
|
||||
$manager = $this->getManager();
|
||||
|
||||
/** @var CategoryTransformer $transformer */
|
||||
$transformer = app(CategoryTransformer::class);
|
||||
@ -175,7 +175,7 @@ class CategoryController extends Controller
|
||||
*/
|
||||
public function transactions(Request $request, Category $category): JsonResponse
|
||||
{
|
||||
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
$pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
$type = $request->get('type') ?? 'default';
|
||||
$this->parameters->set('type', $type);
|
||||
|
||||
|
@ -99,10 +99,10 @@ class AccountController extends Controller
|
||||
|
||||
// loop the end balances. This is an array for each account ($expenses)
|
||||
foreach ($endBalances as $accountId => $expenses) {
|
||||
$accountId = (int)$accountId;
|
||||
$accountId = (int) $accountId;
|
||||
// loop each expense entry (each entry can be a different currency).
|
||||
foreach ($expenses as $currencyId => $endAmount) {
|
||||
$currencyId = (int)$currencyId;
|
||||
$currencyId = (int) $currencyId;
|
||||
|
||||
// see if there is an accompanying start amount.
|
||||
// grab the difference and find the currency.
|
||||
@ -114,7 +114,7 @@ class AccountController extends Controller
|
||||
$tempData[] = [
|
||||
'name' => $accountNames[$accountId],
|
||||
'difference' => $diff,
|
||||
'diff_float' => (float)$diff,
|
||||
'diff_float' => (float) $diff,
|
||||
'currency_id' => $currencyId,
|
||||
];
|
||||
}
|
||||
@ -247,10 +247,10 @@ class AccountController extends Controller
|
||||
|
||||
// loop the end balances. This is an array for each account ($expenses)
|
||||
foreach ($endBalances as $accountId => $expenses) {
|
||||
$accountId = (int)$accountId;
|
||||
$accountId = (int) $accountId;
|
||||
// loop each expense entry (each entry can be a different currency).
|
||||
foreach ($expenses as $currencyId => $endAmount) {
|
||||
$currencyId = (int)$currencyId;
|
||||
$currencyId = (int) $currencyId;
|
||||
|
||||
// see if there is an accompanying start amount.
|
||||
// grab the difference and find the currency.
|
||||
@ -263,7 +263,7 @@ class AccountController extends Controller
|
||||
'name' => $accountNames[$accountId],
|
||||
'difference' => bcmul($diff, '-1'),
|
||||
// For some reason this line is never covered in code coverage:
|
||||
'diff_float' => ((float)$diff) * -1, // @codeCoverageIgnore
|
||||
'diff_float' => ((float) $diff) * -1, // @codeCoverageIgnore
|
||||
'currency_id' => $currencyId,
|
||||
];
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ class AvailableBudgetController extends Controller
|
||||
$spent = $spentInfo['amount'];
|
||||
}
|
||||
}
|
||||
$left = bcadd($availableBudget->amount, (string)$spent);
|
||||
$left = bcadd($availableBudget->amount, (string) $spent);
|
||||
// left less than zero? Set to zero.
|
||||
if (-1 === bccomp($left, '0')) {
|
||||
$left = '0';
|
||||
|
@ -104,7 +104,7 @@ class CategoryController extends Controller
|
||||
// make data arrays if not yet present.
|
||||
$tempData[$inKey] = $tempData[$inKey] ?? [
|
||||
'currency_id' => $currency['currency_id'],
|
||||
'label' => (string)trans('firefly.box_earned_in_currency', ['currency' => $currency['currency_name']]),
|
||||
'label' => (string) trans('firefly.box_earned_in_currency', ['currency' => $currency['currency_name']]),
|
||||
'currency_code' => $currency['currency_code'],
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_decimal_places' => $currency['currency_decimal_places'],
|
||||
@ -117,7 +117,7 @@ class CategoryController extends Controller
|
||||
];
|
||||
$tempData[$outKey] = $tempData[$outKey] ?? [
|
||||
'currency_id' => $currency['currency_id'],
|
||||
'label' => (string)trans('firefly.box_spent_in_currency', ['currency' => $currency['currency_name']]),
|
||||
'label' => (string) trans('firefly.box_spent_in_currency', ['currency' => $currency['currency_name']]),
|
||||
'currency_code' => $currency['currency_code'],
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'currency_decimal_places' => $currency['currency_decimal_places'],
|
||||
@ -141,48 +141,48 @@ class CategoryController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
// foreach ([] as $set) {
|
||||
// foreach ($set as $currency) {
|
||||
// $inKey = sprintf('%d-i', $currency['currency_id']);
|
||||
// $outKey = sprintf('%d-e', $currency['currency_id']);
|
||||
// $categories[] = (string)trans('firefly.no_category');
|
||||
// // make data arrays if not yet present.
|
||||
// $tempData[$inKey] = $tempData[$inKey] ?? [
|
||||
// 'currency_id' => $currency['currency_id'],
|
||||
// 'label' => (string)trans('firefly.box_earned_in_currency', ['currency' => $currency['currency_name']]),
|
||||
// 'currency_code' => $currency['currency_code'],
|
||||
// 'currency_symbol' => $currency['currency_symbol'],
|
||||
// 'currency_decimal_places' => $currency['currency_decimal_places'],
|
||||
// 'type' => 'bar', // line, area or bar
|
||||
// 'yAxisID' => 0, // 0, 1, 2
|
||||
// 'entries' => [
|
||||
// // per category:
|
||||
// // "category" => 5,
|
||||
// ],
|
||||
// ];
|
||||
// $tempData[$outKey] = $tempData[$outKey] ?? [
|
||||
// 'currency_id' => $currency['currency_id'],
|
||||
// 'label' => (string)trans('firefly.box_spent_in_currency', ['currency' => $currency['currency_name']]),
|
||||
// 'currency_code' => $currency['currency_code'],
|
||||
// 'currency_symbol' => $currency['currency_symbol'],
|
||||
// 'currency_decimal_places' => $currency['currency_decimal_places'],
|
||||
// 'type' => 'bar', // line, area or bar
|
||||
// 'yAxisID' => 0, // 0, 1, 2
|
||||
// 'entries' => [
|
||||
// // per category:
|
||||
// // "category" => 5,
|
||||
// ],
|
||||
// ];
|
||||
// foreach ($currency['transaction_journals'] as $journal) {
|
||||
// // is it expense or income?
|
||||
// $letter = -1 === bccomp($journal['amount'], '0') ? 'e' : 'i';
|
||||
// $currentKey = sprintf('%d-%s', $currency['currency_id'], $letter);
|
||||
// $name = (string)trans('firefly.no_category');
|
||||
// $tempData[$currentKey]['entries'][$name] = $tempData[$currentKey]['entries'][$name] ?? '0';
|
||||
// $tempData[$currentKey]['entries'][$name] = bcadd($tempData[$currentKey]['entries'][$name], $journal['amount']);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// foreach ([] as $set) {
|
||||
// foreach ($set as $currency) {
|
||||
// $inKey = sprintf('%d-i', $currency['currency_id']);
|
||||
// $outKey = sprintf('%d-e', $currency['currency_id']);
|
||||
// $categories[] = (string)trans('firefly.no_category');
|
||||
// // make data arrays if not yet present.
|
||||
// $tempData[$inKey] = $tempData[$inKey] ?? [
|
||||
// 'currency_id' => $currency['currency_id'],
|
||||
// 'label' => (string)trans('firefly.box_earned_in_currency', ['currency' => $currency['currency_name']]),
|
||||
// 'currency_code' => $currency['currency_code'],
|
||||
// 'currency_symbol' => $currency['currency_symbol'],
|
||||
// 'currency_decimal_places' => $currency['currency_decimal_places'],
|
||||
// 'type' => 'bar', // line, area or bar
|
||||
// 'yAxisID' => 0, // 0, 1, 2
|
||||
// 'entries' => [
|
||||
// // per category:
|
||||
// // "category" => 5,
|
||||
// ],
|
||||
// ];
|
||||
// $tempData[$outKey] = $tempData[$outKey] ?? [
|
||||
// 'currency_id' => $currency['currency_id'],
|
||||
// 'label' => (string)trans('firefly.box_spent_in_currency', ['currency' => $currency['currency_name']]),
|
||||
// 'currency_code' => $currency['currency_code'],
|
||||
// 'currency_symbol' => $currency['currency_symbol'],
|
||||
// 'currency_decimal_places' => $currency['currency_decimal_places'],
|
||||
// 'type' => 'bar', // line, area or bar
|
||||
// 'yAxisID' => 0, // 0, 1, 2
|
||||
// 'entries' => [
|
||||
// // per category:
|
||||
// // "category" => 5,
|
||||
// ],
|
||||
// ];
|
||||
// foreach ($currency['transaction_journals'] as $journal) {
|
||||
// // is it expense or income?
|
||||
// $letter = -1 === bccomp($journal['amount'], '0') ? 'e' : 'i';
|
||||
// $currentKey = sprintf('%d-%s', $currency['currency_id'], $letter);
|
||||
// $name = (string)trans('firefly.no_category');
|
||||
// $tempData[$currentKey]['entries'][$name] = $tempData[$currentKey]['entries'][$name] ?? '0';
|
||||
// $tempData[$currentKey]['entries'][$name] = bcadd($tempData[$currentKey]['entries'][$name], $journal['amount']);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// re-sort every spent array and add 0 for missing entries.
|
||||
foreach ($tempData as $index => $set) {
|
||||
|
@ -111,8 +111,8 @@ class ConfigurationController extends Controller
|
||||
|
||||
return [
|
||||
'is_demo_site' => null === $isDemoSite ? null : $isDemoSite->data,
|
||||
'permission_update_check' => null === $updateCheck ? null : (int)$updateCheck->data,
|
||||
'last_update_check' => null === $lastCheck ? null : (int)$lastCheck->data,
|
||||
'permission_update_check' => null === $updateCheck ? null : (int) $updateCheck->data,
|
||||
'last_update_check' => null === $lastCheck ? null : (int) $lastCheck->data,
|
||||
'single_user_mode' => null === $singleUser ? null : $singleUser->data,
|
||||
];
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ class Controller extends BaseController
|
||||
private function getParameters(): ParameterBag
|
||||
{
|
||||
$bag = new ParameterBag;
|
||||
$page = (int)request()->get('page');
|
||||
$page = (int) request()->get('page');
|
||||
if (0 === $page) {
|
||||
$page = 1;
|
||||
}
|
||||
@ -131,7 +131,7 @@ class Controller extends BaseController
|
||||
foreach ($integers as $integer) {
|
||||
$value = request()->query->get($integer);
|
||||
if (null !== $value) {
|
||||
$bag->set($integer, (int)$value);
|
||||
$bag->set($integer, (int) $value);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -116,7 +116,7 @@ class CurrencyController extends Controller
|
||||
|
||||
// types to get, page size:
|
||||
$types = $this->mapAccountTypes($this->parameters->get('type'));
|
||||
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
$pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
|
||||
// get list of accounts. Count it and split it.
|
||||
/** @var AccountRepositoryInterface $accountRepository */
|
||||
@ -126,7 +126,7 @@ class CurrencyController extends Controller
|
||||
// filter list on currency preference:
|
||||
$collection = $unfiltered->filter(
|
||||
static function (Account $account) use ($currency, $accountRepository) {
|
||||
$currencyId = (int)$accountRepository->getMetaValue($account, 'currency_id');
|
||||
$currencyId = (int) $accountRepository->getMetaValue($account, 'currency_id');
|
||||
|
||||
return $currencyId === $currency->id;
|
||||
}
|
||||
@ -165,7 +165,7 @@ class CurrencyController extends Controller
|
||||
|
||||
$manager = $this->getManager();
|
||||
// types to get, page size:
|
||||
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
$pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
|
||||
// get list of available budgets. Count it and split it.
|
||||
|
||||
@ -209,7 +209,7 @@ class CurrencyController extends Controller
|
||||
|
||||
/** @var BillRepositoryInterface $repository */
|
||||
$repository = app(BillRepositoryInterface::class);
|
||||
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
$pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
$unfiltered = $repository->getBills();
|
||||
|
||||
// filter and paginate list:
|
||||
@ -249,7 +249,7 @@ class CurrencyController extends Controller
|
||||
$blRepository = app(BudgetLimitRepositoryInterface::class);
|
||||
|
||||
$manager = $this->getManager();
|
||||
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
$pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
$collection = $blRepository->getAllBudgetLimitsByCurrency($currency, $this->parameters->get('start'), $this->parameters->get('end'));
|
||||
$count = $collection->count();
|
||||
$budgetLimits = $collection->slice(($this->parameters->get('page') - 1) * $pageSize, $pageSize);
|
||||
@ -278,7 +278,7 @@ class CurrencyController extends Controller
|
||||
{
|
||||
// create some objects:
|
||||
$manager = $this->getManager();
|
||||
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
$pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
$collection = $this->repository->getExchangeRates($currency);
|
||||
|
||||
|
||||
@ -302,9 +302,9 @@ class CurrencyController extends Controller
|
||||
*
|
||||
* @param TransactionCurrency $currency
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
* @codeCoverageIgnore
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function delete(TransactionCurrency $currency): JsonResponse
|
||||
{
|
||||
@ -391,7 +391,7 @@ class CurrencyController extends Controller
|
||||
*/
|
||||
public function index(): JsonResponse
|
||||
{
|
||||
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
$pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
$collection = $this->repository->getAll();
|
||||
$count = $collection->count();
|
||||
// slice them:
|
||||
@ -455,7 +455,7 @@ class CurrencyController extends Controller
|
||||
{
|
||||
$manager = $this->getManager();
|
||||
// types to get, page size:
|
||||
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
$pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
|
||||
// get list of budgets. Count it and split it.
|
||||
/** @var RecurringRepositoryInterface $repository */
|
||||
@ -506,7 +506,7 @@ class CurrencyController extends Controller
|
||||
public function rules(TransactionCurrency $currency): JsonResponse
|
||||
{
|
||||
$manager = $this->getManager();
|
||||
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
$pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
|
||||
// get list of budgets. Count it and split it.
|
||||
/** @var RuleRepositoryInterface $repository */
|
||||
@ -572,8 +572,8 @@ class CurrencyController extends Controller
|
||||
*
|
||||
* @param CurrencyRequest $request
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function store(CurrencyRequest $request): JsonResponse
|
||||
{
|
||||
@ -607,7 +607,7 @@ class CurrencyController extends Controller
|
||||
*/
|
||||
public function transactions(Request $request, TransactionCurrency $currency): JsonResponse
|
||||
{
|
||||
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
$pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
$type = $request->get('type') ?? 'default';
|
||||
$this->parameters->set('type', $type);
|
||||
|
||||
|
@ -69,8 +69,8 @@ class CurrencyExchangeRateController extends Controller
|
||||
*
|
||||
* @param Request $request
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function index(Request $request): JsonResponse
|
||||
{
|
||||
|
@ -40,6 +40,7 @@ use League\Fractal\Resource\Item;
|
||||
|
||||
/**
|
||||
* Class ImportController
|
||||
*
|
||||
* @deprecated
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
@ -77,7 +78,7 @@ class ImportController extends Controller
|
||||
{
|
||||
// create some objects:
|
||||
$manager = $this->getManager();
|
||||
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
$pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
|
||||
// get list of accounts. Count it and split it.
|
||||
$collection = $this->repository->get();
|
||||
@ -127,7 +128,7 @@ class ImportController extends Controller
|
||||
*/
|
||||
public function transactions(Request $request, ImportJob $importJob): JsonResponse
|
||||
{
|
||||
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
$pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
$type = $request->get('type') ?? 'default';
|
||||
$this->parameters->set('type', $type);
|
||||
|
||||
|
@ -79,9 +79,9 @@ class LinkTypeController extends Controller
|
||||
*
|
||||
* @param LinkType $linkType
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
* @codeCoverageIgnore
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function delete(LinkType $linkType): JsonResponse
|
||||
{
|
||||
@ -103,7 +103,7 @@ class LinkTypeController extends Controller
|
||||
{
|
||||
// create some objects:
|
||||
$manager = $this->getManager();
|
||||
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
$pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
|
||||
// get list of accounts. Count it and split it.
|
||||
$collection = $this->repository->get();
|
||||
@ -151,8 +151,8 @@ class LinkTypeController extends Controller
|
||||
*
|
||||
* @param LinkTypeRequest $request
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function store(LinkTypeRequest $request): JsonResponse
|
||||
{
|
||||
@ -187,7 +187,7 @@ class LinkTypeController extends Controller
|
||||
*/
|
||||
public function transactions(Request $request, LinkType $linkType): JsonResponse
|
||||
{
|
||||
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
$pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
$type = $request->get('type') ?? 'default';
|
||||
$this->parameters->set('type', $type);
|
||||
|
||||
@ -241,8 +241,8 @@ class LinkTypeController extends Controller
|
||||
* @param LinkTypeRequest $request
|
||||
* @param LinkType $linkType
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function update(LinkTypeRequest $request, LinkType $linkType): JsonResponse
|
||||
{
|
||||
|
@ -93,7 +93,7 @@ class PiggyBankController extends Controller
|
||||
{
|
||||
$manager = $this->getManager();
|
||||
// types to get, page size:
|
||||
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
$pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
|
||||
// get list of budgets. Count it and split it.
|
||||
$collection = $this->repository->getPiggyBanks();
|
||||
@ -126,7 +126,7 @@ class PiggyBankController extends Controller
|
||||
public function piggyBankEvents(PiggyBank $piggyBank): JsonResponse
|
||||
{
|
||||
// types to get, page size:
|
||||
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
$pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
$manager = $this->getManager();
|
||||
|
||||
$collection = $this->repository->getEvents($piggyBank);
|
||||
@ -175,13 +175,13 @@ class PiggyBankController extends Controller
|
||||
*
|
||||
* @param PiggyBankRequest $request
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function store(PiggyBankRequest $request): JsonResponse
|
||||
{
|
||||
$piggyBank = $this->repository->store($request->getAll());
|
||||
$manager = $this->getManager();
|
||||
$manager = $this->getManager();
|
||||
|
||||
/** @var PiggyBankTransformer $transformer */
|
||||
$transformer = app(PiggyBankTransformer::class);
|
||||
|
@ -147,10 +147,10 @@ class PreferenceController extends Controller
|
||||
$newValue = explode(',', $data['data']);
|
||||
break;
|
||||
case 'listPageSize':
|
||||
$newValue = (int)$data['data'];
|
||||
$newValue = (int) $data['data'];
|
||||
break;
|
||||
case 'customFiscalYear':
|
||||
$newValue = 1 === (int)$data['data'];
|
||||
$newValue = 1 === (int) $data['data'];
|
||||
break;
|
||||
}
|
||||
$result = app('preferences')->set($preference->name, $newValue);
|
||||
|
@ -99,7 +99,7 @@ class RecurrenceController extends Controller
|
||||
$manager = $this->getManager();
|
||||
|
||||
// types to get, page size:
|
||||
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
$pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
|
||||
// get list of budgets. Count it and split it.
|
||||
$collection = $this->repository->getAll();
|
||||
@ -149,8 +149,8 @@ class RecurrenceController extends Controller
|
||||
*
|
||||
* @param RecurrenceStoreRequest $request
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function store(RecurrenceStoreRequest $request): JsonResponse
|
||||
{
|
||||
@ -178,7 +178,7 @@ class RecurrenceController extends Controller
|
||||
*/
|
||||
public function transactions(Request $request, Recurrence $recurrence): JsonResponse
|
||||
{
|
||||
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
$pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
$type = $request->get('type') ?? 'default';
|
||||
$this->parameters->set('type', $type);
|
||||
|
||||
@ -224,9 +224,9 @@ class RecurrenceController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
* @codeCoverageIgnore
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function trigger(): JsonResponse
|
||||
{
|
||||
|
@ -105,7 +105,7 @@ class RuleController extends Controller
|
||||
$manager = $this->getManager();
|
||||
|
||||
// types to get, page size:
|
||||
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
$pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
|
||||
// get list of budgets. Count it and split it.
|
||||
$collection = $this->ruleRepository->getAll();
|
||||
@ -214,12 +214,12 @@ class RuleController extends Controller
|
||||
* @param RuleTestRequest $request
|
||||
* @param Rule $rule
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function testRule(RuleTestRequest $request, Rule $rule): JsonResponse
|
||||
{
|
||||
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
$pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
$parameters = $request->getTestParameters();
|
||||
/** @var Rule $rule */
|
||||
Log::debug(sprintf('Now testing rule #%d, "%s"', $rule->id, $rule->title));
|
||||
|
@ -106,7 +106,7 @@ class RuleGroupController extends Controller
|
||||
{
|
||||
$manager = $this->getManager();
|
||||
// types to get, page size:
|
||||
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
$pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
|
||||
// get list of rule groups. Count it and split it.
|
||||
$collection = $this->ruleGroupRepository->get();
|
||||
@ -177,7 +177,7 @@ class RuleGroupController extends Controller
|
||||
{
|
||||
$manager = $this->getManager();
|
||||
// types to get, page size:
|
||||
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
$pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
|
||||
// get list of budgets. Count it and split it.
|
||||
$collection = $this->ruleGroupRepository->getRules($group);
|
||||
@ -246,13 +246,13 @@ class RuleGroupController extends Controller
|
||||
* @param RuleGroupTestRequest $request
|
||||
* @param RuleGroup $group
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function testGroup(RuleGroupTestRequest $request, RuleGroup $group): JsonResponse
|
||||
{
|
||||
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
$pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
Log::debug('Now in testGroup()');
|
||||
/** @var Collection $rules */
|
||||
$rules = $this->ruleGroupRepository->getActiveRules($group);
|
||||
@ -305,8 +305,8 @@ class RuleGroupController extends Controller
|
||||
* @param RuleGroupTriggerRequest $request
|
||||
* @param RuleGroup $group
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @throws Exception
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function triggerGroup(RuleGroupTriggerRequest $request, RuleGroup $group): JsonResponse
|
||||
{
|
||||
|
@ -79,7 +79,7 @@ class TransferController extends Controller
|
||||
}
|
||||
|
||||
// collector to return results.
|
||||
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
$pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
$manager = $this->getManager();
|
||||
/** @var User $admin */
|
||||
$admin = auth()->user();
|
||||
|
@ -96,8 +96,8 @@ class SummaryController extends Controller
|
||||
/**
|
||||
* @param DateRequest $request
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @throws Exception
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function basic(DateRequest $request): JsonResponse
|
||||
{
|
||||
@ -176,7 +176,7 @@ class SummaryController extends Controller
|
||||
$set = $collector->getExtractedJournals();
|
||||
/** @var array $transactionJournal */
|
||||
foreach ($set as $transactionJournal) {
|
||||
$currencyId = (int)$transactionJournal['currency_id'];
|
||||
$currencyId = (int) $transactionJournal['currency_id'];
|
||||
$incomes[$currencyId] = $incomes[$currencyId] ?? '0';
|
||||
$incomes[$currencyId] = bcadd($incomes[$currencyId], bcmul($transactionJournal['amount'], '-1'));
|
||||
$sums[$currencyId] = $sums[$currencyId] ?? '0';
|
||||
@ -198,7 +198,7 @@ class SummaryController extends Controller
|
||||
|
||||
/** @var array $transactionJournal */
|
||||
foreach ($set as $transactionJournal) {
|
||||
$currencyId = (int)$transactionJournal['currency_id'];
|
||||
$currencyId = (int) $transactionJournal['currency_id'];
|
||||
$expenses[$currencyId] = $expenses[$currencyId] ?? '0';
|
||||
$expenses[$currencyId] = bcadd($expenses[$currencyId], $transactionJournal['amount']);
|
||||
$sums[$currencyId] = $sums[$currencyId] ?? '0';
|
||||
@ -272,7 +272,7 @@ class SummaryController extends Controller
|
||||
$return = [];
|
||||
foreach ($paidAmount as $currencyId => $amount) {
|
||||
$amount = bcmul($amount, '-1');
|
||||
$currency = $this->currencyRepos->findNull((int)$currencyId);
|
||||
$currency = $this->currencyRepos->findNull((int) $currencyId);
|
||||
if (null === $currency) {
|
||||
continue;
|
||||
}
|
||||
@ -292,7 +292,7 @@ class SummaryController extends Controller
|
||||
|
||||
foreach ($unpaidAmount as $currencyId => $amount) {
|
||||
$amount = bcmul($amount, '-1');
|
||||
$currency = $this->currencyRepos->findNull((int)$currencyId);
|
||||
$currency = $this->currencyRepos->findNull((int) $currencyId);
|
||||
if (null === $currency) {
|
||||
continue;
|
||||
}
|
||||
@ -317,8 +317,8 @@ class SummaryController extends Controller
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return array
|
||||
* @throws Exception
|
||||
* @return array
|
||||
*/
|
||||
private function getLeftToSpendInfo(Carbon $start, Carbon $end): array
|
||||
{
|
||||
@ -337,7 +337,7 @@ class SummaryController extends Controller
|
||||
$days = $today->diffInDays($end) + 1;
|
||||
$perDay = '0';
|
||||
if (0 !== $days && bccomp($leftToSpend, '0') > -1) {
|
||||
$perDay = bcdiv($leftToSpend, (string)$days);
|
||||
$perDay = bcdiv($leftToSpend, (string) $days);
|
||||
}
|
||||
|
||||
$return[] = [
|
||||
@ -350,7 +350,7 @@ class SummaryController extends Controller
|
||||
'currency_decimal_places' => $row['currency_decimal_places'],
|
||||
'value_parsed' => app('amount')->formatFlat($row['currency_symbol'], $row['currency_decimal_places'], $leftToSpend, false),
|
||||
'local_icon' => 'money',
|
||||
'sub_title' => (string)trans(
|
||||
'sub_title' => (string) trans(
|
||||
'firefly.box_spend_per_day',
|
||||
['amount' => app('amount')->formatFlat(
|
||||
$row['currency_symbol'],
|
||||
@ -361,6 +361,7 @@ class SummaryController extends Controller
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
@ -25,8 +25,8 @@ namespace FireflyIII\Api\V1\Controllers;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Api\V1\Requests\DateRequest;
|
||||
use FireflyIII\Api\V1\Requests\TagUpdateRequest;
|
||||
use FireflyIII\Api\V1\Requests\TagStoreRequest;
|
||||
use FireflyIII\Api\V1\Requests\TagUpdateRequest;
|
||||
use FireflyIII\Helpers\Collector\GroupCollectorInterface;
|
||||
use FireflyIII\Models\Tag;
|
||||
use FireflyIII\Repositories\Tag\TagRepositoryInterface;
|
||||
@ -117,7 +117,7 @@ class TagController extends Controller
|
||||
{
|
||||
$manager = $this->getManager();
|
||||
// types to get, page size:
|
||||
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
$pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
|
||||
// get list of budgets. Count it and split it.
|
||||
$collection = $this->repository->get();
|
||||
@ -190,7 +190,7 @@ class TagController extends Controller
|
||||
*/
|
||||
public function transactions(Request $request, Tag $tag): JsonResponse
|
||||
{
|
||||
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
$pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
$type = $request->get('type') ?? 'default';
|
||||
$this->parameters->set('type', $type);
|
||||
|
||||
@ -236,7 +236,7 @@ class TagController extends Controller
|
||||
* Update a rule.
|
||||
*
|
||||
* @param TagUpdateRequest $request
|
||||
* @param Tag $tag
|
||||
* @param Tag $tag
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
@ -288,8 +288,8 @@ class TagController extends Controller
|
||||
];
|
||||
/** @var Tag $tag */
|
||||
foreach ($tags as $tag) {
|
||||
$earned = (float)$this->repository->earnedInPeriod($tag, $start, $end);
|
||||
$spent = (float)$this->repository->spentInPeriod($tag, $start, $end);
|
||||
$earned = (float) $this->repository->earnedInPeriod($tag, $start, $end);
|
||||
$spent = (float) $this->repository->spentInPeriod($tag, $start, $end);
|
||||
$size = ($spent * -1) + $earned;
|
||||
$min = $min ?? $size;
|
||||
if ($size > 0) {
|
||||
|
@ -152,7 +152,7 @@ class TransactionController extends Controller
|
||||
*/
|
||||
public function index(Request $request): JsonResponse
|
||||
{
|
||||
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
$pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
$type = $request->get('type') ?? 'default';
|
||||
$this->parameters->set('type', $type);
|
||||
|
||||
@ -302,7 +302,7 @@ class TransactionController extends Controller
|
||||
$response = [
|
||||
'message' => 'The given data was invalid.',
|
||||
'errors' => [
|
||||
'transactions.0.description' => [sprintf('Internal exception: %s', $e->getMessage())]
|
||||
'transactions.0.description' => [sprintf('Internal exception: %s', $e->getMessage())],
|
||||
],
|
||||
];
|
||||
|
||||
|
@ -105,7 +105,7 @@ class TransactionLinkController extends Controller
|
||||
$name = $request->get('name');
|
||||
|
||||
// types to get, page size:
|
||||
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
$pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
$linkType = $this->repository->findByName($name);
|
||||
|
||||
// get list of transaction links. Count it and split it.
|
||||
@ -155,8 +155,8 @@ class TransactionLinkController extends Controller
|
||||
*
|
||||
* @param TransactionLinkRequest $request
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function store(TransactionLinkRequest $request): JsonResponse
|
||||
{
|
||||
@ -186,8 +186,8 @@ class TransactionLinkController extends Controller
|
||||
* @param TransactionLinkRequest $request
|
||||
* @param TransactionJournalLink $journalLink
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function update(TransactionLinkRequest $request, TransactionJournalLink $journalLink): JsonResponse
|
||||
{
|
||||
|
@ -70,9 +70,9 @@ class UserController extends Controller
|
||||
*
|
||||
* @param User $user
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
* @codeCoverageIgnore
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function delete(User $user): JsonResponse
|
||||
{
|
||||
@ -95,7 +95,7 @@ class UserController extends Controller
|
||||
public function index(): JsonResponse
|
||||
{
|
||||
// user preferences
|
||||
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
$pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||
$manager = $this->getManager();
|
||||
|
||||
// build collection
|
||||
|
@ -126,7 +126,7 @@ class AccountStoreRequest extends Request
|
||||
'interest_period' => 'required_if:type,liability|in:daily,monthly,yearly',
|
||||
'notes' => 'min:0|max:65536',
|
||||
];
|
||||
$rules = Location::requestRules($rules);
|
||||
$rules = Location::requestRules($rules);
|
||||
|
||||
return $rules;
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ class AccountUpdateRequest extends Request
|
||||
$types = implode(',', array_keys(config('firefly.subTitlesByIdentifier')));
|
||||
$ccPaymentTypes = implode(',', array_keys(config('firefly.ccTypes')));
|
||||
|
||||
$rules = [
|
||||
$rules = [
|
||||
'name' => sprintf('min:1|uniqueAccountForUser:%d', $account->id),
|
||||
'type' => sprintf('in:%s', $types),
|
||||
'iban' => 'iban|nullable',
|
||||
|
@ -119,10 +119,10 @@ class BillRequest extends Request
|
||||
$validator->after(
|
||||
static function (Validator $validator) {
|
||||
$data = $validator->getData();
|
||||
$min = (float)($data['amount_min'] ?? 0);
|
||||
$max = (float)($data['amount_max'] ?? 0);
|
||||
$min = (float) ($data['amount_min'] ?? 0);
|
||||
$max = (float) ($data['amount_max'] ?? 0);
|
||||
if ($min > $max) {
|
||||
$validator->errors()->add('amount_min', (string)trans('validation.amount_min_over_max'));
|
||||
$validator->errors()->add('amount_min', (string) trans('validation.amount_min_over_max'));
|
||||
}
|
||||
}
|
||||
);
|
||||
|
@ -167,8 +167,8 @@ class RecurrenceStoreRequest extends Request
|
||||
$return[] = [
|
||||
'type' => $repetition['type'],
|
||||
'moment' => $repetition['moment'],
|
||||
'skip' => (int)$repetition['skip'],
|
||||
'weekend' => (int)$repetition['weekend'],
|
||||
'skip' => (int) $repetition['skip'],
|
||||
'weekend' => (int) $repetition['weekend'],
|
||||
];
|
||||
}
|
||||
|
||||
@ -194,25 +194,25 @@ class RecurrenceStoreRequest extends Request
|
||||
foreach ($transactions as $transaction) {
|
||||
$return[] = [
|
||||
'amount' => $transaction['amount'],
|
||||
'currency_id' => isset($transaction['currency_id']) ? (int)$transaction['currency_id'] : null,
|
||||
'currency_id' => isset($transaction['currency_id']) ? (int) $transaction['currency_id'] : null,
|
||||
'currency_code' => $transaction['currency_code'] ?? null,
|
||||
'foreign_amount' => $transaction['foreign_amount'] ?? null,
|
||||
'foreign_currency_id' => isset($transaction['foreign_currency_id']) ? (int)$transaction['foreign_currency_id'] : null,
|
||||
'foreign_currency_id' => isset($transaction['foreign_currency_id']) ? (int) $transaction['foreign_currency_id'] : null,
|
||||
'foreign_currency_code' => $transaction['foreign_currency_code'] ?? null,
|
||||
'source_id' => isset($transaction['source_id']) ? (int)$transaction['source_id'] : null,
|
||||
'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,
|
||||
'source_id' => isset($transaction['source_id']) ? (int) $transaction['source_id'] : null,
|
||||
'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,
|
||||
'description' => $transaction['description'],
|
||||
'type' => $this->string('type'),
|
||||
|
||||
// new and updated fields:
|
||||
'piggy_bank_id' => isset($transaction['piggy_bank_id']) ? (int)$transaction['piggy_bank_id'] : null,
|
||||
'piggy_bank_id' => isset($transaction['piggy_bank_id']) ? (int) $transaction['piggy_bank_id'] : null,
|
||||
'piggy_bank_name' => $transaction['piggy_bank_name'] ?? null,
|
||||
'tags' => $transaction['tags'] ?? [],
|
||||
'budget_id' => isset($transaction['budget_id']) ? (int)$transaction['budget_id'] : null,
|
||||
'budget_id' => isset($transaction['budget_id']) ? (int) $transaction['budget_id'] : null,
|
||||
'budget_name' => $transaction['budget_name'] ?? null,
|
||||
'category_id' => isset($transaction['category_id']) ? (int)$transaction['category_id'] : null,
|
||||
'category_id' => isset($transaction['category_id']) ? (int) $transaction['category_id'] : null,
|
||||
'category_name' => $transaction['category_name'] ?? null,
|
||||
];
|
||||
}
|
||||
|
@ -169,8 +169,8 @@ class RecurrenceUpdateRequest extends Request
|
||||
$return[] = [
|
||||
'type' => $repetition['type'],
|
||||
'moment' => $repetition['moment'],
|
||||
'skip' => (int)$repetition['skip'],
|
||||
'weekend' => (int)$repetition['weekend'],
|
||||
'skip' => (int) $repetition['skip'],
|
||||
'weekend' => (int) $repetition['weekend'],
|
||||
];
|
||||
}
|
||||
|
||||
@ -186,25 +186,25 @@ class RecurrenceUpdateRequest extends Request
|
||||
{
|
||||
return [
|
||||
'amount' => $transaction['amount'],
|
||||
'currency_id' => isset($transaction['currency_id']) ? (int)$transaction['currency_id'] : null,
|
||||
'currency_id' => isset($transaction['currency_id']) ? (int) $transaction['currency_id'] : null,
|
||||
'currency_code' => $transaction['currency_code'] ?? null,
|
||||
'foreign_amount' => $transaction['foreign_amount'] ?? null,
|
||||
'foreign_currency_id' => isset($transaction['foreign_currency_id']) ? (int)$transaction['foreign_currency_id'] : null,
|
||||
'foreign_currency_id' => isset($transaction['foreign_currency_id']) ? (int) $transaction['foreign_currency_id'] : null,
|
||||
'foreign_currency_code' => $transaction['foreign_currency_code'] ?? null,
|
||||
'source_id' => isset($transaction['source_id']) ? (int)$transaction['source_id'] : null,
|
||||
'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,
|
||||
'source_id' => isset($transaction['source_id']) ? (int) $transaction['source_id'] : null,
|
||||
'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,
|
||||
'description' => $transaction['description'],
|
||||
'type' => $this->string('type'),
|
||||
|
||||
// new and updated fields:
|
||||
'piggy_bank_id' => isset($transaction['piggy_bank_id']) ? (int)$transaction['piggy_bank_id'] : null,
|
||||
'piggy_bank_id' => isset($transaction['piggy_bank_id']) ? (int) $transaction['piggy_bank_id'] : null,
|
||||
'piggy_bank_name' => $transaction['piggy_bank_name'] ?? null,
|
||||
'tags' => $transaction['tags'] ?? [],
|
||||
'budget_id' => isset($transaction['budget_id']) ? (int)$transaction['budget_id'] : null,
|
||||
'budget_id' => isset($transaction['budget_id']) ? (int) $transaction['budget_id'] : null,
|
||||
'budget_name' => $transaction['budget_name'] ?? null,
|
||||
'category_id' => isset($transaction['category_id']) ? (int)$transaction['category_id'] : null,
|
||||
'category_id' => isset($transaction['category_id']) ? (int) $transaction['category_id'] : null,
|
||||
'category_name' => $transaction['category_name'] ?? null,
|
||||
];
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ class RuleGroupTestRequest extends Request
|
||||
*/
|
||||
private function getAccounts(): Collection
|
||||
{
|
||||
$accountList = '' === (string)$this->query('accounts') ? [] : explode(',', $this->query('accounts'));
|
||||
$accountList = '' === (string) $this->query('accounts') ? [] : explode(',', $this->query('accounts'));
|
||||
$accounts = new Collection;
|
||||
|
||||
/** @var AccountRepositoryInterface $accountRepository */
|
||||
@ -85,7 +85,7 @@ class RuleGroupTestRequest extends Request
|
||||
|
||||
foreach ($accountList as $accountId) {
|
||||
Log::debug(sprintf('Searching for asset account with id "%s"', $accountId));
|
||||
$account = $accountRepository->findNull((int)$accountId);
|
||||
$account = $accountRepository->findNull((int) $accountId);
|
||||
if ($this->validAccount($account)) {
|
||||
/** @noinspection NullPointerExceptionInspection */
|
||||
Log::debug(sprintf('Found account #%d ("%s") and its an asset account', $account->id, $account->name));
|
||||
@ -114,7 +114,7 @@ class RuleGroupTestRequest extends Request
|
||||
*/
|
||||
private function getPage(): int
|
||||
{
|
||||
return 0 === (int)$this->query('page') ? 1 : (int)$this->query('page');
|
||||
return 0 === (int) $this->query('page') ? 1 : (int) $this->query('page');
|
||||
|
||||
}
|
||||
|
||||
@ -123,7 +123,7 @@ class RuleGroupTestRequest extends Request
|
||||
*/
|
||||
private function getSearchLimit(): int
|
||||
{
|
||||
return 0 === (int)$this->query('search_limit') ? (int)config('firefly.test-triggers.limit') : (int)$this->query('search_limit');
|
||||
return 0 === (int) $this->query('search_limit') ? (int) config('firefly.test-triggers.limit') : (int) $this->query('search_limit');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -131,7 +131,7 @@ class RuleGroupTestRequest extends Request
|
||||
*/
|
||||
private function getTriggerLimit(): int
|
||||
{
|
||||
return 0 === (int)$this->query('triggered_limit') ? (int)config('firefly.test-triggers.range') : (int)$this->query('triggered_limit');
|
||||
return 0 === (int) $this->query('triggered_limit') ? (int) config('firefly.test-triggers.range') : (int) $this->query('triggered_limit');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -77,7 +77,7 @@ class RuleGroupTriggerRequest extends Request
|
||||
*/
|
||||
private function getAccounts(): Collection
|
||||
{
|
||||
$accountList = '' === (string)$this->query('accounts') ? [] : explode(',', $this->query('accounts'));
|
||||
$accountList = '' === (string) $this->query('accounts') ? [] : explode(',', $this->query('accounts'));
|
||||
$accounts = new Collection;
|
||||
|
||||
/** @var AccountRepositoryInterface $accountRepository */
|
||||
@ -85,7 +85,7 @@ class RuleGroupTriggerRequest extends Request
|
||||
|
||||
foreach ($accountList as $accountId) {
|
||||
Log::debug(sprintf('Searching for asset account with id "%s"', $accountId));
|
||||
$account = $accountRepository->findNull((int)$accountId);
|
||||
$account = $accountRepository->findNull((int) $accountId);
|
||||
if ($this->validAccount($account)) {
|
||||
/** @noinspection NullPointerExceptionInspection */
|
||||
Log::debug(sprintf('Found account #%d ("%s") and its an asset account', $account->id, $account->name));
|
||||
|
@ -141,7 +141,7 @@ class RuleStoreRequest extends Request
|
||||
$actions = $data['actions'] ?? [];
|
||||
// need at least one trigger
|
||||
if (0 === count($actions)) {
|
||||
$validator->errors()->add('title', (string)trans('validation.at_least_one_action'));
|
||||
$validator->errors()->add('title', (string) trans('validation.at_least_one_action'));
|
||||
}
|
||||
}
|
||||
|
||||
@ -156,7 +156,7 @@ class RuleStoreRequest extends Request
|
||||
$triggers = $data['triggers'] ?? [];
|
||||
// need at least one trigger
|
||||
if (0 === count($triggers)) {
|
||||
$validator->errors()->add('title', (string)trans('validation.at_least_one_trigger'));
|
||||
$validator->errors()->add('title', (string) trans('validation.at_least_one_trigger'));
|
||||
}
|
||||
}
|
||||
|
||||
@ -172,8 +172,8 @@ class RuleStoreRequest extends Request
|
||||
$return[] = [
|
||||
'type' => $action['type'],
|
||||
'value' => $action['value'],
|
||||
'active' => $this->convertBoolean((string)($action['active'] ?? 'false')),
|
||||
'stop_processing' => $this->convertBoolean((string)($action['stop_processing'] ?? 'false')),
|
||||
'active' => $this->convertBoolean((string) ($action['active'] ?? 'false')),
|
||||
'stop_processing' => $this->convertBoolean((string) ($action['stop_processing'] ?? 'false')),
|
||||
];
|
||||
}
|
||||
}
|
||||
@ -193,8 +193,8 @@ class RuleStoreRequest extends Request
|
||||
$return[] = [
|
||||
'type' => $trigger['type'],
|
||||
'value' => $trigger['value'],
|
||||
'active' => $this->convertBoolean((string)($trigger['active'] ?? 'false')),
|
||||
'stop_processing' => $this->convertBoolean((string)($trigger['stop_processing'] ?? 'false')),
|
||||
'active' => $this->convertBoolean((string) ($trigger['active'] ?? 'false')),
|
||||
'stop_processing' => $this->convertBoolean((string) ($trigger['stop_processing'] ?? 'false')),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ class RuleTestRequest extends Request
|
||||
*/
|
||||
private function getAccounts(): Collection
|
||||
{
|
||||
$accountList = '' === (string)$this->query('accounts') ? [] : explode(',', $this->query('accounts'));
|
||||
$accountList = '' === (string) $this->query('accounts') ? [] : explode(',', $this->query('accounts'));
|
||||
$accounts = new Collection;
|
||||
|
||||
/** @var AccountRepositoryInterface $accountRepository */
|
||||
@ -85,7 +85,7 @@ class RuleTestRequest extends Request
|
||||
|
||||
foreach ($accountList as $accountId) {
|
||||
Log::debug(sprintf('Searching for asset account with id "%s"', $accountId));
|
||||
$account = $accountRepository->findNull((int)$accountId);
|
||||
$account = $accountRepository->findNull((int) $accountId);
|
||||
if ($this->validAccount($account)) {
|
||||
/** @noinspection NullPointerExceptionInspection */
|
||||
Log::debug(sprintf('Found account #%d ("%s") and its an asset account', $account->id, $account->name));
|
||||
@ -114,7 +114,7 @@ class RuleTestRequest extends Request
|
||||
*/
|
||||
private function getPage(): int
|
||||
{
|
||||
return 0 === (int)$this->query('page') ? 1 : (int)$this->query('page');
|
||||
return 0 === (int) $this->query('page') ? 1 : (int) $this->query('page');
|
||||
|
||||
}
|
||||
|
||||
@ -123,7 +123,7 @@ class RuleTestRequest extends Request
|
||||
*/
|
||||
private function getSearchLimit(): int
|
||||
{
|
||||
return 0 === (int)$this->query('search_limit') ? (int)config('firefly.test-triggers.limit') : (int)$this->query('search_limit');
|
||||
return 0 === (int) $this->query('search_limit') ? (int) config('firefly.test-triggers.limit') : (int) $this->query('search_limit');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -131,7 +131,7 @@ class RuleTestRequest extends Request
|
||||
*/
|
||||
private function getTriggerLimit(): int
|
||||
{
|
||||
return 0 === (int)$this->query('triggered_limit') ? (int)config('firefly.test-triggers.range') : (int)$this->query('triggered_limit');
|
||||
return 0 === (int) $this->query('triggered_limit') ? (int) config('firefly.test-triggers.range') : (int) $this->query('triggered_limit');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -76,7 +76,7 @@ class RuleTriggerRequest extends Request
|
||||
*/
|
||||
private function getAccounts(): Collection
|
||||
{
|
||||
$accountList = '' === (string)$this->query('accounts') ? [] : explode(',', $this->query('accounts'));
|
||||
$accountList = '' === (string) $this->query('accounts') ? [] : explode(',', $this->query('accounts'));
|
||||
$accounts = new Collection;
|
||||
|
||||
/** @var AccountRepositoryInterface $accountRepository */
|
||||
@ -84,7 +84,7 @@ class RuleTriggerRequest extends Request
|
||||
|
||||
foreach ($accountList as $accountId) {
|
||||
Log::debug(sprintf('Searching for asset account with id "%s"', $accountId));
|
||||
$account = $accountRepository->findNull((int)$accountId);
|
||||
$account = $accountRepository->findNull((int) $accountId);
|
||||
if ($this->validAccount($account)) {
|
||||
/** @noinspection NullPointerExceptionInspection */
|
||||
Log::debug(sprintf('Found account #%d ("%s") and its an asset account', $account->id, $account->name));
|
||||
|
@ -142,7 +142,7 @@ class RuleUpdateRequest extends Request
|
||||
$actions = $data['actions'] ?? null;
|
||||
// need at least one action
|
||||
if (is_array($actions) && 0 === count($actions)) {
|
||||
$validator->errors()->add('title', (string)trans('validation.at_least_one_action'));
|
||||
$validator->errors()->add('title', (string) trans('validation.at_least_one_action'));
|
||||
}
|
||||
}
|
||||
|
||||
@ -157,7 +157,7 @@ class RuleUpdateRequest extends Request
|
||||
$triggers = $data['triggers'] ?? null;
|
||||
// need at least one trigger
|
||||
if (is_array($triggers) && 0 === count($triggers)) {
|
||||
$validator->errors()->add('title', (string)trans('validation.at_least_one_trigger'));
|
||||
$validator->errors()->add('title', (string) trans('validation.at_least_one_trigger'));
|
||||
}
|
||||
}
|
||||
|
||||
@ -176,8 +176,8 @@ class RuleUpdateRequest extends Request
|
||||
$return[] = [
|
||||
'type' => $action['type'],
|
||||
'value' => $action['value'],
|
||||
'active' => $this->convertBoolean((string)($action['active'] ?? 'false')),
|
||||
'stop_processing' => $this->convertBoolean((string)($action['stop_processing'] ?? 'false')),
|
||||
'active' => $this->convertBoolean((string) ($action['active'] ?? 'false')),
|
||||
'stop_processing' => $this->convertBoolean((string) ($action['stop_processing'] ?? 'false')),
|
||||
];
|
||||
}
|
||||
}
|
||||
@ -200,8 +200,8 @@ class RuleUpdateRequest extends Request
|
||||
$return[] = [
|
||||
'type' => $trigger['type'],
|
||||
'value' => $trigger['value'],
|
||||
'active' => $this->convertBoolean((string)($trigger['active'] ?? 'false')),
|
||||
'stop_processing' => $this->convertBoolean((string)($trigger['stop_processing'] ?? 'false')),
|
||||
'active' => $this->convertBoolean((string) ($trigger['active'] ?? 'false')),
|
||||
'stop_processing' => $this->convertBoolean((string) ($trigger['stop_processing'] ?? 'false')),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -110,8 +110,8 @@ class TransactionLinkRequest extends Request
|
||||
$journalRepos->setUser($user);
|
||||
|
||||
$data = $validator->getData();
|
||||
$inwardId = (int)($data['inward_id'] ?? 0);
|
||||
$outwardId = (int)($data['outward_id'] ?? 0);
|
||||
$inwardId = (int) ($data['inward_id'] ?? 0);
|
||||
$outwardId = (int) ($data['outward_id'] ?? 0);
|
||||
$inward = $journalRepos->findNull($inwardId);
|
||||
$outward = $journalRepos->findNull($outwardId);
|
||||
|
||||
|
@ -212,63 +212,63 @@ class TransactionStoreRequest extends Request
|
||||
$return[] = [
|
||||
'type' => $this->stringFromValue($object['type']),
|
||||
'date' => $this->dateFromValue($object['date']),
|
||||
'order' => $this->integerFromValue((string)$object['order']),
|
||||
'order' => $this->integerFromValue((string) $object['order']),
|
||||
|
||||
'currency_id' => $this->integerFromValue((string)$object['currency_id']),
|
||||
'currency_id' => $this->integerFromValue((string) $object['currency_id']),
|
||||
'currency_code' => $this->stringFromValue($object['currency_code']),
|
||||
|
||||
// foreign currency info:
|
||||
'foreign_currency_id' => $this->integerFromValue((string)$object['foreign_currency_id']),
|
||||
'foreign_currency_id' => $this->integerFromValue((string) $object['foreign_currency_id']),
|
||||
'foreign_currency_code' => $this->stringFromValue($object['foreign_currency_code']),
|
||||
|
||||
// amount and foreign amount. Cannot be 0.
|
||||
'amount' => $this->stringFromValue((string)$object['amount']),
|
||||
'foreign_amount' => $this->stringFromValue((string)$object['foreign_amount']),
|
||||
'amount' => $this->stringFromValue((string) $object['amount']),
|
||||
'foreign_amount' => $this->stringFromValue((string) $object['foreign_amount']),
|
||||
|
||||
// description.
|
||||
'description' => $this->stringFromValue($object['description']),
|
||||
|
||||
// source of transaction. If everything is null, assume cash account.
|
||||
'source_id' => $this->integerFromValue((string)$object['source_id']),
|
||||
'source_id' => $this->integerFromValue((string) $object['source_id']),
|
||||
'source_name' => $this->stringFromValue($object['source_name']),
|
||||
'source_iban' => $this->stringFromValue($object['source_iban']),
|
||||
'source_number' => $this->stringFromValue($object['source_number']),
|
||||
'source_bic' => $this->stringFromValue($object['source_bic']),
|
||||
|
||||
// destination of transaction. If everything is null, assume cash account.
|
||||
'destination_id' => $this->integerFromValue((string)$object['destination_id']),
|
||||
'destination_id' => $this->integerFromValue((string) $object['destination_id']),
|
||||
'destination_name' => $this->stringFromValue($object['destination_name']),
|
||||
'destination_iban' => $this->stringFromValue($object['destination_iban']),
|
||||
'destination_number' => $this->stringFromValue($object['destination_number']),
|
||||
'destination_bic' => $this->stringFromValue($object['destination_bic']),
|
||||
|
||||
// budget info
|
||||
'budget_id' => $this->integerFromValue((string)$object['budget_id']),
|
||||
'budget_id' => $this->integerFromValue((string) $object['budget_id']),
|
||||
'budget_name' => $this->stringFromValue($object['budget_name']),
|
||||
|
||||
// category info
|
||||
'category_id' => $this->integerFromValue((string)$object['category_id']),
|
||||
'category_id' => $this->integerFromValue((string) $object['category_id']),
|
||||
'category_name' => $this->stringFromValue($object['category_name']),
|
||||
|
||||
// journal bill reference. Optional. Will only work for withdrawals
|
||||
'bill_id' => $this->integerFromValue((string)$object['bill_id']),
|
||||
'bill_id' => $this->integerFromValue((string) $object['bill_id']),
|
||||
'bill_name' => $this->stringFromValue($object['bill_name']),
|
||||
|
||||
// piggy bank reference. Optional. Will only work for transfers
|
||||
'piggy_bank_id' => $this->integerFromValue((string)$object['piggy_bank_id']),
|
||||
'piggy_bank_id' => $this->integerFromValue((string) $object['piggy_bank_id']),
|
||||
'piggy_bank_name' => $this->stringFromValue($object['piggy_bank_name']),
|
||||
|
||||
// some other interesting properties
|
||||
'reconciled' => $this->convertBoolean((string)$object['reconciled']),
|
||||
'reconciled' => $this->convertBoolean((string) $object['reconciled']),
|
||||
'notes' => $this->nlStringFromValue($object['notes']),
|
||||
'tags' => $this->arrayFromValue($object['tags']),
|
||||
|
||||
// all custom fields:
|
||||
'internal_reference' => $this->stringFromValue((string)$object['internal_reference']),
|
||||
'external_id' => $this->stringFromValue((string)$object['external_id']),
|
||||
'internal_reference' => $this->stringFromValue((string) $object['internal_reference']),
|
||||
'external_id' => $this->stringFromValue((string) $object['external_id']),
|
||||
'original_source' => sprintf('ff3-v%s|api-v%s', config('firefly.version'), config('firefly.api_version')),
|
||||
'recurrence_id' => $this->integerFromValue($object['recurrence_id']),
|
||||
'bunq_payment_id' => $this->stringFromValue((string)$object['bunq_payment_id']),
|
||||
'bunq_payment_id' => $this->stringFromValue((string) $object['bunq_payment_id']),
|
||||
|
||||
'sepa_cc' => $this->stringFromValue($object['sepa_cc']),
|
||||
'sepa_ct_op' => $this->stringFromValue($object['sepa_ct_op']),
|
||||
|
@ -297,33 +297,33 @@ class TransactionUpdateRequest extends Request
|
||||
// for each field, add it to the array if a reference is present in the request:
|
||||
foreach ($this->integerFields as $fieldName) {
|
||||
if (array_key_exists($fieldName, $transaction)) {
|
||||
$current[$fieldName] = $this->integerFromValue((string)$transaction[$fieldName]);
|
||||
$current[$fieldName] = $this->integerFromValue((string) $transaction[$fieldName]);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($this->stringFields as $fieldName) {
|
||||
if (array_key_exists($fieldName, $transaction)) {
|
||||
$current[$fieldName] = $this->stringFromValue((string)$transaction[$fieldName]);
|
||||
$current[$fieldName] = $this->stringFromValue((string) $transaction[$fieldName]);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($this->textareaFields as $fieldName) {
|
||||
if (array_key_exists($fieldName, $transaction)) {
|
||||
$current[$fieldName] = $this->nlStringFromValue((string)$transaction[$fieldName]);
|
||||
$current[$fieldName] = $this->nlStringFromValue((string) $transaction[$fieldName]);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($this->dateFields as $fieldName) {
|
||||
Log::debug(sprintf('Now at date field %s', $fieldName));
|
||||
if (array_key_exists($fieldName, $transaction)) {
|
||||
$current[$fieldName] = $this->dateFromValue((string)$transaction[$fieldName]);
|
||||
Log::debug(sprintf('New value: "%s"', (string)$transaction[$fieldName]));
|
||||
$current[$fieldName] = $this->dateFromValue((string) $transaction[$fieldName]);
|
||||
Log::debug(sprintf('New value: "%s"', (string) $transaction[$fieldName]));
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($this->booleanFields as $fieldName) {
|
||||
if (array_key_exists($fieldName, $transaction)) {
|
||||
$current[$fieldName] = $this->convertBoolean((string)$transaction[$fieldName]);
|
||||
$current[$fieldName] = $this->convertBoolean((string) $transaction[$fieldName]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -85,7 +85,7 @@ class UserUpdateRequest extends Request
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
$user = $this->route()->parameter('user');
|
||||
$user = $this->route()->parameter('user');
|
||||
|
||||
return [
|
||||
'email' => sprintf('email|unique:users,email,%d', $user->id),
|
||||
|
Loading…
Reference in New Issue
Block a user