From eb6cd45913465d1f8488e384d61ec1d3b371ab7c Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Thu, 3 Mar 2016 21:39:15 +0200 Subject: [PATCH] Minor fixes --- app/Http/Controllers/ClientController.php | 12 +++---- app/Http/routes.php | 5 +-- app/Listeners/SubscriptionListener.php | 11 ++++-- database/seeds/CurrenciesSeeder.php | 3 +- resources/views/payments/payment.blade.php | 42 +++++++++++++--------- 5 files changed, 45 insertions(+), 28 deletions(-) diff --git a/app/Http/Controllers/ClientController.php b/app/Http/Controllers/ClientController.php index e9bc9835a6..163d75f622 100644 --- a/app/Http/Controllers/ClientController.php +++ b/app/Http/Controllers/ClientController.php @@ -78,9 +78,9 @@ class ClientController extends BaseController public function store(CreateClientRequest $request) { $client = $this->clientService->save($request->input()); - + Session::flash('message', trans('texts.created_client')); - + return redirect()->to($client->getRoute()); } @@ -109,7 +109,7 @@ class ClientController extends BaseController ['label' => trans('texts.enter_credit'), 'url' => '/credits/create/'.$client->public_id], ['label' => trans('texts.enter_expense'), 'url' => '/expenses/create/0/'.$client->public_id] ); - + $data = array( 'actionLinks' => $actionLinks, 'showBreadcrumbs' => false, @@ -132,7 +132,7 @@ class ClientController extends BaseController */ public function create() { - if (Client::scope()->count() > Auth::user()->getMaxNumClients()) { + if (Client::scope()->withTrashed()->count() > Auth::user()->getMaxNumClients()) { return View::make('error', ['hideHeader' => true, 'error' => "Sorry, you've exceeded the limit of ".Auth::user()->getMaxNumClients()." clients"]); } @@ -200,9 +200,9 @@ class ClientController extends BaseController public function update(UpdateClientRequest $request) { $client = $this->clientService->save($request->input()); - + Session::flash('message', trans('texts.updated_client')); - + return redirect()->to($client->getRoute()); } diff --git a/app/Http/routes.php b/app/Http/routes.php index b6283c09fc..7ce979cfb0 100644 --- a/app/Http/routes.php +++ b/app/Http/routes.php @@ -678,8 +678,9 @@ if (Utils::isNinjaDev()) { */ /* -if (Utils::isNinjaDev() && Auth::check() && Auth::user()->id === 1) +if (Utils::isNinjaDev()) { - Auth::loginUsingId(1); + //ini_set('memory_limit','1024M'); + //Auth::loginUsingId(1); } */ \ No newline at end of file diff --git a/app/Listeners/SubscriptionListener.php b/app/Listeners/SubscriptionListener.php index 0949e6de9c..14d0bb0016 100644 --- a/app/Listeners/SubscriptionListener.php +++ b/app/Listeners/SubscriptionListener.php @@ -75,7 +75,7 @@ class SubscriptionListener { //$this->checkSubscriptions(ACTIVITY_TYPE_CREATE_VENDOR, $event->vendor); } - + public function createdExpense(ExpenseWasCreated $event) { //$this->checkSubscriptions(ACTIVITY_TYPE_CREATE_EXPENSE, $event->expense); @@ -89,10 +89,15 @@ class SubscriptionListener $manager = new Manager(); $manager->setSerializer(new ArraySerializer()); $manager->parseIncludes($include); - + $resource = new Item($entity, $transformer, $entity->getEntityType()); $data = $manager->createData($resource)->toArray(); - + + // For legacy Zapier support + if (isset($data['client_id'])) { + $data['client_name'] = $entity->client->getDisplayName(); + } + Utils::notifyZapier($subscription, $data); } } diff --git a/database/seeds/CurrenciesSeeder.php b/database/seeds/CurrenciesSeeder.php index c62df1f2fa..2290aa9f78 100644 --- a/database/seeds/CurrenciesSeeder.php +++ b/database/seeds/CurrenciesSeeder.php @@ -51,7 +51,8 @@ class CurrenciesSeeder extends Seeder ['name' => 'Aruban Florin', 'code' => 'AWG', 'symbol' => 'Afl. ', 'precision' => '2', 'thousand_separator' => ' ', 'decimal_separator' => '.'], ['name' => 'Turkish Lira', 'code' => 'TRY', 'symbol' => 'TL ', 'precision' => '2', 'thousand_separator' => '.', 'decimal_separator' => ','], ['name' => 'Romanian New Leu', 'code' => 'RON', 'symbol' => '', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], - ['name' => 'Croatian', 'code' => 'HKR', 'symbol' => 'kn', 'precision' => '2', 'thousand_separator' => '.', 'decimal_separator' => ','], + ['name' => 'Croatian Kuna', 'code' => 'HKR', 'symbol' => 'kn', 'precision' => '2', 'thousand_separator' => '.', 'decimal_separator' => ','], + ['name' => 'Saudi Riyal', 'code' => 'SAR', 'symbol' => '', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ]; foreach ($currencies as $currency) { diff --git a/resources/views/payments/payment.blade.php b/resources/views/payments/payment.blade.php index 7c0789a904..822075fdc5 100644 --- a/resources/views/payments/payment.blade.php +++ b/resources/views/payments/payment.blade.php @@ -14,7 +14,21 @@ // Disable the submit button to prevent repeated clicks $form.find('button').prop('disabled', true); - Stripe.card.createToken($form, stripeResponseHandler); + var data = { + name: $('#first_name').val() + ' ' + $('#last_name').val(), + address_line1: $('#address1').val(), + address_line2: $('#address2').val(), + address_city: $('#city').val(), + address_state: $('#state').val(), + address_zip: $('#postal_code').val(), + address_country: $("#country_id option:selected").text(), + number: $('#card_number').val(), + cvc: $('#cvv').val(), + exp_month: $('#expiration_month').val(), + exp_year: $('#expiration_year').val() + }; + + Stripe.card.createToken(data, stripeResponseHandler); // Prevent the form from submitting with the default action return false; @@ -53,7 +67,7 @@ }); @endif - + @stop @section('content') @@ -65,7 +79,7 @@ ->addClass('payment-form') ->rules(array( 'first_name' => 'required', - 'last_name' => 'required', + 'last_name' => 'required', 'card_number' => 'required', 'expiration_month' => 'required', 'expiration_year' => 'required', @@ -84,7 +98,7 @@ {{ Former::populateField('first_name', $contact->first_name) }} {{ Former::populateField('last_name', $contact->last_name) }} @if (!$client->country_id && $client->account->country_id) - {{ Former::populateField('country_id', $client->account->country_id) }} + {{ Former::populateField('country_id', $client->account->country_id) }} @endif @endif @@ -103,15 +117,15 @@

{{ $client->getDisplayName() }}

{{ trans('texts.invoice') . ' ' . $invoiceNumber }}|  {{ trans('texts.amount_due') }}: {{ $account->formatMoney($amount, $client, true) }}

@elseif ($paymentTitle) -

{{ $paymentTitle }}
{{ $paymentSubtitle }}

+

{{ $paymentTitle }}
{{ $paymentSubtitle }}

@endif - +
@if (Request::secure() || Utils::isNinjaDev())

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

-
{{ trans('texts.256_encryption') }}
+
{{ trans('texts.256_encryption') }}
@endif
@@ -204,7 +218,6 @@ ->id('card_number') ->placeholder(trans('texts.card_number')) ->autocomplete('cc-number') - ->data_stripe('number') ->label('') !!}
@@ -212,7 +225,6 @@ ->id('cvv') ->placeholder(trans('texts.cvv')) ->autocomplete('off') - ->data_stripe('cvc') ->label('') !!}
@@ -221,7 +233,6 @@ {!! Former::select($accountGateway->getPublishableStripeKey() ? '' : 'expiration_month') ->id('expiration_month') ->autocomplete('cc-exp-month') - ->data_stripe('exp-month') ->placeholder(trans('texts.expiration_month')) ->addOption('01 - January', '1') ->addOption('02 - February', '2') @@ -241,7 +252,6 @@ {!! Former::select($accountGateway->getPublishableStripeKey() ? '' : 'expiration_year') ->id('expiration_year') ->autocomplete('cc-exp-year') - ->data_stripe('exp-year') ->placeholder(trans('texts.expiration_year')) ->addOption('2016', '2016') ->addOption('2017', '2017') @@ -266,7 +276,7 @@ {!! trans('texts.token_billing_secure', ['stripe_link' => link_to('https://stripe.com/', 'Stripe.com', ['target' => '_blank'])]) !!} @endif - +
@if (isset($acceptedCreditCardTypes)) @@ -278,7 +288,7 @@ @endif
- +

 
 

@@ -291,8 +301,8 @@ - - + +

 

 

@@ -302,7 +312,7 @@ {!! Former::close() !!}