diff --git a/.ci/php-cs-fixer/composer.lock b/.ci/php-cs-fixer/composer.lock index 4c87af4adb..b783d43031 100644 --- a/.ci/php-cs-fixer/composer.lock +++ b/.ci/php-cs-fixer/composer.lock @@ -8,16 +8,16 @@ "packages": [ { "name": "composer/pcre", - "version": "3.1.0", + "version": "3.1.1", "source": { "type": "git", "url": "https://github.com/composer/pcre.git", - "reference": "4bff79ddd77851fe3cdd11616ed3f92841ba5bd2" + "reference": "00104306927c7a0919b4ced2aaa6782c1e61a3c9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/pcre/zipball/4bff79ddd77851fe3cdd11616ed3f92841ba5bd2", - "reference": "4bff79ddd77851fe3cdd11616ed3f92841ba5bd2", + "url": "https://api.github.com/repos/composer/pcre/zipball/00104306927c7a0919b4ced2aaa6782c1e61a3c9", + "reference": "00104306927c7a0919b4ced2aaa6782c1e61a3c9", "shasum": "" }, "require": { @@ -59,7 +59,7 @@ ], "support": { "issues": "https://github.com/composer/pcre/issues", - "source": "https://github.com/composer/pcre/tree/3.1.0" + "source": "https://github.com/composer/pcre/tree/3.1.1" }, "funding": [ { @@ -75,7 +75,7 @@ "type": "tidelift" } ], - "time": "2022-11-17T09:50:14+00:00" + "time": "2023-10-11T07:11:09+00:00" }, { "name": "composer/semver", @@ -226,16 +226,16 @@ }, { "name": "friendsofphp/php-cs-fixer", - "version": "v3.34.1", + "version": "v3.35.1", "source": { "type": "git", "url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git", - "reference": "98bf1b1068b4ceddbbc2a2b70b67a5e380add9e3" + "reference": "ec1ccc264994b6764882669973ca435cf05bab08" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/98bf1b1068b4ceddbbc2a2b70b67a5e380add9e3", - "reference": "98bf1b1068b4ceddbbc2a2b70b67a5e380add9e3", + "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/ec1ccc264994b6764882669973ca435cf05bab08", + "reference": "ec1ccc264994b6764882669973ca435cf05bab08", "shasum": "" }, "require": { @@ -268,8 +268,6 @@ "phpspec/prophecy": "^1.16", "phpspec/prophecy-phpunit": "^2.0", "phpunit/phpunit": "^9.5", - "phpunitgoodpractices/polyfill": "^1.6", - "phpunitgoodpractices/traits": "^1.9.2", "symfony/phpunit-bridge": "^6.2.3", "symfony/yaml": "^5.4 || ^6.0" }, @@ -309,7 +307,7 @@ ], "support": { "issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues", - "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.34.1" + "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.35.1" }, "funding": [ { @@ -317,7 +315,7 @@ "type": "github" } ], - "time": "2023-10-03T23:51:05+00:00" + "time": "2023-10-12T13:47:26+00:00" }, { "name": "psr/container", diff --git a/app/Api/V1/Controllers/Autocomplete/AccountController.php b/app/Api/V1/Controllers/Autocomplete/AccountController.php index 25cee01da6..ecbfba6e61 100644 --- a/app/Api/V1/Controllers/Autocomplete/AccountController.php +++ b/app/Api/V1/Controllers/Autocomplete/AccountController.php @@ -82,7 +82,8 @@ class AccountController extends Controller $date = $data['date'] ?? today(config('app.timezone')); $return = []; - $result = $this->repository->searchAccount((string)$query, $types, $data['limit']); + + $result = $this->repository->searchAccount((string)$query, $types, $this->parameters->get('limit')); // TODO this code is duplicated in the V2 Autocomplete controller, which means this code is due to be deprecated. $defaultCurrency = app('amount')->getDefaultCurrency(); diff --git a/app/Api/V1/Controllers/Autocomplete/BillController.php b/app/Api/V1/Controllers/Autocomplete/BillController.php index 88656746d8..542fd4a25f 100644 --- a/app/Api/V1/Controllers/Autocomplete/BillController.php +++ b/app/Api/V1/Controllers/Autocomplete/BillController.php @@ -58,7 +58,6 @@ class BillController extends Controller /** * Documentation for this endpoint is at: * https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/autocomplete/getBillsAC - * TODO expand API to add active field. * * @param AutocompleteRequest $request * @@ -67,7 +66,7 @@ class BillController extends Controller public function bills(AutocompleteRequest $request): JsonResponse { $data = $request->getData(); - $result = $this->repository->searchBill($data['query'], $data['limit']); + $result = $this->repository->searchBill($data['query'], $this->parameters->get('limit')); $filtered = $result->map( static function (Bill $item) { return [ diff --git a/app/Api/V1/Controllers/Autocomplete/BudgetController.php b/app/Api/V1/Controllers/Autocomplete/BudgetController.php index 61bb6a82b9..f3334df101 100644 --- a/app/Api/V1/Controllers/Autocomplete/BudgetController.php +++ b/app/Api/V1/Controllers/Autocomplete/BudgetController.php @@ -66,7 +66,7 @@ class BudgetController extends Controller public function budgets(AutocompleteRequest $request): JsonResponse { $data = $request->getData(); - $result = $this->repository->searchBudget($data['query'], $data['limit']); + $result = $this->repository->searchBudget($data['query'], $this->parameters->get('limit')); $filtered = $result->map( static function (Budget $item) { return [ diff --git a/app/Api/V1/Controllers/Autocomplete/CategoryController.php b/app/Api/V1/Controllers/Autocomplete/CategoryController.php index 1abd086dac..a35b7e11a6 100644 --- a/app/Api/V1/Controllers/Autocomplete/CategoryController.php +++ b/app/Api/V1/Controllers/Autocomplete/CategoryController.php @@ -66,7 +66,7 @@ class CategoryController extends Controller public function categories(AutocompleteRequest $request): JsonResponse { $data = $request->getData(); - $result = $this->repository->searchCategory($data['query'], $data['limit']); + $result = $this->repository->searchCategory($data['query'], $this->parameters->get('limit')); $filtered = $result->map( static function (Category $item) { return [ diff --git a/app/Api/V1/Controllers/Autocomplete/CurrencyController.php b/app/Api/V1/Controllers/Autocomplete/CurrencyController.php index e46a477034..2250b32f33 100644 --- a/app/Api/V1/Controllers/Autocomplete/CurrencyController.php +++ b/app/Api/V1/Controllers/Autocomplete/CurrencyController.php @@ -66,7 +66,7 @@ class CurrencyController extends Controller public function currencies(AutocompleteRequest $request): JsonResponse { $data = $request->getData(); - $collection = $this->repository->searchCurrency($data['query'], $data['limit']); + $collection = $this->repository->searchCurrency($data['query'], $this->parameters->get('limit')); $result = []; /** @var TransactionCurrency $currency */ @@ -95,7 +95,7 @@ class CurrencyController extends Controller public function currenciesWithCode(AutocompleteRequest $request): JsonResponse { $data = $request->getData(); - $collection = $this->repository->searchCurrency($data['query'], $data['limit']); + $collection = $this->repository->searchCurrency($data['query'], $this->parameters->get('limit')); $result = []; /** @var TransactionCurrency $currency */ diff --git a/app/Api/V1/Controllers/Autocomplete/ObjectGroupController.php b/app/Api/V1/Controllers/Autocomplete/ObjectGroupController.php index 6ad068c28d..67cd318e38 100644 --- a/app/Api/V1/Controllers/Autocomplete/ObjectGroupController.php +++ b/app/Api/V1/Controllers/Autocomplete/ObjectGroupController.php @@ -67,7 +67,7 @@ class ObjectGroupController extends Controller { $data = $request->getData(); $return = []; - $result = $this->repository->search($data['query'], $data['limit']); + $result = $this->repository->search($data['query'], $this->parameters->get('limit')); /** @var ObjectGroup $objectGroup */ foreach ($result as $objectGroup) { diff --git a/app/Api/V1/Controllers/Autocomplete/PiggyBankController.php b/app/Api/V1/Controllers/Autocomplete/PiggyBankController.php index 8bcbc216c8..74ac1c0498 100644 --- a/app/Api/V1/Controllers/Autocomplete/PiggyBankController.php +++ b/app/Api/V1/Controllers/Autocomplete/PiggyBankController.php @@ -70,7 +70,7 @@ class PiggyBankController extends Controller public function piggyBanks(AutocompleteRequest $request): JsonResponse { $data = $request->getData(); - $piggies = $this->piggyRepository->searchPiggyBank($data['query'], $data['limit']); + $piggies = $this->piggyRepository->searchPiggyBank($data['query'], $this->parameters->get('limit')); $defaultCurrency = app('amount')->getDefaultCurrency(); $response = []; @@ -105,7 +105,7 @@ class PiggyBankController extends Controller public function piggyBanksWithBalance(AutocompleteRequest $request): JsonResponse { $data = $request->getData(); - $piggies = $this->piggyRepository->searchPiggyBank($data['query'], $data['limit']); + $piggies = $this->piggyRepository->searchPiggyBank($data['query'], $this->parameters->get('limit')); $defaultCurrency = app('amount')->getDefaultCurrency(); $response = []; /** @var PiggyBank $piggy */ diff --git a/app/Api/V1/Controllers/Autocomplete/RecurrenceController.php b/app/Api/V1/Controllers/Autocomplete/RecurrenceController.php index a209d6934c..74c1262ae4 100644 --- a/app/Api/V1/Controllers/Autocomplete/RecurrenceController.php +++ b/app/Api/V1/Controllers/Autocomplete/RecurrenceController.php @@ -64,7 +64,7 @@ class RecurrenceController extends Controller public function recurring(AutocompleteRequest $request): JsonResponse { $data = $request->getData(); - $recurrences = $this->repository->searchRecurrence($data['query'], $data['limit']); + $recurrences = $this->repository->searchRecurrence($data['query'], $this->parameters->get('limit')); $response = []; /** @var Recurrence $recurrence */ diff --git a/app/Api/V1/Controllers/Autocomplete/RuleController.php b/app/Api/V1/Controllers/Autocomplete/RuleController.php index 2cc3acd57b..0f45c8fd44 100644 --- a/app/Api/V1/Controllers/Autocomplete/RuleController.php +++ b/app/Api/V1/Controllers/Autocomplete/RuleController.php @@ -63,7 +63,7 @@ class RuleController extends Controller public function rules(AutocompleteRequest $request): JsonResponse { $data = $request->getData(); - $rules = $this->repository->searchRule($data['query'], $data['limit']); + $rules = $this->repository->searchRule($data['query'], $this->parameters->get('limit')); $response = []; /** @var Rule $rule */ diff --git a/app/Api/V1/Controllers/Autocomplete/RuleGroupController.php b/app/Api/V1/Controllers/Autocomplete/RuleGroupController.php index f5e69f793a..c3c1af2503 100644 --- a/app/Api/V1/Controllers/Autocomplete/RuleGroupController.php +++ b/app/Api/V1/Controllers/Autocomplete/RuleGroupController.php @@ -63,7 +63,7 @@ class RuleGroupController extends Controller public function ruleGroups(AutocompleteRequest $request): JsonResponse { $data = $request->getData(); - $groups = $this->repository->searchRuleGroup($data['query'], $data['limit']); + $groups = $this->repository->searchRuleGroup($data['query'], $this->parameters->get('limit')); $response = []; /** @var RuleGroup $group */ diff --git a/app/Api/V1/Controllers/Autocomplete/TagController.php b/app/Api/V1/Controllers/Autocomplete/TagController.php index 8b2a442de8..c0bf758e75 100644 --- a/app/Api/V1/Controllers/Autocomplete/TagController.php +++ b/app/Api/V1/Controllers/Autocomplete/TagController.php @@ -67,7 +67,7 @@ class TagController extends Controller { $data = $request->getData(); - $result = $this->repository->searchTags($data['query'], $data['limit']); + $result = $this->repository->searchTags($data['query'], $this->parameters->get('limit')); $array = []; /** @var Tag $tag */ foreach ($result as $tag) { diff --git a/app/Api/V1/Controllers/Autocomplete/TransactionController.php b/app/Api/V1/Controllers/Autocomplete/TransactionController.php index 5d5cb94daf..a8033ed624 100644 --- a/app/Api/V1/Controllers/Autocomplete/TransactionController.php +++ b/app/Api/V1/Controllers/Autocomplete/TransactionController.php @@ -71,7 +71,7 @@ class TransactionController extends Controller public function transactions(AutocompleteRequest $request): JsonResponse { $data = $request->getData(); - $result = $this->repository->searchJournalDescriptions($data['query'], $data['limit']); + $result = $this->repository->searchJournalDescriptions($data['query'], $this->parameters->get('limit')); // limit and unique $filtered = $result->unique('description'); @@ -113,7 +113,7 @@ class TransactionController extends Controller } } if (!is_numeric($data['query'])) { - $result = $this->repository->searchJournalDescriptions($data['query'], $data['limit']); + $result = $this->repository->searchJournalDescriptions($data['query'], $this->parameters->get('limit')); } // limit and unique diff --git a/app/Api/V1/Controllers/Autocomplete/TransactionTypeController.php b/app/Api/V1/Controllers/Autocomplete/TransactionTypeController.php index 88d636c905..66f1f23a8f 100644 --- a/app/Api/V1/Controllers/Autocomplete/TransactionTypeController.php +++ b/app/Api/V1/Controllers/Autocomplete/TransactionTypeController.php @@ -62,7 +62,7 @@ class TransactionTypeController extends Controller public function transactionTypes(AutocompleteRequest $request): JsonResponse { $data = $request->getData(); - $types = $this->repository->searchTypes($data['query'], $data['limit']); + $types = $this->repository->searchTypes($data['query'], $this->parameters->get('limit')); $array = []; /** @var TransactionType $type */ diff --git a/app/Api/V1/Controllers/Summary/BasicController.php b/app/Api/V1/Controllers/Summary/BasicController.php index 7e4e5bdb8c..28ec3b227a 100644 --- a/app/Api/V1/Controllers/Summary/BasicController.php +++ b/app/Api/V1/Controllers/Summary/BasicController.php @@ -236,6 +236,7 @@ class BasicController extends Controller */ private function getBillInformation(Carbon $start, Carbon $end): array { + app('log')->debug(sprintf('Now in getBillInformation("%s", "%s")', $start->format('Y-m-d'), $end->format('Y-m-d-'))); /* * Since both this method and the chart use the exact same data, we can suffice * with calling the one method in the bill repository that will get this amount. @@ -281,7 +282,7 @@ class BasicController extends Controller 'sub_title' => '', ]; } - + app('log')->debug(sprintf('Done with getBillInformation("%s", "%s")', $start->format('Y-m-d'), $end->format('Y-m-d-'))); return $return; } diff --git a/app/Api/V1/Requests/Autocomplete/AutocompleteRequest.php b/app/Api/V1/Requests/Autocomplete/AutocompleteRequest.php index 5d071fe7b6..875d1f7335 100644 --- a/app/Api/V1/Requests/Autocomplete/AutocompleteRequest.php +++ b/app/Api/V1/Requests/Autocomplete/AutocompleteRequest.php @@ -46,8 +46,6 @@ class AutocompleteRequest extends FormRequest if ('' !== $types) { $array = explode(',', $types); } - $limit = $this->convertInteger('limit'); - $limit = 0 === $limit ? 10 : $limit; // remove 'initial balance' from allowed types. its internal $array = array_diff($array, [AccountType::INITIAL_BALANCE, AccountType::RECONCILIATION]); @@ -56,7 +54,6 @@ class AutocompleteRequest extends FormRequest 'types' => $array, 'query' => $this->convertString('query'), 'date' => $this->getCarbonDate('date'), - 'limit' => $limit, ]; } @@ -66,7 +63,6 @@ class AutocompleteRequest extends FormRequest public function rules(): array { return [ - 'limit' => 'min:0|max:1337', ]; } } diff --git a/app/Providers/JournalServiceProvider.php b/app/Providers/JournalServiceProvider.php index ee81ca6102..fa8dd0c960 100644 --- a/app/Providers/JournalServiceProvider.php +++ b/app/Providers/JournalServiceProvider.php @@ -46,7 +46,9 @@ class JournalServiceProvider extends ServiceProvider /** * Bootstrap the application services. */ - public function boot(): void {} + public function boot(): void + { + } /** * Register the application services. diff --git a/app/Repositories/Bill/BillRepository.php b/app/Repositories/Bill/BillRepository.php index e1ebd24fe4..cc3f91b14c 100644 --- a/app/Repositories/Bill/BillRepository.php +++ b/app/Repositories/Bill/BillRepository.php @@ -665,13 +665,17 @@ class BillRepository implements BillRepositoryInterface */ public function sumUnpaidInRange(Carbon $start, Carbon $end): array { + app('log')->debug(sprintf('Now in sumUnpaidInRange("%s", "%s")', $start->format('Y-m-d'), $end->format('Y-m-d'))); $bills = $this->getActiveBills(); $return = []; /** @var Bill $bill */ foreach ($bills as $bill) { + app('log')->debug(sprintf('Processing bill #%d ("%s")', $bill->id, $bill->name)); $dates = $this->getPayDatesInRange($bill, $start, $end); $count = $bill->transactionJournals()->after($start)->before($end)->count(); $total = $dates->count() - $count; + app('log')->debug(sprintf('Pay dates: %d, count: %d, left: %d', $dates->count(), $count, $total)); + app('log')->debug('dates', $dates->toArray()); if ($total > 0) { $currency = $bill->transactionCurrency; diff --git a/app/Support/Steam.php b/app/Support/Steam.php index 9f2c490660..335f246abf 100644 --- a/app/Support/Steam.php +++ b/app/Support/Steam.php @@ -323,15 +323,15 @@ class Steam $balances[$format] = $currentBalance; app('log')->debug(sprintf( - '%s: transaction in %s(!). Conversion rate is %s. %s %s = %s %s', - $format, - $currency->code, - $rate, - $currency->code, - $transaction['amount'], - $native->code, - $convertedAmount - )); + '%s: transaction in %s(!). Conversion rate is %s. %s %s = %s %s', + $format, + $currency->code, + $rate, + $currency->code, + $transaction['amount'], + $native->code, + $convertedAmount + )); }