GContacts

Gcontacts is a Dolibarr module for contacts syncronization between Dolibarr and a GMail account.

Thanks to GMail popularity, once your contacts are defined on a GMail account, synchronization with a smartphone is straightforward.

Synchronization can be done in two ways:

From Dolibarr to a GMail account

If this option is on, any modification on a dolibarr contact will be automatically transferred to the GMail account

From a GMail account to Dolibarr

If this option is on, you will be able to synchronize manually GMail modifications to the Dolibarr contacts address book.

Goal of the module

The main goal of this module is to maintain Dolibarr contacts adress book on mobiles in the most simplest and integred way.

Developpement of this module try to answer following needs :

Exportation : Exported contacts from Dolibarr must stand on the native phone adress book, so the name of the caller will appears on phone when incomming call.

Importation : When a commercial want to enter a new customer (on visit, after a call...), he should do it as simple as possible

Collaborative : Share the updated infos : The Dolibarr contact adress book should be accessible on all smartphones of Dolibarr users. If one of them update a contact, the modification must be available on all the other smartphones.

Simplicity : Simple configuration and an easy way to go back on a situation without Dolibarr

Identification : Do not mix Dolibarr contacts with others on smartphone.

Portablility : Solution must work on a maximum of different platforms : Android, Iphone ...

Answer to these problems stand on a GMail account. It becomes extremely easy to add one or several GMail account on a smartphone. Once your account is setup on your phone, your GMail contacts address book is automatically maintain synchronous.

Once the synchronisation between GMail and your smatphone is active, we only need a synchronization between Dolibarr and Gmail to keep an adress book up-to-date on mobiles. That's the goal of this module.

Configuration / Initialisation

After module activation, an icon appears at the end of the line. click on it to access the setup page.

config

Upper part is to enter your GMail credentials and to set up the synchronization.

In Bottom part, 'Opérations', you will be able to initialize/update and cleanup your adress book on your GMail account.

We recommend to create a Google account specifically dedicated to your Dolibarr adress book. So you will be able to share it with your colleagues and everyone will have the Dolibarr's contacts on his smartphone.

If you start with a GMail account that already has contacts, it is strongly recommended to make a backup of your contacts first. This can be done easily with the following procedure: Backup your GMail adress book

Synchronization occurs for contacts defined as 'Shared'. 'Private' contacts will never be synchronized

This module works with standard GMail accounts and with Google Apps accounts (You have to enable "Contacts" service and disable the SSL connection for this service)

From Dolibarr to GMail

From Dolibarr to GMail, synchronizations are transparents and automatics. Any change on one of your Dolibarr contact will be automatically transposed on your GMail account. Similarly, the creation or deletion of a Dolibarr contact contact will also be done transparently.

edit gmail

Note that informations on third party of this contact are also transferred to GMail. Eg., Address, telephone or fax of the company attached to this contact will be listed on the GMail contact card with the label 'Company Name'.
In the example above, the mail of the 'Decomo' company will be filled in the GMail contact card of Jean Derivière under the label 'Decomo SPRL'. Similarly, the name of the company will be filled on the GMail card beside the contact's job title.

If the information of third party are identical to those of the contact (eg., For the address), it will only appear once on the GMail contact card.

Sync with 'My Contacts' Group : With this parameter set to 'ON', the synchronization will be done with the group 'My Contacts' on your GMail account.

This parameter is mandatory for compatibility with IPhones : the GMail connection under IOS allows only the synchronization with contacts under the 'My Contacts' group.
If all the smartphones using this modules are Androids, we recommend to desactivate this parameter and to define an other contact group for sync. This will ensure you a more clear view of your contacts origin under your GMail account.

GMail group name container for contacts : Ce paramètre vous permet de définir le nom du groupe GMail sous lequel vos contacts seront sauvés. La valeur par défaut est 'Onelog',

Group contacts of one sales representative under a Gmail group : When creating a new contact, if the third party of this contact is assigned to a commercial, the contact will also be owned on the GMail account by a group Onelog/XXX where XXX is the login of Dolibarr commercial user, So all the contacts of a commercial will stand in GMail group.

Unfortunately there is no mechanism provided in the kernel of Dolibarr to trigger external modules on commercial to third party association changes. Therefore, if you change this association, it will not be passed on to the GMail account. To force synchronization of this change, you must, at the contact level, edit and re-save the contact.

Enable possibility to sync contact by contact :  If you enable this option, a new field will appear on each contact page. This field allows you to enable or disable syncronization to GMail for the contact.

If you disable this option, or if you disable the module GContacs itself, the sync value ​​set for each contact will be lost and reset to the default value.

Default value per contact : This option sets the default taken by the contact sync field when creating a new contact, or when importing multiple contacts

