abstract class CrmSync extends BaseHook implements xi_crm_synchronisation_hook

Abstract Class for CRM Sync Plugins This abstract class incorporates the old interface and is the recommended way to create new sync plugins for the CRM

Properties

Controller $mod

Instance providing the hook

from  BaseHook
array $_hook_info

Hook Information "id" => "4914" "instance_id" => "api_microsoft" "name" => "oauth_client" "hook" => "webservice.oauth_client" "type" => "object" "registry_name" => "oauth_client" "function_name" => "" "internal" => "no" "dep_mode" => "local" "active" => "yes" "title" => "Basic functions" "description" => "" "options" => ""

from  BaseHook
int $_crm_contact_id
array $_crm2src_map

Methods

string
createContact()

This function should create a new/empty contact in source and return a reference key The CRM will use updateContactPropertyValues() afterwards to set the properties

bool
deleteContact(string $sourceReferenceKey)

This function should delete the contact associated with the reference key

mixed
getContactIsDeleted(string $sourceReferenceKey)

This function should return true, when the referenced contact has been deleted in source The function will be called before getContactPropertyValues and as a result may delete the crm contact

array
getContactProperties()

This function should return all available properties of the source, which are meant to be available for synchronisation The keys should not change afterwards, as they will be used for mapping and identification

array
getContactPropertyValues(string $sourceReferenceKey, string[] $propertyKeys, int $syncTime = null)

Return the properties of the specified contact

string
getHookDescription()

No description

from  BaseHook
string
getHookIdentifier()

Get Hook identifier consists of instance_id puncto separator and hook name Ex. instance_id.name

from  BaseHook
array
getHookInfoValue(bool $key = false)

Return Hook information (ID, InstanceID, Name, Hook Type, Object Type, ...)

from  BaseHook
string
getHookInstance()

No description

from  BaseHook
string
getHookName()

No description

from  BaseHook
string
getHookTitle()

No description

from  BaseHook
array
getNewContacts(int $syncTime = null)

This function should return reference keys for contacts which have been created in source since the last sync The CRM will call getContactPropertyValues() for the given contacts to retrieve the data

getObject()

No description

from  BaseHook
array
get_field_values(array $sync_keys, $source_ref_id, int|bool $sync_time = false)

Returns Values of specified Fields after sync time

get_sync_fields()

Get all Fields available for Synchronisation

bool
isAvailable()

Returns true if this hook is available otherwise false.

bool
set_field_values(array $sync_key_values, string|int $source_ref_id, int $sync_time)

Set the values in source

bool
updateContactPropertyValues(string $sourceReferenceKey, $propertyKeyValues, $syncTime)

Update the properties of the specified contact

Details

at line 67
abstract string createContact()

This function should create a new/empty contact in source and return a reference key The CRM will use updateContactPropertyValues() afterwards to set the properties

Return Value

string

Source Reference Key

at line 87
abstract bool deleteContact(string $sourceReferenceKey)

This function should delete the contact associated with the reference key

Parameters

string $sourceReferenceKey

Return Value

bool

success

at line 56
abstract mixed getContactIsDeleted(string $sourceReferenceKey)

This function should return true, when the referenced contact has been deleted in source The function will be called before getContactPropertyValues and as a result may delete the crm contact

Parameters

string $sourceReferenceKey

The reference key to identify the contact in SOURCE

Return Value

mixed

at line 23
abstract array getContactProperties()

This function should return all available properties of the source, which are meant to be available for synchronisation The keys should not change afterwards, as they will be used for mapping and identification

Return Value

array

['sourcePropertyKey'=>'name of source property']

at line 45
abstract array getContactPropertyValues(string $sourceReferenceKey, string[] $propertyKeys, int $syncTime = null)

Return the properties of the specified contact

Parameters

string $sourceReferenceKey
string[] $propertyKeys

['sourcePropertyKey1','sourcePropertyKey2','...']

int $syncTime

Unixtime when the last sync happened

Return Value

array

['sourcePropertyKey'=>'value']

in BaseHook at line 76
string getHookDescription()

No description

Return Value

string

in BaseHook at line 55
string getHookIdentifier()

Get Hook identifier consists of instance_id puncto separator and hook name Ex. instance_id.name

Return Value

string

in BaseHook at line 45
array getHookInfoValue(bool $key = false)

Return Hook information (ID, InstanceID, Name, Hook Type, Object Type, ...)

Parameters

bool $key

Return Value

array

in BaseHook at line 69
string getHookInstance()

No description

Return Value

string

in BaseHook at line 62
string getHookName()

No description

Return Value

string

in BaseHook at line 83
string getHookTitle()

No description

Return Value

string

at line 34
abstract array getNewContacts(int $syncTime = null)

This function should return reference keys for contacts which have been created in source since the last sync The CRM will call getContactPropertyValues() for the given contacts to retrieve the data

Parameters

int $syncTime

Unixtime when the last sync happened

Return Value

array

['sourceRefKey1','sourceRefKey2','...'] Source Reference Keys

in BaseHook at line 88
getObject()

No description

at line 128
array get_field_values(array $sync_keys, $source_ref_id, int|bool $sync_time = false)

Returns Values of specified Fields after sync time

Parameters

array $sync_keys

Keys of the fields to sync

$source_ref_id
int|bool $sync_time

Unixtime of last Sync

Return Value

array

['sourcePropertyKey'=>'value']

Examples

The Lookbook returns the property values for the given IDs in $sync_keys

at line 114
get_sync_fields()

Get all Fields available for Synchronisation

at line 92
bool isAvailable()

Returns true if this hook is available otherwise false.

Return Value

bool

at line 143
bool set_field_values(array $sync_key_values, string|int $source_ref_id, int $sync_time)

Set the values in source

Parameters

array $sync_key_values

array(sync_key => field value) Receives the CRM field values with the source sync_keys

string|int $source_ref_id

The reference field, e.g. the system user ID in the Lookbook

int $sync_time

Unixtime of current Sync(more or less time())

Return Value

bool

success

at line 78
abstract bool updateContactPropertyValues(string $sourceReferenceKey, $propertyKeyValues, $syncTime)

Update the properties of the specified contact

Parameters

string $sourceReferenceKey
$propertyKeyValues
$syncTime

Return Value

bool

True if update was successful