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

master
Skylar Ittner 5 years ago
parent b1fafb57dc
commit f65a9d33ff

@ -180,7 +180,7 @@ switch ($VARS['action']) {
}
});
returnToSender("family_saved");
returnToSender("family_saved", "&id=" . $family->getID());
break;
case "deletefamily":
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) {
$database->delete("people", ["familyid" => $VARS['familyid']]);
$database->delete("interests", ["familyid" => $VARS['familyid']]);
$database->delete("payments", ["familyid" => $VARS['familyid']]);
$database->delete("families", ["familyid" => $VARS['familyid']]);
returnToSender("family_deleted");

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

@ -40,9 +40,9 @@ if (empty($VARS['id']) || !$database->has('families', ['familyid' => $VARS['id']
}
?>
</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"); ?>
</div>
</a>
</h3>
<div class="card-body">
@ -300,8 +300,8 @@ if (empty($VARS['id']) || !$database->has('families', ['familyid' => $VARS['id']
<?php
}
?>
<input type="hidden" name="source" value="editfamily" />
<input type="hidden" name="action" value="editfamily" />
<input type="hidden" name="source" value="families" />
<div class="card-footer d-flex">
<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">
<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>
<table id="famtable" class="table table-bordered table-hover table-sm">
<thead>

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