mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Bug fixes
This commit is contained in:
parent
2142538e15
commit
99800f38dd
@ -13,7 +13,7 @@ class AccountController extends \BaseController {
|
||||
//$user = User::where('password', '=', $guestKey)->firstOrFail();
|
||||
$user = User::where('password', '=', $guestKey)->first();
|
||||
|
||||
if ($user && !$user->is_guest)
|
||||
if ($user && $user->registered)
|
||||
{
|
||||
exit;
|
||||
}
|
||||
@ -33,7 +33,7 @@ class AccountController extends \BaseController {
|
||||
$account->users()->save($user);
|
||||
}
|
||||
|
||||
Auth::login($user);
|
||||
Auth::login($user, true);
|
||||
Session::put('tz', 'US/Eastern');
|
||||
|
||||
return Redirect::to('invoices/create');
|
||||
@ -452,7 +452,7 @@ class AccountController extends \BaseController {
|
||||
|
||||
public function checkEmail()
|
||||
{
|
||||
$email = User::where('email', '=', Input::get('email'))->first();
|
||||
$email = User::where('email', '=', Input::get('email'))->where('id', '<>', Auth::user()->id)->first();
|
||||
|
||||
if ($email) {
|
||||
return "taken";
|
||||
@ -500,6 +500,6 @@ class AccountController extends \BaseController {
|
||||
*/
|
||||
|
||||
Session::flash('message', 'Successfully registered');
|
||||
return Redirect::to(Input::get('path'));
|
||||
return Redirect::to(Input::get('path'))->with('clearGuestKey', true);
|
||||
}
|
||||
}
|
@ -5,7 +5,7 @@ class ActivityController extends \BaseController {
|
||||
public function getDatatable($clientId)
|
||||
{
|
||||
return Datatable::collection(Activity::scope()->where('client_id','=',$clientId)->get())
|
||||
->addColumn('date', function($model) { return $model->created_at->format('m/d/y h:i a'); })
|
||||
->addColumn('date', function($model) { return timestampToDateTimeString($model->created_at); })
|
||||
->addColumn('message', function($model) { return $model->message; })
|
||||
->addColumn('balance', function($model) { return '$' . $model->balance; })
|
||||
->orderColumns('date')
|
||||
|
@ -14,6 +14,7 @@ class ClientController extends \BaseController {
|
||||
|
||||
return View::make('list', array(
|
||||
'entityType'=>ENTITY_CLIENT,
|
||||
'title' => '- Clients',
|
||||
'columns'=>['checkbox', 'Client', 'Contact', 'Balance', 'Last Login', 'Date Created', 'Email', 'Phone', 'Action']
|
||||
));
|
||||
}
|
||||
@ -61,7 +62,7 @@ class ClientController extends \BaseController {
|
||||
'client' => null,
|
||||
'method' => 'POST',
|
||||
'url' => 'clients',
|
||||
'title' => 'New',
|
||||
'title' => '- New Client',
|
||||
'countries' => Country::orderBy('name')->get());
|
||||
|
||||
return View::make('clients.edit', $data);
|
||||
@ -88,7 +89,11 @@ class ClientController extends \BaseController {
|
||||
$client = Client::scope()->with('contacts')->findOrFail($id);
|
||||
trackViewed($client->name);
|
||||
|
||||
return View::make('clients.show')->with('client', $client);
|
||||
$data = array(
|
||||
'client' => $client,
|
||||
'title' => '- ' . $client->name);
|
||||
|
||||
return View::make('clients.show', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -104,7 +109,7 @@ class ClientController extends \BaseController {
|
||||
'client' => $client,
|
||||
'method' => 'PUT',
|
||||
'url' => 'clients/' . $id,
|
||||
'title' => 'Edit',
|
||||
'title' => '- ' . $client->name,
|
||||
'countries' => Country::orderBy('name')->get());
|
||||
return View::make('clients.edit', $data);
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ class CreditController extends \BaseController {
|
||||
{
|
||||
return View::make('list', array(
|
||||
'entityType'=>ENTITY_CREDIT,
|
||||
'title' => '- Credits',
|
||||
'columns'=>['checkbox', 'Credit Number', 'Client', 'Amount', 'Credit Date']
|
||||
));
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ class InvoiceController extends \BaseController {
|
||||
{
|
||||
return View::make('list', array(
|
||||
'entityType'=>ENTITY_INVOICE,
|
||||
'title' => '- Invoices',
|
||||
'columns'=>['checkbox', 'Invoice Number', 'Client', 'Total', 'Amount Due', 'Invoice Date', 'Due Date', 'Status', 'Action']
|
||||
));
|
||||
}
|
||||
@ -61,7 +62,8 @@ class InvoiceController extends \BaseController {
|
||||
|
||||
public function view($key)
|
||||
{
|
||||
$invitation = Invitation::with('user', 'invoice.account', 'invoice.invoice_items', 'invoice.client.account.account_gateways')->where('key', '=', $key)->firstOrFail();
|
||||
$invitation = Invitation::with('user', 'invoice.account', 'invoice.invoice_items', 'invoice.client.account.account_gateways')
|
||||
->where('key', '=', $key)->firstOrFail();
|
||||
|
||||
$user = $invitation->user;
|
||||
$invoice = $invitation->invoice;
|
||||
@ -216,9 +218,9 @@ class InvoiceController extends \BaseController {
|
||||
'invoice' => $invoice,
|
||||
'method' => 'PUT',
|
||||
'url' => 'invoices/' . $id,
|
||||
'title' => 'Edit',
|
||||
'title' => '- ' . $invoice->invoice_number,
|
||||
'account' => Auth::user()->account,
|
||||
'products' => Product::scope()->get(),
|
||||
'products' => Product::scope()->get(array('key','notes','cost','qty')),
|
||||
'client' => $invoice->client,
|
||||
'clients' => Client::scope()->orderBy('name')->get());
|
||||
return View::make('invoices.edit', $data);
|
||||
@ -240,11 +242,11 @@ class InvoiceController extends \BaseController {
|
||||
'invoiceNumber' => $invoiceNumber,
|
||||
'method' => 'POST',
|
||||
'url' => 'invoices',
|
||||
'title' => 'New',
|
||||
'title' => '- New Invoice',
|
||||
'client' => $client,
|
||||
'items' => json_decode(Input::old('items')),
|
||||
'account' => Auth::user()->account,
|
||||
'products' => Product::scope()->get(),
|
||||
'products' => Product::scope()->get(array('key','notes','cost','qty')),
|
||||
'clients' => Client::scope()->orderBy('name')->get());
|
||||
return View::make('invoices.edit', $data);
|
||||
}
|
||||
|
@ -4,7 +4,11 @@ class PaymentController extends \BaseController
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
return View::make('payments.index');
|
||||
return View::make('list', array(
|
||||
'entityType'=>ENTITY_PAYMENT,
|
||||
'title' => '- Payments',
|
||||
'columns'=>['checkbox', 'Transaction Reference', 'Client', 'Amount', 'Payment Date']
|
||||
));
|
||||
}
|
||||
|
||||
public function getDatatable($clientId = null)
|
||||
@ -18,24 +22,17 @@ class PaymentController extends \BaseController
|
||||
$table = Datatable::collection($collection->get());
|
||||
|
||||
if (!$clientId) {
|
||||
$table->addColumn('client', function($model)
|
||||
{
|
||||
return link_to('clients/' . $model->invoice->client->id, $model->invoice->client->name);
|
||||
});
|
||||
$table->addColumn('checkbox', function($model) { return '<input type="checkbox" name="ids[]" value="' . $model->id . '">'; });
|
||||
}
|
||||
|
||||
return $table->addColumn('invoice', function($model)
|
||||
{
|
||||
return link_to('invoices/' . $model->invoice->id . '/edit', $model->invoice->number);
|
||||
})
|
||||
->addColumn('amount', function($model)
|
||||
{
|
||||
return '$' . $model->amount;
|
||||
})
|
||||
->addColumn('date', function($model)
|
||||
{
|
||||
return $model->created_at->format('m/d/y h:i a');
|
||||
})
|
||||
$table->addColumn('transaction_reference', function($model) { return $model->transaction_reference; });
|
||||
|
||||
if (!$clientId) {
|
||||
$table->addColumn('client', function($model) { return link_to('clients/' . $model->client->id, $model->client->name); });
|
||||
}
|
||||
|
||||
return $table->addColumn('amount', function($model) { return '$' . $model->amount; })
|
||||
->addColumn('date', function($model) { return timestampToDateTimeString($model->created_at); })
|
||||
->orderColumns('client')
|
||||
->make();
|
||||
}
|
||||
|
@ -219,9 +219,14 @@ class UserController extends BaseController {
|
||||
*/
|
||||
public function logout()
|
||||
{
|
||||
Confide::logout();
|
||||
|
||||
return Redirect::to('/');
|
||||
}
|
||||
if (!Auth::user()->registered)
|
||||
{
|
||||
$account = Auth::user()->account;
|
||||
$account->forceDelete();
|
||||
}
|
||||
|
||||
Confide::logout();
|
||||
|
||||
return Redirect::to('/')->with('clearGuestKey', true);
|
||||
}
|
||||
}
|
||||
|
@ -212,7 +212,7 @@ class ConfideSetupUsersTable extends Migration {
|
||||
$t->timestamp('viewed_date');
|
||||
|
||||
$t->foreign('user_id')->references('id')->on('users');
|
||||
$t->foreign('contact_id')->references('id')->on('contacts');
|
||||
$t->foreign('contact_id')->references('id')->on('contacts')->onDelete('cascade');
|
||||
$t->foreign('invoice_id')->references('id')->on('invoices')->onDelete('cascade');
|
||||
});
|
||||
|
||||
|
@ -3,6 +3,7 @@
|
||||
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,6 +2,8 @@
|
||||
|
||||
class AccountGateway extends Eloquent
|
||||
{
|
||||
protected $hidden = array('config');
|
||||
|
||||
public function gateway()
|
||||
{
|
||||
return $this->belongsTo('Gateway');
|
||||
|
@ -3,7 +3,8 @@
|
||||
class Client extends Eloquent implements iEntity
|
||||
{
|
||||
protected $softDelete = true;
|
||||
|
||||
protected $hidden = array('created_at', 'updated_at', 'deleted_at', 'notes', 'last_login');
|
||||
|
||||
public static $fieldName = 'Client - Name';
|
||||
public static $fieldPhone = 'Client - Phone';
|
||||
public static $fieldAddress1 = 'Client - Street';
|
||||
|
@ -3,6 +3,7 @@
|
||||
class Invitation extends Eloquent
|
||||
{
|
||||
protected $softDelete = true;
|
||||
protected $hidden = array('created_at', 'updated_at', 'deleted_at');
|
||||
|
||||
public function scopeScope($query)
|
||||
{
|
||||
|
@ -3,6 +3,7 @@
|
||||
class Invoice extends Eloquent implements iEntity
|
||||
{
|
||||
protected $softDelete = true;
|
||||
protected $hidden = array('created_at', 'updated_at', 'deleted_at', 'viewed_date', 'key');
|
||||
|
||||
public function scopeScope($query)
|
||||
{
|
||||
|
@ -3,6 +3,7 @@
|
||||
class InvoiceItem extends Eloquent
|
||||
{
|
||||
protected $softDelete = true;
|
||||
protected $hidden = array('created_at', 'updated_at', 'deleted_at');
|
||||
|
||||
public function invoice()
|
||||
{
|
||||
|
@ -8,6 +8,7 @@ class User extends ConfideUser implements UserInterface, RemindableInterface, iP
|
||||
{
|
||||
|
||||
protected $softDelete = true;
|
||||
protected $hidden = array('created_at', 'updated_at', 'deleted_at', 'password', 'confirmation_code', 'registered', 'confirmed');
|
||||
|
||||
public static $rules = array(
|
||||
/*
|
||||
@ -25,13 +26,6 @@ class User extends ConfideUser implements UserInterface, RemindableInterface, iP
|
||||
*/
|
||||
protected $table = 'users';
|
||||
|
||||
/**
|
||||
* The attributes excluded from the model's JSON form.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $hidden = array('password');
|
||||
|
||||
public function account()
|
||||
{
|
||||
return $this->belongsTo('Account');
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
</style>
|
||||
|
||||
{{ Former::open_for_files()->addClass('col-md-9 col-md-offset-1')->rules(array(
|
||||
{{ Former::open_for_files()->addClass('col-md-10 col-md-offset-1')->rules(array(
|
||||
'name' => 'required',
|
||||
'email' => 'email|required'
|
||||
)); }}
|
||||
@ -58,7 +58,10 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{ Former::actions( Button::lg_primary_submit('Save') ) }}
|
||||
<center>
|
||||
{{ Button::lg_primary_submit('Save') }}
|
||||
</center>
|
||||
|
||||
{{ Former::close() }}
|
||||
|
||||
<script type="text/javascript">
|
||||
|
@ -3,7 +3,7 @@
|
||||
@section('content')
|
||||
@parent
|
||||
|
||||
{{ Former::open()->addClass('col-md-9 col-md-offset-1') }}
|
||||
{{ Former::open()->addClass('col-md-10 col-md-offset-1') }}
|
||||
{{ Former::legend('Payment Gateway') }}
|
||||
|
||||
@if ($accountGateway)
|
||||
|
@ -5,12 +5,11 @@
|
||||
$('input#name').focus();
|
||||
@stop
|
||||
|
||||
|
||||
@section('content')
|
||||
|
||||
<!--<h3>{{ $title }} Client</h3>-->
|
||||
|
||||
{{ Former::open($url)->addClass('col-md-9 col-md-offset-1 main_form')->method($method)->rules(array(
|
||||
{{ Former::open($url)->addClass('col-md-10 col-md-offset-1 main_form')->method($method)->rules(array(
|
||||
'name' => 'required',
|
||||
'email' => 'email'
|
||||
)); }}
|
||||
@ -71,7 +70,11 @@
|
||||
|
||||
{{ Former::hidden('data')->data_bind("value: ko.toJSON(model)") }}
|
||||
|
||||
{{ Former::actions( Button::lg_primary_submit('Save') ) }}
|
||||
<center style="margin-top:16px">
|
||||
{{ Button::lg_primary_submit('Save') }} |
|
||||
{{ link_to('clients/' . ($client ? $client->id : ''), 'Cancel') }}
|
||||
</center>
|
||||
|
||||
{{ Former::close() }}
|
||||
|
||||
<script type="text/javascript">
|
||||
|
@ -8,7 +8,7 @@
|
||||
<meta name="author" content="">
|
||||
<meta name="csrf-token" content="<?= csrf_token() ?>">
|
||||
|
||||
<title>Invoice Ninja</title>
|
||||
<title>Invoice Ninja {{ isset($title) ? $title : '' }}</title>
|
||||
|
||||
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
|
||||
<!--[if lt IE 9]>
|
||||
@ -237,7 +237,7 @@
|
||||
@if (Auth::user()->registered)
|
||||
{{ Auth::user()->email }}
|
||||
@else
|
||||
{{ Button::sm_primary('Sign up', array('data-toggle'=>'modal', 'data-target'=>'#signUpModal')); }}
|
||||
{{ Button::sm_primary('Sign up', array('data-toggle'=>'modal', 'data-target'=>'#signUpModal')) }}
|
||||
@endif
|
||||
|
||||
<div class="btn-group">
|
||||
@ -245,12 +245,12 @@
|
||||
My Account <span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu" role="menu">
|
||||
<li>{{ link_to('account/details', 'Details'); }}</li>
|
||||
<li>{{ link_to('account/settings', 'Settings'); }}</li>
|
||||
<li>{{ link_to('account/import', 'Import'); }}</li>
|
||||
<li>{{ link_to('account/export', 'Export'); }}</li>
|
||||
<li>{{ link_to('account/details', 'Details') }}</li>
|
||||
<li>{{ link_to('account/settings', 'Settings') }}</li>
|
||||
<li>{{ link_to('account/import', 'Import') }}</li>
|
||||
<li>{{ link_to('account/export', 'Export') }}</li>
|
||||
<li class="divider"></li>
|
||||
<li><a href="#">Logout</a></li>
|
||||
<li>{{ link_to('#', 'Logout', array('onclick'=>'logout()')) }}</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
@ -352,6 +352,28 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="modal fade" id="logoutModal" tabindex="-1" role="dialog" aria-labelledby="logoutModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h4 class="modal-title" id="myModalLabel">Logout</h4>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<h3>Are you sure?</h3>
|
||||
<p>This will erase all of your data.</p>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer" id="signUpFooter">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
|
||||
<button type="button" class="btn btn-primary" onclick="logout(true)">Logout</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
|
||||
@ -398,7 +420,6 @@
|
||||
url: '{{ URL::to('signup/validate') }}',
|
||||
data: 'email=' + $('form.signUpForm #email').val() + '&path={{ Request::path() }}',
|
||||
success: function(result) {
|
||||
console.log(result)
|
||||
if (result == 'available') {
|
||||
$('.signUpForm').submit();
|
||||
} else {
|
||||
@ -421,27 +442,45 @@
|
||||
}
|
||||
@endif
|
||||
|
||||
function logout(force)
|
||||
{
|
||||
if (force || {{ Auth::user()->registered ? 'true' : 'false' }}) {
|
||||
window.location = '{{ URL::to('logout') }}';
|
||||
} else {
|
||||
$('#logoutModal').modal('show');
|
||||
}
|
||||
}
|
||||
|
||||
$(function() {
|
||||
|
||||
@if (Auth::user()->is_guest)
|
||||
if (isStorageSupported()) {
|
||||
localStorage.setItem('guest_key', '{{ Auth::user()->password }}');
|
||||
@if (!Auth::user()->registered)
|
||||
localStorage.setItem('guest_key', '{{ Auth::user()->password }}');
|
||||
@elseif (Session::get('clearGuestKey'))
|
||||
localStorage.setItem('guest_key', '');
|
||||
@endif
|
||||
}
|
||||
@endif
|
||||
|
||||
|
||||
@if (!Auth::user()->registered)
|
||||
validateSignUp();
|
||||
validateSignUp();
|
||||
|
||||
$('#signUpModal').on('shown.bs.modal', function () {
|
||||
$(['first_name','last_name','email','password']).each(function(i, field) {
|
||||
var $input = $('form.signUpForm #'+field);
|
||||
if (!$input.val()) {
|
||||
console.log('focus: %s', field);
|
||||
$input.focus();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
})
|
||||
$('#signUpModal').on('shown.bs.modal', function () {
|
||||
$(['first_name','last_name','email','password']).each(function(i, field) {
|
||||
var $input = $('form.signUpForm #'+field);
|
||||
if (!$input.val()) {
|
||||
$input.focus();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
/*
|
||||
$(window).on('beforeunload', function() {
|
||||
return true;
|
||||
});
|
||||
$('form').submit(function() { $(window).off('beforeunload') });
|
||||
$('a[rel!=ext]').click(function() { $(window).off('beforeunload') });
|
||||
*/
|
||||
@endif
|
||||
|
||||
@yield('onReady')
|
||||
|
@ -131,7 +131,7 @@
|
||||
{{ Button::normal('Download PDF', array('onclick' => 'onDownloadClick()')) }}
|
||||
@endif
|
||||
|
||||
{{ Button::primary('Save Invoice', array('onclick' => 'onSaveClick()')) }}
|
||||
{{ Button::primary_submit('Save Invoice', array('onclick' => 'onSaveClick()')) }}
|
||||
{{ Button::primary('Send Email', array('onclick' => 'onEmailClick()')) }}
|
||||
</div>
|
||||
<p> </p>
|
||||
@ -343,10 +343,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
function onSaveClick() {
|
||||
$('.main_form').submit();
|
||||
}
|
||||
|
||||
function onArchiveClick() {
|
||||
$('#action').val('archive');
|
||||
$('.main_form').submit();
|
||||
|
@ -1,9 +0,0 @@
|
||||
@extends('header')
|
||||
|
||||
@section('content')
|
||||
|
||||
<h3>View Invoice</h3>
|
||||
|
||||
{{ $invoice->number }} - {{ $invoice->client->name }}
|
||||
|
||||
@stop
|
@ -116,8 +116,13 @@
|
||||
}
|
||||
|
||||
if (isStorageSupported()) {
|
||||
$('[name="guest_key"]').val(localStorage.getItem('guest_key'));
|
||||
@if (Session::get('clearGuestKey'))
|
||||
localStorage.setItem('guest_key', '');
|
||||
@else
|
||||
$('[name="guest_key"]').val(localStorage.getItem('guest_key'));
|
||||
@endif
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
@ -171,19 +171,18 @@ function generatePDF(invoice) {
|
||||
}
|
||||
|
||||
function formatNumber(num) {
|
||||
if (!num) {
|
||||
return "";
|
||||
}
|
||||
return parseFloat(num).toFixed(2);
|
||||
num = parseFloat(num);
|
||||
if (!num) return '';
|
||||
var p = num.toFixed(2).split(".");
|
||||
return p[0].split("").reverse().reduce(function(acc, num, i, orig) {
|
||||
return num + (i && !(i % 3) ? "," : "") + acc;
|
||||
}, "") + "." + p[1];
|
||||
}
|
||||
|
||||
function formatMoney(num) {
|
||||
num = parseFloat(num);
|
||||
if (!num) return '$0.00';
|
||||
var p = num.toFixed(2).split(".");
|
||||
return "$" + p[0].split("").reverse().reduce(function(acc, num, i, orig) {
|
||||
return num + (i && !(i % 3) ? "," : "") + acc;
|
||||
}, "") + "." + p[1];
|
||||
return '$' + formatNumber(num);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user