diff --git a/app/Console/Commands/SendRecurringInvoices.php b/app/Console/Commands/SendRecurringInvoices.php index 2c8d93959bd7..96b8aa9c2b72 100644 --- a/app/Console/Commands/SendRecurringInvoices.php +++ b/app/Console/Commands/SendRecurringInvoices.php @@ -33,15 +33,24 @@ class SendRecurringInvoices extends Command $today = new DateTime(); $invoices = Invoice::with('account.timezone', 'invoice_items', 'client', 'user') - ->whereRaw('is_deleted IS FALSE AND deleted_at IS NULL AND is_recurring IS TRUE AND frequency_id > 0 AND start_date <= ? AND (end_date IS NULL OR end_date >= ?)', array($today, $today))->get(); + ->whereRaw('is_deleted IS FALSE AND deleted_at IS NULL AND is_recurring IS TRUE AND frequency_id > 0 AND start_date <= ? AND (end_date IS NULL OR end_date >= ?)', array($today, $today)) + ->orderBy('id', 'asc') + ->get(); $this->info(count($invoices).' recurring invoice(s) found'); foreach ($invoices as $recurInvoice) { + if (!$recurInvoice->user->confirmed) { + continue; + } + $recurInvoice->account->loadLocalizationSettings($recurInvoice->client); + //date_default_timezone_set(session(SESSION_TIMEZONE)); + $this->info('Processing Invoice '.$recurInvoice->id.' - Should send '.($recurInvoice->shouldSendToday() ? 'YES' : 'NO')); $invoice = $this->invoiceRepo->createRecurringInvoice($recurInvoice); if ($invoice && !$invoice->isPaid()) { + $this->info('Sending Invoice'); $this->mailer->sendInvoice($invoice); } } diff --git a/app/Http/Controllers/Auth/AuthController.php b/app/Http/Controllers/Auth/AuthController.php index 82d6612a5903..6c732cf15dee 100644 --- a/app/Http/Controllers/Auth/AuthController.php +++ b/app/Http/Controllers/Auth/AuthController.php @@ -61,7 +61,7 @@ class AuthController extends Controller { $this->accountRepo->unlinkUserFromOauth(Auth::user()); Session::flash('message', trans('texts.updated_settings')); - return redirect()->to('/settings/' . ACCOUNT_COMPANY_DETAILS); + return redirect()->to('/settings/' . ACCOUNT_USER_DETAILS); } public function getLoginWrapper() diff --git a/app/Http/Controllers/InvoiceController.php b/app/Http/Controllers/InvoiceController.php index 7c04bafcd0e4..886a96619ca3 100644 --- a/app/Http/Controllers/InvoiceController.php +++ b/app/Http/Controllers/InvoiceController.php @@ -468,8 +468,7 @@ class InvoiceController extends BaseController if (!Auth::user()->confirmed) { $errorMessage = trans(Auth::user()->registered ? 'texts.confirmation_required' : 'texts.registration_required'); Session::flash('error', $errorMessage); - Session::flash('message', $message); - return Redirect::to($url); + return Redirect::to('invoices/'.$invoice->public_id.'/edit'); } if ($invoice->is_recurring) { diff --git a/app/Models/Invoice.php b/app/Models/Invoice.php index a0001150c09d..1a56abd2df1d 100644 --- a/app/Models/Invoice.php +++ b/app/Models/Invoice.php @@ -1,6 +1,7 @@ getNextSendDate()) { - return false; - } - - return $this->account->getDateTime() >= $nextSendDate; - } - public function getSchedule() { if (!$this->start_date || !$this->is_recurring || !$this->frequency_id) { return false; } - $startDate = $this->last_sent_date ?: $this->getOriginal('start_date'); + $startDate = $this->getOriginal('last_sent_date') ?: $this->getOriginal('start_date'); $startDate .= ' ' . DEFAULT_SEND_RECURRING_HOUR . ':00:00'; $startDate = $this->account->getDateTime($startDate); $endDate = $this->end_date ? $this->account->getDateTime($this->getOriginal('end_date')) : null; @@ -325,6 +317,16 @@ class Invoice extends EntityModel } /* + public function shouldSendToday() + { + if (!$nextSendDate = $this->getNextSendDate()) { + return false; + } + + return $this->account->getDateTime() >= $nextSendDate; + } + */ + public function shouldSendToday() { if (!$this->start_date || strtotime($this->start_date) > strtotime('now')) { @@ -376,7 +378,6 @@ class Invoice extends EntityModel return false; } - */ public function getReminder() { diff --git a/app/Models/User.php b/app/Models/User.php index 480293203fa8..da3fbf5f6f3e 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -203,7 +203,8 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon { if (!$user->getOriginal('email') || $user->getOriginal('email') == TEST_USERNAME - || $user->getOriginal('username') == TEST_USERNAME) { + || $user->getOriginal('username') == TEST_USERNAME + || $user->getOriginal('email') == 'tests@bitrock.com') { event(new UserSignedUp()); } diff --git a/app/Services/AuthService.php b/app/Services/AuthService.php index b882bef18eef..0d6642d2613f 100644 --- a/app/Services/AuthService.php +++ b/app/Services/AuthService.php @@ -49,7 +49,7 @@ class AuthService Session::flash('message', trans('texts.success_message')); } else { Session::flash('message', trans('texts.updated_settings')); - return redirect()->to('/settings/' . ACCOUNT_COMPANY_DETAILS); + return redirect()->to('/settings/' . ACCOUNT_USER_DETAILS); } } else { Session::flash('error', $result); diff --git a/public/apple-touch-icon-120x120-precomposed.png b/public/apple-touch-icon-120x120-precomposed.png new file mode 100644 index 000000000000..46bb79d000a7 Binary files /dev/null and b/public/apple-touch-icon-120x120-precomposed.png differ diff --git a/readme.md b/readme.md index 908c59265ea9..04c37c82dc4b 100644 --- a/readme.md +++ b/readme.md @@ -7,8 +7,6 @@ [![Join the chat at https://gitter.im/hillelcoren/invoice-ninja](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/hillelcoren/invoice-ninja?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) -Please help our project by voting for us on [Product Hunt](http://www.producthunt.com/tech/invoice-ninja). - If you'd like to use our code to sell your own invoicing app email us for details about our affiliate program. ### Installation Options diff --git a/resources/views/accounts/invoice_design.blade.php b/resources/views/accounts/invoice_design.blade.php index 41a9b7a90f9e..0ec6d4d94337 100644 --- a/resources/views/accounts/invoice_design.blade.php +++ b/resources/views/accounts/invoice_design.blade.php @@ -141,8 +141,14 @@
{!! Former::actions( - Button::primary(trans('texts.customize'))->large()->asLinkTo(URL::to('/settings/customize_design')), - Button::success(trans('texts.save'))->submit()->large()->appendIcon(Icon::create('floppy-disk'))->withAttributes(['class' => 'save-button']) + Button::primary(trans('texts.customize')) + ->appendIcon(Icon::create('edit')) + ->asLinkTo(URL::to('/settings/customize_design')) + ->large(), + Button::success(trans('texts.save')) + ->submit()->large() + ->appendIcon(Icon::create('floppy-disk')) + ->withAttributes(['class' => 'save-button']) ) !!}
diff --git a/resources/views/accounts/user_details.blade.php b/resources/views/accounts/user_details.blade.php index 6f15abb60bb4..dc86f0ce4c16 100644 --- a/resources/views/accounts/user_details.blade.php +++ b/resources/views/accounts/user_details.blade.php @@ -71,12 +71,18 @@
@if (Utils::isNinja()) @if (Auth::user()->confirmed) - {!! Button::primary(trans('texts.change_password'))->large()->withAttributes(['onclick'=>'showChangePassword()']) !!} + {!! Button::primary(trans('texts.change_password')) + ->appendIcon(Icon::create('lock')) + ->large()->withAttributes(['onclick'=>'showChangePassword()']) !!} @elseif (Auth::user()->registered) - {!! Button::primary(trans('texts.resend_confirmation'))->asLinkTo(URL::to('/resend_confirmation'))->large() !!} + {!! Button::primary(trans('texts.resend_confirmation')) + ->appendIcon(Icon::create('send')) + ->asLinkTo(URL::to('/resend_confirmation'))->large() !!} @endif @endif - {!! Button::success(trans('texts.save'))->submit()->large()->appendIcon(Icon::create('floppy-disk')) !!} + {!! Button::success(trans('texts.save')) + ->submit()->large() + ->appendIcon(Icon::create('floppy-disk')) !!}
@@ -120,7 +126,10 @@