Skip to content

Commit

Permalink
refs #39633, fixes sync error message
Browse files Browse the repository at this point in the history
  • Loading branch information
jimyhuang committed Jun 7, 2024
1 parent 4e662fd commit 3ea85a8
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
18 changes: 17 additions & 1 deletion CRM/Mailing/External/SmartMarketing.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,25 @@ public static function syncGroup($groupId) {
);
}
}
else {
return array(
'batch' => FALSE,
'batch_id' => 0,
'result' => array(
'#report' => array('error' => ts('Please provide at least 1 contact.')),
),
);
}
}
}
return array();

return array(
'batch' => FALSE,
'batch_id' => 0,
'result' => array(
'#report' => array('error' => ts('The group you request doesn\'t exists in flydove.')),
),
);
}

public static function getProviderByGroup($groupId) {
Expand Down
8 changes: 6 additions & 2 deletions CRM/Mailing/Page/AJAX.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public static function addContactToRemote() {
'message' => '<p>'.ts('Because of the large amount of data you are about to perform, we have scheduled this job for the batch process. You will receive an email notification when the work is completed.'). '</p><p>&raquo; <a href="'.CRM_Utils_System::url('civicrm/admin/batch', "reset=1&id={$syncResult['batch_id']}").'" target="_blank">'.ts('Batch Job List').'</a></p>',
);
}
elseif (!empty($syncResult['result']['#report'])) {
elseif (!empty($syncResult['result']['#count']) && !empty($syncResult['result']['#report'])) {
$report = ts('Successful synced');
foreach($syncResult['result']['#report'] as $rep) {
$report .= "<p>$rep</p>";
Expand All @@ -94,9 +94,13 @@ public static function addContactToRemote() {
);
}
else {
$report = ts('Synchronize error').': ';
foreach($syncResult['result']['#report'] as $rep) {
$report .= "<span>$rep</span>";
}
$remoteResult = array(
'success' => FALSE,
'message' => ts('Synchronize error').':'.$syncResult,
'message' => $report,
);
}
}
Expand Down

0 comments on commit 3ea85a8

Please sign in to comment.