mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Merge remote-tracking branch 'upstream/develop' into develop
This commit is contained in:
commit
e795ac28cd
@ -253,8 +253,7 @@ class AccountController extends BaseController
|
|||||||
|
|
||||||
public function getSearchData()
|
public function getSearchData()
|
||||||
{
|
{
|
||||||
$account = Auth::user()->account;
|
$data = $this->accountRepo->getSearchData(Auth::user());
|
||||||
$data = $this->accountRepo->getSearchData($account);
|
|
||||||
|
|
||||||
return Response::json($data);
|
return Response::json($data);
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ class TokenController extends BaseController
|
|||||||
|
|
||||||
public function getDatatable()
|
public function getDatatable()
|
||||||
{
|
{
|
||||||
return $this->tokenService->getDatatable(Auth::user()->account_id);
|
return $this->tokenService->getDatatable(Auth::user()->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function edit($publicId)
|
public function edit($publicId)
|
||||||
|
@ -34,7 +34,8 @@ class ApiCheck {
|
|||||||
// check for a valid token
|
// check for a valid token
|
||||||
$token = AccountToken::where('token', '=', Request::header('X-Ninja-Token'))->first(['id', 'user_id']);
|
$token = AccountToken::where('token', '=', Request::header('X-Ninja-Token'))->first(['id', 'user_id']);
|
||||||
|
|
||||||
if ($token) {
|
// check if user is archived
|
||||||
|
if ($token && $token->user) {
|
||||||
Auth::loginUsingId($token->user_id);
|
Auth::loginUsingId($token->user_id);
|
||||||
Session::set('token_id', $token->id);
|
Session::set('token_id', $token->id);
|
||||||
} else {
|
} else {
|
||||||
|
@ -110,9 +110,11 @@ Route::group(['middleware' => 'auth:user'], function() {
|
|||||||
Route::get('view_archive/{entity_type}/{visible}', 'AccountController@setTrashVisible');
|
Route::get('view_archive/{entity_type}/{visible}', 'AccountController@setTrashVisible');
|
||||||
Route::get('hide_message', 'HomeController@hideMessage');
|
Route::get('hide_message', 'HomeController@hideMessage');
|
||||||
Route::get('force_inline_pdf', 'UserController@forcePDFJS');
|
Route::get('force_inline_pdf', 'UserController@forcePDFJS');
|
||||||
|
Route::get('account/getSearchData', array('as' => 'getSearchData', 'uses' => 'AccountController@getSearchData'));
|
||||||
|
|
||||||
Route::get('settings/user_details', 'AccountController@showUserDetails');
|
Route::get('settings/user_details', 'AccountController@showUserDetails');
|
||||||
Route::post('settings/user_details', 'AccountController@saveUserDetails');
|
Route::post('settings/user_details', 'AccountController@saveUserDetails');
|
||||||
|
Route::post('users/change_password', 'UserController@changePassword');
|
||||||
|
|
||||||
Route::resource('clients', 'ClientController');
|
Route::resource('clients', 'ClientController');
|
||||||
Route::get('api/clients', array('as'=>'api.clients', 'uses'=>'ClientController@getDatatable'));
|
Route::get('api/clients', array('as'=>'api.clients', 'uses'=>'ClientController@getDatatable'));
|
||||||
@ -191,7 +193,6 @@ Route::group([
|
|||||||
Route::get('start_trial/{plan}', 'AccountController@startTrial')
|
Route::get('start_trial/{plan}', 'AccountController@startTrial')
|
||||||
->where(['plan'=>'pro']);
|
->where(['plan'=>'pro']);
|
||||||
Route::get('restore_user/{user_id}', 'UserController@restoreUser');
|
Route::get('restore_user/{user_id}', 'UserController@restoreUser');
|
||||||
Route::post('users/change_password', 'UserController@changePassword');
|
|
||||||
Route::get('/switch_account/{user_id}', 'UserController@switchAccount');
|
Route::get('/switch_account/{user_id}', 'UserController@switchAccount');
|
||||||
Route::get('/unlink_account/{user_account_id}/{user_id}', 'UserController@unlinkAccount');
|
Route::get('/unlink_account/{user_account_id}/{user_id}', 'UserController@unlinkAccount');
|
||||||
Route::get('/manage_companies', 'UserController@manageCompanies');
|
Route::get('/manage_companies', 'UserController@manageCompanies');
|
||||||
@ -220,11 +221,6 @@ Route::group([
|
|||||||
Route::get('settings/{section?}', 'AccountController@showSection');
|
Route::get('settings/{section?}', 'AccountController@showSection');
|
||||||
Route::post('settings/{section?}', 'AccountController@doSection');
|
Route::post('settings/{section?}', 'AccountController@doSection');
|
||||||
|
|
||||||
//Route::get('api/payment_terms', array('as'=>'api.payment_terms', 'uses'=>'PaymentTermController@getDatatable'));
|
|
||||||
//Route::resource('payment_terms', 'PaymentTermController');
|
|
||||||
//Route::post('payment_terms/bulk', 'PaymentTermController@bulk');
|
|
||||||
|
|
||||||
Route::get('account/getSearchData', array('as' => 'getSearchData', 'uses' => 'AccountController@getSearchData'));
|
|
||||||
Route::post('user/setTheme', 'UserController@setTheme');
|
Route::post('user/setTheme', 'UserController@setTheme');
|
||||||
Route::post('remove_logo', 'AccountController@removeLogo');
|
Route::post('remove_logo', 'AccountController@removeLogo');
|
||||||
Route::post('account/go_pro', 'AccountController@enableProPlan');
|
Route::post('account/go_pro', 'AccountController@enableProPlan');
|
||||||
@ -744,30 +740,6 @@ if (!defined('CONTACT_EMAIL')) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
// Log all SQL queries to laravel.log
|
|
||||||
if (Utils::isNinjaDev()) {
|
|
||||||
Event::listen('illuminate.query', function($query, $bindings, $time, $name) {
|
|
||||||
$data = compact('bindings', 'time', 'name');
|
|
||||||
|
|
||||||
// Format binding data for sql insertion
|
|
||||||
foreach ($bindings as $i => $binding) {
|
|
||||||
if ($binding instanceof \DateTime) {
|
|
||||||
$bindings[$i] = $binding->format('\'Y-m-d H:i:s\'');
|
|
||||||
} elseif (is_string($binding)) {
|
|
||||||
$bindings[$i] = "'$binding'";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Insert bindings into query
|
|
||||||
$query = str_replace(array('%', '?'), array('%%', '%s'), $query);
|
|
||||||
$query = vsprintf($query, $bindings);
|
|
||||||
|
|
||||||
Log::info($query, $data);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if (Utils::isNinjaDev())
|
if (Utils::isNinjaDev())
|
||||||
{
|
{
|
||||||
|
@ -140,7 +140,7 @@ class Utils
|
|||||||
|
|
||||||
public static function hasAllPermissions($permission)
|
public static function hasAllPermissions($permission)
|
||||||
{
|
{
|
||||||
return Auth::check() && Auth::user()->hasPermissions($permission);
|
return Auth::check() && Auth::user()->hasPermission($permission);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function isTrial()
|
public static function isTrial()
|
||||||
|
@ -16,4 +16,9 @@ class AccountToken extends EntityModel
|
|||||||
{
|
{
|
||||||
return $this->belongsTo('App\Models\Account');
|
return $this->belongsTo('App\Models\Account');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function user()
|
||||||
|
{
|
||||||
|
return $this->belongsTo('App\Models\User');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -75,17 +75,19 @@ class AccountRepository
|
|||||||
return $account;
|
return $account;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getSearchData($account)
|
public function getSearchData($user)
|
||||||
{
|
{
|
||||||
$data = $this->getAccountSearchData($account);
|
$data = $this->getAccountSearchData($user);
|
||||||
|
|
||||||
$data['navigation'] = $this->getNavigationSearchData();
|
$data['navigation'] = $user->is_admin ? $this->getNavigationSearchData() : [];
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getAccountSearchData($account)
|
private function getAccountSearchData($user)
|
||||||
{
|
{
|
||||||
|
$account = $user->account;
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'clients' => [],
|
'clients' => [],
|
||||||
'contacts' => [],
|
'contacts' => [],
|
||||||
@ -101,9 +103,17 @@ class AccountRepository
|
|||||||
$data[$account->custom_client_label2] = [];
|
$data[$account->custom_client_label2] = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
$clients = Client::scope()
|
if ($user->hasPermission('view_all')) {
|
||||||
->with('contacts', 'invoices')
|
$clients = Client::scope()
|
||||||
->get();
|
->with('contacts', 'invoices')
|
||||||
|
->get();
|
||||||
|
} else {
|
||||||
|
$clients = Client::scope()
|
||||||
|
->where('user_id', '=', $user->id)
|
||||||
|
->with(['contacts', 'invoices' => function($query) use ($user) {
|
||||||
|
$query->where('user_id', '=', $user->id);
|
||||||
|
}])->get();
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($clients as $client) {
|
foreach ($clients as $client) {
|
||||||
if ($client->name) {
|
if ($client->name) {
|
||||||
|
@ -13,10 +13,10 @@ class TokenRepository extends BaseRepository
|
|||||||
return 'App\Models\AccountToken';
|
return 'App\Models\AccountToken';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function find($accountId)
|
public function find($userId)
|
||||||
{
|
{
|
||||||
$query = DB::table('account_tokens')
|
$query = DB::table('account_tokens')
|
||||||
->where('account_tokens.account_id', '=', $accountId);
|
->where('account_tokens.user_id', '=', $userId);
|
||||||
|
|
||||||
if (!Session::get('show_trash:token')) {
|
if (!Session::get('show_trash:token')) {
|
||||||
$query->where('account_tokens.deleted_at', '=', null);
|
$query->where('account_tokens.deleted_at', '=', null);
|
||||||
|
@ -27,9 +27,9 @@ class TokenService extends BaseService
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public function getDatatable($accountId)
|
public function getDatatable($userId)
|
||||||
{
|
{
|
||||||
$query = $this->tokenRepo->find($accountId);
|
$query = $this->tokenRepo->find($userId);
|
||||||
|
|
||||||
return $this->createDatatable(ENTITY_TOKEN, $query, false);
|
return $this->createDatatable(ENTITY_TOKEN, $query, false);
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
<div class="pull-right">
|
<div class="pull-right">
|
||||||
{!! Button::primary(trans('texts.add_user'))->asLinkTo(URL::to('/users/create'))->appendIcon(Icon::create('plus-sign')) !!}
|
{!! Button::primary(trans('texts.add_user'))->asLinkTo(URL::to('/users/create'))->appendIcon(Icon::create('plus-sign')) !!}
|
||||||
</div>
|
</div>
|
||||||
@else
|
@elseif (Utils::isTrial())
|
||||||
<div class="alert alert-warning">{!! trans('texts.add_users_not_supported') !!}</div>
|
<div class="alert alert-warning">{!! trans('texts.add_users_not_supported') !!}</div>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
<table cellpadding="10" cellspacing="0" border="0" bgcolor="#2F2C2B" width="600" align="center" class="header">
|
<table cellpadding="10" cellspacing="0" border="0" bgcolor="#2F2C2B" width="600" align="center" class="header">
|
||||||
<tr>
|
<tr>
|
||||||
<td class="logo" style="border-collapse: collapse; vertical-align: middle; padding-left:34px; padding-top:20px; padding-bottom:12px" valign="middle">
|
<td class="logo" style="border-collapse: collapse; vertical-align: middle; padding-left:34px; padding-top:20px; padding-bottom:12px" valign="middle">
|
||||||
<img src="{{ $message->embed(asset('images/invoiceninja-logo.png')) }}" alt="github" />
|
<img src="{{ $message->embed(asset('images/invoiceninja-logo.png')) }}" alt="Invoice Ninja" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
@ -26,9 +26,9 @@
|
|||||||
|
|
||||||
@section('footer')
|
@section('footer')
|
||||||
<p style="color: #A7A6A6; font-size: 13px; line-height: 18px; margin: 0 0 7px; padding: 0;">
|
<p style="color: #A7A6A6; font-size: 13px; line-height: 18px; margin: 0 0 7px; padding: 0;">
|
||||||
<a href="{{ SOCIAL_LINK_FACEBOOK }}" style="color: #A7A6A6; text-decoration: none; font-weight: bold; font-size: 10px;"><img src="{{ $message->embed(asset('images/emails/icon-facebook.png')) }}" alt="facebook" /></a>
|
<a href="{{ SOCIAL_LINK_FACEBOOK }}" style="color: #A7A6A6; text-decoration: none; font-weight: bold; font-size: 10px;"><img src="{{ $message->embed(asset('images/emails/icon-facebook.png')) }}" alt="Facebook" /></a>
|
||||||
<a href="{{ SOCIAL_LINK_TWITTER }}" style="color: #A7A6A6; text-decoration: none; font-weight: bold; font-size: 10px;"><img src="{{ $message->embed(asset('images/emails/icon-twitter.png')) }}" alt="twitter" /></a>
|
<a href="{{ SOCIAL_LINK_TWITTER }}" style="color: #A7A6A6; text-decoration: none; font-weight: bold; font-size: 10px;"><img src="{{ $message->embed(asset('images/emails/icon-twitter.png')) }}" alt="Twitter" /></a>
|
||||||
<a href="{{ SOCIAL_LINK_GITHUB }}" style="color: #A7A6A6; text-decoration: none; font-weight: bold; font-size: 10px;"><img src="{{ $message->embed(asset('images/emails/icon-github.png')) }}" alt="github" /></a>
|
<a href="{{ SOCIAL_LINK_GITHUB }}" style="color: #A7A6A6; text-decoration: none; font-weight: bold; font-size: 10px;"><img src="{{ $message->embed(asset('images/emails/icon-github.png')) }}" alt="GitHub" /></a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p style="color: #A7A6A6; font-size: 13px; line-height: 18px; margin: 0 0 7px; padding: 0;">
|
<p style="color: #A7A6A6; font-size: 13px; line-height: 18px; margin: 0 0 7px; padding: 0;">
|
||||||
|
@ -12,6 +12,10 @@
|
|||||||
|
|
||||||
@if ($user)
|
@if ($user)
|
||||||
{!! Former::populate($user) !!}
|
{!! Former::populate($user) !!}
|
||||||
|
{{ Former::populateField('is_admin', intval($user->is_admin)) }}
|
||||||
|
{{ Former::populateField('permissions[create_all]', intval($user->hasPermission('create'))) }}
|
||||||
|
{{ Former::populateField('permissions[view_all]', intval($user->hasPermission('view_all'))) }}
|
||||||
|
{{ Former::populateField('permissions[edit_all]', intval($user->hasPermission('edit_all'))) }}
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
|
@ -114,8 +114,8 @@
|
|||||||
"columns": [
|
"columns": [
|
||||||
{
|
{
|
||||||
"image": "$accountLogo",
|
"image": "$accountLogo",
|
||||||
"fit": [120, 80],
|
"fit": [120, 60],
|
||||||
"margin": [30, 20, 0, 0]
|
"margin": [30, 16, 0, 0]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"stack": "$accountDetails",
|
"stack": "$accountDetails",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user