diff --git a/addressbook/add.php b/addressbook/add.php index 7e3174f9b3..10cbef0108 100755 --- a/addressbook/add.php +++ b/addressbook/add.php @@ -23,6 +23,8 @@ $t = new Template($phpgw_info["server"]["app_tpl"]); $t->set_file(array( "add" => "add.tpl")); + $this = CreateObject("addressbook.addressbook"); + if ($AddVcard){ Header("Location: " . $phpgw->link($phpgw_info["server"]["webserver_url"] . "/addressbook/vcardin.php")); @@ -39,66 +41,38 @@ } else { $bday = "$bday_month/$bday_day/$bday_year"; } - if ($access != "private" && $access != "public") { $access = $phpgw->accounts->array_to_string($access,$n_groups); } - if ($url == "http://") { $url = ""; } - if ($phpgw_info["apps"]["timetrack"]["enabled"]) { - $sql = "insert into addressbook (ab_owner,ab_access,ab_firstname,ab_lastname,ab_title,ab_email," - . "ab_hphone,ab_wphone,ab_fax,ab_pager,ab_mphone,ab_ophone,ab_street,ab_address2,ab_city," - . "ab_state,ab_zip,ab_bday," - . "ab_notes,ab_company_id,ab_url) values ('" . $phpgw_info["user"]["account_id"] . "','$access','" - . addslashes($firstname). "','" - . addslashes($lastname) . "','" - . addslashes($title) . "','" - . addslashes($email) . "','" - . addslashes($hphone) . "','" - . addslashes($wphone) . "','" - . addslashes($fax) . "','" - . addslashes($pager) . "','" - . addslashes($mphone) . "','" - . addslashes($ophone) . "','" - . addslashes($street) . "','" - . addslashes($address2) . "','" - . addslashes($city) . "','" - . addslashes($state) . "','" - . addslashes($zip) . "','" - . addslashes($bday) . "','" - . addslashes($notes) . "','" - . addslashes($company) . "','" - . addslashes($url) . "')"; - } else { - $sql = "insert into addressbook (ab_owner,ab_access,ab_firstname,ab_lastname,ab_title,ab_email," - . "ab_hphone,ab_wphone,ab_fax,ab_pager,ab_mphone,ab_ophone,ab_street,ab_address2,ab_city," - . "ab_state,ab_zip,ab_bday," - . "ab_notes,ab_company,ab_url) values ('" . $phpgw_info["user"]["account_id"] . "','$access','" - . addslashes($firstname). "','" - . addslashes($lastname) . "','" - . addslashes($title) . "','" - . addslashes($email) . "','" - . addslashes($hphone) . "','" - . addslashes($wphone) . "','" - . addslashes($fax) . "','" - . addslashes($pager) . "','" - . addslashes($mphone) . "','" - . addslashes($ophone) . "','" - . addslashes($street) . "','" - . addslashes($address2) . "','" - . addslashes($city) . "','" - . addslashes($state) . "','" - . addslashes($zip) . "','" - . addslashes($bday) . "','" - . addslashes($notes) . "','" - . addslashes($company) . "','" - . addslashes($url) . "')"; - } - $phpgw->db->query($sql); - + $this->id = $ab_id; + $this->company = $company; + $this->company_id = $company_id; + $this->firstname = $firstname; + $this->lastname = $lastname; + $this->email = $email; + $this->title = $title; + $this->wphone = $wphone; + $this->hphone = $hphone; + $this->fax = $fax; + $this->pager = $pager; + $this->mphone = $mphone; + $this->ophone = $ophone; + $this->street = $street; + $this->address2 = $address2; + $this->city = $city; + $this->state = $state; + $this->zip = $zip; + $this->bday = $bday; + $this->url = $url; + $this->notes = $notes; + $this->access = $access; + + $this->add_entry(); + Header("Location: " . $phpgw->link($phpgw_info["server"]["webserver_url"] . "/addressbook/", "cd=14")); }