mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-16 09:22:33 +00:00
Renamed some methods.
This commit is contained in:
@@ -32,7 +32,7 @@ class HelpController extends Controller
|
|||||||
return Response::json($content);
|
return Response::json($content);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->_inCache($route)) {
|
if ($this->inCache($route)) {
|
||||||
$content = [
|
$content = [
|
||||||
'text' => Cache::get('help.' . $route . '.text'),
|
'text' => Cache::get('help.' . $route . '.text'),
|
||||||
'title' => Cache::get('help.' . $route . '.title'),
|
'title' => Cache::get('help.' . $route . '.title'),
|
||||||
@@ -40,7 +40,7 @@ class HelpController extends Controller
|
|||||||
|
|
||||||
return Response::json($content);
|
return Response::json($content);
|
||||||
}
|
}
|
||||||
$content = $this->_getFromGithub($route);
|
$content = $this->getFromGithub($route);
|
||||||
|
|
||||||
|
|
||||||
Cache::put('help.' . $route . '.text', $content['text'], 10080); // a week.
|
Cache::put('help.' . $route . '.text', $content['text'], 10080); // a week.
|
||||||
@@ -55,7 +55,7 @@ class HelpController extends Controller
|
|||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
protected function _inCache($route)
|
protected function inCache($route)
|
||||||
{
|
{
|
||||||
return Cache::has('help.' . $route . '.title') && Cache::has('help.' . $route . '.text');
|
return Cache::has('help.' . $route . '.title') && Cache::has('help.' . $route . '.text');
|
||||||
}
|
}
|
||||||
@@ -65,7 +65,7 @@ class HelpController extends Controller
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
protected function _getFromGithub($route)
|
protected function getFromGithub($route)
|
||||||
{
|
{
|
||||||
$uri = 'https://raw.githubusercontent.com/JC5/firefly-iii-help/master/' . e($route) . '.md';
|
$uri = 'https://raw.githubusercontent.com/JC5/firefly-iii-help/master/' . e($route) . '.md';
|
||||||
$content = [
|
$content = [
|
||||||
|
@@ -45,7 +45,7 @@ class ProfileController extends Controller
|
|||||||
|
|
||||||
return Redirect::route('change-password');
|
return Redirect::route('change-password');
|
||||||
}
|
}
|
||||||
$result = $this->_validatePassword($request->get('current_password'), $request->get('new_password'), $request->get('new_password_confirmation'));
|
$result = $this->validatePassword($request->get('current_password'), $request->get('new_password'), $request->get('new_password_confirmation'));
|
||||||
if (!($result === true)) {
|
if (!($result === true)) {
|
||||||
Session::flash('error', $result);
|
Session::flash('error', $result);
|
||||||
|
|
||||||
@@ -70,7 +70,7 @@ class ProfileController extends Controller
|
|||||||
*
|
*
|
||||||
* @return string|bool
|
* @return string|bool
|
||||||
*/
|
*/
|
||||||
protected function _validatePassword($old, $new1, $new2)
|
protected function validatePassword($old, $new1, $new2)
|
||||||
{
|
{
|
||||||
if (strlen($new1) == 0 || strlen($new2) == 0) {
|
if (strlen($new1) == 0 || strlen($new2) == 0) {
|
||||||
return 'Do fill in a password!';
|
return 'Do fill in a password!';
|
||||||
|
@@ -201,8 +201,8 @@ class AccountRepository implements AccountRepositoryInterface
|
|||||||
*/
|
*/
|
||||||
public function store(array $data)
|
public function store(array $data)
|
||||||
{
|
{
|
||||||
$newAccount = $this->_store($data);
|
$newAccount = $this->storeAccount($data);
|
||||||
$this->_storeMetadata($newAccount, $data);
|
$this->storeMetadata($newAccount, $data);
|
||||||
|
|
||||||
|
|
||||||
// continue with the opposing account:
|
// continue with the opposing account:
|
||||||
@@ -214,8 +214,8 @@ class AccountRepository implements AccountRepositoryInterface
|
|||||||
'name' => $data['name'] . ' initial balance',
|
'name' => $data['name'] . ' initial balance',
|
||||||
'active' => false,
|
'active' => false,
|
||||||
];
|
];
|
||||||
$opposing = $this->_store($opposingData);
|
$opposing = $this->storeAccount($opposingData);
|
||||||
$this->_storeInitialBalance($newAccount, $opposing, $data);
|
$this->storeInitialBalance($newAccount, $opposing, $data);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -235,7 +235,7 @@ class AccountRepository implements AccountRepositoryInterface
|
|||||||
$account->save();
|
$account->save();
|
||||||
|
|
||||||
// update meta data:
|
// update meta data:
|
||||||
$this->_updateMetadata($account, $data);
|
$this->updateMetadata($account, $data);
|
||||||
|
|
||||||
$openingBalance = $this->openingBalanceTransaction($account);
|
$openingBalance = $this->openingBalanceTransaction($account);
|
||||||
|
|
||||||
@@ -244,7 +244,7 @@ class AccountRepository implements AccountRepositoryInterface
|
|||||||
// if opening balance, do an update:
|
// if opening balance, do an update:
|
||||||
if ($openingBalance) {
|
if ($openingBalance) {
|
||||||
// update existing opening balance.
|
// update existing opening balance.
|
||||||
$this->_updateInitialBalance($account, $openingBalance, $data);
|
$this->updateInitialBalance($account, $openingBalance, $data);
|
||||||
} else {
|
} else {
|
||||||
// create new opening balance.
|
// create new opening balance.
|
||||||
$type = $data['openingBalance'] < 0 ? 'expense' : 'revenue';
|
$type = $data['openingBalance'] < 0 ? 'expense' : 'revenue';
|
||||||
@@ -254,8 +254,8 @@ class AccountRepository implements AccountRepositoryInterface
|
|||||||
'name' => $data['name'] . ' initial balance',
|
'name' => $data['name'] . ' initial balance',
|
||||||
'active' => false,
|
'active' => false,
|
||||||
];
|
];
|
||||||
$opposing = $this->_store($opposingData);
|
$opposing = $this->storeAccount($opposingData);
|
||||||
$this->_storeInitialBalance($account, $opposing, $data);
|
$this->storeInitialBalance($account, $opposing, $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -274,7 +274,7 @@ class AccountRepository implements AccountRepositoryInterface
|
|||||||
*
|
*
|
||||||
* @return Account
|
* @return Account
|
||||||
*/
|
*/
|
||||||
protected function _store(array $data)
|
protected function storeAccount(array $data)
|
||||||
{
|
{
|
||||||
$type = Config::get('firefly.accountTypeByIdentifier.' . $data['accountType']);
|
$type = Config::get('firefly.accountTypeByIdentifier.' . $data['accountType']);
|
||||||
$accountType = AccountType::whereType($type)->first();
|
$accountType = AccountType::whereType($type)->first();
|
||||||
@@ -306,7 +306,7 @@ class AccountRepository implements AccountRepositoryInterface
|
|||||||
* @param Account $account
|
* @param Account $account
|
||||||
* @param array $data
|
* @param array $data
|
||||||
*/
|
*/
|
||||||
protected function _storeMetadata(Account $account, array $data)
|
protected function storeMetadata(Account $account, array $data)
|
||||||
{
|
{
|
||||||
$metaData = new AccountMeta(
|
$metaData = new AccountMeta(
|
||||||
[
|
[
|
||||||
@@ -328,7 +328,7 @@ class AccountRepository implements AccountRepositoryInterface
|
|||||||
*
|
*
|
||||||
* @return TransactionJournal
|
* @return TransactionJournal
|
||||||
*/
|
*/
|
||||||
protected function _storeInitialBalance(Account $account, Account $opposing, array $data)
|
protected function storeInitialBalance(Account $account, Account $opposing, array $data)
|
||||||
{
|
{
|
||||||
$type = $data['openingBalance'] < 0 ? 'Withdrawal' : 'Deposit';
|
$type = $data['openingBalance'] < 0 ? 'Withdrawal' : 'Deposit';
|
||||||
$transactionType = TransactionType::whereType($type)->first();
|
$transactionType = TransactionType::whereType($type)->first();
|
||||||
@@ -397,7 +397,7 @@ class AccountRepository implements AccountRepositoryInterface
|
|||||||
* @param Account $account
|
* @param Account $account
|
||||||
* @param array $data
|
* @param array $data
|
||||||
*/
|
*/
|
||||||
protected function _updateMetadata(Account $account, array $data)
|
protected function updateMetadata(Account $account, array $data)
|
||||||
{
|
{
|
||||||
$metaEntries = $account->accountMeta()->get();
|
$metaEntries = $account->accountMeta()->get();
|
||||||
$updated = false;
|
$updated = false;
|
||||||
@@ -434,7 +434,7 @@ class AccountRepository implements AccountRepositoryInterface
|
|||||||
*
|
*
|
||||||
* @return TransactionJournal
|
* @return TransactionJournal
|
||||||
*/
|
*/
|
||||||
protected function _updateInitialBalance(Account $account, TransactionJournal $journal, array $data)
|
protected function updateInitialBalance(Account $account, TransactionJournal $journal, array $data)
|
||||||
{
|
{
|
||||||
$journal->date = $data['openingBalanceDate'];
|
$journal->date = $data['openingBalanceDate'];
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user