Bug fixes

This commit is contained in:
Hillel Coren 2014-04-06 12:02:04 +03:00
parent bd5472994b
commit 6710eba329
13 changed files with 156 additions and 58 deletions

View File

@ -39,18 +39,8 @@ class AccountController extends \BaseController {
if (!$user) if (!$user)
{ {
$account = new Account; $account = $this->accountRepo->create();
$account->ip = Request::getClientIp(); $user = $account->users()->first();
$account->account_key = str_random(RANDOM_KEY_LENGTH);
$account->save();
$random = str_random(RANDOM_KEY_LENGTH);
$user = new User;
$user->password = $random;
$user->password_confirmation = $random;
$user->username = $random;
$account->users()->save($user);
Session::forget(RECENTLY_VIEWED); Session::forget(RECENTLY_VIEWED);
} }

View File

@ -23,7 +23,9 @@ App::before(function($request)
if (Input::has('lang')) if (Input::has('lang'))
{ {
App::setLocale(Input::get('lang')); $locale = Input::get('lang');
Session::set(SESSION_LOCALE, $locale);
App::setLocale($locale);
} }
else if (Auth::check()) else if (Auth::check())
{ {

View File

@ -293,5 +293,16 @@ return array(
'remove_logo' => ':link to remove the Invoice Ninja logo by joining the pro plan', 'remove_logo' => ':link to remove the Invoice Ninja logo by joining the pro plan',
'remove_logo_link' => 'Click here', 'remove_logo_link' => 'Click here',
], ],
'logout' => 'Log Out',
'sign_up_to_save' => 'Sign up to save your work',
'agree_to_terms' =>'I agree to the Invoice Ninja :terms',
'terms_of_service' => 'Terms of Service',
'email_taken' => 'The email address is already regiestered',
'working' => 'Working',
'success' => 'Success',
'success_message' => 'You have succesfully registered. Please visit the link in the account confirmation email to verify your email address.',
'erase_data' => 'This will permanently erase your data.',
); );

View File

@ -294,4 +294,16 @@ return array(
'remove_logo_link' => 'Click here', 'remove_logo_link' => 'Click here',
], ],
'logout' => 'Log Out',
'sign_up_to_save' => 'Sign up to save your work',
'agree_to_terms' =>'I agree to the Invoice Ninja :terms',
'terms_of_service' => 'Terms of Service',
'email_taken' => 'The email address is already regiestered',
'working' => 'Working',
'success' => 'Success',
'success_message' => 'You have succesfully registered. Please visit the link in the account confirmation email to verify your email address.',
'erase_data' => 'This will permanently erase your data.',
); );

View File

@ -292,6 +292,17 @@ return array(
'remove_logo' => ':link to remove the Invoice Ninja logo by joining the pro plan', 'remove_logo' => ':link to remove the Invoice Ninja logo by joining the pro plan',
'remove_logo_link' => 'Click here', 'remove_logo_link' => 'Click here',
], ],
'logout' => 'Log Out',
'sign_up_to_save' => 'Sign up to save your work',
'agree_to_terms' =>'I agree to the Invoice Ninja :terms',
'terms_of_service' => 'Terms of Service',
'email_taken' => 'The email address is already regiestered',
'working' => 'Working',
'success' => 'Success',
'success_message' => 'You have succesfully registered. Please visit the link in the account confirmation email to verify your email address.',
'erase_data' => 'This will permanently erase your data.',
); );

View File

@ -293,6 +293,17 @@ return array(
'remove_logo' => ':link to remove the Invoice Ninja logo by joining the pro plan', 'remove_logo' => ':link to remove the Invoice Ninja logo by joining the pro plan',
'remove_logo_link' => 'Click here', 'remove_logo_link' => 'Click here',
], ],
'logout' => 'Log Out',
'sign_up_to_save' => 'Sign up to save your work',
'agree_to_terms' =>'I agree to the Invoice Ninja :terms',
'terms_of_service' => 'Terms of Service',
'email_taken' => 'The email address is already regiestered',
'working' => 'Working',
'success' => 'Success',
'success_message' => 'You have succesfully registered. Please visit the link in the account confirmation email to verify your email address.',
'erase_data' => 'This will permanently erase your data.',
); );

View File

@ -294,6 +294,17 @@ return array(
'remove_logo_link' => 'Click here', 'remove_logo_link' => 'Click here',
], ],
'logout' => 'Log Out',
'sign_up_to_save' => 'Sign up to save your work',
'agree_to_terms' =>'I agree to the Invoice Ninja :terms',
'terms_of_service' => 'Terms of Service',
'email_taken' => 'The email address is already regiestered',
'working' => 'Working',
'success' => 'Success',
'success_message' => 'You have succesfully registered. Please visit the link in the account confirmation email to verify your email address.',
'erase_data' => 'This will permanently erase your data.',
); );

