From d22c328dbfcde234a9a7f7509799f9c2213bb61c Mon Sep 17 00:00:00 2001 From: blakej115 Date: Sat, 22 Oct 2022 16:45:23 -0400 Subject: [PATCH] Fixed error when trying to export when no records exist, Fixed menu context, Fixed main menu counter not updating --- controllers/Exports.php | 6 ++++-- controllers/Records.php | 2 +- controllers/records/partials/_list_toolbar.htm | 4 ++++ updates/version.yaml | 4 +++- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/controllers/Exports.php b/controllers/Exports.php index 6798d21..711b0fa 100644 --- a/controllers/Exports.php +++ b/controllers/Exports.php @@ -21,7 +21,7 @@ class Exports extends Controller { public function __construct() { parent::__construct(); - BackendMenu::setContext('blakejones.magicforms', 'forms', 'exports'); + BackendMenu::setContext('BlakeJones.MagicForms', 'forms', 'exports'); } public function index() { @@ -84,7 +84,9 @@ public function csv() { $filteredRecords = $records->get(); $recordsArray = $filteredRecords->toArray(); $record = $filteredRecords->first(); - $headers = array_merge($headers, array_keys($record->form_data_arr)); + if (isset($record)) { + $headers = array_merge($headers, array_keys($record->form_data_arr)); + } // ADD HEADERS $csv->insertOne($headers); diff --git a/controllers/Records.php b/controllers/Records.php index 9c81e8c..0766bf0 100644 --- a/controllers/Records.php +++ b/controllers/Records.php @@ -23,7 +23,7 @@ class Records extends Controller { public function __construct() { parent::__construct(); - BackendMenu::setContext('blakejones.magicforms', 'forms', 'records'); + BackendMenu::setContext('BlakeJones.MagicForms', 'forms', 'records'); } public function view($id) { diff --git a/controllers/records/partials/_list_toolbar.htm b/controllers/records/partials/_list_toolbar.htm index 8f882fd..d8c8305 100644 --- a/controllers/records/partials/_list_toolbar.htm +++ b/controllers/records/partials/_list_toolbar.htm @@ -17,6 +17,7 @@ 'interval': 3 }); $.oc.sideNav.setCounter('forms/records', data.counter); + $.oc.sideNav.setCounter('forms', data.counter); $('#Lists').html(data.list['#Lists']); ", ]); @@ -35,6 +36,7 @@ 'request_success' => " $('#records-toolbar').find('button').prop('disabled', true); $.oc.sideNav.setCounter('forms/records', data.counter); + $.oc.sideNav.setCounter('forms', data.counter); $('#Lists').html(data.list['#Lists']); ", ]); @@ -50,6 +52,7 @@ 'request_success' => " $('#records-toolbar').find('button').prop('disabled', true); $.oc.sideNav.setCounter('forms/records', data.counter); + $.oc.sideNav.setCounter('forms', data.counter); $('#Lists').html(data.list['#Lists']); ", ]); @@ -67,6 +70,7 @@ 'request_success' => " $('#records-toolbar').find('button').blur(); $.oc.sideNav.setCounter('forms/records', data.counter); + $.oc.sideNav.setCounter('forms', data.counter); $('#Lists').html(data.list['#Lists']); ", ]); diff --git a/updates/version.yaml b/updates/version.yaml index 15a38e8..486e30f 100644 --- a/updates/version.yaml +++ b/updates/version.yaml @@ -136,4 +136,6 @@ 1.6.2: - Fixed getting total count of records preventing install because the records table doesn't exist 1.6.3: - - Fixed needed use Schema for UnreadRecords class \ No newline at end of file + - Fixed needed use Schema for UnreadRecords class +1.6.4: + - Fixed error when trying to export when no records exist, Fixed menu context, Fixed main menu counter not updating \ No newline at end of file