Skip to content

Commit

Permalink
Use default country as standard
Browse files Browse the repository at this point in the history
  • Loading branch information
respencer committed May 7, 2024
1 parent cdd66b2 commit 577b171
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 9 deletions.
6 changes: 4 additions & 2 deletions src/CartToFamily.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
require 'Include/Functions.php';

use ChurchCRM\Authentication\AuthenticationManager;
use ChurchCRM\dto\SystemConfig;
use ChurchCRM\dto\SystemURLs;
use ChurchCRM\model\ChurchCRM\PersonQuery;
use ChurchCRM\Utils\InputUtils;
Expand Down Expand Up @@ -50,8 +51,9 @@
$sCity = SelectWhichInfo(InputUtils::legacyFilterInput($_POST['City']), $per_City);
$sZip = SelectWhichInfo(InputUtils::legacyFilterInput($_POST['Zip']), $per_Zip);
$sCountry = SelectWhichInfo(InputUtils::legacyFilterInput($_POST['Country']), $per_Country);
$sDefaultCountry = SystemConfig::getValue('sDefaultCountry');

if ($sCountry == 'United States' || $sCountry == 'Canada') {
if ($sCountry == $sDefaultCountry) {
$sState = InputUtils::legacyFilterInput($_POST['State']);
} else {
$sState = InputUtils::legacyFilterInput($_POST['StateTextbox']);
Expand Down Expand Up @@ -288,7 +290,7 @@
<td class="TextColumn">
<?php require 'Include/StateDropDown.php'; ?>
OR
<input type="text" name="StateTextbox" value="<?php if ($sCountry != 'United States' && $sCountry != 'Canada') {
<input type="text" name="StateTextbox" value="<?php if ($sCountry != $sDefaultCountry) {
echo $sState;
} ?>" size="20" maxlength="30">
<BR><?= gettext('(Use the textbox for countries other than US and Canada)') ?>
Expand Down
5 changes: 3 additions & 2 deletions src/PersonEditor.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,9 @@
}

$sCountryTest = SelectWhichInfo($sCountry, $fam_Country, false);
$sDefaultCountry = SystemConfig::getValue('sDefaultCountry');
$sState = '';
if ($sCountryTest == 'United States' || $sCountryTest == 'Canada') {
if ($sCountryTest == $sDefaultCountry) {
if (array_key_exists('State', $_POST)) {
$sState = InputUtils::legacyFilterInput($_POST['State']);
}
Expand Down Expand Up @@ -903,7 +904,7 @@ class="form-control">
<div class="form-group col-md-2">
<label><?= gettext('None State') ?>:</label>
<input type="text" name="StateTextbox"
value="<?php if ($sPhoneCountry != 'United States' && $sPhoneCountry != 'Canada') {
value="<?php if ($sPhoneCountry != $sDefaultCountry) {
echo htmlentities(stripslashes($sState), ENT_NOQUOTES, 'UTF-8');
} ?>"
size="20" maxlength="30" class="form-control">
Expand Down
3 changes: 2 additions & 1 deletion src/Reports/CanvassReports.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ function CanvassBriefingSheets(string $iFYID): void
$memberClassX = $memberAgeX + 20;
$memberCellX = $memberClassX + 20;
$memberEmailX = $memberCellX + 25;
$sDefaultCountry = SystemConfig::getValue('sDefaultCountry');

while ($aFamily = mysqli_fetch_array($rsFamilies)) {
$curY = $topY;
Expand Down Expand Up @@ -185,7 +186,7 @@ function CanvassBriefingSheets(string $iFYID): void
}
$pdf->writeAt(SystemConfig::getValue('leftX'), $curY, $aFamily['fam_City'] . ', ' . $aFamily['fam_State'] . ' ' . $aFamily['fam_Zip']);
$curY += 5;
if ($aFamily['fam_Country'] != '' && $aFamily['fam_Country'] != 'United States' && $aFamily['fam_Country'] != 'USA') {
if ($aFamily['fam_Country'] != '' && $aFamily['fam_Country'] != $sDefaultCountry) {
$pdf->writeAt(SystemConfig::getValue('leftX'), $curY, $aFamily['fam_Country']);
$curY += 5;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Reports/ConfirmLabels.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
}
$labelText .= sprintf("\n%s, %s %s", $family->getCity(), $family->getState(), $family->getZip());

if ($family->getCountry() != '' && $family->getCountry() != 'USA' && $family->getCountry() != 'United States') {
if ($family->getCountry() != '' && $family->getCountry() != $sDefaultCountry) {
$labelText .= "\n" . $family->getCountry();
}

Expand Down
2 changes: 1 addition & 1 deletion src/Reports/NewsLetterLabels.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
}
$labelText .= sprintf("\n%s, %s %s", $family->getCity(), $family->getState(), $family->getZip());

if ($family->getCountry() != '' && $family->getCountry() != 'US' && $family->getCountry() != 'USA' && $family->getCountry() != 'United States') {
if ($family->getCountry() != '' && $family->getCountry() != $sDefaultCountry) {
$labelText .= "\n" . $family->getCountry();
}

Expand Down
5 changes: 3 additions & 2 deletions src/Reports/TaxReport.php
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,8 @@ public function finishPage($curY, $fam_ID, $fam_Name, $fam_Address1, $fam_Addres
}
$this->writeAt(SystemConfig::getValue('leftX'), $curY, $fam_City . ', ' . $fam_State . ' ' . $fam_Zip);
$curY += SystemConfig::getValue('incrementY');
if ($fam_Country != '' && $fam_Country != 'USA' && $fam_Country != 'United States') {
$sDefaultCountry = SystemConfig::getValue('sDefaultCountry');
if ($fam_Country != '' && $fam_Country != $sDefaultCountry) {
$this->writeAt(SystemConfig::getValue('leftX'), $curY, $fam_Country);
$curY += SystemConfig::getValue('incrementY');
}
Expand All @@ -267,7 +268,7 @@ public function finishPage($curY, $fam_ID, $fam_Name, $fam_Address1, $fam_Addres
}
$this->writeAt(SystemConfig::getValue('leftX') + 5, $curY, SystemConfig::getValue('sChurchCity') . ', ' . SystemConfig::getValue('sChurchState') . ' ' . SystemConfig::getValue('sChurchZip'));
$curY += SystemConfig::getValue('incrementY');
if ($fam_Country != '' && $fam_Country != 'USA' && $fam_Country != 'United States') {
if ($fam_Country != '' && $fam_Country != $sDefaultCountry) {
$this->writeAt(SystemConfig::getValue('leftX') + 5, $curY, $fam_Country);
$curY += SystemConfig::getValue('incrementY');
}
Expand Down

0 comments on commit 577b171

Please sign in to comment.