From 483b92c9f31c56a42f46178d232764eae310b121 Mon Sep 17 00:00:00 2001 From: Nate Jones Date: Tue, 25 Nov 2014 18:38:22 +0000 Subject: [PATCH] Contacts: Language corrections and additions, curl and setting check (for Google import), remove groups on contact delete, added additional options for Google Contact import (select fields, set contact type, category and shared state). --- app/contacts/app_languages.php | 158 +++++++++++++++++++------ app/contacts/contact_delete.php | 39 +++--- app/contacts/contact_edit.php | 110 +++-------------- app/contacts/contact_import.php | 4 +- app/contacts/contact_import_google.php | 146 ++++++++++++++++++----- 5 files changed, 279 insertions(+), 178 deletions(-) diff --git a/app/contacts/app_languages.php b/app/contacts/app_languages.php index 65a9c9a78f..d6cd0d331b 100644 --- a/app/contacts/app_languages.php +++ b/app/contacts/app_languages.php @@ -67,10 +67,70 @@ $text['label-contact_type']['pt-pt'] = "Tipo"; $text['label-contact_type']['fr-fr'] = "Type"; - $text['description-contact_type']['en-us'] = "Select the contact type."; - $text['description-contact_type']['es-cl'] = "Seleccione el tipo de contacto."; - $text['description-contact_type']['pt-pt'] = "Seleccionar o tipo de contacto."; - $text['description-contact_type']['fr-fr'] = "Choisir le type de contact."; + $text['option-contact_type_customer']['en-us'] = "Customer"; + $text['option-contact_type_customer']['es-cl'] = "Cliente"; + $text['option-contact_type_customer']['pt-pt'] = "Cliente"; + $text['option-contact_type_customer']['fr-fr'] = "Client"; + + $text['option-contact_type_contractor']['en-us'] = "Contractor"; + $text['option-contact_type_contractor']['es-cl'] = "Contratista"; + $text['option-contact_type_contractor']['pt-pt'] = "Contratante"; + $text['option-contact_type_contractor']['fr-fr'] = "Entrepreneur"; + + $text['option-contact_type_friend']['en-us'] = "Friend"; + $text['option-contact_type_friend']['es-cl'] = "Amigo"; + $text['option-contact_type_friend']['pt-pt'] = "Amigo"; + $text['option-contact_type_friend']['fr-fr'] = "Ami"; + + $text['option-contact_type_lead']['en-us'] = "Lead"; + $text['option-contact_type_lead']['es-cl'] = "Supervisor"; + $text['option-contact_type_lead']['pt-pt'] = "Supervisor"; + $text['option-contact_type_lead']['fr-fr'] = "Superviseur"; + + $text['option-contact_type_member']['en-us'] = "Member"; + $text['option-contact_type_member']['es-cl'] = "Miembro"; + $text['option-contact_type_member']['pt-pt'] = "Membro"; + $text['option-contact_type_member']['fr-fr'] = "Membre"; + + $text['option-contact_type_family']['en-us'] = "Family"; + $text['option-contact_type_family']['es-cl'] = "Familia"; + $text['option-contact_type_family']['pt-pt'] = "Família"; + $text['option-contact_type_family']['fr-fr'] = "Famille"; + + $text['option-contact_type_subscriber']['en-us'] = "Subscriber"; + $text['option-contact_type_subscriber']['es-cl'] = "Suscriptor"; + $text['option-contact_type_subscriber']['pt-pt'] = "Assinante"; + $text['option-contact_type_subscriber']['fr-fr'] = "Abonné"; + + $text['option-contact_type_supplier']['en-us'] = "Supplier"; + $text['option-contact_type_supplier']['es-cl'] = "Proveedor"; + $text['option-contact_type_supplier']['pt-pt'] = "Fornecedor"; + $text['option-contact_type_supplier']['fr-fr'] = "Fournisseur"; + + $text['option-contact_type_provider']['en-us'] = "Provider"; + $text['option-contact_type_provider']['es-cl'] = "Proveedor"; + $text['option-contact_type_provider']['pt-pt'] = "Provedor"; + $text['option-contact_type_provider']['fr-fr'] = "Fournisseur"; + + $text['option-contact_type_user']['en-us'] = "User"; + $text['option-contact_type_user']['es-cl'] = "Usuario"; + $text['option-contact_type_user']['pt-pt'] = "Usuário"; + $text['option-contact_type_user']['fr-fr'] = "Utilisateur"; + + $text['option-contact_type_volunteer']['en-us'] = "Volunteer"; + $text['option-contact_type_volunteer']['es-cl'] = "Voluntario"; + $text['option-contact_type_volunteer']['pt-pt'] = "Voluntário"; + $text['option-contact_type_volunteer']['fr-fr'] = "Bénévole"; + + $text['description-contact_type']['en-us'] = "Set the contact type."; + $text['description-contact_type']['es-cl'] = "Establecer el tipo de contacto."; + $text['description-contact_type']['pt-pt'] = "Defina o tipo de contato."; + $text['description-contact_type']['fr-fr'] = "Définissez le type de contact."; + + $text['description-contact_type_import']['en-us'] = "Set a type for the contacts."; + $text['description-contact_type_import']['es-cl'] = "Definición de un tipo de los contactos."; + $text['description-contact_type_import']['pt-pt'] = "Definir um tipo para os contatos."; + $text['description-contact_type_import']['fr-fr'] = "Définir un type pour les contacts."; $text['label-contact_organization']['en-us'] = "Organization"; $text['label-contact_organization']['es-cl'] = "Organización"; @@ -80,7 +140,7 @@ $text['description-contact_organization']['en-us'] = "Enter the organization."; $text['description-contact_organization']['es-cl'] = "Ingrese la organización."; $text['description-contact_organization']['pt-pt'] = "Introduzir a organização."; - $text['description-contact_organization']['fr-fr'] = ""; + $text['description-contact_organization']['fr-fr'] = "Entrez l'organisation."; $text['label-contact_name']['en-us'] = "Name"; $text['label-contact_name']['es-cl'] = "Nombre"; @@ -105,7 +165,7 @@ $text['description-contact_name_given']['en-us'] = "Enter the given name."; $text['description-contact_name_given']['es-cl'] = "Ingrese el nombre dado."; $text['description-contact_name_given']['pt-pt'] = "Introduzir o nome"; - $text['description-contact_name_given']['fr-fr'] = ""; + $text['description-contact_name_given']['fr-fr'] = "Entrez le nom donné."; $text['label-contact_name_middle']['en-us'] = "Middle"; $text['label-contact_name_middle']['es-cl'] = "Segundo Nombre"; @@ -125,7 +185,7 @@ $text['description-contact_name_family']['en-us'] = "Enter the family name."; $text['description-contact_name_family']['es-cl'] = "Ingrese el apellido."; $text['description-contact_name_family']['pt-pt'] = "Introduzir o nome de família"; - $text['description-contact_name_family']['fr-fr'] = ""; + $text['description-contact_name_family']['fr-fr'] = "Entrez le nom de famille."; $text['label-contact_name_suffix']['en-us'] = "Suffix"; $text['label-contact_name_suffix']['es-cl'] = "Sufijo"; @@ -133,9 +193,9 @@ $text['label-contact_name_suffix']['fr-fr'] = "Suffixe"; $text['description-contact_name_suffix']['en-us'] = "Enter the name suffix."; - $text['description-contact_name_suffix']['es-cl'] = ""; - $text['description-contact_name_suffix']['pt-pt'] = ""; - $text['description-contact_name_suffix']['fr-fr'] = ""; + $text['description-contact_name_suffix']['es-cl'] = "Introduzca el nombre del sufijo."; + $text['description-contact_name_suffix']['pt-pt'] = "Digite o nome do sufixo."; + $text['description-contact_name_suffix']['fr-fr'] = "Entrez le suffixe de nom."; $text['label-contact_nickname']['en-us'] = "Nickname"; $text['label-contact_nickname']['es-cl'] = "Apodo"; @@ -145,7 +205,7 @@ $text['description-contact_nickname']['en-us'] = "Enter the nickname."; $text['description-contact_nickname']['es-cl'] = "Ingrese un apodo."; $text['description-contact_nickname']['pt-pt'] = "Introduza o nickname."; - $text['description-contact_nickname']['fr-fr'] = ""; + $text['description-contact_nickname']['fr-fr'] = "Entrez le surnom."; $text['label-contact_title']['en-us'] = "Title"; $text['label-contact_title']['es-cl'] = "Título"; @@ -155,17 +215,22 @@ $text['description-contact_title']['en-us'] = "Enter the title."; $text['description-contact_title']['es-cl'] = "Ingrese el título."; $text['description-contact_title']['pt-pt'] = "Introduza o título."; - $text['description-contact_title']['fr-fr'] = ""; + $text['description-contact_title']['fr-fr'] = "Entrez le titre."; $text['label-contact_category']['en-us'] = "Category"; $text['label-contact_category']['es-cl'] = "Categoría"; $text['label-contact_category']['pt-pt'] = "Categoria"; $text['label-contact_category']['fr-fr'] = "Catégorie"; - $text['description-contact_category']['en-us'] = "Enter the category."; - $text['description-contact_category']['es-cl'] = "Ingrese la categoría."; - $text['description-contact_category']['pt-pt'] = "Introduza a categoria."; - $text['description-contact_category']['fr-fr'] = "Entrez la catégorie."; + $text['description-contact_category']['en-us'] = "Set the contact category."; + $text['description-contact_category']['es-cl'] = "Establezca la categoría de contactos."; + $text['description-contact_category']['pt-pt'] = "Defina a categoria de contato."; + $text['description-contact_category']['fr-fr'] = "Définissez la catégorie de contacts."; + + $text['description-contact_category_import']['en-us'] = "Set a category for the contacts."; + $text['description-contact_category_import']['es-cl'] = "Establezca una categoría para los contactos."; + $text['description-contact_category_import']['pt-pt'] = "Definir uma categoria para os contatos."; + $text['description-contact_category_import']['fr-fr'] = "Définir une catégorie pour les contacts."; $text['label-contact_role']['en-us'] = "Role"; $text['label-contact_role']['es-cl'] = "Rol"; @@ -185,7 +250,7 @@ $text['description-contact_email']['en-us'] = "Enter the email address."; $text['description-contact_email']['es-cl'] = "Ingrese la dirección de correo electrónico."; $text['description-contact_email']['pt-pt'] = "Introduza o endereço de email."; - $text['description-contact_email']['fr-fr'] = ""; + $text['description-contact_email']['fr-fr'] = "Entrez l'adresse e-mail."; $text['label-contact_url']['en-us'] = "URL"; $text['label-contact_url']['es-cl'] = "URL"; @@ -205,7 +270,7 @@ $text['description-contact_time_zone']['en-us'] = "Enter the time zone."; $text['description-contact_time_zone']['es-cl'] = "Ingrese la zona horaria."; $text['description-contact_time_zone']['pt-pt'] = "Introduza o time zone."; - $text['description-contact_time_zone']['fr-fr'] = ""; + $text['description-contact_time_zone']['fr-fr'] = "Entrez le fuseau horaire."; $text['label-contact_note']['en-us'] = "Note"; $text['label-contact_note']['es-cl'] = "Notas"; @@ -215,7 +280,7 @@ $text['description-contact_note']['en-us'] = "Enter a note."; $text['description-contact_note']['es-cl'] = "Ingrese una nota."; $text['description-contact_note']['pt-pt'] = "Introduza uma nota."; - $text['description-contact_note']['fr-fr'] = ""; + $text['description-contact_note']['fr-fr'] = "Entrez une note."; $text['label-true']['en-us'] = "True"; $text['label-true']['es-cl'] = "Verdadero"; @@ -233,9 +298,9 @@ $text['label-order']['fr-fr'] = "Ordre"; $text['description-order']['en-us'] = "Set the order (index) for this array element."; - $text['description-order']['es-cl'] = "Establecer el orden (ndice) para este elemento de la matriz."; - $text['description-order']['pt-pt'] = "Defina a ordem (ndice) para este elemento da matriz."; - $text['description-order']['fr-fr'] = "Dfinir l'ordre (index) pour cet lment de tableau."; + $text['description-order']['es-cl'] = "Establecer el orden (índice) para este elemento de la matriz."; + $text['description-order']['pt-pt'] = "Defina a ordem (índice) para este elemento da matriz."; + $text['description-order']['fr-fr'] = "Définissez l'ordre (index) pour cet élément de tableau."; $text['label-shared']['en-us'] = "Shared"; $text['label-shared']['es-cl'] = "Compartido"; @@ -247,6 +312,11 @@ $text['description-shared']['pt-pt'] = "Compartilhe esse contato com outros usuários do domínio."; $text['description-shared']['fr-fr'] = "Partager ce contact avec d'autres utilisateurs sur le domaine."; + $text['description-shared_import']['en-us'] = "Share contacts with other users on the domain."; + $text['description-shared_import']['es-cl'] = "Comparte estos contactos con otros usuarios en el dominio."; + $text['description-shared_import']['pt-pt'] = "Compartilhe estes contatos com outros usuários do domínio."; + $text['description-shared_import']['fr-fr'] = "Partager ces contacts avec d'autres utilisateurs sur le domaine."; + $text['option-true']['en-us'] = "True"; $text['option-true']['es-cl'] = "Verdadero"; $text['option-true']['pt-pt'] = "Sim"; @@ -321,7 +391,7 @@ $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['description-phone_type']['fr-fr'] = "Définir le type ou le but numéro."; $text['label-phone_label']['en-us'] = "Label"; $text['label-phone_label']['es-cl'] = "Etiqueta"; @@ -341,7 +411,7 @@ $text['description-phone_number']['en-us'] = "Enter the phone number."; $text['description-phone_number']['es-cl'] = "Ingrese el número de teléfono."; $text['description-phone_number']['pt-pt'] = "Introduza o número de telefone"; - $text['description-phone_number']['fr-fr'] = ""; + $text['description-phone_number']['fr-fr'] = "Entrez le numéro de téléphone."; $text['label-phone_extension']['en-us'] = "Extension"; $text['label-phone_extension']['es-cl'] = "Extensión"; @@ -351,7 +421,7 @@ $text['description-phone_extension']['en-us'] = "Enter the extension."; $text['description-phone_extension']['es-cl'] = "Ingrese la extensión."; $text['description-phone_extension']['pt-pt'] = "Introduza a extensão"; - $text['description-phone_extension']['fr-fr'] = ""; + $text['description-phone_extension']['fr-fr'] = "Entrez l'extension."; $text['label-phone_description']['en-us'] = "Description"; $text['label-phone_description']['es-cl'] = "Descripción"; @@ -361,7 +431,7 @@ $text['description-phone_description']['en-us'] = "Enter the description."; $text['description-phone_description']['es-cl'] = "Ingrese una descripción."; $text['description-phone_description']['pt-pt'] = "Introduza a descrição"; - $text['description-phone_description']['fr-fr'] = ""; + $text['description-phone_description']['fr-fr'] = "Entrez la description."; $text['label-phone_tools']['en-us'] = "Tools"; $text['label-phone_tools']['es-cl'] = "Herramientas"; @@ -512,7 +582,7 @@ $text['description-address_locality']['en-us'] = "Enter the city."; $text['description-address_locality']['es-cl'] = "Ingrese la ciudad"; $text['description-address_locality']['pt-pt'] = "Introduza a cidade."; - $text['description-address_locality']['fr-fr'] = ""; + $text['description-address_locality']['fr-fr'] = "Entrez dans la ville."; $text['label-address_region']['en-us'] = "Region"; $text['label-address_region']['es-cl'] = "Región"; @@ -522,7 +592,7 @@ $text['description-address_region']['en-us'] = "Enter the state or province."; $text['description-address_region']['es-cl'] = "Ingrese el estado o provincia."; $text['description-address_region']['pt-pt'] = "Introduza o estado ou província."; - $text['description-address_region']['fr-fr'] = ""; + $text['description-address_region']['fr-fr'] = "Entrez l'état ou province."; $text['label-address_postal_code']['en-us'] = "Postal Code"; $text['label-address_postal_code']['es-cl'] = "Código Postal"; @@ -532,7 +602,7 @@ $text['description-address_postal_code']['en-us'] = "Enter the postal code."; $text['description-address_postal_code']['es-cl'] = "Ingrese el código postal."; $text['description-address_postal_code']['pt-pt'] = "Introduza o código postal."; - $text['description-address_postal_code']['fr-fr'] = ""; + $text['description-address_postal_code']['fr-fr'] = "Entrez le code postal."; $text['label-address_country']['en-us'] = "Country"; $text['label-address_country']['es-cl'] = "País"; @@ -542,7 +612,7 @@ $text['description-address_country']['en-us'] = "Enter the country."; $text['description-address_country']['es-cl'] = "Ingrese el país."; $text['description-address_country']['pt-pt'] = "Introduza o país."; - $text['description-address_country']['fr-fr'] = ""; + $text['description-address_country']['fr-fr'] = "Entrez le pays."; $text['label-address_latitude']['en-us'] = "Latitude"; $text['label-address_latitude']['es-cl'] = "Latitud"; @@ -572,7 +642,7 @@ $text['description-address_description']['en-us'] = "Enter a description."; $text['description-address_description']['es-cl'] = "Ingrese una descripción"; $text['description-address_description']['pt-pt'] = "Introduza uma descrição."; - $text['description-address_description']['fr-fr'] = ""; + $text['description-address_description']['fr-fr'] = "Entrez une description."; $text['label-address_tools']['en-us'] = "Tools"; $text['label-address_tools']['es-cl'] = "Herramientas"; @@ -760,8 +830,8 @@ $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'] = ""; + $text['description-contact_notes-add']['pt-pt'] = "Digite a nota desejada abaixo."; + $text['description-contact_notes-add']['fr-fr'] = "Entrez ci-dessous la note désirée."; $text['title-contact_notes-edit']['en-us'] = "Contact Note Edit"; $text['title-contact_notes-edit']['es-cl'] = "Editar Nota de Contactos"; @@ -775,8 +845,8 @@ $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']['pt-pt'] = "Digite a nota desejada abaixo."; + $text['description-contact_notes-edit']['fr-fr'] = "Entrez ci-dessous la note désirée."; $text['label-contact_notes']['en-us'] = "Notes"; $text['label-contact_notes']['es-cl'] = "Notas"; @@ -877,7 +947,7 @@ $text['description-contact_setting_value']['en-us'] = "Enter the value of this setting."; $text['description-contact_setting_value']['es-cl'] = "Ingrese el valor para esta configuración."; $text['description-contact_setting_value']['pt-pt'] = "Introduza o valor desta definição."; - $text['description-contact_setting_value']['fr-fr'] = ""; + $text['description-contact_setting_value']['fr-fr'] = "Entrez la valeur de ce paramètre."; // contact import $text['title-contacts_import']['en-us'] = "Import Contacts"; @@ -960,6 +1030,16 @@ $text['label-contacts_import_google_account']['pt-pt'] = "Conta"; $text['label-contacts_import_google_account']['fr-fr'] = "Compte"; + $text['label-import_fields']['en-us'] = "Fields"; + $text['label-import_fields']['es-cl'] = "Campos"; + $text['label-import_fields']['pt-pt'] = "Campos"; + $text['label-import_fields']['fr-fr'] = "Les Champs"; + + $text['description-import_fields']['en-us'] = "Select contact data fields to import."; + $text['description-import_fields']['es-cl'] = "Seleccionar campos de datos de contactos para importar."; + $text['description-import_fields']['pt-pt'] = "Selecione os campos de dados de contacto para importar."; + $text['description-import_fields']['fr-fr'] = "Sélectionner les champs de données de contact à importer."; + $text['label-group']['en-us'] = "Group"; $text['label-group']['es-cl'] = "Grupo"; $text['label-group']['pt-pt'] = "Grupo"; @@ -981,9 +1061,9 @@ $text['message-google_signed_out']['fr-fr'] = "Compte Google: Déconnecté"; $text['message-contacts_imported']['en-us'] = "Contacts Imported: "; - $text['message-contacts_imported']['es-cl'] = ""; - $text['message-contacts_imported']['pt-pt'] = ""; - $text['message-contacts_imported']['fr-fr'] = ""; + $text['message-contacts_imported']['es-cl'] = "Contactos Importados: "; + $text['message-contacts_imported']['pt-pt'] = "Contatos Importados: "; + $text['message-contacts_imported']['fr-fr'] = "Contacts Importés: "; // general labels $text['label-primary']['en-us'] = "Primary"; diff --git a/app/contacts/contact_delete.php b/app/contacts/contact_delete.php index fff037f6ff..b013d2ec97 100644 --- a/app/contacts/contact_delete.php +++ b/app/contacts/contact_delete.php @@ -41,59 +41,62 @@ else { } if (count($_GET)>0) { - $id = check_str($_GET["id"]); + $contact_uuid = check_str($_GET["id"]); } -if (strlen($id)>0) { +if (strlen($contact_uuid)>0) { //delete addresses $sql = "delete from v_contact_addresses "; $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; - $sql .= "and contact_uuid = '$id' "; + $sql .= "and contact_uuid = '".$contact_uuid."' "; $prep_statement = $db->prepare(check_sql($sql)); $prep_statement->execute(); unset($prep_statement, $sql); //delete phones - $sql = ""; - $sql .= "delete from v_contact_phones "; + $sql = "delete from v_contact_phones "; $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; - $sql .= "and contact_uuid = '$id' "; + $sql .= "and contact_uuid = '".$contact_uuid."' "; $prep_statement = $db->prepare(check_sql($sql)); $prep_statement->execute(); unset($prep_statement, $sql); //delete emails - $sql = ""; - $sql .= "delete from v_contact_emails "; + $sql = "delete from v_contact_emails "; $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; - $sql .= "and contact_uuid = '$id' "; + $sql .= "and contact_uuid = '".$contact_uuid."' "; $prep_statement = $db->prepare(check_sql($sql)); $prep_statement->execute(); unset($prep_statement, $sql); //delete urls - $sql = ""; - $sql .= "delete from v_contact_urls "; + $sql = "delete from v_contact_urls "; $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; - $sql .= "and contact_uuid = '$id' "; + $sql .= "and contact_uuid = '".$contact_uuid."' "; $prep_statement = $db->prepare(check_sql($sql)); $prep_statement->execute(); unset($prep_statement, $sql); //delete notes - $sql = ""; - $sql .= "delete from v_contact_notes "; + $sql = "delete from v_contact_notes "; $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; - $sql .= "and contact_uuid = '$id' "; + $sql .= "and contact_uuid = '".$contact_uuid."' "; $prep_statement = $db->prepare(check_sql($sql)); $prep_statement->execute(); unset($prep_statement, $sql); //delete settings - $sql = ""; $sql = "delete from v_contact_settings "; $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; - $sql .= "and contact_uuid = '$id' "; + $sql .= "and contact_uuid = '".$contact_uuid."' "; + $prep_statement = $db->prepare(check_sql($sql)); + $prep_statement->execute(); + unset($prep_statement, $sql); + + //delete groups + $sql = "delete from v_contact_groups "; + $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; + $sql .= "and contact_uuid = '".$contact_uuid."' "; $prep_statement = $db->prepare(check_sql($sql)); $prep_statement->execute(); unset($prep_statement, $sql); @@ -101,7 +104,7 @@ if (strlen($id)>0) { //delete a contact $sql = "delete from v_contacts "; $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; - $sql .= "and contact_uuid = '$id' "; + $sql .= "and contact_uuid = '".$contact_uuid."' "; $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 a4381dee93..5a3aa720e4 100644 --- a/app/contacts/contact_edit.php +++ b/app/contacts/contact_edit.php @@ -376,87 +376,26 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { if (is_array($_SESSION["contact"]["type"])) { sort($_SESSION["contact"]["type"]); echo " \n"; } else { echo " \n"; } echo "
\n"; @@ -551,12 +490,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo " \n"; } @@ -578,12 +512,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo " \n"; } @@ -605,12 +534,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo " \n"; } diff --git a/app/contacts/contact_import.php b/app/contacts/contact_import.php index 13db5a6888..0dd85f757e 100644 --- a/app/contacts/contact_import.php +++ b/app/contacts/contact_import.php @@ -432,7 +432,9 @@ else { echo " \n"; echo " \n"; - echo " ".$text['header-contacts_import_google']."\n"; + if (function_exists('curl_version') && $_SESSION['contact']['google_oauth_client_id']['text'] != '' && $_SESSION['contact']['google_oauth_client_secret']['text'] != '') { + echo " ".$text['header-contacts_import_google']."\n"; + } echo " \n"; echo " \n"; echo "
\n"; diff --git a/app/contacts/contact_import_google.php b/app/contacts/contact_import_google.php index 492b744fda..cab1d8928c 100644 --- a/app/contacts/contact_import_google.php +++ b/app/contacts/contact_import_google.php @@ -80,6 +80,7 @@ if ($_POST['a'] == 'import') { $sql .= "( "; $sql .= "domain_uuid, "; $sql .= "contact_uuid, "; + $sql .= "contact_type, "; $sql .= "contact_organization, "; $sql .= "contact_name_prefix, "; $sql .= "contact_name_given, "; @@ -88,12 +89,14 @@ if ($_POST['a'] == 'import') { $sql .= "contact_name_suffix, "; $sql .= "contact_nickname, "; $sql .= "contact_title, "; + $sql .= "contact_category, "; $sql .= "contact_note "; $sql .= ") "; $sql .= "values "; $sql .= "( "; $sql .= "'".$_SESSION['domain_uuid']."', "; $sql .= "'".$contact_uuid."', "; + $sql .= "'".check_str($_POST['import_type'])."', "; $sql .= "'".check_str($contact['organization'])."', "; $sql .= "'".check_str($contact['name_prefix'])."', "; $sql .= "'".check_str($contact['name_given'])."', "; @@ -102,33 +105,34 @@ if ($_POST['a'] == 'import') { $sql .= "'".check_str($contact['name_suffix'])."', "; $sql .= "'".check_str($contact['nickname'])."', "; $sql .= "'".check_str($contact['title'])."', "; + $sql .= "'".check_str($_POST['import_category'])."', "; $sql .= "'".check_str($contact['notes'])."' "; $sql .= ")"; - //echo $sql."

