1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-18 00:53:10 +01:00

Bug fixes

This commit is contained in:
Hillel Coren 2015-10-15 22:37:01 +03:00
parent b052e1b6d8
commit 1ab154aba9
20 changed files with 93 additions and 77 deletions

View File

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

View File

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

View File

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

View File

@ -1,8 +1,6 @@
<?php namespace App\Models;
use Utils;
use DateTime;
use Carbon;
use Illuminate\Database\Eloquent\SoftDeletes;
class Invoice extends EntityModel
@ -232,10 +230,11 @@ class Invoice extends EntityModel
return false;
}
$timezone = $this->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()) {

View File

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

19
composer.lock generated
View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -76,7 +76,7 @@
<div class="row">
<div class="col-md-6">
<div class="col-md-12">
{!! Former::open()->addClass('warn-on-exit')->onchange('refreshPDF()') !!}
{!! Former::populate($account) !!}
@ -91,54 +91,63 @@
<div class="panel-heading">
<h3 class="panel-title">{!! trans('texts.invoice_design') !!}</h3>
</div>
<div class="panel-body">
<div class="panel-body form-padding-right">
<div role="tabpanel">
<ul class="nav nav-tabs" role="tablist" style="border: none">
<li role="presentation" class="active"><a href="#generalSettings" aria-controls="generalSettings" role="tab" data-toggle="tab">{{ trans('texts.general_settings') }}</a></li>
<li role="presentation"><a href="#invoiceLabels" aria-controls="invoiceLabels" role="tab" data-toggle="tab">{{ trans('texts.invoice_labels') }}</a></li>
<li role="presentation"><a href="#invoiceOptions" aria-controls="invoiceOptions" role="tab" data-toggle="tab">{{ trans('texts.invoice_options') }}</a></li>
</ul>
</div>
<div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="generalSettings">
<div class="panel-body">
@if (!Utils::isPro() || \App\Models\InvoiceDesign::count() == COUNT_FREE_DESIGNS_SELF_HOST)
{!! Former::select('invoice_design_id')->style('display:inline')->fromQuery($invoiceDesigns, 'name', 'id')->addOption(trans('texts.more_designs') . '...', '-1') !!}
@else
{!! Former::select('invoice_design_id')->style('display:inline')->fromQuery($invoiceDesigns, 'name', 'id') !!}
@endif
{!! Former::text('font_size')->type('number')->min('0')->step('1') !!}
{!! Former::text('primary_color') !!}
{!! Former::text('secondary_color') !!}
</div>
</div>
<div role="tabpanel" class="tab-pane" id="invoiceLabels">
<div class="panel-body">
@if (!Utils::isPro() || \App\Models\InvoiceDesign::count() == COUNT_FREE_DESIGNS_SELF_HOST)
{!! Former::select('invoice_design_id')->style('display:inline')->fromQuery($invoiceDesigns, 'name', 'id')->addOption(trans('texts.more_designs') . '...', '-1') !!}
@else
{!! Former::select('invoice_design_id')->style('display:inline')->fromQuery($invoiceDesigns, 'name', 'id') !!}
@endif
{!! Former::text('labels_item')->label(trans('texts.item')) !!}
{!! Former::text('labels_description')->label(trans('texts.description')) !!}
{!! Former::text('labels_unit_cost')->label(trans('texts.unit_cost')) !!}
{!! Former::text('labels_quantity')->label(trans('texts.quantity')) !!}
{!! Former::text('font_size')->type('number')->min('0')->step('1') !!}
{!! Former::text('primary_color') !!}
{!! Former::text('secondary_color') !!}
{!! Former::actions(
Button::primary(trans('texts.customize_design'))->small()->asLinkTo(URL::to('/settings/customize_design'))
) !!}
</div>
</div>
<div role="tabpanel" class="tab-pane" id="invoiceOptions">
<div class="panel-body">
</div>
</div>
{!! Former::checkbox('hide_quantity')->text(trans('texts.hide_quantity_help')) !!}
{!! Former::checkbox('hide_paid_to_date')->text(trans('texts.hide_paid_to_date_help')) !!}
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">{!! trans('texts.invoice_labels') !!}</h3>
</div>
<div class="panel-body">
{!! Former::text('labels_item')->label(trans('texts.item')) !!}
{!! Former::text('labels_description')->label(trans('texts.description')) !!}
{!! Former::text('labels_unit_cost')->label(trans('texts.unit_cost')) !!}
{!! Former::text('labels_quantity')->label(trans('texts.quantity')) !!}
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">{!! trans('texts.invoice_options') !!}</h3>
</div>
<div class="panel-body">
{!! Former::checkbox('hide_quantity')->text(trans('texts.hide_quantity_help')) !!}
{!! Former::checkbox('hide_paid_to_date')->text(trans('texts.hide_paid_to_date_help')) !!}
</div>
</div>
</div>
</div>
</div>
@if (Auth::user()->isPro())
{!! Former::actions( Button::success(trans('texts.save'))->submit()->large()->appendIcon(Icon::create('floppy-disk'))) !!}
<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'))
) !!}
<br/>
@else
<script>
$(function() {
@ -150,11 +159,10 @@
{!! Former::close() !!}
</div>
<div class="col-md-6">
</div>
@include('invoices.pdf', ['account' => Auth::user()->account, 'pdfHeight' => 800])
</div>
</div>
@stop