Fix adding families, fix deleting families with interests (close #10)

master
Skylar Ittner 6 years ago
parent b1fafb57dc
commit f65a9d33ff

@ -180,7 +180,7 @@ switch ($VARS['action']) {
} }
}); });
returnToSender("family_saved"); returnToSender("family_saved", "&id=" . $family->getID());
break; break;
case "deletefamily": case "deletefamily":
if (!(new User($_SESSION['uid']))->hasPermission("HACHEPORTAL_EDIT")) { if (!(new User($_SESSION['uid']))->hasPermission("HACHEPORTAL_EDIT")) {
@ -189,6 +189,7 @@ switch ($VARS['action']) {
if (!empty($VARS['familyid']) && $database->count("families", ['familyid' => $VARS['familyid']]) === 1) { if (!empty($VARS['familyid']) && $database->count("families", ['familyid' => $VARS['familyid']]) === 1) {
$database->delete("people", ["familyid" => $VARS['familyid']]); $database->delete("people", ["familyid" => $VARS['familyid']]);
$database->delete("interests", ["familyid" => $VARS['familyid']]);
$database->delete("payments", ["familyid" => $VARS['familyid']]); $database->delete("payments", ["familyid" => $VARS['familyid']]);
$database->delete("families", ["familyid" => $VARS['familyid']]); $database->delete("families", ["familyid" => $VARS['familyid']]);
returnToSender("family_deleted"); returnToSender("family_deleted");

@ -9,17 +9,17 @@
class Family { class Family {
private $id; private $id;
private $name; private $name = "";
private $father; private $father = "";
private $mother; private $mother = "";
private $phone; private $phone = "";
private $email; private $email = "";
private $address; private $address = "";
private $city; private $city = "";
private $state; private $state = "";
private $zip; private $zip = "";
private $photo; private $photo = false;
private $newsletter; private $newsletter = 1;
private $children = []; private $children = [];
public function __construct() { public function __construct() {

@ -40,9 +40,9 @@ if (empty($VARS['id']) || !$database->has('families', ['familyid' => $VARS['id']
} }
?> ?>
</div> </div>
<div class="ml-auto btn btn-outline-info btn-sm" id="cancelbtn"> <a href="./app.php?page=families" class="ml-auto btn btn-outline-info btn-sm">
<i class="fas fa-times"></i> <?php $Strings->get("Cancel"); ?> <i class="fas fa-times"></i> <?php $Strings->get("Cancel"); ?>
</div> </a>
</h3> </h3>
<div class="card-body"> <div class="card-body">
@ -300,8 +300,8 @@ if (empty($VARS['id']) || !$database->has('families', ['familyid' => $VARS['id']
<?php <?php
} }
?> ?>
<input type="hidden" name="source" value="editfamily" />
<input type="hidden" name="action" value="editfamily" /> <input type="hidden" name="action" value="editfamily" />
<input type="hidden" name="source" value="families" />
<div class="card-footer d-flex"> <div class="card-footer d-flex">
<button type="submit" class="btn btn-success mr-1"> <button type="submit" class="btn btn-success mr-1">

@ -18,7 +18,9 @@ $families = $database->select("families", ['familyid (id)', 'familyname', 'phone
?> ?>
<div class="btn-group"> <div class="btn-group">
<a href="app.php?page=editfamily" class="btn btn-success"><i class="fas fa-plus"></i> <?php $Strings->get("Add Family"); ?></a> <?php if ($writeaccess) { ?>
<a href="app.php?page=editfamily" class="btn btn-success"><i class="fas fa-plus"></i> <?php $Strings->get("Add Family"); ?></a>
<?php } ?>
</div> </div>
<table id="famtable" class="table table-bordered table-hover table-sm"> <table id="famtable" class="table table-bordered table-hover table-sm">
<thead> <thead>

@ -12,8 +12,4 @@ $("#add_child_row").click(function () {
$.get("lib/template_child_entry.php", {}, function (resp) { $.get("lib/template_child_entry.php", {}, function (resp) {
$("#child_list").append(resp); $("#child_list").append(resp);
}); });
});
$("#cancelbtn").click(function () {
history.back();
}); });
Loading…
Cancel
Save