From c9af8bfe46a7c1040c18a92124fc7caa3ae3489d Mon Sep 17 00:00:00 2001 From: skeeter Date: Fri, 23 Mar 2001 03:10:28 +0000 Subject: [PATCH] Created new delete() for sql. --- phpgwapi/inc/class.accounts_sql.inc.php | 47 +++++++++++++++---------- 1 file changed, 28 insertions(+), 19 deletions(-) diff --git a/phpgwapi/inc/class.accounts_sql.inc.php b/phpgwapi/inc/class.accounts_sql.inc.php index 7bd06123d9..4dddde8e2a 100644 --- a/phpgwapi/inc/class.accounts_sql.inc.php +++ b/phpgwapi/inc/class.accounts_sql.inc.php @@ -38,32 +38,41 @@ $this->db = $phpgw->db; } - function read_repository() - { - global $phpgw, $phpgw_info; - $this->db->query("select * from phpgw_accounts where account_id='" . $this->account_id . "'",__LINE__,__FILE__); - $this->db->next_record(); + function read_repository() + { + global $phpgw, $phpgw_info; + $this->db->query("select * from phpgw_accounts where account_id='" . $this->account_id . "'",__LINE__,__FILE__); + $this->db->next_record(); - $this->data["userid"] = $this->db->f("account_lid"); - $this->data["account_id"] = $this->db->f("account_id"); - $this->data["account_lid"] = $this->db->f("account_lid"); - $this->data["firstname"] = $this->db->f("account_firstname"); - $this->data["lastname"] = $this->db->f("account_lastname"); - $this->data["fullname"] = $this->db->f("account_firstname") . " " - . $this->db->f("account_lastname"); - $this->data["lastlogin"] = $this->db->f("account_lastlogin"); - $this->data["lastloginfrom"] = $this->db->f("account_lastloginfrom"); - $this->data["lastpasswd_change"] = $this->db->f("account_lastpwd_change"); - $this->data["status"] = $this->db->f("account_status"); - return $this->data; - } + $this->data["userid"] = $this->db->f("account_lid"); + $this->data["account_id"] = $this->db->f("account_id"); + $this->data["account_lid"] = $this->db->f("account_lid"); + $this->data["firstname"] = $this->db->f("account_firstname"); + $this->data["lastname"] = $this->db->f("account_lastname"); + $this->data["fullname"] = $this->db->f("account_firstname") . " " + . $this->db->f("account_lastname"); + $this->data["lastlogin"] = $this->db->f("account_lastlogin"); + $this->data["lastloginfrom"] = $this->db->f("account_lastloginfrom"); + $this->data["lastpasswd_change"] = $this->db->f("account_lastpwd_change"); + $this->data["status"] = $this->db->f("account_status"); + return $this->data; + } function save_repository() { $this->db->query("update phpgw_accounts set account_firstname='" . $this->data['firstname'] . "', account_lastname='" . $this->data['lastname'] . "', account_status='" . $this->data['status'] . "' where account_id='" . $this->account_id . "'",__LINE__,__FILE__); - + } + + function delete($accountid = '') + { + global $phpgw, $phpgw_info; + + $account_id = get_account_id($accountid); + + // Do this last since we are depending upon this record to get the account_lid above + $this->db->query('DELETE FROM phpgw_accounts WHERE account_id='.$account_id); }