From ca81e77597be1d2ffc4cef34fc09a7c07cdc0bc9 Mon Sep 17 00:00:00 2001 From: Miles Lott Date: Fri, 2 Feb 2001 16:19:37 +0000 Subject: [PATCH] Some changes to templates and php files to add some custom fields --- addressbook/add.php | 41 ++++++++++--------- addressbook/edit.php | 2 + addressbook/inc/class.contacts.inc.php | 2 +- addressbook/inc/class.contacts_shared.inc.php | 1 + addressbook/inc/class.contacts_sql.inc.php | 18 +++++--- addressbook/inc/functions.inc.php | 12 ++++++ addressbook/index.php | 2 +- addressbook/templates/default/form.tpl | 18 +++++++- addressbook/templates/justweb/form.tpl | 9 ++++ addressbook/templates/verdilak/form.tpl | 9 ++++ addressbook/view.php | 17 +++++--- 11 files changed, 97 insertions(+), 34 deletions(-) diff --git a/addressbook/add.php b/addressbook/add.php index e721508f57..8f355a7b1d 100755 --- a/addressbook/add.php +++ b/addressbook/add.php @@ -48,26 +48,27 @@ $url = ""; } - $fields["company"] = $company; - $fields["company_id"] = $company_id; - $fields["firstname"] = $firstname; - $fields["lastname"] = $lastname; - $fields["email"] = $email; - $fields["title"] = $title; - $fields["wphone"] = $wphone; - $fields["hphone"] = $hphone; - $fields["fax"] = $fax; - $fields["pager"] = $pager; - $fields["mphone"] = $mphone; - $fields["ophone"] = $ophone; - $fields["street"] = $street; - $fields["address2"] = $address2; - $fields["city"] = $city; - $fields["state"] = $state; - $fields["zip"] = $zip; - $fields["bday"] = $bday; - $fields["url"] = $url; - $fields["notes"] = $notes; + $fields["ORG_Name"] = $company; + $fields["N_Given"] = $firstname; + $fields["N_Family"] = $lastname; + $fields["D_EMAIL"] = $email; + $fields["D_EMAILTYPE"] = $email_type; + $fields["TITLE"] = $title; + $fields["A_TEL"] = $wphone; + $fields["B_TEL"] = $hphone; + $fields["C_TEL"] = $fax; + $fields["pager"] = $pager; + $fields["mphone"] = $mphone; + $fields["ophone"] = $ophone; + $fields["ADR_Street"] = $street; + $fields["address2"] = $address2; + $fields["ADR_Locality"] = $city; + $fields["ADR_Region"] = $state; + $fields["ADR_PostalCode"] = $zip; + $fields["ADR_Country"] = $country; + $fields["bday"] = $bday; + $fields["url"] = $url; + $fields["notes"] = $notes; $this->add($phpgw_info["user"]["account_id"],$access,$fields); diff --git a/addressbook/edit.php b/addressbook/edit.php index b13023962f..2fb4b9fd75 100755 --- a/addressbook/edit.php +++ b/addressbook/edit.php @@ -60,6 +60,7 @@ $fields["N_Given"] = $firstname; $fields["N_Family"] = $lastname; $fields["D_EMAIL"] = $email; + $fields["D_EMAILTYPE"] = $email_type; $fields["TITLE"] = $title; $fields["A_TEL"] = $wphone; $fields["B_TEL"] = $hphone; @@ -72,6 +73,7 @@ $fields["ADR_Locality"] = $city; $fields["ADR_Region"] = $state; $fields["ADR_PostalCode"] = $zip; + $fields["ADR_Country"] = $country; $fields["bday"] = $bday; $fields["url"] = $url; $fields["notes"] = $notes; diff --git a/addressbook/inc/class.contacts.inc.php b/addressbook/inc/class.contacts.inc.php index 4ba356a8cf..7875065c54 100644 --- a/addressbook/inc/class.contacts.inc.php +++ b/addressbook/inc/class.contacts.inc.php @@ -2,4 +2,4 @@ if (!$phpgw_info["server"]["contacts_repository"]) { $phpgw_info["server"]["contacts_repository"] = "sql"; } include($phpgw_info["server"]["include_root"]."/addressbook/inc/class.contacts_".$phpgw_info["server"]["contacts_repository"].".inc.php"); include($phpgw_info["server"]["include_root"]."/addressbook/inc/class.contacts_shared.inc.php"); -?> \ No newline at end of file +?> diff --git a/addressbook/inc/class.contacts_shared.inc.php b/addressbook/inc/class.contacts_shared.inc.php index 0a5d3d18e3..fdb6dc61d8 100644 --- a/addressbook/inc/class.contacts_shared.inc.php +++ b/addressbook/inc/class.contacts_shared.inc.php @@ -38,6 +38,7 @@ var $db; var $account_id; var $stock_contact_fields; // This is an array of all the fields in the addressbook + var $email_types; var $total_records; function split_ab_and_extras($fields) diff --git a/addressbook/inc/class.contacts_sql.inc.php b/addressbook/inc/class.contacts_sql.inc.php index ab7228295c..1204be1447 100644 --- a/addressbook/inc/class.contacts_sql.inc.php +++ b/addressbook/inc/class.contacts_sql.inc.php @@ -24,7 +24,7 @@ /* $Id$ */ /* - contacts_extra ( + addressbook_extra ( contact_id int, contact_owner int, contact_name varchar(255), @@ -38,7 +38,8 @@ { var $db; var $account_id; - var $stock_contact_fields; // This is an array of all the fields in the contacts table + var $stock_contact_fields; // This is an array of all the fields in the addressbook table + var $email_types; var $total_records; // This will contain numrows for data retrieved function contacts_() @@ -97,6 +98,11 @@ "D_EMAIL_Work" => "D.EMAIL.Work", //yn "D_EMAIL_Home" => "D.EMAIL.Home", //yn ); + + $this->email_types = array("INTERNET","CompuServe","AOL","Prodigy", + "eWorld","AppleLink","AppleTalk","PowerShare", + "IBMMail","ATTMail","MCIMail","X.400","TLX" + ); } function read_single_entry($id,$fields) @@ -212,7 +218,7 @@ list($ab_fields,$ab_fieldnames,$extra_fields) = $this->split_ab_and_extras($fields); //$this->db->lock(array("contacts")); - $this->db->query("insert into contacts (owner," + $this->db->query("insert into addressbook (owner," . implode(",",$this->stock_contact_fields) . ") values ('$owner','" . implode("','",$this->loop_addslashes($ab_fields)) . "')",__LINE__,__FILE__); @@ -224,7 +230,7 @@ if (count($extra_fields)) { while (list($name,$value) = each($extra_fields)) { - $this->db->query("insert into contacts_extra values ('$id','" . $this->account_id . "','" + $this->db->query("insert into addressbook_extra values ('$id','" . $this->account_id . "','" . addslashes($name) . "','" . addslashes($value) . "')",__LINE__,__FILE__); } } @@ -240,7 +246,7 @@ function add_single_extra_field($id,$owner,$field_name,$field_value) { - $this->db->query("insert into contacts_extra values ($id,'$owner','" . addslashes($field_name) + $this->db->query("insert into addressbook_extra values ($id,'$owner','" . addslashes($field_name) . "','" . addslashes($field_value) . "')",__LINE__,__FILE__); } @@ -268,7 +274,7 @@ if ($field_s == ",") { unset($field_s); } - $this->db->query("update addressbook set owner='$owner', $fields_s where " + $this->db->query("update addressbook set owner='$owner' $fields_s where " . "id='$id'",__LINE__,__FILE__); } diff --git a/addressbook/inc/functions.inc.php b/addressbook/inc/functions.inc.php index 7ce43611ee..e46eb0ac76 100755 --- a/addressbook/inc/functions.inc.php +++ b/addressbook/inc/functions.inc.php @@ -55,6 +55,7 @@ $city = $fields["ADR_Locality"]; $state = $fields["ADR_Region"]; $zip = $fields["ADR_PostalCode"]; + $country = $fields["ADR_Country"]; $bday = $fields["bday"]; $notes = $fields["notes"]; $company = $fields["ORG_Name"]; @@ -76,6 +77,7 @@ $city = ""; $state = ""; $zip = ""; + $country = ""; /* if($phpgw_info["apps"]["timetrack"]["enabled"]) { @@ -140,6 +142,12 @@ $bday_year = ''; } + $email_type = ""; + $notes = ''; } else { $notes = "