From a5f991870cbc302b3e42f353100f181c6db21236 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Mon, 2 Jun 2014 19:21:47 +0300 Subject: [PATCH] Bug fixes --- app/controllers/HomeController.php | 24 ++++++++++++++++---- app/controllers/ProductController.php | 3 ++- app/filters.php | 4 +++- app/lang/de/texts.php | 2 ++ app/lang/en/texts.php | 2 +- app/lang/es/texts.php | 4 +++- app/lang/fr/texts.php | 4 +++- app/lang/it/texts.php | 2 ++ app/lang/nl/texts.php | 3 ++- app/lang/pt_BR/texts.php | 1 + app/ninja/repositories/InvoiceRepository.php | 1 + app/routes.php | 2 +- app/start/global.php | 4 ++-- app/views/error.blade.php | 17 ++++++++++++-- app/views/master.blade.php | 5 ++-- app/views/public/contact_us.blade.php | 12 +--------- 16 files changed, 62 insertions(+), 28 deletions(-) diff --git a/app/controllers/HomeController.php b/app/controllers/HomeController.php index 96fcdd649fbb..a90a76396a7a 100755 --- a/app/controllers/HomeController.php +++ b/app/controllers/HomeController.php @@ -21,12 +21,22 @@ class HomeController extends BaseController { public function showAboutUs() { - return View::make('public.about_us'); + $data = [ + 'title' => 'About Us', + 'description' => 'Invoice Ninja is an an open-source solution where you can create, customize, and generate invoices online for free using our templates!' + ]; + + return View::make('public.about_us', $data); } public function showContactUs() { - return View::make('public.contact_us'); + $data = [ + 'title' => 'Contact Us', + 'description' => 'Contact us today and try out our free or premium hassle-free plans. Start your online invoicing today with Invoice Ninja!' + ]; + + return View::make('public.contact_us', $data); } public function showTerms() @@ -46,7 +56,12 @@ class HomeController extends BaseController { public function showPlans() { - return View::make('public.plans'); + $data = [ + 'title' => 'Professional Invoicing Software & Templates', + 'description' => 'Invoice Ninja allows you to create and generate your own custom invoices. Choose from our professional invoice templates or customize your own with our pro plan.' + ]; + + return View::make('public.plans', $data); } @@ -66,7 +81,8 @@ class HomeController extends BaseController { $message = trans('texts.sent_message'); Session::flash('message', $message); - return Redirect::to('/contact'); + + return View::make('public.contact_us'); } public function showComingSoon() diff --git a/app/controllers/ProductController.php b/app/controllers/ProductController.php index 132fcb614557..7c6df2317978 100644 --- a/app/controllers/ProductController.php +++ b/app/controllers/ProductController.php @@ -26,7 +26,8 @@ class ProductController extends \BaseController {
  • '.uctrans('texts.archive_product').'
  • '; - }) + }) + ->orderColumns(['cost', 'product_key', 'cost']) ->make(); } diff --git a/app/filters.php b/app/filters.php index 6e3db447ef3d..cd9f00324e9a 100755 --- a/app/filters.php +++ b/app/filters.php @@ -107,7 +107,9 @@ Route::filter('csrf', function() $token = Request::ajax() ? Request::header('X-CSRF-Token') : Input::get('_token'); if (Session::token() != $token) - { + { + Session::flash('warning', trans('texts.session_expired')); + return Redirect::to('/'); //throw new Illuminate\Session\TokenMismatchException; } diff --git a/app/lang/de/texts.php b/app/lang/de/texts.php index 66c9b6ca61cc..1b556770132d 100644 --- a/app/lang/de/texts.php +++ b/app/lang/de/texts.php @@ -380,4 +380,6 @@ return array( 'notification_quote_sent' => 'The following client :client was emailed Quote :invoice for :amount.', 'notification_quote_viewed' => 'The following client :client viewed Quote :invoice for :amount.', + 'session_expired' => 'Your session has expired.', + ); diff --git a/app/lang/en/texts.php b/app/lang/en/texts.php index 8fc8ece4e4ef..1e953ace581b 100644 --- a/app/lang/en/texts.php +++ b/app/lang/en/texts.php @@ -395,7 +395,7 @@ return array( 'notification_quote_sent' => 'The following client :client was emailed Quote :invoice for :amount.', 'notification_quote_viewed' => 'The following client :client viewed Quote :invoice for :amount.', - + 'session_expired' => 'Your session has expired.', ); diff --git a/app/lang/es/texts.php b/app/lang/es/texts.php index dd1812ebb408..6cc14169a987 100644 --- a/app/lang/es/texts.php +++ b/app/lang/es/texts.php @@ -377,5 +377,7 @@ return array( 'notification_quote_viewed_subject' => 'Quote :invoice was viewed by :client', 'notification_quote_sent' => 'The following client :client was emailed Quote :invoice for :amount.', 'notification_quote_viewed' => 'The following client :client viewed Quote :invoice for :amount.', - + + 'session_expired' => 'Your session has expired.', + ); diff --git a/app/lang/fr/texts.php b/app/lang/fr/texts.php index 4cffdd16d1a0..3195d546c1d5 100644 --- a/app/lang/fr/texts.php +++ b/app/lang/fr/texts.php @@ -379,5 +379,7 @@ return array( 'notification_quote_viewed_subject' => 'Quote :invoice was viewed by :client', 'notification_quote_sent' => 'The following client :client was emailed Quote :invoice for :amount.', 'notification_quote_viewed' => 'The following client :client viewed Quote :invoice for :amount.', - + + 'session_expired' => 'Your session has expired.', + ); diff --git a/app/lang/it/texts.php b/app/lang/it/texts.php index 008a5c20e7d9..60caf790db43 100644 --- a/app/lang/it/texts.php +++ b/app/lang/it/texts.php @@ -380,4 +380,6 @@ return array( 'notification_quote_sent' => 'The following client :client was emailed Quote :invoice for :amount.', 'notification_quote_viewed' => 'The following client :client viewed Quote :invoice for :amount.', + 'session_expired' => 'Your session has expired.', + ); diff --git a/app/lang/nl/texts.php b/app/lang/nl/texts.php index c1ca2cb0e363..d6c7cacf9ce1 100644 --- a/app/lang/nl/texts.php +++ b/app/lang/nl/texts.php @@ -380,5 +380,6 @@ return array( 'notification_quote_viewed_subject' => 'Quote :invoice was viewed by :client', 'notification_quote_sent' => 'The following client :client was emailed Quote :invoice for :amount.', 'notification_quote_viewed' => 'The following client :client viewed Quote :invoice for :amount.', - + + 'session_expired' => 'Your session has expired.', ); diff --git a/app/lang/pt_BR/texts.php b/app/lang/pt_BR/texts.php index 1e0f21977f1b..7c58e473071e 100644 --- a/app/lang/pt_BR/texts.php +++ b/app/lang/pt_BR/texts.php @@ -369,5 +369,6 @@ return array( 'notification_quote_sent' => 'The following client :client was emailed Quote :invoice for :amount.', 'notification_quote_viewed' => 'The following client :client viewed Quote :invoice for :amount.', + 'session_expired' => 'Your session has expired.', ); diff --git a/app/ninja/repositories/InvoiceRepository.php b/app/ninja/repositories/InvoiceRepository.php index 9b855782b44a..1566b7f1c6a4 100755 --- a/app/ninja/repositories/InvoiceRepository.php +++ b/app/ninja/repositories/InvoiceRepository.php @@ -17,6 +17,7 @@ class InvoiceRepository ->join('contacts', 'contacts.client_id', '=', 'clients.id') ->where('invoices.account_id', '=', $accountId) ->where('clients.deleted_at', '=', null) + ->where('contacts.deleted_at', '=', null) ->where('invoices.is_recurring', '=', false) ->where('contacts.is_primary', '=', true) ->select('clients.public_id as client_public_id', 'invoice_number', 'clients.name as client_name', 'invoices.public_id', 'amount', 'invoices.balance', 'invoice_date', 'due_date', 'invoice_statuses.name as invoice_status_name', 'clients.currency_id', 'contacts.first_name', 'contacts.last_name', 'contacts.email', 'quote_id', 'quote_invoice_id'); diff --git a/app/routes.php b/app/routes.php index e0ef2efdce65..f8ec76523363 100755 --- a/app/routes.php +++ b/app/routes.php @@ -28,7 +28,7 @@ Route::get('/about', 'HomeController@showAboutUs'); Route::get('/terms', 'HomeController@showTerms'); Route::get('/contact', 'HomeController@showContactUs'); Route::get('/plans', 'HomeController@showPlans'); -Route::post('/contact', 'HomeController@doContactUs'); +Route::post('/contact_submit', 'HomeController@doContactUs'); Route::get('/faq', 'HomeController@showFaq'); Route::get('/features', 'HomeController@showFeatures'); Route::get('/secure_payment', 'HomeController@showSecurePayment'); diff --git a/app/start/global.php b/app/start/global.php index 046970c8f303..76d8360be6b4 100755 --- a/app/start/global.php +++ b/app/start/global.php @@ -58,9 +58,9 @@ $monolog->pushHandler(new Monolog\Handler\SyslogHandler('intranet', 'user', Logg App::error(function(Exception $exception, $code) { - //Log::error($exception); - Utils::logError($exception . ' ' . $code); + + return Response::view('error', ['error' => "A {$code} error occurred."], $code); }); /* diff --git a/app/views/error.blade.php b/app/views/error.blade.php index c24ac38fed60..a1397db1820e 100755 --- a/app/views/error.blade.php +++ b/app/views/error.blade.php @@ -1,7 +1,20 @@ -@extends('header') +@extends('public.header') @section('content') - {{ $error }} +

     

    +

     

    + +

    +
    +

    {{ $error }}

    + Looks like something went wrong.
    + If you'd like help please email us at contact@invoiceninja.com. +
    +
    + +

     

    +

     

    + @stop \ No newline at end of file diff --git a/app/views/master.blade.php b/app/views/master.blade.php index db3a3b1c679d..1ed3eb5df2cf 100755 --- a/app/views/master.blade.php +++ b/app/views/master.blade.php @@ -1,8 +1,9 @@ - Invoice Ninja {{ isset($title) ? $title : ' - Free and Open-Source Online Invoicing' }} - + Invoice Ninja | {{ isset($title) ? $title : ' Free Online Invoice Templates & Generator' }} + + diff --git a/app/views/public/contact_us.blade.php b/app/views/public/contact_us.blade.php index 1b02a51dd0e4..f9b6478e2709 100644 --- a/app/views/public/contact_us.blade.php +++ b/app/views/public/contact_us.blade.php @@ -64,23 +64,13 @@ var contactForm = {

    - - - @if (Session::has('message')) -
    {{ Session::get('message') }}
    - @endif - - @if (Session::has('error')) -
    {{ Session::get('error') }}
    - @endif -

    Questions, special requests, or just want to say hi?

    Fill in the form below and we'll get back to you as soon as possible. Hope to hear from you!

    - {{ Form::open(['url' => 'contact', 'class' => 'feedbackForm']) }} + {{ Form::open(['url' => 'contact_submit', 'class' => 'feedbackForm']) }}