Skip to content

Commit

Permalink
Configurable Person's Initial Format
Browse files Browse the repository at this point in the history
  • Loading branch information
bigtigerku committed Sep 11, 2024
1 parent 4ad8385 commit 3f448ce
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
11 changes: 8 additions & 3 deletions src/ChurchCRM/dto/Photo.php
Original file line number Diff line number Diff line change
Expand Up @@ -304,9 +304,14 @@ private function getInitialsString(): string
{
$retstr = '';
if ($this->photoType == 'Person') {
$fullNameArr = PersonQuery::create()->select(['FirstName', 'LastName'])->findOneById($this->id);
foreach ($fullNameArr as $name) {
$retstr .= mb_strtoupper(mb_substr($name, 0, 1));
if (SystemConfig::getValue('sInitialFormat') === 'FI') {
$fullNameArr = PersonQuery::create()->findOneById($this->id)->getFirstName();
$retstr .= mb_strtoupper(mb_substr($fullNameArr, 0, 2));
} else {
$fullNameArr = PersonQuery::create()->select(['FirstName', 'LastName'])->findOneById($this->id);
foreach ($fullNameArr as $name) {
$retstr .= mb_strtoupper(mb_substr($name, 0, 1));
}
}
} elseif ($this->photoType == 'Family') {
$fullNameArr = FamilyQuery::create()->findOneById($this->id)->getName();
Expand Down
3 changes: 2 additions & 1 deletion src/ChurchCRM/dto/SystemConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ private static function buildConfigs(): array
'sDatePickerPlaceHolder' => new ConfigItem(109, 'sDatePickerPlaceHolder', 'text', 'yyyy-mm-dd', gettext('For defining the date in Date-Picker, per default : yyyy-mm-dd, In French : dd/mm/yyyy for example.')),
'sDatePickerFormat' => new ConfigItem(110, 'sDatePickerFormat', 'text', 'Y-m-d', gettext('For defining the date in Date-Picker, per default : Y-m-d, In French : d/m/Y for example.')),
'sFont' => new ConfigItem(112, 'sFont', 'text', 'Roboto-Regular.ttf', gettext('Set font to render initials. Upload custom font to fonts directory')),
'sInitialFormat' => new ConfigItem(113, 'sInitialFormat', 'choice', 'FL', gettext('When name is First Middle Last, select option to generates initial of FL(One character from Fist and Last) or FI(Two characters from First)'), '', '{"Choices":["' . gettext('FL') . '","' . gettext('FI') . '"]}'),
'bRegistered' => new ConfigItem(999, 'bRegistered', 'boolean', '0', gettext('ChurchCRM has been registered. The ChurchCRM team uses registration information to track usage. This information is kept confidential and never released or sold. If this field is true the registration option in the admin menu changes to update registration.')),
'leftX' => new ConfigItem(1001, 'leftX', 'number', '20', gettext('Left Margin (1 = 1/100th inch)')),
'incrementY' => new ConfigItem(1002, 'incrementY', 'number', '4', gettext('Line Thickness (1 = 1/100th inch')),
Expand Down Expand Up @@ -283,7 +284,7 @@ private static function buildCategories(): array
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'],
gettext('Financial Settings') => ['sDepositSlipType', 'iChecksPerDepositForm', 'bDisplayBillCounts', 'bUseScannedChecks', 'bEnableNonDeductible', 'iFYMonth', 'bUseDonationEnvelopes', 'aFinanceQueries'],
gettext('Quick Search') => ['bSearchIncludePersons', 'bSearchIncludePersonsMax', 'bSearchIncludeAddresses', 'bSearchIncludeAddressesMax', 'bSearchIncludeFamilies', 'bSearchIncludeFamiliesMax', 'bSearchIncludeFamilyHOH', 'bSearchIncludeFamilyHOHMax', 'bSearchIncludeGroups', 'bSearchIncludeGroupsMax', 'bSearchIncludeDeposits', 'bSearchIncludeDepositsMax', 'bSearchIncludePayments', 'bSearchIncludePaymentsMax', 'bSearchIncludeFamilyCustomProperties', 'bSearchIncludeCalendarEvents', 'bSearchIncludeCalendarEventsMax'],
gettext('Localization') => ['sLanguage', 'sDistanceUnit', 'sPhoneFormat', 'sPhoneFormatWithExt', 'sPhoneFormatCell', 'sDateFormatLong', 'sDateFormatNoYear', 'sDateFormatShort', 'sDateTimeFormat', 'sDateFilenameFormat', 'sCSVExportDelimiter', 'sCSVExportCharset', 'sDatePickerFormat', 'sDatePickerPlaceHolder', 'sFont'],
gettext('Localization') => ['sLanguage', 'sDistanceUnit', 'sPhoneFormat', 'sPhoneFormatWithExt', 'sPhoneFormatCell', 'sDateFormatLong', 'sDateFormatNoYear', 'sDateFormatShort', 'sDateTimeFormat', 'sDateFilenameFormat', 'sCSVExportDelimiter', 'sCSVExportCharset', 'sDatePickerFormat', 'sDatePickerPlaceHolder', 'sFont', 'sInitialFormat'],
gettext('Integration') => ['sMailChimpApiKey', 'sGoogleTrackingID', 'bEnableGravatarPhotos', 'bEnableGooglePhotos', 'iRemotePhotoCacheDuration', 'sNexmoAPIKey', 'sNexmoAPISecret', 'sNexmoFromNumber', 'sOLPURL', 'sOLPUserName', 'sOLPPassword'],
gettext('Church Services') => ['iPersonConfessionFatherCustomField', 'iPersonConfessionDateCustomField'],
gettext('Events') => ['bEnableExternalCalendarAPI', 'bEventsOnDashboardPresence', 'iEventsOnDashboardPresenceTimeOut'],
Expand Down

0 comments on commit 3f448ce

Please sign in to comment.