From 4f06bc26147d1e0978d36c537a4f104cf2cfa3c3 Mon Sep 17 00:00:00 2001 From: Arun Philip Date: Wed, 8 May 2024 00:41:39 -0400 Subject: [PATCH 01/22] [rector] apply SetList::DEAD_CODE, better type checking (see msg) This commit includes a variety of changes that improve the codebase's quality and consistency. The following changes were made: - Replaced `==` with `===` for strict comparisons. - Removed redundant `break` statements after `return` in switch-case structures. - Fixed variable naming consistency and unnecessary variable assignments. - Simplified conditional statements and removed unused code. - Corrected minor typos and formatted code for better readability. - Enhanced type safety by casting variables explicitly and adding type hints. - Improved function and variable documentation with consistent comments. - Refactored repeated logic to improve maintainability. - Removed redundant checks for null values and unnecessary extractions. functions --- src/AddDonors.php | 2 +- .../Authentication/AuthenticationManager.php | 4 +- src/ChurchCRM/Backup/BackupDownloader.php | 3 - src/ChurchCRM/Backup/BackupJob.php | 31 +-- src/ChurchCRM/Backup/JobBase.php | 9 +- src/ChurchCRM/Backup/RestoreJob.php | 13 +- src/ChurchCRM/Bootstrapper.php | 4 +- src/ChurchCRM/Config/Menu/MenuItem.php | 3 - src/ChurchCRM/Dashboard/EventsMenuItems.php | 6 +- src/ChurchCRM/MICRFunctions.php | 2 +- src/ChurchCRM/Reports/ChurchInfoReport.php | 7 +- src/ChurchCRM/Reports/PDF_AddressReport.php | 3 - src/ChurchCRM/Reports/PDF_Attendance.php | 1 - src/ChurchCRM/SQLUtils.php | 2 - .../Search/BaseSearchResultProvider.php | 22 +- .../Search/FamilySearchResultProvider.php | 1 - src/ChurchCRM/Service/AppIntegrityService.php | 6 +- src/ChurchCRM/Service/DashboardService.php | 9 +- src/ChurchCRM/Service/FinancialService.php | 219 +----------------- src/ChurchCRM/Service/GroupService.php | 4 +- src/ChurchCRM/Service/SystemService.php | 2 +- src/ChurchCRM/Service/TimelineService.php | 10 +- src/ChurchCRM/Service/UpgradeService.php | 8 +- .../Slim/Middleware/AuthMiddleware.php | 2 +- .../SystemCalendars/AnniversariesCalendar.php | 4 +- .../SystemCalendars/BirthdaysCalendar.php | 6 +- .../SystemCalendars/HolidayCalendar.php | 9 +- .../SystemCalendars/SystemCalendar.php | 14 +- .../SystemCalendars/UnpinnedEvents.php | 14 +- src/ChurchCRM/data/States.php | 3 - src/ChurchCRM/dto/Cart.php | 7 +- src/ChurchCRM/dto/ChurchCRMReleaseManager.php | 2 - src/ChurchCRM/dto/ConfigItem.php | 4 +- src/ChurchCRM/dto/MenuEventsCount.php | 4 +- src/ChurchCRM/dto/Notification.php | 88 +++---- src/ChurchCRM/dto/PeopleCustomField.php | 9 - src/ChurchCRM/dto/Photo.php | 2 - src/ChurchCRM/dto/iCal.php | 3 +- src/ChurchCRM/model/ChurchCRM/Deposit.php | 22 +- src/ChurchCRM/model/ChurchCRM/Family.php | 14 +- .../model/ChurchCRM/KioskAssignment.php | 8 +- src/ChurchCRM/model/ChurchCRM/Person.php | 20 +- src/ChurchCRM/model/ChurchCRM/Pledge.php | 3 +- .../PHPPendingDeprecationVersionCheckTask.php | 2 - src/ChurchCRM/utils/ExecutionTime.php | 22 +- src/ChurchCRM/utils/InputUtils.php | 6 +- src/ChurchCRM/utils/MiscUtils.php | 4 +- src/FamilyCustomFieldsEditor.php | 4 +- src/FamilyEditor.php | 40 ++-- src/GroupPropsEditor.php | 2 +- src/GroupView.php | 4 +- src/Include/Functions.php | 109 +++------ src/Include/GetGroupArray.php | 15 -- src/ListEvents.php | 4 +- src/ManageEnvelopes.php | 40 ++-- src/NoteEditor.php | 2 +- src/PersonCustomFieldsEditor.php | 2 +- src/PersonEditor.php | 2 +- src/PersonView.php | 6 +- src/PrintView.php | 4 +- src/PropertyAssign.php | 2 +- src/QueryView.php | 2 +- src/Reports/ConfirmReport.php | 4 +- src/Reports/ConfirmReportEmail.php | 3 +- src/Reports/FamilyPledgeSummary.php | 16 +- src/Reports/FundRaiserStatement.php | 3 +- src/Reports/PDFLabel.php | 28 ++- src/Reports/PledgeSummary.php | 9 +- src/Reports/ReminderReport.php | 13 +- src/Reports/TaxReport.php | 3 +- src/Reports/VotingMembers.php | 2 +- src/Reports/ZeroGivers.php | 3 +- src/UserEditor.php | 12 +- src/api/routes/email/mailchimp.php | 4 +- src/eGive.php | 4 +- src/rector.php | 1 + src/v2/routes/people.php | 2 +- src/v2/templates/cart/cartempty.php | 4 +- src/v2/templates/people/person-list.php | 2 +- src/v2/templates/root/dashboard.php | 4 +- 80 files changed, 299 insertions(+), 699 deletions(-) diff --git a/src/AddDonors.php b/src/AddDonors.php index 0c64c3d57b..b69446cbc0 100644 --- a/src/AddDonors.php +++ b/src/AddDonors.php @@ -45,7 +45,7 @@ $sSQL = "SELECT pn_per_id FROM paddlenum_pn WHERE pn_per_id='$donorID' AND pn_FR_ID = '$iFundRaiserID'"; $rsBuyer = RunQuery($sSQL); - if ($donorID > 0 && mysqli_num_rows($rsBuyer) == 0) { + if ($donorID > 0 && mysqli_num_rows($rsBuyer) === 0) { $sSQL = "INSERT INTO paddlenum_pn (pn_Num, pn_fr_ID, pn_per_ID) VALUES ('$extraPaddleNum', '$iFundRaiserID', '$donorID')"; RunQuery($sSQL); diff --git a/src/ChurchCRM/Authentication/AuthenticationManager.php b/src/ChurchCRM/Authentication/AuthenticationManager.php index 3ea27810c1..73c4f3914f 100644 --- a/src/ChurchCRM/Authentication/AuthenticationManager.php +++ b/src/ChurchCRM/Authentication/AuthenticationManager.php @@ -61,9 +61,7 @@ public static function endSession(bool $preventRedirect = false): void $currentSessionUserName = 'Unknown'; try { - if (self::getCurrentUser() instanceof User) { - $currentSessionUserName = self::getCurrentUser()->getName(); - } + $currentSessionUserName = self::getCurrentUser()->getName(); } catch (\Exception $e) { //unable to get name of user logging out. Don't really care. } diff --git a/src/ChurchCRM/Backup/BackupDownloader.php b/src/ChurchCRM/Backup/BackupDownloader.php index 993c3b79f8..d1388cb1f5 100644 --- a/src/ChurchCRM/Backup/BackupDownloader.php +++ b/src/ChurchCRM/Backup/BackupDownloader.php @@ -32,9 +32,6 @@ public static function downloadBackup(string $filename): void $ext = strtolower($path_parts['extension']); switch ($ext) { case 'gz': - header('Content-type: application/x-gzip'); - header('Content-Disposition: attachment; filename="' . $path_parts['basename'] . '"'); - break; case 'tar.gz': header('Content-type: application/x-gzip'); header('Content-Disposition: attachment; filename="' . $path_parts['basename'] . '"'); diff --git a/src/ChurchCRM/Backup/BackupJob.php b/src/ChurchCRM/Backup/BackupJob.php index 427c41a46a..194c09bd0b 100644 --- a/src/ChurchCRM/Backup/BackupJob.php +++ b/src/ChurchCRM/Backup/BackupJob.php @@ -17,32 +17,13 @@ class BackupJob extends JobBase { private string $BackupFileBaseName; - private ?\SplFileInfo $BackupFile = null; - /** - * @var bool - */ - private $IncludeExtraneousFiles; - /** - * @var string - */ - public $BackupDownloadFileName; - /** - * @var bool - */ - public $shouldEncrypt; - - /** - * @var string - */ - public $BackupPassword; - - /** - * @param string $BaseName - * @param BackupType $BackupType - * @param bool $IncludeExtraneousFiles - */ - public function __construct(string $BaseName, $BackupType, $IncludeExtraneousFiles, $EncryptBackup, $BackupPassword) + private bool $IncludeExtraneousFiles; + public string $BackupDownloadFileName; + public bool $shouldEncrypt; + public string $BackupPassword; + + public function __construct(string $BaseName, string $BackupType, bool $IncludeExtraneousFiles, bool $EncryptBackup, string $BackupPassword) { $this->BackupType = $BackupType; $this->TempFolder = $this->createEmptyTempFolder(); diff --git a/src/ChurchCRM/Backup/JobBase.php b/src/ChurchCRM/Backup/JobBase.php index 92da13031b..c10d187064 100644 --- a/src/ChurchCRM/Backup/JobBase.php +++ b/src/ChurchCRM/Backup/JobBase.php @@ -8,13 +8,8 @@ class JobBase { - /** @var BackupType */ - protected $BackupType; - - /** - * @var string - */ - protected $TempFolder; + protected string $BackupType; + protected string $TempFolder; protected function createEmptyTempFolder(): string { diff --git a/src/ChurchCRM/Backup/RestoreJob.php b/src/ChurchCRM/Backup/RestoreJob.php index 24ca23bf00..73b95b56c8 100644 --- a/src/ChurchCRM/Backup/RestoreJob.php +++ b/src/ChurchCRM/Backup/RestoreJob.php @@ -9,6 +9,7 @@ use ChurchCRM\SQLUtils; use ChurchCRM\Utils\InputUtils; use ChurchCRM\Utils\LoggerUtils; +use Defuse\Crypto\Exception\WrongKeyOrModifiedCiphertextException; use Defuse\Crypto\File; use Exception; use PharData; @@ -17,15 +18,7 @@ class RestoreJob extends JobBase { private \SplFileInfo $RestoreFile; - - /** - * @var array - */ - public $Messages = []; - /** - * @var bool - */ - private $IsBackupEncrypted; + public array $Messages = []; private ?string $restorePassword = null; private function isIncomingFileFailed(): bool @@ -64,7 +57,7 @@ private function decryptBackup(): void File::decryptFileWithPassword($this->RestoreFile, $tempfile, $this->restorePassword); rename($tempfile, $this->RestoreFile); LoggerUtils::getAppLogger()->info('File decrypted'); - } catch (\Defuse\Crypto\Exception\WrongKeyOrModifiedCiphertextException $ex) { + } catch (WrongKeyOrModifiedCiphertextException $ex) { if ($ex->getMessage() == 'Bad version header.') { LoggerUtils::getAppLogger()->info("Bad version header; this file probably wasn't encrypted"); } else { diff --git a/src/ChurchCRM/Bootstrapper.php b/src/ChurchCRM/Bootstrapper.php index 4ff535efb9..ad21d69143 100644 --- a/src/ChurchCRM/Bootstrapper.php +++ b/src/ChurchCRM/Bootstrapper.php @@ -198,9 +198,9 @@ private static function isDatabaseEmpty(): bool $connection = Propel::getConnection(); $query = "SHOW TABLES FROM `" . self::$databaseName . "`"; $statement = $connection->prepare($query); - $resultset = $statement->execute(); + $statement->execute(); $results = $statement->fetchAll(\PDO::FETCH_ASSOC); - if (count($results) == 0) { + if (count($results) === 0) { self::$bootStrapLogger->debug("No database tables found"); return true; } diff --git a/src/ChurchCRM/Config/Menu/MenuItem.php b/src/ChurchCRM/Config/Menu/MenuItem.php index 2b73e45069..49081cdd48 100644 --- a/src/ChurchCRM/Config/Menu/MenuItem.php +++ b/src/ChurchCRM/Config/Menu/MenuItem.php @@ -65,9 +65,6 @@ public function getName() return $this->name; } - /** - * @return bool - */ public function isExternal(): bool { return $this->external; diff --git a/src/ChurchCRM/Dashboard/EventsMenuItems.php b/src/ChurchCRM/Dashboard/EventsMenuItems.php index ce19bbdfe4..5f319d91d7 100644 --- a/src/ChurchCRM/Dashboard/EventsMenuItems.php +++ b/src/ChurchCRM/Dashboard/EventsMenuItems.php @@ -17,13 +17,11 @@ public static function getDashboardItemName(): string public static function getDashboardItemValue(): array { - $activeEvents = [ + return [ 'Events' => self::getNumberEventsOfToday(), 'Birthdays' => self::getNumberBirthDates(), 'Anniversaries' => self::getNumberAnniversaries(), ]; - - return $activeEvents; } public static function shouldInclude(string $PageName): bool @@ -48,8 +46,6 @@ private static function getNumberBirthDates() ->filterByBirthMonth(date('m')) ->filterByBirthDay(date('d')) ->count(); - - return $peopleWithBirthDays; } private static function getNumberAnniversaries() diff --git a/src/ChurchCRM/MICRFunctions.php b/src/ChurchCRM/MICRFunctions.php index ceab2cd540..78e9c6ea4c 100644 --- a/src/ChurchCRM/MICRFunctions.php +++ b/src/ChurchCRM/MICRFunctions.php @@ -78,7 +78,7 @@ public function findRouteAndAccount($micr) } } - public function findCheckNo($micr) + public function findCheckNo($micr): string { $formatID = $this->identifyFormat($micr); if ($formatID == $this->CHECKNO_FIRST) { diff --git a/src/ChurchCRM/Reports/ChurchInfoReport.php b/src/ChurchCRM/Reports/ChurchInfoReport.php index 30c028d211..a991eeb8d9 100644 --- a/src/ChurchCRM/Reports/ChurchInfoReport.php +++ b/src/ChurchCRM/Reports/ChurchInfoReport.php @@ -51,7 +51,6 @@ public function printRightJustified($x, $y, $str): void public function printRightJustifiedCell($x, $y, $wid, $str): void { $strconv = iconv('UTF-8', 'ISO-8859-1', $str); - $iLen = strlen($strconv); $this->SetXY($x, $y); $this->Cell($wid, SystemConfig::getValue('incrementY'), $strconv, 1, 0, 'R'); } @@ -59,7 +58,6 @@ public function printRightJustifiedCell($x, $y, $wid, $str): void public function printCenteredCell($x, $y, $wid, $str): void { $strconv = iconv('UTF-8', 'ISO-8859-1', $str); - $iLen = strlen($strconv); $this->SetXY($x, $y); $this->Cell($wid, SystemConfig::getValue('incrementY'), $strconv, 1, 0, 'C'); } @@ -119,10 +117,9 @@ public function startLetterPage($fam_ID, $fam_Name, $fam_Address1, $fam_Address2 if ($fam_Country != '' && $fam_Country != SystemConfig::getValue('sDefaultCountry')) { $this->writeAt(SystemConfig::getValue('leftX'), $curY, $fam_Country); $curY += SystemConfig::getValue('incrementY'); - } - $curY += 5.0; // mm to get away from the second window + } // mm to get away from the second window - return $curY; + return $curY + 5.0; } public function makeSalutation($famID): string diff --git a/src/ChurchCRM/Reports/PDF_AddressReport.php b/src/ChurchCRM/Reports/PDF_AddressReport.php index 63ab79704c..a30e697121 100644 --- a/src/ChurchCRM/Reports/PDF_AddressReport.php +++ b/src/ChurchCRM/Reports/PDF_AddressReport.php @@ -9,10 +9,7 @@ class PdfAddressReport extends ChurchInfoReport private int $_Margin_Top = 12; // Top margin private int $_Char_Size = 12; // Character size private int $_CurLine = 2; - private int $_Column = 0; private string $_Font = 'Times'; - private $sFamily; - private $sLastName; private function numLinesInFpdfCell(int $w, $txt): int { diff --git a/src/ChurchCRM/Reports/PDF_Attendance.php b/src/ChurchCRM/Reports/PDF_Attendance.php index 0652780a0d..071f15341b 100644 --- a/src/ChurchCRM/Reports/PDF_Attendance.php +++ b/src/ChurchCRM/Reports/PDF_Attendance.php @@ -45,7 +45,6 @@ public function drawAttendanceCalendar( } $yTitle = 20; - $yTeachers = $yTitle + $yIncrement; $nameX = 10 + $yIncrement / 2; $numMembers = 0; $aNameCount = 0; diff --git a/src/ChurchCRM/SQLUtils.php b/src/ChurchCRM/SQLUtils.php index 56baa39995..a732d173c3 100644 --- a/src/ChurchCRM/SQLUtils.php +++ b/src/ChurchCRM/SQLUtils.php @@ -119,8 +119,6 @@ private static function clearSQL($sql, &$isMultiComment) * * @param int $offset * @param string $text - * - * @return bool */ private static function isQuoted($offset, $text): bool { diff --git a/src/ChurchCRM/Search/BaseSearchResultProvider.php b/src/ChurchCRM/Search/BaseSearchResultProvider.php index d098b27e2f..c1639e67ea 100644 --- a/src/ChurchCRM/Search/BaseSearchResultProvider.php +++ b/src/ChurchCRM/Search/BaseSearchResultProvider.php @@ -4,28 +4,20 @@ abstract class BaseSearchResultProvider { - /* @var string */ - protected $pluralNoun; - /* @var ChurchCRM\Search\SearchResult[] */ - protected $searchResults = []; + protected string $pluralNoun; + + /* @var SearchResult[] */ + protected array $searchResults = []; abstract public function getSearchResults(string $SearchQuery); - protected function formatSearchGroup() + protected function formatSearchGroup(): SearchResultGroup { - if (!empty($this->searchResults)) { - return new SearchResultGroup(gettext($this->pluralNoun) . ' (' . count($this->searchResults) . ')', $this->searchResults); - } - - return []; + return new SearchResultGroup(gettext($this->pluralNoun) . ' (' . count($this->searchResults) . ')', $this->searchResults); } - protected function addSearchResults(array $results) + protected function addSearchResults(array $results): void { $this->searchResults = array_merge($this->searchResults, $results); } - - protected function __construct() - { - } } diff --git a/src/ChurchCRM/Search/FamilySearchResultProvider.php b/src/ChurchCRM/Search/FamilySearchResultProvider.php index bb28b09190..3087233aa3 100644 --- a/src/ChurchCRM/Search/FamilySearchResultProvider.php +++ b/src/ChurchCRM/Search/FamilySearchResultProvider.php @@ -18,7 +18,6 @@ public function __construct() public function getSearchResults(string $SearchQuery) { - $searchResults = []; if (SystemConfig::getBooleanValue('bSearchIncludeFamilies')) { $this->addSearchResults($this->getFamilySearchResultsByPartialName($SearchQuery)); } diff --git a/src/ChurchCRM/Service/AppIntegrityService.php b/src/ChurchCRM/Service/AppIntegrityService.php index 6b0dc54158..60da47956b 100644 --- a/src/ChurchCRM/Service/AppIntegrityService.php +++ b/src/ChurchCRM/Service/AppIntegrityService.php @@ -184,8 +184,8 @@ private static function verifyDirectoryWriteable(string $path): bool */ public static function getApplicationPrerequisites(): array { - $prerequisites = [ - new Prerequisite('PHP 8.1+', fn () => version_compare(PHP_VERSION, '8.1.0', '>=')), + return [ + new Prerequisite('PHP 8.1+', fn (): bool => version_compare(PHP_VERSION, '8.1.0', '>=')), new Prerequisite('PCRE and UTF-8 Support', fn (): bool => function_exists('preg_match') && @preg_match('/^.$/u', 'ñ') && @preg_match('/^\pL$/u', 'ñ')), new Prerequisite('Multibyte Encoding', fn (): bool => extension_loaded('mbstring')), new Prerequisite('PHP Phar', fn (): bool => extension_loaded('phar')), @@ -206,8 +206,6 @@ public static function getApplicationPrerequisites(): array new Prerequisite('PHP ZipArchive', fn (): bool => extension_loaded('zip')), new Prerequisite('Mysqli Functions', fn (): bool => function_exists('mysqli_connect')), ]; - - return $prerequisites; } /** diff --git a/src/ChurchCRM/Service/DashboardService.php b/src/ChurchCRM/Service/DashboardService.php index 3c57d7d204..dc4202b38c 100644 --- a/src/ChurchCRM/Service/DashboardService.php +++ b/src/ChurchCRM/Service/DashboardService.php @@ -34,9 +34,8 @@ public function getFamilyCount(): array $familyCount = FamilyQuery::Create() ->filterByDateDeactivated() ->count(); - $data = ['familyCount' => $familyCount]; - return $data; + return ['familyCount' => $familyCount]; } public function getPersonCount(): array @@ -46,9 +45,8 @@ public function getPersonCount(): array ->filterByDateDeactivated(null) ->endUse() ->count(); - $data = ['personCount' => $personCount]; - return $data; + return ['personCount' => $personCount]; } /** @@ -93,9 +91,8 @@ public function getGroupStats(): array '; $rsQuickStat = RunQuery($sSQL); $row = mysqli_fetch_array($rsQuickStat); - $data = ['groups' => $row['Group_cnt'], 'sundaySchoolClasses' => $row['SundaySchoolClasses'], 'sundaySchoolkids' => $row['SundaySchoolKidsCount']]; - return $data; + return ['groups' => $row['Group_cnt'], 'sundaySchoolClasses' => $row['SundaySchoolClasses'], 'sundaySchoolkids' => $row['SundaySchoolKidsCount']]; } /** diff --git a/src/ChurchCRM/Service/FinancialService.php b/src/ChurchCRM/Service/FinancialService.php index df00e2bc10..418d75338d 100644 --- a/src/ChurchCRM/Service/FinancialService.php +++ b/src/ChurchCRM/Service/FinancialService.php @@ -175,9 +175,9 @@ private function validateFund(array $payment): void //If a single fund is selected, that fund must exist, and not equal the default "Select a Fund" selection. //If a split is selected, at least one fund must be non-zero, the total must add up to the total of all funds, and all funds in the split must be valid funds. $FundSplit = $payment['FundSplit']; - if (count($FundSplit) >= 1 && $FundSplit[0]->FundID != 'None') { // split + if (count($FundSplit) >= 1 && $FundSplit[0]->FundID !== 'None') { // split $nonZeroFundAmountEntered = 0; - foreach ($FundSplit as $fun_id => $fund) { + foreach ($FundSplit as $fund) { //$fun_active = $fundActive[$fun_id]; if ($fund->Amount > 0) { $nonZeroFundAmountEntered++; @@ -234,10 +234,8 @@ public function processCurrencyDenominations($payment, string $groupKey): void foreach ($currencyDenoms as $cdom) { $sSQL = "INSERT INTO pledge_denominations_pdem (pdem_plg_GroupKey, plg_depID, pdem_denominationID, pdem_denominationQuantity) VALUES ('" . $groupKey . "','" . $payment->DepositID . "','" . $cdom->currencyID . "','" . $cdom->Count . "')"; - if (isset($sSQL)) { - RunQuery($sSQL); - unset($sSQL); - } + RunQuery($sSQL); + unset($sSQL); } } @@ -344,209 +342,6 @@ public function getPledgeorPayment(string $GroupKey): string return json_encode($payment, JSON_THROW_ON_ERROR); } - private function generateBankDepositSlip($thisReport): void - { - // -------------------------------- - // BEGIN FRONT OF BANK DEPOSIT SLIP - $thisReport->pdf->addPage('L', [187, 84]); - $thisReport->pdf->SetFont('Courier', '', 18); - // Print Deposit Slip portion of report - - $thisReport->pdf->SetXY($thisReport->date1X, $thisReport->date1Y); - $thisReport->pdf->Write(8, $thisReport->deposit->dep_Date); - - $thisReport->pdf->SetXY($thisReport->customerName1X, $thisReport->customerName1Y); - $thisReport->pdf->Write(8, SystemConfig::getValue('sChurchName')); - - $thisReport->pdf->SetXY($thisReport->AccountNumberX, $thisReport->AccountNumberY); - $thisReport->pdf->Cell(55, 7, SystemConfig::getValue('sChurchChkAcctNum'), 1, 1, 'R'); - - if ($thisReport->deposit->totalCash > 0) { - $totalCashStr = sprintf('%.2f', $thisReport->deposit->totalCash); - $thisReport->pdf->SetXY($thisReport->cashX, $thisReport->cashY); - $thisReport->pdf->Cell(46, 7, $totalCashStr, 1, 1, 'R'); - } - - if ($thisReport->deposit->totalChecks > 0) { - $totalChecksStr = sprintf('%.2f', $thisReport->deposit->totalChecks); - $thisReport->pdf->SetXY($thisReport->checksX, $thisReport->checksY); - $thisReport->pdf->Cell(46, 7, $totalChecksStr, 1, 1, 'R'); - } - - $grandTotalStr = sprintf('%.2f', $thisReport->deposit->dep_Total); - $cashReceivedStr = sprintf('%.2f', 0); - - $thisReport->pdf->SetXY($thisReport->cashReceivedX, $thisReport->cashReceivedY); - $thisReport->pdf->Cell(46, 7, $cashReceivedStr, 1, 1, 'R'); - - $thisReport->pdf->SetXY($thisReport->topTotalX, $thisReport->topTotalY); - $thisReport->pdf->Cell(46, 7, $grandTotalStr, 1, 1, 'R'); - - // -------------------------------- - // BEGIN BACK OF BANK DEPOSIT SLIP - - $thisReport->pdf->addPage('P', [84, 187]); - $numItems = 0; - foreach ($thisReport->payments as $payment) { - // List all the checks and total the cash - if ($payment->plg_method === 'CHECK') { - $plgSumStr = sprintf('%.2f', $payment->plg_amount); - $thisReport->pdf->SetFontSize(14); - $thisReport->pdf->SetXY($thisReport->depositSlipBackCheckNosX, $thisReport->depositSlipBackCheckNosY + $numItems * $thisReport->depositSlipBackCheckNosHeight); - $thisReport->pdf->Cell($thisReport->depositSlipBackCheckNosWidth, $thisReport->depositSlipBackCheckNosHeight, $payment->plg_CheckNo, 1, 0, 'L'); - $thisReport->pdf->SetFontSize(18); - $thisReport->pdf->Cell($thisReport->depositSlipBackDollarsWidth, $thisReport->depositSlipBackDollarsHeight, $plgSumStr, 1, 1, 'R'); - $numItems += 1; - } - } - } - - private function generateDepositSummary($thisReport): void - { - $thisReport->depositSummaryParameters = new \stdClass(); - - $thisReport->depositSummaryParameters->title = new \stdClass(); - $thisReport->depositSummaryParameters->title->x = 85; - $thisReport->depositSummaryParameters->title->y = 7; - - $thisReport->depositSummaryParameters->date = new \stdClass(); - $thisReport->depositSummaryParameters->date->x = 185; - $thisReport->depositSummaryParameters->date->y = 7; - - $thisReport->depositSummaryParameters->summary = new \stdClass(); - $thisReport->depositSummaryParameters->summary->x = 12; - $thisReport->depositSummaryParameters->summary->y = 15; - $thisReport->depositSummaryParameters->summary->intervalY = 4; - $thisReport->depositSummaryParameters->summary->FundX = 15; - $thisReport->depositSummaryParameters->summary->MethodX = 55; - $thisReport->depositSummaryParameters->summary->FromX = 80; - $thisReport->depositSummaryParameters->summary->MemoX = 120; - $thisReport->depositSummaryParameters->summary->AmountX = 185; - - $thisReport->depositSummaryParameters->aggregateX = 135; - $thisReport->depositSummaryParameters->displayBillCounts = false; - - $thisReport->pdf->addPage(); - $thisReport->pdf->SetXY($thisReport->depositSummaryParameters->date->x, $thisReport->depositSummaryParameters->date->y); - $thisReport->pdf->Write(8, $thisReport->deposit->dep_Date); - - $thisReport->pdf->SetXY($thisReport->depositSummaryParameters->title->x, $thisReport->depositSummaryParameters->title->y); - $thisReport->pdf->SetFont('Courier', 'B', 20); - $thisReport->pdf->Write(8, 'Deposit Summary ' . $thisReport->deposit->dep_ID); - $thisReport->pdf->SetFont('Times', 'B', 10); - - $thisReport->curX = $thisReport->depositSummaryParameters->summary->x; - $thisReport->curY = $thisReport->depositSummaryParameters->summary->y; - - $thisReport->pdf->SetFont('Times', 'B', 10); - $thisReport->pdf->SetXY($thisReport->curX, $thisReport->curY); - $thisReport->pdf->Write(8, 'Chk No.'); - - $thisReport->pdf->SetXY($thisReport->curX + $thisReport->depositSummaryParameters->summary->FundX, $thisReport->curY); - $thisReport->pdf->Write(8, 'Fund'); - - $thisReport->pdf->SetXY($thisReport->curX + $thisReport->depositSummaryParameters->summary->MethodX, $thisReport->curY); - $thisReport->pdf->Write(8, 'PmtMethod'); - - $thisReport->pdf->SetXY($thisReport->curX + $thisReport->depositSummaryParameters->summary->FromX, $thisReport->curY); - $thisReport->pdf->Write(8, 'Rcd From'); - - $thisReport->pdf->SetXY($thisReport->curX + $thisReport->depositSummaryParameters->summary->MemoX, $thisReport->curY); - $thisReport->pdf->Write(8, 'Memo'); - - $thisReport->pdf->SetXY($thisReport->curX + $thisReport->depositSummaryParameters->summary->AmountX, $thisReport->curY); - $thisReport->pdf->Write(8, 'Amount'); - $thisReport->curY += 2 * $thisReport->depositSummaryParameters->summary->intervalY; - - $totalAmount = 0; - - //while ($aRow = mysqli_fetch_array($rsPledges)) - foreach ($thisReport->payments as $payment) { - $thisReport->pdf->SetFont('Times', '', 10); - - // Format Data - if (strlen($payment->plg_CheckNo) > 8) { - $payment->plg_CheckNo = '...' . mb_substr($payment->plg_CheckNo, -8, 8); - } - if (strlen($payment->fun_Name) > 20) { - $payment->fun_Name = mb_substr($payment->fun_Name, 0, 20) . '...'; - } - if (strlen($payment->plg_comment) > 40) { - $payment->plg_comment = mb_substr($payment->plg_comment, 0, 38) . '...'; - } - if (strlen($payment->familyName) > 25) { - $payment->familyName = mb_substr($payment->familyName, 0, 24) . '...'; - } - - $thisReport->pdf->printRightJustified($thisReport->curX + 2, $thisReport->curY, $payment->plg_CheckNo); - - $thisReport->pdf->SetXY($thisReport->curX + $thisReport->depositSummaryParameters->summary->FundX, $thisReport->curY); - $thisReport->pdf->Write(8, $payment->fun_Name); - - $thisReport->pdf->SetXY($thisReport->curX + $thisReport->depositSummaryParameters->summary->MethodX, $thisReport->curY); - $thisReport->pdf->Write(8, $payment->plg_method); - - $thisReport->pdf->SetXY($thisReport->curX + $thisReport->depositSummaryParameters->summary->FromX, $thisReport->curY); - $thisReport->pdf->Write(8, $payment->familyName); - - $thisReport->pdf->SetXY($thisReport->curX + $thisReport->depositSummaryParameters->summary->MemoX, $thisReport->curY); - $thisReport->pdf->Write(8, $payment->plg_comment); - - $thisReport->pdf->SetFont('Courier', '', 8); - - $thisReport->pdf->printRightJustified($thisReport->curX + $thisReport->depositSummaryParameters->summary->AmountX, $thisReport->curY, $payment->plg_amount); - - $thisReport->curY += $thisReport->depositSummaryParameters->summary->intervalY; - - if ($thisReport->curY >= 250) { - $thisReport->pdf->addPage(); - $thisReport->curY = $thisReport->topY; - } - } - - $thisReport->curY += $thisReport->depositSummaryParameters->summary->intervalY; - - $thisReport->pdf->SetXY($thisReport->curX + $thisReport->depositSummaryParameters->summary->MemoX, $thisReport->curY); - $thisReport->pdf->Write(8, 'Deposit total'); - - $grandTotalStr = sprintf('%.2f', $thisReport->deposit->dep_Total); - $thisReport->pdf->printRightJustified($thisReport->curX + $thisReport->depositSummaryParameters->summary->AmountX, $thisReport->curY, $grandTotalStr); - - // Now print deposit totals by fund - $thisReport->curY += 2 * $thisReport->depositSummaryParameters->summary->intervalY; - if ($thisReport->depositSummaryParameters->displayBillCounts) { - $this->generateCashDenominations($thisReport); - } - $thisReport->curX = $thisReport->depositSummaryParameters->aggregateX; - $this->generateTotalsByFund($thisReport); - - $thisReport->curY += $thisReport->summaryIntervalY; - $this->generateTotalsByCurrencyType($thisReport); - $thisReport->curY += $thisReport->summaryIntervalY * 2; - - $thisReport->curY += 130; - $thisReport->curX = $thisReport->depositSummaryParameters->summary->x; - - $this->generateWitnessSignature($thisReport); - } - - private function generateWitnessSignature($thisReport): void - { - $thisReport->pdf->setXY($thisReport->curX, $thisReport->curY); - $thisReport->pdf->write(8, 'Witness 1'); - $thisReport->pdf->line($thisReport->curX + 17, $thisReport->curY + 8, $thisReport->curX + 80, $thisReport->curY + 8); - - $thisReport->curY += 10; - $thisReport->pdf->setXY($thisReport->curX, $thisReport->curY); - $thisReport->pdf->write(8, 'Witness 2'); - $thisReport->pdf->line($thisReport->curX + 17, $thisReport->curY + 8, $thisReport->curX + 80, $thisReport->curY + 8); - - $thisReport->curY += 10; - $thisReport->pdf->setXY($thisReport->curX, $thisReport->curY); - $thisReport->pdf->write(8, 'Witness 3'); - $thisReport->pdf->line($thisReport->curX + 17, $thisReport->curY + 8, $thisReport->curX + 80, $thisReport->curY + 8); - } - public function getDepositPDF($depID): void { } @@ -556,9 +351,8 @@ public function getDepositCSV(string $depID): \stdClass requireUserGroupMembership('bFinance'); $retstring = ''; $line = []; - $firstLine = true; $payments = $this->getPayments($depID); - if (count($payments) == 0) { + if (count($payments) === 0) { throw new \Exception('No Payments on this Deposit', 404); } foreach ($payments[0] as $key => $value) { @@ -567,7 +361,7 @@ public function getDepositCSV(string $depID): \stdClass $retstring = implode(',', $line) . "\n"; foreach ($payments as $payment) { $line = []; - foreach ($payment as $key => $value) { + foreach ($payment as $value) { $line[] = str_replace(',', '', $value); } $retstring .= implode(',', $line) . "\n"; @@ -583,7 +377,6 @@ public function getDepositCSV(string $depID): \stdClass public function getCurrencyTypeOnDeposit(string $currencyID, string $depositID) { - $currencies = []; // Get the list of Currency denominations $sSQL = 'select sum(pdem_denominationQuantity) from pledge_denominations_pdem where plg_depID = ' . $depositID . ' diff --git a/src/ChurchCRM/Service/GroupService.php b/src/ChurchCRM/Service/GroupService.php index 86203483dd..a28f49a1b3 100644 --- a/src/ChurchCRM/Service/GroupService.php +++ b/src/ChurchCRM/Service/GroupService.php @@ -121,7 +121,7 @@ public function getGroupRoles($groupID): array $rsList = RunQuery($sSQL); // Validate that this list ID is really for a group roles list. (for security) - if (mysqli_num_rows($rsList) == 0) { + if (mysqli_num_rows($rsList) === 0) { throw new \Exception('invalid request'); } @@ -158,7 +158,7 @@ public function getGroupRoleOrder(string $groupID, string $groupRoleID) return $rowOrder[0]; } - public function deleteGroupRole(string $groupID, string $groupRoleID) + public function deleteGroupRole(string $groupID, string $groupRoleID): array { requireUserGroupMembership('bManageGroups'); $sSQL = 'SELECT * FROM list_lst diff --git a/src/ChurchCRM/Service/SystemService.php b/src/ChurchCRM/Service/SystemService.php index 1c05ab799e..308e900641 100644 --- a/src/ChurchCRM/Service/SystemService.php +++ b/src/ChurchCRM/Service/SystemService.php @@ -76,7 +76,7 @@ public static function getPrerequisiteStatus(): string } else { $unmet = AppIntegrityService::getUnmetPrerequisites(); - $unmetNames = array_map(fn ($o): string => (string) $o->getName(), $unmet); + $unmetNames = array_map(fn ($o): string => $o->getName(), $unmet); return 'Missing Prerequisites: ' . json_encode(array_values($unmetNames), JSON_THROW_ON_ERROR); } diff --git a/src/ChurchCRM/Service/TimelineService.php b/src/ChurchCRM/Service/TimelineService.php index d1c24eb177..845bd7ec87 100644 --- a/src/ChurchCRM/Service/TimelineService.php +++ b/src/ChurchCRM/Service/TimelineService.php @@ -36,7 +36,7 @@ public function getForFamily(int $familyID): array krsort($timeline); $sortedTimeline = []; - foreach ($timeline as $date => $item) { + foreach ($timeline as $item) { $sortedTimeline[] = $item; } @@ -99,7 +99,7 @@ private function sortTimeline(array $timeline): array krsort($timeline); $sortedTimeline = []; - foreach ($timeline as $date => $item) { + foreach ($timeline as $item) { $sortedTimeline[] = $item; } @@ -124,8 +124,6 @@ public function getForPerson(int $personID): array } /** - * @param Note $dbNote - * * @return mixed|null */ public function noteToTimelineItem(Note $dbNote) @@ -180,11 +178,7 @@ public function createTimeLineItem(string $id, $type, string $datetime, $year, $ $item['style'] = 'fa-calendar bg-green'; break; case 'verify': - $item['style'] = 'fa-circle-check bg-teal'; - break; case 'verify-link': - $item['style'] = 'fa-circle-check bg-teal'; - break; case 'verify-URL': $item['style'] = 'fa-circle-check bg-teal'; break; diff --git a/src/ChurchCRM/Service/UpgradeService.php b/src/ChurchCRM/Service/UpgradeService.php index cd9a86c541..8369f1991b 100644 --- a/src/ChurchCRM/Service/UpgradeService.php +++ b/src/ChurchCRM/Service/UpgradeService.php @@ -66,11 +66,9 @@ public static function upgradeDatabaseVersion() throw new \Exception("Invalid upgrade file specified: $scriptName"); } } - if (!$errorFlag) { - $version->setUpdateEnd(new \DateTimeImmutable()); - $version->save(); - sleep(2); - } + $version->setUpdateEnd(new \DateTimeImmutable()); + $version->save(); + sleep(2); // increment the number of scripts executed. // If no scripts run, then there is no supported upgrade path defined in the JSON file diff --git a/src/ChurchCRM/Slim/Middleware/AuthMiddleware.php b/src/ChurchCRM/Slim/Middleware/AuthMiddleware.php index 21a74ef01b..5c40f6687e 100644 --- a/src/ChurchCRM/Slim/Middleware/AuthMiddleware.php +++ b/src/ChurchCRM/Slim/Middleware/AuthMiddleware.php @@ -39,7 +39,7 @@ public function __invoke(Request $request, RequestHandler $handler): Response private function isPath(Request $request, string $pathPart): bool { $pathAry = explode('/', $request->getUri()->getPath()); - if (!empty($pathAry) && $pathAry[0] === $pathPart) { + if ($pathAry[0] === $pathPart) { return true; } diff --git a/src/ChurchCRM/SystemCalendars/AnniversariesCalendar.php b/src/ChurchCRM/SystemCalendars/AnniversariesCalendar.php index 79b3c036d7..1103523828 100644 --- a/src/ChurchCRM/SystemCalendars/AnniversariesCalendar.php +++ b/src/ChurchCRM/SystemCalendars/AnniversariesCalendar.php @@ -39,7 +39,7 @@ public function getName(): string return gettext('Anniversaries'); } - public function getEvents(string $start, string $end) + public function getEvents(string $start, string $end): ObjectCollection { $families = FamilyQuery::create() ->filterByWeddingdate('', Criteria::NOT_EQUAL) @@ -48,7 +48,7 @@ public function getEvents(string $start, string $end) return $this->familyCollectionToEvents($families); } - public function getEventById(int $Id) + public function getEventById(int $Id): ObjectCollection { $families = FamilyQuery::create() ->filterByWeddingdate('', Criteria::NOT_EQUAL) diff --git a/src/ChurchCRM/SystemCalendars/BirthdaysCalendar.php b/src/ChurchCRM/SystemCalendars/BirthdaysCalendar.php index be8a48b189..e750975844 100644 --- a/src/ChurchCRM/SystemCalendars/BirthdaysCalendar.php +++ b/src/ChurchCRM/SystemCalendars/BirthdaysCalendar.php @@ -39,7 +39,7 @@ public function getName(): string return gettext('Birthdays'); } - public function getEvents(string $start, string $end) + public function getEvents(string $start, string $end): ObjectCollection { $people = PersonQuery::create() ->filterByBirthDay('', Criteria::NOT_EQUAL) @@ -48,7 +48,7 @@ public function getEvents(string $start, string $end) return $this->peopleCollectionToEvents($people); } - public function getEventById(int $Id) + public function getEventById(int $Id): ObjectCollection { $people = PersonQuery::create() ->filterByBirthDay('', Criteria::NOT_EQUAL) @@ -63,7 +63,7 @@ private function peopleCollectionToEvents(ObjectCollection $People): ObjectColle $events = new ObjectCollection(); $events->setModel(Event::class); foreach ($People as $person) { - for ($year = date('Y'); $year <= date('Y') + 1; $year++) { + for ($year = (int) date('Y'); $year <= (int) date('Y') + 1; $year++) { $birthday = new Event(); $birthday->setId($person->getId()); $birthday->setEditable(false); diff --git a/src/ChurchCRM/SystemCalendars/HolidayCalendar.php b/src/ChurchCRM/SystemCalendars/HolidayCalendar.php index 152eb8acb0..cd1bcb4d35 100644 --- a/src/ChurchCRM/SystemCalendars/HolidayCalendar.php +++ b/src/ChurchCRM/SystemCalendars/HolidayCalendar.php @@ -47,7 +47,7 @@ public function getName(): string return gettext('Holidays'); } - public function getEvents(string $start, string $end) + public function getEvents(string $start, string $end): ObjectCollection { $Country = Countries::getCountryByName(SystemConfig::getValue('sChurchCountry')); $year = date('Y'); @@ -63,9 +63,12 @@ public function getEvents(string $start, string $end) return $events; } - public function getEventById(int $Id) + public function getEventById(int $Id): ObjectCollection { - return false; + $emptySet = new ObjectCollection(); + $emptySet->setModel(Event::class); + + return $emptySet; } private function yasumiHolidayToEvent(Holiday $holiday): Event diff --git a/src/ChurchCRM/SystemCalendars/SystemCalendar.php b/src/ChurchCRM/SystemCalendars/SystemCalendar.php index 5e20bd39e0..28b5857241 100644 --- a/src/ChurchCRM/SystemCalendars/SystemCalendar.php +++ b/src/ChurchCRM/SystemCalendars/SystemCalendar.php @@ -17,17 +17,9 @@ public function getForegroundColor(): string; public function getBackgroundColor(): string; - /** - * @return ObjectCollection|array - */ - public function getEvents(string $start, string $end); - - /** - * TODO: this seems wrong. please fix this. - * - * @return ObjectCollection|array|Event|false - */ - public function getEventById(int $Id); + public function getEvents(string $start, string $end): ObjectCollection; + + public function getEventById(int $Id): ObjectCollection; public static function isAvailable(): bool; } diff --git a/src/ChurchCRM/SystemCalendars/UnpinnedEvents.php b/src/ChurchCRM/SystemCalendars/UnpinnedEvents.php index 64570ced6c..3bbc7459c4 100644 --- a/src/ChurchCRM/SystemCalendars/UnpinnedEvents.php +++ b/src/ChurchCRM/SystemCalendars/UnpinnedEvents.php @@ -38,24 +38,20 @@ public function getName(): string return gettext('Unpinned Events'); } - public function getEvents(string $start, string $end) + public function getEvents(string $start, string $end): ObjectCollection { - $Events = EventQuery::create() + return EventQuery::create() ->filterByStart(['min' => $start]) ->filterByEnd(['max' => $end]) ->useCalendarEventQuery(null, Criteria::LEFT_JOIN) ->filterByCalendarId(null) ->endUse() ->find(); - - return $Events; } - public function getEventById(int $Id) + public function getEventById(int $Id): ObjectCollection { - $Event = EventQuery::create() - ->findOneById($Id); - - return $Event; + return EventQuery::create() + ->findById($Id); } } diff --git a/src/ChurchCRM/data/States.php b/src/ChurchCRM/data/States.php index 1b10a88425..3a340b9844 100644 --- a/src/ChurchCRM/data/States.php +++ b/src/ChurchCRM/data/States.php @@ -7,13 +7,10 @@ class States { - private string $countryCode; private array $states = []; public function __construct(string $countryCode) { - $this->countryCode = $countryCode; - $stateFileName = SystemURLs::getDocumentRoot() . '/locale/states/' . $countryCode . '.json'; if (is_file($stateFileName)) { $statesFile = file_get_contents($stateFileName); diff --git a/src/ChurchCRM/dto/Cart.php b/src/ChurchCRM/dto/Cart.php index f1d7f920d7..e11b7ce113 100644 --- a/src/ChurchCRM/dto/Cart.php +++ b/src/ChurchCRM/dto/Cart.php @@ -180,11 +180,9 @@ public static function emptyToGroup($GroupID, $RoleID): void public static function getCartPeople() { - $people = PersonQuery::create() + return PersonQuery::create() ->filterById($_SESSION['aPeopleCart']) ->find(); - - return $people; } public static function getEmailLink(): string @@ -216,9 +214,8 @@ public static function getSMSLink(): string $SMSNumberArray[] = $cartPerson->getCellPhone(); } } - $sSMSLink = implode(',', $SMSNumberArray); - return $sSMSLink; + return implode(',', $SMSNumberArray); } public static function emptyAll(): void diff --git a/src/ChurchCRM/dto/ChurchCRMReleaseManager.php b/src/ChurchCRM/dto/ChurchCRMReleaseManager.php index 43b0ac814f..5f739b6cc9 100644 --- a/src/ChurchCRM/dto/ChurchCRMReleaseManager.php +++ b/src/ChurchCRM/dto/ChurchCRMReleaseManager.php @@ -295,7 +295,5 @@ public static function doUpgrade(string $zipFilename, string $sha1): void $logger->info('Upgrade process complete'); ini_set('display_errors', $displayErrors); self::$isUpgradeInProgress = false; - - return; } } diff --git a/src/ChurchCRM/dto/ConfigItem.php b/src/ChurchCRM/dto/ConfigItem.php index c8b233c9c1..a8944f5901 100644 --- a/src/ChurchCRM/dto/ConfigItem.php +++ b/src/ChurchCRM/dto/ConfigItem.php @@ -15,8 +15,8 @@ class ConfigItem private $url; private $data; private $dbConfigItem; - private $section = null; - private $category = null; + private $section; + private $category; public function __construct($id, $name, $type, $default, $tooltip = '', $url = '', $data = '') { diff --git a/src/ChurchCRM/dto/MenuEventsCount.php b/src/ChurchCRM/dto/MenuEventsCount.php index 318d1094ef..d70c0c29c9 100644 --- a/src/ChurchCRM/dto/MenuEventsCount.php +++ b/src/ChurchCRM/dto/MenuEventsCount.php @@ -20,12 +20,10 @@ class MenuEventsCount { public static function getBirthDates() { - $peopleWithBirthDays = PersonQuery::create() + return PersonQuery::create() ->filterByBirthMonth(date('m')) ->filterByBirthDay(date('d')) ->find(); - - return $peopleWithBirthDays; } /** diff --git a/src/ChurchCRM/dto/Notification.php b/src/ChurchCRM/dto/Notification.php index 263b38ef41..79e4b303b0 100644 --- a/src/ChurchCRM/dto/Notification.php +++ b/src/ChurchCRM/dto/Notification.php @@ -9,11 +9,11 @@ class Notification { - protected $projectorText; - protected $recipients; + protected string $projectorText; + protected array $recipients; protected ?Person $person = null; - public function setRecipients($recipients): void + public function setRecipients(array $recipients): void { $this->recipients = $recipients; } @@ -36,72 +36,74 @@ public function setProjectorText(string $text): void $this->projectorText = $text; } - private function sendEmail() + private function sendEmail(): bool { $emailaddresses = []; foreach ($this->recipients as $recipient) { $emailaddresses[] = $recipient->getEmail(); } - try { - $email = new NotificationEmail($emailaddresses, $this->person->getFullName()); - $emailStatus = $email->send(); + $email = new NotificationEmail($emailaddresses, $this->person->getFullName()); - return $emailStatus; - } catch (\Exception $ex) { - return false; - } + return $email->send(); } private function sendSMS(): bool { - try { - $client = new Client(new Basic(SystemConfig::getValue('sNexmoAPIKey'), SystemConfig::getValue('sNexmoAPISecret'))); - - foreach ($this->recipients as $recipient) { - $message = $client->message()->sendText([ - 'to' => $recipient->getNumericCellPhone(), - 'from' => SystemConfig::getValue('sNexmoFromNumber'), - 'text' => gettext('Notification for') . ' ' . $this->person->getFullName(), - ]); - } + $client = new Client(new Basic(SystemConfig::getValue('sNexmoAPIKey'), SystemConfig::getValue('sNexmoAPISecret'))); - return true; - } catch (\Exception $ex) { - return false; + foreach ($this->recipients as $recipient) { + $client->message()->sendText( + $recipient->getNumericCellPhone(), + SystemConfig::getValue('sNexmoFromNumber'), + gettext('Notification for') . ' ' . $this->person->getFullName() + ); } + + return true; } - private function sendProjector() + private function sendProjector(): string|false { - try { - $OLPAlert = new OpenLPNotification( - SystemConfig::getValue('sOLPURL'), - SystemConfig::getValue('sOLPUserName'), - SystemConfig::getValue('sOLPPassword') - ); - $OLPAlert->setAlertText($this->projectorText); - - return $OLPAlert->send(); - } catch (\Exception $ex) { - return false; - } + $OLPAlert = new OpenLPNotification( + SystemConfig::getValue('sOLPURL'), + SystemConfig::getValue('sOLPUserName'), + SystemConfig::getValue('sOLPPassword') + ); + $OLPAlert->setAlertText($this->projectorText); + + return $OLPAlert->send(); } public function send(): array { $methods = []; if (SystemConfig::hasValidMailServerSettings()) { - $send = $this->sendEmail(); - $methods[] = 'email: ' . $send; + $sendEmail = false; + try { + $sendEmail = $this->sendEmail(); + } catch (\Throwable) { + // do nothing + } + $methods[] = 'email: ' . $sendEmail; } if (SystemConfig::hasValidSMSServerSettings()) { - $send = (bool) $this->sendSMS(); - $methods[] = 'sms: ' . $send; + $sendSms = false; + try { + $sendSms = $this->sendSMS(); + } catch (\Throwable) { + // do nothing + } + $methods[] = 'sms: ' . $sendSms; } if (SystemConfig::hasValidOpenLPSettings()) { - $send = (bool) $this->sendProjector(); - $methods[] = 'projector: ' . $send; + $sendOpenLp = false; + try { + $sendOpenLp = (bool) $this->sendProjector(); + } catch (\Throwable) { + // do nothing + } + $methods[] = 'projector: ' . $sendOpenLp; } return [ 'status' => '', diff --git a/src/ChurchCRM/dto/PeopleCustomField.php b/src/ChurchCRM/dto/PeopleCustomField.php index fdf49641d5..34ced6c367 100644 --- a/src/ChurchCRM/dto/PeopleCustomField.php +++ b/src/ChurchCRM/dto/PeopleCustomField.php @@ -57,9 +57,6 @@ public function getFormattedValue() return $this->formattedValue; } - /** - * @return mixed - */ public function getLink(): ?string { return $this->link; @@ -73,17 +70,11 @@ public function getName() return $this->name; } - /** - * @return mixed - */ public function getValue(): string { return $this->value; } - /** - * @return mixed - */ public function getIcon(): string { return $this->icon; diff --git a/src/ChurchCRM/dto/Photo.php b/src/ChurchCRM/dto/Photo.php index 05440de002..456d069681 100644 --- a/src/ChurchCRM/dto/Photo.php +++ b/src/ChurchCRM/dto/Photo.php @@ -251,8 +251,6 @@ private function loadFromGravatar($email, string $baseName): string $s = 60; $d = '404'; $r = 'g'; - $img = false; - $atts = []; $url = 'https://www.gravatar.com/avatar/'; $url .= md5(strtolower(trim($email))); $url .= "?s=$s&d=$d&r=$r"; diff --git a/src/ChurchCRM/dto/iCal.php b/src/ChurchCRM/dto/iCal.php index 4764062bff..bbd48c4b70 100644 --- a/src/ChurchCRM/dto/iCal.php +++ b/src/ChurchCRM/dto/iCal.php @@ -50,8 +50,7 @@ public function toString(): string foreach ($this->eventsArray as $event) { $iCal .= $this->eventToVEVENT($event); } - $iCal .= 'END:VCALENDAR'; - return $iCal; + return $iCal . 'END:VCALENDAR'; } } diff --git a/src/ChurchCRM/model/ChurchCRM/Deposit.php b/src/ChurchCRM/model/ChurchCRM/Deposit.php index 8ed9210cc9..d8759365fb 100644 --- a/src/ChurchCRM/model/ChurchCRM/Deposit.php +++ b/src/ChurchCRM/model/ChurchCRM/Deposit.php @@ -280,8 +280,6 @@ private function generateDepositSummary(\stdClass $thisReport): void $thisReport->pdf->Write(8, 'Amount'); $thisReport->curY += 2 * $thisReport->depositSummaryParameters->summary->intervalY; - $totalAmount = 0; - //while ($aRow = mysqli_fetch_array($rsPledges)) foreach ($this->getPledges() as $payment) { $thisReport->pdf->SetFont('Times', '', 10); @@ -426,55 +424,47 @@ public function getTotalAmount() public function getTotalChecks() { - $totalCash = PledgeQuery::create() + return PledgeQuery::create() ->filterByDepId($this->getId()) ->filterByMethod('CHECK') ->withColumn('SUM(Pledge.Amount)', 'sumAmount') ->find() ->getColumnValues('sumAmount')[0]; - - return $totalCash; } public function getTotalCash() { - $totalCash = PledgeQuery::create() + return PledgeQuery::create() ->filterByDepId($this->getId()) ->filterByMethod('CASH') ->withColumn('SUM(Pledge.Amount)', 'sumAmount') ->find() ->getColumnValues('sumAmount')[0]; - - return $totalCash; } public function getCountChecks() { - $countCash = PledgeQuery::create() + return PledgeQuery::create() ->filterByDepId($this->getId()) ->groupByGroupKey() ->filterByMethod('CHECK') ->find() ->count(); - - return $countCash; } public function getCountCash() { - $countCash = PledgeQuery::create() + return PledgeQuery::create() ->filterByDepId($this->getId()) ->groupByGroupKey() ->filterByMethod('CASH') ->find() ->count(); - - return $countCash; } public function getFundTotals() { - $funds = PledgeQuery::create() + return PledgeQuery::create() ->filterByDepId($this->getId()) ->groupByFundId() ->withColumn('SUM(' . PledgeTableMap::COL_PLG_AMOUNT . ')', 'Total') @@ -483,8 +473,6 @@ public function getFundTotals() ->orderBy(DonationFundTableMap::COL_FUN_NAME) ->select(['Name', 'Total']) ->find(); - - return $funds; } public function getPledgesJoinAll(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) diff --git a/src/ChurchCRM/model/ChurchCRM/Family.php b/src/ChurchCRM/model/ChurchCRM/Family.php index f1ab2917a0..3d46bd8f45 100644 --- a/src/ChurchCRM/model/ChurchCRM/Family.php +++ b/src/ChurchCRM/model/ChurchCRM/Family.php @@ -67,9 +67,7 @@ public function getViewURI(): string public function getWeddingDay() { if ($this->getWeddingdate() !== null && $this->getWeddingdate() !== '') { - $day = $this->getWeddingdate()->format('d'); - - return $day; + return $this->getWeddingdate()->format('d'); } return ''; @@ -78,9 +76,7 @@ public function getWeddingDay() public function getWeddingMonth() { if ($this->getWeddingdate() !== null && $this->getWeddingdate() !== '') { - $month = $this->getWeddingdate()->format('m'); - - return $month; + return $this->getWeddingdate()->format('m'); } return ''; @@ -174,8 +170,6 @@ private function getPeopleByRole(string $roleConfigName): array /** * @throws PropelException - * - * @return array */ public function getEmails(): array { @@ -332,13 +326,11 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum public function toSearchArray(): array { - $searchArray = [ + return [ 'Id' => $this->getId(), 'displayName' => $this->getFamilyString(SystemConfig::getBooleanValue('bSearchIncludeFamilyHOH')), 'uri' => SystemURLs::getRootPath() . '/v2/family/' . $this->getId(), ]; - - return $searchArray; } public function isActive(): bool diff --git a/src/ChurchCRM/model/ChurchCRM/KioskAssignment.php b/src/ChurchCRM/model/ChurchCRM/KioskAssignment.php index b04106db3b..96c959f565 100644 --- a/src/ChurchCRM/model/ChurchCRM/KioskAssignment.php +++ b/src/ChurchCRM/model/ChurchCRM/KioskAssignment.php @@ -22,13 +22,11 @@ class KioskAssignment extends BaseKioskAssignment private function getActiveEvent() { if ($this->getAssignmentType() == KioskAssignmentTypes::EVENTATTENDANCEKIOSK) { - $Event = EventQuery::create() + return EventQuery::create() ->filterByStart('now', Criteria::LESS_EQUAL) ->filterByEnd('now', Criteria::GREATER_EQUAL) ->filterById($this->getEventId()) ->findOne(); - - return $Event; } else { throw new \Exception('This kiosk does not support group attendance'); } @@ -42,7 +40,7 @@ public function getActiveGroupMembers() $groupTypeJoin->addForeignValueCondition('list_lst', 'lst_ID', '', $this->getActiveEvent()->getGroup()->getRoleListId(), Join::EQUAL); $groupTypeJoin->setJoinType(Criteria::LEFT_JOIN); - $ssClass = PersonQuery::create() + return PersonQuery::create() ->joinWithPerson2group2roleP2g2r() ->usePerson2group2roleP2g2rQuery() ->filterByGroupId($this->getEvent()->getGroupId()) @@ -54,8 +52,6 @@ public function getActiveGroupMembers() ->withColumn('(CASE WHEN event_attend.event_id is not null AND event_attend.checkout_date IS NULL then 1 else 0 end)', 'status') ->select(['Id', 'FirstName', 'LastName', 'status']) ->find(); - - return $ssClass; } else { throw new \Exception('This kiosk does not support group attendance'); } diff --git a/src/ChurchCRM/model/ChurchCRM/Person.php b/src/ChurchCRM/model/ChurchCRM/Person.php index 7bc28fc0e5..9c64d25a8b 100644 --- a/src/ChurchCRM/model/ChurchCRM/Person.php +++ b/src/ChurchCRM/model/ChurchCRM/Person.php @@ -283,12 +283,10 @@ public function getFamilyPhone(int $type): string /** * * If person address found, return latitude and Longitude of person address * else return family latitude and Longitude. - * - * @return array */ public function getLatLng(): array { - $address = $this->getAddress(); //if person address empty, this will get Family address + $this->getAddress(); //if person address empty, this will get Family address $lat = 0; $lng = 0; if (!empty($this->getAddress1())) { @@ -299,13 +297,11 @@ public function getLatLng(): array } } else { // note: this is useful when a person don't have a family (i.e. not an address) - if (!empty($this->getFamily())) { - if (!$this->getFamily()->hasLatitudeAndLongitude()) { - $this->getFamily()->updateLanLng(); - } - $lat = $this->getFamily()->getLatitude(); - $lng = $this->getFamily()->getLongitude(); + if (!$this->getFamily()->hasLatitudeAndLongitude()) { + $this->getFamily()->updateLanLng(); } + $lat = $this->getFamily()->getLatitude(); + $lng = $this->getFamily()->getLongitude(); } return [ @@ -538,13 +534,11 @@ public function preDelete(ConnectionInterface $con = null) public function getProperties() { - $personProperties = PropertyQuery::create() + return PropertyQuery::create() ->filterByProClass('p') ->useRecordPropertyQuery() ->filterByRecordId($this->getId()) ->find(); - - return $personProperties; } // return array of person properties @@ -573,7 +567,7 @@ public function getPropertiesString(): array /** * @return string[] */ - public function getCustomFields($allPersonCustomFields, $customMapping, &$CustomList, $name_func): array + public function getCustomFields($allPersonCustomFields, array $customMapping, array &$CustomList, $name_func): array { // add custom fields to person_custom table since they are not defined in the propel schema $rawQry = PersonCustomQuery::create(); diff --git a/src/ChurchCRM/model/ChurchCRM/Pledge.php b/src/ChurchCRM/model/ChurchCRM/Pledge.php index ccaa3cfe8f..e6057fb0ae 100644 --- a/src/ChurchCRM/model/ChurchCRM/Pledge.php +++ b/src/ChurchCRM/model/ChurchCRM/Pledge.php @@ -18,7 +18,7 @@ */ class Pledge extends BasePledge { - public function getFormattedFY() + public function getFormattedFY(): string { return MakeFYString($this->getFyId()); } @@ -26,7 +26,6 @@ public function getFormattedFY() /** * Code to be run before deleting the object in database. * - * @param ConnectionInterface $con * * @return bool */ diff --git a/src/ChurchCRM/tasks/PHPPendingDeprecationVersionCheckTask.php b/src/ChurchCRM/tasks/PHPPendingDeprecationVersionCheckTask.php index e350ca078d..e2a99ade64 100644 --- a/src/ChurchCRM/tasks/PHPPendingDeprecationVersionCheckTask.php +++ b/src/ChurchCRM/tasks/PHPPendingDeprecationVersionCheckTask.php @@ -6,8 +6,6 @@ class PHPPendingDeprecationVersionCheckTask implements TaskInterface, PreUpgradeTaskInterface { - private const REQUIRED_PHP_VERSION = '8.1.0'; - public function isActive(): bool { return version_compare(PHP_VERSION, $this::REQUIRED_PHP_VERSION, '<'); diff --git a/src/ChurchCRM/utils/ExecutionTime.php b/src/ChurchCRM/utils/ExecutionTime.php index 9fe35465b2..a3a3d2d58c 100644 --- a/src/ChurchCRM/utils/ExecutionTime.php +++ b/src/ChurchCRM/utils/ExecutionTime.php @@ -5,21 +5,17 @@ class ExecutionTime { // inspired from https://stackoverflow.com/a/22885011 - private $startTime; - private $endTime; - private $startR; - private $endR; + private float $startTime; + private ?float $endTime = null; public function __construct() { $this->startTime = microtime(true); - $this->startR = getrusage(); } public function end(): void { $this->endTime = microtime(true); - $this->endR = getrusage(); } public function getMilliseconds(): float @@ -35,16 +31,12 @@ public function getMilliseconds(): float return round($value, 2); } - private function runTime(array $ru, array $rus, string $index) - { - return ($ru["ru_$index.tv_sec"] * 1000 + intval($ru["ru_$index.tv_usec"] / 1000)) - - ($rus["ru_$index.tv_sec"] * 1000 + intval($rus["ru_$index.tv_usec"] / 1000)); - } - public function __toString(): string { - return 'This process used ' . $this->runTime($this->endTime, $this->startTime, 'utime') . - " ms for its computations\nIt spent " . $this->runTime($this->endTime, $this->startTime, 'stime') . - " ms in system calls\n"; + if ($this->endTime === null) { + return 'This process is still running: ' . $this->getMilliseconds() . ' ms.'; + } + + return 'This process completed in ' . $this->getMilliseconds() . ' ms.'; } } diff --git a/src/ChurchCRM/utils/InputUtils.php b/src/ChurchCRM/utils/InputUtils.php index f2198ea85b..1e1dc082e7 100644 --- a/src/ChurchCRM/utils/InputUtils.php +++ b/src/ChurchCRM/utils/InputUtils.php @@ -61,7 +61,7 @@ public static function filterInt($sInput): int return 0; } - return (int) intval(trim($sInput)); + return intval(trim($sInput)); } public static function filterFloat($sInput): float @@ -72,7 +72,7 @@ public static function filterFloat($sInput): float return 0; } - return (float) floatval(trim($sInput)); + return floatval(trim($sInput)); } public static function filterDate($sInput): string @@ -106,6 +106,8 @@ public static function legacyFilterInput($sInput, $type = 'string', $size = 1) return self::filterFloat($sInput); case 'date': return self::filterDate($sInput); + default: + throw new \InvalidArgumentException('Invalid "type" for legacyFilterInput provided'); } } else { return ''; diff --git a/src/ChurchCRM/utils/MiscUtils.php b/src/ChurchCRM/utils/MiscUtils.php index 8d6f18948e..70e73ad53a 100644 --- a/src/ChurchCRM/utils/MiscUtils.php +++ b/src/ChurchCRM/utils/MiscUtils.php @@ -33,7 +33,6 @@ public static function randomWord(int $length = 6): string { $cons = ['b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'r', 's', 't', 'v', 'w', 'x', 'z', 'pt', 'gl', 'gr', 'ch', 'ph', 'ps', 'sh', 'st', 'th', 'wh']; $cons_cant_start = ['ck', 'cm', 'dr', 'ds', 'ft', 'gh', 'gn', 'kr', 'ks', 'ls', 'lt', 'lr', 'mp', 'mt', 'ms', 'ng', 'ns', 'rd', 'rg', 'rs', 'rt', 'ss', 'ts', 'tch']; - $vows = ['a', 'e', 'i', 'o', 'u', 'y', 'ee', 'oa', 'oo']; $current = (random_int(0, 1) === 0 ? 'cons' : 'vows'); $word = ''; while (strlen($word) < $length) { @@ -124,9 +123,8 @@ public static function getGitHubWikiAnchorLink(string $text): string $anchor = preg_replace('/[^\w\d\- ]+/', '', $anchor); $anchor = preg_replace('/\s/', '-', $anchor); $anchor = preg_replace('/\-+$/', '', $anchor); - $anchor = str_replace(' ', '-', $anchor); - return $anchor; + return str_replace(' ', '-', $anchor); } public static function dashesToCamelCase(string $string, bool $capitalizeFirstCharacter = false): string diff --git a/src/FamilyCustomFieldsEditor.php b/src/FamilyCustomFieldsEditor.php index 4f7f2fb5ba..5fd7dace44 100644 --- a/src/FamilyCustomFieldsEditor.php +++ b/src/FamilyCustomFieldsEditor.php @@ -88,9 +88,9 @@ $newFieldName = InputUtils::legacyFilterInput($_POST['newFieldName']); $newFieldSec = $_POST['newFieldSec']; - if (strlen($newFieldName) == 0) { + if (strlen($newFieldName) === 0) { $bNewNameError = true; - } elseif (strlen($newFieldType) == 0 || $newFieldType < 1) { + } elseif (strlen($newFieldType) === 0 || $newFieldType < 1) { // This should never happen, but check anyhow. // $bNewTypeError = true; } else { diff --git a/src/FamilyEditor.php b/src/FamilyEditor.php index d3b8b0233c..d4fef7f682 100644 --- a/src/FamilyEditor.php +++ b/src/FamilyEditor.php @@ -13,12 +13,12 @@ use ChurchCRM\model\ChurchCRM\Person; use ChurchCRM\model\ChurchCRM\PersonQuery; use ChurchCRM\Utils\InputUtils; -use ChurchCRM\Utils\MiscUtils; use ChurchCRM\Utils\RedirectUtils; $sPageTitle = gettext('Family Editor'); $iFamilyID = -1; +$family = null; // Get the FamilyID from the querystring if (array_key_exists('FamilyID', $_GET)) { @@ -32,8 +32,8 @@ RedirectUtils::redirect('v2/dashboard'); } - $sSQL = 'SELECT fam_ID FROM family_fam WHERE fam_ID = ' . $iFamilyID; - if (mysqli_num_rows(RunQuery($sSQL)) == 0) { + $family = FamilyQuery::create()->findOneById($iFamilyID); + if ($family === null) { RedirectUtils::redirect('v2/dashboard'); } } elseif (!AuthenticationManager::getCurrentUser()->isAddRecordsEnabled()) { @@ -417,29 +417,29 @@ } else { //FirstPass //Are we editing or adding? - if ($iFamilyID > 0) { + if ($family) { //Editing.... //Get the information on this family $sSQL = 'SELECT * FROM family_fam WHERE fam_ID = ' . $iFamilyID; $rsFamily = RunQuery($sSQL); extract(mysqli_fetch_array($rsFamily)); - $iFamilyID = $fam_ID; - $sName = $fam_Name; - $sAddress1 = $fam_Address1; - $sAddress2 = $fam_Address2; - $sCity = $fam_City; - $sState = $fam_State; - $sZip = $fam_Zip; - $sCountry = $fam_Country; - $sHomePhone = $fam_HomePhone; - $sWorkPhone = $fam_WorkPhone; - $sCellPhone = $fam_CellPhone; - $sEmail = $fam_Email; - $bSendNewsLetter = ($fam_SendNewsLetter == 'TRUE'); - $dWeddingDate = $fam_WeddingDate; - $nLatitude = $fam_Latitude; - $nLongitude = $fam_Longitude; + $iFamilyID = $family->getId(); + $sName = $family->getName(); + $sAddress1 = $family->getAddress1(); + $sAddress2 = $family->getAddress2(); + $sCity = $family->getCity(); + $sState = $family->getState(); + $sZip = $family->getZip(); + $sCountry = $family->getCountry(); + $sHomePhone = $family->getHomePhone(); + $sWorkPhone = $family->getWorkPhone(); + $sCellPhone = $family->getCellPhone(); + $sEmail = $family->getEmail(); + $bSendNewsLetter = $family->getSendNewsletter() === 'TRUE'; + $dWeddingDate = $family->getWeddingdate(SystemConfig::getValue("sDatePickerFormat")); + $nLatitude = $family->getLatitude(); + $nLongitude = $family->getLongitude(); // Expand the phone number $sHomePhone = ExpandPhoneNumber($sHomePhone, $sCountry, $bNoFormat_HomePhone); diff --git a/src/GroupPropsEditor.php b/src/GroupPropsEditor.php index 73dd12f22b..a52dc6e898 100644 --- a/src/GroupPropsEditor.php +++ b/src/GroupPropsEditor.php @@ -101,7 +101,7 @@ require 'Include/Header.php'; -if (mysqli_num_rows($rsPropList) == 0) { +if (mysqli_num_rows($rsPropList) === 0) { ?>

diff --git a/src/GroupView.php b/src/GroupView.php index 7051e1f15d..1707d4de12 100644 --- a/src/GroupView.php +++ b/src/GroupView.php @@ -12,7 +12,7 @@ use ChurchCRM\Utils\RedirectUtils; // Get the GroupID out of the querystring -$iGroupID = InputUtils::legacyFilterInput($_GET['GroupID'], 'int'); +$iGroupID = (int) InputUtils::legacyFilterInput($_GET['GroupID'], 'int'); if ($iGroupID < 1) { RedirectUtils::redirect('GroupList.php'); @@ -270,7 +270,7 @@ $sAssignedProperties = ','; //Was anything returned? - if (mysqli_num_rows($rsAssignedProperties) == 0) { + if (mysqli_num_rows($rsAssignedProperties) === 0) { // No, indicate nothing returned echo '

' . gettext('No property assignments') . '.

'; } else { diff --git a/src/Include/Functions.php b/src/Include/Functions.php index 471a20ec7c..5e3397a42d 100644 --- a/src/Include/Functions.php +++ b/src/Include/Functions.php @@ -20,16 +20,14 @@ // If magic_quotes off and array function addslashes_deep($value) { - $value = is_array($value) ? - array_map('addslashes_deep', $value) : - addslashes($value); - - return $value; + return is_array($value) ? + array_map('addslashes_deep', $value) : + addslashes($value); } // If Magic Quotes is turned off, do the same thing manually.. if (!isset($_SESSION['bHasMagicQuotes'])) { - foreach ($_REQUEST as $key => $value) { + foreach ($_REQUEST as $value) { $value = addslashes_deep($value); } } @@ -119,10 +117,10 @@ function addslashes_deep($value) // // Returns the current fiscal year -function CurrentFY() +function CurrentFY(): int { - $yearNow = date('Y'); - $monthNow = date('m'); + $yearNow = (int) date('Y'); + $monthNow = (int) date('m'); $FYID = $yearNow - 1996; if ($monthNow >= SystemConfig::getValue('iFYMonth') && SystemConfig::getValue('iFYMonth') > 1) { $FYID += 1; @@ -132,7 +130,7 @@ function CurrentFY() } // PrintFYIDSelect: make a fiscal year selection menu. -function PrintFYIDSelect($iFYID, $selectName): void +function PrintFYIDSelect(int $iFYID, string $selectName): void { echo sprintf('', $selectName); diff --git a/src/PledgeEditor.php b/src/PledgeEditor.php index 344d0fa29c..e107b06142 100644 --- a/src/PledgeEditor.php +++ b/src/PledgeEditor.php @@ -516,7 +516,7 @@ - + diff --git a/src/ReminderReport.php b/src/ReminderReport.php index 6a567e16b3..6c4c03f509 100644 --- a/src/ReminderReport.php +++ b/src/ReminderReport.php @@ -32,7 +32,7 @@
- +
diff --git a/src/sundayschool/SundaySchoolReports.php b/src/sundayschool/SundaySchoolReports.php index 22628724e6..c12ac5fffd 100644 --- a/src/sundayschool/SundaySchoolReports.php +++ b/src/sundayschool/SundaySchoolReports.php @@ -194,7 +194,7 @@ : - + From a435a9664e8eb845b9bb4d603ec535df1a413864 Mon Sep 17 00:00:00 2001 From: Arun Philip Date: Mon, 27 May 2024 23:59:19 -0400 Subject: [PATCH 18/22] phpcs optionmanager --- src/OptionManager.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/OptionManager.php b/src/OptionManager.php index b44b7021b0..2cb37222c6 100644 --- a/src/OptionManager.php +++ b/src/OptionManager.php @@ -305,9 +305,9 @@ $aInactiveClassificationIds = explode(',', SystemConfig::getValue('sInactiveClassification')); $aInactiveClasses = array_filter($aInactiveClassificationIds, fn ($k) => is_numeric($k)); - if (count($aInactiveClassificationIds) !== count($aInactiveClasses)) { - LoggerUtils::getAppLogger()->warning('Encountered invalid configuration(s) for sInactiveClassification, please fix this'); - } +if (count($aInactiveClassificationIds) !== count($aInactiveClasses)) { + LoggerUtils::getAppLogger()->warning('Encountered invalid configuration(s) for sInactiveClassification, please fix this'); +} for ($row = 1; $row <= $numRows; $row++) { ?> From 7e5e14008fe415de1824404a41e14f21702afce8 Mon Sep 17 00:00:00 2001 From: Arun Philip Date: Tue, 28 May 2024 00:31:53 -0400 Subject: [PATCH 19/22] fix invalid legacyFilterInput type in PledgeEditor --- src/PledgeEditor.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PledgeEditor.php b/src/PledgeEditor.php index e107b06142..b28ec46236 100644 --- a/src/PledgeEditor.php +++ b/src/PledgeEditor.php @@ -61,7 +61,7 @@ $sGroupKey = InputUtils::legacyFilterInput($_GET['GroupKey'], 'string'); } // this will only be set if someone pressed the 'edit' button on the Pledge or Deposit line if (array_key_exists('CurrentDeposit', $_GET)) { - $iCurrentDeposit = InputUtils::legacyFilterInput($_GET['CurrentDeposit'], 'integer'); + $iCurrentDeposit = InputUtils::legacyFilterInput($_GET['CurrentDeposit'], 'int'); } $linkBack = InputUtils::legacyFilterInput($_GET['linkBack'], 'string'); $iFamily = 0; From 77e530ea32572831bffb91d0585b80537a61ce45 Mon Sep 17 00:00:00 2001 From: Arun Philip Date: Thu, 13 Jun 2024 01:43:31 -0400 Subject: [PATCH 20/22] add more types and rerun rector --- src/ChurchCRM/MICRFunctions.php | 24 ++++++++++--------- src/ChurchCRM/SQLUtils.php | 10 +++----- src/ChurchCRM/Service/AppIntegrityService.php | 2 +- src/ChurchCRM/Service/FinancialService.php | 4 ++-- src/ChurchCRM/Service/PersonService.php | 2 +- src/ChurchCRM/Service/SystemService.php | 11 +++++---- src/ChurchCRM/data/Countries.php | 2 +- src/ChurchCRM/utils/InputUtils.php | 4 ++-- src/EventEditor.php | 1 - src/Reports/AdvancedDeposit.php | 2 +- src/Reports/EnvelopeReport.php | 3 +-- src/Reports/PhotoBook.php | 2 +- src/v2/templates/admin/debug.php | 8 +++---- 13 files changed, 36 insertions(+), 39 deletions(-) diff --git a/src/ChurchCRM/MICRFunctions.php b/src/ChurchCRM/MICRFunctions.php index 78e9c6ea4c..e6566ce09d 100644 --- a/src/ChurchCRM/MICRFunctions.php +++ b/src/ChurchCRM/MICRFunctions.php @@ -6,24 +6,24 @@ class MICRFunctions { - public $CHECKNO_FIRST = 1; // oo tt o - public $ROUTE_FIRST1 = 2; // tt o - public $ROUTE_FIRST2 = 3; // tt oo - public $NOT_RECOGNIZED = 4; + public int $CHECKNO_FIRST = 1; // oo tt o + public int $ROUTE_FIRST1 = 2; // tt o + public int $ROUTE_FIRST2 = 3; // tt oo + public int $NOT_RECOGNIZED = 4; - public function identifyFormat($micr) + public function identifyFormat(string $micr): int { // t000000000t0000o0000000000000o ROUTE_FIRST2 // t000000000t 0000000000o 0000 ROUTE_FIRST1 // o000000o t000000000t 0000000000o CHECKNO_FIRST $firstChar = mb_substr($micr, 0, 1); - if ($firstChar == 'o') { + if ($firstChar === 'o') { return $this->CHECKNO_FIRST; } elseif ($firstChar == 't') { $firstSmallO = strpos($micr, 'o'); $secondSmallO = strrpos($micr, 'o'); - if ($firstSmallO == $secondSmallO) { + if ($firstSmallO === $secondSmallO) { // Only one 'o' $len = strlen($micr); if ($len - $firstSmallO > 12) { @@ -35,9 +35,11 @@ public function identifyFormat($micr) return $this->ROUTE_FIRST2; } } + + throw new \InvalidArgumentException('Unknown format provided'); } - public function findRoute($micr): string + public function findRoute(string $micr): string { $routeAndAccount = $this->findRouteAndAccount($micr); $breakChar = strpos($routeAndAccount, 't', 1); @@ -45,7 +47,7 @@ public function findRoute($micr): string return mb_substr($micr, 1, $breakChar - 1); } - public function findAccount($micr): string + public function findAccount(string $micr): string { $routeAndAccount = $this->findRouteAndAccount($micr); $breakChar = strpos($routeAndAccount, 't', 1); @@ -53,7 +55,7 @@ public function findAccount($micr): string return mb_substr($routeAndAccount, $breakChar + 1, strlen($micr) - $breakChar); } - public function findRouteAndAccount($micr) + public function findRouteAndAccount(string $micr): string { $formatID = $this->identifyFormat($micr); @@ -78,7 +80,7 @@ public function findRouteAndAccount($micr) } } - public function findCheckNo($micr): string + public function findCheckNo(string $micr): string { $formatID = $this->identifyFormat($micr); if ($formatID == $this->CHECKNO_FIRST) { diff --git a/src/ChurchCRM/SQLUtils.php b/src/ChurchCRM/SQLUtils.php index a5de2e61bf..36dfeb3209 100644 --- a/src/ChurchCRM/SQLUtils.php +++ b/src/ChurchCRM/SQLUtils.php @@ -71,8 +71,7 @@ public static function sqlImport(string $fileName, $mysqli): void /** * Remove comments from sql. * - * @param string sql - * @param bool is multicomment line + * @param bool $isMultiComment is multicomment line * * @return string */ @@ -94,7 +93,7 @@ private static function clearSQL($sql, &$isMultiComment) while (preg_match('{--\s|#|/\*[^!]}sUi', $sql, $matched, PREG_OFFSET_CAPTURE, $offset)) { [$comment, $foundOn] = $matched[0]; if (self::isQuoted($foundOn, $sql)) { - $offset = $foundOn + strlen($comment); + $offset = (int) $foundOn + strlen($comment); } else { if (mb_substr($comment, 0, 2) == '/*') { $closedOn = strpos($sql, '*/', $foundOn); @@ -116,11 +115,8 @@ private static function clearSQL($sql, &$isMultiComment) /** * Check if "offset" position is quoted. - * - * @param int $offset - * @param string $text */ - private static function isQuoted($offset, $text): bool + private static function isQuoted(int $offset, string $text): bool { if ($offset > strlen($text)) { $offset = strlen($text); diff --git a/src/ChurchCRM/Service/AppIntegrityService.php b/src/ChurchCRM/Service/AppIntegrityService.php index 60da47956b..cb06a3fcdb 100644 --- a/src/ChurchCRM/Service/AppIntegrityService.php +++ b/src/ChurchCRM/Service/AppIntegrityService.php @@ -256,7 +256,7 @@ public static function hasModRewrite(): bool $header['status'] = $line; } - list($key, $value) = explode(': ', $line); + [$key, $value] = explode(': ', $line); $header[$key] = $value; } diff --git a/src/ChurchCRM/Service/FinancialService.php b/src/ChurchCRM/Service/FinancialService.php index 418d75338d..4d6c709434 100644 --- a/src/ChurchCRM/Service/FinancialService.php +++ b/src/ChurchCRM/Service/FinancialService.php @@ -17,13 +17,13 @@ class FinancialService { - public function deletePayment($groupKey): void + public function deletePayment(string $groupKey): void { requireUserGroupMembership('bFinance'); PledgeQuery::create()->findOneByGroupKey($groupKey)->delete(); } - public function getMemberByScanString($tScanString): array + public function getMemberByScanString(string $tScanString): array { requireUserGroupMembership('bFinance'); diff --git a/src/ChurchCRM/Service/PersonService.php b/src/ChurchCRM/Service/PersonService.php index 127f6ca40c..76f0049b03 100644 --- a/src/ChurchCRM/Service/PersonService.php +++ b/src/ChurchCRM/Service/PersonService.php @@ -10,7 +10,7 @@ class PersonService /** * @return array> */ - public function search(string $searchTerm, $includeFamilyRole = true): array + public function search(string $searchTerm, bool $includeFamilyRole = true): array { $searchLikeString = '%' . $searchTerm . '%'; $people = PersonQuery::create() diff --git a/src/ChurchCRM/Service/SystemService.php b/src/ChurchCRM/Service/SystemService.php index 308e900641..727130b246 100644 --- a/src/ChurchCRM/Service/SystemService.php +++ b/src/ChurchCRM/Service/SystemService.php @@ -4,6 +4,7 @@ use ChurchCRM\Backup\BackupJob; use ChurchCRM\Backup\BackupType; +use ChurchCRM\dto\Prerequisite; use ChurchCRM\dto\SystemConfig; use ChurchCRM\dto\SystemURLs; use ChurchCRM\Utils\ChurchCRMReleaseManager; @@ -73,13 +74,13 @@ public static function getPrerequisiteStatus(): string { if (AppIntegrityService::arePrerequisitesMet()) { return 'All Prerequisites met'; - } else { - $unmet = AppIntegrityService::getUnmetPrerequisites(); + } - $unmetNames = array_map(fn ($o): string => $o->getName(), $unmet); + $unmet = AppIntegrityService::getUnmetPrerequisites(); - return 'Missing Prerequisites: ' . json_encode(array_values($unmetNames), JSON_THROW_ON_ERROR); - } + $unmetNames = array_map(fn (Prerequisite $o): string => $o->getName(), $unmet); + + return 'Missing Prerequisites: ' . json_encode(array_values($unmetNames), JSON_THROW_ON_ERROR); } private static function isTimerThresholdExceeded(string $LastTime, int $ThresholdHours): bool diff --git a/src/ChurchCRM/data/Countries.php b/src/ChurchCRM/data/Countries.php index 1f0957ed3b..2c2008b25e 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([__CLASS__, 'getSingleName'], self::$countries); + return array_map([self::class, 'getSingleName'], self::$countries); } public static function getAll(): array diff --git a/src/ChurchCRM/utils/InputUtils.php b/src/ChurchCRM/utils/InputUtils.php index 1e1dc082e7..ef3c65cab5 100644 --- a/src/ChurchCRM/utils/InputUtils.php +++ b/src/ChurchCRM/utils/InputUtils.php @@ -8,7 +8,7 @@ class InputUtils { private static string $AllowedHTMLTags = '


    • '; - public static function legacyFilterInputArr(array $arr, $key, $type = 'string', $size = 1) + public static function legacyFilterInputArr(array $arr, $key, $type = 'string', $size = 1): string|int|float { if (array_key_exists($key, $arr)) { return InputUtils::legacyFilterInput($arr[$key], $type, $size); @@ -89,7 +89,7 @@ public static function filterDate($sInput): string // Sanitizes user input as a security measure // Optionally, a filtering type and size may be specified. By default, strip any tags from a string. // Note that a database connection must already be established for the mysqli_real_escape_string function to work. - public static function legacyFilterInput($sInput, $type = 'string', $size = 1) + public static function legacyFilterInput($sInput, $type = 'string', $size = 1): string|int|float { global $cnInfoCentral; if (strlen($sInput) > 0) { diff --git a/src/EventEditor.php b/src/EventEditor.php index 52cc4c1e51..37f821d0ec 100644 --- a/src/EventEditor.php +++ b/src/EventEditor.php @@ -44,7 +44,6 @@ $iErrors = 0; if ($sAction === 'Create Event' && !empty($tyid)) { - // User is coming from the event types screen and thus there // is no existing event in the event_event table // diff --git a/src/Reports/AdvancedDeposit.php b/src/Reports/AdvancedDeposit.php index 160867980f..aeaab3c402 100644 --- a/src/Reports/AdvancedDeposit.php +++ b/src/Reports/AdvancedDeposit.php @@ -221,7 +221,7 @@ public function printRightJustified($x, $y, $str): void $this->Write(8, $str); } - public function startFirstPage() + public function startFirstPage(): int|float { global $sDateStart, $sDateEnd, $sort, $iDepID, $datetype; $this->addPage(); diff --git a/src/Reports/EnvelopeReport.php b/src/Reports/EnvelopeReport.php index cfb62db7f9..94f2d27430 100644 --- a/src/Reports/EnvelopeReport.php +++ b/src/Reports/EnvelopeReport.php @@ -84,7 +84,7 @@ public function sGetFamilyString(Family $family): string } // Number of lines is only for the $text parameter - public function addRecord($text, $numlines): void + public function addRecord($text, int $numlines): void { // Add an extra blank line after record $numlines++; @@ -105,7 +105,6 @@ public function addRecord($text, $numlines): void $families = FamilyQuery::Create()->orderByEnvelope()->filterByEnvelope(0, 'Criteria::GREATER_THAN')->find(); foreach ($families as $family) { - $OutStr = ''; $OutStr = $pdf->sGetFamilyString($family); // Count the number of lines in the output string diff --git a/src/Reports/PhotoBook.php b/src/Reports/PhotoBook.php index 376f8e6fc0..2645b5b661 100644 --- a/src/Reports/PhotoBook.php +++ b/src/Reports/PhotoBook.php @@ -20,7 +20,7 @@ class PdfPhotoBook extends ChurchInfoReport { private $group; - private $FYIDString; + private string $FYIDString; private ?int $currentX = null; private ?int $currentY = null; private int $pageMarginL = 15; diff --git a/src/v2/templates/admin/debug.php b/src/v2/templates/admin/debug.php index 46f42a8755..49cfdb4c05 100644 --- a/src/v2/templates/admin/debug.php +++ b/src/v2/templates/admin/debug.php @@ -197,7 +197,7 @@

      0) { - ?> + ?>

      :

@@ -207,7 +207,7 @@ + ?> @@ -220,11 +220,11 @@ } ?> -
filename ?> expectedhash ?>
- From 114b8304590def919457c67dd0fb081e2672f10c Mon Sep 17 00:00:00 2001 From: Arun Philip Date: Thu, 8 Aug 2024 01:13:43 -0400 Subject: [PATCH 21/22] add back $vows since it's used via variable variables --- src/ChurchCRM/utils/MiscUtils.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ChurchCRM/utils/MiscUtils.php b/src/ChurchCRM/utils/MiscUtils.php index 70e73ad53a..10af70a098 100644 --- a/src/ChurchCRM/utils/MiscUtils.php +++ b/src/ChurchCRM/utils/MiscUtils.php @@ -33,6 +33,7 @@ public static function randomWord(int $length = 6): string { $cons = ['b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'r', 's', 't', 'v', 'w', 'x', 'z', 'pt', 'gl', 'gr', 'ch', 'ph', 'ps', 'sh', 'st', 'th', 'wh']; $cons_cant_start = ['ck', 'cm', 'dr', 'ds', 'ft', 'gh', 'gn', 'kr', 'ks', 'ls', 'lt', 'lr', 'mp', 'mt', 'ms', 'ng', 'ns', 'rd', 'rg', 'rs', 'rt', 'ss', 'ts', 'tch']; + $vows = ['a', 'e', 'i', 'o', 'u', 'y', 'ee', 'oa', 'oo']; $current = (random_int(0, 1) === 0 ? 'cons' : 'vows'); $word = ''; while (strlen($word) < $length) { From 30d74c70ef1a8ff3974cacdbda66149852cdf407 Mon Sep 17 00:00:00 2001 From: Arun Philip Date: Thu, 8 Aug 2024 01:27:46 -0400 Subject: [PATCH 22/22] update rector and re-process --- src/CartToGroup.php | 2 +- src/ChurchCRM/Reports/PDF_Directory.php | 2 +- src/ChurchCRM/Service/SystemService.php | 2 +- src/ChurchCRM/Service/UpgradeService.php | 2 +- src/ChurchCRM/Twig/GettextExtension.php | 16 ++++ src/ChurchCRM/dto/Notification.php | 2 +- src/ChurchCRM/dto/Photo.php | 6 +- src/ChurchCRM/model/ChurchCRM/Family.php | 2 +- src/ChurchCRM/utils/InputUtils.php | 4 +- src/DonatedItemEditor.php | 4 +- src/FamilyEditor.php | 108 +++++++++++------------ src/FundRaiserEditor.php | 8 +- src/GroupList.php | 2 +- src/GroupPropsEditor.php | 10 +-- src/GroupPropsFormEditor.php | 14 +-- src/GroupReports.php | 2 +- src/GroupView.php | 54 ++++++------ src/Include/Footer-Short.php | 4 +- src/Include/Functions.php | 14 +-- src/PaddleNumEditor.php | 8 +- src/PaddleNumList.php | 8 +- src/PeopleDashboard.php | 38 ++++---- src/PersonCustomFieldsEditor.php | 12 +-- src/PledgeEditor.php | 72 +++++++-------- src/PrintView.php | 22 ++--- src/QuerySQL.php | 4 +- src/Reports/AdvancedDeposit.php | 2 +- src/SelectDelete.php | 50 +++++------ src/VolunteerOpportunityEditor.php | 8 +- src/api/routes/people/people-persons.php | 2 +- src/composer.lock | 32 +++---- src/v2/routes/calendar.php | 2 +- src/v2/templates/people/family-list.php | 2 +- 33 files changed, 268 insertions(+), 252 deletions(-) create mode 100644 src/ChurchCRM/Twig/GettextExtension.php diff --git a/src/CartToGroup.php b/src/CartToGroup.php index 5d47299fac..e732bcf948 100644 --- a/src/CartToGroup.php +++ b/src/CartToGroup.php @@ -40,7 +40,7 @@ require 'Include/Header.php'; if (count($_SESSION['aPeopleCart']) > 0) { -?> + ?> diff --git a/src/ChurchCRM/Reports/PDF_Directory.php b/src/ChurchCRM/Reports/PDF_Directory.php index 38bb534a7d..a0bfec38c3 100644 --- a/src/ChurchCRM/Reports/PDF_Directory.php +++ b/src/ChurchCRM/Reports/PDF_Directory.php @@ -345,7 +345,7 @@ public function sGetFamilyString($aRow): string // This function formats the string for the head of household. // NOTE: This is used for the Head AND Spouse (called twice) - public function sGetHeadString($rsCustomFields, $aHead) + public function sGetHeadString($rsCustomFields, $aHead): string { global $bDirBirthday; global $bDirPersonalPhone; diff --git a/src/ChurchCRM/Service/SystemService.php b/src/ChurchCRM/Service/SystemService.php index 727130b246..479792db2a 100644 --- a/src/ChurchCRM/Service/SystemService.php +++ b/src/ChurchCRM/Service/SystemService.php @@ -34,7 +34,7 @@ public static function getInstalledVersion() return $composerJson['version']; } - public static function getCopyrightDate() + public static function getCopyrightDate(): string { return (new \DateTime())->format('Y'); } diff --git a/src/ChurchCRM/Service/UpgradeService.php b/src/ChurchCRM/Service/UpgradeService.php index 8369f1991b..258b4d3ab9 100644 --- a/src/ChurchCRM/Service/UpgradeService.php +++ b/src/ChurchCRM/Service/UpgradeService.php @@ -18,7 +18,7 @@ class UpgradeService { - public static function upgradeDatabaseVersion() + public static function upgradeDatabaseVersion(): bool { $logger = LoggerUtils::getAppLogger(); $db_version = SystemService::getDBVersion(); diff --git a/src/ChurchCRM/Twig/GettextExtension.php b/src/ChurchCRM/Twig/GettextExtension.php new file mode 100644 index 0000000000..e3de833888 --- /dev/null +++ b/src/ChurchCRM/Twig/GettextExtension.php @@ -0,0 +1,16 @@ +photoURI); MiscUtils::throwIfFailed($content); @@ -266,7 +266,7 @@ private function loadFromGravatar($email, string $baseName): string throw new \Exception('Gravatar not found'); } - private function loadFromGoogle($email, string $baseName): string|false + private function loadFromGoogle($email, string $baseName) { $url = 'http://picasaweb.google.com/data/entry/api/user/'; $url .= strtolower(trim($email)); @@ -291,7 +291,7 @@ private function loadFromGoogle($email, string $baseName): string|false return false; } - private function getRandomColor(\GdImage $image): int|false + private function getRandomColor(\GdImage $image) { $red = random_int(0, 150); $green = random_int(0, 150); diff --git a/src/ChurchCRM/model/ChurchCRM/Family.php b/src/ChurchCRM/model/ChurchCRM/Family.php index 3d46bd8f45..048d1f5236 100644 --- a/src/ChurchCRM/model/ChurchCRM/Family.php +++ b/src/ChurchCRM/model/ChurchCRM/Family.php @@ -275,7 +275,7 @@ public function verify(): void $this->createTimeLineNote('verify'); } - public function getFamilyString($booleanIncludeHOH = true) + public function getFamilyString(bool $booleanIncludeHOH = true): string { $HoH = []; if ($booleanIncludeHOH) { diff --git a/src/ChurchCRM/utils/InputUtils.php b/src/ChurchCRM/utils/InputUtils.php index ef3c65cab5..1e1dc082e7 100644 --- a/src/ChurchCRM/utils/InputUtils.php +++ b/src/ChurchCRM/utils/InputUtils.php @@ -8,7 +8,7 @@ class InputUtils { private static string $AllowedHTMLTags = '


    • '; - public static function legacyFilterInputArr(array $arr, $key, $type = 'string', $size = 1): string|int|float + public static function legacyFilterInputArr(array $arr, $key, $type = 'string', $size = 1) { if (array_key_exists($key, $arr)) { return InputUtils::legacyFilterInput($arr[$key], $type, $size); @@ -89,7 +89,7 @@ public static function filterDate($sInput): string // Sanitizes user input as a security measure // Optionally, a filtering type and size may be specified. By default, strip any tags from a string. // Note that a database connection must already be established for the mysqli_real_escape_string function to work. - public static function legacyFilterInput($sInput, $type = 'string', $size = 1): string|int|float + public static function legacyFilterInput($sInput, $type = 'string', $size = 1) { global $cnInfoCentral; if (strlen($sInput) > 0) { diff --git a/src/DonatedItemEditor.php b/src/DonatedItemEditor.php index 9d153f1c9f..cd0641fd34 100644 --- a/src/DonatedItemEditor.php +++ b/src/DonatedItemEditor.php @@ -250,7 +250,7 @@ + ?>
      diff --git a/src/FamilyEditor.php b/src/FamilyEditor.php index d4fef7f682..ea98a63122 100644 --- a/src/FamilyEditor.php +++ b/src/FamilyEditor.php @@ -560,8 +560,8 @@ + ?>

      @@ -593,9 +593,9 @@

      maxlength="10" size="8">
      @@ -606,7 +606,7 @@
      + ?>
      @@ -617,7 +617,7 @@
      - @@ -641,7 +641,7 @@ "' data-mask> > + } ?>>
      @@ -680,9 +680,9 @@
      > + } ?>>
      - @@ -704,11 +704,11 @@ ">
      + ?>
      - @@ -726,15 +726,15 @@ + } ?>" size="30" maxlength="50"> - 0) { - ?> + ?>

      @@ -747,7 +747,7 @@ while ($rowCustomField = mysqli_fetch_array($rsCustomFields, MYSQLI_BOTH)) { extract($rowCustomField); if (AuthenticationManager::getCurrentUser()->isEnabledSecurity($aSecurityType[$fam_custom_FieldSec])) { - ?> + ?>
      @@ -765,7 +765,7 @@
      + } ?>

      @@ -776,7 +776,7 @@
      0) { - ?> + ?>
@@ -849,7 +849,7 @@ @@ -926,8 +926,8 @@
- + @@ -936,7 +936,7 @@
'; - } + } echo '
@@ -813,14 +813,14 @@ } for ($iCount = 1; $iCount <= $iFamilyMemberRows; $iCount++) { - ?> + ?>
+ } ?>
@@ -835,13 +835,13 @@ @@ -915,8 +915,8 @@ } ?> - > +
'; echo ''; - } + } echo ''; echo ''; echo ' '; - if (AuthenticationManager::getCurrentUser()->isAddRecordsEnabled()) { - echo ' '; - } + if (AuthenticationManager::getCurrentUser()->isAddRecordsEnabled()) { + echo ' '; + } echo ' 0) { - echo " onclick=\"javascript:document.location='v2/family/$iFamilyID';\">"; - } else { - echo " onclick=\"javascript:document.location='" . SystemURLs::getRootPath() . "/v2/family';\">"; - } + if ($iFamilyID > 0) { + echo " onclick=\"javascript:document.location='v2/family/$iFamilyID';\">"; + } else { + echo " onclick=\"javascript:document.location='" . SystemURLs::getRootPath() . "/v2/family';\">"; + } echo ''; - ?> + ?> " name="FundRaiserSubmit"> + } else { + echo 'v2/dashboard'; + } ?>';"> 0) { echo '\n"; @@ -250,7 +250,7 @@
Delete - diff --git a/src/GroupList.php b/src/GroupList.php index 47c4b32166..e988a11395 100644 --- a/src/GroupList.php +++ b/src/GroupList.php @@ -34,7 +34,7 @@ isManageGroupsEnabled()) { -?> + ?>
diff --git a/src/GroupPropsEditor.php b/src/GroupPropsEditor.php index a52dc6e898..1ed635eefe 100644 --- a/src/GroupPropsEditor.php +++ b/src/GroupPropsEditor.php @@ -102,15 +102,15 @@ require 'Include/Header.php'; if (mysqli_num_rows($rsPropList) === 0) { -?> + ?>


- + ?>
@@ -145,7 +145,7 @@ - @@ -159,6 +159,6 @@
- + ?>

- + ?>
@@ -285,7 +285,7 @@ + ?>

@@ -349,10 +349,10 @@ > + } ?>> - @@ -369,7 +369,7 @@ - diff --git a/src/GroupReports.php b/src/GroupReports.php index ed9dd4d9c7..69535b183c 100644 --- a/src/GroupReports.php +++ b/src/GroupReports.php @@ -141,6 +141,6 @@ -getId() . '">' . gettext('Edit this Group') . ''; echo ''; ?> - getHasSpecialProps()) { echo '' . gettext('Edit Group-Specific Properties Form') . ''; } @@ -115,7 +115,7 @@ if (AuthenticationManager::getCurrentUser()->isEmailEnabled()) { // Does user have permission to email groups // Display link - ?> + ?>
-