From 6534872d28d2f9f776bd189ef70307c7481e532c Mon Sep 17 00:00:00 2001 From: Nate Jones Date: Wed, 19 Nov 2014 03:44:41 +0000 Subject: [PATCH] Contacts: Ability to add unlimited Emails and URLs. Ability to specify a primary Email, Address, URL, and Number. Ability to select or define a custom label for Emails, Addresses, URLs, and Numbers (similar to Google Contacts). --- app/contacts/app_config.php | 153 ++++++++++-- app/contacts/app_defaults.php | 187 +++++++++++++++ app/contacts/app_languages.php | 304 +++++++++++++++++++++--- app/contacts/contact_address_delete.php | 4 +- app/contacts/contact_address_edit.php | 250 ++++++++++--------- app/contacts/contact_addresses.php | 100 ++++---- app/contacts/contact_delete.php | 35 ++- app/contacts/contact_edit.php | 78 ++---- app/contacts/contact_email_delete.php | 61 +++++ app/contacts/contact_email_edit.php | 301 +++++++++++++++++++++++ app/contacts/contact_emails.php | 140 +++++++++++ app/contacts/contact_extensions.php | 6 +- app/contacts/contact_import.php | 76 +++--- app/contacts/contact_note_delete.php | 3 +- app/contacts/contact_note_edit.php | 33 +-- app/contacts/contact_notes.php | 86 +++---- app/contacts/contact_phone_delete.php | 3 +- app/contacts/contact_phone_edit.php | 284 ++++++++++------------ app/contacts/contact_phones.php | 91 ++++--- app/contacts/contact_setting_delete.php | 12 +- app/contacts/contact_setting_edit.php | 18 +- app/contacts/contact_settings.php | 112 +++++---- app/contacts/contact_url_delete.php | 63 +++++ app/contacts/contact_url_edit.php | 301 +++++++++++++++++++++++ app/contacts/contact_urls.php | 138 +++++++++++ app/contacts/contacts.php | 3 +- app/contacts/contacts_vcard.php | 78 ++++-- app/contacts/icon_gmaps.png | Bin 0 -> 4378 bytes app/fax/fax_send.php | 2 +- resources/classes/vcard.php | 93 +++----- 30 files changed, 2272 insertions(+), 743 deletions(-) create mode 100644 app/contacts/app_defaults.php create mode 100644 app/contacts/contact_email_delete.php create mode 100644 app/contacts/contact_email_edit.php create mode 100644 app/contacts/contact_emails.php create mode 100644 app/contacts/contact_url_delete.php create mode 100644 app/contacts/contact_url_edit.php create mode 100644 app/contacts/contact_urls.php create mode 100644 app/contacts/icon_gmaps.png 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 "
"; - echo "\n"; - echo "\n"; - echo " "; - echo " "; - echo "
\n"; - echo "
"; +//javascript to toggle input/select boxes + echo ""; +//show the content echo "
\n"; - echo "
\n"; - echo "\n"; + echo "
\n"; echo "\n"; - echo "\n"; - echo "\n"; echo "\n"; - echo "\n"; - echo "
"; + echo ""; if ($action == "update") { echo $text['header-contact_addresses-edit']; } @@ -224,13 +240,13 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo $text['header-contact_addresses-add']; } echo ""; + echo ""; echo " "; echo " \n"; echo "
\n"; + echo "
\n"; + if ($action == "update") { echo $text['description-contact_addresses-edit']; } @@ -238,45 +254,65 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo $text['description-contact_addresses-add']; } echo "

