diff --git a/app/Http/Controllers/InvoiceController.php b/app/Http/Controllers/InvoiceController.php index 36c616321a..16db772f08 100644 --- a/app/Http/Controllers/InvoiceController.php +++ b/app/Http/Controllers/InvoiceController.php @@ -491,7 +491,13 @@ class InvoiceController extends BaseController private function emailRecurringInvoice(&$invoice) { if (!$invoice->shouldSendToday()) { - return trans('texts.recurring_too_soon'); + if ($date = $invoice->getNextSendDate()) { + $date = $invoice->account->formatDate($date); + $date .= ' ' . DEFAULT_SEND_RECURRING_HOUR . ':00 am ' . $invoice->account->getTimezone(); + return trans('texts.recurring_too_soon', ['date' => $date]); + } else { + return trans('texts.no_longer_running'); + } } // switch from the recurring invoice to the generated invoice diff --git a/app/Http/routes.php b/app/Http/routes.php index 436b12bf03..c41770d8c1 100644 --- a/app/Http/routes.php +++ b/app/Http/routes.php @@ -315,6 +315,7 @@ if (!defined('CONTACT_EMAIL')) { define('MAX_SUBDOMAIN_LENGTH', 30); define('MAX_IFRAME_URL_LENGTH', 250); define('DEFAULT_FONT_SIZE', 9); + define('DEFAULT_SEND_RECURRING_HOUR', 8); define('INVOICE_STATUS_DRAFT', 1); define('INVOICE_STATUS_SENT', 2); diff --git a/app/Models/Account.php b/app/Models/Account.php index 51bb3550f8..067ba6d29c 100644 --- a/app/Models/Account.php +++ b/app/Models/Account.php @@ -160,9 +160,9 @@ class Account extends Eloquent } } - public function getDateTime() + public function getDateTime($date = 'now') { - return new \DateTime('now', new \DateTimeZone($this->getTimezone())); + return new \DateTime($date, new \DateTimeZone($this->getTimezone())); } public function getCustomDateFormat() diff --git a/app/Models/Invoice.php b/app/Models/Invoice.php index 18bd7ebe75..396c421e2a 100644 --- a/app/Models/Invoice.php +++ b/app/Models/Invoice.php @@ -1,8 +1,6 @@ account->getTimezone(); $startDate = $this->last_sent_date ?: $this->start_date; - $startDate = new \DateTime($startDate . ' 12:00:00', new \DateTimeZone($timezone)); - $endDate = $this->end_date ? new \DateTime($this->end_date, new \DateTimeZone($timezone)) : null; + $startDate .= ' ' . DEFAULT_SEND_RECURRING_HOUR . ':00:00'; + $startDate = $this->account->getDateTime($startDate); + $endDate = $this->end_date ? $this->account->getDateTime($this->end_date) : null; + $timezone = $this->account->getTimezone(); $rule = $this->getRecurrenceRule(); $rule = new \Recurr\Rule("{$rule}", $startDate, $endDate, $timezone); @@ -258,8 +257,8 @@ class Invoice extends EntityModel public function getNextSendDate() { if ($this->start_date && !$this->last_sent_date) { - $timezone = $this->account->getTimezone(); - return new \DateTime($this->start_date . ' 12:00:00', new \DateTimeZone($timezone)); + $startDate = $this->start_date . ' ' . DEFAULT_SEND_RECURRING_HOUR . ':00:00'; + return $this->account->getDateTime($startDate); } if (!$schedule = $this->getSchedule()) { diff --git a/composer.json b/composer.json index 81e4aa6888..a2effe62a1 100644 --- a/composer.json +++ b/composer.json @@ -29,7 +29,7 @@ "coatesap/omnipay-datacash": "~2.0", "alfaproject/omnipay-neteller": "1.0.*@dev", "mfauveau/omnipay-pacnet": "~2.0", - "coatesap/omnipay-paymentsense": "~2.0", + "coatesap/omnipay-paymentsense": "2.0.0", "coatesap/omnipay-realex": "~2.0", "fruitcakestudio/omnipay-sisow": "~2.0", "alfaproject/omnipay-skrill": "dev-master", diff --git a/composer.lock b/composer.lock index c38eb0f70c..55b826b5e8 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "f76cd603e0ffaf0499cefa858ae14d07", + "hash": "c6273849605c03edf4f72bc6b1033658", "packages": [ { "name": "alfaproject/omnipay-neteller", @@ -501,16 +501,16 @@ }, { "name": "coatesap/omnipay-paymentsense", - "version": "v2.1.0", + "version": "v2.0.0", "source": { "type": "git", "url": "https://github.com/coatesap/omnipay-paymentsense.git", - "reference": "664e00a726b99b65b08381f8409263795f2986a2" + "reference": "4a5a87ef140abf8e09ff27cd0e6502ac1e79e434" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/coatesap/omnipay-paymentsense/zipball/664e00a726b99b65b08381f8409263795f2986a2", - "reference": "664e00a726b99b65b08381f8409263795f2986a2", + "url": "https://api.github.com/repos/coatesap/omnipay-paymentsense/zipball/4a5a87ef140abf8e09ff27cd0e6502ac1e79e434", + "reference": "4a5a87ef140abf8e09ff27cd0e6502ac1e79e434", "shasum": "" }, "require": { @@ -530,8 +530,8 @@ } }, "autoload": { - "psr-4": { - "Coatesap\\PaymentSense\\": "src/" + "psr-0": { + "Omnipay\\PaymentSense\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -545,9 +545,8 @@ } ], "description": "PaymentSense driver for the Omnipay payment processing library", - "homepage": "https://github.com/coatesap/omnipay-paymentsense", + "homepage": "https://github.com/coatesap/paymentsense", "keywords": [ - "driver", "gateway", "merchant", "omnipay", @@ -556,7 +555,7 @@ "payment sense", "paymentsense" ], - "time": "2015-10-13 07:08:13" + "time": "2014-03-18 17:17:57" }, { "name": "coatesap/omnipay-realex", diff --git a/resources/lang/da/texts.php b/resources/lang/da/texts.php index 369d53e3c6..98f6661327 100644 --- a/resources/lang/da/texts.php +++ b/resources/lang/da/texts.php @@ -745,7 +745,6 @@ 'current_user' => 'Nuværende bruger', 'new_recurring_invoice' => 'Ny gentaget fakture', 'recurring_invoice' => 'Gentaget faktura', - 'recurring_too_soon' => 'Det er for tidligt at generere den næste faktura', 'created_by_invoice' => 'Oprettet fra :invoice', 'primary_user' => 'Primær bruger', 'help' => 'Hjælp', @@ -821,5 +820,6 @@ 'basic_settings' => 'Basic Settings', 'pro' => 'Pro', 'gateways' => 'Payment Gateways', + 'recurring_too_soon' => 'Det er for tidligt at generere den næste faktura, it\'s scheduled for :date', ); diff --git a/resources/lang/de/texts.php b/resources/lang/de/texts.php index aa681ade8a..ce842ad950 100644 --- a/resources/lang/de/texts.php +++ b/resources/lang/de/texts.php @@ -745,7 +745,6 @@ return array( 'current_user' => 'Aktueller Benutzer', 'new_recurring_invoice' => 'Neue wiederkehrende Rechnung', 'recurring_invoice' => 'Wiederkehrende Rechnung', - 'recurring_too_soon' => 'Es ist zu früh, um die nächste wiederkehrende Rechnung zu erstellen', 'created_by_invoice' => 'Erstellt durch :invoice', 'primary_user' => 'Primärer Benutzer', 'help' => 'Hilfe', @@ -821,6 +820,7 @@ return array( 'basic_settings' => 'Basic Settings', 'pro' => 'Pro', 'gateways' => 'Payment Gateways', + 'recurring_too_soon' => 'Es ist zu früh, um die nächste wiederkehrende Rechnung zu erstellen, it\'s scheduled for :date', ); diff --git a/resources/lang/en/texts.php b/resources/lang/en/texts.php index 51f1da60ea..42491eb90a 100644 --- a/resources/lang/en/texts.php +++ b/resources/lang/en/texts.php @@ -745,7 +745,7 @@ return array( 'current_user' => 'Current User', 'new_recurring_invoice' => 'New Recurring Invoice', 'recurring_invoice' => 'Recurring Invoice', - 'recurring_too_soon' => 'It\'s too soon to create the next recurring invoice', + 'recurring_too_soon' => 'It\'s too soon to create the next recurring invoice, it\'s scheduled for :date', 'created_by_invoice' => 'Created by :invoice', 'primary_user' => 'Primary User', 'help' => 'Help', @@ -823,7 +823,10 @@ return array( 'gateways' => 'Payment Gateways', 'next_send_on' => 'Send next: :date', - + 'no_longer_running' => 'This invoice is not scheduled to run', + 'general_settings' => 'General Settings', + 'customize' => 'Customize', ); + diff --git a/resources/lang/es/texts.php b/resources/lang/es/texts.php index 2de8392025..b064c8922e 100644 --- a/resources/lang/es/texts.php +++ b/resources/lang/es/texts.php @@ -723,7 +723,6 @@ return array( 'current_user' => 'Usuario Actual', 'new_recurring_invoice' => 'Nueva Factura Recurrente', 'recurring_invoice' => 'Factura Recurrente', - 'recurring_too_soon' => 'Es my pronto para crear la siguiente factura recurrente', 'created_by_invoice' => 'Creado por :invoice', 'primary_user' => 'Usuario Primario', 'help' => 'Ayuda', @@ -799,6 +798,7 @@ return array( 'basic_settings' => 'Basic Settings', 'pro' => 'Pro', 'gateways' => 'Payment Gateways', + 'recurring_too_soon' => 'Es my pronto para crear la siguiente factura recurrente, it\'s scheduled for :date', ); diff --git a/resources/lang/es_ES/texts.php b/resources/lang/es_ES/texts.php index 7cc9bf4ba9..175234b105 100644 --- a/resources/lang/es_ES/texts.php +++ b/resources/lang/es_ES/texts.php @@ -744,7 +744,7 @@ return array( 'current_user' => 'Current User', 'new_recurring_invoice' => 'New Recurring Invoice', 'recurring_invoice' => 'Recurring Invoice', - 'recurring_too_soon' => 'It\'s too soon to create the next recurring invoice', + 'recurring_too_soon' => 'It\'s too soon to create the next recurring invoice, it\'s scheduled for :date', 'created_by_invoice' => 'Created by :invoice', 'primary_user' => 'Primary User', 'help' => 'Help', diff --git a/resources/lang/fr/texts.php b/resources/lang/fr/texts.php index 35a4fbdca8..bdf65778e6 100644 --- a/resources/lang/fr/texts.php +++ b/resources/lang/fr/texts.php @@ -737,7 +737,6 @@ return array( 'current_user' => 'Utilisateur actuel', 'new_recurring_invoice' => 'Nouvelle facture récurrente', 'recurring_invoice' => 'Facture récurrente', - 'recurring_too_soon' => 'Il est trop tôt pour créer la prochaine facture récurrente', 'created_by_invoice' => 'Créé par :invoice', 'primary_user' => 'Utilisateur principal', 'help' => 'Aide', @@ -813,6 +812,7 @@ return array( 'basic_settings' => 'Basic Settings', 'pro' => 'Pro', 'gateways' => 'Payment Gateways', + 'recurring_too_soon' => 'Il est trop tôt pour créer la prochaine facture récurrente, it\'s scheduled for :date', ); diff --git a/resources/lang/fr_CA/texts.php b/resources/lang/fr_CA/texts.php index 1dfdf94ef3..7810ef9f5b 100644 --- a/resources/lang/fr_CA/texts.php +++ b/resources/lang/fr_CA/texts.php @@ -738,7 +738,7 @@ return array( 'current_user' => 'Current User', 'new_recurring_invoice' => 'New Recurring Invoice', 'recurring_invoice' => 'Recurring Invoice', - 'recurring_too_soon' => 'It\'s too soon to create the next recurring invoice', + 'recurring_too_soon' => 'It\'s too soon to create the next recurring invoice, it\'s scheduled for :date', 'created_by_invoice' => 'Created by :invoice', 'primary_user' => 'Primary User', 'help' => 'Help', diff --git a/resources/lang/it/texts.php b/resources/lang/it/texts.php index 467b91ff48..cee9bb05d5 100644 --- a/resources/lang/it/texts.php +++ b/resources/lang/it/texts.php @@ -740,7 +740,7 @@ return array( 'current_user' => 'Current User', 'new_recurring_invoice' => 'New Recurring Invoice', 'recurring_invoice' => 'Recurring Invoice', - 'recurring_too_soon' => 'It\'s too soon to create the next recurring invoice', + 'recurring_too_soon' => 'It\'s too soon to create the next recurring invoice, it\'s scheduled for :date', 'created_by_invoice' => 'Created by :invoice', 'primary_user' => 'Primary User', 'help' => 'Help', diff --git a/resources/lang/lt/texts.php b/resources/lang/lt/texts.php index a491697b03..09f4e7084f 100644 --- a/resources/lang/lt/texts.php +++ b/resources/lang/lt/texts.php @@ -747,7 +747,7 @@ return array( 'current_user' => 'Current User', 'new_recurring_invoice' => 'New Recurring Invoice', 'recurring_invoice' => 'Recurring Invoice', - 'recurring_too_soon' => 'It\'s too soon to create the next recurring invoice', + 'recurring_too_soon' => 'It\'s too soon to create the next recurring invoice, it\'s scheduled for :date', 'created_by_invoice' => 'Created by :invoice', 'primary_user' => 'Primary User', 'help' => 'Help', diff --git a/resources/lang/nb_NO/texts.php b/resources/lang/nb_NO/texts.php index 374b0479cf..90d4c92177 100644 --- a/resources/lang/nb_NO/texts.php +++ b/resources/lang/nb_NO/texts.php @@ -740,12 +740,12 @@ return array( 'recent_payments' => 'Recent Payments', 'outstanding' => 'Outstanding', 'manage_companies' => 'Manage Companies', - 'total_revenue' => 'Total Revenue', + 'total_revenue' => 'Total Revenue', 'current_user' => 'Current User', 'new_recurring_invoice' => 'New Recurring Invoice', 'recurring_invoice' => 'Recurring Invoice', - 'recurring_too_soon' => 'It\'s too soon to create the next recurring invoice', + 'recurring_too_soon' => 'It\'s too soon to create the next recurring invoice, it\'s scheduled for :date', 'created_by_invoice' => 'Created by :invoice', 'primary_user' => 'Primary User', 'help' => 'Help', diff --git a/resources/lang/nl/texts.php b/resources/lang/nl/texts.php index 96e8ddf216..e36ae44d14 100644 --- a/resources/lang/nl/texts.php +++ b/resources/lang/nl/texts.php @@ -740,7 +740,6 @@ return array( 'current_user' => 'Huidige gebruiker', 'new_recurring_invoice' => 'Nieuwe wederkerende factuur', 'recurring_invoice' => 'Wederkerende factuur', - 'recurring_too_soon' => 'Het is te vroeg om de volgende wederkerende factuur aan te maken', 'created_by_invoice' => 'Aangemaakt door :invoice', 'primary_user' => 'Primaire gebruiker', 'help' => 'Help', @@ -816,5 +815,6 @@ return array( 'basic_settings' => 'Basic Settings', 'pro' => 'Pro', 'gateways' => 'Payment Gateways', + 'recurring_too_soon' => 'Het is te vroeg om de volgende wederkerende factuur aan te maken, it\'s scheduled for :date', ); diff --git a/resources/lang/pt_BR/texts.php b/resources/lang/pt_BR/texts.php index 4795151833..e7e86e20f3 100644 --- a/resources/lang/pt_BR/texts.php +++ b/resources/lang/pt_BR/texts.php @@ -740,7 +740,7 @@ return array( 'current_user' => 'Current User', 'new_recurring_invoice' => 'New Recurring Invoice', 'recurring_invoice' => 'Recurring Invoice', - 'recurring_too_soon' => 'It\'s too soon to create the next recurring invoice', + 'recurring_too_soon' => 'It\'s too soon to create the next recurring invoice, it\'s scheduled for :date', 'created_by_invoice' => 'Created by :invoice', 'primary_user' => 'Primary User', 'help' => 'Help', diff --git a/resources/lang/sv/texts.php b/resources/lang/sv/texts.php index bd99b07325..f1fa93425a 100644 --- a/resources/lang/sv/texts.php +++ b/resources/lang/sv/texts.php @@ -743,7 +743,7 @@ return array( 'current_user' => 'Current User', 'new_recurring_invoice' => 'New Recurring Invoice', 'recurring_invoice' => 'Recurring Invoice', - 'recurring_too_soon' => 'It\'s too soon to create the next recurring invoice', + 'recurring_too_soon' => 'It\'s too soon to create the next recurring invoice, it\'s scheduled for :date', 'created_by_invoice' => 'Created by :invoice', 'primary_user' => 'Primary User', 'help' => 'Help', diff --git a/resources/views/accounts/invoice_design.blade.php b/resources/views/accounts/invoice_design.blade.php index c76520bd94..6e3210970f 100644 --- a/resources/views/accounts/invoice_design.blade.php +++ b/resources/views/accounts/invoice_design.blade.php @@ -76,7 +76,7 @@