1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-09 12:42:36 +01:00

Bug fixes

This commit is contained in:
Hillel Coren 2015-10-20 11:23:38 +03:00
parent 1458b9ade7
commit 88c215d1df
11 changed files with 50 additions and 26 deletions

View File

@ -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);
}
}

View File

@ -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()

View File

@ -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) {

View File

@ -1,6 +1,7 @@
<?php namespace App\Models;
use Utils;
use DateTime;
use Illuminate\Database\Eloquent\SoftDeletes;
class Invoice extends EntityModel
@ -215,22 +216,13 @@ class Invoice extends EntityModel
return $this;
}
public function shouldSendToday()
{
if (!$nextSendDate = $this->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()
{

View File

@ -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());
}

View File

@ -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);

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

View File

@ -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

View File

@ -141,8 +141,14 @@
<br/>
{!! 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'])
) !!}
<br/>

View File

@ -71,12 +71,18 @@
<center>
@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')) !!}
</center>
</div>
@ -120,7 +126,10 @@
</div>
<div class="modal-footer" style="margin-top: 0px" id="changePasswordFooter">
<button type="button" class="btn btn-default" id="cancelChangePasswordButton" data-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-default" id="cancelChangePasswordButton" data-dismiss="modal">
{{ trans('texts.cancel') }}
<i class="glyphicon glyphicon-remove-circle"></i>
</button>
<button type="button" class="btn btn-success" onclick="submitChangePassword()" id="changePasswordButton" disabled>
{{ trans('texts.save') }}
<i class="glyphicon glyphicon-floppy-disk"></i>

View File

@ -136,6 +136,8 @@
});
}
@endif
function checkForEnter(event)
{
if (event.keyCode === 13){
@ -144,7 +146,6 @@
return false;
}
}
@endif
function logout(force)
{