mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-26 07:15:41 +00:00
Some code simplifications.
This commit is contained in:
@@ -286,17 +286,14 @@ class ReportHelper implements ReportHelperInterface
|
|||||||
/** @var Tag $entry */
|
/** @var Tag $entry */
|
||||||
foreach ($set as $entry) {
|
foreach ($set as $entry) {
|
||||||
// less than zero? multiply to be above zero.
|
// less than zero? multiply to be above zero.
|
||||||
$amount = $entry->amount;
|
$amount = $entry->amount;
|
||||||
$id = intval($entry->id);
|
$id = intval($entry->id);
|
||||||
if (!isset($collection[$id])) {
|
$previousAmount = $collection[$id]['amount'] ?? '0';
|
||||||
$collection[$id] = [
|
$collection[$id] = [
|
||||||
'id' => $id,
|
'id' => $id,
|
||||||
'tag' => $entry->tag,
|
'tag' => $entry->tag,
|
||||||
'amount' => $amount,
|
'amount' => bcadd($previousAmount, $amount),
|
||||||
];
|
];
|
||||||
} else {
|
|
||||||
$collection[$id]['amount'] = bcadd($collection[$id]['amount'], $amount);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// cleanup collection (match "fonts")
|
// cleanup collection (match "fonts")
|
||||||
|
@@ -128,12 +128,13 @@ class AttachmentController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function preview(Attachment $attachment)
|
public function preview(Attachment $attachment)
|
||||||
{
|
{
|
||||||
if ($attachment->mime == 'application/pdf') {
|
$image = 'images/page_green.png';
|
||||||
$file = public_path('images/page_white_acrobat.png');
|
|
||||||
} else {
|
|
||||||
$file = public_path('images/page_green.png');
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
if ($attachment->mime == 'application/pdf') {
|
||||||
|
$image = 'images/page_white_acrobat.png';
|
||||||
|
}
|
||||||
|
$file = public_path($image);
|
||||||
$response = Response::make(File::get($file));
|
$response = Response::make(File::get($file));
|
||||||
$response->header('Content-Type', 'image/png');
|
$response->header('Content-Type', 'image/png');
|
||||||
|
|
||||||
|
@@ -69,14 +69,13 @@ class ConfirmationController extends Controller
|
|||||||
$now = time();
|
$now = time();
|
||||||
$maxDiff = config('firefly.resend_confirmation');
|
$maxDiff = config('firefly.resend_confirmation');
|
||||||
$owner = env('SITE_OWNER', 'mail@example.com');
|
$owner = env('SITE_OWNER', 'mail@example.com');
|
||||||
|
$view = 'auth.confirmation.no-resent';
|
||||||
if ($now - $time > $maxDiff) {
|
if ($now - $time > $maxDiff) {
|
||||||
|
|
||||||
event(new ResendConfirmation(Auth::user(), $request->ip()));
|
event(new ResendConfirmation(Auth::user(), $request->ip()));
|
||||||
|
$view = 'auth.confirmation.resent';
|
||||||
return view('auth.confirmation.resent', ['owner' => $owner]);
|
|
||||||
} else {
|
|
||||||
return view('auth.confirmation.no-resent', ['owner' => $owner]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return view($view, ['owner' => $owner]);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -53,11 +53,14 @@ class PasswordController extends Controller
|
|||||||
{
|
{
|
||||||
$this->validate($request, ['email' => 'required|email']);
|
$this->validate($request, ['email' => 'required|email']);
|
||||||
|
|
||||||
$user = User::whereEmail($request->get('email'))->first();
|
$user = User::whereEmail($request->get('email'))->first();
|
||||||
|
$response = 'passwords.blocked';
|
||||||
|
|
||||||
if (!is_null($user) && intval($user->blocked) === 1) {
|
if (is_null($user)) {
|
||||||
$response = 'passwords.blocked';
|
$response = Password::INVALID_USER;
|
||||||
} else {
|
}
|
||||||
|
|
||||||
|
if (!is_null($user) && intval($user->blocked) === 0) {
|
||||||
$response = Password::sendResetLink(
|
$response = Password::sendResetLink(
|
||||||
$request->only('email'), function (Message $message) {
|
$request->only('email'), function (Message $message) {
|
||||||
$message->subject($this->getEmailSubject());
|
$message->subject($this->getEmailSubject());
|
||||||
|
@@ -158,6 +158,11 @@ class BudgetController extends Controller
|
|||||||
$budgeted = '0';
|
$budgeted = '0';
|
||||||
$range = Preferences::get('viewRange', '1M')->data;
|
$range = Preferences::get('viewRange', '1M')->data;
|
||||||
$repeatFreq = Config::get('firefly.range_to_repeat_freq.' . $range);
|
$repeatFreq = Config::get('firefly.range_to_repeat_freq.' . $range);
|
||||||
|
|
||||||
|
if (session('is_custom_range') === true) {
|
||||||
|
$repeatFreq = 'custom';
|
||||||
|
}
|
||||||
|
|
||||||
/** @var Carbon $start */
|
/** @var Carbon $start */
|
||||||
$start = session('start', new Carbon);
|
$start = session('start', new Carbon);
|
||||||
/** @var Carbon $end */
|
/** @var Carbon $end */
|
||||||
|
Reference in New Issue
Block a user