\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; @@ -284,29 +320,19 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo "\n"; echo "\n"; - echo "\n"; - echo "\n"; - - echo "\n"; - echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; echo "\n"; echo " \n"; echo " "; echo "
\n"; + echo " ".$text['label-address_label']."\n"; + echo "\n"; + if (is_array($_SESSION["contact"]["address_label"])) { + sort($_SESSION["contact"]["address_label"]); + foreach($_SESSION["contact"]["address_label"] as $row) { + $address_label_options[] = ""; + } + $address_label_found = (in_array($address_label, $_SESSION["contact"]["address_label"])) ? true : false; + } + else { + $selected[$address_label] = "selected"; + $default_labels[] = $text['option-work']; + $default_labels[] = $text['option-home']; + $default_labels[] = $text['option-mailing']; + $default_labels[] = $text['option-physical']; + $default_labels[] = $text['option-shipping']; + $default_labels[] = $text['option-billing']; + $default_labels[] = $text['option-other']; + foreach ($default_labels as $default_label) { + $address_label_options[] = ""; + } + $address_label_found = (in_array($address_label, $default_labels)) ? true : false; + } + echo " \n"; + echo " \n"; + echo " \n"; + echo "
\n"; + echo $text['description-address_label']."\n"; echo "
\n"; - echo " ".$text['label-address_type'].":\n"; + echo " ".$text['label-address_type']."\n"; echo "\n"; - if (is_array($_SESSION["contact"]["address_type"])) { - sort($_SESSION["contact"]["address_type"]); - echo " \n"; - } - else { - echo " \n"; + echo " \n"; echo "
\n"; echo $text['description-address_type']."\n"; echo "
\n"; - echo " ".$text['label-address_street'].":\n"; - echo "\n"; - echo " \n"; - echo "
\n"; - echo $text['description-address_street']."\n"; - echo "
\n"; - echo " ".$text['label-address_extended'].":\n"; + echo " ".$text['label-address_address']."\n"; echo "\n"; + echo "
\n"; echo " \n"; echo "
\n"; - echo $text['description-address_extended']."\n"; + echo $text['description-address_address']."\n"; echo "
\n"; - echo " ".$text['label-address_locality'].":\n"; + echo " ".$text['label-address_locality']."\n"; echo "\n"; echo " \n"; @@ -317,7 +343,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo "
\n"; - echo " ".$text['label-address_region'].":\n"; + echo " ".$text['label-address_region']."\n"; echo "\n"; echo " \n"; @@ -328,7 +354,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo "
\n"; - echo " ".$text['label-address_postal_code'].":\n"; + echo " ".$text['label-address_postal_code']."\n"; echo "\n"; echo " \n"; @@ -339,7 +365,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo "
\n"; - echo " ".$text['label-address_country'].":\n"; + echo " ".$text['label-address_country']."\n"; echo "\n"; echo " \n"; @@ -350,7 +376,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo "
\n"; - echo " ".$text['label-address_latitude'].":\n"; + echo " ".$text['label-address_latitude']."\n"; echo "\n"; echo " \n"; @@ -361,7 +387,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo "
\n"; - echo " ".$text['label-address_longitude'].":\n"; + echo " ".$text['label-address_longitude']."\n"; echo "\n"; echo " \n"; @@ -372,7 +398,21 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo "
\n"; - echo " ".$text['label-address_description'].":\n"; + echo " ".$text['label-primary']."\n"; + echo "\n"; + echo " \n"; + echo "
\n"; + echo $text['description-address_primary']."\n"; + echo "
\n"; + echo " ".$text['label-address_description']."\n"; echo "\n"; echo " \n"; @@ -383,21 +423,17 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo "
\n"; - echo " \n"; + echo "
\n"; + echo " \n"; if ($action == "update") { - echo " \n"; + echo " \n"; } - echo " \n"; + echo " \n"; echo "
"; echo ""; - echo "
"; - echo "
"; - //include the footer require_once "resources/footer.php"; ?> \ No newline at end of file diff --git a/app/contacts/contact_addresses.php b/app/contacts/contact_addresses.php index e688a9e167..72210f78b0 100644 --- a/app/contacts/contact_addresses.php +++ b/app/contacts/contact_addresses.php @@ -38,8 +38,8 @@ else { require_once "resources/paging.php"; //get variables used to control the order - $order_by = $_GET["order_by"]; - $order = $_GET["order"]; +// $order_by = $_GET["order_by"]; +// $order = $_GET["order"]; //show the content @@ -51,36 +51,37 @@ require_once "resources/paging.php"; echo "\n"; //prepare to page the results - $sql = " select count(*) as num_rows from v_contact_addresses "; - $sql .= " where domain_uuid = '".$_SESSION['domain_uuid']."' "; - $sql .= " and contact_uuid = '$contact_uuid' "; - if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; } - $prep_statement = $db->prepare($sql); - if ($prep_statement) { - $prep_statement->execute(); - $row = $prep_statement->fetch(PDO::FETCH_ASSOC); - if ($row['num_rows'] > 0) { - $num_rows = $row['num_rows']; - } - else { - $num_rows = '0'; - } - } +// $sql = " select count(*) as num_rows from v_contact_addresses "; +// $sql .= " where domain_uuid = '".$_SESSION['domain_uuid']."' "; +// $sql .= " and contact_uuid = '$contact_uuid' "; +// if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; } +// $prep_statement = $db->prepare($sql); +// if ($prep_statement) { +// $prep_statement->execute(); +// $row = $prep_statement->fetch(PDO::FETCH_ASSOC); +// if ($row['num_rows'] > 0) { +// $num_rows = $row['num_rows']; +// } +// else { +// $num_rows = '0'; +// } +// } //prepare to page the results - $rows_per_page = 10; - $param = ""; - $page = $_GET['page']; - if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; } - list($paging_controls, $rows_per_page, $var_3) = paging($num_rows, $param, $rows_per_page); - $offset = $rows_per_page * $page; +// $rows_per_page = 10; +// $param = ""; +// $page = $_GET['page']; +// if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; } +// list($paging_controls, $rows_per_page, $var_3) = paging($num_rows, $param, $rows_per_page); +// $offset = $rows_per_page * $page; //get the contact list - $sql = " select * from v_contact_addresses "; - $sql .= " where domain_uuid = '".$_SESSION['domain_uuid']."' "; - $sql .= " and contact_uuid = '$contact_uuid' "; - if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; } - $sql .= " limit $rows_per_page offset $offset "; + $sql = "select * from v_contact_addresses "; + $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; + $sql .= "and contact_uuid = '$contact_uuid' "; + $sql .= "order by address_primary desc, address_label asc "; +// if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; } +// $sql .= " limit $rows_per_page offset $offset "; $prep_statement = $db->prepare(check_sql($sql)); $prep_statement->execute(); $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); @@ -95,17 +96,12 @@ require_once "resources/paging.php"; echo "\n"; echo "\n"; - echo th_order_by('address_type', $text['label-address_type'], $order_by, $order); - //echo th_order_by('address_street', $text['label-address_street'], $order_by, $order); - //echo th_order_by('address_extended', $text['label-address_extended'], $order_by, $order); - echo th_order_by('address_locality', $text['label-address_locality'], $order_by, $order); - echo th_order_by('address_region', $text['label-address_region'], $order_by, $order); - //echo th_order_by('address_postal_code', $text['label-address_postal_code'], $order_by, $order); - echo th_order_by('address_country', $text['label-address_country'], $order_by, $order); - //echo th_order_by('address_latitude', $text['label-address_latitude'], $order_by, $order); - //echo th_order_by('address_longitude', $text['label-address_longitude'], $order_by, $order); - echo "\n"; - echo th_order_by('address_description', $text['label-address_description'], $order_by, $order); + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; 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 "\n"; - //echo " \n"; - echo " \n"; - //echo " \n"; - //echo " \n"; - echo " \n"; - echo " \n"; - //echo " \n"; - echo " \n"; - //echo " \n"; - //echo " \n"; - echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; echo " \n"; echo " \n"; - echo "
".$text['label-address_tools']."".$text['label-address_label']."".$text['label-address_address']."".$text['label-address_locality'].", ".$text['label-address_region']."".$text['label-address_country']." ".$text['label-address_description'].""; echo "$v_link_label_add"; echo "
".$row['address_name']." ".ucwords($row['address_type'])." ".$row['address_street']." ".$row['address_extended']." ".$row['address_locality']." ".$row['address_region']." ".$row['address_postal_code']." ".$row['address_country']." ".$row['address_latitude']." ".$row['address_longitude']." 
".$row['address_label']." ".$row['address_street']." ".$row['address_locality'].(($row['address_region'] != '') ? ", ".$row['address_region'] : null)." ".$row['address_country']." ".$row['address_description']." "; @@ -141,11 +131,11 @@ require_once "resources/paging.php"; } //end if results echo "
\n"; + echo "\n"; echo " \n"; echo " \n"; - echo " \n"; - echo " \n"; +// echo " \n"; +// echo " \n"; echo " \n"; diff --git a/app/contacts/contact_delete.php b/app/contacts/contact_delete.php index 2bcdda0d29..fff037f6ff 100644 --- a/app/contacts/contact_delete.php +++ b/app/contacts/contact_delete.php @@ -45,14 +45,6 @@ if (count($_GET)>0) { } if (strlen($id)>0) { - //delete a contact - $sql = "delete from v_contacts "; - $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; - $sql .= "and contact_uuid = '$id' "; - $prep_statement = $db->prepare(check_sql($sql)); - $prep_statement->execute(); - unset($prep_statement, $sql); - //delete addresses $sql = "delete from v_contact_addresses "; $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; @@ -70,6 +62,24 @@ if (strlen($id)>0) { $prep_statement->execute(); unset($prep_statement, $sql); + //delete emails + $sql = ""; + $sql .= "delete from v_contact_emails "; + $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; + $sql .= "and contact_uuid = '$id' "; + $prep_statement = $db->prepare(check_sql($sql)); + $prep_statement->execute(); + unset($prep_statement, $sql); + + //delete urls + $sql = ""; + $sql .= "delete from v_contact_urls "; + $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; + $sql .= "and contact_uuid = '$id' "; + $prep_statement = $db->prepare(check_sql($sql)); + $prep_statement->execute(); + unset($prep_statement, $sql); + //delete notes $sql = ""; $sql .= "delete from v_contact_notes "; @@ -80,7 +90,6 @@ if (strlen($id)>0) { unset($prep_statement, $sql); //delete settings - $sql = ""; $sql = "delete from v_contact_settings "; $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; @@ -88,6 +97,14 @@ if (strlen($id)>0) { $prep_statement = $db->prepare(check_sql($sql)); $prep_statement->execute(); unset($prep_statement, $sql); + + //delete a contact + $sql = "delete from v_contacts "; + $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; + $sql .= "and contact_uuid = '$id' "; + $prep_statement = $db->prepare(check_sql($sql)); + $prep_statement->execute(); + unset($prep_statement, $sql); } diff --git a/app/contacts/contact_edit.php b/app/contacts/contact_edit.php index 5845c206a6..04e891d5e0 100644 --- a/app/contacts/contact_edit.php +++ b/app/contacts/contact_edit.php @@ -74,8 +74,6 @@ else { $contact_title = check_str($_POST["contact_title"]); $contact_category = check_str($_POST["contact_category"]); $contact_role = check_str($_POST["contact_role"]); - $contact_email = check_str($_POST["contact_email"]); - $contact_url = check_str($_POST["contact_url"]); $contact_time_zone = check_str($_POST["contact_time_zone"]); $contact_note = check_str($_POST["contact_note"]); } @@ -95,8 +93,6 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { //if (strlen($contact_nickname) == 0) { $msg .= $text['message-required'].$text['label-contact_nickname']."
\n"; } //if (strlen($contact_title) == 0) { $msg .= $text['message-required'].$text['label-contact_title']."
\n"; } //if (strlen($contact_role) == 0) { $msg .= $text['message-required'].$text['label-contact_role']."
\n"; } - //if (strlen($contact_email) == 0) { $msg .= $text['message-required'].$text['label-contact_email']."
\n"; } - //if (strlen($contact_url) == 0) { $msg .= $text['message-required'].$text['label-contact_url']."
\n"; } //if (strlen($contact_time_zone) == 0) { $msg .= $text['message-required'].$text['label-contact_time_zone']."
\n"; } //if (strlen($contact_note) == 0) { $msg .= $text['message-required'].$text['label-contact_note']."
\n"; } if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { @@ -129,8 +125,6 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $sql .= "contact_title, "; $sql .= "contact_category, "; $sql .= "contact_role, "; - $sql .= "contact_email, "; - $sql .= "contact_url, "; $sql .= "contact_time_zone, "; $sql .= "contact_note "; $sql .= ") "; @@ -146,8 +140,6 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $sql .= "'".$contact_title."', "; $sql .= "'".$contact_category."', "; $sql .= "'".$contact_role."', "; - $sql .= "'".$contact_email."', "; - $sql .= "'".$contact_url."', "; $sql .= "'".$contact_time_zone."', "; $sql .= "'".$contact_note."' "; $sql .= ")"; @@ -210,8 +202,6 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $sql .= "contact_title = '".$contact_title."', "; $sql .= "contact_category = '".$contact_category."', "; $sql .= "contact_role = '".$contact_role."', "; - $sql .= "contact_email = '".$contact_email."', "; - $sql .= "contact_url = '".$contact_url."', "; $sql .= "contact_time_zone = '".$contact_time_zone."', "; $sql .= "contact_note = '".$contact_note."' "; $sql .= "where domain_uuid = '".$domain_uuid."' "; @@ -237,7 +227,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { } //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) //pre-populate the form - if (count($_GET)>0 && $_POST["persistformvar"] != "true") { + if (count($_GET) > 0 && $_POST["persistformvar"] != "true") { $contact_uuid = $_GET["id"]; $sql = "select * from v_contacts "; $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; @@ -254,11 +244,8 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $contact_title = $row["contact_title"]; $contact_category = $row["contact_category"]; $contact_role = $row["contact_role"]; - $contact_email = $row["contact_email"]; - $contact_url = $row["contact_url"]; $contact_time_zone = $row["contact_time_zone"]; $contact_note = $row["contact_note"]; - break; //limit to 1 row } unset ($prep_statement); } @@ -326,17 +313,17 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo "\n"; echo "
 $paging_controls $paging_controls"; echo "$v_link_label_add"; echo "
\n"; echo "\n"; - echo "\n"; - echo "\n"; echo "
"; + echo ""; switch ($action) { case "add" : echo $text['header-contact-add']; break; case "update" : echo $text['header-contact-edit']; break; } echo "\n"; + echo "\n"; echo " \n"; if ($action == "update") { echo " \n"; - echo " \n"; + echo " \n"; } if ($action == "update" && is_dir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/app/invoices')) { echo " \n"; @@ -358,19 +345,18 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo "
\n"; - echo "\n"; + echo "
\n"; echo "\n"; echo "
\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; - echo "\n"; - echo "\n"; - - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - - echo "\n"; - echo "\n"; echo "\n"; echo "\n"; echo "
\n"; - echo " ".$text['label-contact_type'].":\n"; + echo " ".$text['label-contact_type']."\n"; echo "\n"; - - if (is_array($_SESSION["contact"]["role"])) { - sort($_SESSION["contact"]["role"]); + if (is_array($_SESSION["contact"]["type"])) { + sort($_SESSION["contact"]["type"]); echo "
\n"; - echo " ".$text['label-contact_organization'].":\n"; + echo " ".$text['label-contact_organization']."\n"; echo "\n"; echo " \n"; @@ -473,7 +459,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo "
\n"; - echo " ".$text['label-contact_name_given'].":\n"; + echo " ".$text['label-contact_name_given']."\n"; echo "\n"; echo " \n"; @@ -484,7 +470,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo "
\n"; - echo " ".$text['label-contact_name_family'].":\n"; + echo " ".$text['label-contact_name_family']."\n"; echo "\n"; echo " \n"; @@ -495,7 +481,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo "
\n"; - echo " ".$text['label-contact_nickname'].":\n"; + echo " ".$text['label-contact_nickname']."\n"; echo "\n"; echo " \n"; @@ -506,7 +492,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo "
\n"; - echo " ".$text['label-contact_title'].":\n"; + echo " ".$text['label-contact_title']."\n"; echo "\n"; if (is_array($_SESSION["contact"]["title"])) { @@ -533,7 +519,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo "
\n"; - echo " ".$text['label-contact_category'].":\n"; + echo " ".$text['label-contact_category']."\n"; echo "\n"; if (is_array($_SESSION["contact"]["category"])) { @@ -560,7 +546,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo "
\n"; - echo " ".$text['label-contact_role'].":\n"; + echo " ".$text['label-contact_role']."\n"; echo "\n"; if (is_array($_SESSION["contact"]["role"])) { @@ -587,29 +573,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo "
\n"; - echo " ".$text['label-contact_email'].":\n"; - echo "\n"; - echo " \n"; - echo "
\n"; - echo $text['description-contact_email']."\n"; - echo "
\n"; - echo " ".$text['label-contact_url'].":\n"; - echo "\n"; - echo " \n"; - echo "
\n"; - echo $text['description-contact_url']."\n"; - echo "
\n"; - echo " ".$text['label-contact_time_zone'].":\n"; + echo " ".$text['label-contact_time_zone']."\n"; echo "\n"; echo " \n"; @@ -638,7 +602,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $contact_shared_disabled = ($_SESSION['groups'][0]['domain_uuid'] != $_SESSION['domain_uuid']) ? "disabled='disabled'" : null; echo "
\n"; - echo " ".$text['label-shared'].":\n"; + echo " ".$text['label-shared']."\n"; echo "\n"; echo " \n"; echo "\n"; echo "\n"; echo "\n"; @@ -759,11 +723,13 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo "\n"; if ($action == "update") { - echo ""; + echo ""; echo "
\n"; - echo " ".$text['label-contact_note'].":\n"; + echo " ".$text['label-contact_note']."\n"; echo "\n"; - echo " \n"; + echo " \n"; echo "
\n"; echo $text['description-contact_note']."\n"; echo "
         \n"; //echo "

