Bug fixes

This commit is contained in:
Hillel Coren 2014-03-23 11:30:48 +02:00
parent 45a8689bf0
commit 308a75099a
8 changed files with 70 additions and 14 deletions

View File

@ -6,6 +6,8 @@
Most online invoicing sites are expensive. They shouldn't be. The aim of this project is to provide a free, open-source alternative. Additionally, the hope is the codebase will serve as a sample site for Laravel as well as other JavaScript technologies.
For discussion of the code please use the [Google Group](https://groups.google.com/d/forum/invoiceninja).
For updates follow [@invoiceninja](https://twitter.com/invoiceninja) or join the [Facebook Group](https://www.facebook.com/invoiceninja)
Site design by [kantorp-wegl.in](http://kantorp-wegl.in/)

View File

@ -461,7 +461,7 @@ class AccountController extends \BaseController {
else
{
$account = Account::findOrFail(Auth::user()->account_id);
$account->account_gateways()->forceDelete();
$account->account_gateways()->delete();
if ($gatewayId)
{

View File

@ -20,6 +20,17 @@ class UserController extends BaseController {
return Redirect::to(Input::get('path'));
}
public function forcePDFJS()
{
$user = Auth::user();
$user->force_pdfjs = true;
$user->save();
Session::flash('message', 'Successfully updated PDF settings');
return Redirect::to('/invoices/create');
}
/**
* Displays the form for account creation
*
@ -110,18 +121,18 @@ class UserController extends BaseController {
// with the second parameter as true.
// logAttempt will check if the 'email' perhaps is the username.
// Get the value from the config file instead of changing the controller
if ( Confide::logAttempt( $input, false ) )
if ( Input::get( 'login_email' ) && Confide::logAttempt( $input, false ) )
{
Event::fire('user.login');
// Redirect the user to the URL they were trying to access before
// caught by the authentication filter IE Redirect::guest('user/login').
// Otherwise fallback to '/'
// Fix pull #145
return Redirect::intended('/clients'); // change it to '/admin', '/dashboard' or something
return Redirect::intended('/dashboard'); // change it to '/admin', '/dashboard' or something
}
else
{
$user = new User;
//$user = new User;
// Check if there was too many login attempts
if( Confide::isThrottled( $input ) )

View File

@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class EnableForcingJspdf extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function($table)
{
$table->boolean('force_pdfjs')->default(false);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('users', function($table)
{
$table->dropColumn('force_pdfjs');
});
}
}

View File

@ -96,13 +96,13 @@ class Activity extends Eloquent
public static function createInvoice($invoice)
{
if ($invoice->is_recurring)
if (Auth::check())
{
$message = Utils::encodeActivity(null, 'created recurring', $invoice);
$message = Utils::encodeActivity(Auth::user(), 'created', $invoice);
}
else
{
$message = Utils::encodeActivity(Auth::user(), 'created', $invoice);
$message = Utils::encodeActivity(null, 'created', $invoice);
}
$client = $invoice->client;

View File

@ -1,5 +1,7 @@
<?php
/*
|--------------------------------------------------------------------------
| Application Routes
@ -22,7 +24,6 @@
//dd(gethostname());
//Log::error('test');
Route::get('/', 'HomeController@showWelcome');
Route::get('/rocksteady', 'HomeController@showWelcome');
Route::get('/about', 'HomeController@showAboutUs');
@ -56,6 +57,7 @@ Route::group(array('before' => 'auth'), function()
{
Route::get('dashboard', 'DashboardController@index');
Route::get('view_archive/{entity_type}/{visible}', 'AccountController@setTrashVisible');
Route::get('force_inline_pdf', 'UserController@forcePDFJS');
Route::get('account/getSearchData', array('as' => 'getSearchData', 'uses' => 'AccountController@getSearchData'));
Route::get('company/{section?}', 'AccountController@showSection');
@ -282,3 +284,10 @@ Event::listen('illuminate.query', function($query, $bindings, $time, $name)
Log::info($query, $data);
});
*/
/*
if (Auth::check() && Auth::user()->id === 1)
{
Auth::loginUsingId(1);
}
*/

View File

@ -388,10 +388,10 @@
$.ajax({
type: 'POST',
url: '{{ URL::to('signup/submit') }}',
data: 'new_email=' + $('form.signUpForm #new_email').val() +
'&new_password=' + $('form.signUpForm #new_password').val() +
'&new_first_name=' + $('form.signUpForm #new_first_name').val() +
'&new_last_name=' + $('form.signUpForm #new_last_name').val(),
data: 'new_email=' + encodeURIComponent($('form.signUpForm #new_email').val()) +
'&new_password=' + encodeURIComponent($('form.signUpForm #new_password').val()) +
'&new_first_name=' + encodeURIComponent($('form.signUpForm #new_first_name').val()) +
'&new_last_name=' + encodeURIComponent($('form.signUpForm #new_last_name').val()),
success: function(result) {
if (result) {
localStorage.setItem('guest_key', '');

View File

@ -623,7 +623,7 @@
return doc.output('datauristring');
}
function refreshPDF() {
if (isFirefox || (isChrome && !isChromium)) {
if ({{ Auth::user()->force_pdfjs ? 'false' : 'true' }} && (isFirefox || (isChrome && !isChromium))) {
var string = getPDFString();
$('#theFrame').attr('src', string).show();
} else {