"; $db->exec(check_sql($sql)); unset($sql); - //make contact private - $sql = "insert into v_contact_groups "; - $sql .= "( "; - $sql .= "contact_group_uuid, "; - $sql .= "domain_uuid, "; - $sql .= "contact_uuid, "; - $sql .= "group_uuid "; - $sql .= ") "; - $sql .= "values "; - $sql .= "( "; - $sql .= "'".uuid()."', "; - $sql .= "'".$_SESSION['domain_uuid']."', "; - $sql .= "'".$contact_uuid."', "; - $sql .= "'".$_SESSION["user_uuid"]."' "; - $sql .= ")"; - //echo $sql."

"; - $db->exec(check_sql($sql)); - unset($sql); + //set sharing + if ($_POST['import_shared'] != 'true') { + $sql = "insert into v_contact_groups "; + $sql .= "( "; + $sql .= "contact_group_uuid, "; + $sql .= "domain_uuid, "; + $sql .= "contact_uuid, "; + $sql .= "group_uuid "; + $sql .= ") "; + $sql .= "values "; + $sql .= "( "; + $sql .= "'".uuid()."', "; + $sql .= "'".$_SESSION['domain_uuid']."', "; + $sql .= "'".$contact_uuid."', "; + $sql .= "'".$_SESSION["user_uuid"]."' "; + $sql .= ")"; + $db->exec(check_sql($sql)); + unset($sql); + } //insert emails - if (sizeof($contact['emails']) > 0) { + if ($_POST['import_fields']['email'] && sizeof($contact['emails']) > 0) { foreach ($contact['emails'] as $contact_email) { $sql = "insert into v_contact_emails "; $sql .= "("; @@ -148,14 +152,13 @@ if ($_POST['a'] == 'import') { $sql .= "'".check_str($contact_email['address'])."', "; $sql .= (($contact_email['primary']) ? 1 : 0)." "; $sql .= ")"; - //echo $sql."