\n"; require "contact_phones.php"; require "contact_addresses.php"; + require "contact_emails.php"; + require "contact_urls.php"; require "contact_extensions.php"; require "contact_notes.php"; require "contact_settings.php"; diff --git a/app/contacts/contact_email_delete.php b/app/contacts/contact_email_delete.php new file mode 100644 index 0000000000..e417debd96 --- /dev/null +++ b/app/contacts/contact_email_delete.php @@ -0,0 +1,61 @@ + + Portions created by the Initial Developer are Copyright (C) 2008-2012 + the Initial Developer. All Rights Reserved. + + Contributor(s): + Mark J Crane +*/ +require_once "root.php"; +require_once "resources/require.php"; +require_once "resources/check_auth.php"; +if (permission_exists('contact_delete')) { + //access granted +} +else { + echo "access denied"; + exit; +} + +//add multi-lingual support + require_once "app_languages.php"; + foreach($text as $key => $value) { + $text[$key] = $value[$_SESSION['domain']['language']['code']]; + } + +if (count($_GET)>0) { + $id = check_str($_GET["id"]); + $contact_uuid = check_str($_GET["contact_uuid"]); +} + +if (strlen($id)>0) { + $sql = "delete from v_contact_emails "; + $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; + $sql .= "and contact_email_uuid = '".$id."' "; + $prep_statement = $db->prepare(check_sql($sql)); + $prep_statement->execute(); + unset($sql); +} + +$_SESSION["message"] = $text['message-delete']; +header("Location: contact_edit.php?id=".$contact_uuid); +return; + +?> \ No newline at end of file diff --git a/app/contacts/contact_email_edit.php b/app/contacts/contact_email_edit.php new file mode 100644 index 0000000000..9a84bbc7ee --- /dev/null +++ b/app/contacts/contact_email_edit.php @@ -0,0 +1,301 @@ + + Portions created by the Initial Developer are Copyright (C) 2008-2012 + the Initial Developer. All Rights Reserved. + + Contributor(s): + Mark J Crane +*/ +require_once "root.php"; +require_once "resources/require.php"; +require_once "resources/check_auth.php"; +if (permission_exists('contact_edit')) { + //access granted +} +else { + echo "access denied"; + exit; +} + +//add multi-lingual support + require_once "app_languages.php"; + foreach($text as $key => $value) { + $text[$key] = $value[$_SESSION['domain']['language']['code']]; + } + +//action add or update + if (isset($_REQUEST["id"])) { + $action = "update"; + $contact_email_uuid = check_str($_REQUEST["id"]); + } + else { + $action = "add"; + } + +if (strlen($_GET["contact_uuid"]) > 0) { + $contact_uuid = check_str($_GET["contact_uuid"]); +} + +//get http post variables and set them to php variables + if (count($_POST)>0) { + $email_label = check_str($_POST["email_label"]); + $email_label_custom = check_str($_POST["email_label_custom"]); + $email_address = check_str($_POST["email_address"]); + $email_primary = check_str($_POST["email_primary"]); + $email_description = check_str($_POST["email_description"]); + + //use custom label if set + $email_label = ($email_label_custom != '') ? $email_label_custom : $email_label; + } + +if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { + + $msg = ''; + if ($action == "update") { + $contact_email_uuid = check_str($_POST["contact_email_uuid"]); + } + + //check for all required data + if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { + require_once "resources/header.php"; + require_once "resources/persist_form_var.php"; + echo "
\n"; + echo "
\n"; + echo $msg."
"; + echo "
\n"; + persistformvar($_POST); + echo "
\n"; + require_once "resources/footer.php"; + return; + } + + //add or update the database + if ($_POST["persistformvar"] != "true") { + + //if primary, unmark other primary numbers + if ($email_primary) { + $sql = "update v_contact_emails set email_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_email_uuid = uuid(); + $sql = "insert into v_contact_emails "; + $sql .= "("; + $sql .= "domain_uuid, "; + $sql .= "contact_uuid, "; + $sql .= "contact_email_uuid, "; + $sql .= "email_label, "; + $sql .= "email_address, "; + $sql .= "email_primary, "; + $sql .= "email_description "; + $sql .= ")"; + $sql .= "values "; + $sql .= "("; + $sql .= "'".$_SESSION['domain_uuid']."', "; + $sql .= "'".$contact_uuid."', "; + $sql .= "'".$contact_email_uuid."', "; + $sql .= "'".$email_label."', "; + $sql .= "'".$email_address."', "; + $sql .= (($email_primary) ? 1 : 0).", "; + $sql .= "'".$email_description."' "; + $sql .= ")"; + $db->exec(check_sql($sql)); + unset($sql); + + $_SESSION["message"] = $text['message-add']; + header("Location: contact_edit.php?id=".$contact_uuid); + return; + } //if ($action == "add") + + if ($action == "update") { + $sql = "update v_contact_emails set "; + $sql .= "contact_uuid = '".$contact_uuid."', "; + $sql .= "email_label = '".$email_label."', "; + $sql .= "email_address = '".$email_address."', "; + $sql .= "email_primary = ".(($email_primary) ? 1 : 0).", "; + $sql .= "email_description = '".$email_description."' "; + $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; + $sql .= "and contact_email_uuid = '".$contact_email_uuid."'"; + $db->exec(check_sql($sql)); + unset($sql); + + $_SESSION["message"] = $text['message-update']; + header("Location: contact_edit.php?id=".$contact_uuid); + return; + } //if ($action == "update") + } //if ($_POST["persistformvar"] != "true") +} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) + +//pre-populate the form + if (count($_GET)>0 && $_POST["persistformvar"] != "true") { + $contact_email_uuid = $_GET["id"]; + $sql = "select * from v_contact_emails "; + $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; + $sql .= "and contact_email_uuid = '".$contact_email_uuid."' "; + $prep_statement = $db->prepare(check_sql($sql)); + $prep_statement->execute(); + $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); + foreach ($result as &$row) { + $email_label = $row["email_label"]; + $email_address = $row["email_address"]; + $email_primary = $row["email_primary"]; + $email_description = $row["email_description"]; + break; //limit to 1 row + } + unset ($prep_statement); + } + +//show the header + require_once "resources/header.php"; + if ($action == "update") { + $document['title'] = $text['title-contact_email-edit']; + } + else if ($action == "add") { + $document['title'] = $text['title-contact_email-add']; + } + +//javascript to toggle input/select boxes + echo ""; + +//show the content + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
"; + if ($action == "update") { + echo $text['header-contact_email-edit']; + } + else if ($action == "add") { + echo $text['header-contact_email-add']; + } + echo ""; + echo " "; + echo " \n"; + echo "
\n"; + + if ($action == "update") { + echo $text['description-contact_email-edit']; + } + else if ($action == "add") { + echo $text['description-contact_email-add']; + } + echo "