View File

@ -294,4 +294,16 @@ return array(
'remove_logo_link' => 'Klik hier', 'remove_logo_link' => 'Klik hier',
], ],
'logout' => 'Log Out',
'sign_up_to_save' => 'Sign up to save your work',
'agree_to_terms' =>'I agree to the Invoice Ninja :terms',
'terms_of_service' => 'Terms of Service',
'email_taken' => 'The email address is already regiestered',
'working' => 'Working',
'success' => 'Success',
'success_message' => 'You have succesfully registered. Please visit the link in the account confirmation email to verify your email address.',
'erase_data' => 'This will permanently erase your data.',
); );

View File

@ -282,5 +282,16 @@ return array(
'remove_logo_link' => 'Click here', 'remove_logo_link' => 'Click here',
], ],
'logout' => 'Log Out',
'sign_up_to_save' => 'Sign up to save your work',
'agree_to_terms' =>'I agree to the Invoice Ninja :terms',
'terms_of_service' => 'Terms of Service',
'email_taken' => 'The email address is already regiestered',
'working' => 'Working',
'success' => 'Success',
'success_message' => 'You have succesfully registered. Please visit the link in the account confirmation email to verify your email address.',
'erase_data' => 'This will permanently erase your data.',
); );

View File

@ -2,9 +2,44 @@
use Client; use Client;
use Contact; use Contact;
use Account;
use Request;
use Session;
use Language;
use User;
class AccountRepository class AccountRepository
{ {
public function create()
{
$account = new Account;
$account->ip = Request::getClientIp();
$account->account_key = str_random(RANDOM_KEY_LENGTH);
if (Session::has(SESSION_LOCALE))
{
$locale = Session::get(SESSION_LOCALE);
$language = Language::whereLocale($locale)->first();
if ($language)
{
$account->language_id = $language->id;
}
}
$account->save();
$random = str_random(RANDOM_KEY_LENGTH);
$user = new User;
$user->password = $random;
$user->password_confirmation = $random;
$user->username = $random;
$account->users()->save($user);
return $account;
}
public function getSearchData() public function getSearchData()
{ {
$clients = \DB::table('clients') $clients = \DB::table('clients')

View File

@ -113,20 +113,13 @@ HTML::macro('menu_link', function($type) {
$Type = ucfirst($type); $Type = ucfirst($type);
$Types = ucfirst($types); $Types = ucfirst($types);
$class = ( Request::is($types) || Request::is('*'.$type.'*')) ? ' active' : ''; $class = ( Request::is($types) || Request::is('*'.$type.'*')) ? ' active' : '';
$str= '<li class="dropdown '.$class.'">
<a href="'.URL::to($types).'" class="dropdown-toggle">'.$Types.'</a> return '<li class="dropdown '.$class.'">
<ul class="dropdown-menu" id="menu1"> <a href="'.URL::to($types).'" class="dropdown-toggle">'.trans("texts.$types").'</a>
<li><a href="'.URL::to($types.'/create').'">New '.$Type.'</a></li>'; <ul class="dropdown-menu" id="menu1">
//<li><a href="'.URL::to($types).'">View '.$Types.'</a></li>'; <li><a href="'.URL::to($types.'/create').'">'.trans("texts.new_$type").'</a></li>
</ul>
/* </li>';
if ($Type == 'Invoice') {
$str .= '<li><a href="'.URL::to('recurring_invoices').'">Recurring Invoices</a></li>';
}
*/
return $str . '</ul>
</li>';
}); });
HTML::macro('image_data', function($imagePath) { HTML::macro('image_data', function($imagePath) {

View File

@ -108,11 +108,11 @@
<div class="navbar-form navbar-right"> <div class="navbar-form navbar-right">
@if (Auth::check() && !Auth::user()->registered) @if (Auth::check() && !Auth::user()->registered)
{{ Button::sm_success_primary('Sign up', array('id' => 'signUpButton', 'data-toggle'=>'modal', 'data-target'=>'#signUpModal')) }} &nbsp; {{ Button::sm_success_primary(trans('texts.sign_up'), array('id' => 'signUpButton', 'data-toggle'=>'modal', 'data-target'=>'#signUpModal')) }} &nbsp;
@if (Auth::check() && Auth::user()->showSignUpPopOver()) @if (Auth::check() && Auth::user()->showSignUpPopOver())
<button id="signUpPopOver" type="button" class="btn btn-default" data-toggle="popover" data-placement="bottom" data-content="Sign up to save your work" data-html="true" style="display:none"> <button id="signUpPopOver" type="button" class="btn btn-default" data-toggle="popover" data-placement="bottom" data-content="{{ trans('texts.sign_up_to_save') }}" data-html="true" style="display:none">
Sign Up {{ trans('texts.sign_up') }}
</button> </button>
<script> <script>
@ -133,19 +133,19 @@
@if (Auth::user()->registered) @if (Auth::user()->registered)
{{ Auth::user()->getFullName() }} {{ Auth::user()->getFullName() }}
@else @else
Guest {{ trans('texts.guest') }}
@endif @endif
</span> </span>
<span class="caret"></span> <span class="caret"></span>
</button> </button>
<ul class="dropdown-menu" role="menu"> <ul class="dropdown-menu" role="menu">
<li>{{ link_to('company/details', 'Company Details') }}</li> <li>{{ link_to('company/details', trans('texts.company_details')) }}</li>
<li>{{ link_to('company/payments', 'Online Payments') }}</li> <li>{{ link_to('company/payments', trans('texts.online_payments')) }}</li>
<li>{{ link_to('company/notifications', 'Notifications') }}</li> <li>{{ link_to('company/notifications', trans('texts.notifications')) }}</li>
<li>{{ link_to('company/import_export', 'Import/Export') }}</li> <li>{{ link_to('company/import_export', trans('texts.import_export')) }}</li>
<li class="divider"></li> <li class="divider"></li>
<li>{{ link_to('#', 'Logout', array('onclick'=>'logout()')) }}</li> <li>{{ link_to('#', trans('texts.logout'), array('onclick'=>'logout()')) }}</li>
</ul> </ul>
</div> </div>
</div> </div>
@ -242,7 +242,7 @@ Want something changed? We're {{ link_to('https://github.com/hillelcoren/invoice
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title" id="myModalLabel">Sign up</h4> <h4 class="modal-title" id="myModalLabel">{{ trans('texts.sign_up') }}</h4>
</div> </div>
<div style="background-color: #fff; padding-right:20px" id="signUpDiv" onkeyup="validateSignUp()" onclick="validateSignUp()" onkeydown="checkForEnter(event)"> <div style="background-color: #fff; padding-right:20px" id="signUpDiv" onkeyup="validateSignUp()" onclick="validateSignUp()" onkeydown="checkForEnter(event)">
@ -257,14 +257,14 @@ Want something changed? We're {{ link_to('https://github.com/hillelcoren/invoice
@endif @endif
{{ Former::hidden('path')->value(Request::path()) }} {{ Former::hidden('path')->value(Request::path()) }}
{{ Former::text('new_first_name')->label('First name') }} {{ Former::text('new_first_name')->label(trans('texts.first_name')) }}
{{ Former::text('new_last_name')->label('Last name') }} {{ Former::text('new_last_name')->label(trans('texts.last_name')) }}
{{ Former::text('new_email')->label('Email') }} {{ Former::text('new_email')->label(trans('texts.email')) }}
{{ Former::password('new_password')->label('Password') }} {{ Former::password('new_password')->label(trans('texts.password')) }}
{{ Former::checkbox('terms_checkbox')->label(' ')->text('I agree to the Invoice Ninja <a href="'.URL::to('terms').'" target="_blank">Terms of Service</a>') }} {{ Former::checkbox('terms_checkbox')->label(' ')->text(trans('texts.agree_to_terms').' <a href="'.URL::to('terms').'" target="_blank">'.trans('texts.terms_of_service').'</a>') }}
{{ Former::close() }} {{ Former::close() }}
<center><div id="errorTaken" style="display:none">&nbsp;<br/>The email address is already regiestered</div></center> <center><div id="errorTaken" style="display:none">&nbsp;<br/>{{ trans('texts.email_taken') }}</div></center>
<br/> <br/>
@ -273,7 +273,7 @@ Want something changed? We're {{ link_to('https://github.com/hillelcoren/invoice
</div> </div>
<div style="padding-left:40px;padding-right:40px;display:none;min-height:130px" id="working"> <div style="padding-left:40px;padding-right:40px;display:none;min-height:130px" id="working">
<h3>Working...</h3> <h3>{{ trans('texts.working') }}...</h3>
<div class="progress progress-striped active"> <div class="progress progress-striped active">
<div class="progress-bar" role="progressbar" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100" style="width: 100%"></div> <div class="progress-bar" role="progressbar" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100" style="width: 100%"></div>
</div> </div>
@ -281,15 +281,14 @@ Want something changed? We're {{ link_to('https://github.com/hillelcoren/invoice
<div style="background-color: #fff; padding-right:20px;padding-left:20px; display:none" id="signUpSuccessDiv"> <div style="background-color: #fff; padding-right:20px;padding-left:20px; display:none" id="signUpSuccessDiv">
<br/> <br/>
<h3>Success</h3> <h3>{{ trans('texts.success') }}</h3>
You have succesfully registered. Please visit the link in the account confirmation email to verify your email address. {{ trans('texts.success_message') }}<br/>&nbsp;
<br/>&nbsp;
</div> </div>
<div class="modal-footer" id="signUpFooter" style="margin-top: 0px"> <div class="modal-footer" id="signUpFooter" style="margin-top: 0px">
<button type="button" class="btn btn-default" data-dismiss="modal">Close <i class="glyphicon glyphicon-remove-circle"></i></button> <button type="button" class="btn btn-default" data-dismiss="modal">{{ trans('texts.cancel') }} <i class="glyphicon glyphicon-remove-circle"></i></button>
<button type="button" class="btn btn-primary" id="saveSignUpButton" onclick="validateServerSignUp()" disabled>Save <i class="glyphicon glyphicon-floppy-disk"></i></button> <button type="button" class="btn btn-primary" id="saveSignUpButton" onclick="validateServerSignUp()" disabled>{{ trans('texts.save') }} <i class="glyphicon glyphicon-floppy-disk"></i></button>
</div> </div>
</div> </div>
</div> </div>
@ -301,17 +300,17 @@ Want something changed? We're {{ link_to('https://github.com/hillelcoren/invoice
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title" id="myModalLabel">Logout</h4> <h4 class="modal-title" id="myModalLabel">{{ trans('texts.logout') }}</h4>
</div> </div>
<div class="container"> <div class="container">
<h3>Are you sure?</h3> <h3>{{ trans('texts.are_you_sure') }}</h3>
<p>This will permanently erase your data.</p> <p>{{ trans('texts.erase_data') }}</p>
</div> </div>
<div class="modal-footer" id="signUpFooter"> <div class="modal-footer" id="signUpFooter">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button> <button type="button" class="btn btn-default" data-dismiss="modal">{{ trans('texts.cancel') }}</button>
<button type="button" class="btn btn-primary" onclick="logout(true)">Logout</button> <button type="button" class="btn btn-primary" onclick="logout(true)">{{ trans('texts.logout') }}</button>
</div> </div>
</div> </div>
</div> </div>

View File

@ -91,7 +91,7 @@ function GetReportTemplate4(doc, invoice, layout, checkMath) {
doc.rect(left, top, width, height, 'FD'); doc.rect(left, top, width, height, 'FD');
doc.setFontType("bold"); doc.setFontType("bold");
doc.text(layout.footerLeft, y, 'Balance Due'); doc.text(layout.footerLeft, y, invoiceLabels.balance_due);
total = formatMoney(invoice.balance_amount, currencyId); total = formatMoney(invoice.balance_amount, currencyId);
var totalX = layout.headerRight - (doc.getStringUnitWidth(total) * doc.internal.getFontSize()); var totalX = layout.headerRight - (doc.getStringUnitWidth(total) * doc.internal.getFontSize());
@ -761,7 +761,7 @@ function GetReportTemplate1(doc, invoice, layout, checkMath)
doc.setFontSize(10); doc.setFontSize(10);
Msg='Balance Due'; Msg = invoiceLabels.balance_due;
var TmpMsgX = layout.unitCostRight-(doc.getStringUnitWidth(Msg) * doc.internal.getFontSize()); var TmpMsgX = layout.unitCostRight-(doc.getStringUnitWidth(Msg) * doc.internal.getFontSize());
doc.text(TmpMsgX, y, Msg); doc.text(TmpMsgX, y, Msg);
@ -936,7 +936,7 @@ function GetReportTemplate2(doc, invoice, layout, checkMath)
doc.setFontSize(12); doc.setFontSize(12);
x += doc.internal.getFontSize()*4; x += doc.internal.getFontSize()*4;
Msg='Balance Due'; Msg = invoiceLabels.balance_due;
var TmpMsgX = layout.unitCostRight-(doc.getStringUnitWidth(Msg) * doc.internal.getFontSize()); var TmpMsgX = layout.unitCostRight-(doc.getStringUnitWidth(Msg) * doc.internal.getFontSize());
@ -1172,7 +1172,7 @@ function GetReportTemplate3(doc, invoice, layout, checkMath)
SetPdfColor('White', doc); SetPdfColor('White', doc);
doc.setFontSize(12); doc.setFontSize(12);
var label='Balance Due'; var label = invoiceLabels.balance_due;
var labelX = layout.unitCostRight-(doc.getStringUnitWidth(label) * doc.internal.getFontSize()); var labelX = layout.unitCostRight-(doc.getStringUnitWidth(label) * doc.internal.getFontSize());
doc.text(labelX, y+2, label); doc.text(labelX, y+2, label);