1
0

fix(helpdesk): handle nested table key from DB::select in user dropdowns

MintyPHP DB returns rows as $row[$table][$field], so tenant users
come back as $u['u']['id'] not $u['id']. Added fallback for both.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
aminovfariz
2026-06-01 14:41:48 +02:00
parent 3f56f3f279
commit 1c1e82b352
2 changed files with 14 additions and 6 deletions

View File

@@ -48,9 +48,13 @@ $currentStatus = (string) ($handover['status'] ?? '');
<?php if (!empty($errors['assigned_to'])): ?>aria-describedby="assigned_to_error"<?php endif; ?>
>
<option value=""><?php e(t('— Select employee —')); ?></option>
<?php foreach ($tenantUsers as $u): ?>
<option value="<?php e($u['id']); ?>"<?php if ((int) $u['id'] === $currentAssignedTo): ?> selected<?php endif; ?>>
<?php e($u['display_name'] ?: $u['email']); ?>
<?php foreach ($tenantUsers as $u):
$uId = (int) ($u['u']['id'] ?? $u['id'] ?? 0);
$uName = (string) ($u['u']['display_name'] ?? $u['display_name'] ?? '');
$uEmail = (string) ($u['u']['email'] ?? $u['email'] ?? '');
?>
<option value="<?php e($uId); ?>"<?php if ($uId === $currentAssignedTo): ?> selected<?php endif; ?>>
<?php e($uName ?: $uEmail); ?>
</option>
<?php endforeach; ?>
</select>

View File

@@ -117,9 +117,13 @@ $tenantUsers = is_array($tenantUsers ?? null) ? $tenantUsers : [];
<label for="wizard-assigned-to"><?php e(t('Assign to (optional)')); ?></label>
<select id="wizard-assigned-to" name="assigned_to">
<option value="0"><?php e(t('— Not assigned yet —')); ?></option>
<?php foreach ($tenantUsers as $u): ?>
<option value="<?php e($u['id']); ?>"<?php if ((int) ($form['assigned_to'] ?? 0) === (int) $u['id']): ?> selected<?php endif; ?>>
<?php e($u['display_name'] ?: $u['email']); ?>
<?php foreach ($tenantUsers as $u):
$uId = (int) ($u['u']['id'] ?? $u['id'] ?? 0);
$uName = (string) ($u['u']['display_name'] ?? $u['display_name'] ?? '');
$uEmail = (string) ($u['u']['email'] ?? $u['email'] ?? '');
?>
<option value="<?php e($uId); ?>"<?php if ((int) ($form['assigned_to'] ?? 0) === $uId): ?> selected<?php endif; ?>>
<?php e($uName ?: $uEmail); ?>
</option>
<?php endforeach; ?>
</select>