mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-21 11:48:53 +00:00
Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
cefb7d12bc | ||
|
3c0c15103e | ||
|
a8a8afc2be | ||
|
49e32abd3f | ||
|
7977eefaca | ||
|
f1fa6c3108 |
@@ -29,7 +29,7 @@ class ConfirmedUser extends Event
|
|||||||
public $user;
|
public $user;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new event instance.
|
* Create a new event instance. This event is triggered when a user confirms their new account.
|
||||||
*
|
*
|
||||||
* @param User $user
|
* @param User $user
|
||||||
* @param string $ipAddress
|
* @param string $ipAddress
|
||||||
|
@@ -29,7 +29,7 @@ class RegisteredUser extends Event
|
|||||||
public $user;
|
public $user;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new event instance.
|
* Create a new event instance. This event is triggered when a new user registers.
|
||||||
*
|
*
|
||||||
* @param User $user
|
* @param User $user
|
||||||
* @param string $ipAddress
|
* @param string $ipAddress
|
||||||
|
@@ -29,7 +29,7 @@ class ResentConfirmation extends Event
|
|||||||
public $user;
|
public $user;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new event instance.
|
* Create a new event instance. This event is triggered when a users wants a new confirmation.
|
||||||
*
|
*
|
||||||
* @param User $user
|
* @param User $user
|
||||||
* @param string $ipAddress
|
* @param string $ipAddress
|
||||||
|
@@ -76,7 +76,7 @@ class BudgetEventHandler
|
|||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function update(UpdatedBudgetLimit $event): bool
|
public function updateRepetition(UpdatedBudgetLimit $event): bool
|
||||||
{
|
{
|
||||||
$budgetLimit = $event->budgetLimit;
|
$budgetLimit = $event->budgetLimit;
|
||||||
$end = $event->end;
|
$end = $event->end;
|
||||||
|
@@ -43,7 +43,7 @@ class StoredJournalEventHandler
|
|||||||
$piggyBankId = $event->piggyBankId;
|
$piggyBankId = $event->piggyBankId;
|
||||||
|
|
||||||
/** @var PiggyBank $piggyBank */
|
/** @var PiggyBank $piggyBank */
|
||||||
$piggyBank = $journal->user()->piggyBanks()->where('piggy_banks.id', $piggyBankId)->first(['piggy_banks.*']);
|
$piggyBank = $journal->user->piggyBanks()->where('piggy_banks.id', $piggyBankId)->first(['piggy_banks.*']);
|
||||||
|
|
||||||
if (is_null($piggyBank)) {
|
if (is_null($piggyBank)) {
|
||||||
return true;
|
return true;
|
||||||
|
@@ -63,7 +63,7 @@ class UserEventHandler
|
|||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function onUserLogout(): bool
|
public function logoutUser(): bool
|
||||||
{
|
{
|
||||||
// dump stuff from the session:
|
// dump stuff from the session:
|
||||||
Session::forget('twofactor-authenticated');
|
Session::forget('twofactor-authenticated');
|
||||||
|
@@ -297,23 +297,8 @@ class AccountController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function store(AccountFormRequest $request, ARI $repository)
|
public function store(AccountFormRequest $request, ARI $repository)
|
||||||
{
|
{
|
||||||
$accountData = [
|
$data = $request->getAccountData();
|
||||||
'name' => trim($request->input('name')),
|
$account = $repository->store($data);
|
||||||
'accountType' => $request->input('what'),
|
|
||||||
'virtualBalance' => round($request->input('virtualBalance'), 2),
|
|
||||||
'virtualBalanceCurrency' => intval($request->input('amount_currency_id_virtualBalance')),
|
|
||||||
'active' => true,
|
|
||||||
'user' => auth()->user()->id,
|
|
||||||
'iban' => trim($request->input('iban')),
|
|
||||||
'accountNumber' => trim($request->input('accountNumber')),
|
|
||||||
'accountRole' => $request->input('accountRole'),
|
|
||||||
'openingBalance' => round($request->input('openingBalance'), 2),
|
|
||||||
'openingBalanceDate' => new Carbon((string)$request->input('openingBalanceDate')),
|
|
||||||
'openingBalanceCurrency' => intval($request->input('amount_currency_id_openingBalance')),
|
|
||||||
|
|
||||||
];
|
|
||||||
|
|
||||||
$account = $repository->store($accountData);
|
|
||||||
|
|
||||||
Session::flash('success', strval(trans('firefly.stored_new_account', ['name' => $account->name])));
|
Session::flash('success', strval(trans('firefly.stored_new_account', ['name' => $account->name])));
|
||||||
Preferences::mark();
|
Preferences::mark();
|
||||||
@@ -345,22 +330,8 @@ class AccountController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function update(AccountFormRequest $request, ARI $repository, Account $account)
|
public function update(AccountFormRequest $request, ARI $repository, Account $account)
|
||||||
{
|
{
|
||||||
|
$data = $request->getAccountData();
|
||||||
$accountData = [
|
$repository->update($account, $data);
|
||||||
'name' => $request->input('name'),
|
|
||||||
'active' => $request->input('active'),
|
|
||||||
'user' => auth()->user()->id,
|
|
||||||
'iban' => $request->input('iban'),
|
|
||||||
'accountNumber' => $request->input('accountNumber'),
|
|
||||||
'accountRole' => $request->input('accountRole'),
|
|
||||||
'virtualBalance' => round($request->input('virtualBalance'), 2),
|
|
||||||
'openingBalance' => round($request->input('openingBalance'), 2),
|
|
||||||
'openingBalanceDate' => new Carbon((string)$request->input('openingBalanceDate')),
|
|
||||||
'openingBalanceCurrency' => intval($request->input('amount_currency_id_openingBalance')),
|
|
||||||
'ccType' => $request->input('ccType'),
|
|
||||||
'ccMonthlyPaymentDate' => $request->input('ccMonthlyPaymentDate'),
|
|
||||||
];
|
|
||||||
$repository->update($account, $accountData);
|
|
||||||
|
|
||||||
Session::flash('success', strval(trans('firefly.updated_account', ['name' => $account->name])));
|
Session::flash('success', strval(trans('firefly.updated_account', ['name' => $account->name])));
|
||||||
Preferences::mark();
|
Preferences::mark();
|
||||||
|
@@ -164,14 +164,8 @@ class AttachmentController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function update(AttachmentFormRequest $request, AttachmentRepositoryInterface $repository, Attachment $attachment)
|
public function update(AttachmentFormRequest $request, AttachmentRepositoryInterface $repository, Attachment $attachment)
|
||||||
{
|
{
|
||||||
|
$data = $request->getAttachmentData();
|
||||||
$attachmentData = [
|
$repository->update($attachment, $data);
|
||||||
'title' => $request->input('title'),
|
|
||||||
'description' => $request->input('description'),
|
|
||||||
'notes' => $request->input('notes'),
|
|
||||||
];
|
|
||||||
|
|
||||||
$repository->update($attachment, $attachmentData);
|
|
||||||
|
|
||||||
Session::flash('success', strval(trans('firefly.attachment_updated', ['name' => $attachment->filename])));
|
Session::flash('success', strval(trans('firefly.attachment_updated', ['name' => $attachment->filename])));
|
||||||
Preferences::mark();
|
Preferences::mark();
|
||||||
|
@@ -359,11 +359,8 @@ class BudgetController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function store(BudgetFormRequest $request, BudgetRepositoryInterface $repository)
|
public function store(BudgetFormRequest $request, BudgetRepositoryInterface $repository)
|
||||||
{
|
{
|
||||||
$budgetData = [
|
$data = $request->getBudgetData();
|
||||||
'name' => $request->input('name'),
|
$budget = $repository->store($data);
|
||||||
'user' => auth()->user()->id,
|
|
||||||
];
|
|
||||||
$budget = $repository->store($budgetData);
|
|
||||||
|
|
||||||
Session::flash('success', strval(trans('firefly.stored_new_budget', ['name' => e($budget->name)])));
|
Session::flash('success', strval(trans('firefly.stored_new_budget', ['name' => e($budget->name)])));
|
||||||
Preferences::mark();
|
Preferences::mark();
|
||||||
@@ -389,12 +386,8 @@ class BudgetController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function update(BudgetFormRequest $request, BudgetRepositoryInterface $repository, Budget $budget)
|
public function update(BudgetFormRequest $request, BudgetRepositoryInterface $repository, Budget $budget)
|
||||||
{
|
{
|
||||||
$budgetData = [
|
$data = $request->getBudgetData();
|
||||||
'name' => $request->input('name'),
|
$repository->update($budget, $data);
|
||||||
'active' => intval($request->input('active')) == 1,
|
|
||||||
];
|
|
||||||
|
|
||||||
$repository->update($budget, $budgetData);
|
|
||||||
|
|
||||||
Session::flash('success', strval(trans('firefly.updated_budget', ['name' => e($budget->name)])));
|
Session::flash('success', strval(trans('firefly.updated_budget', ['name' => e($budget->name)])));
|
||||||
Preferences::mark();
|
Preferences::mark();
|
||||||
|
@@ -13,6 +13,7 @@ declare(strict_types = 1);
|
|||||||
|
|
||||||
namespace FireflyIII\Http\Requests;
|
namespace FireflyIII\Http\Requests;
|
||||||
|
|
||||||
|
use Carbon\Carbon;
|
||||||
use FireflyIII\Models\Account;
|
use FireflyIII\Models\Account;
|
||||||
use Input;
|
use Input;
|
||||||
|
|
||||||
@@ -33,6 +34,29 @@ class AccountFormRequest extends Request
|
|||||||
return auth()->check();
|
return auth()->check();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getAccountData(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'name' => trim($this->input('name')),
|
||||||
|
'active' => intval($this->input('active')) === 1,
|
||||||
|
'accountType' => $this->input('what'),
|
||||||
|
'virtualBalance' => round($this->input('virtualBalance'), 2),
|
||||||
|
'virtualBalanceCurrency' => intval($this->input('amount_currency_id_virtualBalance')),
|
||||||
|
'user' => auth()->user()->id,
|
||||||
|
'iban' => trim($this->input('iban')),
|
||||||
|
'accountNumber' => trim($this->input('accountNumber')),
|
||||||
|
'accountRole' => $this->input('accountRole'),
|
||||||
|
'openingBalance' => round($this->input('openingBalance'), 2),
|
||||||
|
'openingBalanceDate' => new Carbon((string)$this->input('openingBalanceDate')),
|
||||||
|
'openingBalanceCurrency' => intval($this->input('amount_currency_id_openingBalance')),
|
||||||
|
'ccType' => $this->input('ccType'),
|
||||||
|
'ccMonthlyPaymentDate' => $this->input('ccMonthlyPaymentDate'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
|
@@ -30,6 +30,18 @@ class AttachmentFormRequest extends Request
|
|||||||
return auth()->check();
|
return auth()->check();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getAttachmentData(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'title' => trim($this->input('title')),
|
||||||
|
'description' => trim($this->input('description')),
|
||||||
|
'notes' => trim($this->input('notes')),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
|
@@ -29,10 +29,21 @@ class BudgetFormRequest extends Request
|
|||||||
*/
|
*/
|
||||||
public function authorize()
|
public function authorize()
|
||||||
{
|
{
|
||||||
// Only allow logged in users
|
|
||||||
return auth()->check();
|
return auth()->check();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getBudgetData(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'name' => trim($this->input('name')),
|
||||||
|
'user' => auth()->user()->id,
|
||||||
|
'active' => intval($this->input('active')) == 1,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
|
@@ -7,6 +7,7 @@
|
|||||||
<form action="{{ route('accounts.store') }}" method="post" id="store" class="form-horizontal">
|
<form action="{{ route('accounts.store') }}" method="post" id="store" class="form-horizontal">
|
||||||
<input type="hidden" name="_token" value="{{ csrf_token() }}"/>
|
<input type="hidden" name="_token" value="{{ csrf_token() }}"/>
|
||||||
<input type="hidden" name="what" value="{{ what }}"/>
|
<input type="hidden" name="what" value="{{ what }}"/>
|
||||||
|
<input type="hidden" name="active" value="1"/>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-6 col-md-6 col-sm-12">
|
<div class="col-lg-6 col-md-6 col-sm-12">
|
||||||
|
@@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
<form method="POST" action="{{ route('budgets.store') }}" accept-charset="UTF-8" class="form-horizontal" id="store">
|
<form method="POST" action="{{ route('budgets.store') }}" accept-charset="UTF-8" class="form-horizontal" id="store">
|
||||||
<input name="_token" type="hidden" value="{{ csrf_token() }}">
|
<input name="_token" type="hidden" value="{{ csrf_token() }}">
|
||||||
|
<input name="active" type="hidden" value="1">
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-6 col-md-6 col-sm-12">
|
<div class="col-lg-6 col-md-6 col-sm-12">
|
||||||
|
Reference in New Issue
Block a user