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