|
@@ 81-101 (lines=21) @@
|
| 78 |
|
return true; |
| 79 |
|
} |
| 80 |
|
|
| 81 |
|
protected function sendSubmittedEmail(DNDeployment $deployment) { |
| 82 |
|
if (!$this->canSendEmail($deployment)) { |
| 83 |
|
return false; |
| 84 |
|
} |
| 85 |
|
$deployer = $deployment->Deployer(); |
| 86 |
|
$approver = $deployment->Approver(); |
| 87 |
|
|
| 88 |
|
$email = Email::create(); |
| 89 |
|
$email->setTo(sprintf('%s <%s>', $approver->Name, $approver->Email)); |
| 90 |
|
$email->replyTo(sprintf('%s <%s>', $deployer->Name, $deployer->Email)); |
| 91 |
|
$email->setSubject(sprintf('%s has submitted a deployment for your approval', $deployer->Name)); |
| 92 |
|
$email->setTemplate('DeploymentSubmittedEmail'); |
| 93 |
|
$email->populateTemplate($deployment); |
| 94 |
|
$email->send(); |
| 95 |
|
|
| 96 |
|
$deployment->log()->write(sprintf( |
| 97 |
|
'Deployment submitted email sent to approver %s <%s>', |
| 98 |
|
$approver->Name, |
| 99 |
|
$approver->Email |
| 100 |
|
)); |
| 101 |
|
} |
| 102 |
|
|
| 103 |
|
protected function sendApprovedEmail(DNDeployment $deployment) { |
| 104 |
|
if (!$this->canSendEmail($deployment)) { |
|
@@ 124-144 (lines=21) @@
|
| 121 |
|
)); |
| 122 |
|
} |
| 123 |
|
|
| 124 |
|
protected function sendRejectedEmail(DNDeployment $deployment) { |
| 125 |
|
if (!$this->canSendEmail($deployment)) { |
| 126 |
|
return false; |
| 127 |
|
} |
| 128 |
|
$deployer = $deployment->Deployer(); |
| 129 |
|
$approver = $deployment->Approver(); |
| 130 |
|
|
| 131 |
|
$email = Email::create(); |
| 132 |
|
$email->setTo(sprintf('%s <%s>', $deployer->Name, $deployer->Email)); |
| 133 |
|
$email->replyTo(sprintf('%s <%s>', $approver->Name, $approver->Email)); |
| 134 |
|
$email->setSubject(sprintf('Your deployment has been rejected by %s', $approver->Name)); |
| 135 |
|
$email->setTemplate('DeploymentRejectedEmail'); |
| 136 |
|
$email->populateTemplate($deployment); |
| 137 |
|
$email->send(); |
| 138 |
|
|
| 139 |
|
$deployment->log()->write(sprintf( |
| 140 |
|
'Deployment rejected email sent to requester %s <%s>', |
| 141 |
|
$deployer->Name, |
| 142 |
|
$deployer->Email |
| 143 |
|
)); |
| 144 |
|
} |
| 145 |
|
|
| 146 |
|
protected function sendApprovalCancellationEmail(DNDeployment $deployment) { |
| 147 |
|
if (!$this->canSendEmail($deployment)) { |