Permalink
Browse files

Newsletter import: only send a change notification email if there are…

… changes to be sent

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/branches/2.2.2@52427 467b73ca-7a2a-4603-9d3b-597d59a354a9
  • Loading branch information...
1 parent 10fcb38 commit bec364614876731695398c9fbaaa8b10040a37f8 @sminnee sminnee committed Apr 9, 2008
Showing with 11 additions and 9 deletions.
  1. +11 −9 code/Newsletter/RecipientImportField.php
@@ -363,7 +363,7 @@ protected function importMembers( $id, $group, $cols, $setFields, $primaryColTyp
}
$numChangedFields = count( $changedFields );
- $this->notifyChanges( $changedFields );
+ if($changedFields) $this->notifyChanges( $changedFields );
// TODO Refresh window
$customData = array(
@@ -385,17 +385,19 @@ function findMember( $email ) {
}
function notifyChanges( $changes ) {
- $email = new Email( Email::getAdminEmail(), Email::getAdminEmail(), 'Changed Fields' );
+ if($changes) {
+ $email = new Email( Email::getAdminEmail(), Email::getAdminEmail(), 'Changed Fields' );
- $body = "";
+ $body = "";
- foreach( $changes as $change ) {
- $body .= "-------------------------------\n";
- $body .= implode( ' ', $change ) . "\n";
- }
+ foreach( $changes as $change ) {
+ $body .= "-------------------------------\n";
+ $body .= implode( ' ', $change ) . "\n";
+ }
- $email->setBody( $body );
- $email->send();
+ $email->setBody( $body );
+ $email->send();
+ }
}
}
?>

0 comments on commit bec3646

Please sign in to comment.