diff --git a/cypress/e2e/ui/events/standard.events.spec.js b/cypress/e2e/ui/events/standard.events.spec.js index 3f235f4800..508d45b084 100644 --- a/cypress/e2e/ui/events/standard.events.spec.js +++ b/cypress/e2e/ui/events/standard.events.spec.js @@ -15,7 +15,6 @@ context("Standard User Session", () => { cy.contains("Berry, Miss Brianna"); }); - it("View Event via URL", () => { cy.loginStandard("EditEventAttendees.php?eventId=3"); cy.contains("Attendees for Event : Summer Camp"); @@ -26,13 +25,11 @@ context("Standard User Session", () => { cy.contains("Listing All Church Events"); }); - it("View Event via invalid URL id", () => { cy.loginStandard("EditEventAttendees.php?eventId=99999", false); cy.contains("Listing All Church Events"); }); - it("CheckIn People", () => { cy.loginStandard("Checkin.php"); cy.contains("Event Checkin"); diff --git a/cypress/e2e/ui/people/standard.family.spec.js b/cypress/e2e/ui/people/standard.family.spec.js index e845f058ee..b2358ae196 100644 --- a/cypress/e2e/ui/people/standard.family.spec.js +++ b/cypress/e2e/ui/people/standard.family.spec.js @@ -62,10 +62,12 @@ context("Standard Family", () => { cy.get('input[name="Longitude"]').clear(); // Fill in Other Info section - const weddingYear = '2024'; - const weddingMonth = '04'; - const weddingDay = '03'; - cy.get('#WeddingDate').type(`${weddingYear}-${weddingMonth}-${weddingDay}`); + const weddingYear = "2024"; + const weddingMonth = "04"; + const weddingDay = "03"; + cy.get("#WeddingDate").type( + `${weddingYear}-${weddingMonth}-${weddingDay}`, + ); // Fill in Family Members cy.get('input[name="FirstName1"]').type("Mike"); diff --git a/cypress/e2e/ui/people/standard.people.filterbyclassification.spec.js b/cypress/e2e/ui/people/standard.people.filterbyclassification.spec.js new file mode 100644 index 0000000000..f50182e645 --- /dev/null +++ b/cypress/e2e/ui/people/standard.people.filterbyclassification.spec.js @@ -0,0 +1,85 @@ +describe("template spec", () => { + it("filter-by-classification", () => { + cy.loginAdmin("OptionManager.php?mode=classes"); + cy.get("#inactive4").uncheck(); + cy.get("#inactive5").uncheck(); + + cy.reload(); + + cy.get("#inactive1").should("not.be.checked"); + cy.get("#inactive2").should("not.be.checked"); + cy.get("#inactive3").should("not.be.checked"); + cy.get("#inactive4").should("not.be.checked"); + cy.get("#inactive5").should("not.be.checked"); + + cy.visit("v2/people?familyActiveStatus=inactive"); + cy.get("#members_filter input").type("edwin.adams@example.com"); + cy.contains("No matching records found"); + + cy.visit("v2/people?familyActiveStatus=all"); + cy.get("#members_filter input").type("edwin.adams@example.com"); + cy.contains("(564)-714-4633"); + + cy.visit("v2/people"); + cy.get("#members_filter input").type("edwin.adams@example.com"); + cy.contains("(564)-714-4633"); + + cy.visit("OptionManager.php?mode=classes"); + cy.get("#inactive4").check(); + + cy.reload(); + + cy.get("#inactive1").should("not.be.checked"); + cy.get("#inactive2").should("not.be.checked"); + cy.get("#inactive3").should("not.be.checked"); + cy.get("#inactive4").should("be.checked"); + cy.get("#inactive5").should("not.be.checked"); + + cy.visit("v2/people?familyActiveStatus=inactive"); + cy.get("#members_filter input").type("edwin.adams@example.com"); + cy.contains("No matching records found"); + + cy.visit("v2/people?familyActiveStatus=all"); + cy.get("#members_filter input").type("edwin.adams@example.com"); + cy.contains("(564)-714-4633"); + + cy.visit("v2/people"); + cy.get("#members_filter input").type("edwin.adams@example.com"); + cy.contains("(564)-714-4633"); + + cy.visit("OptionManager.php?mode=classes"); + cy.get("#inactive5").check(); + + cy.reload(); + + cy.get("#inactive1").should("not.be.checked"); + cy.get("#inactive2").should("not.be.checked"); + cy.get("#inactive3").should("not.be.checked"); + cy.get("#inactive4").should("be.checked"); + cy.get("#inactive5").should("be.checked"); + + cy.visit("v2/people?familyActiveStatus=inactive"); + cy.get("#members_filter input").type("edwin.adams@example.com"); + cy.contains("(564)-714-4633"); + + cy.visit("v2/people?familyActiveStatus=all"); + cy.get("#members_filter input").type("edwin.adams@example.com"); + cy.contains("(564)-714-4633"); + + cy.visit("v2/people"); + cy.get("#members_filter input").type("edwin.adams@example.com"); + cy.contains("No matching records found"); + + cy.visit("OptionManager.php?mode=classes"); + cy.get("#inactive4").uncheck(); + cy.get("#inactive5").uncheck(); + + cy.reload(); + + cy.get("#inactive1").should("not.be.checked"); + cy.get("#inactive2").should("not.be.checked"); + cy.get("#inactive3").should("not.be.checked"); + cy.get("#inactive4").should("not.be.checked"); + cy.get("#inactive5").should("not.be.checked"); + }); +}); diff --git a/src/ChurchCRM/data/Countries.php b/src/ChurchCRM/data/Countries.php index 1c56949fa7..1f0957ed3b 100644 --- a/src/ChurchCRM/data/Countries.php +++ b/src/ChurchCRM/data/Countries.php @@ -277,7 +277,7 @@ public static function getNames(): array { self::initializeCountries(); - return array_map(['static', 'getSingleName'], self::$countries); + return array_map([__CLASS__, 'getSingleName'], self::$countries); } public static function getAll(): array @@ -303,7 +303,7 @@ public static function getCountryByName(string $CountryName): ?Country self::initializeCountries(); $result = array_filter(self::$countries, fn ($e): bool => $e->getCountryName() === $CountryName); if (count($result) === 1) { - // Note that array_values() is needed because array_filter does not return continuous array + // Note that array_values() is needed because array_filter does not return a continuous array return array_values($result)[0]; } diff --git a/src/ChurchCRM/dto/SystemConfig.php b/src/ChurchCRM/dto/SystemConfig.php index 14c075f392..05dbcfaa62 100644 --- a/src/ChurchCRM/dto/SystemConfig.php +++ b/src/ChurchCRM/dto/SystemConfig.php @@ -265,6 +265,7 @@ private static function buildConfigs(): array 's2FAApplicationName' => new ConfigItem(2070, 's2FAApplicationName', 'text', gettext('ChurchCRM'), gettext('Specify the application name to be displayed in authenticator app')), 'bSendUserDeletedEmail' => new ConfigItem(2071, 'bSendUserDeletedEmail', 'boolean', '0', gettext('Send an email notifying users when their account has been deleted')), 'sGoogleMapsRenderKey' => new ConfigItem(2072, 'sGoogleMapsRenderKey', 'text', '', gettext('Google Maps API Key used for rendering maps in browser'), 'https://developers.google.com/maps/documentation/javascript/get-api-key'), + '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')), ]; } @@ -275,7 +276,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', 'iProfilePictureListSize', 'sNewPersonNotificationRecipientIDs', 'IncludeDataInNewPersonNotifications', 'sGreeterCustomMsg1', 'sGreeterCustomMsg2'], + gettext('People Setup') => ['sDirClassifications', 'sDirRoleHead', 'sDirRoleSpouse', 'sDirRoleChild', 'sDefaultCity', 'sDefaultState', 'sDefaultZip', 'sDefaultCountry', 'bShowFamilyData', 'bHidePersonAddress', 'bHideFriendDate', 'bHideFamilyNewsletter', 'bHideWeddingDate', 'bHideLatLon', 'bForceUppercaseZip', 'bEnableSelfRegistration', 'bAllowEmptyLastName', 'iPersonNameStyle', 'iProfilePictureListSize', 'sNewPersonNotificationRecipientIDs', 'IncludeDataInNewPersonNotifications', 'sGreeterCustomMsg1', 'sGreeterCustomMsg2', 'sInactiveClassification'], 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'], diff --git a/src/OptionManager.php b/src/OptionManager.php index 51fc2fa6db..ffdb1fe3cc 100644 --- a/src/OptionManager.php +++ b/src/OptionManager.php @@ -17,8 +17,10 @@ require 'Include/Functions.php'; use ChurchCRM\Authentication\AuthenticationManager; +use ChurchCRM\dto\SystemConfig; use ChurchCRM\model\ChurchCRM\ListOption; use ChurchCRM\Utils\InputUtils; +use ChurchCRM\Utils\LoggerUtils; use ChurchCRM\Utils\RedirectUtils; $mode = trim($_GET['mode']); @@ -313,6 +315,13 @@