mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Code cleanup [skip ci]
This commit is contained in:
parent
20044427b4
commit
4a12d4d156
@ -26,8 +26,6 @@ namespace FireflyIII\Api\V1\Controllers;
|
|||||||
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Carbon\Exceptions\InvalidDateException;
|
use Carbon\Exceptions\InvalidDateException;
|
||||||
use FireflyConfig;
|
|
||||||
use FireflyIII\Exceptions\FireflyException;
|
|
||||||
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
||||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||||
use Illuminate\Foundation\Validation\ValidatesRequests;
|
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||||
|
@ -24,7 +24,6 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Api\V1\Controllers;
|
namespace FireflyIII\Api\V1\Controllers;
|
||||||
|
|
||||||
use FireflyIII\Api\V1\Requests\BillRequest;
|
|
||||||
use FireflyIII\Api\V1\Requests\CurrencyRequest;
|
use FireflyIII\Api\V1\Requests\CurrencyRequest;
|
||||||
use FireflyIII\Exceptions\FireflyException;
|
use FireflyIII\Exceptions\FireflyException;
|
||||||
use FireflyIII\Models\TransactionCurrency;
|
use FireflyIII\Models\TransactionCurrency;
|
||||||
@ -178,7 +177,7 @@ class CurrencyController extends Controller
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param CurrencyRequest $request
|
* @param CurrencyRequest $request
|
||||||
* @param TransactionCurrency $currency
|
* @param TransactionCurrency $currency
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
|
@ -86,8 +86,8 @@ class BillRequest extends Request
|
|||||||
break;
|
break;
|
||||||
case 'PUT':
|
case 'PUT':
|
||||||
case 'PATCH':
|
case 'PATCH':
|
||||||
$bill = $this->route()->parameter('bill');
|
$bill = $this->route()->parameter('bill');
|
||||||
$rules['name'] .= ',' . $bill->id;
|
$rules['name'] .= ',' . $bill->id;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -184,7 +184,7 @@ class UpgradeDatabase extends Command
|
|||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if($bill->amount_max === $bill->amount_min) {
|
if ($bill->amount_max === $bill->amount_min) {
|
||||||
RuleTrigger::create(
|
RuleTrigger::create(
|
||||||
[
|
[
|
||||||
'rule_id' => $rule->id,
|
'rule_id' => $rule->id,
|
||||||
|
@ -164,7 +164,8 @@ class VerifyDatabase extends Command
|
|||||||
if (isset($results[$key]) && $results[$key] !== $category) {
|
if (isset($results[$key]) && $results[$key] !== $category) {
|
||||||
$this->error(
|
$this->error(
|
||||||
sprintf(
|
sprintf(
|
||||||
'Transaction #%d referred to the wrong category. Was category #%d but is fixed to be category #%d.', $obj->transaction_journal_id, $category, $results[$key]
|
'Transaction #%d referred to the wrong category. Was category #%d but is fixed to be category #%d.', $obj->transaction_journal_id,
|
||||||
|
$category, $results[$key]
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
DB::table('category_transaction')->where('id', $obj->ct_id)->update(['category_id' => $results[$key]]);
|
DB::table('category_transaction')->where('id', $obj->ct_id)->update(['category_id' => $results[$key]]);
|
||||||
@ -184,14 +185,15 @@ class VerifyDatabase extends Command
|
|||||||
->get(['transactions.id', 'transaction_journal_id', 'identifier', 'budget_transaction.budget_id', 'budget_transaction.id as ct_id']);
|
->get(['transactions.id', 'transaction_journal_id', 'identifier', 'budget_transaction.budget_id', 'budget_transaction.id as ct_id']);
|
||||||
$results = [];
|
$results = [];
|
||||||
foreach ($set as $obj) {
|
foreach ($set as $obj) {
|
||||||
$key = $obj->transaction_journal_id . '-' . $obj->identifier;
|
$key = $obj->transaction_journal_id . '-' . $obj->identifier;
|
||||||
$budget = (int)$obj->budget_id;
|
$budget = (int)$obj->budget_id;
|
||||||
|
|
||||||
// value exists and is not budget:
|
// value exists and is not budget:
|
||||||
if (isset($results[$key]) && $results[$key] !== $budget) {
|
if (isset($results[$key]) && $results[$key] !== $budget) {
|
||||||
$this->error(
|
$this->error(
|
||||||
sprintf(
|
sprintf(
|
||||||
'Transaction #%d referred to the wrong budget. Was budget #%d but is fixed to be budget #%d.', $obj->transaction_journal_id, $budget, $results[$key]
|
'Transaction #%d referred to the wrong budget. Was budget #%d but is fixed to be budget #%d.', $obj->transaction_journal_id, $budget,
|
||||||
|
$results[$key]
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
DB::table('budget_transaction')->where('id', $obj->ct_id)->update(['budget_id' => $results[$key]]);
|
DB::table('budget_transaction')->where('id', $obj->ct_id)->update(['budget_id' => $results[$key]]);
|
||||||
|
@ -132,20 +132,20 @@ class Handler extends ExceptionHandler
|
|||||||
$doMailError = env('SEND_ERROR_MESSAGE', true);
|
$doMailError = env('SEND_ERROR_MESSAGE', true);
|
||||||
if (
|
if (
|
||||||
// if the user wants us to mail:
|
// if the user wants us to mail:
|
||||||
$doMailError === true &&
|
$doMailError === true
|
||||||
((
|
&& ((
|
||||||
// and if is one of these error instances
|
// and if is one of these error instances
|
||||||
$exception instanceof FireflyException
|
$exception instanceof FireflyException
|
||||||
|| $exception instanceof ErrorException
|
|| $exception instanceof ErrorException
|
||||||
|| $exception instanceof OAuthServerException
|
|| $exception instanceof OAuthServerException
|
||||||
|
|
||||||
)
|
)
|
||||||
|| (
|
|| (
|
||||||
// or this one, but it's a JSON exception.
|
// or this one, but it's a JSON exception.
|
||||||
$exception instanceof AuthenticationException
|
$exception instanceof AuthenticationException
|
||||||
&& Request::expectsJson() === true
|
&& Request::expectsJson() === true
|
||||||
))
|
))
|
||||||
) {
|
) {
|
||||||
// then, send email
|
// then, send email
|
||||||
$userData = [
|
$userData = [
|
||||||
'id' => 0,
|
'id' => 0,
|
||||||
|
@ -36,12 +36,12 @@ use FireflyIII\Models\AccountMeta;
|
|||||||
use FireflyIII\Models\ExportJob;
|
use FireflyIII\Models\ExportJob;
|
||||||
use FireflyIII\Models\Note;
|
use FireflyIII\Models\Note;
|
||||||
use FireflyIII\Models\Transaction;
|
use FireflyIII\Models\Transaction;
|
||||||
|
use FireflyIII\Models\TransactionJournal;
|
||||||
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
|
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use Log;
|
use Log;
|
||||||
use Storage;
|
use Storage;
|
||||||
use ZipArchive;
|
use ZipArchive;
|
||||||
use FireflyIII\Models\TransactionJournal;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class ExpandedProcessor.
|
* Class ExpandedProcessor.
|
||||||
|
@ -71,6 +71,7 @@ class TransactionCurrencyFactory
|
|||||||
|
|
||||||
if ('' === $currencyCode && $currencyId === 0) {
|
if ('' === $currencyCode && $currencyId === 0) {
|
||||||
Log::warning('Cannot find anything on empty currency code and empty currency ID!');
|
Log::warning('Cannot find anything on empty currency code and empty currency ID!');
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,12 +97,12 @@ class TransactionFactory
|
|||||||
$description = $journal->description === $data['description'] ? null : $data['description'];
|
$description = $journal->description === $data['description'] ? null : $data['description'];
|
||||||
|
|
||||||
// type of source account depends on journal type:
|
// type of source account depends on journal type:
|
||||||
$sourceType = $this->accountType($journal, 'source');
|
$sourceType = $this->accountType($journal, 'source');
|
||||||
Log::debug(sprintf('Expect source account to be of type %s', $sourceType));
|
Log::debug(sprintf('Expect source account to be of type %s', $sourceType));
|
||||||
$sourceAccount = $this->findAccount($sourceType, $data['source_id'], $data['source_name']);
|
$sourceAccount = $this->findAccount($sourceType, $data['source_id'], $data['source_name']);
|
||||||
|
|
||||||
// same for destination account:
|
// same for destination account:
|
||||||
$destinationType = $this->accountType($journal, 'destination');
|
$destinationType = $this->accountType($journal, 'destination');
|
||||||
Log::debug(sprintf('Expect source destination to be of type %s', $destinationType));
|
Log::debug(sprintf('Expect source destination to be of type %s', $destinationType));
|
||||||
$destinationAccount = $this->findAccount($destinationType, $data['destination_id'], $data['destination_name']);
|
$destinationAccount = $this->findAccount($destinationType, $data['destination_id'], $data['destination_name']);
|
||||||
// first make a "negative" (source) transaction based on the data in the array.
|
// first make a "negative" (source) transaction based on the data in the array.
|
||||||
|
@ -28,7 +28,6 @@ use Exception;
|
|||||||
use FireflyIII\Mail\AccessTokenCreatedMail;
|
use FireflyIII\Mail\AccessTokenCreatedMail;
|
||||||
use FireflyIII\Repositories\User\UserRepositoryInterface;
|
use FireflyIII\Repositories\User\UserRepositoryInterface;
|
||||||
use Laravel\Passport\Events\AccessTokenCreated;
|
use Laravel\Passport\Events\AccessTokenCreated;
|
||||||
use Laravel\Passport\Token;
|
|
||||||
use Log;
|
use Log;
|
||||||
use Mail;
|
use Mail;
|
||||||
use Request;
|
use Request;
|
||||||
|
@ -37,14 +37,14 @@ interface AttachmentHelperInterface
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getAttachmentLocation(Attachment $attachment): string;
|
public function getAttachmentContent(Attachment $attachment): string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Attachment $attachment
|
* @param Attachment $attachment
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getAttachmentContent(Attachment $attachment): string;
|
public function getAttachmentLocation(Attachment $attachment): string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Collection
|
* @return Collection
|
||||||
|
@ -96,7 +96,7 @@ class BudgetController extends Controller
|
|||||||
// if today is between start and end, use the diff in days between end and today (days left)
|
// if today is between start and end, use the diff in days between end and today (days left)
|
||||||
// otherwise, use diff between start and end.
|
// otherwise, use diff between start and end.
|
||||||
$today = new Carbon;
|
$today = new Carbon;
|
||||||
Log::debug(sprintf('Start is %s, end is %s, today is %s', $start->format('Y-m-d'), $end->format('Y-m-d'),$today->format('Y-m-d')));
|
Log::debug(sprintf('Start is %s, end is %s, today is %s', $start->format('Y-m-d'), $end->format('Y-m-d'), $today->format('Y-m-d')));
|
||||||
if ($today->gte($start) && $today->lte($end)) {
|
if ($today->gte($start) && $today->lte($end)) {
|
||||||
$days = $end->diffInDays($today);
|
$days = $end->diffInDays($today);
|
||||||
$daysInMonth = $start->diffInDays($today);
|
$daysInMonth = $start->diffInDays($today);
|
||||||
|
@ -111,10 +111,12 @@ class DebugController extends Controller
|
|||||||
|
|
||||||
return view(
|
return view(
|
||||||
'debug', compact(
|
'debug', compact(
|
||||||
'phpVersion', 'extensions', 'localeAttempts', 'appEnv', 'appDebug', 'appLog', 'appLogLevel', 'now', 'packages', 'drivers', 'currentDriver',
|
'phpVersion', 'extensions', 'localeAttempts', 'appEnv', 'appDebug', 'appLog', 'appLogLevel', 'now', 'packages', 'drivers',
|
||||||
'userAgent', 'displayErrors', 'errorReporting', 'phpOs', 'interface', 'logContent', 'cacheDriver', 'isDocker', 'isSandstorm', 'trustedProxies',
|
'currentDriver',
|
||||||
'toSandbox'
|
'userAgent', 'displayErrors', 'errorReporting', 'phpOs', 'interface', 'logContent', 'cacheDriver', 'isDocker', 'isSandstorm',
|
||||||
)
|
'trustedProxies',
|
||||||
|
'toSandbox'
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,13 +23,11 @@ declare(strict_types=1);
|
|||||||
namespace FireflyIII\Http\Controllers;
|
namespace FireflyIII\Http\Controllers;
|
||||||
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use ExpandedForm;
|
|
||||||
use FireflyIII\Exceptions\FireflyException;
|
use FireflyIII\Exceptions\FireflyException;
|
||||||
use FireflyIII\Http\Requests\RuleFormRequest;
|
use FireflyIII\Http\Requests\RuleFormRequest;
|
||||||
use FireflyIII\Http\Requests\SelectTransactionsRequest;
|
use FireflyIII\Http\Requests\SelectTransactionsRequest;
|
||||||
use FireflyIII\Http\Requests\TestRuleFormRequest;
|
use FireflyIII\Http\Requests\TestRuleFormRequest;
|
||||||
use FireflyIII\Jobs\ExecuteRuleOnExistingTransactions;
|
use FireflyIII\Jobs\ExecuteRuleOnExistingTransactions;
|
||||||
use FireflyIII\Models\AccountType;
|
|
||||||
use FireflyIII\Models\Bill;
|
use FireflyIII\Models\Bill;
|
||||||
use FireflyIII\Models\Rule;
|
use FireflyIII\Models\Rule;
|
||||||
use FireflyIII\Models\RuleAction;
|
use FireflyIII\Models\RuleAction;
|
||||||
@ -331,11 +329,11 @@ class RuleController extends Controller
|
|||||||
public function selectTransactions(Rule $rule)
|
public function selectTransactions(Rule $rule)
|
||||||
{
|
{
|
||||||
// does the user have shared accounts?
|
// does the user have shared accounts?
|
||||||
$first = session('first')->format('Y-m-d');
|
$first = session('first')->format('Y-m-d');
|
||||||
$today = Carbon::create()->format('Y-m-d');
|
$today = Carbon::create()->format('Y-m-d');
|
||||||
$subTitle = (string)trans('firefly.apply_rule_selection', ['title' => $rule->title]);
|
$subTitle = (string)trans('firefly.apply_rule_selection', ['title' => $rule->title]);
|
||||||
|
|
||||||
return view('rules.rule.select-transactions', compact( 'first', 'today', 'rule', 'subTitle'));
|
return view('rules.rule.select-transactions', compact('first', 'today', 'rule', 'subTitle'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -429,6 +427,7 @@ class RuleController extends Controller
|
|||||||
Log::error(sprintf('Could not render view in testTriggers(): %s', $exception->getMessage()));
|
Log::error(sprintf('Could not render view in testTriggers(): %s', $exception->getMessage()));
|
||||||
Log::error($exception->getTraceAsString());
|
Log::error($exception->getTraceAsString());
|
||||||
}
|
}
|
||||||
|
|
||||||
// @codeCoverageIgnoreEnd
|
// @codeCoverageIgnoreEnd
|
||||||
|
|
||||||
return response()->json(['html' => $view, 'warning' => $warning]);
|
return response()->json(['html' => $view, 'warning' => $warning]);
|
||||||
@ -490,6 +489,7 @@ class RuleController extends Controller
|
|||||||
Log::error(sprintf('Could not render view in testTriggersByRule(): %s', $exception->getMessage()));
|
Log::error(sprintf('Could not render view in testTriggersByRule(): %s', $exception->getMessage()));
|
||||||
Log::error($exception->getTraceAsString());
|
Log::error($exception->getTraceAsString());
|
||||||
}
|
}
|
||||||
|
|
||||||
// @codeCoverageIgnoreEnd
|
// @codeCoverageIgnoreEnd
|
||||||
|
|
||||||
return response()->json(['html' => $view, 'warning' => $warning]);
|
return response()->json(['html' => $view, 'warning' => $warning]);
|
||||||
@ -600,6 +600,7 @@ class RuleController extends Controller
|
|||||||
Log::error(sprintf('Throwable was thrown in getActionsForBill(): %s', $e->getMessage()));
|
Log::error(sprintf('Throwable was thrown in getActionsForBill(): %s', $e->getMessage()));
|
||||||
Log::error($e->getTraceAsString());
|
Log::error($e->getTraceAsString());
|
||||||
}
|
}
|
||||||
|
|
||||||
// @codeCoverageIgnoreEnd
|
// @codeCoverageIgnoreEnd
|
||||||
|
|
||||||
return $actions;
|
return $actions;
|
||||||
@ -809,6 +810,7 @@ class RuleController extends Controller
|
|||||||
Log::debug(sprintf('Throwable was thrown in getTriggersForBill(): %s', $e->getMessage()));
|
Log::debug(sprintf('Throwable was thrown in getTriggersForBill(): %s', $e->getMessage()));
|
||||||
Log::debug($e->getTraceAsString());
|
Log::debug($e->getTraceAsString());
|
||||||
}
|
}
|
||||||
|
|
||||||
// @codeCoverageIgnoreEnd
|
// @codeCoverageIgnoreEnd
|
||||||
|
|
||||||
return $triggers;
|
return $triggers;
|
||||||
|
@ -87,7 +87,7 @@ class BulkController extends Controller
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param BulkEditJournalRequest $request
|
* @param BulkEditJournalRequest $request
|
||||||
*
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
|
@ -98,8 +98,9 @@ class ConvertController extends Controller
|
|||||||
|
|
||||||
return view(
|
return view(
|
||||||
'transactions.convert', compact(
|
'transactions.convert', compact(
|
||||||
'sourceType', 'destinationType', 'journal', 'positiveAmount', 'sourceAccount', 'destinationAccount', 'sourceType', 'subTitle', 'subTitleIcon'
|
'sourceType', 'destinationType', 'journal', 'positiveAmount', 'sourceAccount', 'destinationAccount', 'sourceType',
|
||||||
)
|
'subTitle', 'subTitleIcon'
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,7 +24,6 @@ namespace FireflyIII\Http\Controllers\Transaction;
|
|||||||
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use FireflyIII\Helpers\Collector\JournalCollectorInterface;
|
use FireflyIII\Helpers\Collector\JournalCollectorInterface;
|
||||||
use FireflyIII\Helpers\Filter\NegativeAmountFilter;
|
|
||||||
use FireflyIII\Helpers\Filter\TransactionViewFilter;
|
use FireflyIII\Helpers\Filter\TransactionViewFilter;
|
||||||
use FireflyIII\Http\Controllers\Controller;
|
use FireflyIII\Http\Controllers\Controller;
|
||||||
use FireflyIII\Http\Requests\MassDeleteJournalRequest;
|
use FireflyIII\Http\Requests\MassDeleteJournalRequest;
|
||||||
@ -37,10 +36,9 @@ use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
|
|||||||
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
||||||
use FireflyIII\Transformers\TransactionTransformer;
|
use FireflyIII\Transformers\TransactionTransformer;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
|
use Illuminate\View\View as IlluminateView;
|
||||||
use Preferences;
|
use Preferences;
|
||||||
use Symfony\Component\HttpFoundation\ParameterBag;
|
use Symfony\Component\HttpFoundation\ParameterBag;
|
||||||
use View;
|
|
||||||
use Illuminate\View\View as IlluminateView;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class MassController.
|
* Class MassController.
|
||||||
@ -155,10 +153,11 @@ class MassController extends Controller
|
|||||||
// transform to array
|
// transform to array
|
||||||
$transactions = $collection->map(
|
$transactions = $collection->map(
|
||||||
function (Transaction $transaction) use ($transformer) {
|
function (Transaction $transaction) use ($transformer) {
|
||||||
$transaction= $transformer->transform($transaction);
|
$transaction = $transformer->transform($transaction);
|
||||||
// make sure amount is positive:
|
// make sure amount is positive:
|
||||||
$transaction['amount'] = app('steam')->positive((string)$transaction['amount']);
|
$transaction['amount'] = app('steam')->positive((string)$transaction['amount']);
|
||||||
$transaction['foreign_amount'] = app('steam')->positive((string)$transaction['foreign_amount']);
|
$transaction['foreign_amount'] = app('steam')->positive((string)$transaction['foreign_amount']);
|
||||||
|
|
||||||
return $transaction;
|
return $transaction;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -62,12 +62,12 @@ class PiggyBankFormRequest extends Request
|
|||||||
}
|
}
|
||||||
|
|
||||||
$rules = [
|
$rules = [
|
||||||
'name' => $nameRule,
|
'name' => $nameRule,
|
||||||
'account_id' => 'required|belongsToUser:accounts',
|
'account_id' => 'required|belongsToUser:accounts',
|
||||||
'targetamount' => 'required|numeric|more:0',
|
'targetamount' => 'required|numeric|more:0',
|
||||||
'startdate' => 'date',
|
'startdate' => 'date',
|
||||||
'targetdate' => 'date|nullable',
|
'targetdate' => 'date|nullable',
|
||||||
'order' => 'integer|min:1',
|
'order' => 'integer|min:1',
|
||||||
];
|
];
|
||||||
|
|
||||||
return $rules;
|
return $rules;
|
||||||
|
@ -109,23 +109,23 @@ class SplitJournalFormRequest extends Request
|
|||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'what' => 'required|in:withdrawal,deposit,transfer',
|
'what' => 'required|in:withdrawal,deposit,transfer',
|
||||||
'journal_description' => 'required|between:1,255',
|
'journal_description' => 'required|between:1,255',
|
||||||
'id' => 'numeric|belongsToUser:transaction_journals,id',
|
'id' => 'numeric|belongsToUser:transaction_journals,id',
|
||||||
'journal_source_account_id' => 'numeric|belongsToUser:accounts,id',
|
'journal_source_account_id' => 'numeric|belongsToUser:accounts,id',
|
||||||
'journal_source_account_name.*' => 'between:1,255',
|
'journal_source_account_name.*' => 'between:1,255',
|
||||||
'journal_currency_id' => 'required|exists:transaction_currencies,id',
|
'journal_currency_id' => 'required|exists:transaction_currencies,id',
|
||||||
'date' => 'required|date',
|
'date' => 'required|date',
|
||||||
'interest_date' => 'date|nullable',
|
'interest_date' => 'date|nullable',
|
||||||
'book_date' => 'date|nullable',
|
'book_date' => 'date|nullable',
|
||||||
'process_date' => 'date|nullable',
|
'process_date' => 'date|nullable',
|
||||||
'transactions.*.transaction_description' => 'required|between:1,255',
|
'transactions.*.transaction_description' => 'required|between:1,255',
|
||||||
'transactions.*.destination_account_id' => 'numeric|belongsToUser:accounts,id',
|
'transactions.*.destination_account_id' => 'numeric|belongsToUser:accounts,id',
|
||||||
'transactions.*.destination_name' => 'between:1,255|nullable',
|
'transactions.*.destination_name' => 'between:1,255|nullable',
|
||||||
'transactions.*.amount' => 'required|numeric',
|
'transactions.*.amount' => 'required|numeric',
|
||||||
'transactions.*.budget_id' => 'belongsToUser:budgets,id',
|
'transactions.*.budget_id' => 'belongsToUser:budgets,id',
|
||||||
'transactions.*.category_name' => 'between:1,255|nullable',
|
'transactions.*.category_name' => 'between:1,255|nullable',
|
||||||
'transactions.*.piggy_bank_id' => 'between:1,255|nullable',
|
'transactions.*.piggy_bank_id' => 'between:1,255|nullable',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ class RabobankDebitCredit implements ConverterInterface
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
// old format:
|
// old format:
|
||||||
if('A' === $value) {
|
if ('A' === $value) {
|
||||||
Log::debug('Return -1');
|
Log::debug('Return -1');
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -106,6 +106,7 @@ class FakeJobConfiguration implements JobConfigurationInterface
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the data required for the next step in the job configuration.
|
* Return the data required for the next step in the job configuration.
|
||||||
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
@ -144,6 +145,7 @@ class FakeJobConfiguration implements JobConfigurationInterface
|
|||||||
if (strtolower($album) !== 'station to station' && $this->importJob->stage !== 'new') {
|
if (strtolower($album) !== 'station to station' && $this->importJob->stage !== 'new') {
|
||||||
return 'import.fake.enter-album';
|
return 'import.fake.enter-album';
|
||||||
}
|
}
|
||||||
|
|
||||||
return 'impossible-view'; // @codeCoverageIgnore
|
return 'impossible-view'; // @codeCoverageIgnore
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -152,7 +154,7 @@ class FakeJobConfiguration implements JobConfigurationInterface
|
|||||||
*/
|
*/
|
||||||
public function setImportJob(ImportJob $importJob): void
|
public function setImportJob(ImportJob $importJob): void
|
||||||
{
|
{
|
||||||
$this->importJob = $importJob;
|
$this->importJob = $importJob;
|
||||||
$this->repository = app(ImportJobRepositoryInterface::class);
|
$this->repository = app(ImportJobRepositoryInterface::class);
|
||||||
$this->repository->setUser($importJob->user);
|
$this->repository->setUser($importJob->user);
|
||||||
}
|
}
|
||||||
|
@ -28,10 +28,10 @@ namespace FireflyIII\Import\JobConfiguration;
|
|||||||
use FireflyIII\Exceptions\FireflyException;
|
use FireflyIII\Exceptions\FireflyException;
|
||||||
use FireflyIII\Models\ImportJob;
|
use FireflyIII\Models\ImportJob;
|
||||||
use FireflyIII\Repositories\ImportJob\ImportJobRepositoryInterface;
|
use FireflyIII\Repositories\ImportJob\ImportJobRepositoryInterface;
|
||||||
use FireflyIII\Support\Import\JobConfiguration\File\FileConfigurationInterface;
|
|
||||||
use FireflyIII\Support\Import\JobConfiguration\File\ConfigureMappingHandler;
|
use FireflyIII\Support\Import\JobConfiguration\File\ConfigureMappingHandler;
|
||||||
use FireflyIII\Support\Import\JobConfiguration\File\ConfigureRolesHandler;
|
use FireflyIII\Support\Import\JobConfiguration\File\ConfigureRolesHandler;
|
||||||
use FireflyIII\Support\Import\JobConfiguration\File\ConfigureUploadHandler;
|
use FireflyIII\Support\Import\JobConfiguration\File\ConfigureUploadHandler;
|
||||||
|
use FireflyIII\Support\Import\JobConfiguration\File\FileConfigurationInterface;
|
||||||
use FireflyIII\Support\Import\JobConfiguration\File\NewFileJobHandler;
|
use FireflyIII\Support\Import\JobConfiguration\File\NewFileJobHandler;
|
||||||
use Illuminate\Support\MessageBag;
|
use Illuminate\Support\MessageBag;
|
||||||
|
|
||||||
@ -120,7 +120,7 @@ class FileJobConfiguration implements JobConfigurationInterface
|
|||||||
*/
|
*/
|
||||||
public function setImportJob(ImportJob $importJob): void
|
public function setImportJob(ImportJob $importJob): void
|
||||||
{
|
{
|
||||||
$this->importJob = $importJob;
|
$this->importJob = $importJob;
|
||||||
$this->repository = app(ImportJobRepositoryInterface::class);
|
$this->repository = app(ImportJobRepositoryInterface::class);
|
||||||
$this->repository->setUser($importJob->user);
|
$this->repository->setUser($importJob->user);
|
||||||
}
|
}
|
||||||
|
@ -119,7 +119,7 @@ class BunqPrerequisites implements PrerequisitesInterface
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
/** @var ApiContext $object */
|
/** @var ApiContext $object */
|
||||||
$object = app(ApiContext::class);
|
$object = app(ApiContext::class);
|
||||||
$apiContext = $object->create($environment, $apiKey, $deviceDescription, $permittedIps);
|
$apiContext = $object->create($environment, $apiKey, $deviceDescription, $permittedIps);
|
||||||
} catch (FireflyException $e) {
|
} catch (FireflyException $e) {
|
||||||
$messages = new MessageBag();
|
$messages = new MessageBag();
|
||||||
|
@ -23,7 +23,6 @@ declare(strict_types=1);
|
|||||||
namespace FireflyIII\Import\Prerequisites;
|
namespace FireflyIII\Import\Prerequisites;
|
||||||
|
|
||||||
use FireflyIII\User;
|
use FireflyIII\User;
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use Illuminate\Support\MessageBag;
|
use Illuminate\Support\MessageBag;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -23,7 +23,6 @@ declare(strict_types=1);
|
|||||||
namespace FireflyIII\Import\Prerequisites;
|
namespace FireflyIII\Import\Prerequisites;
|
||||||
|
|
||||||
use FireflyIII\User;
|
use FireflyIII\User;
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use Illuminate\Support\MessageBag;
|
use Illuminate\Support\MessageBag;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -25,8 +25,8 @@ namespace FireflyIII\Import\Routine;
|
|||||||
use FireflyIII\Exceptions\FireflyException;
|
use FireflyIII\Exceptions\FireflyException;
|
||||||
use FireflyIII\Models\ImportJob;
|
use FireflyIII\Models\ImportJob;
|
||||||
use FireflyIII\Repositories\ImportJob\ImportJobRepositoryInterface;
|
use FireflyIII\Repositories\ImportJob\ImportJobRepositoryInterface;
|
||||||
use FireflyIII\Support\Import\Routine\Spectre\StageImportDataHandler;
|
|
||||||
use FireflyIII\Support\Import\Routine\Spectre\StageAuthenticatedHandler;
|
use FireflyIII\Support\Import\Routine\Spectre\StageAuthenticatedHandler;
|
||||||
|
use FireflyIII\Support\Import\Routine\Spectre\StageImportDataHandler;
|
||||||
use FireflyIII\Support\Import\Routine\Spectre\StageNewHandler;
|
use FireflyIII\Support\Import\Routine\Spectre\StageNewHandler;
|
||||||
use Log;
|
use Log;
|
||||||
|
|
||||||
|
@ -215,7 +215,7 @@ class ImportArrayStorage
|
|||||||
$collector = app(JournalCollectorInterface::class);
|
$collector = app(JournalCollectorInterface::class);
|
||||||
$collector->setUser($this->importJob->user);
|
$collector->setUser($this->importJob->user);
|
||||||
$collector->setAllAssetAccounts()
|
$collector->setAllAssetAccounts()
|
||||||
->ignoreCache()
|
->ignoreCache()
|
||||||
->setTypes([TransactionType::TRANSFER])
|
->setTypes([TransactionType::TRANSFER])
|
||||||
->withOpposingAccount();
|
->withOpposingAccount();
|
||||||
$collector->removeFilter(InternalTransferFilter::class);
|
$collector->removeFilter(InternalTransferFilter::class);
|
||||||
|
@ -38,9 +38,9 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
|||||||
/**
|
/**
|
||||||
* Class Account.
|
* Class Account.
|
||||||
*
|
*
|
||||||
* @property int $id
|
* @property int $id
|
||||||
* @property string $name
|
* @property string $name
|
||||||
* @property string $iban
|
* @property string $iban
|
||||||
* @property AccountType $accountType
|
* @property AccountType $accountType
|
||||||
*/
|
*/
|
||||||
class Account extends Model
|
class Account extends Model
|
||||||
|
@ -24,7 +24,6 @@ namespace FireflyIII\Models;
|
|||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
use FireflyIII\Models\Account;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class AccountMeta.
|
* Class AccountMeta.
|
||||||
|
@ -24,10 +24,10 @@ namespace FireflyIII\Models;
|
|||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||||
use FireflyIII\Models\Account;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class AccountType.
|
* Class AccountType.
|
||||||
|
*
|
||||||
* @property string $type
|
* @property string $type
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -23,12 +23,12 @@ declare(strict_types=1);
|
|||||||
namespace FireflyIII\Models;
|
namespace FireflyIII\Models;
|
||||||
|
|
||||||
use Crypt;
|
use Crypt;
|
||||||
|
use FireflyIII\User;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
use Illuminate\Database\Eloquent\Relations\MorphTo;
|
use Illuminate\Database\Eloquent\Relations\MorphTo;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||||
use FireflyIII\User;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Attachment.
|
* Class Attachment.
|
||||||
|
@ -22,11 +22,10 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Models;
|
namespace FireflyIII\Models;
|
||||||
|
|
||||||
|
use FireflyIII\User;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
use FireflyIII\User;
|
|
||||||
use FireflyIII\Models\TransactionCurrency;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class AvailableBudget.
|
* Class AvailableBudget.
|
||||||
|
@ -23,14 +23,11 @@ declare(strict_types=1);
|
|||||||
namespace FireflyIII\Models;
|
namespace FireflyIII\Models;
|
||||||
|
|
||||||
use Crypt;
|
use Crypt;
|
||||||
|
use FireflyIII\User;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||||
use FireflyIII\User;
|
|
||||||
use FireflyIII\Models\Transaction;
|
|
||||||
use FireflyIII\Models\TransactionJournal;
|
|
||||||
use FireflyIII\Models\BudgetLimit;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Budget.
|
* Class Budget.
|
||||||
|
@ -24,7 +24,6 @@ namespace FireflyIII\Models;
|
|||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||||
use FireflyIII\Models\Budget;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class BudgetLimit.
|
* Class BudgetLimit.
|
||||||
|
@ -23,13 +23,11 @@ declare(strict_types=1);
|
|||||||
namespace FireflyIII\Models;
|
namespace FireflyIII\Models;
|
||||||
|
|
||||||
use Crypt;
|
use Crypt;
|
||||||
|
use FireflyIII\User;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||||
use FireflyIII\User;
|
|
||||||
use FireflyIII\Models\Transaction;
|
|
||||||
use FireflyIII\Models\TransactionJournal;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Category.
|
* Class Category.
|
||||||
|
@ -29,10 +29,6 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
use Steam;
|
use Steam;
|
||||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||||
use FireflyIII\Models\PiggyBankRepetition;
|
|
||||||
use FireflyIII\Models\PiggyBankEvent;
|
|
||||||
use FireflyIII\Models\Note;
|
|
||||||
use FireflyIII\Models\Account;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class PiggyBank.
|
* Class PiggyBank.
|
||||||
|
@ -23,8 +23,6 @@ declare(strict_types=1);
|
|||||||
namespace FireflyIII\Models;
|
namespace FireflyIII\Models;
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use FireflyIII\Models\TransactionJournal;
|
|
||||||
use FireflyIII\Models\PiggyBank;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class PiggyBankEvent.
|
* Class PiggyBankEvent.
|
||||||
|
@ -25,10 +25,10 @@ namespace FireflyIII\Models;
|
|||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
|
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use FireflyIII\Models\PiggyBank;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class PiggyBankRepetition.
|
* Class PiggyBankRepetition.
|
||||||
|
*
|
||||||
* @property string $currentamount
|
* @property string $currentamount
|
||||||
*/
|
*/
|
||||||
class PiggyBankRepetition extends Model
|
class PiggyBankRepetition extends Model
|
||||||
|
@ -25,15 +25,15 @@ namespace FireflyIII\Models;
|
|||||||
use Crypt;
|
use Crypt;
|
||||||
use Exception;
|
use Exception;
|
||||||
use FireflyIII\Exceptions\FireflyException;
|
use FireflyIII\Exceptions\FireflyException;
|
||||||
|
use FireflyIII\User;
|
||||||
use Illuminate\Contracts\Encryption\DecryptException;
|
use Illuminate\Contracts\Encryption\DecryptException;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Log;
|
use Log;
|
||||||
use FireflyIII\User;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Preference.
|
* Class Preference.
|
||||||
*
|
*
|
||||||
* @property mixed $data
|
* @property mixed $data
|
||||||
* @property string $name
|
* @property string $name
|
||||||
*/
|
*/
|
||||||
class Preference extends Model
|
class Preference extends Model
|
||||||
|
@ -22,9 +22,9 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Models;
|
namespace FireflyIII\Models;
|
||||||
|
|
||||||
|
use FireflyIII\User;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||||
use FireflyIII\User;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Role.
|
* Class Role.
|
||||||
|
@ -22,18 +22,16 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Models;
|
namespace FireflyIII\Models;
|
||||||
|
|
||||||
|
use FireflyIII\User;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||||
use FireflyIII\User;
|
|
||||||
use FireflyIII\Models\RuleTrigger;
|
|
||||||
use FireflyIII\Models\RuleGroup;
|
|
||||||
use FireflyIII\Models\RuleAction;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Rule.
|
* Class Rule.
|
||||||
* @property bool $stop_processing
|
*
|
||||||
* @property int $id
|
* @property bool $stop_processing
|
||||||
|
* @property int $id
|
||||||
* @property \Illuminate\Support\Collection $ruleTriggers
|
* @property \Illuminate\Support\Collection $ruleTriggers
|
||||||
*/
|
*/
|
||||||
class Rule extends Model
|
class Rule extends Model
|
||||||
@ -56,7 +54,7 @@ class Rule extends Model
|
|||||||
'strict' => 'boolean',
|
'strict' => 'boolean',
|
||||||
];
|
];
|
||||||
/** @var array */
|
/** @var array */
|
||||||
protected $fillable = ['rule_group_id', 'order', 'active', 'title', 'description', 'user_id','strict'];
|
protected $fillable = ['rule_group_id', 'order', 'active', 'title', 'description', 'user_id', 'strict'];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $value
|
* @param string $value
|
||||||
|
@ -23,7 +23,6 @@ declare(strict_types=1);
|
|||||||
namespace FireflyIII\Models;
|
namespace FireflyIII\Models;
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use FireflyIII\Models\Rule;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class RuleAction.
|
* Class RuleAction.
|
||||||
|
@ -22,14 +22,14 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Models;
|
namespace FireflyIII\Models;
|
||||||
|
|
||||||
|
use FireflyIII\User;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||||
use FireflyIII\User;
|
|
||||||
use FireflyIII\Models\Rule;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class RuleGroup.
|
* Class RuleGroup.
|
||||||
|
*
|
||||||
* @property bool $active
|
* @property bool $active
|
||||||
*/
|
*/
|
||||||
class RuleGroup extends Model
|
class RuleGroup extends Model
|
||||||
|
@ -23,19 +23,18 @@ declare(strict_types=1);
|
|||||||
namespace FireflyIII\Models;
|
namespace FireflyIII\Models;
|
||||||
|
|
||||||
use Crypt;
|
use Crypt;
|
||||||
|
use FireflyIII\User;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||||
use FireflyIII\User;
|
|
||||||
use FireflyIII\Models\TransactionJournal;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Tag.
|
* Class Tag.
|
||||||
*
|
*
|
||||||
* @property Collection $transactionJournals
|
* @property Collection $transactionJournals
|
||||||
* @property string $tag
|
* @property string $tag
|
||||||
* @property int $id
|
* @property int $id
|
||||||
* @property \Carbon\Carbon $date
|
* @property \Carbon\Carbon $date
|
||||||
*/
|
*/
|
||||||
class Tag extends Model
|
class Tag extends Model
|
||||||
|
@ -71,7 +71,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
|||||||
* @property string $description
|
* @property string $description
|
||||||
* @property bool $is_split
|
* @property bool $is_split
|
||||||
* @property int $attachmentCount
|
* @property int $attachmentCount
|
||||||
* @property int $transaction_currency_id
|
* @property int $transaction_currency_id
|
||||||
*/
|
*/
|
||||||
class Transaction extends Model
|
class Transaction extends Model
|
||||||
{
|
{
|
||||||
|
@ -25,13 +25,12 @@ namespace FireflyIII\Models;
|
|||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||||
use FireflyIII\Models\TransactionJournal;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class TransactionCurrency.
|
* Class TransactionCurrency.
|
||||||
*
|
*
|
||||||
* @property string $code
|
* @property string $code
|
||||||
* @property int $decimal_places
|
* @property int $decimal_places
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class TransactionCurrency extends Model
|
class TransactionCurrency extends Model
|
||||||
|
@ -35,23 +35,12 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
|||||||
use Log;
|
use Log;
|
||||||
use Preferences;
|
use Preferences;
|
||||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||||
use FireflyIII\Models\Transaction;
|
|
||||||
use FireflyIII\Models\TransactionType;
|
|
||||||
use FireflyIII\Models\TransactionJournalMeta;
|
|
||||||
use FireflyIII\Models\TransactionCurrency;
|
|
||||||
use FireflyIII\Models\Tag;
|
|
||||||
use FireflyIII\Models\PiggyBankEvent;
|
|
||||||
use FireflyIII\Models\Note;
|
|
||||||
use FireflyIII\Models\Category;
|
|
||||||
use FireflyIII\Models\Budget;
|
|
||||||
use FireflyIII\Models\Bill;
|
|
||||||
use FireflyIII\Models\Attachment;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class TransactionJournal.
|
* Class TransactionJournal.
|
||||||
*
|
*
|
||||||
* @property User $user
|
* @property User $user
|
||||||
* @property int $bill_id
|
* @property int $bill_id
|
||||||
*/
|
*/
|
||||||
class TransactionJournal extends Model
|
class TransactionJournal extends Model
|
||||||
{
|
{
|
||||||
|
@ -25,12 +25,12 @@ namespace FireflyIII\Models;
|
|||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
use FireflyIII\Models\TransactionJournal;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class TransactionJournalMeta.
|
* Class TransactionJournalMeta.
|
||||||
|
*
|
||||||
* @property string $name
|
* @property string $name
|
||||||
* @property int $transaction_journal_id
|
* @property int $transaction_journal_id
|
||||||
*/
|
*/
|
||||||
class TransactionJournalMeta extends Model
|
class TransactionJournalMeta extends Model
|
||||||
{
|
{
|
||||||
|
@ -25,10 +25,10 @@ namespace FireflyIII\Models;
|
|||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||||
use FireflyIII\Models\TransactionJournal;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class TransactionType.
|
* Class TransactionType.
|
||||||
|
*
|
||||||
* @property string $type
|
* @property string $type
|
||||||
*/
|
*/
|
||||||
class TransactionType extends Model
|
class TransactionType extends Model
|
||||||
|
@ -58,6 +58,7 @@ trait FindAccountsTrait
|
|||||||
/**
|
/**
|
||||||
* @param string $number
|
* @param string $number
|
||||||
* @param array $types
|
* @param array $types
|
||||||
|
*
|
||||||
* @return Account|null
|
* @return Account|null
|
||||||
*/
|
*/
|
||||||
public function findByAccountNumber(string $number, array $types): ?Account
|
public function findByAccountNumber(string $number, array $types): ?Account
|
||||||
|
@ -35,15 +35,6 @@ use Illuminate\Support\Collection;
|
|||||||
interface BudgetRepositoryInterface
|
interface BudgetRepositoryInterface
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
|
||||||
* Get all budgets with these ID's.
|
|
||||||
*
|
|
||||||
* @param array $budgetIds
|
|
||||||
*
|
|
||||||
* @return Collection
|
|
||||||
*/
|
|
||||||
public function getByIds(array $budgetIds): Collection;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A method that returns the amount of money budgeted per day for this budget,
|
* A method that returns the amount of money budgeted per day for this budget,
|
||||||
* on average.
|
* on average.
|
||||||
@ -174,6 +165,15 @@ interface BudgetRepositoryInterface
|
|||||||
*/
|
*/
|
||||||
public function getBudgets(): Collection;
|
public function getBudgets(): Collection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get all budgets with these ID's.
|
||||||
|
*
|
||||||
|
* @param array $budgetIds
|
||||||
|
*
|
||||||
|
* @return Collection
|
||||||
|
*/
|
||||||
|
public function getByIds(array $budgetIds): Collection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Collection
|
* @return Collection
|
||||||
*/
|
*/
|
||||||
|
@ -360,6 +360,7 @@ class ImportJobRepository implements ImportJobRepositoryInterface
|
|||||||
$newConfig = array_merge($currentConfig, $configuration);
|
$newConfig = array_merge($currentConfig, $configuration);
|
||||||
$job->configuration = $newConfig;
|
$job->configuration = $newConfig;
|
||||||
$job->save();
|
$job->save();
|
||||||
|
|
||||||
//Log::debug(sprintf('Set config of job "%s" to: ', $job->key), $newConfig);
|
//Log::debug(sprintf('Set config of job "%s" to: ', $job->key), $newConfig);
|
||||||
|
|
||||||
return $job;
|
return $job;
|
||||||
|
@ -36,52 +36,13 @@ use Symfony\Component\HttpFoundation\File\UploadedFile;
|
|||||||
interface ImportJobRepositoryInterface
|
interface ImportJobRepositoryInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Return all attachments for job.
|
|
||||||
*
|
|
||||||
* @param ImportJob $job
|
* @param ImportJob $job
|
||||||
*
|
* @param int $index
|
||||||
* @return Collection
|
* @param string $error
|
||||||
*/
|
|
||||||
public function getAttachments(ImportJob $job): Collection;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handle upload for job.
|
|
||||||
*
|
|
||||||
* @param ImportJob $job
|
|
||||||
* @param string $name
|
|
||||||
* @param UploadedFile $file
|
|
||||||
*
|
|
||||||
* @return MessageBag
|
|
||||||
* @throws FireflyException
|
|
||||||
*/
|
|
||||||
public function storeFileUpload(ImportJob $job, string $name, UploadedFile $file): MessageBag;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Store file.
|
|
||||||
*
|
|
||||||
* @param ImportJob $job
|
|
||||||
* @param string $name
|
|
||||||
* @param string $fileName
|
|
||||||
*
|
|
||||||
* @return MessageBag
|
|
||||||
*/
|
|
||||||
public function storeCLIUpload(ImportJob $job, string $name, string $fileName): MessageBag;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param ImportJob $job
|
|
||||||
* @param array $transactions
|
|
||||||
*
|
*
|
||||||
* @return ImportJob
|
* @return ImportJob
|
||||||
*/
|
*/
|
||||||
public function setTransactions(ImportJob $job, array $transactions): ImportJob;
|
public function addError(ImportJob $job, int $index, string $error): ImportJob;
|
||||||
|
|
||||||
/**
|
|
||||||
* @param ImportJob $job
|
|
||||||
* @param Tag $tag
|
|
||||||
*
|
|
||||||
* @return ImportJob
|
|
||||||
*/
|
|
||||||
public function setTag(ImportJob $job, Tag $tag): ImportJob;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add message to job.
|
* Add message to job.
|
||||||
@ -93,15 +54,6 @@ interface ImportJobRepositoryInterface
|
|||||||
*/
|
*/
|
||||||
public function addErrorMessage(ImportJob $job, string $error): ImportJob;
|
public function addErrorMessage(ImportJob $job, string $error): ImportJob;
|
||||||
|
|
||||||
/**
|
|
||||||
* @param ImportJob $job
|
|
||||||
* @param int $index
|
|
||||||
* @param string $error
|
|
||||||
*
|
|
||||||
* @return ImportJob
|
|
||||||
*/
|
|
||||||
public function addError(ImportJob $job, int $index, string $error): ImportJob;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param ImportJob $job
|
* @param ImportJob $job
|
||||||
* @param int $steps
|
* @param int $steps
|
||||||
@ -141,6 +93,15 @@ interface ImportJobRepositoryInterface
|
|||||||
*/
|
*/
|
||||||
public function findByKey(string $key): ImportJob;
|
public function findByKey(string $key): ImportJob;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return all attachments for job.
|
||||||
|
*
|
||||||
|
* @param ImportJob $job
|
||||||
|
*
|
||||||
|
* @return Collection
|
||||||
|
*/
|
||||||
|
public function getAttachments(ImportJob $job): Collection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return configuration of job.
|
* Return configuration of job.
|
||||||
*
|
*
|
||||||
@ -198,14 +159,6 @@ interface ImportJobRepositoryInterface
|
|||||||
*/
|
*/
|
||||||
public function setExtendedStatus(ImportJob $job, array $array): ImportJob;
|
public function setExtendedStatus(ImportJob $job, array $array): ImportJob;
|
||||||
|
|
||||||
/**
|
|
||||||
* @param ImportJob $job
|
|
||||||
* @param string $status
|
|
||||||
*
|
|
||||||
* @return ImportJob
|
|
||||||
*/
|
|
||||||
public function setStatus(ImportJob $job, string $status): ImportJob;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param ImportJob $job
|
* @param ImportJob $job
|
||||||
* @param string $stage
|
* @param string $stage
|
||||||
@ -214,6 +167,14 @@ interface ImportJobRepositoryInterface
|
|||||||
*/
|
*/
|
||||||
public function setStage(ImportJob $job, string $stage): ImportJob;
|
public function setStage(ImportJob $job, string $stage): ImportJob;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param ImportJob $job
|
||||||
|
* @param string $status
|
||||||
|
*
|
||||||
|
* @return ImportJob
|
||||||
|
*/
|
||||||
|
public function setStatus(ImportJob $job, string $status): ImportJob;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param ImportJob $job
|
* @param ImportJob $job
|
||||||
* @param int $steps
|
* @param int $steps
|
||||||
@ -222,6 +183,14 @@ interface ImportJobRepositoryInterface
|
|||||||
*/
|
*/
|
||||||
public function setStepsDone(ImportJob $job, int $steps): ImportJob;
|
public function setStepsDone(ImportJob $job, int $steps): ImportJob;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param ImportJob $job
|
||||||
|
* @param Tag $tag
|
||||||
|
*
|
||||||
|
* @return ImportJob
|
||||||
|
*/
|
||||||
|
public function setTag(ImportJob $job, Tag $tag): ImportJob;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param ImportJob $job
|
* @param ImportJob $job
|
||||||
* @param int $count
|
* @param int $count
|
||||||
@ -230,11 +199,42 @@ interface ImportJobRepositoryInterface
|
|||||||
*/
|
*/
|
||||||
public function setTotalSteps(ImportJob $job, int $count): ImportJob;
|
public function setTotalSteps(ImportJob $job, int $count): ImportJob;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param ImportJob $job
|
||||||
|
* @param array $transactions
|
||||||
|
*
|
||||||
|
* @return ImportJob
|
||||||
|
*/
|
||||||
|
public function setTransactions(ImportJob $job, array $transactions): ImportJob;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param User $user
|
* @param User $user
|
||||||
*/
|
*/
|
||||||
public function setUser(User $user);
|
public function setUser(User $user);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store file.
|
||||||
|
*
|
||||||
|
* @param ImportJob $job
|
||||||
|
* @param string $name
|
||||||
|
* @param string $fileName
|
||||||
|
*
|
||||||
|
* @return MessageBag
|
||||||
|
*/
|
||||||
|
public function storeCLIUpload(ImportJob $job, string $name, string $fileName): MessageBag;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle upload for job.
|
||||||
|
*
|
||||||
|
* @param ImportJob $job
|
||||||
|
* @param string $name
|
||||||
|
* @param UploadedFile $file
|
||||||
|
*
|
||||||
|
* @return MessageBag
|
||||||
|
* @throws FireflyException
|
||||||
|
*/
|
||||||
|
public function storeFileUpload(ImportJob $job, string $name, UploadedFile $file): MessageBag;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param ImportJob $job
|
* @param ImportJob $job
|
||||||
* @param string $status
|
* @param string $status
|
||||||
|
@ -23,7 +23,6 @@ declare(strict_types=1);
|
|||||||
namespace FireflyIII\Repositories\Journal;
|
namespace FireflyIII\Repositories\Journal;
|
||||||
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use DB;
|
|
||||||
use Exception;
|
use Exception;
|
||||||
use FireflyIII\Factory\TransactionJournalFactory;
|
use FireflyIII\Factory\TransactionJournalFactory;
|
||||||
use FireflyIII\Factory\TransactionJournalMetaFactory;
|
use FireflyIII\Factory\TransactionJournalMetaFactory;
|
||||||
|
@ -38,15 +38,6 @@ use Illuminate\Support\MessageBag;
|
|||||||
*/
|
*/
|
||||||
interface JournalRepositoryInterface
|
interface JournalRepositoryInterface
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* Find a journal by its hash.
|
|
||||||
*
|
|
||||||
* @param string $hash
|
|
||||||
*
|
|
||||||
* @return TransactionJournalMeta|null
|
|
||||||
*/
|
|
||||||
public function findByHash(string $hash): ?TransactionJournalMeta;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param TransactionJournal $journal
|
* @param TransactionJournal $journal
|
||||||
* @param TransactionType $type
|
* @param TransactionType $type
|
||||||
@ -77,12 +68,22 @@ interface JournalRepositoryInterface
|
|||||||
* Find a specific journal.
|
* Find a specific journal.
|
||||||
*
|
*
|
||||||
* @param int $journalId
|
* @param int $journalId
|
||||||
|
*
|
||||||
* @deprecated
|
* @deprecated
|
||||||
*
|
*
|
||||||
* @return TransactionJournal
|
* @return TransactionJournal
|
||||||
*/
|
*/
|
||||||
public function find(int $journalId): TransactionJournal;
|
public function find(int $journalId): TransactionJournal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find a journal by its hash.
|
||||||
|
*
|
||||||
|
* @param string $hash
|
||||||
|
*
|
||||||
|
* @return TransactionJournalMeta|null
|
||||||
|
*/
|
||||||
|
public function findByHash(string $hash): ?TransactionJournalMeta;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find a specific journal.
|
* Find a specific journal.
|
||||||
*
|
*
|
||||||
|
@ -334,8 +334,8 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface
|
|||||||
public function getSuggestedMonthlyAmount(PiggyBank $piggyBank): string
|
public function getSuggestedMonthlyAmount(PiggyBank $piggyBank): string
|
||||||
{
|
{
|
||||||
$savePerMonth = '0';
|
$savePerMonth = '0';
|
||||||
$repetition = $this->getRepetition($piggyBank);
|
$repetition = $this->getRepetition($piggyBank);
|
||||||
if(null === $repetition) {
|
if (null === $repetition) {
|
||||||
return $savePerMonth;
|
return $savePerMonth;
|
||||||
}
|
}
|
||||||
if (null !== $piggyBank->targetdate && $repetition->currentamount < $piggyBank->targetamount) {
|
if (null !== $piggyBank->targetdate && $repetition->currentamount < $piggyBank->targetamount) {
|
||||||
|
@ -136,6 +136,16 @@ class TagRepository implements TagRepositoryInterface
|
|||||||
return new Tag;
|
return new Tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int $tagId
|
||||||
|
*
|
||||||
|
* @return Tag|null
|
||||||
|
*/
|
||||||
|
public function findNull(int $tagId): ?Tag
|
||||||
|
{
|
||||||
|
return $this->user->tags()->find($tagId);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Tag $tag
|
* @param Tag $tag
|
||||||
*
|
*
|
||||||
@ -192,6 +202,16 @@ class TagRepository implements TagRepositoryInterface
|
|||||||
return new Carbon;
|
return new Carbon;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Will return the newest tag (if known) or NULL.
|
||||||
|
*
|
||||||
|
* @return Tag|null
|
||||||
|
*/
|
||||||
|
public function newestTag(): ?Tag
|
||||||
|
{
|
||||||
|
return $this->user->tags()->whereNotNull('date')->orderBy('date', 'DESC')->first();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Tag
|
* @return Tag
|
||||||
*/
|
*/
|
||||||
@ -453,23 +473,4 @@ class TagRepository implements TagRepositoryInterface
|
|||||||
|
|
||||||
return (int)($range[0] + $extra);
|
return (int)($range[0] + $extra);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/**
|
|
||||||
* @param int $tagId
|
|
||||||
*
|
|
||||||
* @return Tag|null
|
|
||||||
*/
|
|
||||||
public function findNull(int $tagId): ?Tag
|
|
||||||
{
|
|
||||||
return $this->user->tags()->find($tagId);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Will return the newest tag (if known) or NULL.
|
|
||||||
*
|
|
||||||
* @return Tag|null
|
|
||||||
*/
|
|
||||||
public function newestTag(): ?Tag
|
|
||||||
{
|
|
||||||
return $this->user->tags()->whereNotNull('date')->orderBy('date', 'DESC')->first();
|
|
||||||
}}
|
|
||||||
|
@ -69,12 +69,6 @@ interface TagRepositoryInterface
|
|||||||
/**
|
/**
|
||||||
* @param int $tagId
|
* @param int $tagId
|
||||||
*
|
*
|
||||||
* @return Tag|null
|
|
||||||
*/
|
|
||||||
public function findNull(int $tagId): ?Tag;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param int $tagId
|
|
||||||
* @deprecated
|
* @deprecated
|
||||||
* @return Tag
|
* @return Tag
|
||||||
*/
|
*/
|
||||||
@ -87,6 +81,13 @@ interface TagRepositoryInterface
|
|||||||
*/
|
*/
|
||||||
public function findByTag(string $tag): Tag;
|
public function findByTag(string $tag): Tag;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int $tagId
|
||||||
|
*
|
||||||
|
* @return Tag|null
|
||||||
|
*/
|
||||||
|
public function findNull(int $tagId): ?Tag;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Tag $tag
|
* @param Tag $tag
|
||||||
*
|
*
|
||||||
@ -117,15 +118,18 @@ interface TagRepositoryInterface
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Will return the newest tag (if known) or NULL.
|
* Will return the newest tag (if known) or NULL.
|
||||||
|
*
|
||||||
|
* @return Tag|null
|
||||||
|
*/
|
||||||
|
public function newestTag(): ?Tag;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Will return the newest tag (if known) or NULL.
|
||||||
|
*
|
||||||
* @return Tag|null
|
* @return Tag|null
|
||||||
*/
|
*/
|
||||||
public function oldestTag(): ?Tag;
|
public function oldestTag(): ?Tag;
|
||||||
|
|
||||||
/**
|
|
||||||
* Will return the newest tag (if known) or NULL.
|
|
||||||
* @return Tag|null
|
|
||||||
*/
|
|
||||||
public function newestTag(): ?Tag;
|
|
||||||
/**
|
/**
|
||||||
* @param User $user
|
* @param User $user
|
||||||
*/
|
*/
|
||||||
|
@ -87,9 +87,9 @@ class Attempt extends SpectreObject
|
|||||||
private $successAt;
|
private $successAt;
|
||||||
/** @var Carbon */
|
/** @var Carbon */
|
||||||
private $toDate;
|
private $toDate;
|
||||||
/** @var Carbon */
|
/** @var Carbon */
|
||||||
private $updatedAt; // undocumented
|
private $updatedAt; // undocumented
|
||||||
/** @var string */
|
/** @var string */
|
||||||
private $userAgent;
|
private $userAgent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -28,7 +28,6 @@ use FireflyIII\Models\TransactionType;
|
|||||||
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
||||||
use Illuminate\Routing\Route;
|
use Illuminate\Routing\Route;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use Session;
|
|
||||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -58,7 +57,7 @@ class SimpleJournalList implements BinderInterface
|
|||||||
|
|
||||||
// prep some vars
|
// prep some vars
|
||||||
$messages = [];
|
$messages = [];
|
||||||
$final = new Collection;
|
$final = new Collection;
|
||||||
/** @var JournalRepositoryInterface $repository */
|
/** @var JournalRepositoryInterface $repository */
|
||||||
$repository = app(JournalRepositoryInterface::class);
|
$repository = app(JournalRepositoryInterface::class);
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace FireflyIII\Support\Import\JobConfiguration\Bunq;
|
namespace FireflyIII\Support\Import\JobConfiguration\Bunq;
|
||||||
|
|
||||||
use FireflyIII\Models\ImportJob;
|
use FireflyIII\Models\ImportJob;
|
||||||
use Illuminate\Support\MessageBag;
|
use Illuminate\Support\MessageBag;
|
||||||
|
|
||||||
|
@ -35,61 +35,12 @@ use Log;
|
|||||||
*/
|
*/
|
||||||
class ConfigureUploadHandler implements FileConfigurationInterface
|
class ConfigureUploadHandler implements FileConfigurationInterface
|
||||||
{
|
{
|
||||||
/** @var ImportJob */
|
|
||||||
private $importJob;
|
|
||||||
|
|
||||||
/** @var ImportJobRepositoryInterface */
|
|
||||||
private $repository;
|
|
||||||
|
|
||||||
/** @var AccountRepositoryInterface */
|
/** @var AccountRepositoryInterface */
|
||||||
private $accountRepos;
|
private $accountRepos;
|
||||||
|
/** @var ImportJob */
|
||||||
/**
|
private $importJob;
|
||||||
* Get the data necessary to show the configuration screen.
|
/** @var ImportJobRepositoryInterface */
|
||||||
*
|
private $repository;
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public function getNextData(): array
|
|
||||||
{
|
|
||||||
$delimiters = [
|
|
||||||
',' => trans('form.csv_comma'),
|
|
||||||
';' => trans('form.csv_semicolon'),
|
|
||||||
'tab' => trans('form.csv_tab'),
|
|
||||||
];
|
|
||||||
$config = $this->importJob->configuration;
|
|
||||||
$config['date-format'] = $config['date-format'] ?? 'Ymd';
|
|
||||||
$specifics = [];
|
|
||||||
$this->repository->setConfiguration($this->importJob, $config);
|
|
||||||
|
|
||||||
// collect specifics.
|
|
||||||
foreach (config('csv.import_specifics') as $name => $className) {
|
|
||||||
$specifics[$name] = [
|
|
||||||
'name' => trans($className::getName()),
|
|
||||||
'description' => trans($className::getDescription()),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
$data = [
|
|
||||||
'accounts' => [],
|
|
||||||
'delimiters' => $delimiters,
|
|
||||||
'specifics' => $specifics,
|
|
||||||
];
|
|
||||||
|
|
||||||
return $data;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param ImportJob $importJob
|
|
||||||
*/
|
|
||||||
public function setImportJob(ImportJob $importJob): void
|
|
||||||
{
|
|
||||||
$this->importJob = $importJob;
|
|
||||||
$this->repository = app(ImportJobRepositoryInterface::class);
|
|
||||||
$this->repository->setUser($importJob->user);
|
|
||||||
$this->accountRepos = app(AccountRepositoryInterface::class);
|
|
||||||
$this->accountRepos->setUser($importJob->user);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Store data associated with current stage.
|
* Store data associated with current stage.
|
||||||
@ -137,6 +88,40 @@ class ConfigureUploadHandler implements FileConfigurationInterface
|
|||||||
return new MessageBag;
|
return new MessageBag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the data necessary to show the configuration screen.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getNextData(): array
|
||||||
|
{
|
||||||
|
$delimiters = [
|
||||||
|
',' => trans('form.csv_comma'),
|
||||||
|
';' => trans('form.csv_semicolon'),
|
||||||
|
'tab' => trans('form.csv_tab'),
|
||||||
|
];
|
||||||
|
$config = $this->importJob->configuration;
|
||||||
|
$config['date-format'] = $config['date-format'] ?? 'Ymd';
|
||||||
|
$specifics = [];
|
||||||
|
$this->repository->setConfiguration($this->importJob, $config);
|
||||||
|
|
||||||
|
// collect specifics.
|
||||||
|
foreach (config('csv.import_specifics') as $name => $className) {
|
||||||
|
$specifics[$name] = [
|
||||||
|
'name' => trans($className::getName()),
|
||||||
|
'description' => trans($className::getDescription()),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'accounts' => [],
|
||||||
|
'delimiters' => $delimiters,
|
||||||
|
'specifics' => $specifics,
|
||||||
|
];
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array $data
|
* @param array $data
|
||||||
*
|
*
|
||||||
@ -159,4 +144,17 @@ class ConfigureUploadHandler implements FileConfigurationInterface
|
|||||||
|
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param ImportJob $importJob
|
||||||
|
*/
|
||||||
|
public function setImportJob(ImportJob $importJob): void
|
||||||
|
{
|
||||||
|
$this->importJob = $importJob;
|
||||||
|
$this->repository = app(ImportJobRepositoryInterface::class);
|
||||||
|
$this->repository->setUser($importJob->user);
|
||||||
|
$this->accountRepos = app(AccountRepositoryInterface::class);
|
||||||
|
$this->accountRepos->setUser($importJob->user);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -80,6 +80,7 @@ class NewFileJobHandler implements FileConfigurationInterface
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Get the data necessary to show the configuration screen.
|
* Get the data necessary to show the configuration screen.
|
||||||
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
|
@ -26,12 +26,7 @@ namespace FireflyIII\Support\Import\JobConfiguration\Spectre;
|
|||||||
use FireflyIII\Exceptions\FireflyException;
|
use FireflyIII\Exceptions\FireflyException;
|
||||||
use FireflyIII\Models\ImportJob;
|
use FireflyIII\Models\ImportJob;
|
||||||
use FireflyIII\Repositories\ImportJob\ImportJobRepositoryInterface;
|
use FireflyIII\Repositories\ImportJob\ImportJobRepositoryInterface;
|
||||||
use FireflyIII\Services\Spectre\Object\Customer;
|
|
||||||
use FireflyIII\Services\Spectre\Object\Login;
|
use FireflyIII\Services\Spectre\Object\Login;
|
||||||
use FireflyIII\Services\Spectre\Object\Token;
|
|
||||||
use FireflyIII\Services\Spectre\Request\CreateTokenRequest;
|
|
||||||
use FireflyIII\Services\Spectre\Request\ListCustomersRequest;
|
|
||||||
use FireflyIII\Services\Spectre\Request\NewCustomerRequest;
|
|
||||||
use FireflyIII\Support\Import\Information\GetSpectreCustomerTrait;
|
use FireflyIII\Support\Import\Information\GetSpectreCustomerTrait;
|
||||||
use FireflyIII\Support\Import\Information\GetSpectreTokenTrait;
|
use FireflyIII\Support\Import\Information\GetSpectreTokenTrait;
|
||||||
use Illuminate\Support\MessageBag;
|
use Illuminate\Support\MessageBag;
|
||||||
|
@ -25,6 +25,7 @@ namespace FireflyIII\Support\Import\Placeholder;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Class ColumnValue
|
* Class ColumnValue
|
||||||
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*/
|
*/
|
||||||
class ColumnValue
|
class ColumnValue
|
||||||
|
@ -62,7 +62,7 @@ class CSVProcessor implements FileProcessorInterface
|
|||||||
|
|
||||||
// validate mapped values:
|
// validate mapped values:
|
||||||
/** @var MappedValuesValidator $validator */
|
/** @var MappedValuesValidator $validator */
|
||||||
$validator = app(MappedValuesValidator::class);
|
$validator = app(MappedValuesValidator::class);
|
||||||
$validator->setImportJob($this->importJob);
|
$validator->setImportJob($this->importJob);
|
||||||
$mappedValues = $validator->validate($mappingConverger->getMappedValues());
|
$mappedValues = $validator->validate($mappingConverger->getMappedValues());
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace FireflyIII\Support\Import\Routine\File;
|
namespace FireflyIII\Support\Import\Routine\File;
|
||||||
|
|
||||||
use FireflyIII\Models\ImportJob;
|
use FireflyIII\Models\ImportJob;
|
||||||
|
|
||||||
|
|
||||||
|
@ -164,6 +164,7 @@ class LineReader
|
|||||||
} catch (\League\Csv\Exception $e) {
|
} catch (\League\Csv\Exception $e) {
|
||||||
throw new FireflyException(sprintf('Cannot set delimiter: %s', $e->getMessage()));
|
throw new FireflyException(sprintf('Cannot set delimiter: %s', $e->getMessage()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// @codeCoverageIgnoreEnd
|
// @codeCoverageIgnoreEnd
|
||||||
|
|
||||||
return $reader;
|
return $reader;
|
||||||
|
@ -208,7 +208,7 @@ class Preferences
|
|||||||
/**
|
/**
|
||||||
* @param \FireflyIII\User $user
|
* @param \FireflyIII\User $user
|
||||||
* @param $name
|
* @param $name
|
||||||
* @param mixed $value
|
* @param mixed $value
|
||||||
*
|
*
|
||||||
* @return Preference
|
* @return Preference
|
||||||
*/
|
*/
|
||||||
|
@ -55,7 +55,7 @@ class Steam
|
|||||||
//
|
//
|
||||||
/** @var AccountRepositoryInterface $repository */
|
/** @var AccountRepositoryInterface $repository */
|
||||||
$repository = app(AccountRepositoryInterface::class);
|
$repository = app(AccountRepositoryInterface::class);
|
||||||
$currencyId = (int)$repository->getMetaValue($account, 'currency_id');
|
$currencyId = (int)$repository->getMetaValue($account, 'currency_id');
|
||||||
|
|
||||||
// use system default currency:
|
// use system default currency:
|
||||||
if (0 === $currencyId) {
|
if (0 === $currencyId) {
|
||||||
@ -77,9 +77,9 @@ class Steam
|
|||||||
->where('transactions.transaction_currency_id', '!=', $currencyId)
|
->where('transactions.transaction_currency_id', '!=', $currencyId)
|
||||||
->sum('transactions.foreign_amount');
|
->sum('transactions.foreign_amount');
|
||||||
|
|
||||||
$balance = bcadd($nativeBalance, $foreignBalance);
|
$balance = bcadd($nativeBalance, $foreignBalance);
|
||||||
$virtual = null === $account->virtual_balance ? '0' : (string)$account->virtual_balance;
|
$virtual = null === $account->virtual_balance ? '0' : (string)$account->virtual_balance;
|
||||||
$balance = bcadd($balance, $virtual);
|
$balance = bcadd($balance, $virtual);
|
||||||
$cache->store($balance);
|
$cache->store($balance);
|
||||||
|
|
||||||
return $balance;
|
return $balance;
|
||||||
|
@ -26,11 +26,11 @@ use FireflyIII\Models\AccountType;
|
|||||||
use FireflyIII\Models\Attachment;
|
use FireflyIII\Models\Attachment;
|
||||||
use FireflyIII\Models\Transaction as TransactionModel;
|
use FireflyIII\Models\Transaction as TransactionModel;
|
||||||
use FireflyIII\Models\TransactionCurrency;
|
use FireflyIII\Models\TransactionCurrency;
|
||||||
|
use FireflyIII\Models\TransactionJournal;
|
||||||
use FireflyIII\Models\TransactionType;
|
use FireflyIII\Models\TransactionType;
|
||||||
use Lang;
|
use Lang;
|
||||||
use Log;
|
use Log;
|
||||||
use Twig_Extension;
|
use Twig_Extension;
|
||||||
use FireflyIII\Models\TransactionJournal;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Transaction.
|
* Class Transaction.
|
||||||
|
@ -24,12 +24,12 @@ namespace FireflyIII\Support\Twig;
|
|||||||
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use FireflyIII\Models\Account;
|
use FireflyIII\Models\Account;
|
||||||
|
use FireflyIII\Support\Twig\Extension\Account as AccountExtension;
|
||||||
use League\CommonMark\CommonMarkConverter;
|
use League\CommonMark\CommonMarkConverter;
|
||||||
use Route;
|
use Route;
|
||||||
use Twig_Extension;
|
use Twig_Extension;
|
||||||
use Twig_SimpleFilter;
|
use Twig_SimpleFilter;
|
||||||
use Twig_SimpleFunction;
|
use Twig_SimpleFunction;
|
||||||
use FireflyIII\Support\Twig\Extension\Account as AccountExtension;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class TwigSupport.
|
* Class TwigSupport.
|
||||||
|
@ -58,8 +58,8 @@ class LinkToBill implements ActionInterface
|
|||||||
/** @var BillRepositoryInterface $repository */
|
/** @var BillRepositoryInterface $repository */
|
||||||
$repository = app(BillRepositoryInterface::class);
|
$repository = app(BillRepositoryInterface::class);
|
||||||
$repository->setUser($this->action->rule->user);
|
$repository->setUser($this->action->rule->user);
|
||||||
$billName = (string)$this->action->action_value;
|
$billName = (string)$this->action->action_value;
|
||||||
$bill = $repository->findByName($billName);
|
$bill = $repository->findByName($billName);
|
||||||
|
|
||||||
if (null !== $bill && $journal->transactionType->type === TransactionType::WITHDRAWAL) {
|
if (null !== $bill && $journal->transactionType->type === TransactionType::WITHDRAWAL) {
|
||||||
$journal->bill()->associate($bill);
|
$journal->bill()->associate($bill);
|
||||||
|
@ -101,8 +101,8 @@ class SetDestinationAccount implements ActionInterface
|
|||||||
|
|
||||||
// update destination transaction with new destination account:
|
// update destination transaction with new destination account:
|
||||||
// get destination transaction:
|
// get destination transaction:
|
||||||
$transaction = $journal->transactions()->where('amount', '>', 0)->first();
|
$transaction = $journal->transactions()->where('amount', '>', 0)->first();
|
||||||
if(null === $transaction) {
|
if (null === $transaction) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
$transaction->account_id = $this->newDestinationAccount->id;
|
$transaction->account_id = $this->newDestinationAccount->id;
|
||||||
|
35
app/User.php
35
app/User.php
@ -25,7 +25,23 @@ declare(strict_types=1);
|
|||||||
namespace FireflyIII;
|
namespace FireflyIII;
|
||||||
|
|
||||||
use FireflyIII\Events\RequestedNewPassword;
|
use FireflyIII\Events\RequestedNewPassword;
|
||||||
|
use FireflyIII\Models\Account;
|
||||||
|
use FireflyIII\Models\Attachment;
|
||||||
|
use FireflyIII\Models\AvailableBudget;
|
||||||
|
use FireflyIII\Models\Bill;
|
||||||
|
use FireflyIII\Models\Budget;
|
||||||
|
use FireflyIII\Models\Category;
|
||||||
use FireflyIII\Models\CurrencyExchangeRate;
|
use FireflyIII\Models\CurrencyExchangeRate;
|
||||||
|
use FireflyIII\Models\ExportJob;
|
||||||
|
use FireflyIII\Models\ImportJob;
|
||||||
|
use FireflyIII\Models\PiggyBank;
|
||||||
|
use FireflyIII\Models\Preference;
|
||||||
|
use FireflyIII\Models\Role;
|
||||||
|
use FireflyIII\Models\Rule;
|
||||||
|
use FireflyIII\Models\RuleGroup;
|
||||||
|
use FireflyIII\Models\Tag;
|
||||||
|
use FireflyIII\Models\Transaction;
|
||||||
|
use FireflyIII\Models\TransactionJournal;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||||
use Illuminate\Database\Eloquent\Relations\HasManyThrough;
|
use Illuminate\Database\Eloquent\Relations\HasManyThrough;
|
||||||
@ -36,26 +52,11 @@ use Laravel\Passport\HasApiTokens;
|
|||||||
use Log;
|
use Log;
|
||||||
use Request;
|
use Request;
|
||||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||||
use FireflyIII\Models\TransactionJournal;
|
|
||||||
use FireflyIII\Models\Transaction;
|
|
||||||
use FireflyIII\Models\Tag;
|
|
||||||
use FireflyIII\Models\Rule;
|
|
||||||
use FireflyIII\Models\RuleGroup;
|
|
||||||
use FireflyIII\Models\Role;
|
|
||||||
use FireflyIII\Models\Preference;
|
|
||||||
use FireflyIII\Models\Account;
|
|
||||||
use FireflyIII\Models\PiggyBank;
|
|
||||||
use FireflyIII\Models\ImportJob;
|
|
||||||
use FireflyIII\Models\ExportJob;
|
|
||||||
use FireflyIII\Models\Category;
|
|
||||||
use FireflyIII\Models\Budget;
|
|
||||||
use FireflyIII\Models\Bill;
|
|
||||||
use FireflyIII\Models\AvailableBudget;
|
|
||||||
use FireflyIII\Models\Attachment;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class User.
|
* Class User.
|
||||||
* @property int $id
|
*
|
||||||
|
* @property int $id
|
||||||
* @property string $email
|
* @property string $email
|
||||||
*/
|
*/
|
||||||
class User extends Authenticatable
|
class User extends Authenticatable
|
||||||
|
Loading…
Reference in New Issue
Block a user