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;
|
$title = $newGroup->title ?? $newGroup->transactionJournals->first()->description;
|
||||||
$link = route('transactions.show', [$newGroup->id]);
|
$link = route('transactions.show', [$newGroup->id]);
|
||||||
session()->flash('success', trans('firefly.stored_journal', ['description' => $title]));
|
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]));
|
return redirect(route('transactions.show', [$newGroup->id]));
|
||||||
}
|
}
|
||||||
|
@ -53,6 +53,10 @@ class InterestingMessage
|
|||||||
Preferences::mark();
|
Preferences::mark();
|
||||||
$this->handleGroupMessage($request);
|
$this->handleGroupMessage($request);
|
||||||
}
|
}
|
||||||
|
if ($this->accountMessage($request)) {
|
||||||
|
Preferences::mark();
|
||||||
|
$this->handleAccountMessage($request);
|
||||||
|
}
|
||||||
|
|
||||||
return $next($request);
|
return $next($request);
|
||||||
}
|
}
|
||||||
@ -80,6 +84,25 @@ class InterestingMessage
|
|||||||
return null !== $transactionGroupId && null !== $message;
|
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
|
* @param Request $request
|
||||||
*/
|
*/
|
||||||
@ -107,18 +130,32 @@ class InterestingMessage
|
|||||||
}
|
}
|
||||||
$title = $count > 1 ? $group->title : $journal->description;
|
$title = $count > 1 ? $group->title : $journal->description;
|
||||||
if ('created' === $message) {
|
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]));
|
session()->flash('success', (string)trans('firefly.stored_journal', ['description' => $title]));
|
||||||
}
|
}
|
||||||
if ('updated' === $message) {
|
if ('updated' === $message) {
|
||||||
$type = strtolower($journal->transactionType->type);
|
$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]));
|
session()->flash('success', (string)trans(sprintf('firefly.updated_%s', $type), ['description' => $title]));
|
||||||
}
|
}
|
||||||
if ('no_change' === $message) {
|
if ('no_change' === $message) {
|
||||||
$type = strtolower($journal->transactionType->type);
|
$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]));
|
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>
|
<span>×</span><span class="sr-only">{{ 'close'|_ }}</span>
|
||||||
</button>
|
</button>
|
||||||
<strong>{{ 'flash_success'|_ }}</strong>
|
<strong>{{ 'flash_success'|_ }}</strong>
|
||||||
{% if session_has('success_uri') %}
|
{% if session_has('success_url') %}
|
||||||
<a href="{{ session('success_uri') }}">
|
<a href="{{ session('success_url') }}">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{{ session('success') }}
|
{{ session('success') }}
|
||||||
{% if session_has('success_uri') %}
|
{% if session_has('success_url') %}
|
||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
@ -7,11 +7,11 @@
|
|||||||
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
||||||
<h5><i class="icon fas fa-thumbs-up"></i> {{ 'flash_success'|_ }}</h5>
|
<h5><i class="icon fas fa-thumbs-up"></i> {{ 'flash_success'|_ }}</h5>
|
||||||
<span>
|
<span>
|
||||||
{% if session_has('success_uri') %}
|
{% if session_has('success_url') %}
|
||||||
<a href="{{ session('success_uri') }}">
|
<a href="{{ session('success_url') }}">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{{ session('success') }}
|
{{ session('success') }}
|
||||||
{% if session_has('success_uri') %}
|
{% if session_has('success_url') %}
|
||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</span>
|
</span>
|
||||||
@ -28,11 +28,11 @@
|
|||||||
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
||||||
<h5><i class="icon fas fa-exclamation-triangle"></i> {{ 'flash_warning'|_ }}</h5>
|
<h5><i class="icon fas fa-exclamation-triangle"></i> {{ 'flash_warning'|_ }}</h5>
|
||||||
<span>
|
<span>
|
||||||
{% if session_has('warning_uri') %}
|
{% if session_has('warning_url') %}
|
||||||
<a href="{{ session('warning_uri') }}" style="color:rgb(31, 45, 61);">
|
<a href="{{ session('warning_url') }}" style="color:rgb(31, 45, 61);">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{{ session('warning') }}
|
{{ session('warning') }}
|
||||||
{% if session_has('warning_uri') %}
|
{% if session_has('warning_url') %}
|
||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</span>
|
</span>
|
||||||
|
Loading…
Reference in New Issue
Block a user