From 88c215d1dfab7de69aaa9acb69f52f67a9af178c Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Tue, 20 Oct 2015 11:23:38 +0300 Subject: [PATCH] Bug fixes --- .../Commands/SendRecurringInvoices.php | 11 ++++++++- app/Http/Controllers/Auth/AuthController.php | 2 +- app/Http/Controllers/InvoiceController.php | 3 +-- app/Models/Invoice.php | 23 +++++++++--------- app/Models/User.php | 3 ++- app/Services/AuthService.php | 2 +- .../apple-touch-icon-120x120-precomposed.png | Bin 0 -> 4389 bytes readme.md | 2 -- .../views/accounts/invoice_design.blade.php | 10 ++++++-- .../views/accounts/user_details.blade.php | 17 ++++++++++--- resources/views/header.blade.php | 3 ++- 11 files changed, 50 insertions(+), 26 deletions(-) create mode 100644 public/apple-touch-icon-120x120-precomposed.png 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 0000000000000000000000000000000000000000..46bb79d000a769aee48bfea29b4a03950b86954f GIT binary patch literal 4389 zcma)AcT|&4vjzze=^`HlrHK)dE}$TY5FtvahF%3k0a2QCh%^NRG&E@my$OUOO(3)% z9feS&hY~s>p#|yfd%fk{`_Db+&UyFUJ+ph>GCMQRGaKE|q#ZP(k#J8X-XpWfy1d5O8@|{ukx|bBvMoXLP8F=2S z(T8}jQWIEqItg2*r`^sJdMd0&1ydb(!X^u1hN;2^*kn2W4*pX?3k?2C@plHq{8#aR zE!Bl>cl~ird~r>hFFIVH`+bm|sS%X@`*Z0!3kgp*8`H$Bm&+I5p#{N_HsBBwu|(&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Ba0zTf1Gf(x*@)=6dbC;9t8Z`?RN%1aUwe2(Nuh)wkRz4#q) z8|G3O*p(bc*1*%k1h8EiOLe}JbPclDQTGGeJsNCRHe(2&}{LQ`yQuPKz&4}^wJGGpUlp$wztciCxv+30s{14mqAEl zWA8s(b5lJ@_x9-{6=F?_M;u90buzBjS}z%j%CqJMTHe7!Ls`OYyQgmSRIIVHKP6Ul zjP-8@pFNLLA=SCB9RL3Pr>Y9@GbsrW@BsD29KF@nw)nXCo4!^XStB!}iI_M&BQxUg z@bmS}71rEGEa5b;nB?SS=7@-3_Z7cWk4%qNm@x^Tkc7o1B^e{1vgF&snp+WK=#P<+ zk!W;8M9RkM_v5-kTxBJYV+172fC8(mOc%-_C=3u+`MA6h$0Rj4AhfJxC$zFd{P)kN z9bAl6#QE&(erXw(=?35Z4a-@6lSH6wbar+Ie!{5KYzaUL;eHP-Q`25MfSlx&H7UfW zJ4>h3(kRMm@0b|PE&U4ufi&9@hTPmhu!DZgk^(xDm!(V7{M+Y*#BWvK*g-AQOeUrr z2n|b%r$qc6n^Qj^yM?C@XM|ix(X+E#-quyVfZTbe>QAq zFPh=X{r;Bl4bX*PEg}E84z74Pr`7>0iWO9fDc*BqDq^8aQBeULGTX-)5+r*R)&gPi zs9;i+>Gjan{q(3(;lUZelYMpLnwmUrtxeTUdV0=Uw3zG+4~E!5Iv?k0sH=a7M2|Yi zHrzA}o2=QPPyqNcGdJt}(}FaA5Ryz-uBfP>P~Kp&)5n|FXLk;P+CeM7Jizs}eajqw zj;o#A@=e)6xu6Rn=Y^pEDds`{UEKe_tNs6VFrbe-XLPS?UoAVP|9c2Rg@Eg*l|Hl% F`8U-nk1YTI literal 0 HcmV?d00001 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 @@