"; $db->exec(check_sql($sql)); unset($sql); } } //insert numbers - if (sizeof($contact['numbers']) > 0) { + if ($_POST['import_fields']['number'] && sizeof($contact['numbers']) > 0) { foreach ($contact['numbers'] as $contact_number) { $sql = "insert into v_contact_phones "; $sql .= "("; @@ -179,14 +182,13 @@ if ($_POST['a'] == 'import') { $sql .= "'".check_str($contact_number['number'])."', "; $sql .= ((sizeof($contact['numbers']) == 1) ? 1 : 0)." "; $sql .= ")"; - //echo $sql."

"; $db->exec(check_sql($sql)); unset($sql); } } //insert urls - if (sizeof($contact['urls']) > 0) { + if ($_POST['import_fields']['url'] && sizeof($contact['urls']) > 0) { foreach ($contact['urls'] as $contact_url) { $sql = "insert into v_contact_urls "; $sql .= "("; @@ -206,14 +208,13 @@ if ($_POST['a'] == 'import') { $sql .= "'".check_str($contact_url['url'])."', "; $sql .= ((sizeof($contact['urls']) == 1) ? 1 : 0)." "; $sql .= ")"; - //echo $sql."

"; $db->exec(check_sql($sql)); unset($sql); } } //insert addresses - if (sizeof($contact['addresses']) > 0) { + if ($_POST['import_fields']['address'] && sizeof($contact['addresses']) > 0) { foreach ($contact['addresses'] as $contact_address) { $sql = "insert into v_contact_addresses "; $sql .= "("; @@ -255,7 +256,6 @@ if ($_POST['a'] == 'import') { $sql .= "'".check_str($contact_address['country'])."', "; $sql .= ((sizeof($contact['addresses']) == 1) ? 1 : 0)." "; $sql .= ")"; - echo $sql."

