function party_merge in Party 8.2
Same name and namespace in other branches
- 7 party.module \party_merge()
Merge two parties.
@TODO: this is not at all functional!
When running this function, the first party gets all of the second party's attached entities and the second party becomes a 'ghost' party that points to the first.
Parameters
$first the first party.:
$second the second party:
See also
http://drupal.org/node/1669708.
1 call to party_merge()
- party_party_operations_merge in ./
party.module - Merge multiple parties.
File
- ./
party.module, line 1495 - Provides a generic CRM party entity.
Code
function party_merge($first, $second) {
// @todo: Clever logic to work out which data sets to delete and which to keep
// @todo: Transfer hats.
// @todo: Work out what to do with party fields.
// If the field is empty in $first and full in $second copy the value in
// If the field has unlimited cardinality or there is space for the values in $first
// then copy the values in.
// Make the other party a ghost party
$second->merged = 1;
$second->merged_party = $first->pid;
$second
->save();
}