mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-04 03:43:07 +00:00
Fix #1294
This commit is contained in:
@@ -53,7 +53,7 @@ class AboutController extends Controller
|
||||
$search = ['~', '#'];
|
||||
$replace = ['\~', '# '];
|
||||
$phpVersion = str_replace($search, $replace, PHP_VERSION);
|
||||
$phpOs = str_replace($search, $replace, php_uname());
|
||||
$phpOs = str_replace($search, $replace, PHP_OS);
|
||||
$currentDriver = DB::getDriverName();
|
||||
$data
|
||||
= [
|
||||
|
@@ -30,6 +30,7 @@ use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||
use Illuminate\Routing\Controller as BaseController;
|
||||
use Log;
|
||||
use Symfony\Component\HttpFoundation\ParameterBag;
|
||||
|
||||
/**
|
||||
@@ -111,6 +112,7 @@ class Controller extends BaseController
|
||||
$obj = new Carbon($date);
|
||||
} catch (InvalidDateException $e) {
|
||||
// don't care
|
||||
Log::error(sprintf('Invalid date exception in API controller: %s', $e->getMessage()));
|
||||
}
|
||||
}
|
||||
$bag->set($field, $obj);
|
||||
|
@@ -70,6 +70,7 @@ class UserController extends Controller
|
||||
* @param \FireflyIII\User $user
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
* @throws \Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException
|
||||
*/
|
||||
public function delete(User $user)
|
||||
{
|
||||
|
@@ -70,9 +70,9 @@ class AccountRequest extends Request
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
$accountRoles = join(',', config('firefly.accountRoles'));
|
||||
$types = join(',', array_keys(config('firefly.subTitlesByIdentifier')));
|
||||
$ccPaymentTypes = join(',', array_keys(config('firefly.ccTypes')));
|
||||
$accountRoles = implode(',', config('firefly.accountRoles'));
|
||||
$types = implode(',', array_keys(config('firefly.subTitlesByIdentifier')));
|
||||
$ccPaymentTypes = implode(',', array_keys(config('firefly.ccTypes')));
|
||||
$rules = [
|
||||
'name' => 'required|min:1|uniqueAccountForUser',
|
||||
'opening_balance' => 'numeric|required_with:opening_balance_date|nullable',
|
||||
|
@@ -168,6 +168,7 @@ class TransactionRequest extends Request
|
||||
* @param Validator $validator
|
||||
*
|
||||
* @return void
|
||||
* @throws \FireflyIII\Exceptions\FireflyException
|
||||
*/
|
||||
public function withValidator(Validator $validator): void
|
||||
{
|
||||
@@ -438,13 +439,11 @@ class TransactionRequest extends Request
|
||||
|
||||
}
|
||||
// add some errors in case of same account submitted:
|
||||
if (!is_null($sourceAccount) && !is_null($destinationAccount)) {
|
||||
if ($sourceAccount->id === $destinationAccount->id) {
|
||||
if (!is_null($sourceAccount) && !is_null($destinationAccount) && $sourceAccount->id === $destinationAccount->id) {
|
||||
$validator->errors()->add($idField, trans('validation.source_equals_destination'));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Validator $validator
|
||||
@@ -506,8 +505,6 @@ class TransactionRequest extends Request
|
||||
);
|
||||
// @codeCoverageIgnoreEnd
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -70,6 +70,7 @@ class BulkController extends Controller
|
||||
* @param Collection $journals
|
||||
*
|
||||
* @return View
|
||||
* @throws \RuntimeException
|
||||
*/
|
||||
public function edit(Request $request, Collection $journals)
|
||||
{
|
||||
@@ -139,6 +140,7 @@ class BulkController extends Controller
|
||||
* @param JournalRepositoryInterface $repository
|
||||
*
|
||||
* @return mixed
|
||||
* @throws \RuntimeException
|
||||
*/
|
||||
public function update(BulkEditJournalRequest $request, JournalRepositoryInterface $repository)
|
||||
{
|
||||
|
@@ -110,6 +110,13 @@ class LinkController extends Controller
|
||||
}
|
||||
$other = $this->journalRepository->find($linkInfo['transaction_journal_id']);
|
||||
$alreadyLinked = $this->repository->findLink($journal, $other);
|
||||
|
||||
if($other->id === $journal->id) {
|
||||
Session::flash('error', trans('firefly.journals_link_to_self'));
|
||||
|
||||
return redirect(route('transactions.show', [$journal->id]));
|
||||
}
|
||||
|
||||
if ($alreadyLinked) {
|
||||
Session::flash('error', trans('firefly.journals_error_linked'));
|
||||
|
||||
|
@@ -102,7 +102,7 @@ class SingleController extends Controller
|
||||
$budgetId = $this->repository->getJournalBudgetId($journal);
|
||||
$categoryName = $this->repository->getJournalCategoryName($journal);
|
||||
|
||||
$tags = join(',', $this->repository->getTags($journal));
|
||||
$tags = implode(',', $this->repository->getTags($journal));
|
||||
/** @var Transaction $transaction */
|
||||
$transaction = $journal->transactions()->first();
|
||||
$amount = app('steam')->positive($transaction->amount);
|
||||
@@ -280,7 +280,7 @@ class SingleController extends Controller
|
||||
'process_date' => $repository->getJournalDate($journal, 'process_date'),
|
||||
'category' => $repository->getJournalCategoryName($journal),
|
||||
'budget_id' => $repository->getJournalBudgetId($journal),
|
||||
'tags' => join(',', $repository->getTags($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,
|
||||
@@ -441,10 +441,6 @@ class SingleController extends Controller
|
||||
{
|
||||
$count = $this->repository->countTransactions($journal);
|
||||
|
||||
if ($count > 2) {
|
||||
return true; // @codeCoverageIgnore
|
||||
}
|
||||
|
||||
return false;
|
||||
return $count > 2;
|
||||
}
|
||||
}
|
||||
|
@@ -125,7 +125,7 @@ class SplitController extends Controller
|
||||
|
||||
return view(
|
||||
'transactions.split.edit', compact(
|
||||
'subTitleIcon', 'currencies', 'optionalFields', 'preFilled', 'subTitle', 'uploadSize', 'assetAccounts', 'budgets',
|
||||
'subTitleIcon', 'currencies', 'optionalFields', 'preFilled', 'subTitle', 'uploadSize', 'budgets',
|
||||
'journal', 'accountArray',
|
||||
'previous'
|
||||
)
|
||||
@@ -197,7 +197,7 @@ class SplitController extends Controller
|
||||
'destinationAccounts' => $destinationAccounts,
|
||||
'what' => strtolower($this->repository->getTransactionType($journal)),
|
||||
'date' => $request->old('date', $this->repository->getJournalDate($journal, null)),
|
||||
'tags' => join(',', $journal->tags->pluck('tag')->toArray()),
|
||||
'tags' => implode(',', $journal->tags->pluck('tag')->toArray()),
|
||||
|
||||
// all custom fields:
|
||||
'interest_date' => $request->old('interest_date', $this->repository->getMetaField($journal, 'interest_date')),
|
||||
|
@@ -76,6 +76,7 @@ class User extends Authenticatable
|
||||
* @param string $value
|
||||
*
|
||||
* @return User
|
||||
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
|
||||
*/
|
||||
public static function routeBinder(string $value): User
|
||||
{
|
||||
|
@@ -1086,6 +1086,7 @@ return [
|
||||
'invalid_link_selection' => 'Cannot link these transactions',
|
||||
'journals_linked' => 'Transactions are linked.',
|
||||
'journals_error_linked' => 'These transactions are already linked.',
|
||||
'journals_link_to_self' => 'You cannot link a transaction to itself',
|
||||
'journal_links' => 'Transaction links',
|
||||
'this_withdrawal' => 'This withdrawal',
|
||||
'this_deposit' => 'This deposit',
|
||||
|
Reference in New Issue
Block a user