"; $db->exec(check_sql($sql)); unset($sql); } @@ -347,6 +347,98 @@ $row_style["1"] = "row_style1"; 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-import_fields']."\n"; +echo "\n"; +echo "  ".$text['label-contact_name']." \n"; +echo "  ".$text['label-contact_organization']." \n"; +echo "  \n"; +echo "  \n"; +echo "  \n"; +echo " \n"; +echo "
\n"; +echo $text['description-import_fields']."\n"; +echo "
\n"; +echo " ".$text['label-contact_type']."\n"; +echo "\n"; +if (is_array($_SESSION["contact"]["type"])) { + sort($_SESSION["contact"]["type"]); + echo " \n"; +} +else { + echo " \n"; +} +echo "
\n"; +echo $text['description-contact_type_import']."\n"; +echo "
\n"; +echo " ".$text['label-contact_category']."\n"; +echo "\n"; +if (is_array($_SESSION["contact"]["category"])) { + sort($_SESSION["contact"]["category"]); + echo " \n"; +} +else { + echo " \n"; +} +echo "
\n"; +echo $text['description-contact_category_import']."\n"; +echo "
\n"; +echo " ".$text['label-shared']."\n"; +echo "\n"; +echo " \n"; +echo "
\n"; +echo $text['description-shared_import']."\n"; +echo "
"; +echo "

"; + //display groups echo "".$text['label-groups'].""; echo "

";