From a739429005134b4c5c3e13677b4fec8e82c6c085 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Thu, 27 Nov 2014 12:55:09 +0200 Subject: [PATCH] Minor tweaks --- app/config/app.php | 6 ++--- app/controllers/AccountController.php | 12 +++++++++ app/controllers/InvoiceController.php | 26 +++++++++++--------- app/lang/da/texts.php | 3 ++- app/lang/en/texts.php | 6 +++-- app/lang/es/texts.php | 3 ++- app/lang/fr/texts.php | 4 ++- app/lang/it/texts.php | 3 ++- app/lang/lt/texts.php | 3 ++- app/lang/nb_NO/texts.php | 3 ++- app/lang/nl/texts.php | 3 ++- app/lang/pt_BR/texts.php | 3 ++- app/models/User.php | 2 +- app/ninja/repositories/PaymentRepository.php | 1 - app/routes.php | 14 ++++++++--- app/start/global.php | 6 +---- app/views/accounts/import_export.blade.php | 1 + app/views/master.blade.php | 9 +++---- public/built.css | 2 +- 19 files changed, 68 insertions(+), 42 deletions(-) diff --git a/app/config/app.php b/app/config/app.php index 4e029327dbe9..76b4a1680e70 100755 --- a/app/config/app.php +++ b/app/config/app.php @@ -13,7 +13,7 @@ return array( | */ - 'debug' => false, + 'debug' => true, /* |-------------------------------------------------------------------------- @@ -122,8 +122,8 @@ return array( 'Barryvdh\Debugbar\ServiceProvider', 'Chumper\Datatable\DatatableServiceProvider', 'Intervention\Image\ImageServiceProvider', - 'Webpatser\Countries\CountriesServiceProvider', - 'Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider', + 'Webpatser\Countries\CountriesServiceProvider', + 'Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider', ), /* diff --git a/app/controllers/AccountController.php b/app/controllers/AccountController.php index 6b748d452959..b26e716d21dd 100755 --- a/app/controllers/AccountController.php +++ b/app/controllers/AccountController.php @@ -982,6 +982,18 @@ class AccountController extends \BaseController { public function cancelAccount() { + if ($reason = trim(Input::get('reason'))) + { + $email = Auth::user()->email; + $name = Auth::user()->getDisplayName(); + + $data = [ + 'text' => $reason + ]; + + $this->userMailer->sendTo(CONTACT_EMAIL, $email, $name, 'Invoice Ninja Feedback [Canceled Account]', 'contact', $data); + } + $account = Auth::user()->account; $account->forceDelete(); diff --git a/app/controllers/InvoiceController.php b/app/controllers/InvoiceController.php index 3906c12db8b0..0a1718e3a27c 100755 --- a/app/controllers/InvoiceController.php +++ b/app/controllers/InvoiceController.php @@ -217,6 +217,7 @@ class InvoiceController extends \BaseController { $invoice->id = null; $invoice->invoice_number = Auth::user()->account->getNextInvoiceNumber($invoice->is_quote); $invoice->balance = $invoice->amount; + $invoice->invoice_status_id = 0; $invoice->invoice_date = date_create()->format('Y-m-d'); $method = 'POST'; $url = "{$entityType}s"; @@ -248,25 +249,28 @@ class InvoiceController extends \BaseController { $data = array_merge($data, self::getViewModel()); // Set the invitation link on the client's contacts - $clients = $data['clients']; - foreach ($clients as $client) + if (!$clone) { - if ($client->id == $invoice->client->id) + $clients = $data['clients']; + foreach ($clients as $client) { - foreach ($invoice->invitations as $invitation) + if ($client->id == $invoice->client->id) { - foreach ($client->contacts as $contact) + foreach ($invoice->invitations as $invitation) { - if ($invitation->contact_id == $contact->id) + foreach ($client->contacts as $contact) { - $contact->invitation_link = $invitation->getLink(); - } - } + if ($invitation->contact_id == $contact->id) + { + $contact->invitation_link = $invitation->getLink(); + } + } + } + break; } - break; } } - + return View::make('invoices.edit', $data); } diff --git a/app/lang/da/texts.php b/app/lang/da/texts.php index cf565bb7ef0c..fc118f6445f1 100644 --- a/app/lang/da/texts.php +++ b/app/lang/da/texts.php @@ -470,7 +470,7 @@ return array( 'payment_footer2' => '*Please click "PAY NOW" only once - transaction may take up to 1 minute to process.', 'id_number' => 'ID Number', - 'white_label_link' => 'Click to white label', + 'white_label_link' => 'White label', 'white_label_text' => 'Purchase a white label license for $10.00 to remove the Invoice Ninja branding from the top of the client pages.', 'white_label_header' => 'White Label', 'bought_white_label' => 'Successfully enabled white label license', @@ -489,6 +489,7 @@ return array( 'restored_payment' => 'Successfully restored payment', 'restored_credit' => 'Successfully restored credit', + 'reason_for_canceling' => 'Help us improve our site by telling us why you\'re leaving.', ); diff --git a/app/lang/en/texts.php b/app/lang/en/texts.php index cf47b992e8bc..325876dd1af6 100644 --- a/app/lang/en/texts.php +++ b/app/lang/en/texts.php @@ -468,7 +468,7 @@ return array( 'payment_footer2' => '*Please click "PAY NOW" only once - transaction may take up to 1 minute to process.', 'id_number' => 'ID Number', - 'white_label_link' => 'Click to white label', + 'white_label_link' => 'White label', 'white_label_text' => 'Purchase a white label license for $10.00 to remove the Invoice Ninja branding from the top of the client pages.', 'white_label_header' => 'White Label', 'bought_white_label' => 'Successfully enabled white label license', @@ -487,5 +487,7 @@ return array( 'restored_payment' => 'Successfully restored payment', 'restored_credit' => 'Successfully restored credit', - + 'reason_for_canceling' => 'Help us improve our site by telling us why you\'re leaving.', + + ); diff --git a/app/lang/es/texts.php b/app/lang/es/texts.php index 8cfb6d3a2651..a8684e0b918a 100644 --- a/app/lang/es/texts.php +++ b/app/lang/es/texts.php @@ -440,7 +440,7 @@ return array( 'vat_number' => 'Vat Number', 'id_number' => 'ID Number', - 'white_label_link' => 'Click to white label', + 'white_label_link' => 'White label', 'white_label_text' => 'Purchase a white label license for $10.00 to remove the Invoice Ninja branding from the top of the client pages.', 'white_label_header' => 'White Label', 'bought_white_label' => 'Successfully enabled white label license', @@ -459,6 +459,7 @@ return array( 'restored_payment' => 'Successfully restored payment', 'restored_credit' => 'Successfully restored credit', + 'reason_for_canceling' => 'Help us improve our site by telling us why you\'re leaving.', ); \ No newline at end of file diff --git a/app/lang/fr/texts.php b/app/lang/fr/texts.php index 05d913c3debf..0f831aab8e1d 100644 --- a/app/lang/fr/texts.php +++ b/app/lang/fr/texts.php @@ -461,7 +461,7 @@ return array( 'vat_number' => 'Vat Number', 'id_number' => 'ID Number', - 'white_label_link' => 'Click to white label', + 'white_label_link' => 'White label', 'white_label_text' => 'Purchase a white label license for $10.00 to remove the Invoice Ninja branding from the top of the client pages.', 'white_label_header' => 'White Label', 'bought_white_label' => 'Successfully enabled white label license', @@ -479,6 +479,8 @@ return array( 'restored_client' => 'Successfully restored client', 'restored_payment' => 'Successfully restored payment', 'restored_credit' => 'Successfully restored credit', + + 'reason_for_canceling' => 'Help us improve our site by telling us why you\'re leaving.', ); \ No newline at end of file diff --git a/app/lang/it/texts.php b/app/lang/it/texts.php index c7106d4357c4..4e2b94caa7c8 100644 --- a/app/lang/it/texts.php +++ b/app/lang/it/texts.php @@ -462,7 +462,7 @@ return array( 'vat_number' => 'Vat Number', 'id_number' => 'ID Number', - 'white_label_link' => 'Click to white label', + 'white_label_link' => 'White label', 'white_label_text' => 'Purchase a white label license for $10.00 to remove the Invoice Ninja branding from the top of the client pages.', 'white_label_header' => 'White Label', 'bought_white_label' => 'Successfully enabled white label license', @@ -482,6 +482,7 @@ return array( 'restored_payment' => 'Successfully restored payment', 'restored_credit' => 'Successfully restored credit', + 'reason_for_canceling' => 'Help us improve our site by telling us why you\'re leaving.', diff --git a/app/lang/lt/texts.php b/app/lang/lt/texts.php index cb60156e0b24..8dddbaf91858 100644 --- a/app/lang/lt/texts.php +++ b/app/lang/lt/texts.php @@ -471,7 +471,7 @@ return array( 'vat_number' => 'Vat Number', 'id_number' => 'ID Number', - 'white_label_link' => 'Click to white label', + 'white_label_link' => 'White label', 'white_label_text' => 'Purchase a white label license for $10.00 to remove the Invoice Ninja branding from the top of the client pages.', 'white_label_header' => 'White Label', 'bought_white_label' => 'Successfully enabled white label license', @@ -490,6 +490,7 @@ return array( 'restored_payment' => 'Successfully restored payment', 'restored_credit' => 'Successfully restored credit', + 'reason_for_canceling' => 'Help us improve our site by telling us why you\'re leaving.', ); diff --git a/app/lang/nb_NO/texts.php b/app/lang/nb_NO/texts.php index 6062da2168ac..129896e3b830 100644 --- a/app/lang/nb_NO/texts.php +++ b/app/lang/nb_NO/texts.php @@ -469,7 +469,7 @@ return array( 'vat_number' => 'Vat Number', 'id_number' => 'ID Number', - 'white_label_link' => 'Click to white label', + 'white_label_link' => 'White label', 'white_label_text' => 'Purchase a white label license for $10.00 to remove the Invoice Ninja branding from the top of the client pages.', 'white_label_header' => 'White Label', 'bought_white_label' => 'Successfully enabled white label license', @@ -488,6 +488,7 @@ return array( 'restored_payment' => 'Successfully restored payment', 'restored_credit' => 'Successfully restored credit', + 'reason_for_canceling' => 'Help us improve our site by telling us why you\'re leaving.', diff --git a/app/lang/nl/texts.php b/app/lang/nl/texts.php index 401e02dd47c4..96e0d9215e3f 100644 --- a/app/lang/nl/texts.php +++ b/app/lang/nl/texts.php @@ -463,7 +463,7 @@ return array( 'vat_number' => 'Vat Number', 'id_number' => 'ID Number', - 'white_label_link' => 'Click to white label', + 'white_label_link' => 'White label', 'white_label_text' => 'Purchase a white label license for $10.00 to remove the Invoice Ninja branding from the top of the client pages.', 'white_label_header' => 'White Label', 'bought_white_label' => 'Successfully enabled white label license', @@ -483,6 +483,7 @@ return array( 'restored_payment' => 'Successfully restored payment', 'restored_credit' => 'Successfully restored credit', + 'reason_for_canceling' => 'Help us improve our site by telling us why you\'re leaving.', diff --git a/app/lang/pt_BR/texts.php b/app/lang/pt_BR/texts.php index 86c1e3ae92de..6e2ea4703a9f 100644 --- a/app/lang/pt_BR/texts.php +++ b/app/lang/pt_BR/texts.php @@ -451,7 +451,7 @@ return array( 'vat_number' => 'Vat Number', 'id_number' => 'ID Number', - 'white_label_link' => 'Click to white label', + 'white_label_link' => 'White label', 'white_label_text' => 'Purchase a white label license for $10.00 to remove the Invoice Ninja branding from the top of the client pages.', 'white_label_header' => 'White Label', 'bought_white_label' => 'Successfully enabled white label license', @@ -470,6 +470,7 @@ return array( 'restored_payment' => 'Successfully restored payment', 'restored_credit' => 'Successfully restored credit', + 'reason_for_canceling' => 'Help us improve our site by telling us why you\'re leaving.', diff --git a/app/models/User.php b/app/models/User.php index d46b7160c560..7171ef90c0a2 100755 --- a/app/models/User.php +++ b/app/models/User.php @@ -131,7 +131,7 @@ class User extends ConfideUser implements UserInterface, RemindableInterface public function getPopOverText() { - if (!Auth::check() || Session::has('error')) + if (!Utils::isNinja() || !Auth::check() || Session::has('error')) { return false; } diff --git a/app/ninja/repositories/PaymentRepository.php b/app/ninja/repositories/PaymentRepository.php index 5abaa9106141..585174bbfa6c 100755 --- a/app/ninja/repositories/PaymentRepository.php +++ b/app/ninja/repositories/PaymentRepository.php @@ -53,7 +53,6 @@ class PaymentRepository ->on('invitations.contact_id', '=', 'contacts.id'); }) ->leftJoin('payment_types', 'payment_types.id', '=', 'payments.payment_type_id') - ->where('payments.account_id', '=', \Auth::user()->account_id) ->where('clients.is_deleted', '=', false) ->where('payments.is_deleted', '=', false) ->where('invitations.deleted_at', '=', null) diff --git a/app/routes.php b/app/routes.php index 65b01fdd68bd..297a079e9ac7 100755 --- a/app/routes.php +++ b/app/routes.php @@ -1,5 +1,12 @@ id === 1) { Auth::loginUsingId(1); } -*/ - +*/ \ No newline at end of file diff --git a/app/start/global.php b/app/start/global.php index be0bfd585800..a8c2e5ff7d4b 100755 --- a/app/start/global.php +++ b/app/start/global.php @@ -60,13 +60,9 @@ App::error(function(Exception $exception, $code) { if (Utils::isNinjaProd()) { - Utils::logError($exception . ' ' . $code); + Utils::logError("{$code} {$exception->getFile()} [Line {$exception->getLine()}] => {$exception->getMessage()}"); return Response::view('error', ['hideHeader' => true, 'error' => "A {$code} error occurred."], $code); } - else if (Utils::isNinjaDev()) - { - return "{$exception->getFile()}:{$exception->getLine()} => {$exception->getMessage()}"; - } else { return null; diff --git a/app/views/accounts/import_export.blade.php b/app/views/accounts/import_export.blade.php index fd802d177632..6a3baaddc5e0 100755 --- a/app/views/accounts/import_export.blade.php +++ b/app/views/accounts/import_export.blade.php @@ -31,6 +31,7 @@
 

{{ trans('texts.cancel_account_message') }}

  +  

{{ Former::textarea('reason')->placeholder(trans('texts.reason_for_canceling'))->raw() }}