Added productchange notification ticket email
This commit is contained in:
@@ -197,7 +197,7 @@
|
|||||||
?>
|
?>
|
||||||
<tr data-link-type="<?=$link->type?>" class="<?=($hide_credit && $link->type == "credit") ? "hidden" : ""?>">
|
<tr data-link-type="<?=$link->type?>" class="<?=($hide_credit && $link->type == "credit") ? "hidden" : ""?>">
|
||||||
<td>
|
<td>
|
||||||
<input type="radio" class="form-check link-keep"
|
<input type="radio" class="form-check link-keep pointer"
|
||||||
id="link-<?=$link->id?>-action-keep"
|
id="link-<?=$link->id?>-action-keep"
|
||||||
name="links[<?=$link->id?>][action]"
|
name="links[<?=$link->id?>][action]"
|
||||||
value="keep" <?=($linkcontract->cancel_date && $linkcontract->cancel_date < date('U')) ? "" : "checked='checked'"?>
|
value="keep" <?=($linkcontract->cancel_date && $linkcontract->cancel_date < date('U')) ? "" : "checked='checked'"?>
|
||||||
@@ -207,7 +207,7 @@
|
|||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="radio" class="form-check link-cancel"
|
<input type="radio" class="form-check link-cancel pointer"
|
||||||
id="link-<?=$link->id?>-action-cancel"
|
id="link-<?=$link->id?>-action-cancel"
|
||||||
name="links[<?=$link->id?>][action]" value="cancel"
|
name="links[<?=$link->id?>][action]" value="cancel"
|
||||||
onchange="linkActionChange(<?=$link->id?>)" />
|
onchange="linkActionChange(<?=$link->id?>)" />
|
||||||
|
|||||||
@@ -0,0 +1,47 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @var Contract $contract
|
||||||
|
* @var Contract $origin
|
||||||
|
*/
|
||||||
|
$this->setReturnValue([
|
||||||
|
'subject' => "Produktwechsel ".$contract->owner->getCompanyOrName(),
|
||||||
|
'from_email' => "workspace.admin@xinon.at",
|
||||||
|
'from_email_name' => "thetool"
|
||||||
|
]);
|
||||||
|
|
||||||
|
$url_prefix = "http".($_SERVER["HTTPS"] ? "s" : "")."://".$_SERVER["HTTP_HOST"];
|
||||||
|
?>
|
||||||
|
project: storungen-and-support
|
||||||
|
type: Produktwechsel
|
||||||
|
status: Neu
|
||||||
|
priority: Residential
|
||||||
|
Kundenname: <?=str_replace(["\n", "\r"], "", $contract->owner->getCompanyOrName())?>
|
||||||
|
|
||||||
|
Telefon: <?=$contract->owner->phone?>
|
||||||
|
|
||||||
|
e-Mail: <?=$contract->owner->email?>
|
||||||
|
|
||||||
|
Kundennummer: <?=$contract->owner->customer_number?>
|
||||||
|
|
||||||
|
Kunde: <?=str_replace(["\n", "\r"], "", $contract->owner->getCompanyOrName())?>
|
||||||
|
|
||||||
|
|
||||||
|
### Altes Produkt:
|
||||||
|
Vertragsinhaber: <?=$origin->owner->getCompanyOrName()?> [<?=$origin->owner->customer_number?>]
|
||||||
|
Produkt: <?=$origin->product_name?>
|
||||||
|
|
||||||
|
<?=$url_prefix?><?=self::getUrl("Contract", "view", ["contract_id" => $origin->id])?>
|
||||||
|
|
||||||
|
|
||||||
|
### Neues Produkt:
|
||||||
|
Vertragsinhaber: <?=$contract->owner->getCompanyOrName()?> [<?=$contract->owner->customer_number?>]
|
||||||
|
Produkt: <?=$contract->product_name?>
|
||||||
|
|
||||||
|
<?=$url_prefix?><?=self::getUrl("Contract", "view", ["contract_id" => $contract->id])?>
|
||||||
|
|
||||||
|
|
||||||
|
<?php if($contract->finish_date): ?>
|
||||||
|
Neues Produkt hat fertigstellungdatum, somit ist nach der technischen Umstellung nichts mehr zu machen.
|
||||||
|
<?php else: ?>
|
||||||
|
⚠️ Neues Produkt muss nach der technischen Umstellung in thetool FERTIGGESTELLT werden.
|
||||||
|
<?php endif; ?>
|
||||||
@@ -399,6 +399,32 @@ class Contract extends mfBaseModel {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function sendProductchangeNotification(Contract $origin) {
|
||||||
|
$tk_tpl = new Layout();
|
||||||
|
$tk_tpl->setTemplate("Emailtemplates/order/productchange-ticket");
|
||||||
|
|
||||||
|
$tpl_vars = [
|
||||||
|
"contract" => $this,
|
||||||
|
"origin" => $origin
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach($tpl_vars as $name => $val) {
|
||||||
|
$tk_tpl->set($name, $val);
|
||||||
|
}
|
||||||
|
|
||||||
|
$tk_body = $tk_tpl->render();
|
||||||
|
$tk_values = $tk_tpl->getReturnedValue();
|
||||||
|
|
||||||
|
$tk_email = new Emailnotification();
|
||||||
|
$tk_email->setSubject($tk_values["subject"]);
|
||||||
|
$tk_email->setBody($tk_body);
|
||||||
|
$tk_email->setFrom($tk_values["from_email"], $tk_values["from_email_name"]);
|
||||||
|
$tk_email->setTo("workspace@xinon.at");
|
||||||
|
$tk_email->setHeader("X-" . MFAPPNAME . "-Cid", $this->id);
|
||||||
|
$tk_email->send();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public function getProperty($name) {
|
public function getProperty($name) {
|
||||||
if($this->$name == null) {
|
if($this->$name == null) {
|
||||||
|
|
||||||
@@ -628,6 +654,11 @@ class Contract extends mfBaseModel {
|
|||||||
$old_id = $this->id;
|
$old_id = $this->id;
|
||||||
$this->id = null;
|
$this->id = null;
|
||||||
|
|
||||||
|
$data = $this->data;
|
||||||
|
$this->data = new stdClass();
|
||||||
|
foreach($data as $key => $value) {
|
||||||
|
$this->data->$key = $value;
|
||||||
|
}
|
||||||
|
|
||||||
// cleanup Contract daten
|
// cleanup Contract daten
|
||||||
$this->orderproduct_id = null;
|
$this->orderproduct_id = null;
|
||||||
|
|||||||
@@ -593,6 +593,8 @@ class ContractController extends mfBaseController
|
|||||||
$this->layout()->setFlash("Konnte Verknüpfung nicht speichern", "warn");
|
$this->layout()->setFlash("Konnte Verknüpfung nicht speichern", "warn");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$new_contract->sendProductchangeNotification($contract);
|
||||||
|
|
||||||
$this->layout()->setFlash("Produktwechsel erfolgreich erstellt", "success");
|
$this->layout()->setFlash("Produktwechsel erfolgreich erstellt", "success");
|
||||||
if($f == "o") {
|
if($f == "o") {
|
||||||
$this->redirect("Order");
|
$this->redirect("Order");
|
||||||
|
|||||||
Reference in New Issue
Block a user