Parcourir la source

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).

Nate Jones il y a 10 ans
Parent
commit
e7ca4b9d59
5 fichiers modifiés avec 279 ajouts et 178 suppressions
  1. 119 39
      app_languages.php
  2. 21 18
      contact_delete.php
  3. 17 93
      contact_edit.php
  4. 3 1
      contact_import.php
  5. 119 27
      contact_import_google.php

+ 119 - 39
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 (<ED>ndice) para este elemento de la matriz.";
-		$text['description-order']['pt-pt'] = "Defina a ordem (<ED>ndice) para este elemento da matriz.";
-		$text['description-order']['fr-fr'] = "D<E9>finir l'ordre (index) pour cet <E9>l<E9>ment 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";

+ 21 - 18
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);

+ 17 - 93
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 "	<select class='formfld' name='contact_type'>\n";
-			echo "	<option value=''></option>\n";
+			echo "		<option value=''></option>\n";
 			foreach($_SESSION["contact"]["type"] as $row) {
-				if ($row == $contact_type) {
-					echo "	<option value='".$row."' selected='selected'>".$row."</option>\n";
-				}
-				else {
-					echo "	<option value='".$row."'>".$row."</option>\n";
-				}
+				echo "	<option value='".$row."' ".(($row == $contact_type) ? "selected='selected'" : null).">".$row."</option>\n";
 			}
 			echo "	</select>\n";
 		}
 		else {
 			echo "	<select class='formfld' name='contact_type'>\n";
-			echo "	<option value=''></option>\n";
-
-			if ($contact_type == "customer") {
-				echo "	<option value='customer' selected='selected' >Customer</option>\n";
-			}
-			else {
-				echo "	<option value='customer'>Customer</option>\n";
-			}
-			if ($contact_type == "contractor") {
-				echo "	<option value='contractor' selected='selected' >Contractor</option>\n";
-			}
-			else {
-				echo "	<option value='contractor'>Contractor</option>\n";
-			}
-			if ($contact_type == "friend") {
-				echo "	<option value='friend' selected='selected' >Friend</option>\n";
-			}
-			else {
-				echo "	<option value='friend'>Friend</option>\n";
-			}
-			if ($contact_type == "lead") {
-				echo "	<option value='lead' selected='selected' >Lead</option>\n";
-			}
-			else {
-				echo "	<option value='lead'>Lead</option>\n";
-			}
-			if ($contact_type == "member") {
-				echo "	<option value='member' selected='selected' >Member</option>\n";
-			}
-			else {
-				echo "	<option value='member'>Member</option>\n";
-			}
-			if ($contact_type == "family") {
-				echo "	<option value='family' selected='selected' >Family</option>\n";
-			}
-			else {
-				echo "	<option value='family'>Family</option>\n";
-			}
-			if ($contact_type == "subscriber") {
-				echo "	<option value='subscriber' selected='selected' >Subscriber</option>\n";
-			}
-			else {
-				echo "	<option value='subscriber'>Subscriber</option>\n";
-			}
-			if ($contact_type == "supplier") {
-				echo "	<option value='supplier' selected='selected' >Supplier</option>\n";
-			}
-			else {
-				echo "	<option value='supplier'>Supplier</option>\n";
-			}
-			if ($contact_type == "provider") {
-				echo "	<option value='provider' selected='selected' >Provider</option>\n";
-			}
-			else {
-				echo "	<option value='provider'>Provider</option>\n";
-			}
-			if ($contact_type == "user") {
-				echo "	<option value='user' selected='selected' >User</option>\n";
-			}
-			else {
-				echo "	<option value='user'>User</option>\n";
-			}
-			if ($contact_type == "volunteer") {
-				echo "	<option value='volunteer' selected='selected' >Volunteer</option>\n";
-			}
-			else {
-				echo "	<option value='volunteer'>Volunteer</option>\n";
-			}
+			echo "		<option value=''></option>\n";
+			echo "		<option value='customer' ".(($contact_type == "customer") ? "selected='selected'" : null).">".$text['option-contact_type_customer']."</option>\n";
+			echo "		<option value='contractor' ".(($contact_type == "contractor") ? "selected='selected'" : null).">".$text['option-contact_type_contractor']."</option>\n";
+			echo "		<option value='friend' ".(($contact_type == "friend") ? "selected='selected'" : null).">".$text['option-contact_type_friend']."</option>\n";
+			echo "		<option value='lead' ".(($contact_type == "lead") ? "selected='selected'" : null).">".$text['option-contact_type_lead']."</option>\n";
+			echo "		<option value='member' ".(($contact_type == "member") ? "selected='selected'" : null).">".$text['option-contact_type_member']."</option>\n";
+			echo "		<option value='family' ".(($contact_type == "family") ? "selected='selected'" : null).">".$text['option-contact_type_family']."</option>\n";
+			echo "		<option value='subscriber' ".(($contact_type == "subscriber") ? "selected='selected'" : null).">".$text['option-contact_type_subscriber']."</option>\n";
+			echo "		<option value='supplier' ".(($contact_type == "supplier") ? "selected='selected'" : null).">".$text['option-contact_type_supplier']."</option>\n";
+			echo "		<option value='provider' ".(($contact_type == "provider") ? "selected='selected'" : null).">".$text['option-contact_type_provider']."</option>\n";
+			echo "		<option value='user' ".(($contact_type == "user") ? "selected='selected'" : null).">".$text['option-contact_type_user']."</option>\n";
+			echo "		<option value='volunteer' ".(($contact_type == "volunteer") ? "selected='selected'" : null).">".$text['option-contact_type_volunteer']."</option>\n";
 			echo "	</select>\n";
 		}
 		echo "<br />\n";
