Skip to content

Commit

Permalink
Merge pull request #6652 from ChurchCRM/allow-empty-birthday-on-perso…
Browse files Browse the repository at this point in the history
…n-input

allow for empty birthday when initially inputting person
  • Loading branch information
DawoudIO authored Nov 12, 2023
2 parents 82e06c5 + d82d64e commit 50b714d
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions src/PersonEditor.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* website : http://www.churchcrm.io
* copyright : Copyright 2001, 2002, 2003 Deane Barker, Chris Gebhardt
* Copyright 2004-2005 Michael Wilt
*
*
******************************************************************************/

//Include the function library
Expand Down Expand Up @@ -44,7 +44,8 @@
if ($iPersonID > 0) {
$sSQL = 'SELECT per_fam_ID FROM person_per WHERE per_ID = ' . $iPersonID;
$rsPerson = RunQuery($sSQL);
extract(mysqli_fetch_array($rsPerson));
$aRow = mysqli_fetch_array($rsPerson);
$per_fam_ID = $aRow['per_fam_ID'];

if (mysqli_num_rows($rsPerson) == 0) {
RedirectUtils::redirect('Menu.php');
Expand Down Expand Up @@ -146,7 +147,8 @@
if ($iFamily > 0) {
$sSQL = 'SELECT fam_Country FROM family_fam WHERE fam_ID = ' . $iFamily;
$rsFamCountry = RunQuery($sSQL);
extract(mysqli_fetch_array($rsFamCountry));
$aRow = mysqli_fetch_array($rsFamCountry);
$fam_Country = $aRow['fam_Country'];
}

$sCountryTest = SelectWhichInfo($sCountry, $fam_Country, false);
Expand Down Expand Up @@ -212,7 +214,7 @@
if ($iBirthMonth > 0 xor $iBirthDay > 0) {
$sBirthDateError = gettext('Invalid Birth Date: Missing birth month or day.');
$bErrorFlag = true;
} elseif (strlen($iBirthYear) > 0 && $iBirthMonth == 0 && $iBirthDay == 0) {
} elseif ($iBirthYear > 0 && $iBirthMonth == 0 && $iBirthDay == 0) {
$sBirthDateError = gettext('Invalid Birth Date: Missing birth month and day.');
$bErrorFlag = true;
} elseif (strlen($iBirthYear) > 0) {
Expand Down Expand Up @@ -321,7 +323,8 @@
//Get the key back
$sSQL = 'SELECT MAX(fam_ID) AS iFamily FROM family_fam';
$rsLastEntry = RunQuery($sSQL);
extract(mysqli_fetch_array($rsLastEntry));
$aRow = mysqli_fetch_array($rsLastEntry);
$iFamily = $aRow['iFamily'];
}

if ($bHideAge) {
Expand Down Expand Up @@ -399,7 +402,8 @@
if ($bGetKeyBack) {
$sSQL = 'SELECT MAX(per_ID) AS iPersonID FROM person_per';
$rsPersonID = RunQuery($sSQL);
extract(mysqli_fetch_array($rsPersonID));
$aRow = mysqli_fetch_array($rsPersonID);
$iPersonID = $aRow['iPersonID'];
$sSQL = "INSERT INTO person_custom (per_ID) VALUES ('" . $iPersonID . "')";
RunQuery($sSQL);
$note->setPerId($iPersonID);
Expand Down Expand Up @@ -740,12 +744,11 @@ class="form-control">
<div class="col-md-2">
<label><?= gettext('Birth Day') ?>:</label>
<select id="BirthDay" name="BirthDay" class="form-control">
<option value="0"><?= gettext('Select Day') ?></option>
<option value="0" ><?= gettext('Select Day') ?></option>
<?php for ($x = 1; $x < 32; $x++) {
$sDay = $x;
if ($x < 10) {
$sDay = '0' . $x;
} else {
$sDay = $x;
} ?>
<option value="<?= $sDay ?>" <?php if ($iBirthDay == $x) {
echo 'selected';
Expand Down

0 comments on commit 50b714d

Please sign in to comment.