Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Family List Columns Configurable #7149

Merged
merged 1 commit into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion src/ChurchCRM/dto/SystemConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,19 @@ public static function getPersonListColumns(): array
];
}

public static function getFamilyListColumns(): array
{
return [
'Name' => new ListColumn('Name', 'getName', 'false', 'true'),
'Address' => new ListColumn('Address', 'getAddress', 'false', 'true'),
'Home Phone' => new ListColumn('Home Phone', 'getHomePhone', 'false', 'true'),
'Cell Phone' => new ListColumn('Cell Phone', 'getCellPhone', 'false', 'true'),
'Email' => new ListColumn('Email', 'getEmail', 'false', 'true'),
'Created' => new ListColumn('Created', 'getDateEntered', 'false', 'true'),
'Edited' => new ListColumn('Edited', 'getDateLastEdited', 'false', 'true'),
];
}

private static function buildConfigs(): array
{
return [
Expand Down Expand Up @@ -302,6 +315,7 @@ private static function buildConfigs(): array
'sInactiveClassification' => new ConfigItem(2073, 'sInactiveClassification', 'text', '', gettext('Comma separated list of classifications that should appear as inactive')),
'sDefaultZip' => new ConfigItem(2074, 'sDefaultZip', 'text', '', gettext('Default Zip')),
'sPersonListColumns' => new ConfigItem(2075, 'sPersonListColumns', 'json', json_encode(SystemConfig::getPersonListColumns()), gettext('Person List Columns')),
'sFamilyListColumns' => new ConfigItem(2076, 'sFamilyListColumns', 'json', json_encode(SystemConfig::getFamilyListColumns()), gettext('Family List Columns')),
];
}

Expand All @@ -311,7 +325,7 @@ private static function buildCategories(): array
gettext('Church Information') => ['sChurchName', 'sChurchAddress', 'sChurchCity', 'sChurchState', 'sChurchZip', 'sChurchCountry', 'sChurchPhone', 'sChurchEmail', 'sHomeAreaCode', 'sTimeZone', 'iChurchLatitude', 'iChurchLongitude', 'sChurchWebSite', 'sChurchFB', 'sChurchTwitter'],
gettext('User Setup') => ['iMinPasswordLength', 'iMinPasswordChange', 'iMaxFailedLogins', 'iSessionTimeout', 'aDisallowedPasswords', 'bEnableLostPassword', 'bEnable2FA', 'bRequire2FA', 's2FAApplicationName', 'bSendUserDeletedEmail'],
gettext('Email Setup') => ['sSMTPHost', 'bSMTPAuth', 'sSMTPUser', 'sSMTPPass', 'iSMTPTimeout', 'sToEmailAddress', 'bPHPMailerAutoTLS', 'sPHPMailerSMTPSecure'],
gettext('People Setup') => ['sDirClassifications', 'sDirRoleHead', 'sDirRoleSpouse', 'sDirRoleChild', 'sDefaultCity', 'sDefaultState', 'sDefaultZip', 'sDefaultCountry', 'bShowFamilyData', 'bHidePersonAddress', 'bHideFriendDate', 'bHideFamilyNewsletter', 'bHideWeddingDate', 'bHideLatLon', 'bForceUppercaseZip', 'bEnableSelfRegistration', 'bAllowEmptyLastName', 'iPersonNameStyle', 'iPersonInitialStyle', 'iProfilePictureListSize', 'sNewPersonNotificationRecipientIDs', 'IncludeDataInNewPersonNotifications', 'sGreeterCustomMsg1', 'sGreeterCustomMsg2', 'sInactiveClassification', 'sPersonListColumns'],
gettext('People Setup') => ['sDirClassifications', 'sDirRoleHead', 'sDirRoleSpouse', 'sDirRoleChild', 'sDefaultCity', 'sDefaultState', 'sDefaultZip', 'sDefaultCountry', 'bShowFamilyData', 'bHidePersonAddress', 'bHideFriendDate', 'bHideFamilyNewsletter', 'bHideWeddingDate', 'bHideLatLon', 'bForceUppercaseZip', 'bEnableSelfRegistration', 'bAllowEmptyLastName', 'iPersonNameStyle', 'iPersonInitialStyle', 'iProfilePictureListSize', 'sNewPersonNotificationRecipientIDs', 'IncludeDataInNewPersonNotifications', 'sGreeterCustomMsg1', 'sGreeterCustomMsg2', 'sInactiveClassification', 'sPersonListColumns', 'sFamilyListColumns'],
gettext('Enabled Features') => ['bEnabledFinance', 'bEnabledSundaySchool', 'bEnabledEvents', 'bEnabledCalendar', 'bEnabledFundraiser', 'bEnabledEmail', 'bEnabledMenuLinks'],
gettext('Map Settings') => ['sGeoCoderProvider', 'sGoogleMapsGeocodeKey', 'sGoogleMapsRenderKey', 'sBingMapKey', 'sGMapIcons', 'iMapZoom'],
gettext('Report Settings') => ['sQBDTSettings', 'leftX', 'incrementY', 'sTaxReport1', 'sTaxReport2', 'sTaxReport3', 'sTaxSigner', 'sReminder1', 'sReminderSigner', 'sReminderNoPledge', 'sReminderNoPayments', 'sConfirm1', 'sConfirm2', 'sConfirm3', 'sConfirm4', 'sConfirm5', 'sConfirm6', 'sDear', 'sConfirmSincerely', 'sConfirmSigner', 'sPledgeSummary1', 'sPledgeSummary2', 'sDirectoryDisclaimer1', 'sDirectoryDisclaimer2', 'bDirLetterHead', 'sZeroGivers', 'sZeroGivers2', 'sZeroGivers3', 'iPDFOutputType'],
Expand Down
39 changes: 21 additions & 18 deletions src/v2/templates/people/family-list.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,14 @@
<thead>
<tr>
<th><?= gettext('Actions') ?></th>
<th><?= gettext('Name') ?></th>
<th><?= gettext('Address') ?></th>
<th><?= gettext('Home Phone') ?></th>
<th><?= gettext('Cell Phone') ?></th>
<th><?= gettext('Email') ?></th>
<th><?= gettext('Created') ?></th>
<th><?= gettext('Edited') ?></th>
<?php
$columns = json_decode(SystemConfig::getValue('sFamilyListColumns'), null, 512, JSON_THROW_ON_ERROR);
foreach ($columns as $column) {
if ($column->visible === 'true') {
echo '<th>' . gettext($column->name) . '</th>';
}
}
?>
</tr>
</thead>
<tbody>
Expand All @@ -43,17 +44,19 @@
<i class="fas fa-pen"></i>
</a>
</td>
<td><?= $family->getName() ?></td>
<td> <?= $family->getAddress() ?></td>
<td><?= $family->getHomePhone() ?></td>
<td><?= $family->getCellPhone() ?></td>
<td><?= $family->getEmail() ?></td>
<td><?= date_format($family->getDateEntered(), SystemConfig::getValue('sDateFormatLong')) ?></td>
<td>
<?php if ($family->getDateLastEdited()) {
echo date_format($family->getDateLastEdited(), SystemConfig::getValue('sDateFormatLong'));
} ?>
</td>

<?php
foreach ($columns as $column) {
if ($column->visible === 'true') {
if (str_starts_with($column->displayFunction, 'getDate')) {
$columnData = [$family, $column->displayFunction](SystemConfig::getValue('sDateFormatLong'));
} else {
$columnData = [$family, $column->displayFunction]();
}
echo '<td>' . $columnData . '</td>';
}
}
?>
</tr>
<?php } ?>
</tbody>
Expand Down
Loading