Added emailtemplate for Cancel notification
This commit is contained in:
@@ -195,6 +195,7 @@ class ContractController extends mfBaseController
|
||||
$this->redirect("Contract", "cancel", ["contract_id" => $contract->id]);
|
||||
}
|
||||
|
||||
$linked_contracts = [];
|
||||
if(is_array($r->links)) {
|
||||
foreach($r->links as $link_id => $action) {
|
||||
if($action == "cancel") {
|
||||
@@ -205,6 +206,8 @@ class ContractController extends mfBaseController
|
||||
continue;
|
||||
}
|
||||
|
||||
$linked_contracts[] = $link_contract;
|
||||
|
||||
$link_contract->cancel_date = $cancel_date->getTimestamp();
|
||||
if(!$link_contract->save()) {
|
||||
$this->layout()->setFlash("Fehler beim Speichern von verlinktem Vertrag", "warning");
|
||||
@@ -213,11 +216,38 @@ class ContractController extends mfBaseController
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$this->layout()->setFlash("Kündigung gespeichert", "success");
|
||||
$this->redirect("Contract", "view", ["contract_id" => $contract->id]);
|
||||
|
||||
}
|
||||
|
||||
protected function sendCancelNotification() {
|
||||
$contract_id = $this->request->contract_id;
|
||||
$contract = new Contract($contract_id);
|
||||
|
||||
$linked_contracts = [];
|
||||
foreach($contract->links as $link) {
|
||||
if($link->origin_contract_id == $contract_id) {
|
||||
$link_contract = $link->contract;
|
||||
} else {
|
||||
$link_contract = $link->origin;
|
||||
}
|
||||
if($link_contract->owner_id != $contract->owner_id) continue;
|
||||
$linked_contracts[] = $link_contract;
|
||||
}
|
||||
|
||||
$contract->sendCancelNotification($linked_contracts);
|
||||
|
||||
$this->layout()->setFlash("gesendet", "success");
|
||||
$this->redirect("Contract", "view", ["contract_id" => $contract_id]);
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected function productchangeAction()
|
||||
{
|
||||
$this->layout()->setTemplate("Contract/ProductchangeForm");
|
||||
|
||||
Reference in New Issue
Block a user