Maximum number of contacts to retrieve from GMail : Define the maximum number of contacts retrieve from your GMail account. Increase this if you have a lot of contacts to synchronize.

from GMail to Dolibarr

A new tab appears on in the Dolibarr contact view : 'GContacts'


This tab allows you to compare information on the contact between GMail and Dolibarr. Differences will be shown in red, and you will be able to bring back the information found on your Gmail account to Dolibarr.

config

Note that the information on the third party are not recorded, so if you change on your GMail account any information on the third party, they will not be re-synchronized to Dolibarr. But, if you change a third party in Dolibarr (apart from its assignment to a commercial), all of the contacts belonging to this third party will have their GMail card updated automatically (if you have enabled sync to GMail in the configuration module).

Opérations

The second part of the configuration page allows you to do two things:

Export Dolibarr's contacts : This operation will export or re-synchronize all your 'Shared' Dolibarr contacts to your GMail account (taking into account the field 'synchronization' of each contact if this option has been activated). And it will create and populate GMail groups based on third party to commercial affectation.

Cleanup contacts : GMail contacts and groups comming from Dolibarr will be deleted. Contacts on your Dolibarr itself will obviously not be changed.

Import GMail contacts to Dolibarr

Upon activation of the module GContacts, a new entry in the left menu of the Third party view appears : GMail Contacts >> Import new contacts

If you click this menu item, you will have a list of new contacts comming from the "My contacts' GMail account that you define in the module configuration.

config

By selecting the ones you want in the list, and clicking the 'Import' button, you will import them as new contacts Dollibar.

Each of the new integrated contacts take the status of 'Prospect' in Dolibarr.

If you have choosen 'Yes' in the column 'Create a Third party', a third party with the same name will be created simultaneously (such as when you create a new Third party in Dolibarr with type 'Private individual').

If you create a third party for this contact, then you can assign it to a commercial.

In this page, you can also integrate new contacts into Dolibarr comming from the group 'My Contacts' of another GMail account. Simply enter the login and password of the account and click 'Search Contacts'.

Contacts from the GMail account that does not contain a last name (when only the first name is defined) are ignored on import.

When you import contacts from your GMail account (the one defined in the module configuration), they will be automatically moved from the group 'My Contacts' to the group specified in the module configuration, and therefor, will not longer appear in list on subsequent imports.

If you import contacts from another Gmail account, no changes will be made to this account, and new contacts will appear in the 'Dolibarr' group of your GMail main account. This also means that if you repeat the import with the same alternative GMail account, the contacts list to import will be unchanged. If you re-select a contact already imported, a second contact (identical to the first), will be created in Dolibarr and in the main GMail account.

For performance reasons, the maximum number of contacts that can be imported is 800. If the group 'My Contacts' on the GMail account contains more than 800 contacts, you must increase the parameter 'Max number of contacts to retrieve from GMail' in the configuration page of the module.

Check synchro

This menu give you a full and clear report of the synchronization status between Dolibarr and your Gmail account.

config
Tips and tricks

Use a Google Apps account : "Expected response code 200, Got 401. 401 That's an error."

If you get such an error message when connecting to your Google Apps, This mean that the 'Contacts' service on your Google Apps domain is inactive. Activate the service, and in it's configuration, deselect the SSL connection for the API Contacts parameter.

Possible enhancements

GConnect uses a Zend library for connection to Google GMail. This library uses the 'ClientLogin' from Google. This feature will not be longer supported by Google in April 2015. Therefore the connections functions has to be migrate to OAuth 2.0 before this date. (Google deprecation policy)

This module synchronizes only contacts. It is possible to synchronize the members in the case of a association, or internal/external users of Dolibarr.

Minimum detection (first / last name?) of contacts already imported in a double import from an alternative GMail account.

Create GMail groups for Customers / Suppliers / Prospects;

Create GMail groups according to the categories defined in Dolibarr;

Cron scripts in order to automatically integrate new contacts and/or sync modifies GMail contacts.

...

Release notes

V1.0

2013-11-20

First version

V1.1

2013-02-10

Third party creation
Commercial groups

V1.2

2013-02-10

Dolistore version
contact by contact synchro
Main group name option
Export only shared contacts

V1.3

2013-12-21

Dolibarr 1.4 Compatibility

V1.4

2014-01-22

Internal version

V1.5

2014-02-12

Dolibarr 1.5 Compatibility
Allows to sync with 'My Contacts' to enable IPhone Compatibility
Add feature 'Check synchro'

V1.6

2014-04-24

Fix following Google Contacts API V3 policy change. Google flow is now manageg in https.
More infos.

V1.7

2014-05-12

Fix in Gmail Sync to avoid unexpected duplicates