diff --git a/app/contacts/app_config.php b/app/contacts/app_config.php
index 4d73ab2322..a3fec532a0 100644
--- a/app/contacts/app_config.php
+++ b/app/contacts/app_config.php
@@ -193,14 +193,14 @@
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Enter the category.";
$z++;
- $apps[$x]['db'][$y]['fields'][$z]['name'] = "contact_email";
- $apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
- $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Enter the email address.";
- $z++;
- $apps[$x]['db'][$y]['fields'][$z]['name'] = "contact_url";
- $apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
- $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Enter the website address.";
- $z++;
+$apps[$x]['db'][$y]['fields'][$z]['name'] = "contact_email";
+$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
+$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Enter the email address.";
+$z++;
+$apps[$x]['db'][$y]['fields'][$z]['name'] = "contact_url";
+$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
+$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Enter the website address.";
+$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "contact_time_zone";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Enter the time zone.";
@@ -244,13 +244,17 @@
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = "contact_uuid";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
- //$apps[$x]['db'][$y]['fields'][$z]['name'] = "address_name";
- //$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
- //$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Enter the address name.";
- //$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "address_type";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
- $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Enter the address type.";
+ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Used for vCard format.";
+ $z++;
+ $apps[$x]['db'][$y]['fields'][$z]['name'] = "address_label";
+ $apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
+ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Custom label for an address.";
+ $z++;
+ $apps[$x]['db'][$y]['fields'][$z]['name'] = "address_primary";
+ $apps[$x]['db'][$y]['fields'][$z]['type'] = "numeric";
+ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Designate a primary address.";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "address_street";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
@@ -258,7 +262,7 @@
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "address_extended";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
- $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Enter teh extended address.";
+ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Enter the extended address.";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "address_locality";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
@@ -316,13 +320,33 @@
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = "contact_uuid";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
- $apps[$x]['db'][$y]['fields'][$z]['name'] = "phone_type";
+ $apps[$x]['db'][$y]['fields'][$z]['name'] = "phone_type_voice";
+ $apps[$x]['db'][$y]['fields'][$z]['type'] = "numeric";
+ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Number is used for voice calls.";
+ $z++;
+ $apps[$x]['db'][$y]['fields'][$z]['name'] = "phone_type_fax";
+ $apps[$x]['db'][$y]['fields'][$z]['type'] = "numeric";
+ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Number is used for fax calls.";
+ $z++;
+ $apps[$x]['db'][$y]['fields'][$z]['name'] = "phone_type_video";
+ $apps[$x]['db'][$y]['fields'][$z]['type'] = "numeric";
+ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Number is used for video calls.";
+ $z++;
+ $apps[$x]['db'][$y]['fields'][$z]['name'] = "phone_type_text";
+ $apps[$x]['db'][$y]['fields'][$z]['type'] = "numeric";
+ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Number is used for text messages.";
+ $z++;
+ $apps[$x]['db'][$y]['fields'][$z]['name'] = "phone_label";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
- $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Enter the phone type.";
+ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Custom label for the number";
+ $z++;
+ $apps[$x]['db'][$y]['fields'][$z]['name'] = "phone_primary";
+ $apps[$x]['db'][$y]['fields'][$z]['type'] = "numeric";
+ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Designate a primary number.";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "phone_number";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
- $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Enter the phone number.";
+ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Enter the number.";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "phone_extension";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
@@ -436,7 +460,7 @@
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(36)";
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = "primary";
- $z++;
+ $z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "contact_uuid";
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "uuid";
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text";
@@ -480,4 +504,97 @@
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
+ $y = 7; //table array index
+ $apps[$x]['db'][$y]['table'] = "v_contact_emails";
+ $apps[$x]['db'][$y]['fields'][$z]['name'] = "contact_email_uuid";
+ $apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "uuid";
+ $apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text";
+ $apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(36)";
+ $apps[$x]['db'][$y]['fields'][$z]['key']['type'] = "primary";
+ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
+ $z++;
+ $apps[$x]['db'][$y]['fields'][$z]['name'] = "domain_uuid";
+ $apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "uuid";
+ $apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text";
+ $apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(36)";
+ $apps[$x]['db'][$y]['fields'][$z]['key']['type'] = "foreign";
+ $apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = "v_domains";
+ $apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = "domain_uuid";
+ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
+ $z++;
+ $apps[$x]['db'][$y]['fields'][$z]['name'] = "contact_uuid";
+ $apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "uuid";
+ $apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text";
+ $apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(36)";
+ $apps[$x]['db'][$y]['fields'][$z]['key']['type'] = "foreign";
+ $apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = "v_contacts";
+ $apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = "contact_uuid";
+ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
+ $z++;
+ $apps[$x]['db'][$y]['fields'][$z]['name'] = "email_label";
+ $apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
+ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Custom label for the email address.";
+ $z++;
+ $apps[$x]['db'][$y]['fields'][$z]['name'] = "email_primary";
+ $apps[$x]['db'][$y]['fields'][$z]['type'] = "numeric";
+ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Designate a primary address.";
+ $z++;
+ $apps[$x]['db'][$y]['fields'][$z]['name'] = "email_address";
+ $apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
+ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Enter the email address.";
+ $z++;
+ $apps[$x]['db'][$y]['fields'][$z]['name'] = "email_description";
+ $apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
+ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Enter the email description.";
+ $z++;
+
+ $y = 8; //table array index
+ $apps[$x]['db'][$y]['table'] = "v_contact_urls";
+ $apps[$x]['db'][$y]['fields'][$z]['name'] = "contact_url_uuid";
+ $apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "uuid";
+ $apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text";
+ $apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(36)";
+ $apps[$x]['db'][$y]['fields'][$z]['key']['type'] = "primary";
+ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
+ $z++;
+ $apps[$x]['db'][$y]['fields'][$z]['name'] = "domain_uuid";
+ $apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "uuid";
+ $apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text";
+ $apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(36)";
+ $apps[$x]['db'][$y]['fields'][$z]['key']['type'] = "foreign";
+ $apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = "v_domains";
+ $apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = "domain_uuid";
+ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
+ $z++;
+ $apps[$x]['db'][$y]['fields'][$z]['name'] = "contact_uuid";
+ $apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "uuid";
+ $apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text";
+ $apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(36)";
+ $apps[$x]['db'][$y]['fields'][$z]['key']['type'] = "foreign";
+ $apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = "v_contacts";
+ $apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = "contact_uuid";
+ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
+ $z++;
+ $apps[$x]['db'][$y]['fields'][$z]['name'] = "url_type";
+ $apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
+ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Defines the purpose or protocol for the URL.";
+ $z++;
+ $apps[$x]['db'][$y]['fields'][$z]['name'] = "url_label";
+ $apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
+ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Custom label for the url.";
+ $z++;
+ $apps[$x]['db'][$y]['fields'][$z]['name'] = "url_primary";
+ $apps[$x]['db'][$y]['fields'][$z]['type'] = "numeric";
+ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Designate a primary address.";
+ $z++;
+ $apps[$x]['db'][$y]['fields'][$z]['name'] = "url_address";
+ $apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
+ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "The actual URL address.";
+ $z++;
+ $apps[$x]['db'][$y]['fields'][$z]['name'] = "url_description";
+ $apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
+ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Enter the URL description.";
+ $z++;
+
+
?>
\ No newline at end of file
diff --git a/app/contacts/app_defaults.php b/app/contacts/app_defaults.php
new file mode 100644
index 0000000000..dedbb60c79
--- /dev/null
+++ b/app/contacts/app_defaults.php
@@ -0,0 +1,187 @@
+db = $db;
+ $obj->db_type = $db_type;
+ $obj->schema();
+ $field_exists = $obj->column_exists($db_name, 'v_contact_phones', 'phone_type'); //check if field exists
+ if ($field_exists) {
+ //add multi-lingual support
+ require_once "app/contacts/app_languages.php";
+ foreach($text as $key => $value) {
+ $text[$key] = $value[$_SESSION['domain']['language']['code']];
+ }
+
+ // populate phone_type_* values
+ $sql = "update v_contact_phones set phone_type_voice = '1' ";
+ $sql .= "where phone_type = 'home' ";
+ $sql .= "or phone_type = 'work' ";
+ $sql .= "or phone_type = 'voice' ";
+ $sql .= "or phone_type = 'voicemail' ";
+ $sql .= "or phone_type = 'cell' ";
+ $sql .= "or phone_type = 'pcs' ";
+ $db->exec(check_sql($sql));
+ unset($sql);
+ $sql = "update v_contact_phones set phone_type_fax = '1' where phone_type = 'fax'";
+ $db->exec(check_sql($sql));
+ unset($sql);
+ $sql = "update v_contact_phones set phone_type_video = '1' where phone_type = 'video'";
+ $db->exec(check_sql($sql));
+ unset($sql);
+ $sql = "update v_contact_phones set phone_type_text = '1' where phone_type = 'cell' or phone_type = 'pager'";
+ $db->exec(check_sql($sql));
+ unset($sql);
+
+ // migrate phone_type values to phone_label, correct case and make multilingual where appropriate
+ $default_phone_types = array('home','work','pref','voice','fax','msg','cell','pager','modem','car','isdn','video','pcs');
+ $default_phone_labels = array($text['option-home'],$text['option-work'],'Pref','Voice',$text['option-fax'],$text['option-voicemail'],$text['option-mobile'],$text['option-pager'],'Modem','Car','ISDN','Video','PCS');
+ foreach ($default_phone_types as $index => $old) {
+ $new = $default_phone_labels[$index];
+ $sql = "update v_contact_phones set phone_label = '".$new."' where phone_type = '".$old."'";
+ $db->exec(check_sql($sql));
+ unset($sql);
+ }
+
+ // empty phone_type field to prevent confusion in the future
+ $sql = "update v_contact_phones set phone_type = null";
+ $db->exec(check_sql($sql));
+ unset($sql);
+ }
+ unset($obj);
+
+ //populate primary email from deprecated field in v_contact table
+ $obj = new schema;
+ $obj->db = $db;
+ $obj->db_type = $db_type;
+ $obj->schema();
+ $field_exists = $obj->column_exists($db_name, 'v_contacts', 'contact_email'); //check if field exists
+ if ($field_exists) {
+ // get email records
+ $sql = "select * from v_contacts where contact_email is not null and contact_email != ''";
+ $prep_statement = $db->prepare(check_sql($sql));
+ $prep_statement->execute();
+ $result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
+ $result_count = count($result);
+ unset ($prep_statement, $sql);
+ if ($result_count > 0) {
+ foreach($result as $row) {
+ $sql = "insert into v_contact_emails ";
+ $sql .= "(";
+ $sql .= "domain_uuid, ";
+ $sql .= "contact_uuid, ";
+ $sql .= "contact_email_uuid, ";
+ $sql .= "email_primary, ";
+ $sql .= "email_address";
+ $sql .= ")";
+ $sql .= "values ";
+ $sql .= "(";
+ $sql .= "'".$row['domain_uuid']."', ";
+ $sql .= "'".$row['contact_uuid']."', ";
+ $sql .= "'".uuid()."', ";
+ $sql .= "1, ";
+ $sql .= "'".$row['contact_email']."' ";
+ $sql .= ")";
+ $db->exec(check_sql($sql));
+ unset($sql);
+
+ //verify and remove value from old field
+ $sql2 = "select email_address from v_contact_emails ";
+ $sql2 .= "where domain_uuid = '".$row['domain_uuid']."' ";
+ $sql2 .= "and contact_uuid = '".$row['contact_uuid']."' ";
+ $sql2 .= "and email_address = '".$row['contact_email']."' ";
+ $prep_statement2 = $db->prepare(check_sql($sql2));
+ $prep_statement2->execute();
+ $result2 = $prep_statement2->fetchAll(PDO::FETCH_NAMED);
+ $result_count2 = count($result2);
+ if ($result_count2 > 0) {
+ $sql3 = "update v_contacts set contact_email = '' ";
+ $sql3 .= "where domain_uuid = '".$row['domain_uuid']."' ";
+ $sql3 .= "and contact_uuid = '".$row['contact_uuid']."' ";
+ $prep_statement3 = $db->prepare(check_sql($sql3));
+ $prep_statement3->execute();
+ unset($sql3, $prep_statement3);
+ }
+ unset($sql2, $result2, $prep_statement2);
+ }
+ }
+ }
+ unset($obj);
+
+ //populate primary url from deprecated field in v_contact table
+ $obj = new schema;
+ $obj->db = $db;
+ $obj->db_type = $db_type;
+ $obj->schema();
+ $field_exists = $obj->column_exists($db_name, 'v_contacts', 'contact_url'); //check if field exists
+ if ($field_exists) {
+ // get email records
+ $sql = "select * from v_contacts where contact_url is not null and contact_url != ''";
+ $prep_statement = $db->prepare(check_sql($sql));
+ $prep_statement->execute();
+ $result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
+ $result_count = count($result);
+ unset ($prep_statement, $sql);
+ if ($result_count > 0) {
+ foreach($result as $row) {
+ $sql = "insert into v_contact_urls ";
+ $sql .= "(";
+ $sql .= "domain_uuid, ";
+ $sql .= "contact_uuid, ";
+ $sql .= "contact_url_uuid, ";
+ $sql .= "url_primary, ";
+ $sql .= "url_address";
+ $sql .= ")";
+ $sql .= "values ";
+ $sql .= "(";
+ $sql .= "'".$row['domain_uuid']."', ";
+ $sql .= "'".$row['contact_uuid']."', ";
+ $sql .= "'".uuid()."', ";
+ $sql .= "1, ";
+ $sql .= "'".$row['contact_url']."' ";
+ $sql .= ")";
+ $db->exec(check_sql($sql));
+ unset($sql);
+
+ //verify and remove value from old field
+ $sql2 = "select url_address from v_contact_urls ";
+ $sql2 .= "where domain_uuid = '".$row['domain_uuid']."' ";
+ $sql2 .= "and contact_uuid = '".$row['contact_uuid']."' ";
+ $sql2 .= "and url_address = '".$row['contact_url']."' ";
+ $prep_statement2 = $db->prepare(check_sql($sql2));
+ $prep_statement2->execute();
+ $result2 = $prep_statement2->fetchAll(PDO::FETCH_NAMED);
+ $result_count2 = count($result2);
+ if ($result_count2 > 0) {
+ $sql3 = "update v_contacts set contact_url = '' ";
+ $sql3 .= "where domain_uuid = '".$row['domain_uuid']."' ";
+ $sql3 .= "and contact_uuid = '".$row['contact_uuid']."' ";
+ $prep_statement3 = $db->prepare(check_sql($sql3));
+ $prep_statement3->execute();
+ unset($sql3, $prep_statement3);
+ }
+ unset($sql2, $result2, $prep_statement2);
+ }
+ }
+ }
+ unset($obj);
+
+ //set [name]_primary fields to 0 where null
+ $name_tables = array('phones','addresses','emails','urls');
+ $name_fields = array('phone','address','email','url');
+ foreach ($name_tables as $name_index => $name_table) {
+ $sql = "update v_contact_".$name_table." set ".$name_fields[$name_index]."_primary = 0 ";
+ $sql .= "where ".$name_fields[$name_index]."_primary is null ";
+ $prep_statement = $db->prepare(check_sql($sql));
+ $prep_statement->execute();
+ unset($sql, $prep_statement);
+ }
+ unset($name_tables, $name_fields);
+
+}
+
+?>
\ No newline at end of file
diff --git a/app/contacts/app_languages.php b/app/contacts/app_languages.php
index 3dd79ab640..7e39f52c77 100644
--- a/app/contacts/app_languages.php
+++ b/app/contacts/app_languages.php
@@ -136,7 +136,7 @@
$text['label-contact_subcategory']['es-cl'] = "Subcategoría";
$text['label-contact_subcategory']['pt-pt'] = "Subcategoria";
$text['label-contact_subcategory']['fr-fr'] = "Sous-Catégorie";
-
+
$text['description-contact_subcategory']['en-us'] = "Enter the subcategory.";
$text['description-contact_subcategory']['es-cl'] = "Ingrese la categoría.";
$text['description-contact_subcategory']['pt-pt'] = "Introduza a subcategoria";
@@ -303,41 +303,51 @@
$text['button-certificate']['fr-fr'] = "Certificat";
// contact phones
- $text['title-contact_phones-add']['en-us'] = "Contact Phone Add";
+ $text['title-contact_phones-add']['en-us'] = "Contact Number Add";
$text['title-contact_phones-add']['es-cl'] = "Agregar Número de Contacto";
$text['title-contact_phones-add']['pt-pt'] = "Adicionar contacto telefónico";
$text['title-contact_phones-add']['fr-fr'] = "Ajouter un téléphone au Contact";
- $text['header-contact_phones-add']['en-us'] = "Contact Phone Add";
+ $text['header-contact_phones-add']['en-us'] = "Contact Number Add";
$text['header-contact_phones-add']['es-cl'] = "Agregar Número de Contacto";
$text['header-contact_phones-add']['pt-pt'] = "Adicionar contacto telefónico";
$text['header-contact_phones-add']['fr-fr'] = "Ajouter un téléphone au Contact";
- $text['title-contact_phones-edit']['en-us'] = "Contact Phone Edit";
+ $text['title-contact_phones-edit']['en-us'] = "Contact Number Edit";
$text['title-contact_phones-edit']['es-cl'] = "Editar Número de Contacto";
$text['title-contact_phones-edit']['pt-pt'] = "Editar contacto telefónico";
$text['title-contact_phones-edit']['fr-fr'] = "Editer le téléphone du Contact";
- $text['header-contact_phones-edit']['en-us'] = "Contact Phone Edit";
+ $text['header-contact_phones-edit']['en-us'] = "Contact Number Edit";
$text['header-contact_phones-edit']['es-cl'] = "Editar Número de Contacto";
$text['header-contact_phones-edit']['pt-pt'] = "Editar contacto telefónico";
$text['header-contact_phones-edit']['fr-fr'] = "Editer le téléphone du Contact";
- $text['label-phone_numbers']['en-us'] = "Phone Numbers";
- $text['label-phone_numbers']['es-cl'] = "Números telefónicos";
- $text['label-phone_numbers']['pt-pt'] = "Números de telefone";
- $text['label-phone_numbers']['fr-fr'] = "Numéros de téléphone";
+ $text['label-phone_numbers']['en-us'] = "Numbers";
+ $text['label-phone_numbers']['es-cl'] = "Números";
+ $text['label-phone_numbers']['pt-pt'] = "Números";
+ $text['label-phone_numbers']['fr-fr'] = "Numéros";
$text['label-phone_type']['en-us'] = "Type";
$text['label-phone_type']['es-cl'] = "Tipo";
$text['label-phone_type']['pt-pt'] = "Tipo";
$text['label-phone_type']['fr-fr'] = "Type";
- $text['description-phone_type']['en-us'] = "Select the phone type.";
+ $text['description-phone_type']['en-us'] = "Define the number type or purpose.";
$text['description-phone_type']['es-cl'] = "Seleccione el tipo de teléfono.";
$text['description-phone_type']['pt-pt'] = "Seleccionar tipo de telefone";
$text['description-phone_type']['fr-fr'] = "";
+ $text['label-phone_label']['en-us'] = "Label";
+ $text['label-phone_label']['es-cl'] = "Etiqueta";
+ $text['label-phone_label']['pt-pt'] = "Etiqueta";
+ $text['label-phone_label']['fr-fr'] = "Etiquette";
+
+ $text['description-phone_label']['en-us'] = "Select or enter a custom label.";
+ $text['description-phone_label']['es-cl'] = "Seleccione o introduzca una etiqueta personalizada.";
+ $text['description-phone_label']['pt-pt'] = "Selecione ou digite um rótulo personalizado.";
+ $text['description-phone_label']['fr-fr'] = "Sélectionnez ou entrez une étiquette personnalisée.";
+
$text['label-phone_number']['en-us'] = "Number";
$text['label-phone_number']['es-cl'] = "Número";
$text['label-phone_number']['pt-pt'] = "Número";
@@ -378,6 +388,61 @@
$text['label-phone_call']['pt-pt'] = "Chamada";
$text['label-phone_call']['fr-fr'] = "Appel";
+ $text['label-voice']['en-us'] = "Voice";
+ $text['label-voice']['es-cl'] = "Voz";
+ $text['label-voice']['pt-pt'] = "Voz";
+ $text['label-voice']['fr-fr'] = "Voix";
+
+ $text['label-fax']['en-us'] = "Fax";
+ $text['label-fax']['es-cl'] = "Facsímil";
+ $text['label-fax']['pt-pt'] = "Fax";
+ $text['label-fax']['fr-fr'] = "Télécopie";
+
+ $text['label-video']['en-us'] = "Video";
+ $text['label-video']['es-cl'] = "Vídeo";
+ $text['label-video']['pt-pt'] = "Vídeo";
+ $text['label-video']['fr-fr'] = "Vidéo";
+
+ $text['label-text']['en-us'] = "Text";
+ $text['label-text']['es-cl'] = "Texto";
+ $text['label-text']['pt-pt'] = "Texto";
+ $text['label-text']['fr-fr'] = "Texte";
+
+ $text['option-mobile']['en-us'] = "Mobile";
+ $text['option-mobile']['es-cl'] = "Celular";
+ $text['option-mobile']['pt-pt'] = "Celular";
+ $text['option-mobile']['fr-fr'] = "Cellulaire";
+
+ $text['option-main']['en-us'] = "Main";
+ $text['option-main']['es-cl'] = "Principal";
+ $text['option-main']['pt-pt'] = "Principal";
+ $text['option-main']['fr-fr'] = "Principal";
+
+ $text['option-fax']['en-us'] = "Fax";
+ $text['option-fax']['es-cl'] = "Facsímil";
+ $text['option-fax']['pt-pt'] = "Fax";
+ $text['option-fax']['fr-fr'] = "Télécopie";
+
+ $text['option-pager']['en-us'] = "Pager";
+ $text['option-pager']['es-cl'] = "Buscapersonas";
+ $text['option-pager']['pt-pt'] = "Pager";
+ $text['option-pager']['fr-fr'] = "Pager";
+
+ $text['option-voicemail']['en-us'] = "Voicemail";
+ $text['option-voicemail']['es-cl'] = "Correo de Voz";
+ $text['option-voicemail']['pt-pt'] = "Voicemail";
+ $text['option-voicemail']['fr-fr'] = "Messagerie Vocale";
+
+ $text['option-text']['en-us'] = "Text";
+ $text['option-text']['es-cl'] = "Texto";
+ $text['option-text']['pt-pt'] = "Texto";
+ $text['option-text']['fr-fr'] = "Texte";
+
+ $text['option-other']['en-us'] = "Other";
+ $text['option-other']['es-cl'] = "Otro";
+ $text['option-other']['pt-pt'] = "Outro";
+ $text['option-other']['fr-fr'] = "Autre";
+
// contact addresses
$text['title-contact_addresses-add']['en-us'] = "Contact Address Add";
$text['title-contact_addresses-add']['es-cl'] = "Agregar Dirección de Contacto";
@@ -419,30 +484,30 @@
$text['label-address_type']['pt-pt'] = "Tipo";
$text['label-address_type']['fr-fr'] = "Type";
- $text['description-address_type']['en-us'] = "Enter the address type.";
- $text['description-address_type']['es-cl'] = "Ingrese el tipo de dirección.";
- $text['description-address_type']['pt-pt'] = "Introduza o tipo de endereço";
- $text['description-address_type']['fr-fr'] = "";
+ $text['description-address_type']['en-us'] = "Define the address type (used for vCard generation).";
+ $text['description-address_type']['es-cl'] = "Definir el tipo de dirección (utilizado para la generación de vCard).";
+ $text['description-address_type']['pt-pt'] = "Defina o tipo de endereço (usado para geração de vCard).";
+ $text['description-address_type']['fr-fr'] = "Définir le type d'adresse (utilisé pour la production vCard).";
- $text['label-address_street']['en-us'] = "Street Address";
- $text['label-address_street']['es-cl'] = "Calle";
- $text['label-address_street']['pt-pt'] = "Rua";
- $text['label-address_street']['fr-fr'] = "Rue";
+ $text['label-address_label']['en-us'] = "Label";
+ $text['label-address_label']['es-cl'] = "Etiqueta";
+ $text['label-address_label']['pt-pt'] = "Etiqueta";
+ $text['label-address_label']['fr-fr'] = "Etiquette";
- $text['description-address_street']['en-us'] = "Enter the street address.";
- $text['description-address_street']['es-cl'] = "Ingrese la calle.";
- $text['description-address_street']['pt-pt'] = "Introduza o endereço da rua";
- $text['description-address_street']['fr-fr'] = "";
+ $text['description-address_label']['en-us'] = "Select or enter a custom label.";
+ $text['description-address_label']['es-cl'] = "Seleccione o introduzca una etiqueta personalizada.";
+ $text['description-address_label']['pt-pt'] = "Selecione ou digite um rótulo personalizado.";
+ $text['description-address_label']['fr-fr'] = "Sélectionnez ou entrez une étiquette personnalisée.";
- $text['label-address_extended']['en-us'] = "Extended Address";
- $text['label-address_extended']['es-cl'] = "Dirección Extendida";
- $text['label-address_extended']['pt-pt'] = "Mais informações";
- $text['label-address_extended']['fr-fr'] = "Autres infos";
+ $text['label-address_address']['en-us'] = "Address";
+ $text['label-address_address']['es-cl'] = "Calle";
+ $text['label-address_address']['pt-pt'] = "Rua";
+ $text['label-address_address']['fr-fr'] = "Rue";
- $text['description-address_extended']['en-us'] = "Enter the extended address.";
- $text['description-address_extended']['es-cl'] = "Ingrese la dirección extendida.";
- $text['description-address_extended']['pt-pt'] = "Introduza mais informações relativamente ao endereço.";
- $text['description-address_extended']['fr-fr'] = "";
+ $text['description-address_address']['en-us'] = "Enter the address.";
+ $text['description-address_address']['es-cl'] = "Ingrese la calle.";
+ $text['description-address_address']['pt-pt'] = "Introduza o endereço da rua";
+ $text['description-address_address']['fr-fr'] = "Saisissez l'adresse.";
$text['label-address_locality']['en-us'] = "City";
$text['label-address_locality']['es-cl'] = "Ciudad";
@@ -529,6 +594,56 @@
$text['option-work']['pt-pt'] = "Local de Trabalho";
$text['option-work']['fr-fr'] = "En Milieu de Travail";
+ $text['option-dom']['en-us'] = "Domestic";
+ $text['option-dom']['es-cl'] = "Doméstico";
+ $text['option-dom']['pt-pt'] = "Doméstico";
+ $text['option-dom']['fr-fr'] = "Domestique";
+
+ $text['option-intl']['en-us'] = "International";
+ $text['option-intl']['es-cl'] = "Internacional";
+ $text['option-intl']['pt-pt'] = "Internacional";
+ $text['option-intl']['fr-fr'] = "international";
+
+ $text['option-postal']['en-us'] = "Postal";
+ $text['option-postal']['es-cl'] = "Postal";
+ $text['option-postal']['pt-pt'] = "Postal";
+ $text['option-postal']['fr-fr'] = "Postal";
+
+ $text['option-parcel']['en-us'] = "Parcel";
+ $text['option-parcel']['es-cl'] = "Parcela";
+ $text['option-parcel']['pt-pt'] = "Parcela";
+ $text['option-parcel']['fr-fr'] = "Parcelle";
+
+ $text['option-pref']['en-us'] = "Preferred";
+ $text['option-pref']['es-cl'] = "Preferido";
+ $text['option-pref']['pt-pt'] = "Preferido";
+ $text['option-pref']['fr-fr'] = "Préféré";
+
+ $text['option-mailing']['en-us'] = "Mailing";
+ $text['option-mailing']['es-cl'] = "Mailing";
+ $text['option-mailing']['pt-pt'] = "Mailing";
+ $text['option-mailing']['fr-fr'] = "Postale";
+
+ $text['option-physical']['en-us'] = "Physical";
+ $text['option-physical']['es-cl'] = "Físico";
+ $text['option-physical']['pt-pt'] = "Físico";
+ $text['option-physical']['fr-fr'] = "Physique";
+
+ $text['option-shipping']['en-us'] = "Shipping";
+ $text['option-shipping']['es-cl'] = "Envío";
+ $text['option-shipping']['pt-pt'] = "Remessa";
+ $text['option-shipping']['fr-fr'] = "Livraison";
+
+ $text['option-billing']['en-us'] = "Billing";
+ $text['option-billing']['es-cl'] = "Facturación";
+ $text['option-billing']['pt-pt'] = "Faturamento";
+ $text['option-billing']['fr-fr'] = "Facturation";
+
+ $text['label-google_map']['en-us'] = "Open with Google Maps";
+ $text['label-google_map']['es-cl'] = "Abrir con Google Maps";
+ $text['label-google_map']['pt-pt'] = "Abrir com o Google Maps";
+ $text['label-google_map']['fr-fr'] = "Ouvrir avec Google Maps";
+
// contact extensions
$text['label-contact_extensions']['en-us'] = "Extensions";
$text['label-contact_extensions']['es-cl'] = "Extensións";
@@ -550,6 +665,93 @@
$text['label-description']['pt-pt'] = "Descrição";
$text['label-description']['fr-fr'] = "Description";
+ // contact emails
+ $text['header-contact_email-add']['en-us'] = "Contact Email Add";
+ $text['header-contact_email-add']['es-cl'] = "Correo electrónico de contacto Agregar";
+ $text['header-contact_email-add']['pt-pt'] = "Contato e-mail Adicionar";
+ $text['header-contact_email-add']['fr-fr'] = "Contactez-mail Ajouter";
+
+ $text['description-contact_email-add']['en-us'] = "Contact email address information.";
+ $text['description-contact_email-add']['es-cl'] = "Contactar con información de la dirección de correo electrónico.";
+ $text['description-contact_email-add']['pt-pt'] = "As informações de contato endereço de email.";
+ $text['description-contact_email-add']['fr-fr'] = "Coordonnées de l'adresse e-mail.";
+
+ $text['header-contact_email-edit']['en-us'] = "Contact Email Edit";
+ $text['header-contact_email-edit']['es-cl'] = "Correo electrónico de contacto Editar";
+ $text['header-contact_email-edit']['pt-pt'] = "Email de Contato Editar";
+ $text['header-contact_email-edit']['fr-fr'] = "Contact Courriel Modifier";
+
+ $text['description-contact_email-edit']['en-us'] = "Contact email address information.";
+ $text['description-contact_email-edit']['es-cl'] = "Contactar con información de la dirección de correo electrónico.";
+ $text['description-contact_email-edit']['pt-pt'] = "As informações de contato endereço de email.";
+ $text['description-contact_email-edit']['fr-fr'] = "Coordonnées de l'adresse e-mail.";
+
+ $text['label-emails']['en-us'] = "Emails";
+ $text['label-emails']['es-cl'] = "Extensións";
+ $text['label-emails']['pt-pt'] = "Extensões";
+ $text['label-emails']['fr-fr'] = "Extensions";
+
+ $text['label-email_label']['en-us'] = "Label";
+ $text['label-email_label']['es-cl'] = "Etiqueta";
+ $text['label-email_label']['pt-pt'] = "Etiqueta";
+ $text['label-email_label']['fr-fr'] = "Etiquette";
+
+ $text['label-email_address']['en-us'] = "Address";
+ $text['label-email_address']['es-cl'] = "Calle";
+ $text['label-email_address']['pt-pt'] = "Rua";
+ $text['label-email_address']['fr-fr'] = "Rue";
+
+ $text['label-email_description']['en-us'] = "Description";
+ $text['label-email_description']['es-cl'] = "Descripción";
+ $text['label-email_description']['pt-pt'] = "Descrição";
+ $text['label-email_description']['fr-fr'] = "Description";
+
+ // contact urls
+ $text['header-contact_url-add']['en-us'] = "Contact URL Add";
+ $text['header-contact_url-add']['es-cl'] = "Correo electrónico de contacto Agregar";
+ $text['header-contact_url-add']['pt-pt'] = "Contato e-mail Adicionar";
+ $text['header-contact_url-add']['fr-fr'] = "Contactez-mail Ajouter";
+
+ $text['description-contact_url-add']['en-us'] = "Contact url address information.";
+ $text['description-contact_url-add']['es-cl'] = "Contactar con información de la dirección de correo electrónico.";
+ $text['description-contact_url-add']['pt-pt'] = "As informações de contato endereço de url.";
+ $text['description-contact_url-add']['fr-fr'] = "Coordonnées de l'adresse e-mail.";
+
+ $text['header-contact_url-edit']['en-us'] = "Contact URL Edit";
+ $text['header-contact_url-edit']['es-cl'] = "Correo electrónico de contacto Editar";
+ $text['header-contact_url-edit']['pt-pt'] = "URL de Contato Editar";
+ $text['header-contact_url-edit']['fr-fr'] = "Contact Courriel Modifier";
+
+ $text['description-contact_url-edit']['en-us'] = "Contact url address information.";
+ $text['description-contact_url-edit']['es-cl'] = "Contactar con información de la dirección de correo electrónico.";
+ $text['description-contact_url-edit']['pt-pt'] = "As informações de contato endereço de url.";
+ $text['description-contact_url-edit']['fr-fr'] = "Coordonnées de l'adresse e-mail.";
+
+ $text['label-urls']['en-us'] = "URLs";
+ $text['label-urls']['es-cl'] = "Extensións";
+ $text['label-urls']['pt-pt'] = "Extensões";
+ $text['label-urls']['fr-fr'] = "Extensions";
+
+ $text['label-url_label']['en-us'] = "Label";
+ $text['label-url_label']['es-cl'] = "Etiqueta";
+ $text['label-url_label']['pt-pt'] = "Etiqueta";
+ $text['label-url_label']['fr-fr'] = "Etiquette";
+
+ $text['label-url_address']['en-us'] = "Address";
+ $text['label-url_address']['es-cl'] = "Calle";
+ $text['label-url_address']['pt-pt'] = "Rua";
+ $text['label-url_address']['fr-fr'] = "Rue";
+
+ $text['label-url_description']['en-us'] = "Description";
+ $text['label-url_description']['es-cl'] = "Descripción";
+ $text['label-url_description']['pt-pt'] = "Descrição";
+ $text['label-url_description']['fr-fr'] = "Description";
+
+ $text['option-personal']['en-us'] = "Personal";
+ $text['option-personal']['es-cl'] = "Personal";
+ $text['option-personal']['pt-pt'] = "Pessoal";
+ $text['option-personal']['fr-fr'] = "Personnel";
+
// contact notes
$text['title-contact_notes-add']['en-us'] = "Contact Note Add";
$text['title-contact_notes-add']['es-cl'] = "Agregar Nota de Contacto";
@@ -561,7 +763,7 @@
$text['header-contact_notes-add']['pt-pt'] = "Adicionar nota de contacto";
$text['header-contact_notes-add']['fr-fr'] = "Ajouter une note au contact";
- $text['description-contact_notes-add']['en-us'] = "";
+ $text['description-contact_notes-add']['en-us'] = "Enter the desired note below.";
$text['description-contact_notes-add']['es-cl'] = "Ingrese una nota de contacto.";
$text['description-contact_notes-add']['pt-pt'] = "";
$text['description-contact_notes-add']['fr-fr'] = "";
@@ -576,11 +778,10 @@
$text['header-contact_notes-edit']['pt-pt'] = "Editar notas de contacto";
$text['header-contact_notes-edit']['fr-fr'] = "Editer la note du contact";
- $text['description-contact_notes-edit']['en-us'] = ".";
+ $text['description-contact_notes-edit']['en-us'] = "Enter the desired note below.";
$text['description-contact_notes-edit']['es-cl'] = "Modifique la nota de contacto";
$text['description-contact_notes-edit']['pt-pt'] = "";
- $text['description-contact_notes-edit']['fr-fr'] = ".";
-
+ $text['description-contact_notes-edit']['fr-fr'] = "";
$text['label-contact_notes']['en-us'] = "Notes";
$text['label-contact_notes']['es-cl'] = "Notas";
@@ -597,6 +798,16 @@
$text['description-contact_note']['pt-pt'] = "";
$text['description-contact_note']['fr-fr'] = "";
+ $text['label-note_content']['en-us'] = "Content";
+ $text['label-note_content']['es-cl'] = "";
+ $text['label-note_content']['pt-pt'] = "";
+ $text['label-note_content']['fr-fr'] = "";
+
+ $text['label-note_user']['en-us'] = "User";
+ $text['label-note_user']['es-cl'] = "";
+ $text['label-note_user']['pt-pt'] = "";
+ $text['label-note_user']['fr-fr'] = "";
+
// contact import
$text['title-contacts_import']['en-us'] = "Import Contacts";
$text['title-contacts_import']['es-cl'] = "Importar Contactos";
@@ -649,6 +860,31 @@
$text['message-results']['fr-fr'] = "Les contacts suivants ont été téléchargés correctement à partir di fichier CSV:";
// general labels
+ $text['label-primary']['en-us'] = "Primary";
+ $text['label-primary']['es-cl'] = "Primário";
+ $text['label-primary']['pt-pt'] = "Primário";
+ $text['label-primary']['fr-fr'] = "Primaire";
+
+ $text['description-phone_primary']['en-us'] = "Set as the primary Number for this contact.";
+ $text['description-phone_primary']['es-cl'] = "Establecer como el número primario para este contacto.";
+ $text['description-phone_primary']['pt-pt'] = "Definir como o principal número para este contato.";
+ $text['description-phone_primary']['fr-fr'] = "Définir comme primaire numéro pour ce contact.";
+
+ $text['description-address_primary']['en-us'] = "Set as the primary Address for this contact.";
+ $text['description-address_primary']['es-cl'] = "Establecer como dirección principal para este contacto.";
+ $text['description-address_primary']['pt-pt'] = "Definir como o principal endereço para este contato.";
+ $text['description-address_primary']['fr-fr'] = "Définir comme adresse principale pour ce contact.";
+
+ $text['description-email_primary']['en-us'] = "Set as the primary Email for this contact.";
+ $text['description-email_primary']['es-cl'] = "Establecer como el correo electrónico principal para este contacto.";
+ $text['description-email_primary']['pt-pt'] = "Definir como o principal e-mail para este contato.";
+ $text['description-email_primary']['fr-fr'] = "Définir comme primaire par mail pour ce contact.";
+
+ $text['description-url_primary']['en-us'] = "Set as the primary URL for this contact.";
+ $text['description-url_primary']['es-cl'] = "Establecer como la URL principal de este contacto.";
+ $text['description-url_primary']['pt-pt'] = "Definir como a URL principal para este contato.";
+ $text['description-url_primary']['fr-fr'] = "Définir comme l'URL principale de ce contact.";
+
$text['button-add']['en-us'] = "Add";
$text['button-add']['es-cl'] = "Agregar";
$text['button-add']['pt-pt'] = "Adicionar";
diff --git a/app/contacts/contact_address_delete.php b/app/contacts/contact_address_delete.php
index 836d5ed0b8..5e9cbf7b47 100644
--- a/app/contacts/contact_address_delete.php
+++ b/app/contacts/contact_address_delete.php
@@ -46,11 +46,9 @@ if (count($_GET)>0) {
}
if (strlen($id)>0) {
- $sql = "";
- $sql .= "delete from v_contact_addresses ";
+ $sql = "delete from v_contact_addresses ";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and contact_address_uuid = '$id' ";
-
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
unset($sql);
diff --git a/app/contacts/contact_address_edit.php b/app/contacts/contact_address_edit.php
index b90e0898e2..9408306bf5 100644
--- a/app/contacts/contact_address_edit.php
+++ b/app/contacts/contact_address_edit.php
@@ -57,6 +57,8 @@ if (strlen($_GET["contact_uuid"]) > 0) {
if (count($_POST)>0) {
//$address_name = check_str($_POST["address_name"]);
$address_type = check_str($_POST["address_type"]);
+ $address_label = check_str($_POST["address_label"]);
+ $address_label_custom = check_str($_POST["address_label_custom"]);
$address_street = check_str($_POST["address_street"]);
$address_extended = check_str($_POST["address_extended"]);
$address_locality = check_str($_POST["address_locality"]);
@@ -65,7 +67,11 @@ if (strlen($_GET["contact_uuid"]) > 0) {
$address_country = check_str($_POST["address_country"]);
$address_latitude = check_str($_POST["address_latitude"]);
$address_longitude = check_str($_POST["address_longitude"]);
+ $address_primary = check_str($_POST["address_primary"]);
$address_description = check_str($_POST["address_description"]);
+
+ //use custom label if set
+ $address_label = ($address_label_custom != '') ? $address_label_custom : $address_label;
}
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
@@ -76,15 +82,6 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
}
//check for all required data
- //if (strlen($address_type) == 0) { $msg .= $text['message-required'].$text['label-address_type']."
\n"; }
- //if (strlen($address_street) == 0) { $msg .= $text['message-required'].$text['label-address_street']."
\n"; }
- //if (strlen($address_extended) == 0) { $msg .= $text['message-required'].$text['label-address_extended']."
\n"; }
- //if (strlen($address_locality) == 0) { $msg .= $text['message-required'].$text['label-address_locality']."
\n"; }
- //if (strlen($address_region) == 0) { $msg .= $text['message-required'].$text['label-address_region']."
\n"; }
- //if (strlen($address_postal_code) == 0) { $msg .= $text['message-required'].$text['label-address_postal_code']."
\n"; }
- //if (strlen($address_country) == 0) { $msg .= $text['message-required'].$text['label-address_country']."
\n"; }
- //if (strlen($address_latitude) == 0) { $msg .= $text['message-required'].$text['label-address_latitude']."
\n"; }
- //if (strlen($address_longitude) == 0) { $msg .= $text['message-required'].$text['label-address_longitude']."
\n"; }
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
require_once "resources/header.php";
require_once "resources/persist_form_var.php";
@@ -100,6 +97,16 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
//add or update the database
if ($_POST["persistformvar"] != "true") {
+
+ //if primary, unmark other primary numbers
+ if ($address_primary) {
+ $sql = "update v_contact_addresses set address_primary = 0 ";
+ $sql .= "where domain_uuid = '".$domain_uuid."' ";
+ $sql .= "and contact_uuid = '".$contact_uuid."' ";
+ $db->exec(check_sql($sql));
+ unset($sql);
+ }
+
if ($action == "add") {
$contact_address_uuid = uuid();
$sql = "insert into v_contact_addresses ";
@@ -107,8 +114,8 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$sql .= "domain_uuid, ";
$sql .= "contact_uuid, ";
$sql .= "contact_address_uuid, ";
- //$sql .= "address_name, ";
$sql .= "address_type, ";
+ $sql .= "address_label, ";
$sql .= "address_street, ";
$sql .= "address_extended, ";
$sql .= "address_locality, ";
@@ -117,24 +124,26 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$sql .= "address_country, ";
$sql .= "address_latitude, ";
$sql .= "address_longitude, ";
+ $sql .= "address_primary, ";
$sql .= "address_description ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'".$_SESSION['domain_uuid']."', ";
- $sql .= "'$contact_uuid', ";
- $sql .= "'$contact_address_uuid', ";
- //$sql .= "'$address_name', ";
- $sql .= "'$address_type', ";
- $sql .= "'$address_street', ";
- $sql .= "'$address_extended', ";
- $sql .= "'$address_locality', ";
- $sql .= "'$address_region', ";
- $sql .= "'$address_postal_code', ";
- $sql .= "'$address_country', ";
- $sql .= "'$address_latitude', ";
- $sql .= "'$address_longitude', ";
- $sql .= "'$address_description' ";
+ $sql .= "'".$contact_uuid."', ";
+ $sql .= "'".$contact_address_uuid."', ";
+ $sql .= "'".$address_type."', ";
+ $sql .= "'".$address_label."', ";
+ $sql .= "'".$address_street."', ";
+ $sql .= "'".$address_extended."', ";
+ $sql .= "'".$address_locality."', ";
+ $sql .= "'".$address_region."', ";
+ $sql .= "'".$address_postal_code."', ";
+ $sql .= "'".$address_country."', ";
+ $sql .= "'".$address_latitude."', ";
+ $sql .= "'".$address_longitude."', ";
+ $sql .= (($address_primary) ? 1 : 0).", ";
+ $sql .= "'".$address_description."' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
@@ -146,20 +155,21 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
if ($action == "update") {
$sql = "update v_contact_addresses set ";
- $sql .= "contact_uuid = '$contact_uuid', ";
- //$sql .= "address_name = '$address_name', ";
- $sql .= "address_type = '$address_type', ";
- $sql .= "address_street = '$address_street', ";
- $sql .= "address_extended = '$address_extended', ";
- $sql .= "address_locality = '$address_locality', ";
- $sql .= "address_region = '$address_region', ";
- $sql .= "address_postal_code = '$address_postal_code', ";
- $sql .= "address_country = '$address_country', ";
- $sql .= "address_latitude = '$address_latitude', ";
- $sql .= "address_longitude = '$address_longitude', ";
- $sql .= "address_description = '$address_description' ";
+ $sql .= "contact_uuid = '".$contact_uuid."', ";
+ $sql .= "address_type = '".$address_type."', ";
+ $sql .= "address_label = '".$address_label."', ";
+ $sql .= "address_street = '".$address_street."', ";
+ $sql .= "address_extended = '".$address_extended."', ";
+ $sql .= "address_locality = '".$address_locality."', ";
+ $sql .= "address_region = '".$address_region."', ";
+ $sql .= "address_postal_code = '".$address_postal_code."', ";
+ $sql .= "address_country = '".$address_country."', ";
+ $sql .= "address_latitude = '".$address_latitude."', ";
+ $sql .= "address_longitude = '".$address_longitude."', ";
+ $sql .= "address_primary = ".(($address_primary) ? 1 : 0).", ";
+ $sql .= "address_description = '".$address_description."' ";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
- $sql .= "and contact_address_uuid = '$contact_address_uuid'";
+ $sql .= "and contact_address_uuid = '".$contact_address_uuid."'";
$db->exec(check_sql($sql));
unset($sql);
@@ -182,6 +192,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
foreach ($result as &$row) {
//$address_name = $row["address_name"];
$address_type = $row["address_type"];
+ $address_label = $row["address_label"];
$address_street = $row["address_street"];
$address_extended = $row["address_extended"];
$address_locality = $row["address_locality"];
@@ -190,6 +201,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$address_country = $row["address_country"];
$address_latitude = $row["address_latitude"];
$address_longitude = $row["address_longitude"];
+ $address_primary = $row["address_primary"];
$address_description = $row["address_description"];
break; //limit to 1 row
}
@@ -205,18 +217,22 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$document['title'] = $text['title-contact_addresses-add'];
}
-//show the content
- echo "
| \n";
- echo " "; +//javascript to toggle input/select boxes + echo ""; +//show the content echo " |
| ".$text['label-address_tools']." | \n"; - echo th_order_by('address_description', $text['label-address_description'], $order_by, $order); + echo "".$text['label-address_label']." | \n"; + echo "".$text['label-address_address']." | \n"; + echo "".$text['label-address_locality'].", ".$text['label-address_region']." | \n"; + echo "".$text['label-address_country']." | \n"; + echo "\n"; + echo " | ".$text['label-address_description']." | \n"; echo ""; echo "$v_link_label_add"; echo " | \n"; @@ -115,19 +111,13 @@ require_once "resources/paging.php"; foreach($result as $row) { $map_query = $row['address_street']." ".$row['address_extended'].", ".$row['address_locality'].", ".$row['address_region'].", ".$row['address_region'].", ".$row['address_postal_code']; $tr_link = "href='contact_address_edit.php?contact_uuid=".$row['contact_uuid']."&id=".$row['contact_address_uuid']."'"; - echo "|||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ".$row['address_name']." | \n"; - echo "".ucwords($row['address_type'])." | \n"; - //echo "".$row['address_street']." | \n"; - //echo "".$row['address_extended']." | \n"; - echo "".$row['address_locality']." | \n"; - echo "".$row['address_region']." | \n"; - //echo "".$row['address_postal_code']." | \n"; - echo "".$row['address_country']." | \n"; - //echo "".$row['address_latitude']." | \n"; - //echo "".$row['address_longitude']." | \n"; - echo "\n"; - echo " Map \n"; + echo " | ||||||||||||
| ".$row['address_label']." | \n"; + echo " \n"; + echo "".$row['address_locality'].(($row['address_region'] != '') ? ", ".$row['address_region'] : null)." | \n"; + echo "".$row['address_country']." | \n"; + echo "\n";
+ echo " | \n";
echo " ".$row['address_description']." | \n"; echo ""; @@ -141,11 +131,11 @@ require_once "resources/paging.php"; } //end if results echo " | |||||||||||||||||
| \n"; + echo " | \n";
echo "
| |||||||||||||||||||||