Don't require both father and mother name

master
Skylar Ittner 1 year ago
parent 83cfed0d0d
commit 81cf7ccb78

@ -244,7 +244,7 @@ if (empty($VARS['id']) || !$database->has('families', ['familyid' => $VARS['id']
<?php
}
if (empty($item['optional'])) {
echo "required";
echo " required ";
} ?>/>
<?php } else if ($item['type'] == "select") { ?>
<select class="form-control"

@ -125,6 +125,9 @@ $family = (new Family())->load($famid);
],
];
foreach ($items as $i) {
if (empty($i['value'])) {
continue;
}
?>
<div class="list-group-item h5 mb-2">
<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.");
}
$database->action(function($database) {
$database->action(function ($database) {
global $family, $renewal, $SETTINGS;
try {
$lastname = $_POST['familyname'];
$father = $_POST['fathername'];
$mother = $_POST['mothername'];
$father = $_POST['fathername'] ?? "";
$mother = $_POST['mothername'] ?? "";
if (empty($lastname)) {
errorBack("Enter a last name.");
}
if (empty($father)) {
errorBack("Enter a father name.");
}
if (empty($mother)) {
errorBack("Enter a mother name.");
if (empty($father) && empty($mother)) {
errorBack("Enter the father and/or mother's name.");
}
$family->setName($lastname);
@ -83,7 +80,6 @@ $database->action(function($database) {
$family->setState($state);
$family->setZip($zip);
$newsletter = $_POST['newsletter_method'];
$membership_cost = 2500;
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']]);
$children = $database->select("people", 'personid', ['familyid' => $_SESSION['familyid']]);
$familyname = $familyinfo['familyname'];
$fathername = $familyinfo['fathername'];
$mothername = $familyinfo['mothername'];
$fathername = $familyinfo['fathername'] ?? "";
$mothername = $familyinfo['mothername'] ?? "";
$streetaddress = $familyinfo['address'];
$city = $familyinfo['city'];
$state = $familyinfo['state'];
@ -102,7 +102,8 @@ if (isset($_SESSION['familyid']) && $database->has('families', ['familyid' => $_
"name" => "fathername",
"maxlength" => 255,
"value" => $fathername,
"error" => "Enter the father's name."
"error" => "Enter the father's name.",
"optional" => true
],
[
"label" => "Mother's Name",
@ -110,7 +111,8 @@ if (isset($_SESSION['familyid']) && $database->has('families', ['familyid' => $_
"name" => "mothername",
"maxlength" => 255,
"value" => $mothername,
"error" => "Enter the mother's name."
"error" => "Enter the mother's name.",
"optional" => true
],
[
"label" => "Street Address",
@ -266,7 +268,10 @@ if (isset($_SESSION['familyid']) && $database->has('families', ['familyid' => $_
value="<?php echo htmlspecialchars($item['value']); ?>"
<?php
}
?>required />
if (empty($item['optional'])) {
echo " required ";
}
?> />
<?php } else if ($item['type'] == "select") { ?>
<select class="form-control"
name="<?php echo $item['name']; ?>"

Loading…
Cancel
Save