@@ -551,12 +490,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
 			echo "	<select class='formfld' name='contact_title'>\n";
 			echo "	<option value=''></option>\n";
 			foreach($_SESSION["contact"]["title"] as $row) {
-				if ($row == $contact_title) {
-					echo "	<option value='".$row."' selected='selected'>".$row."</option>\n";
-				}
-				else {
-					echo "	<option value='".$row."'>".$row."</option>\n";
-				}
+				echo "	<option value='".$row."' ".(($row == $contact_title) ? "selected='selected'" : null).">".$row."</option>\n";
 			}
 			echo "	</select>\n";
 		}
@@ -578,12 +512,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
 			echo "	<select class='formfld' name='contact_category'>\n";
 			echo "	<option value=''></option>\n";
 			foreach($_SESSION["contact"]["category"] as $row) {
-				if ($row == $contact_category) {
-					echo "	<option value='".$row."' selected='selected'>".$row."</option>\n";
-				}
-				else {
-					echo "	<option value='".$row."'>".$row."</option>\n";
-				}
+				echo "	<option value='".$row."' ".(($row == $contact_category) ? "selected='selected'" : null).">".$row."</option>\n";
 			}
 			echo "	</select>\n";
 		}
@@ -605,12 +534,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
 			echo "	<select class='formfld' name='contact_role'>\n";
 			echo "	<option value=''></option>\n";
 			foreach($_SESSION["contact"]["role"] as $row) {
-				if ($row == $contact_role) {
-					echo "	<option value='".$row."' selected='selected'>".$row."</option>\n";
-				}
-				else {
-					echo "	<option value='".$row."'>".$row."</option>\n";
-				}
+				echo "	<option value='".$row."' ".(($row == $contact_role) ? "selected='selected'" : null).">".$row."</option>\n";
 			}
 			echo "	</select>\n";
 		}

+ 3 - 1
contact_import.php

@@ -432,7 +432,9 @@ else {
 
 	echo "	<tr>\n";
 	echo "		<td valign=\"bottom\" class=\"label\">\n";
-	echo "			<a href='contact_import_google.php'><img src='resources/images/icon_gcontacts.png' style='width: 21px; height: 21px; border: none; text-decoration: none; margin-right: 5px;' align='absmiddle'>".$text['header-contacts_import_google']."</a>\n";
+	if (function_exists('curl_version') && $_SESSION['contact']['google_oauth_client_id']['text'] != '' && $_SESSION['contact']['google_oauth_client_secret']['text'] != '') {
+		echo "		<a href='contact_import_google.php'><img src='resources/images/icon_gcontacts.png' style='width: 21px; height: 21px; border: none; text-decoration: none; margin-right: 5px;' align='absmiddle'>".$text['header-contacts_import_google']."</a>\n";
+	}
 	echo "		</td>\n";
 	echo "		<td valign=\"bottom\" align='right' class=\"label\" nowrap>\n";
 	echo "			<br />\n";

+ 119 - 27
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."<br><br>";
 			$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."<br><br>";
-			$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."<br><br>";
 					$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."<br><br>";
 					$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."<br><br>";
 					$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."<br><br>";
 					$db->exec(check_sql($sql));
 					unset($sql);
 				}
@@ -347,6 +347,98 @@ $row_style["1"] = "row_style1";
 echo "<form name='frm_import' id='frm_import' method='post'>\n";
 echo "<input type='hidden' name='a' value='import'>\n";
 
+echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
+
+echo "<tr>\n";
+echo "<td width='30%' class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
+echo "	".$text['label-import_fields']."\n";
+echo "</td>\n";
+echo "<td width='70%' class='vtable' align='left'>\n";
+echo "	<input type='checkbox' disabled='disabled' checked>&nbsp;".$text['label-contact_name']."&nbsp;\n";
+echo "	<input type='checkbox' disabled='disabled' checked>&nbsp;".$text['label-contact_organization']."&nbsp;\n";
+echo "	<input type='checkbox' name='import_fields[email]' id='field_email' value='1' checked><label for='field_email'>&nbsp;".$text['label-contact_email']."</label>&nbsp;\n";
+echo "	<input type='checkbox' name='import_fields[number]' id='field_number' value='1' checked><label for='field_number'>&nbsp;".$text['label-phone_number']."</label>&nbsp;\n";
+echo "	<input type='checkbox' name='import_fields[url]' id='field_url' value='1' checked><label for='field_url'>&nbsp;".$text['label-contact_url']."</label>&nbsp;\n";
+echo "	<input type='checkbox' name='import_fields[addresse]' id='field_address' value='1' checked><label for='field_address'>&nbsp;".$text['label-address_address']."</label>\n";
+echo "<br />\n";
+echo $text['description-import_fields']."\n";
+echo "</td>\n";
+echo "</tr>\n";
+
+echo "<tr>\n";
+echo "<td width='30%' class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
+echo "	".$text['label-contact_type']."\n";
+echo "</td>\n";
+echo "<td class='vtable' align='left'>\n";
+if (is_array($_SESSION["contact"]["type"])) {
+	sort($_SESSION["contact"]["type"]);
+	echo "	<select class='formfld' name='import_type'>\n";
+	echo "		<option value=''></option>\n";
+	foreach($_SESSION["contact"]["type"] as $row) {
+		echo "	<option value='".$row."'>".$row."</option>\n";
+	}
+	echo "	</select>\n";
+}
+else {
+	echo "	<select class='formfld' name='import_type'>\n";
+	echo "		<option value=''></option>\n";
+	echo "		<option value='customer'>".$text['option-contact_type_customer']."</option>\n";
+	echo "		<option value='contractor'>".$text['option-contact_type_contractor']."</option>\n";
+	echo "		<option value='friend'>".$text['option-contact_type_friend']."</option>\n";
+	echo "		<option value='lead'>".$text['option-contact_type_lead']."</option>\n";
+	echo "		<option value='member'>".$text['option-contact_type_member']."</option>\n";
+	echo "		<option value='family'>".$text['option-contact_type_family']."</option>\n";
+	echo "		<option value='subscriber'>".$text['option-contact_type_subscriber']."</option>\n";
+	echo "		<option value='supplier'>".$text['option-contact_type_supplier']."</option>\n";
+	echo "		<option value='provider'>".$text['option-contact_type_provider']."</option>\n";
+	echo "		<option value='user'>".$text['option-contact_type_user']."</option>\n";
+	echo "		<option value='volunteer'>".$text['option-contact_type_volunteer']."</option>\n";
+	echo "	</select>\n";
+}
+echo "<br />\n";
+echo $text['description-contact_type_import']."\n";
+echo "</td>\n";
+echo "</tr>\n";
+
+echo "<tr>\n";
+echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
+echo "	".$text['label-contact_category']."\n";
+echo "</td>\n";
+echo "<td class='vtable' align='left'>\n";
+if (is_array($_SESSION["contact"]["category"])) {
+	sort($_SESSION["contact"]["category"]);
+	echo "	<select class='formfld' name='import_category'>\n";
+	echo "		<option value=''></option>\n";
+	foreach($_SESSION["contact"]["category"] as $row) {
+		echo "	<option value='".$row."'>".$row."</option>\n";
+	}
+	echo "	</select>\n";
+}
+else {
+	echo "	<input class='formfld' type='text' name='import_category' maxlength='255'>\n";
+}
+echo "<br />\n";
+echo $text['description-contact_category_import']."\n";
+echo "</td>\n";
+echo "</tr>\n";
+
+echo "<tr>\n";
+echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
+echo "	".$text['label-shared']."\n";
+echo "</td>\n";
+echo "<td class='vtable' align='left'>\n";
+echo "	<select class='formfld' name='import_shared' id='import_shared'>\n";
+echo "		<option value='false'>".$text['option-false']."</option>\n";
+echo "		<option value='true'>".$text['option-true']."</option>\n";
+echo "	</select>\n";
+echo "	<br />\n";
+echo $text['description-shared_import']."\n";
+echo "</td>\n";
+echo "</tr>\n";
+
+echo "</table>";
+echo "<br><br>";
+
 //display groups
 echo "<b>".$text['label-groups']."</b>";
 echo "<br><br>";