History file changes

This commit is contained in:
Ravi Gulhane 2026-09-17 13:43:57 +05:30
parent 9e92f5f382
commit cd394cf3d0
2 changed files with 20 additions and 2 deletions

View File

@ -12539,13 +12539,22 @@ class FormController extends Controller
/**
* Selected user attribute codes when the form is configured to show them.
* Uses the saved attribute list as the source of truth so columns still render
* if Show User Attributes was left off after attributes were selected.
*/
protected function userAttributeCodes($form): array
{
if (!$form || ($form->show_user_attributes ?? 'no') !== 'yes') {
if (!$form) {
return [];
}
$raw = $form->user_attributes ?? [];
if (is_object($raw)) {
$raw = (array) $raw;
}
if (is_string($raw) && $raw !== '') {
$decoded = json_decode($raw, true);
$raw = is_array($decoded) ? $decoded : explode('#', $raw);
}
if (!is_array($raw)) {
return [];
}
@ -12553,13 +12562,16 @@ class FormController extends Controller
foreach ($raw as $code) {
if (is_object($code)) {
$code = $code->code ?? '';
} elseif (is_array($code)) {
$code = $code['code'] ?? '';
}
$code = trim((string) $code);
if ($code !== '') {
$codes[] = $code;
}
}
return array_values(array_unique($codes));
$codes = array_values(array_unique($codes));
return $codes;
}
protected function userAttributeValue($user, string $attr): string

View File

@ -158,6 +158,9 @@ class FormentityController extends Controller
$values->show_manager_details = $values->show_manager_details ?? 'no';
$values->show_user_attributes = (($values->show_user_attributes ?? 'no') === 'yes') ? 'yes' : 'no';
$values->user_attributes = $this->normalizeAttributeCodes($values->user_attributes ?? []);
if (!empty($values->user_attributes)) {
$values->show_user_attributes = 'yes';
}
}
//echo '<pre>'; print_r($values); exit;
return $values;
@ -251,6 +254,9 @@ class FormentityController extends Controller
$data['roles_info'] = ($data['roles_info'] ?? 'no') === 'yes' ? 'yes' : 'no';
$data['show_user_attributes'] = ($data['show_user_attributes'] ?? 'no') === 'yes' ? 'yes' : 'no';
$data['user_attributes'] = $this->normalizeAttributeCodes($data['user_attributes'] ?? []);
if (!empty($data['user_attributes'])) {
$data['show_user_attributes'] = 'yes';
}
if ($data['email_notification'] === 'no') {
$data['email_notification_rules'] = [];
} else {