Merge branch 'master' of github.com:akaunting/akaunting into 2.1-dev

This commit is contained in:
denisdulici 2020-05-08 16:36:04 +03:00
commit 534bef0ae4
23 changed files with 84 additions and 41 deletions

View File

@ -23,11 +23,11 @@ class Kernel extends ConsoleKernel
protected function schedule(Schedule $schedule) protected function schedule(Schedule $schedule)
{ {
// Not installed yet // Not installed yet
if (!env('APP_INSTALLED')) { if (!config('app.installed')) {
return; return;
} }
$schedule_time = env('APP_SCHEDULE_TIME', '09:00'); $schedule_time = config('app.schedule_time');
$schedule->command('reminder:invoice')->dailyAt($schedule_time); $schedule->command('reminder:invoice')->dailyAt($schedule_time);
$schedule->command('reminder:bill')->dailyAt($schedule_time); $schedule->command('reminder:bill')->dailyAt($schedule_time);

View File

@ -54,7 +54,7 @@ class Handler extends ExceptionHandler
*/ */
public function render($request, Throwable $exception) public function render($request, Throwable $exception)
{ {
if (env('APP_DEBUG') === false) { if (config('app.debug') === false) {
return $this->handleExceptions($request, $exception); return $this->handleExceptions($request, $exception);
} }

View File

@ -115,7 +115,7 @@ class Login extends Controller
auth()->logout(); auth()->logout();
// Session destroy is required if stored in database // Session destroy is required if stored in database
if (env('SESSION_DRIVER') == 'database') { if (config('session.driver') == 'database') {
$request = app('Illuminate\Http\Request'); $request = app('Illuminate\Http\Request');
$request->session()->getHandler()->destroy($request->session()->getId()); $request->session()->getHandler()->destroy($request->session()->getId());
} }

View File

@ -27,8 +27,10 @@ class Database extends Controller
*/ */
public function store(Request $request) public function store(Request $request)
{ {
$connection = config('database.default','mysql');
$host = $request['hostname']; $host = $request['hostname'];
$port = env('DB_PORT', '3306'); $port = config("database.connections.$connection.port", '3306');
$database = $request['database']; $database = $request['database'];
$username = $request['username']; $username = $request['username'];
$password = $request['password']; $password = $request['password'];

View File

@ -84,19 +84,19 @@ class Item extends Controller
// Download // Download
$steps[] = [ $steps[] = [
'text' => trans('modules.installation.download', ['module' => $name]), 'text' => trans('modules.installation.download', ['module' => $name]),
'url' => url('apps/download') 'url' => route('apps.download')
]; ];
// Unzip // Unzip
$steps[] = [ $steps[] = [
'text' => trans('modules.installation.unzip', ['module' => $name]), 'text' => trans('modules.installation.unzip', ['module' => $name]),
'url' => url('apps/unzip') 'url' => route('apps.unzip')
]; ];
// Download // Download
$steps[] = [ $steps[] = [
'text' => trans('modules.installation.install', ['module' => $name]), 'text' => trans('modules.installation.install', ['module' => $name]),
'url' => url('apps/install') 'url' => route('apps.install')
]; ];
return response()->json([ return response()->json([

View File

@ -19,7 +19,7 @@ class Notifications
public function compose(View $view) public function compose(View $view)
{ {
// No need to add suggestions in console // No need to add suggestions in console
if (app()->runningInConsole() || !env('APP_INSTALLED') || !user()) { if (app()->runningInConsole() || !config('app.installed') || !user()) {
return; return;
} }

View File

@ -20,7 +20,7 @@ class Suggestions
public function compose(View $view) public function compose(View $view)
{ {
// No need to add suggestions in console // No need to add suggestions in console
if (app()->runningInConsole() || !env('APP_INSTALLED')) { if (app()->runningInConsole() || !config('app.installed')) {
return; return;
} }
@ -31,10 +31,10 @@ class Suggestions
if ($path) { if ($path) {
$suggestions = $this->getSuggestions($path); $suggestions = $this->getSuggestions($path);
if ($suggestions) { if ($suggestions) {
$suggestion_modules = $suggestions->modules; $suggestion_modules = $suggestions->modules;
foreach ($suggestion_modules as $key => $module) { foreach ($suggestion_modules as $key => $module) {
$installed = Module::where('company_id', session('company_id'))->where('alias', $module->alias)->first(); $installed = Module::where('company_id', session('company_id'))->where('alias', $module->alias)->first();

View File

@ -26,7 +26,7 @@ class Version207 extends Listener
// Update .env file // Update .env file
Installer::updateEnv([ Installer::updateEnv([
'MAIL_MAILER' => env('MAIL_DRIVER'), 'MAIL_MAILER' => env('MAIL_DRIVER', config('mail.default')),
]); ]);
} }
} }

View File

@ -31,11 +31,11 @@ class App extends Provider
*/ */
public function register() public function register()
{ {
if (env('APP_INSTALLED') && env('APP_DEBUG')) { if (config('app.installed') && config('app.debug')) {
$this->app->register(\Barryvdh\Debugbar\ServiceProvider::class); $this->app->register(\Barryvdh\Debugbar\ServiceProvider::class);
} }
if (env('APP_ENV') !== 'production') { if (config('app.env') !== 'production') {
$this->app->register(\Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class); $this->app->register(\Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class);
} }
} }

View File

@ -17,7 +17,7 @@ trait DateTime
$default = 'd M Y'; $default = 'd M Y';
// Make sure it's installed // Make sure it's installed
if (!env('APP_INSTALLED') && (env('APP_ENV') !== 'testing')) { if (!config('app.installed') && (config('app.env') !== 'testing')) {
return $default; return $default;
} }

View File

@ -293,11 +293,20 @@ trait Modules
public function downloadModule($path) public function downloadModule($path)
{ {
if (empty($path)) {
return [
'success' => false,
'error' => true,
'message' => trans('modules.errors.download', ['module' => '']),
'data' => null,
];
}
if (!$response = static::getResponse('GET', $path)) { if (!$response = static::getResponse('GET', $path)) {
return [ return [
'success' => false, 'success' => false,
'error' => true, 'error' => true,
'message' => null, 'message' => trans('modules.errors.download', ['module' => '']),
'data' => null, 'data' => null,
]; ];
} }
@ -321,7 +330,7 @@ trait Modules
return [ return [
'success' => false, 'success' => false,
'error' => true, 'error' => true,
'message' => null, 'message' => trans('modules.errors.download', ['module' => '']),
'data' => null, 'data' => null,
]; ];
} }
@ -338,6 +347,15 @@ trait Modules
public function unzipModule($path) public function unzipModule($path)
{ {
if (empty($path)) {
return [
'success' => false,
'error' => true,
'message' => trans('modules.errors.unzip', ['module' => '']),
'data' => null,
];
}
$temp_path = storage_path('app/temp') . '/' . $path; $temp_path = storage_path('app/temp') . '/' . $path;
$file = $temp_path . '/upload.zip'; $file = $temp_path . '/upload.zip';
@ -349,7 +367,7 @@ trait Modules
return [ return [
'success' => false, 'success' => false,
'error' => true, 'error' => true,
'message' => null, 'message' => trans('modules.errors.unzip', ['module' => '']),
'data' => null, 'data' => null,
]; ];
} }
@ -373,9 +391,18 @@ trait Modules
public function installModule($path) public function installModule($path)
{ {
if (empty($path)) {
return [
'success' => false,
'error' => true,
'message' => trans('modules.errors.finish', ['module' => '']),
'data' => null,
];
}
$temp_path = storage_path('app/temp') . '/' . $path; $temp_path = storage_path('app/temp') . '/' . $path;
$modules_path = base_path() . '/modules'; $modules_path = config('module.paths.modules');
// Create modules directory // Create modules directory
if (!File::isDirectory($modules_path)) { if (!File::isDirectory($modules_path)) {
@ -406,11 +433,22 @@ trait Modules
Cache::forget('installed.' . $company_id . '.module'); Cache::forget('installed.' . $company_id . '.module');
Console::run("module:install {$module->alias} {$company_id} {$locale}"); $command = "module:install {$module->alias} {$company_id} {$locale}";
if (true !== $result = Console::run($command)) {
$message = !empty($result) ? $result : trans('modules.errors.finish', ['module' => $module->alias]);
return [
'success' => false,
'error' => true,
'message' => $message,
'data' => null,
];
}
return [ return [
'success' => true, 'success' => true,
'redirect' => url('apps/' . $module->alias), 'redirect' => route('apps.app.show', $module->alias),
'error' => false, 'error' => false,
'message' => null, 'message' => null,
'data' => $data, 'data' => $data,

View File

@ -33,7 +33,7 @@ class Info
public static function mysqlVersion() public static function mysqlVersion()
{ {
if (env('DB_CONNECTION') === 'mysql') { if (config('database.default') === 'mysql') {
return DB::selectOne('select version() as mversion')->mversion; return DB::selectOne('select version() as mversion')->mversion;
} }

View File

@ -183,8 +183,8 @@ class Installer
'database' => $database, 'database' => $database,
'username' => $username, 'username' => $username,
'password' => $password, 'password' => $password,
'driver' => env('DB_CONNECTION', 'mysql'), 'driver' => $connection = config('database.default', 'mysql'),
'charset' => env('DB_CHARSET', 'utf8mb4'), 'charset' => config("database.connections.$connection.charset", 'utf8mb4'),
]); ]);
try { try {
@ -213,7 +213,7 @@ class Installer
'DB_PREFIX' => $prefix, 'DB_PREFIX' => $prefix,
]); ]);
$con = env('DB_CONNECTION', 'mysql'); $con = config('database.default', 'mysql');
// Change current connection // Change current connection
$db = Config::get('database.connections.' . $con); $db = Config::get('database.connections.' . $con);

View File

@ -14,6 +14,10 @@ return [
'name' => env('APP_NAME', 'Akaunting'), 'name' => env('APP_NAME', 'Akaunting'),
'installed' => env('APP_INSTALLED', false),
'schedule_time' => env('APP_SCHEDULE_TIME', '9:00'),
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Application Environment | Application Environment

View File

@ -22,7 +22,7 @@ return [
*/ */
'stubs' => [ 'stubs' => [
'enabled' => true, 'enabled' => true,
'path' => base_path() . '/app/Console/Stubs/Modules', 'path' => base_path('app/Console/Stubs/Modules'),
'files' => [ 'files' => [
'listeners/install' => 'Listeners/InstallModule.php', 'listeners/install' => 'Listeners/InstallModule.php',
'providers/event' => 'Providers/Event.php', 'providers/event' => 'Providers/Event.php',
@ -67,7 +67,7 @@ return [
| automatically to list of scanned folders. | automatically to list of scanned folders.
| |
*/ */
'modules' => base_path('modules'), 'modules' => base_path(env('MODULE_PATHS_MODULES', 'modules')),
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@ -77,7 +77,7 @@ return [
| Here you may update the modules assets path. | Here you may update the modules assets path.
| |
*/ */
'assets' => public_path('modules'), 'assets' => public_path(env('MODULE_PATHS_ASSETS', 'modules')),
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@ -88,7 +88,7 @@ return [
| the migration files? | the migration files?
| |
*/ */
'migration' => base_path('database/migrations'), 'migration' => base_path(env('MODULE_PATHS_MIGRATION', 'database/migrations')),
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------

View File

@ -87,10 +87,9 @@
@endif @endif
@endpermission @endpermission
@if ($module->purchase_faq) @if (!empty($module->purchase_desc))
<br> <div class="text-center mt-3">
<div class="text-center"> {!! $module->purchase_desc !!}
<a href="#" @click="onShowFaq" id="button-purchase-faq">{{ trans('modules.tab.faq')}}</a>
</div> </div>
@endif @endif
</div> </div>

View File

@ -191,7 +191,7 @@
@if (!empty($module->purchase_desc)) @if (!empty($module->purchase_desc))
<div class="text-center mt-3"> <div class="text-center mt-3">
{{ $module->purchase_desc }} {!! $module->purchase_desc !!}
</div> </div>
@endif @endif
</div> </div>

View File

@ -33,7 +33,7 @@
<script type="text/javascript"><!-- <script type="text/javascript"><!--
var url = '{{ url("/") }}'; var url = '{{ url("/") }}';
var app_url = '{{ env("APP_URL") }}'; var app_url = '{{ config("app.url") }}';
//--></script> //--></script>
@stack('js') @stack('js')

View File

@ -28,7 +28,7 @@
<script type="text/javascript"><!-- <script type="text/javascript"><!--
var url = '{{ url("/") }}'; var url = '{{ url("/") }}';
var app_url = '{{ env("APP_URL") }}'; var app_url = '{{ config("app.url") }}';
//--></script> //--></script>
@stack('js') @stack('js')

View File

@ -31,7 +31,7 @@
<script type="text/javascript"><!-- <script type="text/javascript"><!--
var url = '{{ url("/") }}'; var url = '{{ url("/") }}';
var app_home = '{{ url("apps/categories") }}'; var app_home = '{{ url("apps/categories") }}';
var app_url = '{{ env("APP_URL") }}'; var app_url = '{{ config("app.url") }}';
//--></script> //--></script>
@stack('js') @stack('js')

View File

@ -30,7 +30,7 @@
<script type="text/javascript"><!-- <script type="text/javascript"><!--
var url = '{{ url("/") }}'; var url = '{{ url("/") }}';
var app_url = '{{ env("APP_URL") }}'; var app_url = '{{ config("app.url") }}';
//--></script> //--></script>
@stack('js') @stack('js')

View File

@ -30,7 +30,7 @@
<script type="text/javascript"><!-- <script type="text/javascript"><!--
var url = '{{ url("/") }}'; var url = '{{ url("/") }}';
var app_url = '{{ env("APP_URL") }}'; var app_url = '{{ config("app.url") }}';
//--></script> //--></script>
@stack('js') @stack('js')

View File

@ -30,7 +30,7 @@
<script type="text/javascript"><!-- <script type="text/javascript"><!--
var url = '{{ url("/") }}'; var url = '{{ url("/") }}';
var app_url = '{{ env("APP_URL") }}'; var app_url = '{{ config("app.url") }}';
//--></script> //--></script>
@stack('js') @stack('js')