From 63a6b88e20a70a1dba7d6c6a62de384b4ed404ff Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Wed, 5 Mar 2014 22:19:12 +0200 Subject: [PATCH] bug fixes --- app/controllers/AccountController.php | 2 +- app/controllers/HomeController.php | 28 ++ app/controllers/InvoiceController.php | 4 +- ...151817_add_support_for_invoice_designs.php | 1 + app/libraries/utils.php | 3 +- app/models/Invoice.php | 2 +- app/ninja/mailers/Mailer.php | 2 +- app/ninja/repositories/InvoiceRepository.php | 2 +- app/routes.php | 5 +- app/views/about_us.blade.php | 184 +++++---- app/views/contact_us.blade.php | 74 ++-- app/views/emails/contact_html.blade.php | 3 + app/views/emails/contact_text.blade.php | 4 + app/views/invoices/edit.blade.php | 49 +-- app/views/master.blade.php | 24 +- app/views/splash.blade.php | 12 +- public/js/script.js | 380 +++++++++++++++++- 17 files changed, 604 insertions(+), 175 deletions(-) create mode 100644 app/views/emails/contact_html.blade.php create mode 100644 app/views/emails/contact_text.blade.php diff --git a/app/controllers/AccountController.php b/app/controllers/AccountController.php index 9199cb3a95..1896755b5d 100755 --- a/app/controllers/AccountController.php +++ b/app/controllers/AccountController.php @@ -60,7 +60,7 @@ class AccountController extends \BaseController { public function setTrashVisible($entityType, $visible) { - Session::put('show_trash', $visible == 'true'); + Session::put('show_trash', $visible == 'true'); return Redirect::to("{$entityType}s"); } diff --git a/app/controllers/HomeController.php b/app/controllers/HomeController.php index ab892400db..c6fafe9a8b 100755 --- a/app/controllers/HomeController.php +++ b/app/controllers/HomeController.php @@ -1,8 +1,18 @@ mailer = $mailer; + } public function showWelcome() { @@ -19,6 +29,24 @@ class HomeController extends BaseController { return View::make('contact_us'); } + public function doContactUs() + { + $email = Input::get('email'); + $name = Input::get('name'); + $message = Input::get('message'); + + $data = [ + 'name' => $name, + 'email' => $email, + 'text' => $message + ]; + + $this->mailer->sendTo('contact@invoiceninja.com', 'contact@invoiceninja.com', 'Invoice Ninja Feedback', 'contact', $data); + + Session::flash('message', 'Successfully sent message'); + return Redirect::to('/contact'); + } + public function showComingSoon() { return View::make('coming_soon'); diff --git a/app/controllers/InvoiceController.php b/app/controllers/InvoiceController.php index 0a93c4bf81..7d16724aec 100755 --- a/app/controllers/InvoiceController.php +++ b/app/controllers/InvoiceController.php @@ -253,7 +253,9 @@ class InvoiceController extends \BaseController { $invoice = $input->invoice; if ($errors = $this->invoiceRepo->getErrors($invoice)) - { + { + Session::flash('error', 'Please make sure to select a client and correct any errors'); + return Redirect::to('invoices/create') ->withInput()->withErrors($errors); } diff --git a/app/database/migrations/2014_02_19_151817_add_support_for_invoice_designs.php b/app/database/migrations/2014_02_19_151817_add_support_for_invoice_designs.php index df8b3588c8..4bd8daf912 100644 --- a/app/database/migrations/2014_02_19_151817_add_support_for_invoice_designs.php +++ b/app/database/migrations/2014_02_19_151817_add_support_for_invoice_designs.php @@ -21,6 +21,7 @@ class AddSupportForInvoiceDesigns extends Migration { DB::table('invoice_designs')->insert(['name' => 'Clean']); DB::table('invoice_designs')->insert(['name' => 'Bold']); DB::table('invoice_designs')->insert(['name' => 'Modern']); + DB::table('invoice_designs')->insert(['name' => 'Plain']); Schema::table('invoices', function($table) { diff --git a/app/libraries/utils.php b/app/libraries/utils.php index c39f827139..e636682a98 100755 --- a/app/libraries/utils.php +++ b/app/libraries/utils.php @@ -27,7 +27,8 @@ class Utils 'url' => Input::get('url', Request::url()), 'user_agent' => isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '', 'ip' => Request::getClientIp(), - 'count' => Session::get('error_count', 0) + 'count' => Session::get('error_count', 0), + 'input' => Input::all() ]; Log::error('\n'.$error, $data); diff --git a/app/models/Invoice.php b/app/models/Invoice.php index f2b4bea4a8..7e73122f86 100755 --- a/app/models/Invoice.php +++ b/app/models/Invoice.php @@ -54,7 +54,7 @@ class Invoice extends EntityModel public function hidePrivateFields() { - $this->setVisible(['invoice_number', 'discount', 'po_number', 'invoice_date', 'due_date', 'terms', 'public_notes', 'amount', 'balance', 'invoice_items', 'client', 'tax_name', 'tax_rate', 'account']); + $this->setVisible(['invoice_number', 'discount', 'po_number', 'invoice_date', 'due_date', 'terms', 'public_notes', 'amount', 'balance', 'invoice_items', 'client', 'tax_name', 'tax_rate', 'account', 'invoice_design_id']); $this->client->setVisible(['name', 'address1', 'address2', 'city', 'state', 'postal_code', 'work_phone', 'payment_terms', 'contacts', 'country', 'currency_id' ]); $this->account->setVisible(['name', 'address1', 'address2', 'city', 'state', 'postal_code', 'work_phone', 'work_email', 'country', 'currency_id']); diff --git a/app/ninja/mailers/Mailer.php b/app/ninja/mailers/Mailer.php index 23bffa4a54..f54e450b3e 100755 --- a/app/ninja/mailers/Mailer.php +++ b/app/ninja/mailers/Mailer.php @@ -2,7 +2,7 @@ use Mail; -abstract class Mailer { +class Mailer { public function sendTo($toEmail, $fromEmail, $subject, $view, $data = []) { diff --git a/app/ninja/repositories/InvoiceRepository.php b/app/ninja/repositories/InvoiceRepository.php index 9e62e4fc34..73cb2fb4b1 100755 --- a/app/ninja/repositories/InvoiceRepository.php +++ b/app/ninja/repositories/InvoiceRepository.php @@ -93,7 +93,7 @@ class InvoiceRepository $invoice = (array) $input; $invoiceId = isset($invoice['public_id']) && $invoice['public_id'] ? Invoice::getPrivateId($invoice['public_id']) : null; - $rules = ['invoice_number' => 'unique:invoices,invoice_number,' . $invoiceId . ',id,account_id,' . \Auth::user()->account_id]; + $rules = ['invoice_number' => 'required|unique:invoices,invoice_number,' . $invoiceId . ',id,account_id,' . \Auth::user()->account_id]; if ($invoice['is_recurring'] && $invoice['start_date'] && $invoice['end_date']) { diff --git a/app/routes.php b/app/routes.php index 5027f907b9..483daaf57a 100755 --- a/app/routes.php +++ b/app/routes.php @@ -56,8 +56,9 @@ Route::get('/send_emails', function() { Route::get('/', 'HomeController@showWelcome'); Route::get('/rocksteady', 'HomeController@showWelcome'); -Route::get('/about_us', 'HomeController@showAboutUs'); -Route::get('/contact_us', 'HomeController@showContactUs'); +Route::get('/about', 'HomeController@showAboutUs'); +Route::get('/contact', 'HomeController@showContactUs'); +Route::post('/contact', 'HomeController@doContactUs'); Route::get('log_error', 'HomeController@logError'); Route::post('get_started', 'AccountController@getStarted'); diff --git a/app/views/about_us.blade.php b/app/views/about_us.blade.php index 4296a820cb..118d6f26b4 100644 --- a/app/views/about_us.blade.php +++ b/app/views/about_us.blade.php @@ -9,83 +9,108 @@ @stop @section('body') - -
-
-
-

WHY INVOICE NINJA? -

-
-
-
+
+
+
+

WHY INVOICE NINJA? +

+
+
+
-
-
-
-
-

Open Source Platform

-

Free yourself from online invoicing platforms with high monthly fees and limited functionality. Being open source allows us fast app development, security audits by the open-course community, and we can keep it FREE!

-
-
+
+
+
+
+

Open Source Platform

+

Free yourself from online invoicing platforms with high monthly fees and limited functionality. Being open source allows us fast app development, security audits by the open-course community, and we can keep it FREE!

+
+
+
+
+ +
+
+
+
+
-
- -
-
-
-
-
-
-
-
-

Live PDF Creation

-

Look professional from day #1. Select one of our beautiful invoice templates to suit your company identity, switch between designs in real time to preview invoices & email them to clients with one click. The live preview PDF function was designed for an efficient and hassle-free experience, and it’s awesome! -

-
-
+
+
+

Live PDF Creation

+

Look professional from day #1. Select one of our beautiful invoice templates to suit your company identity, switch between designs in real time to preview invoices & email them to clients with one click. The live preview PDF function was designed for an efficient and hassle-free experience, and it’s awesome! +

+
+
+ +
+
+
+
+
+

Online Payments

+

Authorize.net, Beanstream, PayPal? InvoiceNinja supports the most popular online payment gateways! If you need help integrating a third party gateway we don’t yet support, please contact us! We’re happy to help! If you need assistance of want to learn more about online payment solutions, contact us!

+
+
+
-
-
-
-
-
-

Online Payments

-

Authorize.net, Beanstream, PayPal? InvoiceNinja supports the most popular online payment gateways! If you need help integrating a third party gateway we don’t yet support, please contact us! We’re happy to help! If you need assistance of want to learn more about online payment solutions, contact us!

-
-
-
-
-
-
-
-
+ + + + + + -