bug fixes

This commit is contained in:
vagrant 2014-01-13 19:22:43 +00:00
parent 4731536311
commit 6375f3ae7a
15 changed files with 59 additions and 22 deletions

View File

@ -69,7 +69,7 @@ class SendRecurringInvoices extends Command {
{
$invitation = Invitation::createNew($recurInvitation);
$invitation->contact_id = $recurInvitation->contact_id;
$invitation->invitation_key = str_random(20);
$invitation->invitation_key = str_random(RANDOM_KEY_LENGTH);
$invoice->invitations()->save($invitation);
}

View File

@ -38,13 +38,14 @@ class AccountController extends \BaseController {
{
$account = new Account;
$account->ip = Request::getClientIp();
$account->account_key = str_random(20);
$account->account_key = str_random(RANDOM_KEY_LENGTH);
$account->save();
$random = str_random(20);
$random = str_random(RANDOM_KEY_LENGTH);
$user = new User;
$user->password = $random;
$user->password_confirmation = $random;
$account->users()->save($user);
Session::forget(RECENTLY_VIEWED);
@ -537,6 +538,7 @@ class AccountController extends \BaseController {
$user->last_name = trim(Input::get('new_last_name'));
$user->email = trim(Input::get('new_email'));
$user->password = trim(Input::get('new_password'));
$user->password_confirmation = trim(Input::get('new_password'));
$user->registered = true;
$user->save();

View File

@ -431,7 +431,7 @@ class InvoiceController extends \BaseController {
$invitation = Invitation::createNew();
$invitation->invoice_id = $invoice->id;
$invitation->contact_id = $contact->id;
$invitation->invitation_key = str_random(20);
$invitation->invitation_key = str_random(RANDOM_KEY_LENGTH);
$invitation->save();
}
else if (!in_array($contact->id, $sendInvoiceIds) && $invitation)

View File

@ -68,6 +68,7 @@ class PaymentController extends \BaseController
'url' => 'payments',
'title' => '- New Payment',
'currencies' => Currency::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(),
'paymentTypes' => PaymentType::remember(DEFAULT_QUERY_CACHE)->orderBy('id')->get(),
'clients' => Client::scope()->with('contacts')->orderBy('name')->get());
return View::make('payments.edit', $data);
@ -87,6 +88,7 @@ class PaymentController extends \BaseController
'url' => 'payments/' . $publicId,
'title' => '- Edit Payment',
'currencies' => Currency::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(),
'paymentTypes' => PaymentType::remember(DEFAULT_QUERY_CACHE)->orderBy('id')->get(),
'clients' => Client::scope()->with('contacts')->orderBy('name')->get());
return View::make('payments.edit', $data);
}

View File

@ -36,6 +36,7 @@ class ConfideSetupUsersTable extends Migration {
Schema::dropIfExists('sizes');
Schema::dropIfExists('industries');
Schema::dropIfExists('gateways');
Schema::dropIfExists('payment_types');
Schema::create('countries', function($table)
{
@ -61,6 +62,12 @@ class ConfideSetupUsersTable extends Migration {
$t->string('name');
});
Schema::create('payment_types', function($t)
{
$t->increments('id');
$t->string('name');
});
Schema::create('payment_terms', function($t)
{
$t->increments('id');
@ -433,6 +440,7 @@ class ConfideSetupUsersTable extends Migration {
$t->unsignedInteger('invitation_id')->nullable();
$t->unsignedInteger('user_id')->nullable();
$t->unsignedInteger('account_gateway_id')->nullable();
$t->unsignedInteger('payment_type_id')->nullable();
$t->unsignedInteger('currency_id')->default(1);
$t->timestamps();
$t->softDeletes();
@ -450,6 +458,7 @@ class ConfideSetupUsersTable extends Migration {
$t->foreign('account_gateway_id')->references('id')->on('account_gateways');
$t->foreign('user_id')->references('id')->on('users')->onDelete('cascade');;
$t->foreign('currency_id')->references('id')->on('currencies');
$t->foreign('payment_type_id')->references('id')->on('payment_types');
$t->unsignedInteger('public_id')->index();
$t->unique( array('account_id','public_id') );
@ -543,5 +552,6 @@ class ConfideSetupUsersTable extends Migration {
Schema::dropIfExists('sizes');
Schema::dropIfExists('industries');
Schema::dropIfExists('gateways');
Schema::dropIfExists('payment_types');
}
}

View File

@ -31,6 +31,11 @@ class ConstantsSeeder extends Seeder
$client->invoices()->save($invoice);
*/
PaymentType::create(array('name' => 'Visa'));
PaymentType::create(array('name' => 'MasterCard'));
PaymentType::create(array('name' => 'American Express'));
PaymentType::create(array('name' => 'Cash'));
Theme::create(array('name' => 'amelia'));
Theme::create(array('name' => 'cerulean'));
Theme::create(array('name' => 'cosmo'));

View File

@ -286,6 +286,12 @@ class Activity extends Eloquent
public static function viewInvoice($invitation)
{
if (Session::get($invitation->invitation_key))
{
return;
}
Session::put($invitation->invitation_key, true);
$invoice = $invitation->invoice;
if (!$invoice->isViewed())

7
app/models/PaymentType.php Executable file
View File

@ -0,0 +1,7 @@
<?php
class PaymentType extends Eloquent
{
public $timestamps = false;
protected $softDelete = false;
}

View File

@ -12,9 +12,9 @@ class User extends ConfideUser implements UserInterface, RemindableInterface
/*
'username' => 'required|email|unique:users',
'email' => 'required|email|unique:users',
'password' => 'required|between:4,20|confirmed',
'password_confirmation' => 'between:4,20',
*/
'password' => 'required|between:6,20|confirmed',
'password_confirmation' => 'between:6,20',
);
/**

View File

@ -11,7 +11,7 @@ class PaymentRepository
{
$query = \DB::table('payments')
->join('clients', 'clients.id', '=','payments.client_id')
->leftJoin('invoices', 'invoices.id', '=','payments.invoice_id')
->join('invoices', 'invoices.id', '=','payments.invoice_id')
->join('contacts', 'contacts.client_id', '=', 'clients.id')
->where('payments.account_id', '=', \Auth::user()->account_id)
->where('payments.deleted_at', '=', null)
@ -49,6 +49,7 @@ class PaymentRepository
$payment->client_id = Client::getPrivateId($input['client']);
$payment->invoice_id = isset($input['invoice']) && $input['invoice'] != "-1" ? Invoice::getPrivateId($input['invoice']) : null;
$payment->currency_id = $input['currency_id'] ? $input['currency_id'] : null;
$payment->payment_type_id = $input['payment_type_id'] ? $input['payment_type_id'] : null;
$payment->payment_date = Utils::toSqlDate($input['payment_date']);
$payment->amount = floatval($input['amount']);
$payment->save();

View File

@ -22,6 +22,7 @@
//Log::error('test');
/*
Event::listen('illuminate.query', function($query, $bindings, $time, $name)
{
$data = compact('bindings', 'time', 'name');
@ -45,17 +46,9 @@ Event::listen('illuminate.query', function($query, $bindings, $time, $name)
Log::info($query, $data);
});
/*
Route::get('/test', function() {
foreach (Invoice::all() as $invoice) {
echo $invoice->id . ' ' . $invoice->shouldSendToday() . '<br/>';
}
dd(true);
});
*/
/*
// TODO_FIX replace with cron
Route::get('/send_emails', function() {
@ -190,6 +183,7 @@ define('ACCOUNT_EXPORT', 'export');
define('DEFAULT_INVOICE_NUMBER', '0001');
define('RECENTLY_VIEWED_LIMIT', 8);
define('LOGGED_ERROR_LIMIT', 100);
define('RANDOM_KEY_LENGTH', 32);
define('INVOICE_STATUS_DRAFT', 1);
define('INVOICE_STATUS_SENT', 2);

View File

@ -189,7 +189,8 @@
<h4 class="modal-title" id="myModalLabel">Sign up</h4>
</div>
<div style="padding-right:20px" id="signUpDiv" onkeyup="validateSignUp()" onkeydown="checkForEnter(event)">
<div style="background-color: #EEEEEE; padding-right:20px" id="signUpDiv" onkeyup="validateSignUp()" onkeydown="checkForEnter(event)">
<br/>
{{ Former::open('signup/submit')->addClass('signUpForm') }}
@ -205,6 +206,7 @@
{{ Former::password('new_password')->label('Password') }}
{{ Former::close() }}
<center><div id="errorTaken" style="display:none">&nbsp;<br/>The email address is already regiestered</div></center>
<br/>
</div>
<div style="padding-left:40px;padding-right:40px;display:none;min-height:130px" id="working">
@ -214,7 +216,7 @@
</div>
</div>
<div class="modal-footer" id="signUpFooter">
<div class="modal-footer" id="signUpFooter" style="margin-top: 0px">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary" onclick="submitSignUp()">Save</button>
</div>

View File

@ -406,11 +406,13 @@
</div>
<div style="background-color: #EEEEEE; padding-left: 16px; padding-right: 16px">
<br/>
@if (Auth::user()->registered)
<p>Please confirm your account to email an invoice.</p>
Please confirm your account to email an invoice.
@else
<p>Please sign up to email an invoice.</p>
Please sign up to email an invoice.
@endif
<br/>&nbsp;
</div>
<div class="modal-footer" style="margin-top: 0px">

View File

@ -26,6 +26,8 @@
{{ Former::select('client')->addOption('', '')->addGroupClass('client-select') }}
{{ Former::select('invoice')->addOption('', '')->addGroupClass('invoice-select') }}
{{ Former::text('amount') }}
{{ Former::select('payment_type_id')->addOption('','')->label('Payment type')
->fromQuery($paymentTypes, 'name', 'id') }}
{{ Former::text('payment_date')->data_date_format(Session::get(SESSION_DATE_PICKER_FORMAT)) }}
{{ Former::select('currency_id')->addOption('','')->label('Currency')
->fromQuery($currencies, 'name', 'id')->select(Session::get(SESSION_CURRENCY, DEFAULT_CURRENCY)) }}

View File

@ -50,7 +50,11 @@
@section('body')
<div class="container">
{{ Former::open('user/reset')->addClass('form-signin') }}
{{ Former::open('user/reset')->addClass('form-signin')->rules(array(
'password' => 'required',
'password_confirmation' => 'required',
)); }}
<h2 class="form-signin-heading">Passord Reset</h2>
<input type="hidden" name="token" value="{{{ $token }}}">