mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Clean up some code, optimise the 503 error.
This commit is contained in:
parent
a4d8bbe3da
commit
776b37f4ea
@ -96,14 +96,15 @@ class FireflyValidator extends Validator
|
|||||||
|
|
||||||
|
|
||||||
if ($hasWhat) {
|
if ($hasWhat) {
|
||||||
|
|
||||||
$search = Config::get('firefly.accountTypeByIdentifier.' . $this->data['what']);
|
$search = Config::get('firefly.accountTypeByIdentifier.' . $this->data['what']);
|
||||||
$type = AccountType::whereType($search)->first();
|
$type = AccountType::whereType($search)->first();
|
||||||
// this field can be used to find the exact type, and continue.
|
// this field can be used to find the exact type, and continue.
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($hasAccountTypeId) {
|
if ($hasAccountTypeId) {
|
||||||
$type = AccountType::find($this->data['account_type_id']);
|
$type = AccountType::find($this->data['account_type_id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($hasAccountId) {
|
if ($hasAccountId) {
|
||||||
/** @var Account $account */
|
/** @var Account $account */
|
||||||
$account = Account::find($this->data['id']);
|
$account = Account::find($this->data['id']);
|
||||||
@ -138,62 +139,6 @@ class FireflyValidator extends Validator
|
|||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
// exit;
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// // get account type from data, we must have this:
|
|
||||||
// $validTypes = array_keys(Config::get('firefly.subTitlesByIdentifier'));
|
|
||||||
// $dbType = null;
|
|
||||||
// $type = isset($this->data['what']) && in_array($this->data['what'], $validTypes) ? $this->data['what'] : null;
|
|
||||||
// // some fallback:
|
|
||||||
// if (is_null($type)) {
|
|
||||||
// $type = in_array(Input::get('what'), $validTypes) ? Input::get('what') : null;
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// // still null?
|
|
||||||
// if (is_null($type)) {
|
|
||||||
// // find by other field:
|
|
||||||
// $findType = isset($this->data['account_type_id']) ? $this->data['account_type_id'] : 0;
|
|
||||||
// $dbType = AccountType::find($findType);
|
|
||||||
// $type = $findType == 0 ? null : $findType;
|
|
||||||
// }
|
|
||||||
// // STILL null?
|
|
||||||
//
|
|
||||||
// if (is_null($type) && isset($this->data['id'])) {
|
|
||||||
// // check ID thingie
|
|
||||||
// $dbAccount = Account::find($this->data['id']);
|
|
||||||
// if (!$dbAccount) {
|
|
||||||
// Log::error('False because $dbAccount does not exist.');
|
|
||||||
//
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
// $dbType = AccountType::find($dbAccount->account_type_id);
|
|
||||||
// } else {
|
|
||||||
// $dbType = AccountType::whereType()
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (is_null($dbType)) {
|
|
||||||
// Log::error('False because $dbType is null.');
|
|
||||||
//
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// // user id?
|
|
||||||
// $userId = Auth::check() ? Auth::user()->id : $this->data['user_id'];
|
|
||||||
//
|
|
||||||
// $query = DB::table('accounts')->where('name', $value)->where('account_type_id', $dbType->id)->where('user_id', $userId);
|
|
||||||
//
|
|
||||||
// if (isset($parameters[0])) {
|
|
||||||
// $query->where('id', '!=', $parameters[0]);
|
|
||||||
// }
|
|
||||||
// $count = $query->count();
|
|
||||||
// if ($count == 0) {
|
|
||||||
//
|
|
||||||
// return true;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// return false;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<link href='http://fonts.googleapis.com/css?family=Lato:100' rel='stylesheet' type='text/css'>
|
<link href='https://fonts.googleapis.com/css?family=Lato:100' rel='stylesheet' type='text/css'>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
body {
|
body {
|
||||||
|
Loading…
Reference in New Issue
Block a user