/** * */ public static function do_edit_individual($entity_data, $party_data) { $entity_data['name'] = $entity_data['first_name'] . ' ' . $entity_data['last_name']; $party_data = self::do_edit_party($entity_data, $party_data); if ($party_data['has_errors']) { return $party_data; } $person_data = PersonAPI::do_edit_person($entity_data, $party_data); if (!isset($person_data['id'])) { return EntityAPIUtils::init_error($party_data, 'Person creation failed'); } return $party_data; }
/** * */ public static function do_create_individual($entity_data) { $party_type = EntityAPI::get_by_code('partytype', PartyAPI::$individual_party_type); if (!isset($party_type['id'])) { return EntityAPIUtils::init_error($entity_data, 'Party type is required'); } $entity_data['name'] = $entity_data['first_name'] . ' ' . $entity_data['last_name']; // Create the party $party_data = self::do_create_party($entity_data, $party_type); if ($party_data['has_errors']) { return $party_data; } $person_data = PersonAPI::do_create_person($entity_data, $party_data); if (!isset($person_data['id'])) { return EntityAPIUtils::init_error($party_data, 'Person creation failed'); } return $party_data; }