From 521fc107f1e73a857fddec693caffd8b4a65e8b1 Mon Sep 17 00:00:00 2001
From: Hillel Coren
Date: Tue, 3 Nov 2015 13:20:49 +0200
Subject: [PATCH] Bug fixes
---
app/Http/Controllers/AccountController.php | 12 +++++++++++-
app/Http/Controllers/Auth/AuthController.php | 4 ++--
public/js/pdf.pdfmake.js | 1 +
resources/views/auth/login.blade.php | 1 +
4 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/app/Http/Controllers/AccountController.php b/app/Http/Controllers/AccountController.php
index 2b6fc33216bb..dca795945620 100644
--- a/app/Http/Controllers/AccountController.php
+++ b/app/Http/Controllers/AccountController.php
@@ -859,8 +859,10 @@ class AccountController extends BaseController
$mimeType = $file->getMimeType();
if ($mimeType == 'image/jpeg') {
+ $path = 'logo/' . $account->account_key . '.jpg';
$file->move('logo/', $account->account_key . '.jpg');
} else if ($mimeType == 'image/png') {
+ $path = 'logo/' . $account->account_key . '.png';
$file->move('logo/', $account->account_key . '.png');
} else {
if (extension_loaded('fileinfo')) {
@@ -868,12 +870,20 @@ class AccountController extends BaseController
$image->resize(200, 120, function ($constraint) {
$constraint->aspectRatio();
});
+ $path = 'logo/'.$account->account_key.'.jpg';
Image::canvas($image->width(), $image->height(), '#FFFFFF')
- ->insert($image)->save('logo/'.$account->account_key.'.jpg');
+ ->insert($image)->save($path);
} else {
Session::flash('warning', 'Warning: To support gifs the fileinfo PHP extension needs to be enabled.');
}
}
+
+ // make sure image isn't interlaced
+ if (extension_loaded('fileinfo')) {
+ $img = Image::make($path);
+ $img->interlace(false);
+ $img->save();
+ }
}
Event::fire(new UserSettingsChanged());
diff --git a/app/Http/Controllers/Auth/AuthController.php b/app/Http/Controllers/Auth/AuthController.php
index a65f6153037b..586f55e6735a 100644
--- a/app/Http/Controllers/Auth/AuthController.php
+++ b/app/Http/Controllers/Auth/AuthController.php
@@ -90,9 +90,9 @@ class AuthController extends Controller {
$users = false;
// we're linking a new account
- if ($userId && Auth::user()->id != $userId) {
+ if ($request->link_accounts && $userId && Auth::user()->id != $userId) {
$users = $this->accountRepo->associateAccounts($userId, Auth::user()->id);
- Session::flash('warning', trans('texts.associated_accounts'));
+ Session::flash('message', trans('texts.associated_accounts'));
// check if other accounts are linked
} else {
$users = $this->accountRepo->loadAccounts(Auth::user()->id);
diff --git a/public/js/pdf.pdfmake.js b/public/js/pdf.pdfmake.js
index 57118324d524..4a795553b763 100644
--- a/public/js/pdf.pdfmake.js
+++ b/public/js/pdf.pdfmake.js
@@ -104,6 +104,7 @@ function GetPdfMake(invoice, javascript, callback) {
doc.save = function(fileName) {
this.download(fileName);
};
+
return doc;
}
diff --git a/resources/views/auth/login.blade.php b/resources/views/auth/login.blade.php
index 33e2d84addab..fe275fe1d54f 100644
--- a/resources/views/auth/login.blade.php
+++ b/resources/views/auth/login.blade.php
@@ -87,6 +87,7 @@
->large()->submit()->block() !!}
@if (Input::get('new_company') && Utils::allowNewAccounts())
+ {!! Former::hidden('link_accounts')->value('true') !!}
- {{ trans('texts.or') }} -
{!! Button::primary(trans('texts.new_company'))->asLinkTo(URL::to('/invoice_now?new_company=true&sign_up=true'))->large()->submit()->block() !!}
@elseif (Utils::isOAuthEnabled())