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