mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-01-07 14:41:20 +00:00
Restructure code to rename a variable.
This commit is contained in:
@@ -110,7 +110,7 @@ class ProfileController extends Controller
|
||||
|
||||
$image = Google2FA::getQRCodeInline($domain, auth()->user()->email, $secret, 200);
|
||||
|
||||
return view('profile.code', compact('image','secret'));
|
||||
return view('profile.code', compact('image', 'secret'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -48,7 +48,7 @@ class DeleteController extends Controller
|
||||
// todo actual number.
|
||||
$journalsCreated = 5;
|
||||
|
||||
return view('recurring.delete', compact('recurrence', 'subTitle','journalsCreated'));
|
||||
return view('recurring.delete', compact('recurrence', 'subTitle', 'journalsCreated'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -56,7 +56,7 @@ class BalanceController extends Controller
|
||||
|
||||
$balance = $helper->getBalanceReport($accounts, $start, $end);
|
||||
|
||||
$result = view('reports.partials.balance', compact( 'balance'))->render();
|
||||
$result = view('reports.partials.balance', compact('balance'))->render();
|
||||
$cache->store($result);
|
||||
|
||||
return $result;
|
||||
|
||||
@@ -181,11 +181,11 @@ class MassController extends Controller
|
||||
if (null !== $journal) {
|
||||
// get optional fields:
|
||||
$what = strtolower($this->repository->getTransactionType($journal));
|
||||
$sourceAccountId = $request->get('source_account_id')[$journal->id] ?? null;
|
||||
$sourceAccountId = $request->get('source_id')[$journal->id] ?? null;
|
||||
$currencyId = $request->get('transaction_currency_id')[$journal->id] ?? 1;
|
||||
$sourceAccountName = $request->get('source_account_name')[$journal->id] ?? null;
|
||||
$destAccountId = $request->get('destination_account_id')[$journal->id] ?? null;
|
||||
$destAccountName = $request->get('destination_account_name')[$journal->id] ?? null;
|
||||
$sourceAccountName = $request->get('source_name')[$journal->id] ?? null;
|
||||
$destAccountId = $request->get('destination_id')[$journal->id] ?? null;
|
||||
$destAccountName = $request->get('destination_name')[$journal->id] ?? null;
|
||||
$budgetId = (int)($request->get('budget_id')[$journal->id] ?? 0.0);
|
||||
$category = $request->get('category')[$journal->id];
|
||||
$tags = $journal->tags->pluck('tag')->toArray();
|
||||
|
||||
@@ -99,10 +99,10 @@ class SingleController extends Controller
|
||||
|
||||
$preFilled = [
|
||||
'description' => $journal->description,
|
||||
'source_account_id' => $source->id,
|
||||
'source_account_name' => $source->name,
|
||||
'destination_account_id' => $destination->id,
|
||||
'destination_account_name' => $destination->name,
|
||||
'source_id' => $source->id,
|
||||
'source_name' => $source->name,
|
||||
'destination_id' => $destination->id,
|
||||
'destination_name' => $destination->name,
|
||||
'amount' => $amount,
|
||||
'source_amount' => $amount,
|
||||
'destination_amount' => $foreignAmount,
|
||||
@@ -152,10 +152,10 @@ class SingleController extends Controller
|
||||
$source = (int)$request->get('source');
|
||||
|
||||
if (($what === 'withdrawal' || $what === 'transfer') && $source > 0) {
|
||||
$preFilled['source_account_id'] = $source;
|
||||
$preFilled['source_id'] = $source;
|
||||
}
|
||||
if ($what === 'deposit' && $source > 0) {
|
||||
$preFilled['destination_account_id'] = $source;
|
||||
$preFilled['destination_id'] = $source;
|
||||
}
|
||||
|
||||
session()->put('preFilled', $preFilled);
|
||||
@@ -259,35 +259,35 @@ class SingleController extends Controller
|
||||
$pTransaction = $repository->getFirstPosTransaction($journal);
|
||||
$foreignCurrency = $pTransaction->foreignCurrency ?? $pTransaction->transactionCurrency;
|
||||
$preFilled = [
|
||||
'date' => $repository->getJournalDate($journal, null), // $journal->dateAsString()
|
||||
'interest_date' => $repository->getJournalDate($journal, 'interest_date'),
|
||||
'book_date' => $repository->getJournalDate($journal, 'book_date'),
|
||||
'process_date' => $repository->getJournalDate($journal, 'process_date'),
|
||||
'category' => $repository->getJournalCategoryName($journal),
|
||||
'budget_id' => $repository->getJournalBudgetId($journal),
|
||||
'tags' => implode(',', $repository->getTags($journal)),
|
||||
'source_account_id' => $sourceAccounts->first()->id,
|
||||
'source_account_name' => $sourceAccounts->first()->edit_name,
|
||||
'destination_account_id' => $destinationAccounts->first()->id,
|
||||
'destination_account_name' => $destinationAccounts->first()->edit_name,
|
||||
'date' => $repository->getJournalDate($journal, null), // $journal->dateAsString()
|
||||
'interest_date' => $repository->getJournalDate($journal, 'interest_date'),
|
||||
'book_date' => $repository->getJournalDate($journal, 'book_date'),
|
||||
'process_date' => $repository->getJournalDate($journal, 'process_date'),
|
||||
'category' => $repository->getJournalCategoryName($journal),
|
||||
'budget_id' => $repository->getJournalBudgetId($journal),
|
||||
'tags' => implode(',', $repository->getTags($journal)),
|
||||
'source_id' => $sourceAccounts->first()->id,
|
||||
'source_name' => $sourceAccounts->first()->edit_name,
|
||||
'destination_id' => $destinationAccounts->first()->id,
|
||||
'destination_name' => $destinationAccounts->first()->edit_name,
|
||||
|
||||
// new custom fields:
|
||||
'due_date' => $repository->getJournalDate($journal, 'due_date'),
|
||||
'payment_date' => $repository->getJournalDate($journal, 'payment_date'),
|
||||
'invoice_date' => $repository->getJournalDate($journal, 'invoice_date'),
|
||||
'interal_reference' => $repository->getMetaField($journal, 'internal_reference'),
|
||||
'notes' => $repository->getNoteText($journal),
|
||||
'due_date' => $repository->getJournalDate($journal, 'due_date'),
|
||||
'payment_date' => $repository->getJournalDate($journal, 'payment_date'),
|
||||
'invoice_date' => $repository->getJournalDate($journal, 'invoice_date'),
|
||||
'interal_reference' => $repository->getMetaField($journal, 'internal_reference'),
|
||||
'notes' => $repository->getNoteText($journal),
|
||||
|
||||
// amount fields
|
||||
'amount' => $pTransaction->amount,
|
||||
'source_amount' => $pTransaction->amount,
|
||||
'native_amount' => $pTransaction->amount,
|
||||
'destination_amount' => $pTransaction->foreign_amount,
|
||||
'currency' => $pTransaction->transactionCurrency,
|
||||
'source_currency' => $pTransaction->transactionCurrency,
|
||||
'native_currency' => $pTransaction->transactionCurrency,
|
||||
'foreign_currency' => $foreignCurrency,
|
||||
'destination_currency' => $foreignCurrency,
|
||||
'amount' => $pTransaction->amount,
|
||||
'source_amount' => $pTransaction->amount,
|
||||
'native_amount' => $pTransaction->amount,
|
||||
'destination_amount' => $pTransaction->foreign_amount,
|
||||
'currency' => $pTransaction->transactionCurrency,
|
||||
'source_currency' => $pTransaction->transactionCurrency,
|
||||
'native_currency' => $pTransaction->transactionCurrency,
|
||||
'foreign_currency' => $foreignCurrency,
|
||||
'destination_currency' => $foreignCurrency,
|
||||
];
|
||||
|
||||
// amounts for withdrawals and deposits:
|
||||
|
||||
@@ -184,30 +184,30 @@ class SplitController extends Controller
|
||||
$sourceAccounts = $this->repository->getJournalSourceAccounts($journal);
|
||||
$destinationAccounts = $this->repository->getJournalDestinationAccounts($journal);
|
||||
$array = [
|
||||
'journal_description' => $request->old('journal_description', $journal->description),
|
||||
'journal_amount' => '0',
|
||||
'journal_foreign_amount' => '0',
|
||||
'sourceAccounts' => $sourceAccounts,
|
||||
'journal_source_account_id' => $request->old('journal_source_account_id', $sourceAccounts->first()->id),
|
||||
'journal_source_account_name' => $request->old('journal_source_account_name', $sourceAccounts->first()->name),
|
||||
'journal_destination_account_id' => $request->old('journal_destination_account_id', $destinationAccounts->first()->id),
|
||||
'destinationAccounts' => $destinationAccounts,
|
||||
'what' => strtolower($this->repository->getTransactionType($journal)),
|
||||
'date' => $request->old('date', $this->repository->getJournalDate($journal, null)),
|
||||
'tags' => implode(',', $journal->tags->pluck('tag')->toArray()),
|
||||
'journal_description' => $request->old('journal_description', $journal->description),
|
||||
'journal_amount' => '0',
|
||||
'journal_foreign_amount' => '0',
|
||||
'sourceAccounts' => $sourceAccounts,
|
||||
'journal_source_id' => $request->old('journal_source_id', $sourceAccounts->first()->id),
|
||||
'journal_source_name' => $request->old('journal_source_name', $sourceAccounts->first()->name),
|
||||
'journal_destination_id' => $request->old('journal_destination_id', $destinationAccounts->first()->id),
|
||||
'destinationAccounts' => $destinationAccounts,
|
||||
'what' => strtolower($this->repository->getTransactionType($journal)),
|
||||
'date' => $request->old('date', $this->repository->getJournalDate($journal, null)),
|
||||
'tags' => implode(',', $journal->tags->pluck('tag')->toArray()),
|
||||
|
||||
// all custom fields:
|
||||
'interest_date' => $request->old('interest_date', $this->repository->getMetaField($journal, 'interest_date')),
|
||||
'book_date' => $request->old('book_date', $this->repository->getMetaField($journal, 'book_date')),
|
||||
'process_date' => $request->old('process_date', $this->repository->getMetaField($journal, 'process_date')),
|
||||
'due_date' => $request->old('due_date', $this->repository->getMetaField($journal, 'due_date')),
|
||||
'payment_date' => $request->old('payment_date', $this->repository->getMetaField($journal, 'payment_date')),
|
||||
'invoice_date' => $request->old('invoice_date', $this->repository->getMetaField($journal, 'invoice_date')),
|
||||
'internal_reference' => $request->old('internal_reference', $this->repository->getMetaField($journal, 'internal_reference')),
|
||||
'notes' => $request->old('notes', $this->repository->getNoteText($journal)),
|
||||
'interest_date' => $request->old('interest_date', $this->repository->getMetaField($journal, 'interest_date')),
|
||||
'book_date' => $request->old('book_date', $this->repository->getMetaField($journal, 'book_date')),
|
||||
'process_date' => $request->old('process_date', $this->repository->getMetaField($journal, 'process_date')),
|
||||
'due_date' => $request->old('due_date', $this->repository->getMetaField($journal, 'due_date')),
|
||||
'payment_date' => $request->old('payment_date', $this->repository->getMetaField($journal, 'payment_date')),
|
||||
'invoice_date' => $request->old('invoice_date', $this->repository->getMetaField($journal, 'invoice_date')),
|
||||
'internal_reference' => $request->old('internal_reference', $this->repository->getMetaField($journal, 'internal_reference')),
|
||||
'notes' => $request->old('notes', $this->repository->getNoteText($journal)),
|
||||
|
||||
// transactions.
|
||||
'transactions' => $this->getTransactionDataFromJournal($journal),
|
||||
'transactions' => $this->getTransactionDataFromJournal($journal),
|
||||
];
|
||||
// update transactions array with old request data.
|
||||
$array['transactions'] = $this->updateWithPrevious($array['transactions'], $request->old());
|
||||
|
||||
@@ -81,10 +81,10 @@ class JournalFormRequest extends Request
|
||||
'budget_name' => null,
|
||||
'category_id' => null,
|
||||
'category_name' => $this->string('category'),
|
||||
'source_id' => $this->integer('source_account_id'),
|
||||
'source_name' => $this->string('source_account_name'),
|
||||
'destination_id' => $this->integer('destination_account_id'),
|
||||
'destination_name' => $this->string('destination_account_name'),
|
||||
'source_id' => $this->integer('source_id'),
|
||||
'source_name' => $this->string('source_name'),
|
||||
'destination_id' => $this->integer('destination_id'),
|
||||
'destination_name' => $this->string('destination_name'),
|
||||
'foreign_currency_id' => null,
|
||||
'foreign_currency_code' => null,
|
||||
'foreign_amount' => null,
|
||||
@@ -161,11 +161,11 @@ class JournalFormRequest extends Request
|
||||
'amount' => 'numeric|required|more:0',
|
||||
'budget_id' => 'mustExist:budgets,id|belongsToUser:budgets,id|nullable',
|
||||
'category' => 'between:1,255|nullable',
|
||||
'source_account_id' => 'numeric|belongsToUser:accounts,id|nullable',
|
||||
'source_account_name' => 'between:1,255|nullable',
|
||||
'destination_account_id' => 'numeric|belongsToUser:accounts,id|nullable',
|
||||
'destination_account_name' => 'between:1,255|nullable',
|
||||
'piggy_bank_id' => 'between:1,255|nullable',
|
||||
'source_id' => 'numeric|belongsToUser:accounts,id|nullable',
|
||||
'source_name' => 'between:1,255|nullable',
|
||||
'destination_id' => 'numeric|belongsToUser:accounts,id|nullable',
|
||||
'destination_name' => 'between:1,255|nullable',
|
||||
'piggy_bank_id' => 'numeric|nullable',
|
||||
|
||||
// foreign currency amounts
|
||||
'native_amount' => 'numeric|more:0|nullable',
|
||||
@@ -193,17 +193,17 @@ class JournalFormRequest extends Request
|
||||
{
|
||||
switch ($what) {
|
||||
case strtolower(TransactionType::WITHDRAWAL):
|
||||
$rules['source_account_id'] = 'required|exists:accounts,id|belongsToUser:accounts';
|
||||
$rules['destination_account_name'] = 'between:1,255|nullable';
|
||||
$rules['source_id'] = 'required|exists:accounts,id|belongsToUser:accounts';
|
||||
$rules['destination_name'] = 'between:1,255|nullable';
|
||||
break;
|
||||
case strtolower(TransactionType::DEPOSIT):
|
||||
$rules['source_account_name'] = 'between:1,255|nullable';
|
||||
$rules['destination_account_id'] = 'required|exists:accounts,id|belongsToUser:accounts';
|
||||
$rules['source_name'] = 'between:1,255|nullable';
|
||||
$rules['destination_id'] = 'required|exists:accounts,id|belongsToUser:accounts';
|
||||
break;
|
||||
case strtolower(TransactionType::TRANSFER):
|
||||
// this may not work:
|
||||
$rules['source_account_id'] = 'required|exists:accounts,id|belongsToUser:accounts|different:destination_account_id';
|
||||
$rules['destination_account_id'] = 'required|exists:accounts,id|belongsToUser:accounts|different:source_account_id';
|
||||
$rules['source_id'] = 'required|exists:accounts,id|belongsToUser:accounts|different:destination_id';
|
||||
$rules['destination_id'] = 'required|exists:accounts,id|belongsToUser:accounts|different:source_id';
|
||||
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -45,11 +45,11 @@ class MassEditJournalRequest extends Request
|
||||
// fixed
|
||||
|
||||
return [
|
||||
'description.*' => 'required|min:1,max:255',
|
||||
'source_account_id.*' => 'numeric|belongsToUser:accounts,id',
|
||||
'destination_account_id.*' => 'numeric|belongsToUser:accounts,id',
|
||||
'revenue_account' => 'max:255',
|
||||
'expense_account' => 'max:255',
|
||||
'description.*' => 'required|min:1,max:255',
|
||||
'source_id.*' => 'numeric|belongsToUser:accounts,id',
|
||||
'destination_id.*' => 'numeric|belongsToUser:accounts,id',
|
||||
'revenue_account' => 'max:255',
|
||||
'expense_account' => 'max:255',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,16 +104,16 @@ class RecurrenceFormRequest extends Request
|
||||
default:
|
||||
throw new FireflyException(sprintf('Cannot handle transaction type "%s"', $this->string('transaction_type')));
|
||||
case 'withdrawal':
|
||||
$return['transactions'][0]['source_account_id'] = $this->integer('source_account_id');
|
||||
$return['transactions'][0]['destination_account_name'] = $this->string('destination_account_name');
|
||||
$return['transactions'][0]['source_id'] = $this->integer('source_id');
|
||||
$return['transactions'][0]['destination_name'] = $this->string('destination_name');
|
||||
break;
|
||||
case 'deposit':
|
||||
$return['transactions'][0]['source_account_name'] = $this->string('source_account_name');
|
||||
$return['transactions'][0]['destination_account_id'] = $this->integer('destination_account_id');
|
||||
$return['transactions'][0]['source_name'] = $this->string('source_name');
|
||||
$return['transactions'][0]['destination_id'] = $this->integer('destination_id');
|
||||
break;
|
||||
case 'transfer':
|
||||
$return['transactions'][0]['source_account_id'] = $this->integer('source_account_id');
|
||||
$return['transactions'][0]['destination_account_id'] = $this->integer('destination_account_id');
|
||||
$return['transactions'][0]['source_id'] = $this->integer('source_id');
|
||||
$return['transactions'][0]['destination_id'] = $this->integer('destination_id');
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -131,34 +131,34 @@ class RecurrenceFormRequest extends Request
|
||||
$tomorrow->addDay();
|
||||
$rules = [
|
||||
// mandatory info for recurrence.
|
||||
'title' => 'required|between:1,255|uniqueObjectForUser:recurrences,title',
|
||||
'first_date' => 'required|date|after:' . $today->format('Y-m-d'),
|
||||
'repetition_type' => ['required', new ValidRecurrenceRepetitionValue, new ValidRecurrenceRepetitionType, 'between:1,20'],
|
||||
'skip' => 'required|numeric|between:0,31',
|
||||
'title' => 'required|between:1,255|uniqueObjectForUser:recurrences,title',
|
||||
'first_date' => 'required|date|after:' . $today->format('Y-m-d'),
|
||||
'repetition_type' => ['required', new ValidRecurrenceRepetitionValue, new ValidRecurrenceRepetitionType, 'between:1,20'],
|
||||
'skip' => 'required|numeric|between:0,31',
|
||||
|
||||
// optional for recurrence:
|
||||
'recurring_description' => 'between:0,65000',
|
||||
'active' => 'numeric|between:0,1',
|
||||
'apply_rules' => 'numeric|between:0,1',
|
||||
'recurring_description' => 'between:0,65000',
|
||||
'active' => 'numeric|between:0,1',
|
||||
'apply_rules' => 'numeric|between:0,1',
|
||||
|
||||
// mandatory for transaction:
|
||||
'transaction_description' => 'required|between:1,255',
|
||||
'transaction_type' => 'required|in:withdrawal,deposit,transfer',
|
||||
'transaction_currency_id' => 'required|exists:transaction_currencies,id',
|
||||
'amount' => 'numeric|required|more:0',
|
||||
'transaction_description' => 'required|between:1,255',
|
||||
'transaction_type' => 'required|in:withdrawal,deposit,transfer',
|
||||
'transaction_currency_id' => 'required|exists:transaction_currencies,id',
|
||||
'amount' => 'numeric|required|more:0',
|
||||
// mandatory account info:
|
||||
'source_account_id' => 'numeric|belongsToUser:accounts,id|nullable',
|
||||
'source_account_name' => 'between:1,255|nullable',
|
||||
'destination_account_id' => 'numeric|belongsToUser:accounts,id|nullable',
|
||||
'destination_account_name' => 'between:1,255|nullable',
|
||||
'source_id' => 'numeric|belongsToUser:accounts,id|nullable',
|
||||
'source_name' => 'between:1,255|nullable',
|
||||
'destination_id' => 'numeric|belongsToUser:accounts,id|nullable',
|
||||
'destination_name' => 'between:1,255|nullable',
|
||||
|
||||
// foreign amount data:
|
||||
'foreign_amount' => 'nullable|more:0',
|
||||
'foreign_amount' => 'nullable|more:0',
|
||||
|
||||
// optional fields:
|
||||
'budget_id' => 'mustExist:budgets,id|belongsToUser:budgets,id|nullable',
|
||||
'category' => 'between:1,255|nullable',
|
||||
'tags' => 'between:1,255|nullable',
|
||||
'budget_id' => 'mustExist:budgets,id|belongsToUser:budgets,id|nullable',
|
||||
'category' => 'between:1,255|nullable',
|
||||
'tags' => 'between:1,255|nullable',
|
||||
];
|
||||
if ($this->integer('foreign_currency_id') > 0) {
|
||||
$rules['foreign_currency_id'] = 'exists:transaction_currencies,id';
|
||||
@@ -181,17 +181,17 @@ class RecurrenceFormRequest extends Request
|
||||
// switchc on type to expand rules for source and destination accounts:
|
||||
switch ($this->string('transaction_type')) {
|
||||
case strtolower(TransactionType::WITHDRAWAL):
|
||||
$rules['source_account_id'] = 'required|exists:accounts,id|belongsToUser:accounts';
|
||||
$rules['destination_account_name'] = 'between:1,255|nullable';
|
||||
$rules['source_id'] = 'required|exists:accounts,id|belongsToUser:accounts';
|
||||
$rules['destination_name'] = 'between:1,255|nullable';
|
||||
break;
|
||||
case strtolower(TransactionType::DEPOSIT):
|
||||
$rules['source_account_name'] = 'between:1,255|nullable';
|
||||
$rules['destination_account_id'] = 'required|exists:accounts,id|belongsToUser:accounts';
|
||||
$rules['source_name'] = 'between:1,255|nullable';
|
||||
$rules['destination_id'] = 'required|exists:accounts,id|belongsToUser:accounts';
|
||||
break;
|
||||
case strtolower(TransactionType::TRANSFER):
|
||||
// this may not work:
|
||||
$rules['source_account_id'] = 'required|exists:accounts,id|belongsToUser:accounts|different:destination_account_id';
|
||||
$rules['destination_account_id'] = 'required|exists:accounts,id|belongsToUser:accounts|different:source_account_id';
|
||||
$rules['source_id'] = 'required|exists:accounts,id|belongsToUser:accounts|different:destination_id';
|
||||
$rules['destination_id'] = 'required|exists:accounts,id|belongsToUser:accounts|different:source_id';
|
||||
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -64,16 +64,16 @@ class SplitJournalFormRequest extends Request
|
||||
foreach ($this->get('transactions') as $index => $transaction) {
|
||||
switch ($data['type']) {
|
||||
case 'withdrawal':
|
||||
$sourceId = $this->integer('journal_source_account_id');
|
||||
$sourceId = $this->integer('journal_source_id');
|
||||
$destinationName = $transaction['destination_name'] ?? '';
|
||||
break;
|
||||
case 'deposit':
|
||||
$sourceName = $transaction['source_name'] ?? '';
|
||||
$destinationId = $this->integer('journal_destination_account_id');
|
||||
$destinationId = $this->integer('journal_destination_id');
|
||||
break;
|
||||
case 'transfer':
|
||||
$sourceId = $this->integer('journal_source_account_id');
|
||||
$destinationId = $this->integer('journal_destination_account_id');
|
||||
$sourceId = $this->integer('journal_source_id');
|
||||
$destinationId = $this->integer('journal_destination_id');
|
||||
break;
|
||||
}
|
||||
$foreignAmount = $transaction['foreign_amount'] ?? null;
|
||||
@@ -112,20 +112,20 @@ class SplitJournalFormRequest extends Request
|
||||
'what' => 'required|in:withdrawal,deposit,transfer',
|
||||
'journal_description' => 'required|between:1,255',
|
||||
'id' => 'numeric|belongsToUser:transaction_journals,id',
|
||||
'journal_source_account_id' => 'numeric|belongsToUser:accounts,id',
|
||||
'journal_source_account_name.*' => 'between:1,255',
|
||||
'journal_source_id' => 'numeric|belongsToUser:accounts,id',
|
||||
'journal_source_name.*' => 'between:1,255',
|
||||
'journal_currency_id' => 'required|exists:transaction_currencies,id',
|
||||
'date' => 'required|date',
|
||||
'interest_date' => 'date|nullable',
|
||||
'book_date' => 'date|nullable',
|
||||
'process_date' => 'date|nullable',
|
||||
'transactions.*.transaction_description' => 'required|between:1,255',
|
||||
'transactions.*.destination_account_id' => 'numeric|belongsToUser:accounts,id',
|
||||
'transactions.*.destination_id' => 'numeric|belongsToUser:accounts,id',
|
||||
'transactions.*.destination_name' => 'between:1,255|nullable',
|
||||
'transactions.*.amount' => 'required|numeric',
|
||||
'transactions.*.budget_id' => 'belongsToUser:budgets,id',
|
||||
'transactions.*.category_name' => 'between:1,255|nullable',
|
||||
'transactions.*.piggy_bank_id' => 'between:1,255|nullable',
|
||||
'transactions.*.piggy_bank_id' => 'numeric|nullable',
|
||||
];
|
||||
}
|
||||
|
||||
@@ -155,8 +155,8 @@ class SplitJournalFormRequest extends Request
|
||||
/** @var array $array */
|
||||
foreach ($transactions as $array) {
|
||||
if ($array['destination_id'] !== null && $array['source_id'] !== null && $array['destination_id'] === $array['source_id']) {
|
||||
$validator->errors()->add('journal_source_account_id', trans('validation.source_equals_destination'));
|
||||
$validator->errors()->add('journal_destination_account_id', trans('validation.source_equals_destination'));
|
||||
$validator->errors()->add('journal_source_id', trans('validation.source_equals_destination'));
|
||||
$validator->errors()->add('journal_destination_id', trans('validation.source_equals_destination'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user