From 4b7d14363038ea62b7144b24909753e38b570515 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Mon, 3 Aug 2015 22:08:07 +0300 Subject: [PATCH] Minor fixes --- app/Http/Controllers/Auth/AuthController.php | 2 +- app/Http/Controllers/UserController.php | 6 +----- app/Libraries/Utils.php | 6 ++++++ app/Models/Account.php | 2 +- app/Ninja/Repositories/AccountRepository.php | 6 +++++- public/js/built.js | 2 +- public/js/script.js | 2 +- resources/views/accounts/details.blade.php | 2 +- resources/views/header.blade.php | 6 +++--- resources/views/invoices/edit.blade.php | 2 +- resources/views/user_account.blade.php | 2 +- 11 files changed, 22 insertions(+), 16 deletions(-) diff --git a/app/Http/Controllers/Auth/AuthController.php b/app/Http/Controllers/Auth/AuthController.php index e17135fe7146..a5897ac6879d 100644 --- a/app/Http/Controllers/Auth/AuthController.php +++ b/app/Http/Controllers/Auth/AuthController.php @@ -62,7 +62,7 @@ class AuthController extends Controller { $userId = Auth::check() ? Auth::user()->id : null; $user = User::where('email', '=', $request->input('email'))->first(); - if ($user->failed_logins >= 3) { + if ($user && $user->failed_logins >= 3) { Session::flash('error', 'These credentials do not match our records.'); return redirect()->to('login'); } diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php index 50b66b69f720..85b4cede7d9a 100644 --- a/app/Http/Controllers/UserController.php +++ b/app/Http/Controllers/UserController.php @@ -382,10 +382,6 @@ class UserController extends BaseController public function manageCompanies() { - $data = [ - - ]; - - return View::make('users.account_management', $data); + return View::make('users.account_management'); } } diff --git a/app/Libraries/Utils.php b/app/Libraries/Utils.php index b38911371476..1efcf4b229a8 100644 --- a/app/Libraries/Utils.php +++ b/app/Libraries/Utils.php @@ -3,6 +3,7 @@ use Auth; use Cache; use DB; +use App; use Schema; use Session; use Request; @@ -69,6 +70,11 @@ class Utils return Auth::check() && Auth::user()->isPro(); } + public static function isEnglish() + { + return App::getLocale() == 'en'; + } + public static function getUserType() { if (Utils::isNinja()) { diff --git a/app/Models/Account.php b/app/Models/Account.php index be307f6ca775..e8cde5293c09 100644 --- a/app/Models/Account.php +++ b/app/Models/Account.php @@ -147,7 +147,7 @@ class Account extends Eloquent public function getLogoPath() { $fileName = 'logo/' . $this->account_key; - return file_exists($fileName.'.png') ? $fileName.'.png' : $fileName.'.jpg'; + return file_exists($fileName.'.png') && $this->utf8_invoices ? $fileName.'.png' : $fileName.'.jpg'; } public function getLogoWidth() diff --git a/app/Ninja/Repositories/AccountRepository.php b/app/Ninja/Repositories/AccountRepository.php index 98ef973f674f..222463c4b532 100644 --- a/app/Ninja/Repositories/AccountRepository.php +++ b/app/Ninja/Repositories/AccountRepository.php @@ -6,7 +6,7 @@ use Session; use Utils; use DB; use stdClass; - +use Schema; use App\Models\AccountGateway; use App\Models\Invitation; use App\Models\Invoice; @@ -250,6 +250,10 @@ class AccountRepository public function findUserAccounts($userId1, $userId2 = false) { + if (!Schema::hasTable('user_accounts')) { + return false; + } + $query = UserAccount::where('user_id1', '=', $userId1) ->orWhere('user_id2', '=', $userId1) ->orWhere('user_id3', '=', $userId1) diff --git a/public/js/built.js b/public/js/built.js index 0a22d2a5a35e..a47d137523b7 100644 --- a/public/js/built.js +++ b/public/js/built.js @@ -29884,7 +29884,7 @@ function generatePDF(invoice, javascript, force, cb) { if (!invoice || !javascript) { return; } - console.log('== generatePDF - force: %s', force); + //console.log('== generatePDF - force: %s', force); if (force || !invoiceOld) { refreshTimer = null; } else { diff --git a/public/js/script.js b/public/js/script.js index dded462d101a..eabb1be9f671 100644 --- a/public/js/script.js +++ b/public/js/script.js @@ -13,7 +13,7 @@ function generatePDF(invoice, javascript, force, cb) { if (!invoice || !javascript) { return; } - console.log('== generatePDF - force: %s', force); + //console.log('== generatePDF - force: %s', force); if (force || !invoiceOld) { refreshTimer = null; } else { diff --git a/resources/views/accounts/details.blade.php b/resources/views/accounts/details.blade.php index 89a2a179f94b..b433f55b7353 100644 --- a/resources/views/accounts/details.blade.php +++ b/resources/views/accounts/details.blade.php @@ -51,7 +51,7 @@ @if (file_exists($account->getLogoPath()))
- {!! HTML::image($account->getLogoPath().'?no_cache='.time(), "Logo") !!}   + {!! HTML::image($account->getLogoPath().'?no_cache='.time(), 'Logo', ['width' => 200]) !!}   {{ trans('texts.remove_logo') }}

@endif diff --git a/resources/views/header.blade.php b/resources/views/header.blade.php index e42e71f27574..9abb87690796 100644 --- a/resources/views/header.blade.php +++ b/resources/views/header.blade.php @@ -253,12 +253,12 @@ }, 2000); $('#search').blur(function(){ - $('#search').css('width', '150px'); + $('#search').css('width', '{{ Utils::isEnglish() ? 150 : 100 }}px'); $('ul.navbar-right').show(); }); $('#search').focus(function(){ - $('#search').css('width', '256px'); + $('#search').css('width', '{{ Utils::isEnglish() ? 256 : 206 }}px'); $('ul.navbar-right').hide(); if (!window.hasOwnProperty('searchData')) { $.get('{{ URL::route('getSearchData') }}', function(data) { @@ -461,7 +461,7 @@ diff --git a/resources/views/invoices/edit.blade.php b/resources/views/invoices/edit.blade.php index 317b72965392..db574f26b340 100644 --- a/resources/views/invoices/edit.blade.php +++ b/resources/views/invoices/edit.blade.php @@ -94,7 +94,7 @@ {!! Former::text('end_date')->data_bind("datePicker: end_date, valueUpdate: 'afterkeydown'") ->data_date_format(Session::get(SESSION_DATE_PICKER_FORMAT, DEFAULT_DATE_PICKER_FORMAT))->append('') !!} - @if ($invoice && $invoice->recurring_invoice_id) + @if ($invoice && $invoice->recurring_invoice)
{!! trans('texts.created_by_recurring', ['invoice' => link_to('/invoices/'.$invoice->recurring_invoice->public_id, $invoice->recurring_invoice->invoice_number)]) !!}
diff --git a/resources/views/user_account.blade.php b/resources/views/user_account.blade.php index 7364f33f6afc..9384f621b498 100644 --- a/resources/views/user_account.blade.php +++ b/resources/views/user_account.blade.php @@ -1,5 +1,5 @@
  • - @if (isset($user_id)) + @if (isset($user_id) && $user_id != Auth::user()->id) @else