\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo " \n"; + echo " \n"; + echo " "; + echo "
\n"; + echo " ".$text['label-email_label']."\n"; + echo "\n"; + if (is_array($_SESSION["contact"]["email_label"])) { + sort($_SESSION["contact"]["email_label"]); + foreach($_SESSION["contact"]["email_label"] as $row) { + $email_label_options[] = ""; + } + $email_label_found = (in_array($email_label, $_SESSION["contact"]["email_label"])) ? true : false; + } + else { + $selected[$email_label] = "selected"; + $default_labels[] = $text['option-work']; + $default_labels[] = $text['option-home']; + $default_labels[] = $text['option-other']; + foreach ($default_labels as $default_label) { + $email_label_options[] = ""; + } + $email_label_found = (in_array($email_label, $default_labels)) ? true : false; + } + echo " \n"; + echo " \n"; + echo " \n"; + echo "
\n"; + echo $text['description-email_label']."\n"; + echo "
\n"; + echo " ".$text['label-email_address']."\n"; + echo "\n"; + echo " \n"; + echo "
\n"; + echo $text['description-email_address']."\n"; + echo "
\n"; + echo " ".$text['label-primary']."\n"; + echo "\n"; + echo " \n"; + echo "
\n"; + echo $text['description-email_primary']."\n"; + echo "
\n"; + echo " ".$text['label-email_description']."\n"; + echo "\n"; + echo " \n"; + echo "
\n"; + echo $text['description-email_description']."\n"; + echo "
\n"; + echo "
\n"; + echo " \n"; + if ($action == "update") { + echo " \n"; + } + echo " \n"; + echo "
"; + echo ""; + +//include the footer + require_once "resources/footer.php"; +?> \ No newline at end of file diff --git a/app/contacts/contact_emails.php b/app/contacts/contact_emails.php new file mode 100644 index 0000000000..fe67364d3d --- /dev/null +++ b/app/contacts/contact_emails.php @@ -0,0 +1,140 @@ + + Portions created by the Initial Developer are Copyright (C) 2008-2012 + the Initial Developer. All Rights Reserved. + + Contributor(s): + Mark J Crane +*/ +require_once "root.php"; +require_once "resources/require.php"; +require_once "resources/check_auth.php"; +if (permission_exists('contact_view')) { + //access granted +} +else { + echo "access denied"; + exit; +} + +//require_once "resources/header.php"; +require_once "resources/paging.php"; + +//get variables used to control the order +// $order_by = $_GET["order_by"]; +// $order = $_GET["order"]; + +//show the content + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
".$text['label-emails']." 
\n"; + + //prepare to page the results +// $sql = " select count(*) as num_rows from v_contact_emails "; +// $sql .= " where domain_uuid = '".$_SESSION['domain_uuid']."' "; +// $sql .= " and contact_uuid = '$contact_uuid' "; +// $prep_statement = $db->prepare($sql); +// if ($prep_statement) { +// $prep_statement->execute(); +// $row = $prep_statement->fetch(PDO::FETCH_ASSOC); +// if ($row['num_rows'] > 0) { +// $num_rows = $row['num_rows']; +// } +// else { +// $num_rows = '0'; +// } +// } + + //prepare to page the results +// $rows_per_page = 10; +// $param = ""; +// $page = $_GET['page']; +// if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; } +// list($paging_controls, $rows_per_page, $var_3) = paging($num_rows, $param, $rows_per_page); +// $offset = $rows_per_page * $page; + + //get the contact list + $sql = "select * from v_contact_emails "; + $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; + $sql .= "and contact_uuid = '$contact_uuid' "; + $sql .= "order by email_primary desc, email_label asc "; +// if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; } +// $sql .= " limit $rows_per_page offset $offset "; + $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); + + $c = 0; + $row_style["0"] = "row_style0"; + $row_style["1"] = "row_style1"; + + echo "
\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + if ($result_count > 0) { + foreach($result as $row) { + $tr_link = "href='contact_email_edit.php?contact_uuid=".$row['contact_uuid']."&id=".$row['contact_email_uuid']."'"; + echo "\n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo "\n"; + if ($c==0) { $c=1; } else { $c=0; } + } //end foreach + unset($sql, $result, $row_count); + } //end if results + + echo "\n"; + echo "\n"; + echo "\n"; + + echo "
".$text['label-email_label']."".$text['label-email_address']."".$text['label-email_description'].""; + echo "$v_link_label_add"; + echo "
".$row['email_label']." ".$row['address_description']." "; + echo "$v_link_label_edit"; + echo "$v_link_label_delete"; + echo "
\n"; + echo " \n"; + echo " \n"; +// echo " \n"; +// echo " \n"; + echo " \n"; + echo " \n"; + echo "
 $paging_controls"; + echo "$v_link_label_add"; + echo "
\n"; + echo "
"; + echo "
"; + +?> \ No newline at end of file diff --git a/app/contacts/contact_extensions.php b/app/contacts/contact_extensions.php index 71a87ae7b0..aa1d0ba3cf 100644 --- a/app/contacts/contact_extensions.php +++ b/app/contacts/contact_extensions.php @@ -117,9 +117,9 @@ require_once "resources/paging.php"; echo "
\n"; echo "\n"; echo "\n"; - echo th_order_by('extension', $text['label-extension'], $order_by, $order); - echo th_order_by('enabled', $text['label-enabled'], $order_by, $order); - echo th_order_by('phone_description', $text['label-description'], $order_by, $order); + echo "\n"; + echo "\n"; + echo "\n"; echo "
".$text['label-extension']."".$text['label-enabled']."".$text['label-description'].""; if (permission_exists('extension_add')) { echo " $v_link_label_add\n"; diff --git a/app/contacts/contact_import.php b/app/contacts/contact_import.php index 4b188dff1b..fdf35a2b6a 100644 --- a/app/contacts/contact_import.php +++ b/app/contacts/contact_import.php @@ -203,62 +203,76 @@ else { $x = 0; if (strlen($data['BusinessFax']) > 0) { $phone_array[$x]['phone_number'] = preg_replace('{\D}', '', $data['BusinessFax']); - $phone_array[$x]['phone_type'] = 'fax'; + $phone_array[$x]['phone_type_fax'] = 1; + $phone_array[$x]['phone_label'] = $text['option-fax']; + $phone_array[$x]['phone_description'] = $text['option-work']; $x++; } if (strlen($data['BusinessPhone']) > 0) { $phone_array[$x]['phone_number'] = preg_replace('{\D}', '', $data['BusinessPhone']); - $phone_array[$x]['phone_type'] = 'work'; + $phone_array[$x]['phone_type_voice'] = 1; + $phone_array[$x]['phone_label'] = $text['option-work']; $x++; } if (strlen($data['BusinessPhone2']) > 0) { $phone_array[$x]['phone_number'] = preg_replace('{\D}', '', $data['BusinessPhone2']); - $phone_array[$x]['phone_type'] = 'work'; + $phone_array[$x]['phone_type_voice'] = 1; + $phone_array[$x]['phone_label'] = $text['option-work']; $x++; } if (strlen($data['CompanyMainPhone']) > 0) { $phone_array[$x]['phone_number'] = preg_replace('{\D}', '', $data['CompanyMainPhone']); - $phone_array[$x]['phone_type'] = 'pref'; + $phone_array[$x]['phone_type_voice'] = 1; + $phone_array[$x]['phone_label'] = $text['option-main']; $x++; } if (strlen($data['HomeFax']) > 0) { $phone_array[$x]['phone_number'] = preg_replace('{\D}', '', $data['HomeFax']); - $phone_array[$x]['phone_type'] = 'fax'; + $phone_array[$x]['phone_type_fax'] = 1; + $phone_array[$x]['phone_label'] = $text['option-fax']; + $phone_array[$x]['phone_description'] = $text['option-home']; $x++; } if (strlen($data['HomePhone']) > 0) { $phone_array[$x]['phone_number'] = preg_replace('{\D}', '', $data['HomePhone']); - $phone_array[$x]['phone_type'] = 'home'; + $phone_array[$x]['phone_type_voice'] = 1; + $phone_array[$x]['phone_label'] = $text['option-home']; $x++; } if (strlen($data['HomePhone2']) > 0) { $phone_array[$x]['phone_number'] = preg_replace('{\D}', '', $data['HomePhone2']); - $phone_array[$x]['phone_type'] = 'home'; + $phone_array[$x]['phone_type_voice'] = 1; + $phone_array[$x]['phone_label'] = $text['option-home']; $x++; } if (strlen($data['MobilePhone']) > 0) { $phone_array[$x]['phone_number'] = preg_replace('{\D}', '', $data['MobilePhone']); - $phone_array[$x]['phone_type'] = 'cell'; + $phone_array[$x]['phone_type_voice'] = 1; + $phone_array[$x]['phone_label'] = $text['option-mobile']; $x++; } if (strlen($data['OtherFax']) > 0) { $phone_array[$x]['phone_number'] = preg_replace('{\D}', '', $data['OtherFax']); - $phone_array[$x]['phone_type'] = 'fax'; + $phone_array[$x]['phone_type_fax'] = 1; + $phone_array[$x]['phone_label'] = $text['option-fax']; $x++; } if (strlen($data['OtherPhone']) > 0) { $phone_array[$x]['phone_number'] = preg_replace('{\D}', '', $data['OtherPhone']); - $phone_array[$x]['phone_type'] = 'home'; + $phone_array[$x]['phone_type_voice'] = 1; + $phone_array[$x]['phone_label'] = $text['option-other']; $x++; } if (strlen($data['Pager']) > 0) { $phone_array[$x]['phone_number'] = preg_replace('{\D}', '', $data['Pager']); - $phone_array[$x]['phone_type'] = 'page'; + $phone_array[$x]['phone_type_text'] = 1; + $phone_array[$x]['phone_label'] = $text['option-pager']; $x++; } if (strlen($data['PrimaryPhone']) > 0) { $phone_array[$x]['phone_number'] = preg_replace('{\D}', '', $data['PrimaryPhone']); - $phone_array[$x]['phone_type'] = 'pref'; + $phone_array[$x]['phone_type_voice'] = 1; + $phone_array[$x]['phone_label'] = $text['option-main']; $x++; } foreach ($phone_array as $row) { @@ -268,16 +282,26 @@ else { $sql .= "domain_uuid, "; $sql .= "contact_uuid, "; $sql .= "contact_phone_uuid, "; - $sql .= "phone_type, "; - $sql .= "phone_number "; + $sql .= "phone_type_voice, "; + $sql .= "phone_type_fax, "; + $sql .= "phone_type_video, "; + $sql .= "phone_type_text, "; + $sql .= "phone_label, "; + $sql .= "phone_number, "; + $sql .= "phone_description "; $sql .= ")"; $sql .= "values "; $sql .= "("; $sql .= "'$domain_uuid', "; $sql .= "'$contact_uuid', "; $sql .= "'$contact_phone_uuid', "; - $sql .= "'".$row['phone_type']."', "; - $sql .= "'".$row['phone_number']."' "; + $sql .= (($row['phone_type_voice']) ? 1 : 0).", "; + $sql .= (($row['phone_type_fax']) ? 1 : 0).", "; + $sql .= (($row['phone_type_video']) ? 1 : 0).", "; + $sql .= (($row['phone_type_text']) ? 1 : 0).", "; + $sql .= "'".$row['phone_label']."', "; + $sql .= "'".$row['phone_number']."', "; + $sql .= "'".$row['phone_description']."', "; $sql .= ")"; $db->exec(check_sql($sql)); unset($sql); @@ -299,8 +323,7 @@ else { //show the header require_once "resources/header.php"; - echo "
\n"; - echo "\n"; + echo "
\n"; echo "\n"; echo "\n"; echo "
".$text['header-contacts_import']."\n"; @@ -315,7 +338,7 @@ else { echo "
\n"; //show the results - echo "\n"; + echo "
\n"; echo "\n"; echo " \n"; echo " \n"; @@ -351,19 +374,13 @@ else { require_once "resources/header.php"; //begin the content - echo "
"; - echo "
".$text['label-contact_name']."".$text['label-contact_organization']."
\n"; - echo "\n"; - echo "
\n"; - echo "
"; - - echo "\n"; + echo "
\n"; echo " \n"; - echo " \n"; - echo " \n"; @@ -373,7 +390,7 @@ else { echo "
\n"; echo "\n"; - echo "
\n"; + echo " \n"; echo " ".$text['header-contacts_import']."
\n"; echo " ".$text['description-contacts_import']."\n"; echo "
\n"; + echo " \n"; echo " \n"; echo " \n"; echo "
\n"; + echo "
\n"; echo "\n"; echo "\n"; echo " \n"; diff --git a/app/contacts/contact_note_delete.php b/app/contacts/contact_note_delete.php index f8d8dd2c28..7cff3588dd 100644 --- a/app/contacts/contact_note_delete.php +++ b/app/contacts/contact_note_delete.php @@ -46,8 +46,7 @@ if (count($_GET)>0) { } if (strlen($id)>0) { - $sql = ""; - $sql .= "delete from v_contact_notes "; + $sql = "delete from v_contact_notes "; $sql .= "where domain_uuid = '$domain_uuid' "; $sql .= "and contact_note_uuid = '$id' "; $prep_statement = $db->prepare(check_sql($sql)); diff --git a/app/contacts/contact_note_edit.php b/app/contacts/contact_note_edit.php index b638fc20b9..10643d654e 100644 --- a/app/contacts/contact_note_edit.php +++ b/app/contacts/contact_note_edit.php @@ -162,55 +162,46 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { } //show the content - echo "
"; - echo "
\n"; @@ -419,6 +436,7 @@ else { echo "  \n"; echo " \n"; + echo "
\n"; echo " \n"; echo " \n"; echo "
\n"; - - echo "\n"; - echo " "; - echo " "; - echo "
\n"; - echo "
"; - echo "\n"; - echo "
\n"; - echo "\n"; + echo "
\n"; echo "\n"; + echo "\n"; + echo "".$text['header-contact_notes-add'].""; } if ($action == "update") { - echo "\n"; + echo "".$text['header-contact_notes-edit']."\n"; } + echo "\n"; echo "\n"; echo "\n"; + echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo " \n"; echo " \n"; echo " "; echo "
"; if ($action == "add") { - echo "".$text['header-contact_notes-add']."".$text['header-contact_notes-edit'].""; echo " "; echo " \n"; echo "
 
\n"; - echo " ".$text['label-contact_note'].":\n"; + echo " ".$text['label-contact_note']."\n"; echo "\n"; - echo " \n"; + echo " \n"; echo "
\n"; echo "\n"; echo "
\n"; - echo " \n"; + echo "
"; + echo " \n"; if ($action == "update") { - echo " \n"; + echo " \n"; } - echo " \n"; + echo " \n"; echo "
"; echo ""; - echo "
"; - echo ""; - //include the footer require_once "resources/footer.php"; ?> \ No newline at end of file diff --git a/app/contacts/contact_notes.php b/app/contacts/contact_notes.php index ab5192730a..8a09e86b15 100644 --- a/app/contacts/contact_notes.php +++ b/app/contacts/contact_notes.php @@ -57,36 +57,36 @@ require_once "resources/paging.php"; echo "
\n"; //prepare to page the results - $sql = "select count(*) as num_rows from v_contact_notes "; - $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; - $sql .= "and contact_uuid = '$contact_uuid' "; - if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; } - $prep_statement = $db->prepare($sql); - if ($prep_statement) { - $prep_statement->execute(); - $row = $prep_statement->fetch(PDO::FETCH_ASSOC); - if ($row['num_rows'] > 0) { - $num_rows = $row['num_rows']; - } - else { - $num_rows = '0'; - } - } +// $sql = "select count(*) as num_rows from v_contact_notes "; +// $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; +// $sql .= "and contact_uuid = '$contact_uuid' "; +// if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; } +// $prep_statement = $db->prepare($sql); +// if ($prep_statement) { +// $prep_statement->execute(); +// $row = $prep_statement->fetch(PDO::FETCH_ASSOC); +// if ($row['num_rows'] > 0) { +// $num_rows = $row['num_rows']; +// } +// else { +// $num_rows = '0'; +// } +// } //prepare to page the results - $rows_per_page = 10; - $param = ""; - $page = $_GET['page']; - if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; } - list($paging_controls, $rows_per_page, $var_3) = paging($num_rows, $param, $rows_per_page); - $offset = $rows_per_page * $page; +// $rows_per_page = 10; +// $param = ""; +// $page = $_GET['page']; +// if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; } +// list($paging_controls, $rows_per_page, $var_3) = paging($num_rows, $param, $rows_per_page); +// $offset = $rows_per_page * $page; //get the contact list $sql = "select * from v_contact_notes "; $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; $sql .= "and contact_uuid = '$contact_uuid' "; - if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; } - $sql .= " limit $rows_per_page offset $offset "; + if (strlen($order_by)> 0) { $sql .= "order by ".$order_by." ".$order." "; } +// $sql .= " limit ".$rows_per_page." offset ".$offset." "; $prep_statement = $db->prepare(check_sql($sql)); if ($prep_statement) { $prep_statement->execute(); @@ -99,38 +99,25 @@ require_once "resources/paging.php"; $row_style["0"] = "row_style0"; $row_style["1"] = "row_style1"; - echo "
\n"; echo "\n"; - if ($result_count == 0) { - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - } - else { + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + if ($result_count != 0) { foreach($result as $row) { $contact_note = $row['contact_note']; $contact_note = str_replace("\n","
",$contact_note); - - echo "\n"; - echo "\n"; - //echo "\n"; - //echo "\n"; - echo "\n"; - echo "\n"; $tr_link = "href='contact_note_edit.php?contact_uuid=".$row['contact_uuid']."&id=".$row['contact_note_uuid']."'"; echo "\n"; - echo " \n"; - //echo " \n"; - //echo " \n"; + echo " \n"; echo " \n"; - echo "
 "; - echo "$v_link_label_add"; - echo "
".$text['label-note_content']."".$text['label-note_user'].""; + echo "$v_link_label_add"; + echo "
\n"; - echo " ".$row['last_mod_date']."    \n"; - echo " ".$row['last_mod_user']."     \n"; - echo "Modified Date ".$row['last_mod_date']."Modified By ".$row['last_mod_user']."\n"; - echo " $v_link_label_add\n"; - echo "
".$contact_note." ".$row['last_mod_date']." ".$row['last_mod_user']." "; + echo "
".$row['last_mod_user'].": ".date("j M Y @ H:i:s", strtotime($row['last_mod_date']))."
"; + echo $contact_note." "; + echo "
"; echo "$v_link_label_edit"; echo "$v_link_label_delete"; @@ -143,7 +130,7 @@ require_once "resources/paging.php"; } //end if results echo "
\n"; + echo "\n"; echo " \n"; echo " \n"; echo " \n"; @@ -157,6 +144,5 @@ require_once "resources/paging.php"; echo "\n"; echo "
 
"; - echo ""; ?> \ No newline at end of file diff --git a/app/contacts/contact_phone_delete.php b/app/contacts/contact_phone_delete.php index caaced5f00..d083ab3014 100644 --- a/app/contacts/contact_phone_delete.php +++ b/app/contacts/contact_phone_delete.php @@ -46,8 +46,7 @@ if (count($_GET)>0) { } if (strlen($id)>0) { - $sql = ""; - $sql .= "delete from v_contact_phones "; + $sql = "delete from v_contact_phones "; $sql .= "where domain_uuid = '$domain_uuid' "; $sql .= "and contact_phone_uuid = '$id' "; $prep_statement = $db->prepare(check_sql($sql)); diff --git a/app/contacts/contact_phone_edit.php b/app/contacts/contact_phone_edit.php index 7c503883df..8032fa3da1 100644 --- a/app/contacts/contact_phone_edit.php +++ b/app/contacts/contact_phone_edit.php @@ -55,13 +55,22 @@ if (strlen($_GET["contact_uuid"]) > 0) { //get http post variables and set them to php variables if (count($_POST)>0) { - $phone_type = check_str($_POST["phone_type"]); + $phone_type_voice = check_str($_POST["phone_type_voice"]); + $phone_type_fax = check_str($_POST["phone_type_fax"]); + $phone_type_video = check_str($_POST["phone_type_video"]); + $phone_type_text = check_str($_POST["phone_type_text"]); + $phone_label = check_str($_POST["phone_label"]); + $phone_label_custom = check_str($_POST["phone_label_custom"]); $phone_number = check_str($_POST["phone_number"]); $phone_extension = check_str($_POST["phone_extension"]); + $phone_primary = check_str($_POST["phone_primary"]); $phone_description = check_str($_POST["phone_description"]); //remove any phone number formatting $phone_number = preg_replace('{\D}', '', $phone_number); + + //use custom label if set + $phone_label = ($phone_label_custom != '') ? $phone_label_custom : $phone_label; } if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { @@ -72,8 +81,6 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { } //check for all required data - //if (strlen($phone_type) == 0) { $msg .= $text['message-required'].$text['label-phone_type']."
\n"; } - //if (strlen($phone_number) == 0) { $msg .= $text['message-required'].$text['label-phone_number']."
\n"; } if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { require_once "resources/header.php"; require_once "resources/persist_form_var.php"; @@ -89,6 +96,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 ($phone_primary) { + $sql = "update v_contact_phones set phone_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_phone_uuid = uuid(); $sql = "insert into v_contact_phones "; @@ -96,20 +113,30 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $sql .= "domain_uuid, "; $sql .= "contact_uuid, "; $sql .= "contact_phone_uuid, "; - $sql .= "phone_type, "; + $sql .= "phone_type_voice, "; + $sql .= "phone_type_fax, "; + $sql .= "phone_type_video, "; + $sql .= "phone_type_text, "; + $sql .= "phone_label, "; $sql .= "phone_number, "; $sql .= "phone_extension, "; + $sql .= "phone_primary, "; $sql .= "phone_description "; $sql .= ")"; $sql .= "values "; $sql .= "("; - $sql .= "'$domain_uuid', "; - $sql .= "'$contact_uuid', "; - $sql .= "'$contact_phone_uuid', "; - $sql .= "'$phone_type', "; - $sql .= "'$phone_number', "; - $sql .= "'$phone_extension', "; - $sql .= "'$phone_description' "; + $sql .= "'".$domain_uuid."', "; + $sql .= "'".$contact_uuid."', "; + $sql .= "'".$contact_phone_uuid."', "; + $sql .= (($phone_type_voice) ? 1 : 'null').", "; + $sql .= (($phone_type_fax) ? 1 : 'null').", "; + $sql .= (($phone_type_video) ? 1 : 'null').", "; + $sql .= (($phone_type_text) ? 1 : 'null').", "; + $sql .= "'".$phone_label."', "; + $sql .= "'".$phone_number."', "; + $sql .= "'".$phone_extension."', "; + $sql .= (($phone_primary) ? 1 : 0).", "; + $sql .= "'".$phone_description."' "; $sql .= ")"; $db->exec(check_sql($sql)); unset($sql); @@ -122,12 +149,17 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { if ($action == "update") { $sql = "update v_contact_phones set "; $sql .= "contact_uuid = '$contact_uuid', "; - $sql .= "phone_type = '$phone_type', "; - $sql .= "phone_number = '$phone_number', "; - $sql .= "phone_extension = '$phone_extension', "; - $sql .= "phone_description = '$phone_description' "; - $sql .= "where domain_uuid = '$domain_uuid'"; - $sql .= "and contact_phone_uuid = '$contact_phone_uuid'"; + $sql .= "phone_type_voice = ".(($phone_type_voice) ? 1 : 'null').", "; + $sql .= "phone_type_fax = ".(($phone_type_fax) ? 1 : 'null').", "; + $sql .= "phone_type_video = ".(($phone_type_video) ? 1 : 'null').", "; + $sql .= "phone_type_text = ".(($phone_type_text) ? 1 : 'null').", "; + $sql .= "phone_label = '".$phone_label."', "; + $sql .= "phone_number = '".$phone_number."', "; + $sql .= "phone_extension = '".$phone_extension."', "; + $sql .= "phone_primary = ".(($phone_primary) ? 1 : 0).", "; + $sql .= "phone_description = '".$phone_description."' "; + $sql .= "where domain_uuid = '".$domain_uuid."' "; + $sql .= "and contact_phone_uuid = '".$contact_phone_uuid."'"; $db->exec(check_sql($sql)); unset($sql); @@ -148,9 +180,14 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $prep_statement->execute(); $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); foreach ($result as &$row) { - $phone_type = $row["phone_type"]; + $phone_type_voice = $row["phone_type_voice"]; + $phone_type_fax = $row["phone_type_fax"]; + $phone_type_video = $row["phone_type_video"]; + $phone_type_text = $row["phone_type_text"]; + $phone_label = $row["phone_label"]; $phone_number = $row["phone_number"]; $phone_extension = $row["phone_extension"]; + $phone_primary = $row["phone_primary"]; $phone_description = $row["phone_description"]; } unset ($prep_statement); @@ -165,18 +202,22 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $document['title'] = $text['title-contact_phones-add']; } -//show the content - echo "
"; - echo "\n"; - echo "\n"; - echo " "; - echo " "; - echo "
\n"; - echo "
"; +//javascript to toggle input/select boxes + echo ""; +//show the content echo "
\n"; - echo "
\n"; - echo "\n"; + echo "
\n"; echo "\n"; - echo "\n"; - echo "\n"; echo "\n"; + echo "
"; + echo ""; if ($action == "update") { echo $text['header-contact_phones-edit']; } @@ -184,136 +225,63 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo $text['header-contact_phones-add']; } echo ""; + echo ""; echo " "; echo " \n"; echo "
\n"; + echo "
\n"; + + echo "\n"; echo "\n"; - echo "\n"; + echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; @@ -321,7 +289,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; echo "\n"; echo "
\n"; + echo "\n"; + echo " ".$text['label-phone_label']."\n"; + echo "\n"; + if (is_array($_SESSION["contact"]["phone_label"])) { + sort($_SESSION["contact"]["phone_label"]); + foreach($_SESSION["contact"]["phone_label"] as $row) { + $phone_label_options[] = ""; + } + $phone_label_found = (in_array($phone_label, $_SESSION["contact"]["phone_label"])) ? true : false; + } + else { + $selected[$phone_label] = "selected"; + $default_labels[] = $text['option-work']; + $default_labels[] = $text['option-home']; + $default_labels[] = $text['option-mobile']; + $default_labels[] = $text['option-main']; + $default_labels[] = $text['option-fax']; + $default_labels[] = $text['option-pager']; + $default_labels[] = $text['option-voicemail']; + $default_labels[] = $text['option-text']; + $default_labels[] = $text['option-other']; + foreach ($default_labels as $default_label) { + $phone_label_options[] = ""; + } + $phone_label_found = (in_array($phone_label, $default_labels)) ? true : false; + } + echo " \n"; + echo " \n"; + echo " \n"; + echo "
\n"; + echo $text['description-phone_label']."\n"; echo "
\n"; - echo " ".$text['label-phone_type'].":\n"; + echo " ".$text['label-phone_type']."\n"; echo "\n"; - if (is_array($_SESSION["contact"]["phone_type"])) { - sort($_SESSION["contact"]["phone_type"]); - echo " \n"; - } - else { - echo " \n"; - } + echo "  \n"; + echo "  \n"; + echo "  \n"; + echo " \n"; echo "
\n"; echo $text['description-phone_type']."\n"; echo "
\n"; - echo " ".$text['label-phone_number'].":\n"; + echo " ".$text['label-phone_number']."\n"; echo "\n"; echo " \n"; @@ -332,7 +300,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo "
\n"; - echo " ".$text['label-phone_extension'].":\n"; + echo " ".$text['label-phone_extension']."\n"; echo "\n"; echo " \n"; @@ -343,7 +311,21 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo "
\n"; - echo " ".$text['label-phone_description'].":\n"; + echo " ".$text['label-primary']."\n"; + echo "\n"; + echo " \n"; + echo "
\n"; + echo $text['description-phone_primary']."\n"; + echo "
\n"; + echo " ".$text['label-phone_description']."\n"; echo "\n"; echo " \n"; @@ -354,6 +336,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo "
\n"; + echo "
\n"; echo " \n"; if ($action == "update") { echo " \n"; @@ -364,11 +347,6 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo "
"; echo ""; - echo "
"; - echo "
"; - //include the footer require_once "resources/footer.php"; ?> \ No newline at end of file diff --git a/app/contacts/contact_phones.php b/app/contacts/contact_phones.php index deefcb802e..d1b7598f38 100644 --- a/app/contacts/contact_phones.php +++ b/app/contacts/contact_phones.php @@ -38,8 +38,8 @@ else { require_once "resources/paging.php"; //get variables used to control the order - $order_by = $_GET["order_by"]; - $order = $_GET["order"]; +// $order_by = $_GET["order_by"]; +// $order = $_GET["order"]; //javascript function: send_cmd echo ""; + +//show the content + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
"; + if ($action == "update") { + echo $text['header-contact_url-edit']; + } + else if ($action == "add") { + echo $text['header-contact_url-add']; + } + echo ""; + echo " "; + echo " \n"; + echo "
\n"; + + if ($action == "update") { + echo $text['description-contact_url-edit']; + } + else if ($action == "add") { + echo $text['description-contact_url-add']; + } + echo "

\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo " \n"; + echo " \n"; + echo " "; + echo "
\n"; + echo " ".$text['label-url_label']."\n"; + echo "\n"; + if (is_array($_SESSION["contact"]["url_label"])) { + sort($_SESSION["contact"]["url_label"]); + foreach($_SESSION["contact"]["url_label"] as $row) { + $url_label_options[] = ""; + } + $url_label_found = (in_array($url_label, $_SESSION["contact"]["url_label"])) ? true : false; + } + else { + $selected[$url_label] = "selected"; + $default_labels[] = $text['option-work']; + $default_labels[] = $text['option-personal']; + $default_labels[] = $text['option-other']; + foreach ($default_labels as $default_label) { + $url_label_options[] = ""; + } + $url_label_found = (in_array($url_label, $default_labels)) ? true : false; + } + echo " \n"; + echo " \n"; + echo " \n"; + echo "
\n"; + echo $text['description-url_label']."\n"; + echo "
\n"; + echo " ".$text['label-url_address']."\n"; + echo "\n"; + echo " \n"; + echo "
\n"; + echo $text['description-url_address']."\n"; + echo "
\n"; + echo " ".$text['label-primary']."\n"; + echo "\n"; + echo " \n"; + echo "
\n"; + echo $text['description-url_primary']."\n"; + echo "
\n"; + echo " ".$text['label-url_description']."\n"; + echo "\n"; + echo " \n"; + echo "
\n"; + echo $text['description-url_description']."\n"; + echo "
\n"; + echo "
\n"; + echo " \n"; + if ($action == "update") { + echo " \n"; + } + echo " \n"; + echo "
"; + echo "
"; + +//include the footer + require_once "resources/footer.php"; +?> \ No newline at end of file diff --git a/app/contacts/contact_urls.php b/app/contacts/contact_urls.php new file mode 100644 index 0000000000..1e1a612f3a --- /dev/null +++ b/app/contacts/contact_urls.php @@ -0,0 +1,138 @@ + + Portions created by the Initial Developer are Copyright (C) 2008-2012 + the Initial Developer. All Rights Reserved. + + Contributor(s): + Mark J Crane +*/ +require_once "root.php"; +require_once "resources/require.php"; +require_once "resources/check_auth.php"; +if (permission_exists('contact_view')) { + //access granted +} +else { + echo "access denied"; + exit; +} + +//require_once "resources/header.php"; +require_once "resources/paging.php"; + +//get variables used to control the order +// $order_by = $_GET["order_by"]; +// $order = $_GET["order"]; + +//show the content + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
".$text['label-urls']." 
\n"; + + //prepare to page the results +// $sql = " select count(*) as num_rows from v_contact_urls "; +// $sql .= " where domain_uuid = '".$_SESSION['domain_uuid']."' "; +// $sql .= " and contact_uuid = '$contact_uuid' "; +// $prep_statement = $db->prepare($sql); +// if ($prep_statement) { +// $prep_statement->execute(); +// $row = $prep_statement->fetch(PDO::FETCH_ASSOC); +// if ($row['num_rows'] > 0) { +// $num_rows = $row['num_rows']; +// } +// else { +// $num_rows = '0'; +// } +// } + + //prepare to page the results +// $rows_per_page = 10; +// $param = ""; +// $page = $_GET['page']; +// if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; } +// list($paging_controls, $rows_per_page, $var_3) = paging($num_rows, $param, $rows_per_page); +// $offset = $rows_per_page * $page; + + //get the contact list + $sql = "select * from v_contact_urls "; + $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; + $sql .= "and contact_uuid = '$contact_uuid' "; + $sql .= "order by url_primary desc, url_label asc "; +// if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; } +// $sql .= " limit $rows_per_page offset $offset "; + $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); + + $c = 0; + $row_style["0"] = "row_style0"; + $row_style["1"] = "row_style1"; + + echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + if ($result_count > 0) { + foreach($result as $row) { + $tr_link = "href='contact_url_edit.php?contact_uuid=".$row['contact_uuid']."&id=".$row['contact_url_uuid']."'"; + echo "\n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo "\n"; + if ($c==0) { $c=1; } else { $c=0; } + } //end foreach + unset($sql, $result, $row_count); + } //end if results + + echo "\n"; + echo "\n"; + echo "\n"; + + echo "
".$text['label-url_label']."".$text['label-url_address']."".$text['label-url_description'].""; + echo "$v_link_label_add"; + echo "
".$row['url_label']." ".$row['address_description']." "; + echo "$v_link_label_edit"; + echo "$v_link_label_delete"; + echo "
\n"; + echo " \n"; + echo " \n"; +// echo " \n"; +// echo " \n"; + echo " \n"; + echo " \n"; + echo "
 $paging_controls"; + echo "$v_link_label_add"; + echo "
