Commit 8fb24f9a authored by Denis S. Valdenaire's avatar Denis S. Valdenaire

Diverses corrections

parent 0166662c
......@@ -13,6 +13,16 @@ class Family_Member extends Record {
$this->link_name = Member::get_family_link_name($this->link_id);
}
public static function fetch($id) {
// SQL SELECT lud_family_members
$sql = " SELECT id, firstname, lastname, DATE_FORMAT(birth_date, '%d/%m/%Y') AS birth_date, link_id,
member_id
FROM ".Family_Member::$table."
WHERE id = ".$id;
$GLOBALS["data"]->select($sql, $family_member, "Family_Member");
return $family_member;
}
public static function fetch_all(&$family_members, $member_id) {
$family_members = array();
// SQL SELECT lud_family_members
......
......@@ -50,7 +50,7 @@ class Record {
}
if($update_sql != "") {
// SQL UPDATE record.table
$sql = " UPDATE ".static::table." SET ".$update_sql." updated_at = now()
$sql = " UPDATE ".static::$table." SET ".$update_sql." updated_at = now()
WHERE id = ".$this->id;
return $GLOBALS["data"]->update($sql);
} else {
......@@ -60,7 +60,7 @@ class Record {
public function delete() {
// SQL DELETE record.table
$sql = " DELETE FROM ".$this->table."
$sql = " DELETE FROM ".static::$table."
WHERE id = ".$this->id;
return $GLOBALS["data"]->delete($sql);
}
......
......@@ -39,7 +39,7 @@ class FamilyMembersController extends AppController {
$family_member = Family_Member::fetch($GLOBALS["data"]->db_escape_string($_REQUEST["i"]));
if($family_member->id != 0) {
$family_member->delete();
Family_Member::fetch_all($family_members, $_REQUEST["i"]);
Family_Member::fetch_all($family_members, $family_member->member_id);
echo json_encode($family_members);
exit(); // no further rendering needed
} else {
......
......@@ -195,10 +195,12 @@ class MembersController extends AppController {
if($member->id != 0) {
$_REQUEST["member_id"] = $member->id;
// the user must first have an account in the accounting part
/*
if(!$member->account_id) {
$member->account_id = Account::create_for_member($member->id);
$member->save_account();
}
*/
$member->create_subscription();
$member->fetch_subscriptions();
$this->set("member", $member);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment