Various PSR12 code cleanup

This commit is contained in:
James Cole
2022-12-29 19:41:57 +01:00
parent 0022009dd5
commit dbf3e76ecc
340 changed files with 4079 additions and 3816 deletions

View File

@@ -19,7 +19,20 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
$finder = PhpCsFixer\Finder::create(); $current = __DIR__;
$paths = [
$current . '/../../app',
$current . '/../../config',
$current . '/../../database',
$current . '/../../routes',
$current . '/../../tests',
$current . '/../../resources/lang',
];
$finder = PhpCsFixer\Finder::create()
->in($paths);
$config = new PhpCsFixer\Config(); $config = new PhpCsFixer\Config();
return $config->setRules([ return $config->setRules([

View File

@@ -31,7 +31,7 @@ SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
# clean up php code # clean up php code
cd $SCRIPT_DIR/php-cs-fixer cd $SCRIPT_DIR/php-cs-fixer
composer update composer update
./vendor/bin/php-cs-fixer fix $SCRIPT_DIR/../app --config $SCRIPT_DIR/php-cs-fixer/.php-cs-fixer.php --allow-risky=yes ./vendor/bin/php-cs-fixer fix --config $SCRIPT_DIR/php-cs-fixer/.php-cs-fixer.php --allow-risky=yes
cd $SCRIPT_DIR/.. cd $SCRIPT_DIR/..
exit 0 exit 0

View File

@@ -33,7 +33,6 @@ use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController; use Illuminate\Routing\Controller as BaseController;
use League\Fractal\Manager; use League\Fractal\Manager;
use League\Fractal\Serializer\JsonApiSerializer; use League\Fractal\Serializer\JsonApiSerializer;
use Log;
use Psr\Container\ContainerExceptionInterface; use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface; use Psr\Container\NotFoundExceptionInterface;
use Symfony\Component\HttpFoundation\ParameterBag; use Symfony\Component\HttpFoundation\ParameterBag;

View File

@@ -97,24 +97,32 @@ class DestroyController extends Controller
case 'accounts': case 'accounts':
$this->destroyAccounts( $this->destroyAccounts(
[ [
AccountType::ASSET, AccountType::DEFAULT, AccountType::ASSET,
AccountType::BENEFICIARY, AccountType::EXPENSE, AccountType::DEFAULT,
AccountType::REVENUE, AccountType::INITIAL_BALANCE, AccountType::BENEFICIARY,
AccountType::DEBT, AccountType::LOAN, AccountType::MORTGAGE, AccountType::CREDITCARD, AccountType::EXPENSE,
AccountType::REVENUE,
AccountType::INITIAL_BALANCE,
AccountType::DEBT,
AccountType::LOAN,
AccountType::MORTGAGE,
AccountType::CREDITCARD,
] ]
); );
break; break;
case 'asset_accounts': case 'asset_accounts':
$this->destroyAccounts( $this->destroyAccounts(
[ [
AccountType::ASSET, AccountType::DEFAULT, AccountType::ASSET,
AccountType::DEFAULT,
] ]
); );
break; break;
case 'expense_accounts': case 'expense_accounts':
$this->destroyAccounts( $this->destroyAccounts(
[ [
AccountType::BENEFICIARY, AccountType::EXPENSE, AccountType::BENEFICIARY,
AccountType::EXPENSE,
] ]
); );
break; break;
@@ -128,7 +136,10 @@ class DestroyController extends Controller
case 'liabilities': case 'liabilities':
$this->destroyAccounts( $this->destroyAccounts(
[ [
AccountType::DEBT, AccountType::LOAN, AccountType::MORTGAGE, AccountType::CREDITCARD, AccountType::DEBT,
AccountType::LOAN,
AccountType::MORTGAGE,
AccountType::CREDITCARD,
] ]
); );
break; break;

View File

@@ -28,7 +28,6 @@ use FireflyIII\Models\Account;
use FireflyIII\Models\Bill; use FireflyIII\Models\Bill;
use FireflyIII\Models\Budget; use FireflyIII\Models\Budget;
use FireflyIII\Models\Category; use FireflyIII\Models\Category;
use FireflyIII\Models\ObjectGroup;
use FireflyIII\Models\PiggyBank; use FireflyIII\Models\PiggyBank;
use FireflyIII\Models\Recurrence; use FireflyIII\Models\Recurrence;
use FireflyIII\Models\Rule; use FireflyIII\Models\Rule;

View File

@@ -24,7 +24,6 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Controllers\Models\Transaction; namespace FireflyIII\Api\V1\Controllers\Models\Transaction;
use FireflyIII\Api\V1\Controllers\Controller; use FireflyIII\Api\V1\Controllers\Controller;
use FireflyIII\Events\DestroyedTransactionGroup;
use FireflyIII\Events\UpdatedAccount; use FireflyIII\Events\UpdatedAccount;
use FireflyIII\Models\Account; use FireflyIII\Models\Account;
use FireflyIII\Models\Transaction; use FireflyIII\Models\Transaction;
@@ -41,8 +40,8 @@ use Log;
*/ */
class DestroyController extends Controller class DestroyController extends Controller
{ {
private JournalRepositoryInterface $repository;
private TransactionGroupRepository $groupRepository; private TransactionGroupRepository $groupRepository;
private JournalRepositoryInterface $repository;
/** /**
* TransactionController constructor. * TransactionController constructor.

View File

@@ -101,36 +101,6 @@ class UpdateController extends Controller
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE); return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
} }
/**
* This endpoint is documented at:
* https://api-docs.firefly-iii.org/#/currencies/enableCurrency
*
* Enable a currency.
*
* @param TransactionCurrency $currency
*
* @return JsonResponse
* @throws FireflyException
* @throws JsonException
* @codeCoverageIgnore
*/
public function enable(TransactionCurrency $currency): JsonResponse
{
$this->repository->enable($currency);
$manager = $this->getManager();
$defaultCurrency = app('amount')->getDefaultCurrencyByUser(auth()->user());
$this->parameters->set('defaultCurrency', $defaultCurrency);
/** @var CurrencyTransformer $transformer */
$transformer = app(CurrencyTransformer::class);
$transformer->setParameters($this->parameters);
$resource = new Item($currency, $transformer, 'currencies');
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
}
/** /**
* This endpoint is documented at: * This endpoint is documented at:
* https://api-docs.firefly-iii.org/#/currencies/defaultCurrency * https://api-docs.firefly-iii.org/#/currencies/defaultCurrency
@@ -163,6 +133,36 @@ class UpdateController extends Controller
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE); return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
} }
/**
* This endpoint is documented at:
* https://api-docs.firefly-iii.org/#/currencies/enableCurrency
*
* Enable a currency.
*
* @param TransactionCurrency $currency
*
* @return JsonResponse
* @throws FireflyException
* @throws JsonException
* @codeCoverageIgnore
*/
public function enable(TransactionCurrency $currency): JsonResponse
{
$this->repository->enable($currency);
$manager = $this->getManager();
$defaultCurrency = app('amount')->getDefaultCurrencyByUser(auth()->user());
$this->parameters->set('defaultCurrency', $defaultCurrency);
/** @var CurrencyTransformer $transformer */
$transformer = app(CurrencyTransformer::class);
$transformer->setParameters($this->parameters);
$resource = new Item($currency, $transformer, 'currencies');
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
}
/** /**
* This endpoint is documented at: * This endpoint is documented at:
* https://api-docs.firefly-iii.org/#/currencies/updateCurrency * https://api-docs.firefly-iii.org/#/currencies/updateCurrency

View File

@@ -325,12 +325,14 @@ class BasicController extends Controller
'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'],
$row['currency_decimal_places'], $row['currency_decimal_places'],
$perDay, $perDay,
false false
)] ),
]
), ),
]; ];
} }

View File

@@ -1,4 +1,5 @@
<?php <?php
/** /**
* ApiDemoUser.php * ApiDemoUser.php
* Copyright (c) 2019 james@firefly-iii.org * Copyright (c) 2019 james@firefly-iii.org

View File

@@ -49,9 +49,9 @@ class UpdateRequest extends FormRequest
private array $arrayFields; private array $arrayFields;
private array $booleanFields; private array $booleanFields;
private array $dateFields; private array $dateFields;
private array $floatFields;
private array $integerFields; private array $integerFields;
private array $stringFields; private array $stringFields;
private array $floatFields;
private array $textareaFields; private array $textareaFields;
/** /**
@@ -283,6 +283,28 @@ class UpdateRequest extends FormRequest
return $current; return $current;
} }
/**
* @param array $current
* @param array $transaction
* @return array
*/
private function getFloatData(array $current, array $transaction): array
{
foreach ($this->floatFields as $fieldName) {
if (array_key_exists($fieldName, $transaction)) {
$value = $transaction[$fieldName];
if (is_float($value)) {
$current[$fieldName] = sprintf('%.24f', $value);
}
if (!is_float($value)) {
$current[$fieldName] = (string)$value;
}
}
}
return $current;
}
/** /**
* The rules that the incoming request must be matched against. * The rules that the incoming request must be matched against.
* *
@@ -396,26 +418,4 @@ class UpdateRequest extends FormRequest
} }
); );
} }
/**
* @param array $current
* @param array $transaction
* @return array
*/
private function getFloatData(array $current, array $transaction): array
{
foreach ($this->floatFields as $fieldName) {
if (array_key_exists($fieldName, $transaction)) {
$value = $transaction[$fieldName];
if (is_float($value)) {
$current[$fieldName] = sprintf('%.24f', $value);
}
if (!is_float($value)) {
$current[$fieldName] = (string) $value;
}
}
}
return $current;
}
} }

View File

@@ -24,7 +24,6 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Requests\Models\TransactionLinkType; namespace FireflyIII\Api\V1\Requests\Models\TransactionLinkType;
use FireflyIII\Models\LinkType; use FireflyIII\Models\LinkType;
use FireflyIII\Models\TransactionJournalLink;
use FireflyIII\Support\Request\ChecksLogin; use FireflyIII\Support\Request\ChecksLogin;
use FireflyIII\Support\Request\ConvertsDataTypes; use FireflyIII\Support\Request\ConvertsDataTypes;
use Illuminate\Foundation\Http\FormRequest; use Illuminate\Foundation\Http\FormRequest;

View File

@@ -62,51 +62,6 @@ class Controller extends BaseController
} }
} }
/**
* Returns a JSON API object and returns it.
*
* @param string $key
* @param Model $object
* @param AbstractTransformer $transformer
* @return array
*/
final protected function jsonApiObject(string $key, Model $object, AbstractTransformer $transformer): array
{
// create some objects:
$manager = new Manager();
$baseUrl = request()->getSchemeAndHttpHost() . '/api/v2';
$manager->setSerializer(new JsonApiSerializer($baseUrl));
$transformer->collectMetaData(new Collection([$object]));
$resource = new Item($object, $transformer, $key);
return $manager->createData($resource)->toArray();
}
/**
* @param string $key
* @param LengthAwarePaginator $paginator
* @param AbstractTransformer $transformer
* @return array
*/
final protected function jsonApiList(string $key, LengthAwarePaginator $paginator, AbstractTransformer $transformer): array
{
$manager = new Manager();
$baseUrl = request()->getSchemeAndHttpHost() . '/api/v2';
$manager->setSerializer(new JsonApiSerializer($baseUrl));
$objects = $paginator->getCollection();
// the transformer, at this point, needs to collect information that ALL items in the collection
// require, like meta data and stuff like that, and save it for later.
$transformer->collectMetaData($objects);
$resource = new FractalCollection($objects, $transformer, $key);
$resource->setPaginator(new IlluminatePaginatorAdapter($paginator));
return $manager->createData($resource)->toArray();
}
/** /**
* TODO duplicate from V1 controller * TODO duplicate from V1 controller
* Method to grab all parameters from the URL. * Method to grab all parameters from the URL.
@@ -161,4 +116,49 @@ class Controller extends BaseController
return $bag; return $bag;
} }
/**
* @param string $key
* @param LengthAwarePaginator $paginator
* @param AbstractTransformer $transformer
* @return array
*/
final protected function jsonApiList(string $key, LengthAwarePaginator $paginator, AbstractTransformer $transformer): array
{
$manager = new Manager();
$baseUrl = request()->getSchemeAndHttpHost().'/api/v2';
$manager->setSerializer(new JsonApiSerializer($baseUrl));
$objects = $paginator->getCollection();
// the transformer, at this point, needs to collect information that ALL items in the collection
// require, like meta data and stuff like that, and save it for later.
$transformer->collectMetaData($objects);
$resource = new FractalCollection($objects, $transformer, $key);
$resource->setPaginator(new IlluminatePaginatorAdapter($paginator));
return $manager->createData($resource)->toArray();
}
/**
* Returns a JSON API object and returns it.
*
* @param string $key
* @param Model $object
* @param AbstractTransformer $transformer
* @return array
*/
final protected function jsonApiObject(string $key, Model $object, AbstractTransformer $transformer): array
{
// create some objects:
$manager = new Manager();
$baseUrl = request()->getSchemeAndHttpHost().'/api/v2';
$manager->setSerializer(new JsonApiSerializer($baseUrl));
$transformer->collectMetaData(new Collection([$object]));
$resource = new Item($object, $transformer, $key);
return $manager->createData($resource)->toArray();
}
} }

View File

