mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-11-25 18:30:55 -06:00
Rename parameter
This commit is contained in:
parent
b812c2e09f
commit
f5983f08fd
@ -77,7 +77,7 @@ class CreateController extends Controller
|
||||
$title = $newGroup->title ?? $newGroup->transactionJournals->first()->description;
|
||||
$link = route('transactions.show', [$newGroup->id]);
|
||||
session()->flash('success', trans('firefly.stored_journal', ['description' => $title]));
|
||||
session()->flash('success_uri', $link);
|
||||
session()->flash('success_url', $link);
|
||||
|
||||
return redirect(route('transactions.show', [$newGroup->id]));
|
||||
}
|
||||
|
@ -53,6 +53,10 @@ class InterestingMessage
|
||||
Preferences::mark();
|
||||
$this->handleGroupMessage($request);
|
||||
}
|
||||
if ($this->accountMessage($request)) {
|
||||
Preferences::mark();
|
||||
$this->handleAccountMessage($request);
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
@ -80,6 +84,25 @@ class InterestingMessage
|
||||
return null !== $transactionGroupId && null !== $message;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
*/
|
||||
private function handleAccountMessage(Request $request): void {
|
||||
|
||||
// get parameters from request.
|
||||
$accountId = $request->get('account_id');
|
||||
$message = $request->get('message');
|
||||
|
||||
/** @var TransactionGroup $group */
|
||||
$account = auth()->user()->accounts()->withTrashed()->find($accountId);
|
||||
|
||||
if (null === $account) {
|
||||
return;
|
||||
}
|
||||
if ('deleted' === $message) {
|
||||
session()->flash('success', (string)trans('firefly.account_deleted', ['name' => $account->name]));
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @param Request $request
|
||||
*/
|
||||
@ -107,18 +130,32 @@ class InterestingMessage
|
||||
}
|
||||
$title = $count > 1 ? $group->title : $journal->description;
|
||||
if ('created' === $message) {
|
||||
session()->flash('success_uri', route('transactions.show', [$transactionGroupId]));
|
||||
session()->flash('success_url', route('transactions.show', [$transactionGroupId]));
|
||||
session()->flash('success', (string)trans('firefly.stored_journal', ['description' => $title]));
|
||||
}
|
||||
if ('updated' === $message) {
|
||||
$type = strtolower($journal->transactionType->type);
|
||||
session()->flash('success_uri', route('transactions.show', [$transactionGroupId]));
|
||||
session()->flash('success_url', route('transactions.show', [$transactionGroupId]));
|
||||
session()->flash('success', (string)trans(sprintf('firefly.updated_%s', $type), ['description' => $title]));
|
||||
}
|
||||
if ('no_change' === $message) {
|
||||
$type = strtolower($journal->transactionType->type);
|
||||
session()->flash('warning_uri', route('transactions.show', [$transactionGroupId]));
|
||||
session()->flash('warning_url', route('transactions.show', [$transactionGroupId]));
|
||||
session()->flash('warning', (string)trans(sprintf('firefly.no_changes_%s', $type), ['description' => $title]));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private function accountMessage(Request $request): bool
|
||||
{
|
||||
// get parameters from request.
|
||||
$accountId = $request->get('account_id');
|
||||
$message = $request->get('message');
|
||||
|
||||
return null !== $accountId && null !== $message;
|
||||
}
|
||||
}
|
||||
|
@ -15,11 +15,11 @@
|
||||
<span>×</span><span class="sr-only">{{ 'close'|_ }}</span>
|
||||
</button>
|
||||
<strong>{{ 'flash_success'|_ }}</strong>
|
||||
{% if session_has('success_uri') %}
|
||||
<a href="{{ session('success_uri') }}">
|
||||
{% if session_has('success_url') %}
|
||||
<a href="{{ session('success_url') }}">
|
||||
{% endif %}
|
||||
{{ session('success') }}
|
||||
{% if session_has('success_uri') %}
|
||||
{% if session_has('success_url') %}
|
||||
</a>
|
||||
{% endif %}
|
||||
|
||||
|
@ -7,11 +7,11 @@
|
||||
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
||||
<h5><i class="icon fas fa-thumbs-up"></i> {{ 'flash_success'|_ }}</h5>
|
||||
<span>
|
||||
{% if session_has('success_uri') %}
|
||||
<a href="{{ session('success_uri') }}">
|
||||
{% if session_has('success_url') %}
|
||||
<a href="{{ session('success_url') }}">
|
||||
{% endif %}
|
||||
{{ session('success') }}
|
||||
{% if session_has('success_uri') %}
|
||||
{% if session_has('success_url') %}
|
||||
</a>
|
||||
{% endif %}
|
||||
</span>
|
||||
@ -28,11 +28,11 @@
|
||||
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
||||
<h5><i class="icon fas fa-exclamation-triangle"></i> {{ 'flash_warning'|_ }}</h5>
|
||||
<span>
|
||||
{% if session_has('warning_uri') %}
|
||||
<a href="{{ session('warning_uri') }}" style="color:rgb(31, 45, 61);">
|
||||
{% if session_has('warning_url') %}
|
||||
<a href="{{ session('warning_url') }}" style="color:rgb(31, 45, 61);">
|
||||
{% endif %}
|
||||
{{ session('warning') }}
|
||||
{% if session_has('warning_uri') %}
|
||||
{% if session_has('warning_url') %}
|
||||
</a>
|
||||
{% endif %}
|
||||
</span>
|
||||
|
Loading…
Reference in New Issue
Block a user