From 976957ddd453db3035b0cf04864694ad886b126f Mon Sep 17 00:00:00 2001 From: NMC Date: Sun, 1 Aug 2021 14:30:16 -0400 Subject: [PATCH 1/2] Add Maintained filed in licenses view and api. + Expires in API --- app/Http/Controllers/Api/LicensesController.php | 7 +++++++ resources/views/licenses/view.blade.php | 11 +++++++++++ 2 files changed, 18 insertions(+) diff --git a/app/Http/Controllers/Api/LicensesController.php b/app/Http/Controllers/Api/LicensesController.php index 268248ab77..fc153f0ac4 100644 --- a/app/Http/Controllers/Api/LicensesController.php +++ b/app/Http/Controllers/Api/LicensesController.php @@ -77,6 +77,13 @@ class LicensesController extends Controller $licenses->where('supplier_id','=',$request->input('supplier_id')); } + if (($request->filled('maintained')) && ($request->input('maintained')=='true')) { + $licenses->where('maintained','=',1); + } + + if (($request->filled('expires')) && ($request->input('expires')=='true')) { + $licenses->whereNotNull('expiration_date'); + } if ($request->filled('search')) { $licenses = $licenses->TextSearch($request->input('search')); diff --git a/resources/views/licenses/view.blade.php b/resources/views/licenses/view.blade.php index 96b426d3dd..990e5e90bc 100755 --- a/resources/views/licenses/view.blade.php +++ b/resources/views/licenses/view.blade.php @@ -285,6 +285,17 @@ @endif +
+
+ + {{ trans('admin/licenses/form.maintained') }} + +
+
+ {{ $license->maintained ? 'Yes' : 'No' }} +
+
+ @if (($license->seats) && ($license->seats) > 0)
From 4cfc4aec1dd9324c25e63a7952131cfc1ca052a6 Mon Sep 17 00:00:00 2001 From: NMC Date: Sun, 1 Aug 2021 15:10:22 -0400 Subject: [PATCH 2/2] fix false search in api. --- app/Http/Controllers/Api/LicensesController.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/Http/Controllers/Api/LicensesController.php b/app/Http/Controllers/Api/LicensesController.php index fc153f0ac4..d9a420eb9d 100644 --- a/app/Http/Controllers/Api/LicensesController.php +++ b/app/Http/Controllers/Api/LicensesController.php @@ -79,10 +79,14 @@ class LicensesController extends Controller if (($request->filled('maintained')) && ($request->input('maintained')=='true')) { $licenses->where('maintained','=',1); + } elseif (($request->filled('maintained')) && ($request->input('maintained')=='false')) { + $licenses->where('maintained','=',0); } if (($request->filled('expires')) && ($request->input('expires')=='true')) { $licenses->whereNotNull('expiration_date'); + } elseif (($request->filled('expires')) && ($request->input('expires')=='false')) { + $licenses->whereNull('expiration_date'); } if ($request->filled('search')) {