mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-08 17:44:32 -04:00
bug fixes
This commit is contained in:
parent
b271a71586
commit
9dd1b54d4a
@ -42,8 +42,8 @@ class SendRecurringInvoices extends Command {
|
||||
$invoice->invoice_number = $recurInvoice->account->getNextInvoiceNumber();
|
||||
$invoice->amount = $recurInvoice->amount;
|
||||
$invoice->currency_id = $recurInvoice->currency_id;
|
||||
$invoice->invoice_date = new DateTime();
|
||||
$invoice->due_date = new DateTime();
|
||||
$invoice->invoice_date = date_create();
|
||||
$invoice->due_date = date_create()->modify($invoice->client->payment_terms . ' day');
|
||||
$invoice->save();
|
||||
|
||||
foreach ($recurInvoice->invoice_items as $recurItem)
|
||||
|
@ -88,6 +88,7 @@ class ClientController extends \BaseController {
|
||||
'title' => '- New Client',
|
||||
'clientSizes' => ClientSize::remember(DEFAULT_QUERY_CACHE)->orderBy('id')->get(),
|
||||
'clientIndustries' => ClientIndustry::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(),
|
||||
'paymentTerms' => PaymentTerm::remember(DEFAULT_QUERY_CACHE)->orderBy('num_days')->get(['name', 'num_days']),
|
||||
'currencies' => Currency::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(),
|
||||
'countries' => Country::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get());
|
||||
|
||||
@ -139,6 +140,7 @@ class ClientController extends \BaseController {
|
||||
'url' => 'clients/' . $publicId,
|
||||
'title' => '- ' . $client->name,
|
||||
'clientSizes' => ClientSize::remember(DEFAULT_QUERY_CACHE)->orderBy('id')->get(),
|
||||
'paymentTerms' => PaymentTerm::remember(DEFAULT_QUERY_CACHE)->orderBy('num_days')->get(['name', 'num_days']),
|
||||
'clientIndustries' => ClientIndustry::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(),
|
||||
'currencies' => Currency::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(),
|
||||
'countries' => Country::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get());
|
||||
@ -187,6 +189,7 @@ class ClientController extends \BaseController {
|
||||
$client->client_size_id = Input::get('client_size_id') ? Input::get('client_size_id') : null;
|
||||
$client->client_industry_id = Input::get('client_industry_id') ? Input::get('client_industry_id') : null;
|
||||
$client->currency_id = Input::get('currency_id') ? Input::get('currency_id') : null;
|
||||
$client->payment_terms = Input::get('payment_terms');
|
||||
$client->website = trim(Input::get('website'));
|
||||
|
||||
$client->save();
|
||||
|
@ -116,7 +116,7 @@ class InvoiceController extends \BaseController {
|
||||
|
||||
public function view($invitationKey)
|
||||
{
|
||||
$invitation = Invitation::with('user', 'invoice.account', 'invoice.client', 'invoice.invoice_items', 'invoice.client.account.account_gateways')
|
||||
$invitation = Invitation::with('user', 'invoice.invoice_items', 'invoice.client.account', 'invoice.client.contacts')
|
||||
->where('invitation_key', '=', $invitationKey)->firstOrFail();
|
||||
|
||||
$user = $invitation->user;
|
||||
@ -350,6 +350,7 @@ class InvoiceController extends \BaseController {
|
||||
'taxRates' => TaxRate::scope()->orderBy('name')->get(),
|
||||
'currencies' => Currency::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(),
|
||||
'clientSizes' => ClientSize::remember(DEFAULT_QUERY_CACHE)->orderBy('id')->get(),
|
||||
'paymentTerms' => PaymentTerm::remember(DEFAULT_QUERY_CACHE)->orderBy('num_days')->get(['name', 'num_days']),
|
||||
'clientIndustries' => ClientIndustry::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(),
|
||||
'frequencies' => array(
|
||||
1 => 'Weekly',
|
||||
|
@ -10,6 +10,7 @@ class ConfideSetupUsersTable extends Migration {
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::dropIfExists('payment_terms');
|
||||
Schema::dropIfExists('themes');
|
||||
Schema::dropIfExists('credits');
|
||||
Schema::dropIfExists('activities');
|
||||
@ -60,6 +61,13 @@ class ConfideSetupUsersTable extends Migration {
|
||||
$t->string('name');
|
||||
});
|
||||
|
||||
Schema::create('payment_terms', function($t)
|
||||
{
|
||||
$t->increments('id');
|
||||
$t->integer('num_days');
|
||||
$t->string('name');
|
||||
});
|
||||
|
||||
Schema::create('timezones', function($t)
|
||||
{
|
||||
$t->increments('id');
|
||||
@ -220,6 +228,7 @@ class ConfideSetupUsersTable extends Migration {
|
||||
$t->unsignedInteger('client_industry_id')->nullable();
|
||||
$t->unsignedInteger('client_size_id')->nullable();
|
||||
$t->boolean('is_deleted');
|
||||
$t->integer('payment_terms');
|
||||
|
||||
$t->foreign('account_id')->references('id')->on('accounts')->onDelete('cascade');
|
||||
$t->foreign('user_id')->references('id')->on('users');
|
||||
@ -294,7 +303,6 @@ class ConfideSetupUsersTable extends Migration {
|
||||
$t->timestamp('last_sent_date')->nullable();
|
||||
$t->unsignedInteger('recurring_invoice_id')->index()->nullable();
|
||||
|
||||
|
||||
$t->decimal('amount', 13, 4);
|
||||
$t->decimal('balance', 13, 4);
|
||||
|
||||
@ -486,6 +494,7 @@ class ConfideSetupUsersTable extends Migration {
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('payment_terms');
|
||||
Schema::dropIfExists('themes');
|
||||
Schema::dropIfExists('credits');
|
||||
Schema::dropIfExists('activities');
|
||||
|
@ -69,10 +69,16 @@ class ConstantsSeeder extends Seeder
|
||||
ClientSize::create(array('name' => '101 - 500'));
|
||||
ClientSize::create(array('name' => '500+'));
|
||||
|
||||
PaymentTerm::create(array('num_days' => 7, 'name' => 'Net 7'));
|
||||
PaymentTerm::create(array('num_days' => 10, 'name' => 'Net 10'));
|
||||
PaymentTerm::create(array('num_days' => 14, 'name' => 'Net 14'));
|
||||
PaymentTerm::create(array('num_days' => 15, 'name' => 'Net 15'));
|
||||
PaymentTerm::create(array('num_days' => 30, 'name' => 'Net 30'));
|
||||
PaymentTerm::create(array('num_days' => 60, 'name' => 'Net 60'));
|
||||
|
||||
Currency::create(array('name' => 'US Dollar', 'symbol' => '$', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'));
|
||||
Currency::create(array('name' => 'Pound Sterling', 'symbol' => '£', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'));
|
||||
|
||||
|
||||
DatetimeFormat::create(array('format' => 'F j, Y, g:i a', 'label' => 'March 10, 2013, 6:15 pm'));
|
||||
DatetimeFormat::create(array('format' => 'D M jS, Y g:ia', 'label' => 'Mon March 10th, 2013, 6:15 pm'));
|
||||
|
||||
|
@ -3,7 +3,6 @@
|
||||
class Account extends Eloquent
|
||||
{
|
||||
protected $softDelete = true;
|
||||
protected $hidden = array('ip', 'timezone_id', 'created_at', 'updated_at', 'deleted_at', 'key', 'last_login');
|
||||
|
||||
public function users()
|
||||
{
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
class AccountGateway extends Eloquent
|
||||
{
|
||||
protected $hidden = array('config');
|
||||
|
||||
public function gateway()
|
||||
{
|
||||
return $this->belongsTo('Gateway');
|
||||
|
@ -20,8 +20,6 @@ define("ACTIVITY_TYPE_DELETE_CREDIT", 15);
|
||||
|
||||
class Activity extends Eloquent
|
||||
{
|
||||
protected $hidden = array('id');
|
||||
|
||||
public function scopeScope($query)
|
||||
{
|
||||
return $query->whereAccountId(Auth::user()->account_id);
|
||||
@ -121,7 +119,7 @@ class Activity extends Eloquent
|
||||
$activity->invoice_id = $invitation->invoice_id;
|
||||
$activity->contact_id = $invitation->contact_id;
|
||||
$activity->activity_type_id = ACTIVITY_TYPE_EMAIL_INVOICE;
|
||||
$activity->message = $userName . ' emailed invoice ' . link_to('invoices/'.$invitation->invoice->public_id, $invitation->invoice->invoice_number) . ' to ' . $invitation->contact->getFullName();
|
||||
$activity->message = $userName . ' emailed invoice ' . link_to('invoices/'.$invitation->invoice->public_id, $invitation->invoice->invoice_number) . ' to ' . $invitation->contact->getFullName() . ' - ' . $invitation->contact->email;
|
||||
$activity->balance = $invitation->invoice->client->balance;
|
||||
$activity->adjustment = $adjustment;
|
||||
$activity->save();
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
class Client extends EntityModel
|
||||
{
|
||||
protected $hidden = array('id', 'account_id', 'created_at', 'updated_at', 'deleted_at', 'private_notes', 'last_login');
|
||||
|
||||
public static $fieldName = 'Client - Name';
|
||||
public static $fieldPhone = 'Client - Phone';
|
||||
public static $fieldAddress1 = 'Client - Street';
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
class Contact extends EntityModel
|
||||
{
|
||||
protected $hidden = array('id', 'cliend_id', 'created_at', 'updated_at', 'deleted_at', 'last_login');
|
||||
|
||||
public static $fieldFirstName = 'Contact - First Name';
|
||||
public static $fieldLastName = 'Contact - Last Name';
|
||||
public static $fieldEmail = 'Contact - Email';
|
||||
|
@ -3,8 +3,6 @@
|
||||
class EntityModel extends Eloquent
|
||||
{
|
||||
protected $softDelete = true;
|
||||
protected $hidden = array('id', 'created_at', 'updated_at', 'deleted_at');
|
||||
|
||||
public static function createNew($parent = false)
|
||||
{
|
||||
$className = get_called_class();
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
class Invitation extends EntityModel
|
||||
{
|
||||
protected $hidden = array('id', 'account_id', 'user_id', 'contact_id', 'created_at', 'updated_at', 'deleted_at', 'viewed_date');
|
||||
|
||||
public function invoice()
|
||||
{
|
||||
return $this->belongsTo('Invoice');
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
class Invoice extends EntityModel
|
||||
{
|
||||
protected $hidden = array('id', 'account_id', 'client_id', 'created_at', 'updated_at', 'deleted_at', 'viewed_date');
|
||||
|
||||
public function account()
|
||||
{
|
||||
return $this->belongsTo('Account');
|
||||
|
7
app/models/PaymentTerm.php
Executable file
7
app/models/PaymentTerm.php
Executable file
@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
class PaymentTerm extends Eloquent
|
||||
{
|
||||
public $timestamps = false;
|
||||
protected $softDelete = false;
|
||||
}
|
@ -3,5 +3,4 @@
|
||||
class TaxRate extends EntityModel
|
||||
{
|
||||
|
||||
|
||||
}
|
@ -6,9 +6,7 @@ use Zizaco\Confide\ConfideUser;
|
||||
|
||||
class User extends ConfideUser implements UserInterface, RemindableInterface
|
||||
{
|
||||
|
||||
protected $softDelete = true;
|
||||
protected $hidden = array('created_at', 'updated_at', 'deleted_at', 'password', 'confirmation_code', 'registered', 'confirmed');
|
||||
|
||||
public static $rules = array(
|
||||
/*
|
||||
|
@ -31,6 +31,7 @@ class ClientRepository
|
||||
$client->client_size_id = $data['client_size_id'] ? $data['client_size_id'] : null;
|
||||
$client->client_industry_id = $data['client_industry_id'] ? $data['client_industry_id'] : null;
|
||||
$client->currency_id = $data['currency_id'] ? $data['currency_id'] : null;
|
||||
$client->payment_terms = $data['payment_terms'];
|
||||
$client->website = trim($data['website']);
|
||||
$client->save();
|
||||
|
||||
@ -41,7 +42,7 @@ class ClientRepository
|
||||
{
|
||||
$record = (array) $record;
|
||||
|
||||
if (isset($record['public_id']) && $record['public_id'])
|
||||
if ($publicId != "-1" && isset($record['public_id']) && $record['public_id'])
|
||||
{
|
||||
$contact = Contact::scope($record['public_id'])->firstOrFail();
|
||||
}
|
||||
|
@ -44,6 +44,8 @@
|
||||
</div>
|
||||
|
||||
{{ Former::legend('Additional Info') }}
|
||||
{{ Former::select('payment_terms')->addOption('','')
|
||||
->fromQuery($paymentTerms, 'name', 'num_days') }}
|
||||
{{ Former::select('currency_id')->addOption('','')->label('Currency')
|
||||
->fromQuery($currencies, 'name', 'id')->select(Session::get(SESSION_CURRENCY, DEFAULT_CURRENCY)) }}
|
||||
{{ Former::select('client_size_id')->addOption('','')->label('Size')
|
||||
|
@ -35,10 +35,10 @@
|
||||
|
||||
</div>
|
||||
|
||||
<h2>{{ $client->name }}</h2>
|
||||
<h2>{{ $client->getDisplayName() }}</h2>
|
||||
@if ($client->last_login > 0)
|
||||
<h3 style="margin-top:0px"><small>
|
||||
Last logged in {{ Utils::timestampToDateTimeString($client->last_login); }}
|
||||
Last logged in {{ Utils::timestampToDateTimeString(strtotime($client->last_login)); }}
|
||||
</small></h3>
|
||||
@endif
|
||||
|
||||
@ -50,7 +50,8 @@
|
||||
<p>{{ $client->getPhone() }}</p>
|
||||
<p>{{ $client->getNotes() }}</p>
|
||||
<p>{{ $client->getIndustry() }}</p>
|
||||
<p>{{ $client->getWebsite() }}
|
||||
<p>{{ $client->getWebsite() }}</p>
|
||||
<p>{{ $client->payment_terms ? "Payment terms: Net " . $client->payment_terms : '' }}</p>
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
|
@ -66,13 +66,8 @@
|
||||
@section('body')
|
||||
|
||||
<div class="container">
|
||||
<p/>
|
||||
<div>
|
||||
<a href="{{ URL::to('/') }}" style="font-size:30px;color:black">Invoice Ninja</a>
|
||||
|
||||
</div>
|
||||
|
||||
<p style="clear: both"/>
|
||||
<p> </p>
|
||||
<p> </p>
|
||||
<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
|
||||
|
||||
<div class="navbar-header">
|
||||
@ -172,7 +167,7 @@
|
||||
{{ Former::close() }}
|
||||
</div>
|
||||
|
||||
Want something changed? We're {{ link_to('https://github.com/hillelcoren/invoice-ninja', 'open source', array('target'=>'_blank')) }}, email us at {{ link_to('mailto:contact@invoiceninja.com', 'contact@invoiceninja.com') }}.
|
||||
Need something changed? We're {{ link_to('https://github.com/hillelcoren/invoice-ninja', 'open source', array('target'=>'_blank')) }}, email us at {{ link_to('mailto:contact@invoiceninja.com', 'contact@invoiceninja.com') }}.
|
||||
<p class="text-danger">This is a demo site, the data is erased.</p>
|
||||
|
||||
</div>
|
||||
|
@ -123,16 +123,16 @@
|
||||
->raw()->data_bind("value: product_key, valueUpdate: 'afterkeydown'")->addClass('datalist') }}
|
||||
</td>
|
||||
<td style="width:300px">
|
||||
<textarea data-bind="value: wrapped_notes, valueUpdate: 'afterkeydown'" rows="1" cols="60" style="resize: none;" class="form-control word-wrap" onchange="refreshPDF()"></textarea>
|
||||
<textarea data-bind="value: wrapped_notes, valueUpdate: 'afterkeydown'" rows="1" cols="60" style="resize: none;" class="form-control word-wrap"></textarea>
|
||||
</td>
|
||||
<td style="width:100px">
|
||||
<input onkeyup="onItemChange()" data-bind="value: prettyCost, valueUpdate: 'afterkeydown'" style="text-align: right" class="form-control" onchange="refreshPDF()"//>
|
||||
<input onkeyup="onItemChange()" data-bind="value: prettyCost, valueUpdate: 'afterkeydown'" style="text-align: right" class="form-control"//>
|
||||
</td>
|
||||
<td style="width:80px">
|
||||
<input onkeyup="onItemChange()" data-bind="value: prettyQty, valueUpdate: 'afterkeydown'" style="text-align: right" class="form-control" onchange="refreshPDF()"//>
|
||||
<input onkeyup="onItemChange()" data-bind="value: prettyQty, valueUpdate: 'afterkeydown'" style="text-align: right" class="form-control"//>
|
||||
</td>
|
||||
<td style="width:120px; vertical-align:middle" data-bind="visible: $parent.tax_rates().length > 1">
|
||||
<select class="form-control" style="width:100%" data-bind="value: tax, options: $parent.tax_rates, optionsText: 'displayName'" onchange="refreshPDF()"></select>
|
||||
<select class="form-control" style="width:100%" data-bind="value: tax, options: $parent.tax_rates, optionsText: 'displayName'"></select>
|
||||
</td>
|
||||
<td style="width:100px;text-align: right;padding-top:9px !important">
|
||||
<span data-bind="text: total"></span>
|
||||
@ -242,6 +242,8 @@
|
||||
</div>
|
||||
|
||||
{{ Former::legend('Additional Info') }}
|
||||
{{ Former::select('payment_terms')->addOption('','')->data_bind('value: payment_terms')
|
||||
->fromQuery($paymentTerms, 'name', 'num_days') }}
|
||||
{{ Former::select('currency_id')->addOption('','')->label('Currency')->data_bind('value: currency_id')
|
||||
->fromQuery($currencies, 'name', 'id') }}
|
||||
{{ Former::select('client_size_id')->addOption('','')->label('Size')->data_bind('value: client_size_id')
|
||||
@ -274,7 +276,7 @@
|
||||
</div>
|
||||
|
||||
<div class="modal-footer" style="margin-top: 0px">
|
||||
<span class="error-block" id="emailError" style="display:none;float:left">Please provide a valid email address.</span><span> </span>
|
||||
<span class="error-block" id="emailError" style="display:none;float:left;font-weight:bold">Please provide a valid email address.</span><span> </span>
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
|
||||
<button type="button" class="btn btn-primary" data-bind="click: clientFormComplete">Done</button>
|
||||
</div>
|
||||
@ -360,7 +362,8 @@
|
||||
if (clientId > 0) {
|
||||
model.loadClient(clientMap[clientId]);
|
||||
} else {
|
||||
model.client.public_id(0); // TODO_FIX
|
||||
//model.client.public_id(0); // TODO_FIX
|
||||
model.loadClient(new ClientModel());
|
||||
}
|
||||
refreshPDF();
|
||||
}).trigger('change');
|
||||
@ -408,6 +411,11 @@
|
||||
});
|
||||
|
||||
function applyComboboxListeners() {
|
||||
$('.invoice-table input, .invoice-table select, .invoice-table textarea').on('blur', function() {
|
||||
//if (value != $(this).val()) refreshPDF();
|
||||
refreshPDF();
|
||||
});
|
||||
|
||||
var value;
|
||||
$('.datalist').on('focus', function() {
|
||||
value = $(this).val();
|
||||
@ -618,10 +626,16 @@
|
||||
self.clientBackup = ko.mapping.toJS(self.client);
|
||||
//console.log(self.clientBackup);
|
||||
|
||||
/*
|
||||
if (self.client.public_id() == 0) {
|
||||
$('#clientModal input').val('');
|
||||
$('#clientModal #payment_terms').val('');
|
||||
$('#clientModal #country_id').val('');
|
||||
$('#clientModal #currency_id').val('');
|
||||
$('#clientModal #client_size_id').val('');
|
||||
$('#clientModal #client_industry_id').val('');
|
||||
}
|
||||
*/
|
||||
|
||||
$('#emailError').css( "display", "none" );
|
||||
$('#clientModal').modal('show');
|
||||
@ -735,6 +749,7 @@
|
||||
self.client_industry_id = ko.observable('');
|
||||
self.currency_id = ko.observable('');
|
||||
self.website = ko.observable('');
|
||||
self.payment_terms = ko.observable();
|
||||
self.contacts = ko.observableArray();
|
||||
|
||||
self.mapping = {
|
||||
|
@ -31,12 +31,10 @@
|
||||
@endif
|
||||
var doc = generatePDF(invoice);
|
||||
var string = doc.output('datauristring');
|
||||
alert(isFirefox);
|
||||
alert(isChrome);
|
||||
|
||||
if (isFirefox || isChrome) {
|
||||
$('#theFrame').attr('src', string).show();
|
||||
} else {
|
||||
alert(1);
|
||||
var pdfAsArray = convertDataURIToBinary(string);
|
||||
PDFJS.getDocument(pdfAsArray).then(function getPdfHelloWorld(pdf) {
|
||||
|
||||
|
@ -631,8 +631,13 @@ ko.bindingHandlers.dropdown = {
|
||||
var value = ko.utils.unwrapObservable(valueAccessor());
|
||||
var id = (value && value.public_id) ? value.public_id() : (value && value.id) ? value.id() : value ? value : false;
|
||||
console.log("combo-update: %s", id);
|
||||
if (id) $(element).val(id);
|
||||
if (id) {
|
||||
$(element).val(id);
|
||||
$(element).combobox('refresh');
|
||||
} else {
|
||||
$(element).combobox('clearTarget');
|
||||
$(element).combobox('clearElement');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user