Bug fixes

This commit is contained in:
Hillel Coren 2015-05-10 22:02:35 +03:00
parent bdb9fe4324
commit fcbec2617b
12 changed files with 137 additions and 154 deletions

View File

@ -14,7 +14,10 @@ use stdClass;
use Cache; use Cache;
use Response; use Response;
use parseCSV; use parseCSV;
use Request;
use App\Models\Affiliate;
use App\Models\License;
use App\Models\User; use App\Models\User;
use App\Models\Client; use App\Models\Client;
use App\Models\Contact; use App\Models\Contact;
@ -572,7 +575,7 @@ class AccountController extends BaseController
} }
$subdomain = preg_replace('/[^a-zA-Z0-9_\-]/', '', substr(strtolower(Input::get('subdomain')), 0, MAX_SUBDOMAIN_LENGTH)); $subdomain = preg_replace('/[^a-zA-Z0-9_\-]/', '', substr(strtolower(Input::get('subdomain')), 0, MAX_SUBDOMAIN_LENGTH));
if (!$subdomain || in_array($subdomain, ['www', 'app', 'mail', 'admin', 'blog'])) { if (!$subdomain || in_array($subdomain, ['www', 'app', 'mail', 'admin', 'blog', 'user', 'contact', 'payment', 'payments', 'billing', 'invoice', 'business', 'owner'])) {
$subdomain = null; $subdomain = null;
} }
if ($subdomain) { if ($subdomain) {

View File

@ -613,7 +613,7 @@ class PaymentController extends BaseController
if ($invoice->account->account_key == NINJA_ACCOUNT_KEY) { if ($invoice->account->account_key == NINJA_ACCOUNT_KEY) {
$account = Account::find($invoice->client->public_id); $account = Account::find($invoice->client->public_id);
if ($account->pro_plan_paid) { if ($account->pro_plan_paid && $account->pro_plan_paid != '0000-00-00') {
$date = DateTime::createFromFormat('Y-m-d', $account->pro_plan_paid); $date = DateTime::createFromFormat('Y-m-d', $account->pro_plan_paid);
$account->pro_plan_paid = $date->modify('+1 year')->format('Y-m-d'); $account->pro_plan_paid = $date->modify('+1 year')->format('Y-m-d');
} else { } else {

View File

@ -6,11 +6,13 @@ use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as BaseVerifier;
class VerifyCsrfToken extends BaseVerifier { class VerifyCsrfToken extends BaseVerifier {
private $openRoutes = [ private $openRoutes = [
'signup/register',
'api/v1/clients', 'api/v1/clients',
'api/v1/invoices', 'api/v1/invoices',
'api/v1/quotes', 'api/v1/quotes',
'api/v1/payments', 'api/v1/payments',
'api/v1/email_invoice', 'api/v1/email_invoice',
'api/v1/hooks',
]; ];
/** /**

View File

@ -34,7 +34,7 @@ class HandleInvoiceViewed {
{ {
if ($user->{'notify_viewed'}) if ($user->{'notify_viewed'})
{ {
$this->userMailer->sendNotification($user, $invoice, 'viewed', $payment); $this->userMailer->sendNotification($user, $invoice, 'viewed');
} }
} }
} }

View File

@ -291,7 +291,9 @@ class Activity extends Eloquent
$invoice = $payment->invoice; $invoice = $payment->invoice;
$invoice->balance = $invoice->balance - $payment->amount; $invoice->balance = $invoice->balance - $payment->amount;
$invoice->invoice_status_id = ($invoice->balance > 0) ? INVOICE_STATUS_PARTIAL : INVOICE_STATUS_PAID; $invoice->invoice_status_id = ($invoice->balance > 0) ? INVOICE_STATUS_PARTIAL : INVOICE_STATUS_PAID;
if ($invoice->partial > 0) {
$invoice->partial = max(0, $invoice->partial - $payment->amount); $invoice->partial = max(0, $invoice->partial - $payment->amount);
}
$invoice->save(); $invoice->save();
} }

View File

@ -1,5 +1,6 @@
<?php namespace App\Models; <?php namespace App\Models;
use DateTime;
use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Eloquent\SoftDeletes;
class Invoice extends EntityModel class Invoice extends EntityModel

View File

@ -5,7 +5,7 @@
"jquery": "~1.11", "jquery": "~1.11",
"bootstrap": "~3.*", "bootstrap": "~3.*",
"jquery-ui": "~1.*", "jquery-ui": "~1.*",
"datatables": "1.10.5", "datatables": "1.10.4",
"datatables-bootstrap3": "*", "datatables-bootstrap3": "*",
"knockout.js": "~3.*", "knockout.js": "~3.*",
"knockout-mapping": "*", "knockout-mapping": "*",

File diff suppressed because one or more lines are too long

View File

@ -35,7 +35,7 @@
{!! Former::text('name') !!} {!! Former::text('name') !!}
@if (Auth::user()->isPro() && !Utils::isNinja()) @if (Auth::user()->isPro() && Utils::isNinja())
{{ Former::setOption('capitalize_translations', false) }} {{ Former::setOption('capitalize_translations', false) }}
{!! Former::text('subdomain')->placeholder('texts.www')->onchange('onSubdomainChange()') !!} {!! Former::text('subdomain')->placeholder('texts.www')->onchange('onSubdomainChange()') !!}
@endif @endif

View File

@ -1,4 +1,4 @@
<table class="table table-striped {{ $class = str_random(8) }}"> <table class="table table-striped data-table {{ $class = str_random(8) }}">
<colgroup> <colgroup>
@for ($i = 0; $i < count($columns); $i++) @for ($i = 0; $i < count($columns); $i++)
<col class="con{{ $i }}" /> <col class="con{{ $i }}" />

View File

@ -85,12 +85,7 @@
window.location = '{{ URL::to('view_archive/' . $entityType) }}' + (checked ? '/true' : '/false'); window.location = '{{ URL::to('view_archive/' . $entityType) }}' + (checked ? '/true' : '/false');
} }
</script> $(function() {
@stop
@section('onReady')
var tableFilter = ''; var tableFilter = '';
var searchTimeout = false; var searchTimeout = false;
@ -114,7 +109,7 @@
searchTimeout = setTimeout(function() { searchTimeout = setTimeout(function() {
filterTable($('#tableFilter').val()); filterTable($('#tableFilter').val());
}, 1000); }, 500);
}) })
window.onDatatableReady = function() { window.onDatatableReady = function() {
@ -156,6 +151,8 @@
$('button.archive').prop('disabled', !checked); $('button.archive').prop('disabled', !checked);
} }
});
</script>
@stop @stop

View File

@ -60,9 +60,9 @@
$('#payment_type_id').combobox(); $('#payment_type_id').combobox();
@if (!$clientPublicId) @if (!$payment && !$clientPublicId)
$('.client-select input.form-control').focus(); $('.client-select input.form-control').focus();
@elseif (!$invoicePublicId) @elseif (!$payment && !$invoicePublicId)
$('.invoice-select input.form-control').focus(); $('.invoice-select input.form-control').focus();
@elseif (!$payment) @elseif (!$payment)
$('#amount').focus(); $('#amount').focus();