\n"; + echo "
"; + +?> \ No newline at end of file diff --git a/app/contacts/contacts.php b/app/contacts/contacts.php index 818fcaaa2a..f5deac66ec 100644 --- a/app/contacts/contacts.php +++ b/app/contacts/contacts.php @@ -57,7 +57,7 @@ require_once "resources/paging.php"; echo "\n"; echo " \n"; echo " \n"; echo "
\n"; - echo " ".$text['header-contacts']."
\n"; + echo " ".$text['header-contacts']."
\n"; echo " ".$text['description-contacts']."

\n"; echo "
\n"; @@ -174,7 +174,6 @@ require_once "resources/paging.php"; $row_style["0"] = "row_style0"; $row_style["1"] = "row_style1"; - echo "
\n"; echo "\n"; echo "\n"; echo th_order_by('contact_type', $text['label-contact_type'], $order_by, $order); diff --git a/app/contacts/contacts_vcard.php b/app/contacts/contacts_vcard.php index 9ec26b4fb7..465b015f90 100644 --- a/app/contacts/contacts_vcard.php +++ b/app/contacts/contacts_vcard.php @@ -35,6 +35,15 @@ else { } if (count($_GET)>0) { + + //add multi-lingual support + if ($_GET['type'] == 'download' || $_GET['type'] == 'html') { + require_once "app_languages.php"; + foreach($text as $key => $value) { + $text[$key] = $value[$_SESSION['domain']['language']['code']]; + } + } + //create the vcard object require_once "resources/classes/vcard.php"; $vcard = new vcard(); @@ -43,10 +52,9 @@ if (count($_GET)>0) { $contact_uuid = $_GET["id"]; //get the contact's information - $sql = ""; - $sql .= "select * from v_contacts "; - $sql .= "where domain_uuid = '$domain_uuid' "; - $sql .= "and contact_uuid = '$contact_uuid' "; + $sql = "select * from v_contacts "; + $sql .= "where domain_uuid = '".$domain_uuid."' "; + $sql .= "and contact_uuid = '".$contact_uuid."' "; $prep_statement = $db->prepare(check_sql($sql)); $prep_statement->execute(); $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); @@ -58,8 +66,6 @@ if (count($_GET)>0) { $contact_nickname = $row["contact_nickname"]; $contact_title = $row["contact_title"]; $contact_role = $row["contact_role"]; - $contact_email = $row["contact_email"]; - $contact_url = $row["contact_url"]; $contact_time_zone = $row["contact_time_zone"]; $contact_note = $row["contact_note"]; break; //limit to 1 row @@ -69,8 +75,36 @@ if (count($_GET)>0) { $vcard->data['company'] = $contact_organization; $vcard->data['first_name'] = $contact_name_given; $vcard->data['last_name'] = $contact_name_family; - $vcard->data['email1'] = $contact_email; - $vcard->data['url'] = $contact_url; + + //get the contact's primary (and a secondary, if available) email + $sql = "select email_address from v_contact_emails "; + $sql .= "where domain_uuid = '".$domain_uuid."' "; + $sql .= "and contact_uuid = '".$contact_uuid."' "; + $sql .= "order by email_primary desc "; + $prep_statement = $db->prepare(check_sql($sql)); + $prep_statement->execute(); + $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); + $e = 0; + foreach ($result as &$row) { + $vcard->data['email'.$e] = $row["email_address"]; + if (++$e == 2) { break; } //limit to 2 rows + } + unset ($prep_statement); + + //get the contact's primary url + $sql = "select url_address from v_contact_urls "; + $sql .= "where domain_uuid = '".$domain_uuid."' "; + $sql .= "and contact_uuid = '".$contact_uuid."' "; + $sql .= "and url_primary = 1 "; + $prep_statement = $db->prepare(check_sql($sql)); + $prep_statement->execute(); + $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); + foreach ($result as &$row) { + $vcard->data['url'] = $row["url_address"]; + break; //limit to 1 row + } + unset ($prep_statement); + if ($_GET['type'] == "image" || $_GET['type'] == "html") { //don't add this to the QR code at this time @@ -85,17 +119,24 @@ if (count($_GET)>0) { } //get the contact's telephone numbers - $sql = ""; - $sql .= "select * from v_contact_phones "; - $sql .= "where domain_uuid = '$domain_uuid' "; - $sql .= "and contact_uuid = '$contact_uuid' "; + $sql = "select * from v_contact_phones "; + $sql .= "where domain_uuid = '".$domain_uuid."' "; + $sql .= "and contact_uuid = '".$contact_uuid."' "; $prep_statement = $db->prepare(check_sql($sql)); $prep_statement->execute(); $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); foreach ($result as &$row) { - $phone_type = $row["phone_type"]; + $phone_label = $row["phone_label"]; $phone_number = $row["phone_number"]; - $vcard->data[$phone_type.'_tel'] = $phone_number; + if ($phone_label == $text['option-work']) { $vcard_phone_type = 'work'; } + else if ($phone_label == $text['option-home']) { $vcard_phone_type = 'home'; } + else if ($phone_label == $text['option-mobile']) { $vcard_phone_type = 'cell'; } + else if ($phone_label == $text['option-fax']) { $vcard_phone_type = 'fax'; } + else if ($phone_label == $text['option-pager']) { $vcard_phone_type = 'pager'; } + else { $vcard_phone_type = 'voice'; } + if ($vcard_phone_type != '') { + $vcard->data[$vcard_phone_type.'_tel'] = $phone_number; + } } unset ($prep_statement); @@ -104,10 +145,9 @@ if (count($_GET)>0) { //don't add this to the QR code at this time } else { - $sql = ""; - $sql .= "select * from v_contact_addresses "; - $sql .= "where domain_uuid = '$domain_uuid' "; - $sql .= "and contact_uuid = '$contact_uuid' "; + $sql = "select * from v_contact_addresses "; + $sql .= "where domain_uuid = '".$domain_uuid."' "; + $sql .= "and contact_uuid = '".$contact_uuid."' "; $prep_statement = $db->prepare(check_sql($sql)); $prep_statement->execute(); $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); @@ -138,7 +178,7 @@ if (count($_GET)>0) { $vcard->download(); } - //show the vcard in an text qr code + //show the vcard in a text qr code if ($_GET['type'] == "text") { $vcard->build(); $content = $vcard->card; diff --git a/app/contacts/icon_gmaps.png b/app/contacts/icon_gmaps.png new file mode 100644 index 0000000000000000000000000000000000000000..d1e06b716bf85c0be0bad41573038555a952623b GIT binary patch literal 4378 zcmV+#5#{cQP))p`Hj<=wYG={-Gd zmSio~;zig7;}zSrVFFIrLTF441qy_af|JlG#F*eN2}5beX#&GgGnq-!NvDgULxU%U z7!p@tVx*xLUy7_k zk$6*}C~B(&=_@W{>zM0wGM6P8V_`t@^P!R?(M^I3?=CLt^Zs4-EJhT6qaUV7U@A2U z4j>z{B;`~|zNA4pLwmntG3(7{f5X7C;8ir!MCnp7>mmRl2KH1om-$XX*W_%DLUD8YpLrl=1FE?5CIgO7LSV{4V#q=DB!lWmFoF`M8kOdmKES-|Hcwy;(S6lyL* z+d%_epE5*sRjkeTU^Lv8EQ}`%99y12^_3m*9yzfcZhkFfbu-|OmVwfu;X)z*^5o>y zTE=G*4BIimpSdYW)Z`*y0ZA%86-}VxSqM*oPYu9fT)Wg^F6NyL&S{-S!FuG0(CSQge*hFA+s>573mi6Ss#HF>CZNhRbM12YLR4qeC z)e_W)TMEKsc1g(2U#Y8 zxU{E31}ni&!bt7@5W$)dB0Y@+c6_ZAs(TWW`a{)motDYeZV%| z(W+qC7A;~Rq($)my(V)P@#^X4a9%$Ne>jTRg#x-ivf-#QT+4z?;Q0AI9vs0$u7J+^ z1X^mUVG&@5tHX3Kw&w`s#u%7GcFe}M%82b!^G5Eb@#zb(#fgo$z2{NXgc>n8bsD?g z`##Q1AAwC0s0qx$N&(H`If865g2HhfA;~|jE{lJy<4<}X7wRaOIlOfEFTrTV+DNP zRfq(W7|EW+vv1#t9UK1>_0hSWP0BuOB1yXh;;rFdA>fa4B7n_o`Va7DEw}{670%|O zpqpgJ3TcK@0fZ^o1kNxF_zAe+497xhC4u5Y+E^?|RB*g90&<)Iu zh0szRCEJIfJ~B-#nNy1(=ULMf;~WCYawH^!i31aD*2ol%%0_o&v`^3qrzM*PJH!Co zMs0^0J@fwRa3emQ+K>I`ep3O|PxF@4ZbaV5&_?9NG{;h043pp;T?ey>Q3yzYDC>?z ztytDni@EVAzS`4*jcs)>=@2eCFCS;~AX8UOf;ENtSeC`l0e@+;(cCZ;q7wm*B*L4J zsF08?`ng(z!5H?Q{WbMhMy>9|GV)Z3XwwpNnQ7sRUKLY*9g@yLSTIS&F|vuTwNb+o;_2CxirY@p|Xk7hH zQSHoAy(NC9cd(E)FIK4Dp)mz3C&uuWp|zIB>u^uk0(5?NDVzv-IGKQBJDwf$J0(8+ zZs&Cr8k3MnnofZnlBDk1{GBD9D}XLYu7qiM_Q@Br?IK|D?1;M~Y}XdgoDF7Q7tt5%WT#`&d8!M z)JZ(pU7q*iyMK+7>0`K|r5z8q&x2Z&Byo-hlsC(OHm3t}JvobR3Sn4uH#;a(3TX6N zC(3isP#s1MshbHtwgf%OKmGmRQ~<3G*5I)rl5|AQ$tleX=9Fnt2{LgqhUrs2qD=>CB#5b_ zpOf8^ZMG!gcDKMsAloP!@oY*2l41f6;jm0s+HVbSd*j%i;LzB4T+wtjqQR&D+g#m& zYddbE(@-*-pAr&H`sZNt!mW5@^^Zkh*!Eu!;GaJD8UAc>7k2a(LGrAgZ$eFyJdoqZ zsxWm*qx{zq5>mqfWQHz69~y(Pv=bUdqIPPbfGV`dDnatKbZN~C$w|XB;uj|~sL>j5 zOYdFS)O#zs8x|5R)RY~?q+}!FuY#s}5%=$2--e$Y`UgC6br+uMCGRExjFlpcaGyM@`ULWmSt(#F~;;K9`&%$Z>AO zxqKGW88TctNHSDUEI?`@?|$H#KgZo`9xR(ix{$`&=ezK=PCuSrGM}nRhGI$Q#Sr>o zvWC%5l1PzFDjF+ANDly|d45T;}! z=yyftWLOgzDqIAQWIc@wD;%ysg#3-R1b(z6En@b^43HZ@gGp_<@Z8U)& zEWa1ZLi=P~swI(Y!PVvk*XfBtnUB2*$K3e2h|CYDDJqn}|ovvNj}X zM&)ivqMrUqYc?whp*Wn0!Lq2`Wul@i#?qsxi#3#i@^^u`-$Ooo8bRX#sWx7esykEn zyPT=XOcfi+_8bze8nP21qz1#tUi4E0qCH5$o|G{o(Gp;RL@K{iYBvP7QJoU>9F?JT z=M>?RYo~IQWatiVxZ;)ysY+CWDDi7ipbSbWdqQP=lQ8WeTSRhzrZ}ZZXHhQS^Gw9^~~(a=o^V-UWGrK`B3F=y`FMm;z0r0*nfP zqn{te;<_%hUuLVa;)j~tM2U!u|2e}D4;IMIQ#6-o$&t!5g%Sua*@dc_2q$xh&&?xH zV~JN*mNF{?GjrGsU|#MCXUbDiN9K<1`d+MRUyo&NYcQ{_2Tk!70u!M+$VHeJWB^lr{6=nat4e1c{&W4 zf*L^}-izv%4N$f4mq71%e;nWadEv3y~-oG0^fAb~0bLIfPI@iE6 zi&R9&@W_lP&Qs}XG5D$%qyC!bQPsHaOJH}tdI~S@9f#(R3YB*x&f|vme%#o02%S|! zp52j@-Puwu(~uV^cr@eGP{;%@H5fvAI50$Z%1+aWuA%WEJpAIf@%qs>;81Dv&{ZM) z<5G%5d|h~-VYuliFff<_9@+OGR6sX$EdE)l40_=?(;sRNwc`Pc;__6^E}51oaR8^9UL24edFI=j}v1j z5sE9gzc-4Vi^CMV8E2T{=Rpbya6^nQu_NQO>ol_~7?)DBQoJ48}GjJD{A#}xF=72>=sc<{W&uO3u(?AWpK zo}HT)A3WEONYaM~7DfnUkWw{Ad>rsRmVc4fF~O?vP~SEj7`l=qWFZ_1;{8+O7`QNw zTh?}X-&2KDb^Nw}3>w9Ht_HVAH9jg!WlB`W(sA^Cu^4;KuEfdd7KAhdO|c0QM2^^^ zOsHjgf}*^wTz|*)^*jFUsT%_%$p;pOv9p(Av+0NrSl(drS=qq26UVpqJ%NKmOAt}B zVm|*^8x98X!O0P z`-ZPT-U*^UN}AvlM+V0!&Wri-F6DUm#KpnP`3D}pGUDHPh2I0|vKdJ#I!5gT?*GGf z^q=n~56;c-8}rN}PXVE&M#Ud3Z4y97F6FShZwLwjE%71TS-i-+wWX4j>3%*{gSXBu z#cO9);7n=`qJaXMq7&rtg)~L4M^!s>aA@1|$O}&|(whmVx)lNt*rPpMF#d5;GMk&s{B(B9Y_Hs?1B~Dit4D#WEV{TqDPs%7pPRA8f=c zpRB=>IcM>wi{5#myJloaJ$z>^c^{r(X=^=USnC-wsYf+1Y*0=9`|UV7I-fvhDH|$( zm9I=hDBOmrKr3Bm&!?dqHo^pyeTl%NS$PF24=h3ht))<+LJ9lfb6xxU2fCl}DHP2d zo{&3?A}+p3!*|nf>o~{(qaJs^`2;>4>+(Q4n8kOqgd{Pcy5$RM%l*GS@CDhmB8s!w zKrV;JfC|v8;snk+0hMi*6gkKHqkVEX8uMcQbtxOQQ~n){KbnAg-Dm^eunz?)0@5IpaYj1%>N2706C({ U{R7<11^@s607*qoM6N<$f}Z(59{>OV literal 0 HcmV?d00001 diff --git a/app/fax/fax_send.php b/app/fax/fax_send.php index 1f3c1322a0..3effa75b56 100644 --- a/app/fax/fax_send.php +++ b/app/fax/fax_send.php @@ -703,7 +703,7 @@ else { $sql .= "c.contact_uuid = cp.contact_uuid and "; $sql .= "c.domain_uuid = '".$_SESSION['domain_uuid']."' and "; $sql .= "cp.domain_uuid = '".$_SESSION['domain_uuid']."' and "; - $sql .= "cp.phone_type = 'fax' and "; + $sql .= "cp.phone_type_fax = 1 and "; $sql .= "cp.phone_number is not null and "; $sql .= "cp.phone_number <> '' "; if (sizeof($user_group_uuids) > 0) { diff --git a/resources/classes/vcard.php b/resources/classes/vcard.php index 95dfb3ddcd..34285d47d0 100644 --- a/resources/classes/vcard.php +++ b/resources/classes/vcard.php @@ -106,68 +106,41 @@ class vcard { if ($this->data['department']) { $this->card .= ";".$this->data['department']; } $this->card .= "\r\n"; - if ($this->data['work_po_box'] - || $this->data['work_extended_address'] - || $this->data['work_address'] - || $this->data['work_city'] - || $this->data['work_state'] - || $this->data['work_postal_code'] - || $this->data['work_country']) { - $this->card .= "ADR;TYPE=work:"; - if (strlen($this->data['work_po_box']) > 0) { - $this->card .= $this->data['work_po_box'].";"; + $vcard_address_type_values = array('work','home','dom','intl','postal','parcel','pref'); + foreach ($vcard_address_type_values as $vcard_address_type_value) { + if ($this->data[$vcard_address_type_value.'_po_box'] + || $this->data[$vcard_address_type_value.'_extended_address'] + || $this->data[$vcard_address_type_value.'_address'] + || $this->data[$vcard_address_type_value.'_city'] + || $this->data[$vcard_address_type_value.'_state'] + || $this->data[$vcard_address_type_value.'_postal_code'] + || $this->data[$vcard_address_type_value.'_country']) { + $this->card .= "ADR;TYPE=".$vcard_address_type_value.":"; + if (strlen($this->data[$vcard_address_type_value.'_po_box']) > 0) { + $this->card .= $this->data[$vcard_address_type_value.'_po_box'].";"; + } + if (strlen($this->data[$vcard_address_type_value.'_extended_address']) > 0) { + $this->card .= $this->data[$vcard_address_type_value.'_extended_address'].";"; + } + if (strlen($this->data[$vcard_address_type_value.'_address']) > 0) { + $this->card .= $this->data[$vcard_address_type_value.'_address'].";"; + } + if (strlen($this->data[$vcard_address_type_value.'_city']) > 0) { + $this->card .= $this->data[$vcard_address_type_value.'_city'].";"; + } + if (strlen($this->data[$vcard_address_type_value.'_state']) > 0) { + $this->card .= $this->data[$vcard_address_type_value.'_state'].";"; + } + if (strlen($this->data[$vcard_address_type_value.'_postal_code']) > 0) { + $this->card .= $this->data[$vcard_address_type_value.'_postal_code'].";"; + } + if (strlen($this->data[$vcard_address_type_value.'_country']) > 0) { + $this->card .= $this->data[$vcard_address_type_value.'_country'].""; + } + $this->card .= "\r\n"; } - if (strlen($this->data['work_extended_address']) > 0) { - $this->card .= $this->data['work_extended_address'].";"; - } - if (strlen($this->data['work_address']) > 0) { - $this->card .= $this->data['work_address'].";"; - } - if (strlen($this->data['work_city']) > 0) { - $this->card .= $this->data['work_city'].";"; - } - if (strlen($this->data['work_state']) > 0) { - $this->card .= $this->data['work_state'].";"; - } - if (strlen($this->data['work_postal_code']) > 0) { - $this->card .= $this->data['work_postal_code'].";"; - } - if (strlen($this->data['work_country']) > 0) { - $this->card .= $this->data['work_country'].""; - } - $this->card .= "\r\n"; - } - if ($this->data['home_po_box'] - || $this->data['home_extended_address'] - || $this->data['home_address'] - || $this->data['home_city'] - || $this->data['home_state'] - || $this->data['home_postal_code'] - || $this->data['home_country']) { - $this->card .= "ADR;TYPE=home:"; - if (strlen($this->data['home_po_box']) > 0) { - $this->card .= $this->data['home_po_box'].";"; - } - if (strlen($this->data['home_extended_address']) > 0) { - $this->card .= $this->data['home_extended_address'].";"; - } - if (strlen($this->data['home_address']) > 0) { - $this->card .= $this->data['home_address'].";"; - } - if (strlen($this->data['home_city']) > 0) { - $this->card .= $this->data['home_city'].";"; - } - if (strlen($this->data['home_state']) > 0) { - $this->card .= $this->data['home_state'].";"; - } - if (strlen($this->data['home_postal_code']) > 0) { - $this->card .= $this->data['home_postal_code'].";"; - } - if (strlen($this->data['home_country']) > 0) { - $this->card .= $this->data['home_country']; - } - $this->card .= "\r\n"; } + if ($this->data['email1']) { $this->card .= "EMAIL;PREF=1:".$this->data['email1']."\r\n"; } if ($this->data['email2']) { $this->card .= "EMAIL;PREF=2:".$this->data['email2']."\r\n"; } if ($this->data['voice_tel']) { $this->card .= "TEL;TYPE=voice:".$this->data['voice_tel']."\r\n"; }