added ConstructionConsentController::deleteAction()

This commit is contained in:
Frank Schubert
2025-02-14 16:19:05 +01:00
parent 61b192e1c9
commit 7575ef05fb
6 changed files with 74 additions and 32 deletions

View File

@@ -70,7 +70,7 @@ class ConstructionConsentController extends mfBaseController {
$pagination['maxItems'] = ConstructionConsent::count($filter);
$this->layout()->set("pagination", $pagination);
$items = ConstructionConsent::search($filter);
$items = ConstructionConsent::search($filter, $pagination);
$this->layout->set("items", $items);
if(array_key_exists("project_id", $filter) && $filter["project_id"]) {
@@ -320,6 +320,25 @@ class ConstructionConsentController extends mfBaseController {
}
protected function deleteAction() {
$id = $this->request->id;
if(!is_numeric($id) || $id < 1) {
$this->layout()->setFlash("Zustimmungserklärung nicht gefunden", "error");
$this->redirect("ConstructionConsent");
}
$item = new ConstructionConsent($id);
if(!$item->id) {
$this->layout()->setFlash("Zustimmungserklärung nicht gefunden", "error");
$this->redirect("ConstructionConsent");
}
$item->delete();
$this->layout()->setFlash("Zustimmungserklärung erfolgreich gelöscht", "success");
$this->redirect("ConstructionConsent");
}
protected function saveDate() {
$r = $this->request;