mirror of
https://github.com/slawkens/myaac.git
synced 2025-04-26 17:29:21 +02:00
Adjustments regarding accounts.id in admin panel -> Accounts editor
getAccountIdentityColumn() function
This commit is contained in:
parent
023f1dc598
commit
8e0978c1ed
@ -23,10 +23,7 @@ $use_datatable = true;
|
|||||||
if (setting('core.account_country'))
|
if (setting('core.account_country'))
|
||||||
require SYSTEM . 'countries.conf.php';
|
require SYSTEM . 'countries.conf.php';
|
||||||
|
|
||||||
$nameOrNumberColumn = 'name';
|
$nameOrNumberColumn = getAccountIdentityColumn();
|
||||||
if (USE_ACCOUNT_NUMBER) {
|
|
||||||
$nameOrNumberColumn = 'number';
|
|
||||||
}
|
|
||||||
|
|
||||||
$hasSecretColumn = $db->hasColumn('accounts', 'secret');
|
$hasSecretColumn = $db->hasColumn('accounts', 'secret');
|
||||||
$hasCoinsColumn = $db->hasColumn('accounts', 'coins');
|
$hasCoinsColumn = $db->hasColumn('accounts', 'coins');
|
||||||
@ -69,7 +66,7 @@ else if (isset($_REQUEST['search_email'])) {
|
|||||||
else if (isset($_REQUEST['search'])) {
|
else if (isset($_REQUEST['search'])) {
|
||||||
$search_account = $_REQUEST['search'];
|
$search_account = $_REQUEST['search'];
|
||||||
$min_size = 3;
|
$min_size = 3;
|
||||||
if ($nameOrNumberColumn == 'number') {
|
if (in_array($nameOrNumberColumn, ['id', 'number'])) {
|
||||||
$min_size = 1;
|
$min_size = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -248,7 +245,7 @@ else if (isset($_REQUEST['search'])) {
|
|||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>ID</th>
|
<th>ID</th>
|
||||||
<th><?= ($nameOrNumberColumn == 'number' ? 'Number' : 'Name'); ?></th>
|
<th><?= ($nameOrNumberColumn == 'name' ? 'Name' : 'Number'); ?></th>
|
||||||
<?php if($hasTypeColumn || $hasGroupColumn): ?>
|
<?php if($hasTypeColumn || $hasGroupColumn): ?>
|
||||||
<th>E-Mail</th>
|
<th>E-Mail</th>
|
||||||
<th>Position</th>
|
<th>Position</th>
|
||||||
|
@ -1684,6 +1684,18 @@ function isRequestMethod(string $method): bool {
|
|||||||
return strtolower($_SERVER['REQUEST_METHOD']) == strtolower($method);
|
return strtolower($_SERVER['REQUEST_METHOD']) == strtolower($method);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getAccountIdentityColumn(): string
|
||||||
|
{
|
||||||
|
if (USE_ACCOUNT_NAME) {
|
||||||
|
return 'name';
|
||||||
|
}
|
||||||
|
elseif (USE_ACCOUNT_NUMBER) {
|
||||||
|
return 'number';
|
||||||
|
}
|
||||||
|
|
||||||
|
return 'id';
|
||||||
|
}
|
||||||
|
|
||||||
// validator functions
|
// validator functions
|
||||||
require_once SYSTEM . 'compat/base.php';
|
require_once SYSTEM . 'compat/base.php';
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user