diff --git a/Layout/default/ConstructionConsent/Form.php b/Layout/default/ConstructionConsent/Form.php
index 816cfb362..8acc6dfb5 100644
--- a/Layout/default/ConstructionConsent/Form.php
+++ b/Layout/default/ConstructionConsent/Form.php
@@ -402,6 +402,7 @@
if(files.length > 0) {
$("#consent_plan_image").prop("files", files);
$("#consent_plan_image").change();
+ window.notify("info", "Plan aus Zwischenablage übernommen.");
}
});
diff --git a/Layout/default/ConstructionConsent/Index.php b/Layout/default/ConstructionConsent/Index.php
index 021e31990..82b2ea4c9 100644
--- a/Layout/default/ConstructionConsent/Index.php
+++ b/Layout/default/ConstructionConsent/Index.php
@@ -113,11 +113,6 @@ $pagination_entity_name = "Zustimmungserklärungen";
Objekttyp |
Objektadresse |
GST-Nr. |
-
-
-
-
-
Anfragestatus |
Anfrageresultat |
|
@@ -139,23 +134,6 @@ $pagination_entity_name = "Zustimmungserklärungen";
=$item->gst?> |
-ez?>
-owner_name?>
-
-owner_street?>
-owner_zip?>owner_city?>
-
-
-phone): ?>
-phone?>
-
-fax): ?>
-fax?>
-
-email): ?>
-email?>
-
-
=($item->status) ? __($item->status,"consent") : ""?> |
result): ?>
$item->id])?>">
- status == "new"): ?>
- $item->id])?>" onclick="if(!confirm('Zustimmungserklärung wirklich löschen?')) return false;" class="text-danger" title="Löschen">
-
+ $item->id])?>" onclick="if(!confirm('Zustimmungserklärung wirklich löschen?')) return false;" class="text-danger" title="Löschen">
+
diff --git a/application/ConstructionConsent/ConstructionConsent.php b/application/ConstructionConsent/ConstructionConsent.php
index 51d997be9..37243778f 100644
--- a/application/ConstructionConsent/ConstructionConsent.php
+++ b/application/ConstructionConsent/ConstructionConsent.php
@@ -34,6 +34,33 @@ class ConstructionConsent extends mfBaseModel {
return $data;
}
+ protected function beforeDelete() {
+ if(!$this->id) return true;
+ // delete owners
+ foreach($this->getProperty("owners") as $owner) {
+ $owner->delete();
+ }
+ // delete contacts
+ foreach($this->getProperty("contacts") as $contact) {
+ $contact->delete();
+ }
+ // delete journals
+ foreach($this->getProperty("journal") as $journal) {
+ $journal->delete();
+ }
+ // delete history
+ foreach($this->getProperty("history") as $history) {
+ $history->delete();
+ }
+ // delete files
+ if($this->getProperty("file")) {
+ $this->getProperty("file")->delete();
+ }
+
+ return true;
+
+ }
+
protected function afterSave() {
$this->createHistory();
}
@@ -181,7 +208,7 @@ class ConstructionConsent extends mfBaseModel {
}
if($name == "file") {
- if(!$this->id) return [];
+ if(!$this->id) return null;
$file = ConstructionConsentFile::getFirst(["constructionconsent_id" => $this->id]);
if($file) {
$this->file = $file;
diff --git a/application/ConstructionConsent/ConstructionConsentController.php b/application/ConstructionConsent/ConstructionConsentController.php
index 48a398d74..339afd66d 100644
--- a/application/ConstructionConsent/ConstructionConsentController.php
+++ b/application/ConstructionConsent/ConstructionConsentController.php
@@ -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;
diff --git a/application/ConstructionConsentFile/ConstructionConsentFile.php b/application/ConstructionConsentFile/ConstructionConsentFile.php
index 8f0628888..359116205 100644
--- a/application/ConstructionConsentFile/ConstructionConsentFile.php
+++ b/application/ConstructionConsentFile/ConstructionConsentFile.php
@@ -5,6 +5,12 @@ class ConstructionConsentFile extends mfBaseModel {
private $creator;
private $editor;
+ protected function beforeDelete() {
+ if(!$this->id) return true;
+ $this->getProperty("file")->delete();
+ return true;
+
+ }
public function getProperty($name) {
if($this->$name == null) {
diff --git a/application/ConstructionConsentOwner/ConstructionConsentOwner.php b/application/ConstructionConsentOwner/ConstructionConsentOwner.php
index 852705610..d5294779c 100644
--- a/application/ConstructionConsentOwner/ConstructionConsentOwner.php
+++ b/application/ConstructionConsentOwner/ConstructionConsentOwner.php
@@ -10,6 +10,15 @@ class ConstructionConsentOwner extends mfBaseModel {
$this->createHistory();
}
+ protected function beforeDelete() {
+ if(!$this->id) return true;
+ foreach($this->getProperty("files") as $file) {
+ $file->delete();
+ }
+
+ return true;
+ }
+
protected function beforeUpdate($data) {
if(!array_key_exists("edit_by", $data)) {
$me = new User();
@@ -45,13 +54,16 @@ class ConstructionConsentOwner extends mfBaseModel {
if($this->$name == null) {
if($name == "files") {
- if(!$this->id) return null;
+ if(!$this->id) return [];
$files = ConstructionConsentOwnerFile::search(["constructionconsentowner_id" => $this->id]);
- if(count($files)) {
- foreach($files as $file) {
- $this->files[$file->filename] = $file;
- }
+
+ if(!count($files)) {
+ return [];
}
+ foreach($files as $file) {
+ $this->files[$file->filename] = $file;
+ }
+
return $this->files;
}
|