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();
|
||||
|
||||
//$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);
|
||||
|
||||
foreach ($days as $day) {
|
||||
|
@ -53,7 +53,11 @@ class InvoiceReminder extends Command
|
||||
|
||||
$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);
|
||||
|
||||
foreach ($days as $day) {
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
namespace App\Http\ViewComposers;
|
||||
|
||||
use Auth;
|
||||
use Illuminate\View\View;
|
||||
use anlutro\LaravelSettings\Facade as Settingg;
|
||||
|
||||
@ -17,17 +16,16 @@ class Menu
|
||||
public function compose(View $view)
|
||||
{
|
||||
$customer = null;
|
||||
$company_id = session('company_id');
|
||||
$user = auth()->user();
|
||||
|
||||
// Get all companies
|
||||
$companies = Auth::user()->companies()->limit(10)->get()->sortBy('name');
|
||||
foreach ($companies as $com) {
|
||||
$companies = $user->companies()->enabled()->limit(10)->get()->each(function ($com) {
|
||||
$com->setSettings();
|
||||
}
|
||||
})->sortBy('name');
|
||||
|
||||
// Get customer
|
||||
if (Auth::user()->customer) {
|
||||
$customer = Auth::user();
|
||||
if ($user->customer) {
|
||||
$customer = $user;
|
||||
}
|
||||
|
||||
$view->with(['companies' => $companies, 'customer' => $customer]);
|
||||
|
@ -16,9 +16,19 @@ class Login
|
||||
*/
|
||||
public function handle(ILogin $event)
|
||||
{
|
||||
// Set company id
|
||||
$company = $event->user->companies()->first();
|
||||
// Get first company
|
||||
$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]);
|
||||
|
||||
// Save user login time
|
||||
|
@ -204,6 +204,18 @@ class Company extends Eloquent
|
||||
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
|
||||
*
|
||||
|
@ -13,14 +13,17 @@ return [
|
||||
'current_email' => 'Current Email',
|
||||
'reset' => 'Reset',
|
||||
'never' => 'never',
|
||||
|
||||
'password' => [
|
||||
'current' => 'Password',
|
||||
'current_confirm' => 'Password Confirmation',
|
||||
'new' => 'New Password',
|
||||
'new_confirm' => 'New Password Confirmation',
|
||||
],
|
||||
|
||||
'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.',
|
||||
|
@ -62,7 +62,9 @@
|
||||
<i class="fa fa-ellipsis-h"></i>
|
||||
</button>
|
||||
<ul class="dropdown-menu dropdown-menu-right">
|
||||
@if ($item->enabled)
|
||||
<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>
|
||||
@permission('delete-companies-companies')
|
||||
<li>{!! Form::deleteLink($item, 'companies/companies', '', 'company_name') !!}</li>
|
||||
|
Loading…
x
Reference in New Issue
Block a user