diff --git a/LICENSE b/LICENSE index 4d1b69fde2e5..07daadbcb3fb 100644 --- a/LICENSE +++ b/LICENSE @@ -1,5 +1,5 @@ Attribution Assurance License -Copyright (c) 2013 by Hillel Coren +Copyright (c) 2014 by Hillel Coren http://www.hillelcoren.com All Rights Reserved diff --git a/app/config/app.php b/app/config/app.php index 2788a7946e6b..5375b22c0b13 100755 --- a/app/config/app.php +++ b/app/config/app.php @@ -65,7 +65,7 @@ return array( | */ - 'key' => 'a2jfy6HtBEdNtJnRSOC7vIM3UVhxZ1BB', + 'key' => '', /* |-------------------------------------------------------------------------- @@ -214,7 +214,7 @@ return array( 'Typography' => 'Bootstrapper\Typography', 'Confide' => 'Zizaco\Confide\ConfideFacade', 'Former' => 'Former\Facades\Former', - 'Datatable' => 'Chumper\Datatable\Facades\Datatable', + 'Datatable' => 'Chumper\Datatable\Facades\DatatableFacade', 'Omnipay' => 'Omnipay\Omnipay', 'CreditCard' => 'Omnipay\Common\CreditCard', 'Image' => 'Intervention\Image\Facades\Image', diff --git a/app/config/packages/zizaco/confide/config.php b/app/config/packages/zizaco/confide/config.php index 2e60fdad1c63..e26ae0a94eab 100755 --- a/app/config/packages/zizaco/confide/config.php +++ b/app/config/packages/zizaco/confide/config.php @@ -111,7 +111,7 @@ return array( | table, otherwise they will not be able to login after the payment. | */ - 'signup_email' => true, - 'signup_confirm' => true, + 'signup_email' => false, + 'signup_confirm' => false, ); diff --git a/app/controllers/AccountController.php b/app/controllers/AccountController.php index 9199cb3a95ac..eae0d6923bfb 100755 --- a/app/controllers/AccountController.php +++ b/app/controllers/AccountController.php @@ -1,16 +1,19 @@ accountRepo = $accountRepo; + $this->mailer = $mailer; } public function getStarted() @@ -60,7 +63,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"); } @@ -450,7 +453,7 @@ class AccountController extends \BaseController { if ($validator->fails()) { - return Redirect::to('company/settings') + return Redirect::to('company/payments') ->withErrors($validator) ->withInput(); } @@ -571,11 +574,14 @@ class AccountController extends \BaseController { $user->first_name = trim(Input::get('new_first_name')); $user->last_name = trim(Input::get('new_last_name')); $user->email = trim(strtolower(Input::get('new_email'))); + $user->username = $user->email; $user->password = trim(Input::get('new_password')); $user->password_confirmation = trim(Input::get('new_password')); $user->registered = true; $user->amend(); + $this->mailer->sendConfirmation($user); + $activities = Activity::scope()->get(); foreach ($activities as $activity) { diff --git a/app/controllers/HomeController.php b/app/controllers/HomeController.php index ab892400db74..459ad6bd2ef8 100755 --- a/app/controllers/HomeController.php +++ b/app/controllers/HomeController.php @@ -1,8 +1,18 @@ mailer = $mailer; + } public function showWelcome() { @@ -19,6 +29,29 @@ class HomeController extends BaseController { return View::make('contact_us'); } + public function showTerms() + { + return View::make('terms'); + } + + 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 0a93c4bf81cb..7d16724aec52 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 df8b3588c8a8..4bd8daf912df 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 c39f8271396c..e636682a9843 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 7b446d65dfa3..7e73122f8649 100755 --- a/app/models/Invoice.php +++ b/app/models/Invoice.php @@ -54,10 +54,10 @@ 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', 'country', 'currency_id']); + $this->account->setVisible(['name', 'address1', 'address2', 'city', 'state', 'postal_code', 'work_phone', 'work_email', 'country', 'currency_id']); foreach ($this->invoice_items as $invoiceItem) { diff --git a/app/ninja/mailers/Mailer.php b/app/ninja/mailers/Mailer.php index 23bffa4a5421..f54e450b3e5f 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/mailers/UserMailer.php b/app/ninja/mailers/UserMailer.php index d4037be6608a..2ed34b9bb6d1 100755 --- a/app/ninja/mailers/UserMailer.php +++ b/app/ninja/mailers/UserMailer.php @@ -8,6 +8,23 @@ use Utils; class UserMailer extends Mailer { + public function sendConfirmation(User $user) + { + if (!$user->email) + { + return; + } + + $view = 'confirm'; + $subject = 'Invoice Ninja Account Confirmation'; + + $data = [ + 'user' => $user + ]; + + $this->sendTo($user->email, CONTACT_EMAIL, $subject, $view, $data); + } + public function sendNotification(User $user, Invoice $invoice, $type, Payment $payment = null) { if (!$user->email) diff --git a/app/ninja/repositories/InvoiceRepository.php b/app/ninja/repositories/InvoiceRepository.php index 9e62e4fc3461..c8327d0311a8 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']) { @@ -127,7 +127,7 @@ class InvoiceRepository $invoice->invoice_date = Utils::toSqlDate($data['invoice_date']); $invoice->due_date = Utils::toSqlDate($data['due_date']); - $invoice->is_recurring = $data['is_recurring']; + $invoice->is_recurring = $data['is_recurring'] ? true : false; $invoice->frequency_id = $data['frequency_id'] ? $data['frequency_id'] : 0; $invoice->start_date = Utils::toSqlDate($data['start_date']); $invoice->end_date = Utils::toSqlDate($data['end_date']); diff --git a/app/routes.php b/app/routes.php index 5027f907b9ba..329213dec6da 100755 --- a/app/routes.php +++ b/app/routes.php @@ -56,8 +56,10 @@ 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('/terms', 'HomeController@showTerms'); +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 e703f44f7c24..f5efb7fdea2a 100644 --- a/app/views/about_us.blade.php +++ b/app/views/about_us.blade.php @@ -9,184 +9,132 @@ @stop @section('body') + +{{ Form::open(array('url' => 'get_started', 'id' => 'startForm')) }} +{{ Form::hidden('guest_key') }} +{{ Form::close() }} + -