From c2ec46824621468f2a1cb4046805c485ed13fea5 Mon Sep 17 00:00:00 2001 From: slawkens Date: Tue, 23 Jul 2024 22:56:31 +0200 Subject: [PATCH] feat: search by email in accounts editor --- admin/pages/accounts.php | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/admin/pages/accounts.php b/admin/pages/accounts.php index d42a2ee6..bb95de6b 100644 --- a/admin/pages/accounts.php +++ b/admin/pages/accounts.php @@ -8,6 +8,7 @@ * @link https://my-aac.org */ +use MyAAC\Models\Account as AccountModel; use MyAAC\Models\Player; defined('MYAAC') or die('Direct access not allowed!'); @@ -51,9 +52,21 @@ $acc_type = setting('core.account_types'); get(); + if ($accountModel->count() == 1) { + $id = (int)$accountModel[0]->id; + } else if ($accountModel->count() > 10) { + echo_error('Specified e-mail resulted with too many accounts.'); + } + else { + echo_error('No entries found.'); + } +} else if (isset($_REQUEST['search'])) { $search_account = $_REQUEST['search']; if (strlen($search_account) < 3 && !Validator::number($search_account)) { @@ -214,7 +227,7 @@ else if (isset($_REQUEST['search'])) { } } } else if ($id == 0) { - $accounts_db = $db->query('SELECT `id`, `' . $nameOrNumberColumn . '`' . ($hasTypeColumn ? ',type' : ($hasGroupColumn ? ',group_id' : '')) . ' FROM `accounts` ORDER BY `id` ASC'); + $accounts_db = $db->query('SELECT `id`, `' . $nameOrNumberColumn . '`' . ($hasTypeColumn ? ',type' : ($hasGroupColumn ? ',group_id' : '')) . ', email FROM `accounts` ORDER BY `id` ASC'); ?>
@@ -228,6 +241,7 @@ else if (isset($_REQUEST['search'])) { ID + E-Mail Position Edit @@ -238,6 +252,7 @@ else if (isset($_REQUEST['search'])) { +
+
+
+ + +
+ + +
+
+