Don't require both father and mother name
This commit is contained in:
parent
83cfed0d0d
commit
81cf7ccb78
@ -244,7 +244,7 @@ if (empty($VARS['id']) || !$database->has('families', ['familyid' => $VARS['id']
|
|||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
if (empty($item['optional'])) {
|
if (empty($item['optional'])) {
|
||||||
echo "required";
|
echo " required ";
|
||||||
} ?>/>
|
} ?>/>
|
||||||
<?php } else if ($item['type'] == "select") { ?>
|
<?php } else if ($item['type'] == "select") { ?>
|
||||||
<select class="form-control"
|
<select class="form-control"
|
||||||
|
@ -125,6 +125,9 @@ $family = (new Family())->load($famid);
|
|||||||
],
|
],
|
||||||
];
|
];
|
||||||
foreach ($items as $i) {
|
foreach ($items as $i) {
|
||||||
|
if (empty($i['value'])) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
<div class="list-group-item h5 mb-2">
|
<div class="list-group-item h5 mb-2">
|
||||||
<i class="<?php echo $i['icon']; ?>"></i> <?php
|
<i class="<?php echo $i['icon']; ?>"></i> <?php
|
||||||
|
@ -33,22 +33,19 @@ if (!empty($_SESSION['familyid']) && $database->has("families", ['familyid' => $
|
|||||||
die("You took too long and were automatically logged out. Please try again.");
|
die("You took too long and were automatically logged out. Please try again.");
|
||||||
}
|
}
|
||||||
|
|
||||||
$database->action(function($database) {
|
$database->action(function ($database) {
|
||||||
global $family, $renewal, $SETTINGS;
|
global $family, $renewal, $SETTINGS;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$lastname = $_POST['familyname'];
|
$lastname = $_POST['familyname'];
|
||||||
$father = $_POST['fathername'];
|
$father = $_POST['fathername'] ?? "";
|
||||||
$mother = $_POST['mothername'];
|
$mother = $_POST['mothername'] ?? "";
|
||||||
|
|
||||||
if (empty($lastname)) {
|
if (empty($lastname)) {
|
||||||
errorBack("Enter a last name.");
|
errorBack("Enter a last name.");
|
||||||
}
|
}
|
||||||
if (empty($father)) {
|
if (empty($father) && empty($mother)) {
|
||||||
errorBack("Enter a father name.");
|
errorBack("Enter the father and/or mother's name.");
|
||||||
}
|
|
||||||
if (empty($mother)) {
|
|
||||||
errorBack("Enter a mother name.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$family->setName($lastname);
|
$family->setName($lastname);
|
||||||
@ -83,7 +80,6 @@ $database->action(function($database) {
|
|||||||
$family->setState($state);
|
$family->setState($state);
|
||||||
$family->setZip($zip);
|
$family->setZip($zip);
|
||||||
|
|
||||||
|
|
||||||
$newsletter = $_POST['newsletter_method'];
|
$newsletter = $_POST['newsletter_method'];
|
||||||
$membership_cost = 2500;
|
$membership_cost = 2500;
|
||||||
if (empty($newsletter)) {
|
if (empty($newsletter)) {
|
||||||
|
@ -26,8 +26,8 @@ if (isset($_SESSION['familyid']) && $database->has('families', ['familyid' => $_
|
|||||||
$familyinfo = $database->get("families", ['familyname', 'phone', 'email', 'address', 'city', 'state', 'zip', 'father_name (fathername)', 'mother_name (mothername)', 'newsletter_method'], ['familyid' => $_SESSION['familyid']]);
|
$familyinfo = $database->get("families", ['familyname', 'phone', 'email', 'address', 'city', 'state', 'zip', 'father_name (fathername)', 'mother_name (mothername)', 'newsletter_method'], ['familyid' => $_SESSION['familyid']]);
|
||||||
$children = $database->select("people", 'personid', ['familyid' => $_SESSION['familyid']]);
|
$children = $database->select("people", 'personid', ['familyid' => $_SESSION['familyid']]);
|
||||||
$familyname = $familyinfo['familyname'];
|
$familyname = $familyinfo['familyname'];
|
||||||
$fathername = $familyinfo['fathername'];
|
$fathername = $familyinfo['fathername'] ?? "";
|
||||||
$mothername = $familyinfo['mothername'];
|
$mothername = $familyinfo['mothername'] ?? "";
|
||||||
$streetaddress = $familyinfo['address'];
|
$streetaddress = $familyinfo['address'];
|
||||||
$city = $familyinfo['city'];
|
$city = $familyinfo['city'];
|
||||||
$state = $familyinfo['state'];
|
$state = $familyinfo['state'];
|
||||||
@ -102,7 +102,8 @@ if (isset($_SESSION['familyid']) && $database->has('families', ['familyid' => $_
|
|||||||
"name" => "fathername",
|
"name" => "fathername",
|
||||||
"maxlength" => 255,
|
"maxlength" => 255,
|
||||||
"value" => $fathername,
|
"value" => $fathername,
|
||||||
"error" => "Enter the father's name."
|
"error" => "Enter the father's name.",
|
||||||
|
"optional" => true
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"label" => "Mother's Name",
|
"label" => "Mother's Name",
|
||||||
@ -110,7 +111,8 @@ if (isset($_SESSION['familyid']) && $database->has('families', ['familyid' => $_
|
|||||||
"name" => "mothername",
|
"name" => "mothername",
|
||||||
"maxlength" => 255,
|
"maxlength" => 255,
|
||||||
"value" => $mothername,
|
"value" => $mothername,
|
||||||
"error" => "Enter the mother's name."
|
"error" => "Enter the mother's name.",
|
||||||
|
"optional" => true
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"label" => "Street Address",
|
"label" => "Street Address",
|
||||||
@ -266,7 +268,10 @@ if (isset($_SESSION['familyid']) && $database->has('families', ['familyid' => $_
|
|||||||
value="<?php echo htmlspecialchars($item['value']); ?>"
|
value="<?php echo htmlspecialchars($item['value']); ?>"
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
?>required />
|
if (empty($item['optional'])) {
|
||||||
|
echo " required ";
|
||||||
|
}
|
||||||
|
?> />
|
||||||
<?php } else if ($item['type'] == "select") { ?>
|
<?php } else if ($item['type'] == "select") { ?>
|
||||||
<select class="form-control"
|
<select class="form-control"
|
||||||
name="<?php echo $item['name']; ?>"
|
name="<?php echo $item['name']; ?>"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user