1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-18 23:42:25 +02:00

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 Response;
use parseCSV;
use Request;
use App\Models\Affiliate;
use App\Models\License;
use App\Models\User;
use App\Models\Client;
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));
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;
}
if ($subdomain) {

View File

@ -613,7 +613,7 @@ class PaymentController extends BaseController
if ($invoice->account->account_key == NINJA_ACCOUNT_KEY) {
$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);
$account->pro_plan_paid = $date->modify('+1 year')->format('Y-m-d');
} else {

View File

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

View File

@ -34,7 +34,7 @@ class HandleInvoiceViewed {
{
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->balance = $invoice->balance - $payment->amount;
$invoice->invoice_status_id = ($invoice->balance > 0) ? INVOICE_STATUS_PARTIAL : INVOICE_STATUS_PAID;
$invoice->partial = max(0, $invoice->partial - $payment->amount);
if ($invoice->partial > 0) {
$invoice->partial = max(0, $invoice->partial - $payment->amount);
}
$invoice->save();
}

View File

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

View File

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

File diff suppressed because one or more lines are too long

View File

@ -35,7 +35,7 @@
{!! Former::text('name') !!}
@if (Auth::user()->isPro() && !Utils::isNinja())
@if (Auth::user()->isPro() && Utils::isNinja())
{{ Former::setOption('capitalize_translations', false) }}
{!! Former::text('subdomain')->placeholder('texts.www')->onchange('onSubdomainChange()') !!}
@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>
@for ($i = 0; $i < count($columns); $i++)
<col class="con{{ $i }}" />
@ -43,7 +43,7 @@
$(row).addClass('entityArchived');
}
},
"bAutoWidth": false,
"bAutoWidth": false,
@if (isset($hasCheckboxes) && $hasCheckboxes)
'aaSorting': [['1', 'asc']],
// Disable sorting on the first column

View File

@ -85,77 +85,74 @@
window.location = '{{ URL::to('view_archive/' . $entityType) }}' + (checked ? '/true' : '/false');
}
$(function() {
var tableFilter = '';
var searchTimeout = false;
var oTable0 = $('#DataTables_Table_0').dataTable();
var oTable1 = $('#DataTables_Table_1').dataTable();
function filterTable(val) {
if (val == tableFilter) {
return;
}
tableFilter = val;
oTable0.fnFilter(val);
@if (isset($secEntityType))
oTable1.fnFilter(val);
@endif
}
$('#tableFilter').on('keyup', function(){
if (searchTimeout) {
window.clearTimeout(searchTimeout);
}
searchTimeout = setTimeout(function() {
filterTable($('#tableFilter').val());
}, 500);
})
window.onDatatableReady = function() {
$(':checkbox').click(function() {
setArchiveEnabled();
});
$('tbody tr').click(function(event) {
if (event.target.type !== 'checkbox' && event.target.type !== 'button' && event.target.tagName.toLowerCase() !== 'a') {
$checkbox = $(this).closest('tr').find(':checkbox:not(:disabled)');
var checked = $checkbox.prop('checked');
$checkbox.prop('checked', !checked);
setArchiveEnabled();
}
});
$('tbody tr').mouseover(function() {
$(this).closest('tr').find('.tr-action').css('visibility','visible');
}).mouseout(function() {
$dropdown = $(this).closest('tr').find('.tr-action');
if (!$dropdown.hasClass('open')) {
$dropdown.css('visibility','hidden');
}
});
}
$('.archive').prop('disabled', true);
$('.archive:not(.dropdown-toggle)').click(function() {
submitForm('archive');
});
$('.selectAll').click(function() {
$(this).closest('table').find(':checkbox:not(:disabled)').prop('checked', this.checked);
});
function setArchiveEnabled() {
var checked = $('tbody :checkbox:checked').length > 0;
$('button.archive').prop('disabled', !checked);
}
});
</script>
@stop
@section('onReady')
var tableFilter = '';
var searchTimeout = false;
var oTable0 = $('#DataTables_Table_0').dataTable();
var oTable1 = $('#DataTables_Table_1').dataTable();
function filterTable(val) {
if (val == tableFilter) {
return;
}
tableFilter = val;
oTable0.fnFilter(val);
@if (isset($secEntityType))
oTable1.fnFilter(val);
@endif
}
$('#tableFilter').on('keyup', function(){
if (searchTimeout) {
window.clearTimeout(searchTimeout);
}
searchTimeout = setTimeout(function() {
filterTable($('#tableFilter').val());
}, 1000);
})
window.onDatatableReady = function() {
$(':checkbox').click(function() {
setArchiveEnabled();
});
$('tbody tr').click(function(event) {
if (event.target.type !== 'checkbox' && event.target.type !== 'button' && event.target.tagName.toLowerCase() !== 'a') {
$checkbox = $(this).closest('tr').find(':checkbox:not(:disabled)');
var checked = $checkbox.prop('checked');
$checkbox.prop('checked', !checked);
setArchiveEnabled();
}
});
$('tbody tr').mouseover(function() {
$(this).closest('tr').find('.tr-action').css('visibility','visible');
}).mouseout(function() {
$dropdown = $(this).closest('tr').find('.tr-action');
if (!$dropdown.hasClass('open')) {
$dropdown.css('visibility','hidden');
}
});
}
$('.archive').prop('disabled', true);
$('.archive:not(.dropdown-toggle)').click(function() {
submitForm('archive');
});
$('.selectAll').click(function() {
$(this).closest('table').find(':checkbox:not(:disabled)').prop('checked', this.checked);
});
function setArchiveEnabled() {
var checked = $('tbody :checkbox:checked').length > 0;
$('button.archive').prop('disabled', !checked);
}
@stop

View File

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