@@ -36,6 +36,7 @@ use Illuminate\Http\JsonResponse;
class SumController extends Controller class SumController extends Controller
{ {
use ConvertsExchangeRates; use ConvertsExchangeRates;
private BillRepositoryInterface $repository; private BillRepositoryInterface $repository;
/** /**
@@ -55,10 +56,10 @@ class SumController extends Controller
* @param DateRequest $request * @param DateRequest $request
* @return JsonResponse * @return JsonResponse
*/ */
public function unpaid(DateRequest $request): JsonResponse public function paid(DateRequest $request): JsonResponse
{ {
$dates = $request->getAll(); $dates = $request->getAll();
$result = $this->repository->sumUnpaidInRange($dates['start'], $dates['end']); $result = $this->repository->sumPaidInRange($dates['start'], $dates['end']);
$converted = $this->cerSum($result); $converted = $this->cerSum($result);
// convert to JSON response: // convert to JSON response:
@@ -69,10 +70,10 @@ class SumController extends Controller
* @param DateRequest $request * @param DateRequest $request
* @return JsonResponse * @return JsonResponse
*/ */
public function paid(DateRequest $request): JsonResponse public function unpaid(DateRequest $request): JsonResponse
{ {
$dates = $request->getAll(); $dates = $request->getAll();
$result = $this->repository->sumPaidInRange($dates['start'], $dates['end']); $result = $this->repository->sumUnpaidInRange($dates['start'], $dates['end']);
$converted = $this->cerSum($result); $converted = $this->cerSum($result);
// convert to JSON response: // convert to JSON response:

View File

@@ -30,7 +30,6 @@ use FireflyIII\Transformers\V2\BudgetTransformer;
use Illuminate\Http\JsonResponse; use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Pagination\LengthAwarePaginator; use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\Support\Collection;
class ListController extends Controller class ListController extends Controller
{ {

View File

@@ -29,7 +29,6 @@ use FireflyIII\Api\V2\Request\Transaction\ListRequest;
use FireflyIII\Helpers\Collector\GroupCollectorInterface; use FireflyIII\Helpers\Collector\GroupCollectorInterface;
use FireflyIII\Models\Account; use FireflyIII\Models\Account;
use FireflyIII\Support\Http\Api\TransactionFilter; use FireflyIII\Support\Http\Api\TransactionFilter;
use FireflyIII\Transformers\V2\PreferenceTransformer;
use FireflyIII\Transformers\V2\TransactionGroupTransformer; use FireflyIII\Transformers\V2\TransactionGroupTransformer;
use Illuminate\Http\JsonResponse; use Illuminate\Http\JsonResponse;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;

View File

@@ -24,7 +24,6 @@ declare(strict_types=1);
namespace FireflyIII\Console\Commands\Correction; namespace FireflyIII\Console\Commands\Correction;
use DB; use DB;
use Exception;
use FireflyIII\Models\Transaction; use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionJournal; use FireflyIII\Models\TransactionJournal;
use Illuminate\Console\Command; use Illuminate\Console\Command;

View File

@@ -23,7 +23,6 @@ declare(strict_types=1);
namespace FireflyIII\Console\Commands\Correction; namespace FireflyIII\Console\Commands\Correction;
use Exception;
use FireflyIII\Models\Transaction; use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionJournal; use FireflyIII\Models\TransactionJournal;
use Illuminate\Console\Command; use Illuminate\Console\Command;

View File

@@ -23,7 +23,6 @@ declare(strict_types=1);
namespace FireflyIII\Console\Commands\Upgrade; namespace FireflyIII\Console\Commands\Upgrade;
use Exception;
use FireflyIII\Exceptions\FireflyException; use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\Note; use FireflyIII\Models\Note;
use FireflyIII\Models\TransactionJournalMeta; use FireflyIII\Models\TransactionJournalMeta;

View File

@@ -1,4 +1,5 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
/* /*
* ChangedPiggyBankAmount.php * ChangedPiggyBankAmount.php
@@ -35,10 +36,10 @@ class ChangedPiggyBankAmount extends Event
{ {
use SerializesModels; use SerializesModels;
public PiggyBank $piggyBank;
public ?TransactionJournal $transactionJournal;
public ?TransactionGroup $transactionGroup;
public string $amount; public string $amount;
public PiggyBank $piggyBank;
public ?TransactionGroup $transactionGroup;
public ?TransactionJournal $transactionJournal;
/** /**
* Create a new event instance. * Create a new event instance.

View File

@@ -34,11 +34,11 @@ class TriggeredAuditLog extends Event
{ {
use SerializesModels; use SerializesModels;
public Model $changer;
public Model $auditable;
public string $field;
public mixed $before;
public mixed $after; public mixed $after;
public Model $auditable;
public mixed $before;
public Model $changer;
public string $field;
/** /**
* Create a new event instance. * Create a new event instance.

View File

@@ -38,8 +38,8 @@ use Illuminate\Support\Arr;
use Illuminate\Validation\ValidationException as LaravelValidationException; use Illuminate\Validation\ValidationException as LaravelValidationException;
use Laravel\Passport\Exceptions\OAuthServerException as LaravelOAuthException; use Laravel\Passport\Exceptions\OAuthServerException as LaravelOAuthException;
use League\OAuth2\Server\Exception\OAuthServerException; use League\OAuth2\Server\Exception\OAuthServerException;
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
use Symfony\Component\HttpFoundation\Exception\SuspiciousOperationException; use Symfony\Component\HttpFoundation\Exception\SuspiciousOperationException;
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
use Symfony\Component\HttpKernel\Exception\HttpException; use Symfony\Component\HttpKernel\Exception\HttpException;
use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException; use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
@@ -64,7 +64,7 @@ class Handler extends ExceptionHandler
LaravelOAuthException::class, LaravelOAuthException::class,
TokenMismatchException::class, TokenMismatchException::class,
HttpException::class, HttpException::class,
SuspiciousOperationException::class SuspiciousOperationException::class,
]; ];
/** /**

View File

@@ -194,7 +194,8 @@ class AccountFactory
// create it: // create it:
$virtualBalance = array_key_exists('virtual_balance', $data) ? $data['virtual_balance'] : null; $virtualBalance = array_key_exists('virtual_balance', $data) ? $data['virtual_balance'] : null;
$active = array_key_exists('active', $data) ? $data['active'] : true; $active = array_key_exists('active', $data) ? $data['active'] : true;
$databaseData = ['user_id' => $this->user->id, $databaseData = [
'user_id' => $this->user->id,
'account_type_id' => $type->id, 'account_type_id' => $type->id,
'name' => $data['name'], 'name' => $data['name'],
'order' => 25000, 'order' => 25000,

View File

@@ -30,6 +30,7 @@ use FireflyIII\Repositories\ObjectGroup\CreatesObjectGroups;
use FireflyIII\Services\Internal\Support\BillServiceTrait; use FireflyIII\Services\Internal\Support\BillServiceTrait;
use FireflyIII\User; use FireflyIII\User;
use Illuminate\Database\QueryException; use Illuminate\Database\QueryException;
use JsonException;
use Log; use Log;
/** /**
@@ -47,7 +48,7 @@ class BillFactory
* *
* @return Bill|null * @return Bill|null
* @throws FireflyException * @throws FireflyException
* @throws \JsonException * @throws JsonException
*/ */
public function create(array $data): ?Bill public function create(array $data): ?Bill
{ {

View File

@@ -1,4 +1,5 @@
<?php <?php
/** /**
* BudgetFactory.php * BudgetFactory.php
* Copyright (c) 2019 james@firefly-iii.org * Copyright (c) 2019 james@firefly-iii.org

View File

@@ -1,4 +1,5 @@
<?php <?php
/** /**
* CategoryFactory.php * CategoryFactory.php
* Copyright (c) 2019 james@firefly-iii.org * Copyright (c) 2019 james@firefly-iii.org

View File

@@ -1,4 +1,5 @@
<?php <?php
/** /**
* PiggyBankEventFactory.php * PiggyBankEventFactory.php
* Copyright (c) 2019 james@firefly-iii.org * Copyright (c) 2019 james@firefly-iii.org
@@ -22,9 +23,7 @@ declare(strict_types=1);
namespace FireflyIII\Factory; namespace FireflyIII\Factory;
use FireflyIII\Events\ChangedPiggyBankAmount;
use FireflyIII\Models\PiggyBank; use FireflyIII\Models\PiggyBank;
use FireflyIII\Models\PiggyBankEvent;
use FireflyIII\Models\TransactionJournal; use FireflyIII\Models\TransactionJournal;
use FireflyIII\Models\TransactionType; use FireflyIII\Models\TransactionType;
use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface; use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface;

View File

@@ -1,4 +1,5 @@
<?php <?php
/** /**
* PiggyBankFactory.php * PiggyBankFactory.php
* Copyright (c) 2019 james@firefly-iii.org * Copyright (c) 2019 james@firefly-iii.org

View File

@@ -27,6 +27,7 @@ use FireflyIII\Exceptions\DuplicateTransactionException;
use FireflyIII\Exceptions\FireflyException; use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\TransactionGroup; use FireflyIII\Models\TransactionGroup;
use FireflyIII\User; use FireflyIII\User;
use JsonException;
use Log; use Log;
/** /**
@@ -55,7 +56,7 @@ class TransactionGroupFactory
* @return TransactionGroup * @return TransactionGroup
* @throws DuplicateTransactionException * @throws DuplicateTransactionException
* @throws FireflyException * @throws FireflyException
* @throws \JsonException * @throws JsonException
*/ */
public function create(array $data): TransactionGroup public function create(array $data): TransactionGroup
{ {

View File

@@ -399,6 +399,52 @@ class TransactionJournalFactory
} }
} }
/**
* Set the user.
*
* @param User $user
*/
public function setUser(User $user): void
{
$this->user = $user;
$this->currencyRepository->setUser($this->user);
$this->tagFactory->setUser($user);
$this->billRepository->setUser($this->user);
$this->budgetRepository->setUser($this->user);
$this->categoryRepository->setUser($this->user);
$this->piggyRepository->setUser($this->user);
$this->accountRepository->setUser($this->user);
}
/**
* @param Account|null $sourceAccount
* @param Account|null $destinationAccount
* @return array
*/
private function reconciliationSanityCheck(?Account $sourceAccount, ?Account $destinationAccount): array
{
Log::debug(sprintf('Now in %s', __METHOD__));
if (null !== $sourceAccount && null !== $destinationAccount) {
Log::debug('Both accounts exist, simply return them.');
return [$sourceAccount, $destinationAccount];
}
if (null !== $sourceAccount && null === $destinationAccount) {
Log::debug('Destination account is NULL, source account is not.');
$account = $this->accountRepository->getReconciliation($sourceAccount);
Log::debug(sprintf('Will return account #%d ("%s") of type "%s"', $account->id, $account->name, $account->accountType->type));
return [$sourceAccount, $account];
}
if (null === $sourceAccount && null !== $destinationAccount) {
Log::debug('Source account is NULL, destination account is not.');
$account = $this->accountRepository->getReconciliation($destinationAccount);
Log::debug(sprintf('Will return account #%d ("%s") of type "%s"', $account->id, $account->name, $account->accountType->type));
return [$account, $destinationAccount];
}
Log::debug('Unused fallback');
return [$sourceAccount, $destinationAccount];
}
/** /**
* @param string $type * @param string $type
* @param TransactionCurrency|null $currency * @param TransactionCurrency|null $currency
@@ -585,50 +631,4 @@ class TransactionJournalFactory
Log::info('Will trigger duplication alert for this journal.'); Log::info('Will trigger duplication alert for this journal.');
} }
} }
/**
* Set the user.
*
* @param User $user
*/
public function setUser(User $user): void
{
$this->user = $user;
$this->currencyRepository->setUser($this->user);
$this->tagFactory->setUser($user);
$this->billRepository->setUser($this->user);
$this->budgetRepository->setUser($this->user);
$this->categoryRepository->setUser($this->user);
$this->piggyRepository->setUser($this->user);
$this->accountRepository->setUser($this->user);
}
/**
* @param Account|null $sourceAccount
* @param Account|null $destinationAccount
* @return array
*/
private function reconciliationSanityCheck(?Account $sourceAccount, ?Account $destinationAccount): array
{
Log::debug(sprintf('Now in %s', __METHOD__));
if (null !== $sourceAccount && null !== $destinationAccount) {
Log::debug('Both accounts exist, simply return them.');
return [$sourceAccount, $destinationAccount];
}
if (null !== $sourceAccount && null === $destinationAccount) {
Log::debug('Destination account is NULL, source account is not.');
$account = $this->accountRepository->getReconciliation($sourceAccount);
Log::debug(sprintf('Will return account #%d ("%s") of type "%s"', $account->id, $account->name, $account->accountType->type));
return [$sourceAccount, $account];
}
if (null === $sourceAccount && null !== $destinationAccount) {
Log::debug('Source account is NULL, destination account is not.');
$account = $this->accountRepository->getReconciliation($destinationAccount);
Log::debug(sprintf('Will return account #%d ("%s") of type "%s"', $account->id, $account->name, $account->accountType->type));
return [$account, $destinationAccount];
}
Log::debug('Unused fallback');
return [$sourceAccount, $destinationAccount];
}
} }

View File

@@ -24,7 +24,6 @@ declare(strict_types=1);
namespace FireflyIII\Factory; namespace FireflyIII\Factory;
use Carbon\Carbon; use Carbon\Carbon;
use Exception;
use FireflyIII\Models\TransactionJournalMeta; use FireflyIII\Models\TransactionJournalMeta;
use Illuminate\Database\QueryException; use Illuminate\Database\QueryException;
use Log; use Log;

View File

@@ -1,4 +1,5 @@
<?php <?php
/** /**
* ChartJsGenerator.php * ChartJsGenerator.php
* Copyright (c) 2019 james@firefly-iii.org * Copyright (c) 2019 james@firefly-iii.org

View File

@@ -1,4 +1,5 @@
<?php <?php
/** /**
* GeneratorInterface.php * GeneratorInterface.php
* Copyright (c) 2019 james@firefly-iii.org * Copyright (c) 2019 james@firefly-iii.org

View File

@@ -1,4 +1,5 @@
<?php <?php
/** /**
* MonthReportGenerator.php * MonthReportGenerator.php
* Copyright (c) 2019 james@firefly-iii.org * Copyright (c) 2019 james@firefly-iii.org
@@ -43,8 +44,8 @@ class MonthReportGenerator implements ReportGeneratorInterface
/** /**
* Generate the report. * Generate the report.
* @throws FireflyException
* @return string * @return string
* @throws FireflyException
*/ */
public function generate(): string public function generate(): string
{ {

View File

@@ -1,4 +1,5 @@
<?php <?php
/** /**
* MultiYearReportGenerator.php * MultiYearReportGenerator.php
* Copyright (c) 2019 james@firefly-iii.org * Copyright (c) 2019 james@firefly-iii.org

View File

@@ -1,4 +1,5 @@
<?php <?php
/** /**
* YearReportGenerator.php * YearReportGenerator.php
* Copyright (c) 2019 james@firefly-iii.org * Copyright (c) 2019 james@firefly-iii.org

View File

@@ -67,16 +67,32 @@ class MonthReportGenerator implements ReportGeneratorInterface
$defaultShow = ['icon', 'description', 'balance_before', 'amount', 'balance_after', 'date', 'to']; $defaultShow = ['icon', 'description', 'balance_before', 'amount', 'balance_after', 'date', 'to'];
$reportType = 'audit'; $reportType = 'audit';
$accountIds = implode(',', $this->accounts->pluck('id')->toArray()); $accountIds = implode(',', $this->accounts->pluck('id')->toArray());
$hideable = ['buttons', 'icon', 'description', 'balance_before', 'amount', 'balance_after', 'date', $hideable = [
'buttons',
'icon',
'description',
'balance_before',
'amount',
'balance_after',
'date',
'from', 'to', 'budget', 'category', 'bill', 'from',
'to',
'budget',
'category',
'bill',
// more new optional fields // more new optional fields
'create_date', 'update_date', 'create_date',
'update_date',
// date fields. // date fields.
'interest_date', 'book_date', 'process_date', 'interest_date',
'due_date', 'payment_date', 'invoice_date', 'book_date',
'process_date',
'due_date',
'payment_date',
'invoice_date',
]; ];
try { try {
$result = view('reports.audit.report', compact('reportType', 'accountIds', 'auditData', 'hideable', 'defaultShow')) $result = view('reports.audit.report', compact('reportType', 'accountIds', 'auditData', 'hideable', 'defaultShow'))

View File

@@ -1,4 +1,5 @@
<?php <?php
/** /**
* MultiYearReportGenerator.php * MultiYearReportGenerator.php
* Copyright (c) 2019 james@firefly-iii.org * Copyright (c) 2019 james@firefly-iii.org

View File

@@ -1,4 +1,5 @@
<?php <?php
/** /**
* YearReportGenerator.php * YearReportGenerator.php
* Copyright (c) 2019 james@firefly-iii.org * Copyright (c) 2019 james@firefly-iii.org

View File

@@ -1,4 +1,5 @@
<?php <?php
/** /**
* MonthReportGenerator.php * MonthReportGenerator.php
* Copyright (c) 2019 james@firefly-iii.org * Copyright (c) 2019 james@firefly-iii.org
@@ -81,34 +82,6 @@ class MonthReportGenerator implements ReportGeneratorInterface
return $result; return $result;
} }
/**
* Set the involved accounts.
*
* @param Collection $accounts
*
* @return ReportGeneratorInterface
*/
public function setAccounts(Collection $accounts): ReportGeneratorInterface
{
$this->accounts = $accounts;
return $this;
}
/**
* Set the involved budgets.
*
* @param Collection $budgets
*
* @return ReportGeneratorInterface
*/
public function setBudgets(Collection $budgets): ReportGeneratorInterface
{
$this->budgets = $budgets;
return $this;
}
/** /**
* Unused category setter. * Unused category setter.
* *
@@ -199,4 +172,32 @@ class MonthReportGenerator implements ReportGeneratorInterface
return $journals; return $journals;
} }
/**
* Set the involved budgets.
*
* @param Collection $budgets
*
* @return ReportGeneratorInterface
*/
public function setBudgets(Collection $budgets): ReportGeneratorInterface
{
$this->budgets = $budgets;
return $this;
}
/**
* Set the involved accounts.
*
* @param Collection $accounts
*
* @return ReportGeneratorInterface
*/
public function setAccounts(Collection $accounts): ReportGeneratorInterface
{
$this->accounts = $accounts;
return $this;
}
} }

View File

@@ -1,4 +1,5 @@
<?php <?php
/** /**
* MultiYearReportGenerator.php * MultiYearReportGenerator.php
* Copyright (c) 2019 james@firefly-iii.org * Copyright (c) 2019 james@firefly-iii.org

View File

@@ -1,4 +1,5 @@
<?php <?php
/** /**
* YearReportGenerator.php * YearReportGenerator.php
* Copyright (c) 2019 james@firefly-iii.org * Copyright (c) 2019 james@firefly-iii.org

View File

@@ -1,4 +1,5 @@
<?php <?php
/** /**
* MonthReportGenerator.php * MonthReportGenerator.php
* Copyright (c) 2019 james@firefly-iii.org * Copyright (c) 2019 james@firefly-iii.org
@@ -89,20 +90,6 @@ class MonthReportGenerator implements ReportGeneratorInterface
return $result; return $result;
} }
/**
* Set the involved accounts.
*
* @param Collection $accounts
*
* @return ReportGeneratorInterface
*/
public function setAccounts(Collection $accounts): ReportGeneratorInterface
{
$this->accounts = $accounts;
return $this;
}
/** /**
* Empty budget setter. * Empty budget setter.
* *
@@ -115,20 +102,6 @@ class MonthReportGenerator implements ReportGeneratorInterface
return $this; return $this;
} }
/**
* Set the categories involved in this report.
*
* @param Collection $categories
*
* @return ReportGeneratorInterface
*/
public function setCategories(Collection $categories): ReportGeneratorInterface
{
$this->categories = $categories;
return $this;
}
/** /**
* Set the end date for this report. * Set the end date for this report.
* *
@@ -206,6 +179,34 @@ class MonthReportGenerator implements ReportGeneratorInterface
return $transactions; return $transactions;
} }
/**
* Set the categories involved in this report.
*
* @param Collection $categories
*
* @return ReportGeneratorInterface
*/
public function setCategories(Collection $categories): ReportGeneratorInterface
{
$this->categories = $categories;
return $this;
}
/**
* Set the involved accounts.
*
* @param Collection $accounts
*
* @return ReportGeneratorInterface
*/
public function setAccounts(Collection $accounts): ReportGeneratorInterface
{
$this->accounts = $accounts;
return $this;
}
/** /**
* Get the income for this report. * Get the income for this report.
* *

View File

@@ -1,4 +1,5 @@
<?php <?php
/** /**
* MultiYearReportGenerator.php * MultiYearReportGenerator.php
* Copyright (c) 2019 james@firefly-iii.org * Copyright (c) 2019 james@firefly-iii.org

View File

@@ -1,4 +1,5 @@
<?php <?php
/** /**
* YearReportGenerator.php * YearReportGenerator.php
* Copyright (c) 2019 james@firefly-iii.org * Copyright (c) 2019 james@firefly-iii.org

View File

@@ -1,4 +1,5 @@
<?php <?php
/** /**
* ReportGeneratorFactory.php * ReportGeneratorFactory.php
* Copyright (c) 2019 james@firefly-iii.org * Copyright (c) 2019 james@firefly-iii.org

View File

@@ -1,4 +1,5 @@
<?php <?php
/** /**
* ReportGeneratorInterface.php * ReportGeneratorInterface.php
* Copyright (c) 2019 james@firefly-iii.org * Copyright (c) 2019 james@firefly-iii.org

View File

@@ -1,4 +1,5 @@
<?php <?php
/** /**
* MonthReportGenerator.php * MonthReportGenerator.php
* Copyright (c) 2019 james@firefly-iii.org * Copyright (c) 2019 james@firefly-iii.org

View File

@@ -1,4 +1,5 @@
<?php <?php
/** /**
* MultiYearReportGenerator.php * MultiYearReportGenerator.php
* Copyright (c) 2019 james@firefly-iii.org * Copyright (c) 2019 james@firefly-iii.org

View File

@@ -1,4 +1,5 @@
<?php <?php
/** /**
* YearReportGenerator.php * YearReportGenerator.php
* Copyright (c) 2019 james@firefly-iii.org * Copyright (c) 2019 james@firefly-iii.org

View File

@@ -1,4 +1,5 @@
<?php <?php
/** /**
* MultiYearReportGenerator.php * MultiYearReportGenerator.php
* Copyright (c) 2019 james@firefly-iii.org * Copyright (c) 2019 james@firefly-iii.org

View File

@@ -1,4 +1,5 @@
<?php <?php
/** /**
* YearReportGenerator.php * YearReportGenerator.php
* Copyright (c) 2019 james@firefly-iii.org * Copyright (c) 2019 james@firefly-iii.org

View File

@@ -37,6 +37,7 @@ use FireflyIII\Transformers\TransactionGroupTransformer;
use FireflyIII\User; use FireflyIII\User;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use JsonException;
use Log; use Log;
use Ramsey\Uuid\Uuid; use Ramsey\Uuid\Uuid;
use Symfony\Component\HttpFoundation\ParameterBag; use Symfony\Component\HttpFoundation\ParameterBag;
@@ -105,7 +106,7 @@ class StandardMessageGenerator implements MessageGeneratorInterface
* @param Webhook $webhook * @param Webhook $webhook
* @param Model $model * @param Model $model
* @throws FireflyException * @throws FireflyException
* @throws \JsonException * @throws JsonException
*/ */
private function generateMessage(Webhook $webhook, Model $model): void private function generateMessage(Webhook $webhook, Model $model): void
{ {

View File

@@ -23,17 +23,12 @@ declare(strict_types=1);
namespace FireflyIII\Handlers\Events; namespace FireflyIII\Handlers\Events;
use Exception;
use FireflyIII\Exceptions\FireflyException; use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Mail\AccessTokenCreatedMail;
use FireflyIII\Notifications\Admin\TestNotification;
use FireflyIII\Notifications\User\NewAccessToken; use FireflyIII\Notifications\User\NewAccessToken;
use FireflyIII\Repositories\User\UserRepositoryInterface; use FireflyIII\Repositories\User\UserRepositoryInterface;
use Illuminate\Support\Facades\Notification; use Illuminate\Support\Facades\Notification;
use Laravel\Passport\Events\AccessTokenCreated; use Laravel\Passport\Events\AccessTokenCreated;
use Log; use Log;
use Mail;
use Session;
/** /**
* Class APIEventHandler * Class APIEventHandler

View File

@@ -1,4 +1,5 @@
<?php <?php
/** /**
* AdminEventHandler.php * AdminEventHandler.php
* Copyright (c) 2019 james@firefly-iii.org * Copyright (c) 2019 james@firefly-iii.org
@@ -31,34 +32,12 @@ use FireflyIII\Notifications\Admin\VersionCheckResult;
use FireflyIII\Repositories\User\UserRepositoryInterface; use FireflyIII\Repositories\User\UserRepositoryInterface;
use FireflyIII\Support\Facades\FireflyConfig; use FireflyIII\Support\Facades\FireflyConfig;
use Illuminate\Support\Facades\Notification; use Illuminate\Support\Facades\Notification;
use Log;
use Mail;
use Session;
/** /**
* Class AdminEventHandler. * Class AdminEventHandler.
*/ */
class AdminEventHandler class AdminEventHandler
{ {
/**
* Sends a test message to an administrator.
*
* @param AdminRequestedTestMessage $event
*
* @return void
*/
public function sendTestMessage(AdminRequestedTestMessage $event): void
{
/** @var UserRepositoryInterface $repository */
$repository = app(UserRepositoryInterface::class);
if (!$repository->hasRole($event->user, 'owner')) {
return;
}
Notification::send($event->user, new TestNotification($event->user->email));
}
/** /**
* @param InvitationCreated $event * @param InvitationCreated $event
* @return void * @return void
@@ -102,4 +81,23 @@ class AdminEventHandler
} }
} }
} }
/**
* Sends a test message to an administrator.
*
* @param AdminRequestedTestMessage $event
*
* @return void
*/
public function sendTestMessage(AdminRequestedTestMessage $event): void
{
/** @var UserRepositoryInterface $repository */
$repository = app(UserRepositoryInterface::class);
if (!$repository->hasRole($event->user, 'owner')) {
return;
}
Notification::send($event->user, new TestNotification($event->user->email));
}
} }

View File

@@ -23,18 +23,13 @@ declare(strict_types=1);
namespace FireflyIII\Handlers\Events; namespace FireflyIII\Handlers\Events;
use Exception;
use FireflyIII\Events\RequestedReportOnJournals; use FireflyIII\Events\RequestedReportOnJournals;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Mail\ReportNewJournalsMail;
use FireflyIII\Models\TransactionGroup; use FireflyIII\Models\TransactionGroup;
use FireflyIII\Notifications\User\NewAccessToken;
use FireflyIII\Notifications\User\TransactionCreation; use FireflyIII\Notifications\User\TransactionCreation;
use FireflyIII\Repositories\User\UserRepositoryInterface; use FireflyIII\Repositories\User\UserRepositoryInterface;
use FireflyIII\Transformers\TransactionGroupTransformer; use FireflyIII\Transformers\TransactionGroupTransformer;
use Illuminate\Support\Facades\Notification; use Illuminate\Support\Facades\Notification;
use Log; use Log;
use Mail;
/** /**
* Class AutomationHandler * Class AutomationHandler

View File

@@ -29,7 +29,6 @@ use FireflyIII\Notifications\User\BillReminder;
use FireflyIII\Support\Facades\Preferences; use FireflyIII\Support\Facades\Preferences;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Notification; use Illuminate\Support\Facades\Notification;
use Mail;
/** /**
* Class BillEventHandler * Class BillEventHandler

View File

@@ -27,7 +27,6 @@ use FireflyIII\Enums\WebhookTrigger;
use FireflyIII\Events\DestroyedTransactionGroup; use FireflyIII\Events\DestroyedTransactionGroup;
use FireflyIII\Events\RequestedSendWebhookMessages; use FireflyIII\Events\RequestedSendWebhookMessages;
use FireflyIII\Generator\Webhook\MessageGeneratorInterface; use FireflyIII\Generator\Webhook\MessageGeneratorInterface;
use FireflyIII\Models\Webhook;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Log; use Log;

View File

@@ -1,4 +1,5 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
/* /*
* PiggyBankEventHandler.php * PiggyBankEventHandler.php

View File

@@ -1,4 +1,5 @@
<?php <?php
/** /**
* StoredGroupEventHandler.php * StoredGroupEventHandler.php
* Copyright (c) 2019 james@firefly-iii.org * Copyright (c) 2019 james@firefly-iii.org
@@ -27,7 +28,6 @@ use FireflyIII\Events\RequestedSendWebhookMessages;
use FireflyIII\Events\StoredTransactionGroup; use FireflyIII\Events\StoredTransactionGroup;
use FireflyIII\Generator\Webhook\MessageGeneratorInterface; use FireflyIII\Generator\Webhook\MessageGeneratorInterface;
use FireflyIII\Models\TransactionJournal; use FireflyIII\Models\TransactionJournal;
use FireflyIII\Models\Webhook;
use FireflyIII\Repositories\RuleGroup\RuleGroupRepositoryInterface; use FireflyIII\Repositories\RuleGroup\RuleGroupRepositoryInterface;
use FireflyIII\Services\Internal\Support\CreditRecalculateService; use FireflyIII\Services\Internal\Support\CreditRecalculateService;
use FireflyIII\TransactionRules\Engine\RuleEngineInterface; use FireflyIII\TransactionRules\Engine\RuleEngineInterface;

View File

@@ -1,4 +1,5 @@
<?php <?php
/** /**
* UpdatedGroupEventHandler.php * UpdatedGroupEventHandler.php
* Copyright (c) 2019 james@firefly-iii.org * Copyright (c) 2019 james@firefly-iii.org
@@ -30,7 +31,6 @@ use FireflyIII\Models\Account;
use FireflyIII\Models\Transaction; use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionJournal; use FireflyIII\Models\TransactionJournal;
use FireflyIII\Models\TransactionType; use FireflyIII\Models\TransactionType;
use FireflyIII\Models\Webhook;
use FireflyIII\Repositories\RuleGroup\RuleGroupRepositoryInterface; use FireflyIII\Repositories\RuleGroup\RuleGroupRepositoryInterface;
use FireflyIII\Services\Internal\Support\CreditRecalculateService; use FireflyIII\Services\Internal\Support\CreditRecalculateService;
use FireflyIII\TransactionRules\Engine\RuleEngineInterface; use FireflyIII\TransactionRules\Engine\RuleEngineInterface;

View File

@@ -79,33 +79,6 @@ class UserEventHandler
} }
} }
/**
* @param InvitationCreated $event
* @return void
*/
public function sendRegistrationInvite(InvitationCreated $event): void
{
$invitee = $event->invitee->email;
$admin = $event->invitee->user->email;
$url = route('invite', [$event->invitee->invite_code]);
try {
Mail::to($invitee)->send(new InvitationMail($invitee, $admin, $url));
} catch (Exception $e) {
Log::error($e->getMessage());
throw new FireflyException($e->getMessage(), 0, $e);
}
}
/**
* @param RegisteredUser $event
* @return bool
*/
public function createExchangeRates(RegisteredUser $event): void
{
$seeder = new ExchangeRateSeeder();
$seeder->run();
}
/** /**
* Fires to see if a user is admin. * Fires to see if a user is admin.
* *
@@ -138,6 +111,16 @@ class UserEventHandler
} }
} }
/**
* @param RegisteredUser $event
* @return bool
*/
public function createExchangeRates(RegisteredUser $event): void
{
$seeder = new ExchangeRateSeeder();
$seeder->run();
}
/** /**
* @param RegisteredUser $event * @param RegisteredUser $event
* *
@@ -232,6 +215,24 @@ class UserEventHandler
app('preferences')->setForUser($user, 'login_ip_history', $list); app('preferences')->setForUser($user, 'login_ip_history', $list);
} }
/**
* @param RegisteredUser $event
*/
public function sendAdminRegistrationNotification(RegisteredUser $event): void
{
$sendMail = FireflyConfig::get('notification_admin_new_reg', true)->data;
if ($sendMail) {
/** @var UserRepositoryInterface $repository */
$repository = app(UserRepositoryInterface::class);
$all = $repository->all();
foreach ($all as $user) {
if ($repository->hasRole($user, 'owner')) {
Notification::send($user, new AdminRegistrationNotification($event->user));
}
}
}
}
/** /**
* Send email to confirm email change. Will not be made into a notification, because * Send email to confirm email change. Will not be made into a notification, because
* this requires some custom fields from the user and not just the "user" object. * this requires some custom fields from the user and not just the "user" object.
@@ -289,6 +290,23 @@ class UserEventHandler
Notification::send($event->user, new UserNewPassword(route('password.reset', [$event->token]))); Notification::send($event->user, new UserNewPassword(route('password.reset', [$event->token])));
} }
/**
* @param InvitationCreated $event
* @return void
*/
public function sendRegistrationInvite(InvitationCreated $event): void
{
$invitee = $event->invitee->email;
$admin = $event->invitee->user->email;
$url = route('invite', [$event->invitee->invite_code]);
try {
Mail::to($invitee)->send(new InvitationMail($invitee, $admin, $url));
} catch (Exception $e) {
Log::error($e->getMessage());
throw new FireflyException($e->getMessage(), 0, $e);
}
}
/** /**
* This method will send the user a registration mail, welcoming him or her to Firefly III. * This method will send the user a registration mail, welcoming him or her to Firefly III.
* This message is only sent when the configuration of Firefly III says so. * This message is only sent when the configuration of Firefly III says so.
@@ -304,24 +322,6 @@ class UserEventHandler
} }
} }
/**
* @param RegisteredUser $event
*/
public function sendAdminRegistrationNotification(RegisteredUser $event): void
{
$sendMail = FireflyConfig::get('notification_admin_new_reg', true)->data;
if ($sendMail) {
/** @var UserRepositoryInterface $repository */
$repository = app(UserRepositoryInterface::class);
$all = $repository->all();
foreach ($all as $user) {
if ($repository->hasRole($user, 'owner')) {
Notification::send($user, new AdminRegistrationNotification($event->user));
}
}
}
}
/** /**
* @param ActuallyLoggedIn $event * @param ActuallyLoggedIn $event
* @throws FireflyException * @throws FireflyException

View File

@@ -1,4 +1,5 @@
<?php <?php
/** /**
* VersionCheckEventHandler.php * VersionCheckEventHandler.php
* Copyright (c) 2019 james@firefly-iii.org * Copyright (c) 2019 james@firefly-iii.org
@@ -28,6 +29,8 @@ use FireflyIII\Helpers\Update\UpdateTrait;
use FireflyIII\Models\Configuration; use FireflyIII\Models\Configuration;
use FireflyIII\Repositories\User\UserRepositoryInterface; use FireflyIII\Repositories\User\UserRepositoryInterface;
use Log; use Log;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
/** /**
* Class VersionCheckEventHandler * Class VersionCheckEventHandler
@@ -42,8 +45,8 @@ class VersionCheckEventHandler
* @param RequestedVersionCheckStatus $event * @param RequestedVersionCheckStatus $event
* *
* @throws FireflyException * @throws FireflyException
* @throws \Psr\Container\ContainerExceptionInterface * @throws ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface * @throws NotFoundExceptionInterface
* @deprecated ? * @deprecated ?
*/ */
public function checkForUpdates(RequestedVersionCheckStatus $event): void public function checkForUpdates(RequestedVersionCheckStatus $event): void
@@ -91,8 +94,8 @@ class VersionCheckEventHandler
* @param RequestedVersionCheckStatus $event * @param RequestedVersionCheckStatus $event
* *
* @throws FireflyException * @throws FireflyException
* @throws \Psr\Container\ContainerExceptionInterface * @throws ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface * @throws NotFoundExceptionInterface
*/ */
protected function warnToCheckForUpdates(RequestedVersionCheckStatus $event): void protected function warnToCheckForUpdates(RequestedVersionCheckStatus $event): void
{ {

View File

@@ -1,4 +1,5 @@
<?php <?php
/** /**
* AttachmentHelper.php * AttachmentHelper.php
* Copyright (c) 2019 james@firefly-iii.org * Copyright (c) 2019 james@firefly-iii.org

View File

@@ -1,4 +1,5 @@
<?php <?php
/** /**
* AttachmentHelperInterface.php * AttachmentHelperInterface.php
* Copyright (c) 2019 james@firefly-iii.org * Copyright (c) 2019 james@firefly-iii.org

View File

@@ -49,33 +49,10 @@ trait AttachmentCollection
foreach ($object['transactions'] as $transaction) { foreach ($object['transactions'] as $transaction) {
/** @var array $attachment */ /** @var array $attachment */
foreach ($transaction['attachments'] as $attachment) { foreach ($transaction['attachments'] as $attachment) {
$result = str_contains(strtolower($attachment['filename']), strtolower($name)) || str_contains(strtolower($attachment['title']), strtolower($name)); $result = str_contains(strtolower($attachment['filename']), strtolower($name)) || str_contains(
if (true === $result) { strtolower($attachment['title']),
return true; strtolower($name)
} );
}
}
return false;
};
$this->postFilters[] = $filter;
return $this;
}
/**
* @param string $name
* @return GroupCollectorInterface
*/
public function attachmentNameDoesNotContain(string $name): GroupCollectorInterface
{
$this->hasAttachments();
$this->withAttachmentInformation();
$filter = function (int $index, array $object) use ($name): bool {
/** @var array $transaction */
foreach ($object['transactions'] as $transaction) {
/** @var array $attachment */
foreach ($transaction['attachments'] as $attachment) {
$result = !str_contains(strtolower($attachment['filename']), strtolower($name)) && !str_contains(strtolower($attachment['title']), strtolower($name));
if (true === $result) { if (true === $result) {
return true; return true;
} }
@@ -140,7 +117,7 @@ trait AttachmentCollection
* @param string $name * @param string $name
* @return GroupCollectorInterface * @return GroupCollectorInterface
*/ */
public function attachmentNameEnds(string $name): GroupCollectorInterface public function attachmentNameDoesNotContain(string $name): GroupCollectorInterface
{ {
$this->hasAttachments(); $this->hasAttachments();
$this->withAttachmentInformation(); $this->withAttachmentInformation();
@@ -149,7 +126,10 @@ trait AttachmentCollection
foreach ($object['transactions'] as $transaction) { foreach ($object['transactions'] as $transaction) {
/** @var array $attachment */ /** @var array $attachment */
foreach ($transaction['attachments'] as $attachment) { foreach ($transaction['attachments'] as $attachment) {
$result = str_ends_with(strtolower($attachment['filename']), strtolower($name)) || str_ends_with(strtolower($attachment['title']), strtolower($name)); $result = !str_contains(strtolower($attachment['filename']), strtolower($name)) && !str_contains(
strtolower($attachment['title']),
strtolower($name)
);
if (true === $result) { if (true === $result) {
return true; return true;
} }
@@ -175,7 +155,68 @@ trait AttachmentCollection
foreach ($object['transactions'] as $transaction) { foreach ($object['transactions'] as $transaction) {
/** @var array $attachment */ /** @var array $attachment */
foreach ($transaction['attachments'] as $attachment) { foreach ($transaction['attachments'] as $attachment) {
$result = !str_ends_with(strtolower($attachment['filename']), strtolower($name)) && !str_ends_with(strtolower($attachment['title']), strtolower($name)); $result = !str_ends_with(strtolower($attachment['filename']), strtolower($name)) && !str_ends_with(
strtolower($attachment['title']),
strtolower($name)
);
if (true === $result) {
return true;
}
}
}
return false;
};
$this->postFilters[] = $filter;
return $this;
}
/**
* @param string $name
* @return GroupCollectorInterface
*/
public function attachmentNameDoesNotStart(string $name): GroupCollectorInterface
{
$this->hasAttachments();
$this->withAttachmentInformation();
$filter = function (int $index, array $object) use ($name): bool {
/** @var array $transaction */
foreach ($object['transactions'] as $transaction) {
/** @var array $attachment */
foreach ($transaction['attachments'] as $attachment) {
$result = !str_starts_with(strtolower($attachment['filename']), strtolower($name)) && !str_starts_with(
strtolower($attachment['title']),
strtolower($name)
);
if (true === $result) {
return true;
}
}
}
return false;
};
$this->postFilters[] = $filter;
return $this;
}
/**
* @param string $name
* @return GroupCollectorInterface
*/
public function attachmentNameEnds(string $name): GroupCollectorInterface
{
$this->hasAttachments();
$this->withAttachmentInformation();
$filter = function (int $index, array $object) use ($name): bool {
/** @var array $transaction */
foreach ($object['transactions'] as $transaction) {
/** @var array $attachment */
foreach ($transaction['attachments'] as $attachment) {
$result = str_ends_with(strtolower($attachment['filename']), strtolower($name)) || str_ends_with(
strtolower($attachment['title']),
strtolower($name)
);
if (true === $result) { if (true === $result) {
return true; return true;
} }
@@ -253,33 +294,10 @@ trait AttachmentCollection
foreach ($object['transactions'] as $transaction) { foreach ($object['transactions'] as $transaction) {
/** @var array $attachment */ /** @var array $attachment */
foreach ($transaction['attachments'] as $attachment) { foreach ($transaction['attachments'] as $attachment) {
$result = str_starts_with(strtolower($attachment['filename']), strtolower($name)) || str_starts_with(strtolower($attachment['title']), strtolower($name)); $result = str_starts_with(strtolower($attachment['filename']), strtolower($name)) || str_starts_with(
if (true === $result) { strtolower($attachment['title']),
return true; strtolower($name)
} );
}
}
return false;
};
$this->postFilters[] = $filter;
return $this;
}
/**
* @param string $name
* @return GroupCollectorInterface
*/
public function attachmentNameDoesNotStart(string $name): GroupCollectorInterface
{
$this->hasAttachments();
$this->withAttachmentInformation();
$filter = function (int $index, array $object) use ($name): bool {
/** @var array $transaction */
foreach ($object['transactions'] as $transaction) {
/** @var array $attachment */
foreach ($transaction['attachments'] as $attachment) {
$result = !str_starts_with(strtolower($attachment['filename']), strtolower($name)) && !str_starts_with(strtolower($attachment['title']), strtolower($name));
if (true === $result) { if (true === $result) {
return true; return true;
} }
@@ -396,32 +414,6 @@ trait AttachmentCollection
return $this; return $this;
} }
/**
* @param string $value
* @return GroupCollectorInterface
*/
public function attachmentNotesEnds(string $value): GroupCollectorInterface
{
$this->hasAttachments();
$this->withAttachmentInformation();
$filter = function (int $index, array $object) use ($value): bool {
/** @var array $transaction */
foreach ($object['transactions'] as $transaction) {
/** @var array $attachment */
foreach ($transaction['attachments'] as $attachment) {
/** @var Attachment $object */
$object = auth()->user()->attachments()->find($attachment['id']);
$notes = (string) $object->notes()?->first()?->text;
return $notes !== '' && str_ends_with(strtolower($notes), strtolower($value));
}
}
return false;
};
$this->postFilters[] = $filter;
return $this;
}
/** /**
* @param string $value * @param string $value
* @return GroupCollectorInterface * @return GroupCollectorInterface
@@ -448,32 +440,6 @@ trait AttachmentCollection
return $this; return $this;
} }
/**
* @param string $value
* @return GroupCollectorInterface
*/
public function attachmentNotesStarts(string $value): GroupCollectorInterface
{
$this->hasAttachments();
$this->withAttachmentInformation();
$filter = function (int $index, array $object) use ($value): bool {
/** @var array $transaction */
foreach ($object['transactions'] as $transaction) {
/** @var array $attachment */
foreach ($transaction['attachments'] as $attachment) {
/** @var Attachment $object */
$object = auth()->user()->attachments()->find($attachment['id']);
$notes = (string) $object->notes()?->first()?->text;
return $notes !== '' && str_starts_with(strtolower($notes), strtolower($value));
}
}
return false;
};
$this->postFilters[] = $filter;
return $this;
}
/** /**
* @param string $value * @param string $value
* @return GroupCollectorInterface * @return GroupCollectorInterface
@@ -500,6 +466,58 @@ trait AttachmentCollection
return $this; return $this;
} }
/**
* @param string $value
* @return GroupCollectorInterface
*/
public function attachmentNotesEnds(string $value): GroupCollectorInterface
{
$this->hasAttachments();
$this->withAttachmentInformation();
$filter = function (int $index, array $object) use ($value): bool {
/** @var array $transaction */
foreach ($object['transactions'] as $transaction) {
/** @var array $attachment */
foreach ($transaction['attachments'] as $attachment) {
/** @var Attachment $object */
$object = auth()->user()->attachments()->find($attachment['id']);
$notes = (string)$object->notes()?->first()?->text;
return $notes !== '' && str_ends_with(strtolower($notes), strtolower($value));
}
}
return false;
};
$this->postFilters[] = $filter;
return $this;
}
/**
* @param string $value
* @return GroupCollectorInterface
*/
public function attachmentNotesStarts(string $value): GroupCollectorInterface
{
$this->hasAttachments();
$this->withAttachmentInformation();
$filter = function (int $index, array $object) use ($value): bool {
/** @var array $transaction */
foreach ($object['transactions'] as $transaction) {
/** @var array $attachment */
foreach ($transaction['attachments'] as $attachment) {
/** @var Attachment $object */
$object = auth()->user()->attachments()->find($attachment['id']);
$notes = (string)$object->notes()?->first()?->text;
return $notes !== '' && str_starts_with(strtolower($notes), strtolower($value));
}
}
return false;
};
$this->postFilters[] = $filter;
return $this;
}
/** /**
* Has attachments * Has attachments
* *

View File

@@ -53,6 +53,25 @@ trait MetaCollection
return $this; return $this;
} }
/**
* Will include bill name + ID, if any.
*
* @return GroupCollectorInterface
*/
public function withBillInformation(): GroupCollectorInterface
{
if (false === $this->hasBillInformation) {
// join bill table
$this->query->leftJoin('bills', 'bills.id', '=', 'transaction_journals.bill_id');
// add fields
$this->fields[] = 'bills.id as bill_id';
$this->fields[] = 'bills.name as bill_name';
$this->hasBillInformation = true;
}
return $this;
}
/** /**
* Exclude a specific budget. * Exclude a specific budget.
* *
@@ -72,6 +91,27 @@ trait MetaCollection
return $this; return $this;
} }
/**
* Will include budget ID + name, if any.
*
* @return GroupCollectorInterface
*/
public function withBudgetInformation(): GroupCollectorInterface
{
if (false === $this->hasBudgetInformation) {
// join link table
$this->query->leftJoin('budget_transaction_journal', 'budget_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id');
// join cat table
$this->query->leftJoin('budgets', 'budget_transaction_journal.budget_id', '=', 'budgets.id');
// add fields
$this->fields[] = 'budgets.id as budget_id';
$this->fields[] = 'budgets.name as budget_name';
$this->hasBudgetInformation = true;
}
return $this;
}
/** /**
* @inheritDoc * @inheritDoc
*/ */
@@ -104,6 +144,27 @@ trait MetaCollection
return $this; return $this;
} }
/**
* Will include category ID + name, if any.
*
* @return GroupCollectorInterface
*/
public function withCategoryInformation(): GroupCollectorInterface
{
if (false === $this->hasCatInformation) {
// join link table
$this->query->leftJoin('category_transaction_journal', 'category_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id');
// join cat table
$this->query->leftJoin('categories', 'category_transaction_journal.category_id', '=', 'categories.id');
// add fields
$this->fields[] = 'categories.id as category_id';
$this->fields[] = 'categories.name as category_name';
$this->hasCatInformation = true;
}
return $this;
}
/** /**
* Exclude a specific category. * Exclude a specific category.
* *
@@ -126,11 +187,11 @@ trait MetaCollection
/** /**
* @inheritDoc * @inheritDoc
*/ */
public function externalIdContains(string $externalId): GroupCollectorInterface public function excludeExternalId(string $externalId): GroupCollectorInterface
{ {
$this->joinMetaDataTables(); $this->joinMetaDataTables();
$this->query->where('journal_meta.name', '=', 'external_id'); $this->query->where('journal_meta.name', '=', 'external_id');
$this->query->where('journal_meta.data', 'LIKE', sprintf('%%%s%%', $externalId)); $this->query->where('journal_meta.data', '!=', sprintf('%s', json_encode($externalId)));
return $this; return $this;
} }
@@ -138,11 +199,48 @@ trait MetaCollection
/** /**
* @inheritDoc * @inheritDoc
*/ */
public function externalIdDoesNotContain(string $externalId): GroupCollectorInterface public function excludeExternalUrl(string $url): GroupCollectorInterface
{
$this->joinMetaDataTables();
$this->query->where('journal_meta.name', '=', 'external_url');
$this->query->where('journal_meta.data', '!=', json_encode($url));
return $this;
}
/**
* @inheritDoc
*/
public function excludeInternalReference(string $internalReference): GroupCollectorInterface
{
$this->joinMetaDataTables();
$this->query->where('journal_meta.name', '=', 'internal_reference');
$this->query->where('journal_meta.data', 'NOT LIKE', sprintf('%%%s%%', $internalReference));
return $this;
}
/**
* @inheritDoc
*/
public function excludeRecurrenceId(string $recurringId): GroupCollectorInterface
{
$this->joinMetaDataTables();
$this->query->where('journal_meta.name', '=', 'recurrence_id');
$this->query->where('journal_meta.data', '!=', sprintf('%s', json_encode($recurringId)));
return $this;
}
/**
* @inheritDoc
*/
public function externalIdContains(string $externalId): GroupCollectorInterface
{ {
$this->joinMetaDataTables(); $this->joinMetaDataTables();
$this->query->where('journal_meta.name', '=', 'external_id'); $this->query->where('journal_meta.name', '=', 'external_id');
$this->query->where('journal_meta.data', 'NOT LIKE', sprintf('%%%s%%', $externalId)); $this->query->where('journal_meta.data', 'LIKE', sprintf('%%%s%%', $externalId));
return $this; return $this;
} }
@@ -163,11 +261,11 @@ trait MetaCollection
/** /**
* @inheritDoc * @inheritDoc
*/ */
public function externalIdEnds(string $externalId): GroupCollectorInterface public function externalIdDoesNotContain(string $externalId): GroupCollectorInterface
{ {
$this->joinMetaDataTables(); $this->joinMetaDataTables();
$this->query->where('journal_meta.name', '=', 'external_id'); $this->query->where('journal_meta.name', '=', 'external_id');
$this->query->where('journal_meta.data', 'LIKE', sprintf('%%%s"', $externalId)); $this->query->where('journal_meta.data', 'NOT LIKE', sprintf('%%%s%%', $externalId));
return $this; return $this;
} }
@@ -187,7 +285,7 @@ trait MetaCollection
/** /**
* @inheritDoc * @inheritDoc
*/ */
public function externalIdStarts(string $externalId): GroupCollectorInterface public function externalIdDoesNotStart(string $externalId): GroupCollectorInterface
{ {
$this->joinMetaDataTables(); $this->joinMetaDataTables();
$this->query->where('journal_meta.name', '=', 'external_id'); $this->query->where('journal_meta.name', '=', 'external_id');
@@ -199,7 +297,19 @@ trait MetaCollection
/** /**
* @inheritDoc * @inheritDoc
*/ */
public function externalIdDoesNotStart(string $externalId): GroupCollectorInterface public function externalIdEnds(string $externalId): GroupCollectorInterface
{
$this->joinMetaDataTables();
$this->query->where('journal_meta.name', '=', 'external_id');
$this->query->where('journal_meta.data', 'LIKE', sprintf('%%%s"', $externalId));
return $this;
}
/**
* @inheritDoc
*/
public function externalIdStarts(string $externalId): GroupCollectorInterface
{ {
$this->joinMetaDataTables(); $this->joinMetaDataTables();
$this->query->where('journal_meta.name', '=', 'external_id'); $this->query->where('journal_meta.name', '=', 'external_id');
@@ -237,6 +347,39 @@ trait MetaCollection
return $this; return $this;
} }
/**
* @param string $url
* @return GroupCollectorInterface
*/
public function externalUrlDoesNotEnd(string $url): GroupCollectorInterface
{
$this->joinMetaDataTables();
$url = json_encode($url);
$url = str_replace('\\', '\\\\', ltrim($url, '"'));
$this->query->where('journal_meta.name', '=', 'external_url');
$this->query->where('journal_meta.data', 'NOT LIKE', sprintf('%%%s', $url));
return $this;
}
/**
* @param string $url
* @return GroupCollectorInterface
*/
public function externalUrlDoesNotStart(string $url): GroupCollectorInterface
{
$this->joinMetaDataTables();
$url = json_encode($url);
$url = str_replace('\\', '\\\\', rtrim($url, '"'));
//var_dump($url);
$this->query->where('journal_meta.name', '=', 'external_url');
$this->query->where('journal_meta.data', 'NOT LIKE', sprintf('%s%%', $url));
return $this;
}
/** /**
* @param string $url * @param string $url
* @return GroupCollectorInterface * @return GroupCollectorInterface
@@ -252,20 +395,6 @@ trait MetaCollection
return $this; return $this;
} }
/**
* @param string $url
* @return GroupCollectorInterface
*/
public function externalUrlDoesNotEnd(string $url): GroupCollectorInterface
{
$this->joinMetaDataTables();
$url = json_encode($url);
$url = str_replace('\\', '\\\\', ltrim($url, '"'));
$this->query->where('journal_meta.name', '=', 'external_url');
$this->query->where('journal_meta.data', 'NOT LIKE', sprintf('%%%s', $url));
return $this;
}
/** /**
* @param string $url * @param string $url
* @return GroupCollectorInterface * @return GroupCollectorInterface
@@ -283,23 +412,6 @@ trait MetaCollection
return $this; return $this;
} }
/**
* @param string $url
* @return GroupCollectorInterface
*/
public function externalUrlDoesNotStart(string $url): GroupCollectorInterface
{
$this->joinMetaDataTables();
$url = json_encode($url);
$url = str_replace('\\', '\\\\', rtrim($url, '"'));
//var_dump($url);
$this->query->where('journal_meta.name', '=', 'external_url');
$this->query->where('journal_meta.data', 'NOT LIKE', sprintf('%s%%', $url));
return $this;
}
/** /**
* Where has no tags. * Where has no tags.
* *
@@ -368,18 +480,6 @@ trait MetaCollection
return $this; return $this;
} }
/**
* @inheritDoc
*/
public function internalReferenceEnds(string $externalId): GroupCollectorInterface
{
$this->joinMetaDataTables();
$this->query->where('journal_meta.name', '=', 'internal_reference');
$this->query->where('journal_meta.data', 'LIKE', sprintf('%%%s"', $externalId));
return $this;
}
/** /**
* @inheritDoc * @inheritDoc
*/ */
@@ -395,7 +495,7 @@ trait MetaCollection
/** /**
* @inheritDoc * @inheritDoc
*/ */
public function internalReferenceStarts(string $externalId): GroupCollectorInterface public function internalReferenceDoesNotStart(string $externalId): GroupCollectorInterface
{ {
$this->joinMetaDataTables(); $this->joinMetaDataTables();
$this->query->where('journal_meta.name', '=', 'internal_reference'); $this->query->where('journal_meta.name', '=', 'internal_reference');
@@ -407,7 +507,19 @@ trait MetaCollection
/** /**
* @inheritDoc * @inheritDoc
*/ */
public function internalReferenceDoesNotStart(string $externalId): GroupCollectorInterface public function internalReferenceEnds(string $externalId): GroupCollectorInterface
{
$this->joinMetaDataTables();
$this->query->where('journal_meta.name', '=', 'internal_reference');
$this->query->where('journal_meta.data', 'LIKE', sprintf('%%%s"', $externalId));
return $this;
}
/**
* @inheritDoc
*/
public function internalReferenceStarts(string $externalId): GroupCollectorInterface
{ {
$this->joinMetaDataTables(); $this->joinMetaDataTables();
$this->query->where('journal_meta.name', '=', 'internal_reference'); $this->query->where('journal_meta.name', '=', 'internal_reference');
@@ -570,25 +682,6 @@ trait MetaCollection
return $this; return $this;
} }
/**
* Will include bill name + ID, if any.
*
* @return GroupCollectorInterface
*/
public function withBillInformation(): GroupCollectorInterface
{
if (false === $this->hasBillInformation) {
// join bill table
$this->query->leftJoin('bills', 'bills.id', '=', 'transaction_journals.bill_id');
// add fields
$this->fields[] = 'bills.id as bill_id';
$this->fields[] = 'bills.name as bill_name';
$this->hasBillInformation = true;
}
return $this;
}
/** /**
* Limit the search to a specific set of bills. * Limit the search to a specific set of bills.
* *
@@ -619,27 +712,6 @@ trait MetaCollection
return $this; return $this;
} }
/**
* Will include budget ID + name, if any.
*
* @return GroupCollectorInterface
*/
public function withBudgetInformation(): GroupCollectorInterface
{
if (false === $this->hasBudgetInformation) {
// join link table
$this->query->leftJoin('budget_transaction_journal', 'budget_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id');
// join cat table
$this->query->leftJoin('budgets', 'budget_transaction_journal.budget_id', '=', 'budgets.id');
// add fields
$this->fields[] = 'budgets.id as budget_id';
$this->fields[] = 'budgets.name as budget_name';
$this->hasBudgetInformation = true;
}
return $this;
}
/** /**
* Limit the search to a specific set of budgets. * Limit the search to a specific set of budgets.
* *
@@ -674,27 +746,6 @@ trait MetaCollection
return $this; return $this;
} }
/**
* Will include category ID + name, if any.
*
* @return GroupCollectorInterface
*/
public function withCategoryInformation(): GroupCollectorInterface
{
if (false === $this->hasCatInformation) {
// join link table
$this->query->leftJoin('category_transaction_journal', 'category_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id');
// join cat table
$this->query->leftJoin('categories', 'category_transaction_journal.category_id', '=', 'categories.id');
// add fields
$this->fields[] = 'categories.id as category_id';
$this->fields[] = 'categories.name as category_name';
$this->hasCatInformation = true;
}
return $this;
}
/** /**
* Limit the search to a specific category. * Limit the search to a specific category.
* *
@@ -722,19 +773,6 @@ trait MetaCollection
return $this; return $this;
} }
/**
* @inheritDoc
*/
public function excludeExternalId(string $externalId): GroupCollectorInterface
{
$this->joinMetaDataTables();
$this->query->where('journal_meta.name', '=', 'external_id');
$this->query->where('journal_meta.data', '!=', sprintf('%s', json_encode($externalId)));
return $this;
}
/** /**
* @inheritDoc * @inheritDoc
*/ */
@@ -747,18 +785,6 @@ trait MetaCollection
return $this; return $this;
} }
/**
* @inheritDoc
*/
public function excludeExternalUrl(string $url): GroupCollectorInterface
{
$this->joinMetaDataTables();
$this->query->where('journal_meta.name', '=', 'external_url');
$this->query->where('journal_meta.data', '!=', json_encode($url));
return $this;
}
/** /**
* @inheritDoc * @inheritDoc
*/ */
@@ -772,19 +798,6 @@ trait MetaCollection
return $this; return $this;
} }
/**
* @inheritDoc
*/
public function excludeInternalReference(string $internalReference): GroupCollectorInterface
{
$this->joinMetaDataTables();
$this->query->where('journal_meta.name', '=', 'internal_reference');
$this->query->where('journal_meta.data', 'NOT LIKE', sprintf('%%%s%%', $internalReference));
return $this;
}
/** /**
* @inheritDoc * @inheritDoc
*/ */
@@ -800,11 +813,12 @@ trait MetaCollection
/** /**
* @inheritDoc * @inheritDoc
*/ */
public function excludeRecurrenceId(string $recurringId): GroupCollectorInterface public function setSepaCT(string $sepaCT): GroupCollectorInterface
{ {
$this->joinMetaDataTables(); $this->joinMetaDataTables();
$this->query->where('journal_meta.name', '=', 'recurrence_id'); $this->query->where('journal_meta.name', '=', 'sepa_ct_id');
$this->query->where('journal_meta.data', '!=', sprintf('%s', json_encode($recurringId))); $this->query->where('journal_meta.data', '=', sprintf('%s', json_encode($sepaCT)));
$this->query->whereNull('journal_meta.deleted_at');
return $this; return $this;
} }
@@ -921,10 +935,10 @@ trait MetaCollection
/** /**
* @inheritDoc * @inheritDoc
*/ */
public function withExternalUrl(): GroupCollectorInterface public function withExternalId(): GroupCollectorInterface
{ {
$this->joinMetaDataTables(); $this->joinMetaDataTables();
$this->query->where('journal_meta.name', '=', 'external_url'); $this->query->where('journal_meta.name', '=', 'external_id');
$this->query->whereNotNull('journal_meta.data'); $this->query->whereNotNull('journal_meta.data');
return $this; return $this;
@@ -933,10 +947,10 @@ trait MetaCollection
/** /**
* @inheritDoc * @inheritDoc
*/ */
public function withExternalId(): GroupCollectorInterface public function withExternalUrl(): GroupCollectorInterface
{ {
$this->joinMetaDataTables(); $this->joinMetaDataTables();
$this->query->where('journal_meta.name', '=', 'external_id'); $this->query->where('journal_meta.name', '=', 'external_url');
$this->query->whereNotNull('journal_meta.data'); $this->query->whereNotNull('journal_meta.data');
return $this; return $this;
@@ -980,26 +994,6 @@ trait MetaCollection
return $this; return $this;
} }
/**
* @inheritDoc
*/
public function withoutExternalUrl(): GroupCollectorInterface
{
$this->joinMetaDataTables();
// TODO not sure if this will work properly.
$this->query->where(function (Builder $q1) {
$q1->where(function (Builder $q2) {
$q2->where('journal_meta.name', '=', 'external_url');
$q2->whereNull('journal_meta.data');
})->orWhere(function (Builder $q3) {
$q3->where('journal_meta.name', '!=', 'external_url');
})->orWhere(function (Builder $q4) {
$q4->whereNull('journal_meta.name');
});
});
return $this;
}
/** /**
* @inheritDoc * @inheritDoc
*/ */
@@ -1021,6 +1015,27 @@ trait MetaCollection
return $this; return $this;
} }
/**
* @inheritDoc
*/
public function withoutExternalUrl(): GroupCollectorInterface
{
$this->joinMetaDataTables();
// TODO not sure if this will work properly.
$this->query->where(function (Builder $q1) {
$q1->where(function (Builder $q2) {
$q2->where('journal_meta.name', '=', 'external_url');
$q2->whereNull('journal_meta.data');
})->orWhere(function (Builder $q3) {
$q3->where('journal_meta.name', '!=', 'external_url');
})->orWhere(function (Builder $q4) {
$q4->whereNull('journal_meta.name');
});
});
return $this;
}
/** /**
* @return GroupCollectorInterface * @return GroupCollectorInterface
*/ */
@@ -1047,17 +1062,4 @@ trait MetaCollection
return $this; return $this;
} }
/**
* @inheritDoc
*/
public function setSepaCT(string $sepaCT): GroupCollectorInterface
{
$this->joinMetaDataTables();
$this->query->where('journal_meta.name', '=', 'sepa_ct_id');
$this->query->where('journal_meta.data', '=', sprintf('%s', json_encode($sepaCT)));
$this->query->whereNull('journal_meta.deleted_at');
return $this;
}
} }

View File

@@ -102,6 +102,18 @@ trait TimeCollection
return $this; return $this;
} }
/**
* @inheritDoc
*/
public function withMetaDate(string $field): GroupCollectorInterface
{
$this->joinMetaDataTables();
$this->query->where('journal_meta.name', '=', $field);
$this->query->whereNotNull('journal_meta.data');
return $this;
}
/** /**
* @param Carbon $start * @param Carbon $start
* @param Carbon $end * @param Carbon $end
@@ -161,18 +173,6 @@ trait TimeCollection
return $this; return $this;
} }
/**
* @inheritDoc
*/
public function withMetaDate(string $field): GroupCollectorInterface
{
$this->joinMetaDataTables();
$this->query->where('journal_meta.name', '=', $field);
$this->query->whereNotNull('journal_meta.data');
return $this;
}
/** /**
* @param string $day * @param string $day
* @param string $field * @param string $field

View File

@@ -624,7 +624,8 @@ class GroupCollector implements GroupCollectorInterface
} }
} }
// unset various fields: // unset various fields:
unset($result['tag_id'], $result['meta_data'], $result['meta_name'], unset(
$result['tag_id'], $result['meta_data'], $result['meta_name'],
$result['tag_name'], $result['tag_date'], $result['tag_description'], $result['tag_name'], $result['tag_date'], $result['tag_description'],
$result['tag_latitude'], $result['tag_longitude'], $result['tag_zoom_level'], $result['tag_latitude'], $result['tag_longitude'], $result['tag_zoom_level'],
$result['attachment_filename'], $result['attachment_id'] $result['attachment_filename'], $result['attachment_id']

View File

@@ -89,13 +89,19 @@ interface GroupCollectorInterface
* @param string $name * @param string $name
* @return GroupCollectorInterface * @return GroupCollectorInterface
*/ */
public function attachmentNameEnds(string $name): GroupCollectorInterface; public function attachmentNameDoesNotEnd(string $name): GroupCollectorInterface;
/** /**
* @param string $name * @param string $name
* @return GroupCollectorInterface * @return GroupCollectorInterface
*/ */
public function attachmentNameDoesNotEnd(string $name): GroupCollectorInterface; public function attachmentNameDoesNotStart(string $name): GroupCollectorInterface;
/**
* @param string $name
* @return GroupCollectorInterface
*/
public function attachmentNameEnds(string $name): GroupCollectorInterface;
/** /**
* @param string $name * @param string $name
@@ -109,12 +115,6 @@ interface GroupCollectorInterface
*/ */
public function attachmentNameIsNot(string $name): GroupCollectorInterface; public function attachmentNameIsNot(string $name): GroupCollectorInterface;
/**
* @param string $name
* @return GroupCollectorInterface
*/
public function attachmentNameDoesNotStart(string $name): GroupCollectorInterface;
/** /**
* @param string $name * @param string $name
* @return GroupCollectorInterface * @return GroupCollectorInterface
@@ -145,18 +145,6 @@ interface GroupCollectorInterface
*/ */
public function attachmentNotesDoNotContain(string $value): GroupCollectorInterface; public function attachmentNotesDoNotContain(string $value): GroupCollectorInterface;
/**
* @param string $value
* @return GroupCollectorInterface
*/
public function attachmentNotesEnds(string $value): GroupCollectorInterface;
/**
* @param string $value
* @return GroupCollectorInterface
*/
public function attachmentNotesStarts(string $value): GroupCollectorInterface;
/** /**
* @param string $value * @param string $value
* @return GroupCollectorInterface * @return GroupCollectorInterface
@@ -169,6 +157,18 @@ interface GroupCollectorInterface
*/ */
public function attachmentNotesDoNotStart(string $value): GroupCollectorInterface; public function attachmentNotesDoNotStart(string $value): GroupCollectorInterface;
/**
* @param string $value
* @return GroupCollectorInterface
*/
public function attachmentNotesEnds(string $value): GroupCollectorInterface;
/**
* @param string $value
* @return GroupCollectorInterface
*/
public function attachmentNotesStarts(string $value): GroupCollectorInterface;
/** /**
* @param string $day * @param string $day
* @return GroupCollectorInterface * @return GroupCollectorInterface
@@ -318,6 +318,21 @@ interface GroupCollectorInterface
*/ */
public function excludeDestinationAccounts(Collection $accounts): GroupCollectorInterface; public function excludeDestinationAccounts(Collection $accounts): GroupCollectorInterface;
/**
* Look for specific external ID's.
*
* @param string $externalId
*
* @return GroupCollectorInterface
*/
public function excludeExternalId(string $externalId): GroupCollectorInterface;
/**
* @param string $url
* @return GroupCollectorInterface
*/
public function excludeExternalUrl(string $url): GroupCollectorInterface;
/** /**
* Limit results to exclude a specific foreign currency. * Limit results to exclude a specific foreign currency.
* *
@@ -336,6 +351,15 @@ interface GroupCollectorInterface
*/ */
public function excludeIds(array $groupIds): GroupCollectorInterface; public function excludeIds(array $groupIds): GroupCollectorInterface;
/**
* Look for specific external ID's.
*
* @param string $externalId
*
* @return GroupCollectorInterface
*/
public function excludeInternalReference(string $externalId): GroupCollectorInterface;
/** /**
* Limit the result to NOT a set of specific transaction journals. * Limit the result to NOT a set of specific transaction journals.
* *
@@ -368,6 +392,13 @@ interface GroupCollectorInterface
*/ */
public function excludeRange(Carbon $start, Carbon $end): GroupCollectorInterface; public function excludeRange(Carbon $start, Carbon $end): GroupCollectorInterface;
/**
* @param string $recurringId
*
* @return GroupCollectorInterface
*/
public function excludeRecurrenceId(string $recurringId): GroupCollectorInterface;
/** /**
* Exclude words in descriptions. * Exclude words in descriptions.
* *
@@ -411,11 +442,6 @@ interface GroupCollectorInterface
* @return GroupCollectorInterface * @return GroupCollectorInterface
*/ */
public function externalIdDoesNotContain(string $externalId): GroupCollectorInterface; public function externalIdDoesNotContain(string $externalId): GroupCollectorInterface;
/**
* @param string $externalId
* @return GroupCollectorInterface
*/
public function externalIdEnds(string $externalId): GroupCollectorInterface;
/** /**
* @param string $externalId * @param string $externalId
@@ -427,13 +453,20 @@ interface GroupCollectorInterface
* @param string $externalId * @param string $externalId
* @return GroupCollectorInterface * @return GroupCollectorInterface
*/ */
public function externalIdStarts(string $externalId): GroupCollectorInterface; public function externalIdDoesNotStart(string $externalId): GroupCollectorInterface;
/** /**
* @param string $externalId * @param string $externalId
* @return GroupCollectorInterface * @return GroupCollectorInterface
*/ */
public function externalIdDoesNotStart(string $externalId): GroupCollectorInterface; public function externalIdEnds(string $externalId): GroupCollectorInterface;
/**
* @param string $externalId
* @return GroupCollectorInterface
*/
public function externalIdStarts(string $externalId): GroupCollectorInterface;
/** /**
* @param string $url * @param string $url
* @return GroupCollectorInterface * @return GroupCollectorInterface
@@ -446,12 +479,6 @@ interface GroupCollectorInterface
*/ */
public function externalUrlDoesNotContain(string $url): GroupCollectorInterface; public function externalUrlDoesNotContain(string $url): GroupCollectorInterface;
/**
* @param string $url
* @return GroupCollectorInterface
*/
public function externalUrlEnds(string $url): GroupCollectorInterface;
/** /**
* @param string $url * @param string $url
* @return GroupCollectorInterface * @return GroupCollectorInterface
@@ -462,13 +489,19 @@ interface GroupCollectorInterface
* @param string $url * @param string $url
* @return GroupCollectorInterface * @return GroupCollectorInterface
*/ */
public function externalUrlStarts(string $url): GroupCollectorInterface; public function externalUrlDoesNotStart(string $url): GroupCollectorInterface;
/** /**
* @param string $url * @param string $url
* @return GroupCollectorInterface * @return GroupCollectorInterface
*/ */
public function externalUrlDoesNotStart(string $url): GroupCollectorInterface; public function externalUrlEnds(string $url): GroupCollectorInterface;
/**
* @param string $url
* @return GroupCollectorInterface
*/
public function externalUrlStarts(string $url): GroupCollectorInterface;
/** /**
* Ensure the search will find nothing at all, zero results. * Ensure the search will find nothing at all, zero results.
@@ -565,12 +598,6 @@ interface GroupCollectorInterface
*/ */
public function internalReferenceDoesNotContain(string $externalId): GroupCollectorInterface; public function internalReferenceDoesNotContain(string $externalId): GroupCollectorInterface;
/**
* @param string $externalId
* @return GroupCollectorInterface
*/
public function internalReferenceEnds(string $externalId): GroupCollectorInterface;
/** /**
* @param string $externalId * @param string $externalId
* @return GroupCollectorInterface * @return GroupCollectorInterface
@@ -581,13 +608,19 @@ interface GroupCollectorInterface
* @param string $externalId * @param string $externalId
* @return GroupCollectorInterface * @return GroupCollectorInterface
*/ */
public function internalReferenceStarts(string $externalId): GroupCollectorInterface; public function internalReferenceDoesNotStart(string $externalId): GroupCollectorInterface;
/** /**
* @param string $externalId * @param string $externalId
* @return GroupCollectorInterface * @return GroupCollectorInterface
*/ */
public function internalReferenceDoesNotStart(string $externalId): GroupCollectorInterface; public function internalReferenceEnds(string $externalId): GroupCollectorInterface;
/**
* @param string $externalId
* @return GroupCollectorInterface
*/
public function internalReferenceStarts(string $externalId): GroupCollectorInterface;
/** /**
* Only journals that are reconciled. * Only journals that are reconciled.
@@ -976,27 +1009,12 @@ interface GroupCollectorInterface
*/ */
public function setExternalId(string $externalId): GroupCollectorInterface; public function setExternalId(string $externalId): GroupCollectorInterface;
/**
* Look for specific external ID's.
*
* @param string $externalId
*
* @return GroupCollectorInterface
*/
public function excludeExternalId(string $externalId): GroupCollectorInterface;
/** /**
* @param string $url * @param string $url
* @return GroupCollectorInterface * @return GroupCollectorInterface
*/ */
public function setExternalUrl(string $url): GroupCollectorInterface; public function setExternalUrl(string $url): GroupCollectorInterface;
/**
* @param string $url
* @return GroupCollectorInterface
*/
public function excludeExternalUrl(string $url): GroupCollectorInterface;
/** /**
* Limit results to a specific foreign currency. * Limit results to a specific foreign currency.
* *
@@ -1024,14 +1042,6 @@ interface GroupCollectorInterface
*/ */
public function setInternalReference(string $externalId): GroupCollectorInterface; public function setInternalReference(string $externalId): GroupCollectorInterface;
/**
* Look for specific external ID's.
*
* @param string $externalId
*
* @return GroupCollectorInterface
*/
public function excludeInternalReference(string $externalId): GroupCollectorInterface;
/** /**
* Limit the result to a set of specific transaction journals. * Limit the result to a set of specific transaction journals.
* *
@@ -1138,13 +1148,6 @@ interface GroupCollectorInterface
*/ */
public function setRecurrenceId(string $recurringId): GroupCollectorInterface; public function setRecurrenceId(string $recurringId): GroupCollectorInterface;
/**
* @param string $recurringId
*
* @return GroupCollectorInterface
*/
public function excludeRecurrenceId(string $recurringId): GroupCollectorInterface;
/** /**
* Search for words in descriptions. * Search for words in descriptions.
* *
@@ -1305,13 +1308,6 @@ interface GroupCollectorInterface
*/ */
public function withCategoryInformation(): GroupCollectorInterface; public function withCategoryInformation(): GroupCollectorInterface;
/**
* Transactions with any external URL
*
* @return GroupCollectorInterface
*/
public function withExternalUrl(): GroupCollectorInterface;
/** /**
* Transactions with any external ID * Transactions with any external ID
* *
@@ -1319,6 +1315,13 @@ interface GroupCollectorInterface
*/ */
public function withExternalId(): GroupCollectorInterface; public function withExternalId(): GroupCollectorInterface;
/**
* Transactions with any external URL
*
* @return GroupCollectorInterface
*/
public function withExternalUrl(): GroupCollectorInterface;
/** /**
* Transaction must have meta date field X. * Transaction must have meta date field X.
* *
@@ -1362,13 +1365,6 @@ interface GroupCollectorInterface
*/ */
public function withoutCategory(): GroupCollectorInterface; public function withoutCategory(): GroupCollectorInterface;
/**
* Transactions without an external URL
*
* @return GroupCollectorInterface
*/
public function withoutExternalUrl(): GroupCollectorInterface;
/** /**
* Transactions without an external ID * Transactions without an external ID
* *
@@ -1376,6 +1372,13 @@ interface GroupCollectorInterface
*/ */
public function withoutExternalId(): GroupCollectorInterface; public function withoutExternalId(): GroupCollectorInterface;
/**
* Transactions without an external URL
*
* @return GroupCollectorInterface
*/
public function withoutExternalUrl(): GroupCollectorInterface;
/** /**
* @return GroupCollectorInterface * @return GroupCollectorInterface
*/ */

View File

@@ -1,4 +1,5 @@
<?php <?php
/** /**
* FiscalHelper.php * FiscalHelper.php
* Copyright (c) 2019 james@firefly-iii.org * Copyright (c) 2019 james@firefly-iii.org
@@ -25,6 +26,8 @@ namespace FireflyIII\Helpers\Fiscal;
use Carbon\Carbon; use Carbon\Carbon;
use FireflyIII\Exceptions\FireflyException; use FireflyIII\Exceptions\FireflyException;
use Log; use Log;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
/** /**
* Class FiscalHelper. * Class FiscalHelper.
@@ -47,8 +50,8 @@ class FiscalHelper implements FiscalHelperInterface
* *
* @return Carbon date object * @return Carbon date object
* @throws FireflyException * @throws FireflyException
* @throws \Psr\Container\ContainerExceptionInterface * @throws ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface * @throws NotFoundExceptionInterface
*/ */
public function endOfFiscalYear(Carbon $date): Carbon public function endOfFiscalYear(Carbon $date): Carbon
{ {
@@ -72,8 +75,8 @@ class FiscalHelper implements FiscalHelperInterface
* *
* @return Carbon date object * @return Carbon date object
* @throws FireflyException * @throws FireflyException
* @throws \Psr\Container\ContainerExceptionInterface * @throws ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface * @throws NotFoundExceptionInterface
*/ */
public function startOfFiscalYear(Carbon $date): Carbon public function startOfFiscalYear(Carbon $date): Carbon
{ {

View File

@@ -1,4 +1,5 @@
<?php <?php
/** /**
* FiscalHelperInterface.php * FiscalHelperInterface.php
* Copyright (c) 2019 james@firefly-iii.org * Copyright (c) 2019 james@firefly-iii.org

View File

@@ -32,8 +32,8 @@ use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
use FireflyIII\Support\CacheProperties; use FireflyIII\Support\CacheProperties;
use FireflyIII\User; use FireflyIII\User;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use JsonException;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
use JsonException;
/** /**
* *

View File

@@ -1,4 +1,5 @@
<?php <?php
/** /**
* PopupReport.php * PopupReport.php
* Copyright (c) 2019 james@firefly-iii.org * Copyright (c) 2019 james@firefly-iii.org

View File

@@ -1,4 +1,5 @@
<?php <?php
/** /**
* PopupReportInterface.php * PopupReportInterface.php
* Copyright (c) 2019 james@firefly-iii.org * Copyright (c) 2019 james@firefly-iii.org

View File

@@ -1,4 +1,5 @@
<?php <?php
/** /**
* ReportHelper.php * ReportHelper.php
* Copyright (c) 2019 james@firefly-iii.org * Copyright (c) 2019 james@firefly-iii.org

View File

@@ -1,4 +1,5 @@
<?php <?php
/** /**
* ReportHelperInterface.php * ReportHelperInterface.php
* Copyright (c) 2019 james@firefly-iii.org * Copyright (c) 2019 james@firefly-iii.org

View File

@@ -26,6 +26,8 @@ namespace FireflyIII\Helpers\Update;
use FireflyIII\Exceptions\FireflyException; use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Services\FireflyIIIOrg\Update\UpdateRequestInterface; use FireflyIII\Services\FireflyIIIOrg\Update\UpdateRequestInterface;
use Log; use Log;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
/** /**
* Trait UpdateTrait * Trait UpdateTrait
@@ -40,8 +42,8 @@ trait UpdateTrait
* *
* @return array * @return array
* @throws FireflyException * @throws FireflyException
* @throws \Psr\Container\ContainerExceptionInterface * @throws ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface * @throws NotFoundExceptionInterface
*/ */
public function getLatestRelease(): array public function getLatestRelease(): array
{ {

View File

@@ -36,6 +36,8 @@ use Illuminate\Http\Request;
use Illuminate\Routing\Redirector; use Illuminate\Routing\Redirector;
use Illuminate\View\View; use Illuminate\View\View;
use Log; use Log;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
/** /**
* *
@@ -136,8 +138,8 @@ class CreateController extends Controller
* *
* @return RedirectResponse|Redirector * @return RedirectResponse|Redirector
* @throws FireflyException * @throws FireflyException
* @throws \Psr\Container\ContainerExceptionInterface * @throws ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface * @throws NotFoundExceptionInterface
*/ */
public function store(AccountFormRequest $request) public function store(AccountFormRequest $request)
{ {

View File

@@ -1,4 +1,5 @@
<?php <?php
/** /**
* IndexController.php * IndexController.php
* Copyright (c) 2019 james@firefly-iii.org * Copyright (c) 2019 james@firefly-iii.org
@@ -23,7 +24,6 @@ declare(strict_types=1);
namespace FireflyIII\Http\Controllers\Account; namespace FireflyIII\Http\Controllers\Account;
use Carbon\Carbon; use Carbon\Carbon;
use Exception;
use FireflyIII\Exceptions\FireflyException; use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Http\Controllers\Controller; use FireflyIII\Http\Controllers\Controller;
use FireflyIII\Models\Account; use FireflyIII\Models\Account;
@@ -33,7 +33,10 @@ use Illuminate\Contracts\View\Factory;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Pagination\LengthAwarePaginator; use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\View\View; use Illuminate\View\View;
use JsonException;
use Log; use Log;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
/** /**
* *
@@ -73,9 +76,9 @@ class IndexController extends Controller
* *
* @return Factory|View * @return Factory|View
* @throws FireflyException * @throws FireflyException
* @throws \JsonException * @throws JsonException
* @throws \Psr\Container\ContainerExceptionInterface * @throws ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface * @throws NotFoundExceptionInterface
*/ */
public function inactive(Request $request, string $objectType) public function inactive(Request $request, string $objectType)
{ {
@@ -129,9 +132,9 @@ class IndexController extends Controller
* *
* @return Factory|View * @return Factory|View
* @throws FireflyException * @throws FireflyException
* @throws \JsonException * @throws JsonException
* @throws \Psr\Container\ContainerExceptionInterface * @throws ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface * @throws NotFoundExceptionInterface
*/ */
public function index(Request $request, string $objectType) public function index(Request $request, string $objectType)
{ {

View File

@@ -1,4 +1,5 @@
<?php <?php
/** /**
* ReconcileController.php * ReconcileController.php
* Copyright (c) 2019 james@firefly-iii.org * Copyright (c) 2019 james@firefly-iii.org
@@ -23,7 +24,6 @@ declare(strict_types=1);
namespace FireflyIII\Http\Controllers\Account; namespace FireflyIII\Http\Controllers\Account;
use Carbon\Carbon; use Carbon\Carbon;
use Exception;
use FireflyIII\Exceptions\DuplicateTransactionException; use FireflyIII\Exceptions\DuplicateTransactionException;
use FireflyIII\Exceptions\FireflyException; use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Factory\TransactionGroupFactory; use FireflyIII\Factory\TransactionGroupFactory;
@@ -40,7 +40,10 @@ use Illuminate\Contracts\View\Factory;
use Illuminate\Http\RedirectResponse; use Illuminate\Http\RedirectResponse;
use Illuminate\Routing\Redirector; use Illuminate\Routing\Redirector;
use Illuminate\View\View; use Illuminate\View\View;
use JsonException;
use Log; use Log;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
/** /**
* Class ReconcileController. * Class ReconcileController.
@@ -86,9 +89,9 @@ class ReconcileController extends Controller
* *
* @return Factory|RedirectResponse|Redirector|View * @return Factory|RedirectResponse|Redirector|View
* @throws FireflyException * @throws FireflyException
* @throws \JsonException * @throws JsonException
* @throws \Psr\Container\ContainerExceptionInterface * @throws ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface * @throws NotFoundExceptionInterface
*/ */
public function reconcile(Account $account, Carbon $start = null, Carbon $end = null) // @phpstan-ignore-line public function reconcile(Account $account, Carbon $start = null, Carbon $end = null) // @phpstan-ignore-line
{ {
@@ -236,8 +239,10 @@ class ReconcileController extends Controller
// title: // title:
$description = trans( $description = trans(
'firefly.reconciliation_transaction_title', 'firefly.reconciliation_transaction_title',
['from' => $start->isoFormat($this->monthAndDayFormat), [
'to' => $end->isoFormat($this->monthAndDayFormat)] 'from' => $start->isoFormat($this->monthAndDayFormat),
'to' => $end->isoFormat($this->monthAndDayFormat),
]
); );
$submission = [ $submission = [
'user' => auth()->user()->id, 'user' => auth()->user()->id,

View File

@@ -24,7 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Http\Controllers\Account; namespace FireflyIII\Http\Controllers\Account;
use Carbon\Carbon; use Carbon\Carbon;
use Exception; use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Helpers\Collector\GroupCollectorInterface; use FireflyIII\Helpers\Collector\GroupCollectorInterface;
use FireflyIII\Http\Controllers\Controller; use FireflyIII\Http\Controllers\Controller;
use FireflyIII\Models\Account; use FireflyIII\Models\Account;
@@ -37,6 +37,9 @@ use Illuminate\Http\Request;
use Illuminate\Routing\Redirector; use Illuminate\Routing\Redirector;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Illuminate\View\View; use Illuminate\View\View;
use JsonException;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
/** /**
* Class ShowController * Class ShowController
@@ -83,10 +86,10 @@ class ShowController extends Controller
* @param Carbon|null $end * @param Carbon|null $end
* *
* @return RedirectResponse|Redirector|Factory|View * @return RedirectResponse|Redirector|Factory|View
* @throws \FireflyIII\Exceptions\FireflyException * @throws FireflyException
* @throws \JsonException * @throws JsonException
* @throws \Psr\Container\ContainerExceptionInterface * @throws ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface * @throws NotFoundExceptionInterface
*/ */
public function show(Request $request, Account $account, Carbon $start = null, Carbon $end = null) // @phpstan-ignore-line public function show(Request $request, Account $account, Carbon $start = null, Carbon $end = null) // @phpstan-ignore-line
{ {
@@ -166,10 +169,10 @@ class ShowController extends Controller
* @param Account $account * @param Account $account
* *
* @return RedirectResponse|Redirector|Factory|View * @return RedirectResponse|Redirector|Factory|View
* @throws \FireflyIII\Exceptions\FireflyException * @throws FireflyException
* @throws \JsonException * @throws JsonException
* @throws \Psr\Container\ContainerExceptionInterface * @throws ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface * @throws NotFoundExceptionInterface
*/ */
public function showAll(Request $request, Account $account) public function showAll(Request $request, Account $account)
{ {

View File

@@ -1,4 +1,5 @@
<?php <?php
/** /**
* ConfigurationController.php * ConfigurationController.php
* Copyright (c) 2019 james@firefly-iii.org * Copyright (c) 2019 james@firefly-iii.org
@@ -30,6 +31,8 @@ use Illuminate\Contracts\View\Factory;
use Illuminate\Http\RedirectResponse; use Illuminate\Http\RedirectResponse;
use Illuminate\View\View; use Illuminate\View\View;
use Log; use Log;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
/** /**
* Class ConfigurationController. * Class ConfigurationController.
@@ -61,8 +64,8 @@ class ConfigurationController extends Controller
* *
* @return Factory|View * @return Factory|View
* @throws FireflyException * @throws FireflyException
* @throws \Psr\Container\ContainerExceptionInterface * @throws ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface * @throws NotFoundExceptionInterface
*/ */
public function index() public function index()
{ {

View File

@@ -1,4 +1,5 @@
<?php <?php
/** /**
* HomeController.php * HomeController.php
* Copyright (c) 2019 james@firefly-iii.org * Copyright (c) 2019 james@firefly-iii.org
@@ -34,6 +35,8 @@ use Illuminate\Http\Request;
use Illuminate\Routing\Redirector; use Illuminate\Routing\Redirector;
use Illuminate\View\View; use Illuminate\View\View;
use Log; use Log;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
/** /**
* Class HomeController. * Class HomeController.
@@ -56,8 +59,8 @@ class HomeController extends Controller
* *
* @return Factory|View * @return Factory|View
* @throws FireflyException * @throws FireflyException
* @throws \Psr\Container\ContainerExceptionInterface * @throws ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface * @throws NotFoundExceptionInterface
*/ */
public function index() public function index()
{ {

View File

@@ -1,4 +1,5 @@
<?php <?php
/** /**
* LinkController.php * LinkController.php
* Copyright (c) 2019 james@firefly-iii.org * Copyright (c) 2019 james@firefly-iii.org

View File

@@ -1,4 +1,5 @@
<?php <?php
/** /**
* UpdateController.php * UpdateController.php
* Copyright (c) 2019 james@firefly-iii.org * Copyright (c) 2019 james@firefly-iii.org
@@ -31,6 +32,8 @@ use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Routing\Redirector; use Illuminate\Routing\Redirector;
use Illuminate\View\View; use Illuminate\View\View;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
/** /**
* Class HomeController. * Class HomeController.
@@ -61,8 +64,8 @@ class UpdateController extends Controller
* *
* @return Factory|View * @return Factory|View
* @throws FireflyException * @throws FireflyException
* @throws \Psr\Container\ContainerExceptionInterface * @throws ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface * @throws NotFoundExceptionInterface
*/ */
public function index() public function index()
{ {

View File

@@ -1,4 +1,5 @@
<?php <?php
/** /**
* UserController.php * UserController.php
* Copyright (c) 2019 james@firefly-iii.org * Copyright (c) 2019 james@firefly-iii.org
@@ -32,7 +33,6 @@ use FireflyIII\User;
use Illuminate\Contracts\Foundation\Application; use Illuminate\Contracts\Foundation\Application;
use Illuminate\Contracts\View\Factory; use Illuminate\Contracts\View\Factory;
use Illuminate\Http\RedirectResponse; use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Routing\Redirector; use Illuminate\Routing\Redirector;
use Illuminate\View\View; use Illuminate\View\View;
use Log; use Log;
@@ -168,6 +168,22 @@ class UserController extends Controller
return view('admin.users.index', compact('subTitle', 'subTitleIcon', 'users', 'allowInvites', 'invitedUsers')); return view('admin.users.index', compact('subTitle', 'subTitleIcon', 'users', 'allowInvites', 'invitedUsers'));
} }
/**
* @param InviteUserFormRequest $request
* @return RedirectResponse
*/
public function invite(InviteUserFormRequest $request): RedirectResponse
{
$address = (string)$request->get('invited_user');
$invitee = $this->repository->inviteUser(auth()->user(), $address);
session()->flash('info', trans('firefly.user_is_invited', ['address' => $address]));
// event!
event(new InvitationCreated($invitee));
return redirect(route('admin.users'));
}
/** /**
* Show single user. * Show single user.
* *
@@ -196,22 +212,6 @@ class UserController extends Controller
); );
} }
/**
* @param InviteUserFormRequest $request
* @return RedirectResponse
*/
public function invite(InviteUserFormRequest $request): RedirectResponse
{
$address = (string) $request->get('invited_user');
$invitee = $this->repository->inviteUser(auth()->user(), $address);
session()->flash('info', trans('firefly.user_is_invited', ['address' => $address]));
// event!
event(new InvitationCreated($invitee));
return redirect(route('admin.users'));
}
/** /**
* Update single user. * Update single user.
* *

View File

@@ -1,4 +1,5 @@
<?php <?php
/** /**
* AttachmentController.php * AttachmentController.php
* Copyright (c) 2019 james@firefly-iii.org * Copyright (c) 2019 james@firefly-iii.org

View File

@@ -1,4 +1,5 @@
<?php <?php
/** /**
* ForgotPasswordController.php * ForgotPasswordController.php
* Copyright (c) 2019 james@firefly-iii.org * Copyright (c) 2019 james@firefly-iii.org
@@ -32,6 +33,8 @@ use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\View\View; use Illuminate\View\View;
use Log; use Log;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
/** /**
* Class ForgotPasswordController * Class ForgotPasswordController
@@ -110,8 +113,8 @@ class ForgotPasswordController extends Controller
* *
* @return Factory|View * @return Factory|View
* @throws FireflyException * @throws FireflyException
* @throws \Psr\Container\ContainerExceptionInterface * @throws ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface * @throws NotFoundExceptionInterface
*/ */
public function showLinkRequestForm() public function showLinkRequestForm()
{ {

View File

@@ -1,4 +1,5 @@
<?php <?php
/** /**
* LoginController.php * LoginController.php
* Copyright (c) 2020 james@firefly-iii.org * Copyright (c) 2020 james@firefly-iii.org
@@ -33,13 +34,14 @@ use Illuminate\Contracts\View\Factory;
use Illuminate\Contracts\View\View; use Illuminate\Contracts\View\View;
use Illuminate\Foundation\Auth\AuthenticatesUsers; use Illuminate\Foundation\Auth\AuthenticatesUsers;
use Illuminate\Foundation\Auth\ThrottlesLogins; use Illuminate\Foundation\Auth\ThrottlesLogins;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\RedirectResponse; use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Http\Response; use Illuminate\Http\Response;
use Illuminate\Routing\Redirector; use Illuminate\Routing\Redirector;
use Illuminate\Validation\ValidationException; use Illuminate\Validation\ValidationException;
use Log; use Log;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
/** /**
* Class LoginController * Class LoginController
@@ -202,8 +204,8 @@ class LoginController extends Controller
* *
* @return Factory|Application|View|Redirector|RedirectResponse * @return Factory|Application|View|Redirector|RedirectResponse
* @throws FireflyException * @throws FireflyException
* @throws \Psr\Container\ContainerExceptionInterface * @throws ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface * @throws NotFoundExceptionInterface
*/ */
public function showLoginForm(Request $request) public function showLoginForm(Request $request)
{ {

View File

@@ -1,4 +1,5 @@
<?php <?php
/** /**
* RegisterController.php * RegisterController.php
* Copyright (c) 2019 james@firefly-iii.org * Copyright (c) 2019 james@firefly-iii.org
@@ -140,33 +141,6 @@ class RegisterController extends Controller
return $allowRegistration; return $allowRegistration;
} }
/**
* Show the application registration form.
*
* @param Request $request
*
* @return Factory|View
* @throws ContainerExceptionInterface
* @throws FireflyException
* @throws NotFoundExceptionInterface
*/
public function showRegistrationForm(Request $request)
{
$isDemoSite = app('fireflyconfig')->get('is_demo_site', config('firefly.configuration.is_demo_site'))->data;
$pageTitle = (string) trans('firefly.register_page_title');
$allowRegistration = $this->allowedToRegister();
if (false === $allowRegistration) {
$message = 'Registration is currently not available. If you are the administrator, you can enable this in the administration.';
return view('error', compact('message'));
}
$email = $request->old('email');
return view('auth.register', compact('isDemoSite', 'email', 'pageTitle'));
}
/** /**
* Show the application registration form if the invitation code is valid. * Show the application registration form if the invitation code is valid.
* *
@@ -201,4 +175,31 @@ class RegisterController extends Controller
return view('auth.register', compact('isDemoSite', 'email', 'pageTitle', 'inviteCode')); return view('auth.register', compact('isDemoSite', 'email', 'pageTitle', 'inviteCode'));
} }
/**
* Show the application registration form.
*
* @param Request $request
*
* @return Factory|View
* @throws ContainerExceptionInterface
* @throws FireflyException
* @throws NotFoundExceptionInterface
*/
public function showRegistrationForm(Request $request)
{
$isDemoSite = app('fireflyconfig')->get('is_demo_site', config('firefly.configuration.is_demo_site'))->data;
$pageTitle = (string)trans('firefly.register_page_title');
$allowRegistration = $this->allowedToRegister();
if (false === $allowRegistration) {
$message = 'Registration is currently not available. If you are the administrator, you can enable this in the administration.';
return view('error', compact('message'));
}
$email = $request->old('email');
return view('auth.register', compact('isDemoSite', 'email', 'pageTitle'));
}
} }

View File

@@ -1,4 +1,5 @@
<?php <?php
/** /**
* ResetPasswordController.php * ResetPasswordController.php
* Copyright (c) 2019 james@firefly-iii.org * Copyright (c) 2019 james@firefly-iii.org
@@ -33,6 +34,8 @@ use Illuminate\Http\Request;
use Illuminate\Support\Facades\Password; use Illuminate\Support\Facades\Password;
use Illuminate\Validation\ValidationException; use Illuminate\Validation\ValidationException;
use Illuminate\View\View; use Illuminate\View\View;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
/** /**
* Class ResetPasswordController * Class ResetPasswordController
@@ -123,8 +126,8 @@ class ResetPasswordController extends Controller
* *
* @return Factory|View * @return Factory|View
* @throws FireflyException * @throws FireflyException
* @throws \Psr\Container\ContainerExceptionInterface * @throws ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface * @throws NotFoundExceptionInterface
*/ */
public function showResetForm(Request $request, $token = null) // @phpstan-ignore-line public function showResetForm(Request $request, $token = null) // @phpstan-ignore-line
{ {

View File

@@ -1,4 +1,5 @@
<?php <?php
/** /**
* TwoFactorController.php * TwoFactorController.php
* Copyright (c) 2019 james@firefly-iii.org * Copyright (c) 2019 james@firefly-iii.org

View File

@@ -33,6 +33,8 @@ use FireflyIII\Transformers\BillTransformer;
use Illuminate\Http\JsonResponse; use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Log; use Log;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
use Symfony\Component\HttpFoundation\ParameterBag; use Symfony\Component\HttpFoundation\ParameterBag;
/** /**
@@ -146,8 +148,8 @@ class IndexController extends Controller
* *
* @return array * @return array
* @throws FireflyException * @throws FireflyException
* @throws \Psr\Container\ContainerExceptionInterface * @throws ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface * @throws NotFoundExceptionInterface
*/ */
private function getSums(array $bills): array private function getSums(array $bills): array
{ {

View File

@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Http\Controllers\Bill; namespace FireflyIII\Http\Controllers\Bill;
use Carbon\Carbon; use Carbon\Carbon;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Helpers\Collector\GroupCollectorInterface; use FireflyIII\Helpers\Collector\GroupCollectorInterface;
use FireflyIII\Http\Controllers\Controller; use FireflyIII\Http\Controllers\Controller;
use FireflyIII\Models\Attachment; use FireflyIII\Models\Attachment;
@@ -41,6 +42,8 @@ use Illuminate\View\View;
use League\Fractal\Manager; use League\Fractal\Manager;
use League\Fractal\Resource\Item; use League\Fractal\Resource\Item;
use League\Fractal\Serializer\DataArraySerializer; use League\Fractal\Serializer\DataArraySerializer;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
use Symfony\Component\HttpFoundation\ParameterBag; use Symfony\Component\HttpFoundation\ParameterBag;
/** /**
@@ -123,9 +126,9 @@ class ShowController extends Controller
* @param Bill $bill * @param Bill $bill
* *
* @return Factory|View * @return Factory|View
* @throws \FireflyIII\Exceptions\FireflyException * @throws FireflyException
* @throws \Psr\Container\ContainerExceptionInterface * @throws ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface * @throws NotFoundExceptionInterface
*/ */
public function show(Request $request, Bill $bill) public function show(Request $request, Bill $bill)
{ {

View File

@@ -41,7 +41,10 @@ use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Illuminate\View\View; use Illuminate\View\View;
use JsonException;
use Log; use Log;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
/** /**
* *
@@ -92,9 +95,9 @@ class IndexController extends Controller
* *
* @return Factory|View * @return Factory|View
* @throws FireflyException * @throws FireflyException
* @throws \JsonException * @throws JsonException
* @throws \Psr\Container\ContainerExceptionInterface * @throws ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface * @throws NotFoundExceptionInterface
*/ */
public function index(Request $request, Carbon $start = null, Carbon $end = null) // @phpstan-ignore-line public function index(Request $request, Carbon $start = null, Carbon $end = null) // @phpstan-ignore-line
{ {

View File

@@ -37,6 +37,9 @@ use FireflyIII\Support\Http\Controllers\PeriodOverview;
use Illuminate\Contracts\View\Factory; use Illuminate\Contracts\View\Factory;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\View\View; use Illuminate\View\View;
use JsonException;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
/** /**
* *
@@ -80,9 +83,9 @@ class ShowController extends Controller
* *
* @return Factory|View * @return Factory|View
* @throws FireflyException * @throws FireflyException
* @throws \JsonException * @throws JsonException
* @throws \Psr\Container\ContainerExceptionInterface * @throws ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface * @throws NotFoundExceptionInterface
*/ */
public function noBudget(Request $request, Carbon $start = null, Carbon $end = null)// @phpstan-ignore-line public function noBudget(Request $request, Carbon $start = null, Carbon $end = null)// @phpstan-ignore-line
{ {
@@ -119,8 +122,8 @@ class ShowController extends Controller
* *
* @return Factory|View * @return Factory|View
* @throws FireflyException * @throws FireflyException
* @throws \Psr\Container\ContainerExceptionInterface * @throws ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface * @throws NotFoundExceptionInterface
*/ */
public function noBudgetAll(Request $request) public function noBudgetAll(Request $request)
{ {
@@ -149,9 +152,9 @@ class ShowController extends Controller
* *
* @return Factory|View * @return Factory|View
* @throws FireflyException * @throws FireflyException
* @throws \JsonException * @throws JsonException
* @throws \Psr\Container\ContainerExceptionInterface * @throws ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface * @throws NotFoundExceptionInterface
*/ */
public function show(Request $request, Budget $budget) public function show(Request $request, Budget $budget)
{ {
@@ -187,9 +190,9 @@ class ShowController extends Controller
* *
* @return Factory|View * @return Factory|View
* @throws FireflyException * @throws FireflyException
* @throws \JsonException * @throws JsonException
* @throws \Psr\Container\ContainerExceptionInterface * @throws ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface * @throws NotFoundExceptionInterface
*/ */
public function showByBudgetLimit(Request $request, Budget $budget, BudgetLimit $budgetLimit) public function showByBudgetLimit(Request $request, Budget $budget, BudgetLimit $budgetLimit)
{ {

View File

@@ -32,6 +32,8 @@ use Illuminate\Http\Request;
use Illuminate\Pagination\LengthAwarePaginator; use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Illuminate\View\View; use Illuminate\View\View;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
/** /**
* Class IndexController * Class IndexController
@@ -68,8 +70,8 @@ class IndexController extends Controller
* *
* @return Factory|View * @return Factory|View
* @throws FireflyException * @throws FireflyException
* @throws \Psr\Container\ContainerExceptionInterface * @throws ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface * @throws NotFoundExceptionInterface
*/ */
public function index(Request $request) public function index(Request $request)
{ {

View File

@@ -34,7 +34,10 @@ use Illuminate\Contracts\View\Factory;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Illuminate\View\View; use Illuminate\View\View;
use JsonException;
use Log; use Log;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
/** /**
* *
@@ -76,9 +79,9 @@ class NoCategoryController extends Controller
* *
* @return Factory|View * @return Factory|View
* @throws FireflyException * @throws FireflyException
* @throws \JsonException * @throws JsonException
* @throws \Psr\Container\ContainerExceptionInterface * @throws ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface * @throws NotFoundExceptionInterface
*/ */
public function show(Request $request, Carbon $start = null, Carbon $end = null)// @phpstan-ignore-line public function show(Request $request, Carbon $start = null, Carbon $end = null)// @phpstan-ignore-line
{ {
@@ -117,8 +120,8 @@ class NoCategoryController extends Controller
* *
* @return Factory|View * @return Factory|View
* @throws FireflyException * @throws FireflyException
* @throws \Psr\Container\ContainerExceptionInterface * @throws ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface * @throws NotFoundExceptionInterface
*/ */
public function showAll(Request $request) public function showAll(Request $request)
{ {

View File

@@ -34,6 +34,9 @@ use Illuminate\Contracts\View\Factory;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Illuminate\View\View; use Illuminate\View\View;
use JsonException;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
/** /**
* *
@@ -78,9 +81,9 @@ class ShowController extends Controller
* *
* @return Factory|View * @return Factory|View
* @throws FireflyException * @throws FireflyException
* @throws \JsonException * @throws JsonException
* @throws \Psr\Container\ContainerExceptionInterface * @throws ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface * @throws NotFoundExceptionInterface
*/ */
public function show(Request $request, Category $category, Carbon $start = null, Carbon $end = null) // @phpstan-ignore-line public function show(Request $request, Category $category, Carbon $start = null, Carbon $end = null) // @phpstan-ignore-line
{ {
@@ -97,8 +100,11 @@ class ShowController extends Controller
$path = route('categories.show', [$category->id, $start->format('Y-m-d'), $end->format('Y-m-d')]); $path = route('categories.show', [$category->id, $start->format('Y-m-d'), $end->format('Y-m-d')]);
$subTitle = trans( $subTitle = trans(
'firefly.journals_in_period_for_category', 'firefly.journals_in_period_for_category',
['name' => $category->name, 'start' => $start->isoFormat($this->monthAndDayFormat), [
'end' => $end->isoFormat($this->monthAndDayFormat),] 'name' => $category->name,
'start' => $start->isoFormat($this->monthAndDayFormat),
'end' => $end->isoFormat($this->monthAndDayFormat),
]
); );
/** @var GroupCollectorInterface $collector */ /** @var GroupCollectorInterface $collector */
@@ -121,8 +127,8 @@ class ShowController extends Controller
* *
* @return Factory|View * @return Factory|View
* @throws FireflyException * @throws FireflyException
* @throws \Psr\Container\ContainerExceptionInterface * @throws ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface * @throws NotFoundExceptionInterface
*/ */
public function showAll(Request $request, Category $category) public function showAll(Request $request, Category $category)
{ {

View File

@@ -42,6 +42,8 @@ use Illuminate\Http\JsonResponse;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use JsonException; use JsonException;
use Log; use Log;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
/** /**
* Class AccountController. * Class AccountController.
@@ -327,8 +329,8 @@ class AccountController extends Controller
* @return JsonResponse * @return JsonResponse
* @throws FireflyException * @throws FireflyException
* @throws JsonException * @throws JsonException
* @throws \Psr\Container\ContainerExceptionInterface * @throws ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface * @throws NotFoundExceptionInterface
*/ */
public function frontpage(AccountRepositoryInterface $repository): JsonResponse public function frontpage(AccountRepositoryInterface $repository): JsonResponse
{ {

Some files were not shown because too many files have changed in this diff Show More