Merge branch 'master' of github.com:akaunting/akaunting
This commit is contained in:
commit
270e811150
@ -53,7 +53,11 @@ class BillReminder extends Command
|
|||||||
|
|
||||||
$company->setSettings();
|
$company->setSettings();
|
||||||
|
|
||||||
//$days = explode(',', setting('general.schedule_bill_days', '1,3'));
|
// Don't send reminders if disabled
|
||||||
|
if (!$company->send_bill_reminder) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$days = explode(',', $company->schedule_bill_days);
|
$days = explode(',', $company->schedule_bill_days);
|
||||||
|
|
||||||
foreach ($days as $day) {
|
foreach ($days as $day) {
|
||||||
|
@ -53,7 +53,11 @@ class InvoiceReminder extends Command
|
|||||||
|
|
||||||
$company->setSettings();
|
$company->setSettings();
|
||||||
|
|
||||||
//$days = explode(',', config('general.schedule_invoice_days', '1,3'));
|
// Don't send reminders if disabled
|
||||||
|
if (!$company->send_invoice_reminder) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$days = explode(',', $company->schedule_invoice_days);
|
$days = explode(',', $company->schedule_invoice_days);
|
||||||
|
|
||||||
foreach ($days as $day) {
|
foreach ($days as $day) {
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace App\Http\ViewComposers;
|
namespace App\Http\ViewComposers;
|
||||||
|
|
||||||
use Auth;
|
|
||||||
use Illuminate\View\View;
|
use Illuminate\View\View;
|
||||||
use anlutro\LaravelSettings\Facade as Settingg;
|
use anlutro\LaravelSettings\Facade as Settingg;
|
||||||
|
|
||||||
@ -17,17 +16,16 @@ class Menu
|
|||||||
public function compose(View $view)
|
public function compose(View $view)
|
||||||
{
|
{
|
||||||
$customer = null;
|
$customer = null;
|
||||||
$company_id = session('company_id');
|
$user = auth()->user();
|
||||||
|
|
||||||
// Get all companies
|
// Get all companies
|
||||||
$companies = Auth::user()->companies()->limit(10)->get()->sortBy('name');
|
$companies = $user->companies()->enabled()->limit(10)->get()->each(function ($com) {
|
||||||
foreach ($companies as $com) {
|
|
||||||
$com->setSettings();
|
$com->setSettings();
|
||||||
}
|
})->sortBy('name');
|
||||||
|
|
||||||
// Get customer
|
// Get customer
|
||||||
if (Auth::user()->customer) {
|
if ($user->customer) {
|
||||||
$customer = Auth::user();
|
$customer = $user;
|
||||||
}
|
}
|
||||||
|
|
||||||
$view->with(['companies' => $companies, 'customer' => $customer]);
|
$view->with(['companies' => $companies, 'customer' => $customer]);
|
||||||
|
@ -16,9 +16,19 @@ class Login
|
|||||||
*/
|
*/
|
||||||
public function handle(ILogin $event)
|
public function handle(ILogin $event)
|
||||||
{
|
{
|
||||||
// Set company id
|
// Get first company
|
||||||
$company = $event->user->companies()->first();
|
$company = $event->user->companies()->enabled()->first();
|
||||||
|
|
||||||
|
// Logout if no company assigned
|
||||||
|
if (!$company) {
|
||||||
|
auth()->logout();
|
||||||
|
|
||||||
|
flash(trans('auth.error.no_company'))->error();
|
||||||
|
|
||||||
|
return redirect('auth/login');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set company id
|
||||||
session(['company_id' => $company->id]);
|
session(['company_id' => $company->id]);
|
||||||
|
|
||||||
// Save user login time
|
// Save user login time
|
||||||
|
@ -204,6 +204,18 @@ class Company extends Eloquent
|
|||||||
return Auth::user()->companies()->filter($input)->sortable($sort)->paginate($limit);
|
return Auth::user()->companies()->filter($input)->sortable($sort)->paginate($limit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Scope to only include companies of a given enabled value.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Database\Eloquent\Builder $query
|
||||||
|
* @param mixed $value
|
||||||
|
* @return \Illuminate\Database\Eloquent\Builder
|
||||||
|
*/
|
||||||
|
public function scopeEnabled($query, $value = 1)
|
||||||
|
{
|
||||||
|
return $query->where('enabled', $value);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sort by company name
|
* Sort by company name
|
||||||
*
|
*
|
||||||
|
@ -13,14 +13,17 @@ return [
|
|||||||
'current_email' => 'Current Email',
|
'current_email' => 'Current Email',
|
||||||
'reset' => 'Reset',
|
'reset' => 'Reset',
|
||||||
'never' => 'never',
|
'never' => 'never',
|
||||||
|
|
||||||
'password' => [
|
'password' => [
|
||||||
'current' => 'Password',
|
'current' => 'Password',
|
||||||
'current_confirm' => 'Password Confirmation',
|
'current_confirm' => 'Password Confirmation',
|
||||||
'new' => 'New Password',
|
'new' => 'New Password',
|
||||||
'new_confirm' => 'New Password Confirmation',
|
'new_confirm' => 'New Password Confirmation',
|
||||||
],
|
],
|
||||||
|
|
||||||
'error' => [
|
'error' => [
|
||||||
'self_delete' => 'Error: Can not delete yourself!'
|
'self_delete' => 'Error: Can not delete yourself!',
|
||||||
|
'no_company' => 'Error: No company assigned to your account. Please, contact the system administrator.',
|
||||||
],
|
],
|
||||||
|
|
||||||
'failed' => 'These credentials do not match our records.',
|
'failed' => 'These credentials do not match our records.',
|
||||||
|
@ -62,7 +62,9 @@
|
|||||||
<i class="fa fa-ellipsis-h"></i>
|
<i class="fa fa-ellipsis-h"></i>
|
||||||
</button>
|
</button>
|
||||||
<ul class="dropdown-menu dropdown-menu-right">
|
<ul class="dropdown-menu dropdown-menu-right">
|
||||||
|
@if ($item->enabled)
|
||||||
<li><a href="{{ url('companies/companies/' . $item->id . '/set') }}">{{ trans('general.switch') }}</a></li>
|
<li><a href="{{ url('companies/companies/' . $item->id . '/set') }}">{{ trans('general.switch') }}</a></li>
|
||||||
|
@endif
|
||||||
<li><a href="{{ url('companies/companies/' . $item->id . '/edit') }}">{{ trans('general.edit') }}</a></li>
|
<li><a href="{{ url('companies/companies/' . $item->id . '/edit') }}">{{ trans('general.edit') }}</a></li>
|
||||||
@permission('delete-companies-companies')
|
@permission('delete-companies-companies')
|
||||||
<li>{!! Form::deleteLink($item, 'companies/companies', '', 'company_name') !!}</li>
|
<li>{!! Form::deleteLink($item, 'companies/companies', '', 'company_name') !!}</li>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user