Helper to merge duplicate objects

package org.openpsa.contacts

 Methods

__construct (string $mode)

Constructor, the parameter governs which objects the instance works on

Parameters

$mode

stringmode, currently valid modes are 'person' and 'group'

errstr ()

Returns somewhat descriptive error strings

Returns

stringlatest error

merge (object $obj1, object $obj2, $merge_mode)

Merges given objects

Depending on modes either all or only future dependencies, this method will go trough all components' interface classes and call a merge method there

Parameters

$obj1

objectObject that data will be merged to

$obj2

objectObject that data will be merged from

$merge_mode

Returns

booleanIndicating success/failure

merge_delete (object $obj1, object $obj2)

Merges first object with second and then deletes the second

Parameters

$obj1

objectObject that will remain

$obj2

objectObject that will be deleted

Returns

booleanIndicating success/Failure

merge_needed ()

Checks if there are any objects (for the mode given in constructor) that need to be processed

Note: does not check user's privileges or that the objects actually exist (the cleanup cronjob handles dangling references)

Returns

booleanindicating need for processing (merge/not duplicate)

_call_component_merge (string $component, object $obj1, object $obj2, string $merge_mode)

Calls the given components interface method for merging duplicates (if said method exists)

Parameters

$component

stringcomponent name

$obj1

objectObject that data will be merged from

$obj2

objectObject that data will be merged to

$merge_mode

stringmerge mode

Returns

booleanIndicating success/failure

 Properties

 

mixed $_errstr

 

mixed $_object_mode