Merge pull request #14760 from eileenmcnaughton/unsub
[civicrm-core.git] / CRM / Export / BAO / Export.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 5 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2019 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
9 | |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
13 | |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
18 | |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
26 */
27
28 /**
29 *
30 * @package CRM
31 * @copyright CiviCRM LLC (c) 2004-2019
32 */
33
34 /**
35 * This class contains the functions for Component export
36 *
37 */
38 class CRM_Export_BAO_Export {
39 // increase this number a lot to avoid making too many queries
40 // LIMIT is not much faster than a no LIMIT query
41 // CRM-7675
42 const EXPORT_ROW_COUNT = 100000;
43
44 /**
45 * Get the list the export fields.
46 *
47 * @param int $selectAll
48 * User preference while export.
49 * @param array $ids
50 * Contact ids.
51 * @param array $params
52 * Associated array of fields.
53 * @param string $order
54 * Order by clause.
55 * @param array $fields
56 * Associated array of fields.
57 * @param array $moreReturnProperties
58 * Additional return fields.
59 * @param int $exportMode
60 * Export mode.
61 * @param string $componentClause
62 * Component clause.
63 * @param string $componentTable
64 * Component table.
65 * @param bool $mergeSameAddress
66 * Merge records if they have same address.
67 * @param bool $mergeSameHousehold
68 * Merge records if they belong to the same household.
69 *
70 * @param array $exportParams
71 * @param string $queryOperator
72 *
73 * @return array|null
74 * An array can be requested from within a unit test.
75 *
76 * @throws \CRM_Core_Exception
77 */
78 public static function exportComponents(
79 $selectAll,
80 $ids,
81 $params,
82 $order = NULL,
83 $fields = NULL,
84 $moreReturnProperties = NULL,
85 $exportMode = CRM_Export_Form_Select::CONTACT_EXPORT,
86 $componentClause = NULL,
87 $componentTable = NULL,
88 $mergeSameAddress = FALSE,
89 $mergeSameHousehold = FALSE,
90 $exportParams = [],
91 $queryOperator = 'AND'
92 ) {
93
94 $isPostalOnly = (
95 isset($exportParams['postal_mailing_export']['postal_mailing_export']) &&
96 $exportParams['postal_mailing_export']['postal_mailing_export'] == 1
97 );
98
99 if (!$selectAll && $componentTable && !empty($exportParams['additional_group'])) {
100 // If an Additional Group is selected, then all contacts in that group are
101 // added to the export set (filtering out duplicates).
102 // Really - the calling function could do this ... just saying
103 // @todo take a whip to the calling function.
104 CRM_Core_DAO::executeQuery("
105 INSERT INTO {$componentTable} SELECT distinct gc.contact_id FROM civicrm_group_contact gc WHERE gc.group_id = {$exportParams['additional_group']} ON DUPLICATE KEY UPDATE {$componentTable}.contact_id = gc.contact_id"
106 );
107 }
108 // rectify params to what proximity search expects if there is a value for prox_distance
109 // CRM-7021
110 // @todo - move this back to the calling functions
111 if (!empty($params)) {
112 CRM_Contact_BAO_ProximityQuery::fixInputParams($params);
113 }
114 // @todo everything from this line up should go back to the calling functions.
115 $processor = new CRM_Export_BAO_ExportProcessor($exportMode, $fields, $queryOperator, $mergeSameHousehold, $isPostalOnly, $mergeSameAddress, $exportParams);
116 if ($moreReturnProperties) {
117 $processor->setAdditionalRequestedReturnProperties($moreReturnProperties);
118 }
119 $processor->setComponentTable($componentTable);
120 $processor->setComponentClause($componentClause);
121
122 list($query, $queryString) = $processor->runQuery($params, $order);
123
124 // This perhaps only needs calling when $mergeSameHousehold == 1
125 self::buildRelatedContactArray($selectAll, $ids, $processor, $componentTable);
126
127 $addPaymentHeader = FALSE;
128
129 list($outputColumns, $metadata) = $processor->getExportStructureArrays();
130
131 if ($processor->isMergeSameAddress()) {
132 foreach (array_keys($processor->getAdditionalFieldsForSameAddressMerge()) as $field) {
133 $processor->setColumnAsCalculationOnly($field);
134 }
135 }
136
137 $paymentDetails = [];
138 if ($processor->isExportPaymentFields()) {
139 // get payment related in for event and members
140 $paymentDetails = CRM_Contribute_BAO_Contribution::getContributionDetails($exportMode, $ids);
141 //get all payment headers.
142 // If we haven't selected specific payment fields, load in all the
143 // payment headers.
144 if (!$processor->isExportSpecifiedPaymentFields()) {
145 if (!empty($paymentDetails)) {
146 $addPaymentHeader = TRUE;
147 foreach (array_keys($processor->getPaymentHeaders()) as $paymentField) {
148 $processor->addOutputSpecification($paymentField);
149 }
150 }
151 }
152 }
153
154 $componentDetails = [];
155
156 $rowCount = self::EXPORT_ROW_COUNT;
157 $offset = 0;
158 // we write to temp table often to avoid using too much memory
159 $tempRowCount = 100;
160
161 $count = -1;
162
163 $headerRows = $processor->getHeaderRows();
164 $sqlColumns = $processor->getSQLColumns();
165 $processor->createTempTable();
166 $limitReached = FALSE;
167
168 while (!$limitReached) {
169 $limitQuery = "{$queryString} LIMIT {$offset}, {$rowCount}";
170 CRM_Core_DAO::disableFullGroupByMode();
171 $iterationDAO = CRM_Core_DAO::executeQuery($limitQuery);
172 CRM_Core_DAO::reenableFullGroupByMode();
173 // If this is less than our limit by the end of the iteration we do not need to run the query again to
174 // check if some remain.
175 $rowsThisIteration = 0;
176
177 while ($iterationDAO->fetch()) {
178 $count++;
179 $rowsThisIteration++;
180 $row = $processor->buildRow($query, $iterationDAO, $outputColumns, $metadata, $paymentDetails, $addPaymentHeader);
181 if ($row === FALSE) {
182 continue;
183 }
184
185 // add component info
186 // write the row to a file
187 $componentDetails[] = $row;
188
189 // output every $tempRowCount rows
190 if ($count % $tempRowCount == 0) {
191 self::writeDetailsToTable($processor, $componentDetails, $sqlColumns);
192 $componentDetails = [];
193 }
194 }
195 if ($rowsThisIteration < self::EXPORT_ROW_COUNT) {
196 $limitReached = TRUE;
197 }
198 $offset += $rowCount;
199 }
200
201 if ($processor->getTemporaryTable()) {
202 self::writeDetailsToTable($processor, $componentDetails);
203
204 // do merge same address and merge same household processing
205 if ($mergeSameAddress) {
206 $processor->mergeSameAddress();
207 }
208
209 // call export hook
210 $table = $processor->getTemporaryTable();
211 CRM_Utils_Hook::export($table, $headerRows, $sqlColumns, $exportMode, $componentTable, $ids);
212 if ($table !== $processor->getTemporaryTable()) {
213 CRM_Core_Error::deprecatedFunctionWarning('altering the export table in the hook is deprecated (in some flows the table itself will be)');
214 $processor->setTemporaryTable($table);
215 }
216
217 // In order to be able to write a unit test against this function we need to suppress
218 // the csv writing. In future hopefully the csv writing & the main processing will be in separate functions.
219 if (empty($exportParams['suppress_csv_for_testing'])) {
220 self::writeCSVFromTable($headerRows, $sqlColumns, $processor);
221 }
222 else {
223 // return tableName sqlColumns headerRows in test context
224 return [$processor->getTemporaryTable(), $sqlColumns, $headerRows, $processor];
225 }
226
227 // delete the export temp table and component table
228 $sql = "DROP TABLE IF EXISTS " . $processor->getTemporaryTable();
229 CRM_Core_DAO::executeQuery($sql);
230 CRM_Core_DAO::reenableFullGroupByMode();
231 CRM_Utils_System::civiExit(0, ['processor' => $processor]);
232 }
233 else {
234 CRM_Core_DAO::reenableFullGroupByMode();
235 throw new CRM_Core_Exception(ts('No records to export'));
236 }
237 }
238
239 /**
240 * Handle import error file creation.
241 */
242 public static function invoke() {
243 $type = CRM_Utils_Request::retrieve('type', 'Positive');
244 $parserName = CRM_Utils_Request::retrieve('parser', 'String');
245 if (empty($parserName) || empty($type)) {
246 return;
247 }
248
249 // clean and ensure parserName is a valid string
250 $parserName = CRM_Utils_String::munge($parserName);
251 $parserClass = explode('_', $parserName);
252
253 // make sure parserClass is in the CRM namespace and
254 // at least 3 levels deep
255 if ($parserClass[0] == 'CRM' &&
256 count($parserClass) >= 3
257 ) {
258 require_once str_replace('_', DIRECTORY_SEPARATOR, $parserName) . ".php";
259 // ensure the functions exists
260 if (method_exists($parserName, 'errorFileName') &&
261 method_exists($parserName, 'saveFileName')
262 ) {
263 $errorFileName = $parserName::errorFileName($type);
264 $saveFileName = $parserName::saveFileName($type);
265 if (!empty($errorFileName) && !empty($saveFileName)) {
266 CRM_Utils_System::setHttpHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0');
267 CRM_Utils_System::setHttpHeader('Content-Description', 'File Transfer');
268 CRM_Utils_System::setHttpHeader('Content-Type', 'text/csv');
269 CRM_Utils_System::setHttpHeader('Content-Length', filesize($errorFileName));
270 CRM_Utils_System::setHttpHeader('Content-Disposition', 'attachment; filename=' . $saveFileName);
271
272 readfile($errorFileName);
273 }
274 }
275 }
276 CRM_Utils_System::civiExit();
277 }
278
279 /**
280 * @param $customSearchClass
281 * @param $formValues
282 * @param $order
283 */
284 public static function exportCustom($customSearchClass, $formValues, $order) {
285 $ext = CRM_Extension_System::singleton()->getMapper();
286 if (!$ext->isExtensionClass($customSearchClass)) {
287 require_once str_replace('_', DIRECTORY_SEPARATOR, $customSearchClass) . '.php';
288 }
289 else {
290 require_once $ext->classToPath($customSearchClass);
291 }
292 $search = new $customSearchClass($formValues);
293
294 $includeContactIDs = FALSE;
295 if ($formValues['radio_ts'] == 'ts_sel') {
296 $includeContactIDs = TRUE;
297 }
298
299 $sql = $search->all(0, 0, $order, $includeContactIDs);
300
301 $columns = $search->columns();
302
303 $header = array_keys($columns);
304 $fields = array_values($columns);
305
306 $rows = [];
307 $dao = CRM_Core_DAO::executeQuery($sql);
308 $alterRow = FALSE;
309 if (method_exists($search, 'alterRow')) {
310 $alterRow = TRUE;
311 }
312 while ($dao->fetch()) {
313 $row = [];
314
315 foreach ($fields as $field) {
316 $unqualified_field = CRM_Utils_Array::First(array_slice(explode('.', $field), -1));
317 $row[$field] = $dao->$unqualified_field;
318 }
319 if ($alterRow) {
320 $search->alterRow($row);
321 }
322 $rows[] = $row;
323 }
324
325 CRM_Core_Report_Excel::writeCSVFile(ts('CiviCRM Contact Search'), $header, $rows);
326 CRM_Utils_System::civiExit();
327 }
328
329 /**
330 * @param \CRM_Export_BAO_ExportProcessor $processor
331 * @param $details
332 */
333 public static function writeDetailsToTable($processor, $details) {
334 $tableName = $processor->getTemporaryTable();
335 if (empty($details)) {
336 return;
337 }
338
339 $sql = "
340 SELECT max(id)
341 FROM $tableName
342 ";
343
344 $id = CRM_Core_DAO::singleValueQuery($sql);
345 if (!$id) {
346 $id = 0;
347 }
348
349 $sqlClause = [];
350
351 foreach ($details as $row) {
352 $id++;
353 $valueString = [$id];
354 foreach ($row as $value) {
355 if (empty($value)) {
356 $valueString[] = "''";
357 }
358 else {
359 $valueString[] = "'" . CRM_Core_DAO::escapeString($value) . "'";
360 }
361 }
362 $sqlClause[] = '(' . implode(',', $valueString) . ')';
363 }
364 $sqlColumns = array_merge(['id' => 1], $processor->getSQLColumns());
365 $sqlColumnString = '(' . implode(',', array_keys($sqlColumns)) . ')';
366
367 $sqlValueString = implode(",\n", $sqlClause);
368
369 $sql = "
370 INSERT INTO $tableName $sqlColumnString
371 VALUES $sqlValueString
372 ";
373 CRM_Core_DAO::executeQuery($sql);
374 }
375
376 /**
377 * @param $headerRows
378 * @param $sqlColumns
379 * @param \CRM_Export_BAO_ExportProcessor $processor
380 */
381 public static function writeCSVFromTable($headerRows, $sqlColumns, $processor) {
382 $exportTempTable = $processor->getTemporaryTable();
383 $writeHeader = TRUE;
384 $offset = 0;
385 $limit = self::EXPORT_ROW_COUNT;
386
387 $query = "SELECT * FROM $exportTempTable";
388
389 while (1) {
390 $limitQuery = $query . "
391 LIMIT $offset, $limit
392 ";
393 $dao = CRM_Core_DAO::executeQuery($limitQuery);
394
395 if ($dao->N <= 0) {
396 break;
397 }
398
399 $componentDetails = [];
400 while ($dao->fetch()) {
401 $row = [];
402
403 foreach (array_keys($processor->getSQLColumns()) as $column) {
404 $row[$column] = $dao->$column;
405 }
406 $componentDetails[] = $row;
407 }
408 CRM_Core_Report_Excel::writeCSVFile($processor->getExportFileName(),
409 $headerRows,
410 $componentDetails,
411 NULL,
412 $writeHeader
413 );
414
415 $writeHeader = FALSE;
416 $offset += $limit;
417 }
418 }
419
420 /**
421 * Get the values of linked household contact.
422 *
423 * @param CRM_Core_DAO $relDAO
424 * @param array $value
425 * @param string $field
426 * @param array $row
427 */
428 private static function fetchRelationshipDetails($relDAO, $value, $field, &$row) {
429 $phoneTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Phone', 'phone_type_id');
430 $imProviders = CRM_Core_PseudoConstant::get('CRM_Core_DAO_IM', 'provider_id');
431 $i18n = CRM_Core_I18n::singleton();
432 $field = $field . '_';
433
434 foreach ($value as $relationField => $relationValue) {
435 if (is_object($relDAO) && property_exists($relDAO, $relationField)) {
436 $fieldValue = $relDAO->$relationField;
437 if ($relationField == 'phone_type_id') {
438 $fieldValue = $phoneTypes[$relationValue];
439 }
440 elseif ($relationField == 'provider_id') {
441 $fieldValue = CRM_Utils_Array::value($relationValue, $imProviders);
442 }
443 // CRM-13995
444 elseif (is_object($relDAO) && in_array($relationField, [
445 'email_greeting',
446 'postal_greeting',
447 'addressee',
448 ])) {
449 //special case for greeting replacement
450 $fldValue = "{$relationField}_display";
451 $fieldValue = $relDAO->$fldValue;
452 }
453 }
454 elseif (is_object($relDAO) && $relationField == 'state_province') {
455 $fieldValue = CRM_Core_PseudoConstant::stateProvince($relDAO->state_province_id);
456 }
457 elseif (is_object($relDAO) && $relationField == 'country') {
458 $fieldValue = CRM_Core_PseudoConstant::country($relDAO->country_id);
459 }
460 else {
461 $fieldValue = '';
462 }
463 $relPrefix = $field . $relationField;
464
465 if (is_object($relDAO) && $relationField == 'id') {
466 $row[$relPrefix] = $relDAO->contact_id;
467 }
468 elseif (is_array($relationValue) && $relationField == 'location') {
469 foreach ($relationValue as $ltype => $val) {
470 // If the location name has a space in it the we need to handle that. This
471 // is kinda hacky but specifically covered in the ExportTest so later efforts to
472 // improve it should be secure in the knowled it will be caught.
473 $ltype = str_replace(' ', '_', $ltype);
474 foreach (array_keys($val) as $fld) {
475 $type = explode('-', $fld);
476 $fldValue = "{$ltype}-" . $type[0];
477 if (!empty($type[1])) {
478 $fldValue .= "-" . $type[1];
479 }
480 // CRM-3157: localise country, region (both have ‘country’ context)
481 // and state_province (‘province’ context)
482 switch (TRUE) {
483 case (!is_object($relDAO)):
484 $row[$field . '_' . $fldValue] = '';
485 break;
486
487 case in_array('country', $type):
488 case in_array('world_region', $type):
489 $row[$field . '_' . $fldValue] = $i18n->crm_translate($relDAO->$fldValue,
490 ['context' => 'country']
491 );
492 break;
493
494 case in_array('state_province', $type):
495 $row[$field . '_' . $fldValue] = $i18n->crm_translate($relDAO->$fldValue,
496 ['context' => 'province']
497 );
498 break;
499
500 default:
501 $row[$field . '_' . $fldValue] = $relDAO->$fldValue;
502 break;
503 }
504 }
505 }
506 }
507 elseif (isset($fieldValue) && $fieldValue != '') {
508 //check for custom data
509 if ($cfID = CRM_Core_BAO_CustomField::getKeyID($relationField)) {
510 $row[$relPrefix] = CRM_Core_BAO_CustomField::displayValue($fieldValue, $cfID);
511 }
512 else {
513 //normal relationship fields
514 // CRM-3157: localise country, region (both have ‘country’ context) and state_province (‘province’ context)
515 switch ($relationField) {
516 case 'country':
517 case 'world_region':
518 $row[$relPrefix] = $i18n->crm_translate($fieldValue, ['context' => 'country']);
519 break;
520
521 case 'state_province':
522 $row[$relPrefix] = $i18n->crm_translate($fieldValue, ['context' => 'province']);
523 break;
524
525 default:
526 $row[$relPrefix] = $fieldValue;
527 break;
528 }
529 }
530 }
531 else {
532 // if relation field is empty or null
533 $row[$relPrefix] = '';
534 }
535 }
536 }
537
538 /**
539 * Get the ids that we want to get related contact details for.
540 *
541 * @param array $ids
542 * @param int $exportMode
543 *
544 * @return array
545 */
546 protected static function getIDsForRelatedContact($ids, $exportMode) {
547 if ($exportMode == CRM_Export_Form_Select::CONTACT_EXPORT) {
548 return $ids;
549 }
550 if ($exportMode == CRM_Export_Form_Select::ACTIVITY_EXPORT) {
551 $relIDs = [];
552 $sourceID = CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_ActivityContact', 'record_type_id', 'Activity Source');
553 $dao = CRM_Core_DAO::executeQuery("
554 SELECT contact_id FROM civicrm_activity_contact
555 WHERE activity_id IN ( " . implode(',', $ids) . ") AND
556 record_type_id = {$sourceID}
557 ");
558
559 while ($dao->fetch()) {
560 $relIDs[] = $dao->contact_id;
561 }
562 return $relIDs;
563 }
564 $componentMapping = [
565 CRM_Export_Form_Select::CONTRIBUTE_EXPORT => 'civicrm_contribution',
566 CRM_Export_Form_Select::EVENT_EXPORT => 'civicrm_participant',
567 CRM_Export_Form_Select::MEMBER_EXPORT => 'civicrm_membership',
568 CRM_Export_Form_Select::PLEDGE_EXPORT => 'civicrm_pledge',
569 CRM_Export_Form_Select::GRANT_EXPORT => 'civicrm_grant',
570 ];
571
572 if ($exportMode == CRM_Export_Form_Select::CASE_EXPORT) {
573 return CRM_Case_BAO_Case::retrieveContactIdsByCaseId($ids);
574 }
575 else {
576 return CRM_Core_DAO::getContactIDsFromComponent($ids, $componentMapping[$exportMode]);
577 }
578 }
579
580 /**
581 * @param $selectAll
582 * @param $ids
583 * @param \CRM_Export_BAO_ExportProcessor $processor
584 * @param $componentTable
585 */
586 protected static function buildRelatedContactArray($selectAll, $ids, $processor, $componentTable) {
587 $allRelContactArray = $relationQuery = [];
588 $queryMode = $processor->getQueryMode();
589 $exportMode = $processor->getExportMode();
590
591 foreach ($processor->getRelationshipReturnProperties() as $relationshipKey => $relationReturnProperties) {
592 $allRelContactArray[$relationshipKey] = [];
593 // build Query for each relationship
594 $relationQuery = new CRM_Contact_BAO_Query(NULL, $relationReturnProperties,
595 NULL, FALSE, FALSE, $queryMode
596 );
597 list($relationSelect, $relationFrom, $relationWhere, $relationHaving) = $relationQuery->query();
598
599 list($id, $direction) = explode('_', $relationshipKey, 2);
600 // identify the relationship direction
601 $contactA = 'contact_id_a';
602 $contactB = 'contact_id_b';
603 if ($direction == 'b_a') {
604 $contactA = 'contact_id_b';
605 $contactB = 'contact_id_a';
606 }
607 $relIDs = self::getIDsForRelatedContact($ids, $exportMode);
608
609 $relationshipJoin = $relationshipClause = '';
610 if (!$selectAll && $componentTable) {
611 $relationshipJoin = " INNER JOIN {$componentTable} ctTable ON ctTable.contact_id = {$contactA}";
612 }
613 elseif (!empty($relIDs)) {
614 $relID = implode(',', $relIDs);
615 $relationshipClause = " AND crel.{$contactA} IN ( {$relID} )";
616 }
617
618 $relationFrom = " {$relationFrom}
619 INNER JOIN civicrm_relationship crel ON crel.{$contactB} = contact_a.id AND crel.relationship_type_id = {$id}
620 {$relationshipJoin} ";
621
622 //check for active relationship status only
623 $today = date('Ymd');
624 $relationActive = " AND (crel.is_active = 1 AND ( crel.end_date is NULL OR crel.end_date >= {$today} ) )";
625 $relationWhere = " WHERE contact_a.is_deleted = 0 {$relationshipClause} {$relationActive}";
626 CRM_Core_DAO::disableFullGroupByMode();
627 $relationSelect = "{$relationSelect}, {$contactA} as refContact ";
628 $relationQueryString = "$relationSelect $relationFrom $relationWhere $relationHaving GROUP BY crel.{$contactA}";
629
630 $allRelContactDAO = CRM_Core_DAO::executeQuery($relationQueryString);
631 CRM_Core_DAO::reenableFullGroupByMode();
632
633 while ($allRelContactDAO->fetch()) {
634 $relationQuery->convertToPseudoNames($allRelContactDAO);
635 $row = [];
636 // @todo pass processor to fetchRelationshipDetails and set fields directly within it.
637 self::fetchRelationshipDetails($allRelContactDAO, $relationReturnProperties, $relationshipKey, $row);
638 foreach (array_keys($relationReturnProperties) as $property) {
639 if ($property === 'location') {
640 // @todo - simplify location in self::fetchRelationshipDetails - remove handling here. Or just call
641 // $processor->setRelationshipValue from fetchRelationshipDetails
642 foreach ($relationReturnProperties['location'] as $locationName => $locationValues) {
643 foreach (array_keys($locationValues) as $locationValue) {
644 $key = str_replace(' ', '_', $locationName) . '-' . $locationValue;
645 $processor->setRelationshipValue($relationshipKey, $allRelContactDAO->refContact, $key, $row[$relationshipKey . '__' . $key]);
646 }
647 }
648 }
649 else {
650 $processor->setRelationshipValue($relationshipKey, $allRelContactDAO->refContact, $property, $row[$relationshipKey . '_' . $property]);
651 }
652 }
653 }
654 }
655 }
656
657 }