Added Service PIN PDF+Email to Address

This commit is contained in:
Frank Schubert
2025-04-03 17:05:13 +02:00
parent cfe2924961
commit bcc42d5b9c
5 changed files with 209 additions and 2 deletions

View File

@@ -705,4 +705,31 @@ class AddressController extends mfBaseController {
Helper::renderVue($this,"AddressTickets",
"Tickets von Kunden: " . $address->getCompanyOrName() . '(' . $address->customer_number . ')', ["TICKETS" => $tickets]);
}
protected function sendServicePinAction() {
$address_id = $this->request->id;
if(!is_numeric($address_id) || !$address_id) {
$this->layout->setFlash("Adresse nicht gefunden!", "error");
$this->redirect("Address");
}
$address = new Address($address_id);
if(!$address->id) {
$this->layout->setFlash("Adresse nicht gefunden!", "error");
$this->redirect("Address");
}
if(!$address->customer_number || !$address->spin) {
$this->layout->setFlash("Kunde hat keine Kundennummer oder keinen Service PIN!", "error");
$this->redirect("Address");
}
if($address->sendSpinEmail()) {
$this->layout()->setFlash("Service PIN wurde erfolgreich versendet.", "success");
} else {
$this->layout()->setFlash("Fehler beim SPIN Versand!", "success");
}
$this->redirect("Address");
}
}