From e11f9313f0d1c865dac6d398b551cbe003ef199a Mon Sep 17 00:00:00 2001 From: snipe Date: Wed, 1 Nov 2017 14:12:18 -0700 Subject: [PATCH 1/4] Fixed #4360 - better output if backup fails --- app/Http/Controllers/SettingsController.php | 26 +++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/app/Http/Controllers/SettingsController.php b/app/Http/Controllers/SettingsController.php index 1d1296c4cf..4223ea02cf 100755 --- a/app/Http/Controllers/SettingsController.php +++ b/app/Http/Controllers/SettingsController.php @@ -888,12 +888,30 @@ class SettingsController extends Controller public function postBackups() { + if (!config('app.lock_passwords')) { Artisan::call('backup:run'); - return redirect()->route('settings.backups.index')->with('success', trans('admin/settings/message.backup.generated')); - } else { - return redirect()->to("settings.backups.index")->with('error', trans('general.feature_disabled')); - } + $output = Artisan::output(); + + // Backup completed + if (!preg_match('/failed/', $output)) { + return redirect()->route('settings.backups.index') + ->with('success', trans('admin/settings/message.backup.generated')); + } + + + $formatted_output = str_replace('Backup completed!', '', $output); + $output_split = explode('...', $formatted_output); + + if (array_key_exists(2, $output_split)) { + return redirect()->route("settings.backups.index")->with('error', $output_split[2]); + } + return redirect()->route("settings.backups.index")->with('error', $formatted_output); + + } + return redirect()->route("settings.backups.index")->with('error', trans('general.feature_disabled')); + + } From 4f008e118ff06f08f283f4277a043edd2496a813 Mon Sep 17 00:00:00 2001 From: snipe Date: Wed, 1 Nov 2017 21:55:17 -0700 Subject: [PATCH 2/4] Fixed search string on suppliers selectlist --- app/Http/Controllers/Api/SuppliersController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/Api/SuppliersController.php b/app/Http/Controllers/Api/SuppliersController.php index 672858a5a8..288b6b3c2d 100644 --- a/app/Http/Controllers/Api/SuppliersController.php +++ b/app/Http/Controllers/Api/SuppliersController.php @@ -155,7 +155,7 @@ class SuppliersController extends Controller ]); if ($request->has('search')) { - $suppliers = $suppliers->where('locations.name', 'LIKE', '%'.$request->get('search').'%'); + $suppliers = $suppliers->where('suppliers.name', 'LIKE', '%'.$request->get('search').'%'); } $suppliers = $suppliers->orderBy('name', 'ASC')->paginate(50); From 3ca5d39c6651f370739a6a58882b2708093bcb75 Mon Sep 17 00:00:00 2001 From: snipe Date: Wed, 1 Nov 2017 23:44:31 -0700 Subject: [PATCH 3/4] Hide upload button if app is locked --- resources/views/importer/import.blade.php | 4 +++ resources/views/users/import.blade.php | 32 ++++++++++++++++++----- 2 files changed, 29 insertions(+), 7 deletions(-) diff --git a/resources/views/importer/import.blade.php b/resources/views/importer/import.blade.php index ce64f6fda2..b32372833e 100644 --- a/resources/views/importer/import.blade.php +++ b/resources/views/importer/import.blade.php @@ -29,12 +29,16 @@
+ + @if (!config('app.lock_passwords')) Select Import File... + @endif +
diff --git a/resources/views/users/import.blade.php b/resources/views/users/import.blade.php index 81e767b697..285e89e60c 100644 --- a/resources/views/users/import.blade.php +++ b/resources/views/users/import.blade.php @@ -13,12 +13,17 @@ Create a User {{-- Page content --}} @section('content') - +
+ + @if (config('app.lock_passwords')) +

CSV uploads are disabled on the demo.

+ @endif + @@ -41,14 +46,22 @@ Create a User Any additional fields to the right of those fields will be ignored. Email is optional, however users will not be able to recover their passwords or receive EULAs if you do not provide an email address. If you wish to include a company association, you must reference the ID number of an existing company - companies will not be created on the fly.

- @if (config('app.lock_passwords')) -

Note: Email notification for users is disabled for this installation.

- @endif -
+ + +
- + + Select Import File... + @if (config('app.lock_passwords')) + + @else + + @endif + + +
@@ -81,7 +94,12 @@ Create a User
From 81ca0ac91dbc18e59614f91989c26634a7eb5b9e Mon Sep 17 00:00:00 2001 From: snipe Date: Wed, 1 Nov 2017 23:46:21 -0700 Subject: [PATCH 4/4] Added better styling for user upload --- resources/views/users/import.blade.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/resources/views/users/import.blade.php b/resources/views/users/import.blade.php index 285e89e60c..782fe1bcf3 100644 --- a/resources/views/users/import.blade.php +++ b/resources/views/users/import.blade.php @@ -76,9 +76,9 @@ Create a User
-
+
-
+
{{ Form::checkbox('email_user', '1', Input::old('email_user')) }} Email these users their credentials? (Only possible where email address is included with user data.)
@@ -96,9 +96,9 @@ Create a User