Skip to content

Commit 43718ab

Browse files
committed
Use default country as standard
1 parent 416ce93 commit 43718ab

File tree

6 files changed

+16
-14
lines changed

6 files changed

+16
-14
lines changed

src/CartToFamily.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
require 'Include/Functions.php';
1717

1818
use ChurchCRM\Authentication\AuthenticationManager;
19+
use ChurchCRM\dto\SystemConfig;
1920
use ChurchCRM\dto\SystemURLs;
2021
use ChurchCRM\model\ChurchCRM\PersonQuery;
2122
use ChurchCRM\Utils\InputUtils;
@@ -50,8 +51,9 @@
5051
$sCity = SelectWhichInfo(InputUtils::legacyFilterInput($_POST['City']), $per_City);
5152
$sZip = SelectWhichInfo(InputUtils::legacyFilterInput($_POST['Zip']), $per_Zip);
5253
$sCountry = SelectWhichInfo(InputUtils::legacyFilterInput($_POST['Country']), $per_Country);
54+
$sDefaultCountry = SystemConfig::getValue('sDefaultCountry');
5355

54-
if ($sCountry == 'United States' || $sCountry == 'Canada') {
56+
if ($sCountry == $sDefaultCountry) {
5557
$sState = InputUtils::legacyFilterInput($_POST['State']);
5658
} else {
5759
$sState = InputUtils::legacyFilterInput($_POST['StateTextbox']);
@@ -287,11 +289,8 @@
287289
<td class="LabelColumn"><?= gettext('State') ?>:</td>
288290
<td class="TextColumn">
289291
<?php require 'Include/StateDropDown.php'; ?>
290-
OR
291-
<input type="text" name="StateTextbox" value="<?php if ($sCountry != 'United States' && $sCountry != 'Canada') {
292-
echo $sState;
293-
} ?>" size="20" maxlength="30">
294-
<BR><?= gettext('(Use the textbox for countries other than US and Canada)') ?>
292+
<?= gettext('OR') ?>
293+
<input type="text" name="StateTextbox" value="<?= $sState ?>" size="20" maxlength="30">
295294
</td>
296295
</tr>
297296

@@ -306,7 +305,7 @@
306305
<tr>
307306
<td class="LabelColumn"><?= gettext('Country') ?>:</td>
308307
<td class="TextColumnWithBottomBorder">
309-
<?php require 'Include/CountryDropDown.php' ?>
308+
<?php require 'Include/CountryDropDown.php'; ?>
310309
</td>
311310
</tr>
312311

src/PersonEditor.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,9 @@
211211
}
212212

213213
$sCountryTest = SelectWhichInfo($sCountry, $fam_Country, false);
214+
$sDefaultCountry = SystemConfig::getValue('sDefaultCountry');
214215
$sState = '';
215-
if ($sCountryTest == 'United States' || $sCountryTest == 'Canada') {
216+
if ($sCountryTest == $sDefaultCountry) {
216217
if (array_key_exists('State', $_POST)) {
217218
$sState = InputUtils::legacyFilterInput($_POST['State']);
218219
}
@@ -901,7 +902,7 @@ class="form-control">
901902
<div class="form-group col-md-2">
902903
<label><?= gettext('None State') ?>:</label>
903904
<input type="text" name="StateTextbox"
904-
value="<?php if ($sPhoneCountry != 'United States' && $sPhoneCountry != 'Canada') {
905+
value="<?php if ($sPhoneCountry != $sDefaultCountry) {
905906
echo htmlentities(stripslashes($sState), ENT_NOQUOTES, 'UTF-8');
906907
} ?>"
907908
size="20" maxlength="30" class="form-control">

src/Reports/CanvassReports.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ function CanvassBriefingSheets(string $iFYID): void
158158
$memberClassX = $memberAgeX + 20;
159159
$memberCellX = $memberClassX + 20;
160160
$memberEmailX = $memberCellX + 25;
161+
$sDefaultCountry = SystemConfig::getValue('sDefaultCountry');
161162

162163
while ($aFamily = mysqli_fetch_array($rsFamilies)) {
163164
$curY = $topY;
@@ -185,7 +186,7 @@ function CanvassBriefingSheets(string $iFYID): void
185186
}
186187
$pdf->writeAt(SystemConfig::getValue('leftX'), $curY, $aFamily['fam_City'] . ', ' . $aFamily['fam_State'] . ' ' . $aFamily['fam_Zip']);
187188
$curY += 5;
188-
if ($aFamily['fam_Country'] != '' && $aFamily['fam_Country'] != 'United States' && $aFamily['fam_Country'] != 'USA') {
189+
if ($aFamily['fam_Country'] != '' && $aFamily['fam_Country'] != $sDefaultCountry) {
189190
$pdf->writeAt(SystemConfig::getValue('leftX'), $curY, $aFamily['fam_Country']);
190191
$curY += 5;
191192
}

src/Reports/ConfirmLabels.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
}
4343
$labelText .= sprintf("\n%s, %s %s", $family->getCity(), $family->getState(), $family->getZip());
4444

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

src/Reports/NewsLetterLabels.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
}
4545
$labelText .= sprintf("\n%s, %s %s", $family->getCity(), $family->getState(), $family->getZip());
4646

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

src/Reports/TaxReport.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,8 @@ public function finishPage($curY, $fam_ID, $fam_Name, $fam_Address1, $fam_Addres
241241
}
242242
$this->writeAt(SystemConfig::getValue('leftX'), $curY, $fam_City . ', ' . $fam_State . ' ' . $fam_Zip);
243243
$curY += SystemConfig::getValue('incrementY');
244-
if ($fam_Country != '' && $fam_Country != 'USA' && $fam_Country != 'United States') {
244+
$sDefaultCountry = SystemConfig::getValue('sDefaultCountry');
245+
if ($fam_Country != '' && $fam_Country != $sDefaultCountry) {
245246
$this->writeAt(SystemConfig::getValue('leftX'), $curY, $fam_Country);
246247
$curY += SystemConfig::getValue('incrementY');
247248
}
@@ -255,7 +256,7 @@ public function finishPage($curY, $fam_ID, $fam_Name, $fam_Address1, $fam_Addres
255256
}
256257
$this->writeAt(SystemConfig::getValue('leftX') + 5, $curY, SystemConfig::getValue('sChurchCity') . ', ' . SystemConfig::getValue('sChurchState') . ' ' . SystemConfig::getValue('sChurchZip'));
257258
$curY += SystemConfig::getValue('incrementY');
258-
if ($fam_Country != '' && $fam_Country != 'USA' && $fam_Country != 'United States') {
259+
if ($fam_Country != '' && $fam_Country != $sDefaultCountry) {
259260
$this->writeAt(SystemConfig::getValue('leftX') + 5, $curY, $fam_Country);
260261
$curY += SystemConfig::getValue('incrementY');
261262
}

0 commit comments

Comments
 (0)