added ConstructionConsentController::deleteAction()
This commit is contained in:
@@ -402,6 +402,7 @@
|
|||||||
if(files.length > 0) {
|
if(files.length > 0) {
|
||||||
$("#consent_plan_image").prop("files", files);
|
$("#consent_plan_image").prop("files", files);
|
||||||
$("#consent_plan_image").change();
|
$("#consent_plan_image").change();
|
||||||
|
window.notify("info", "Plan aus Zwischenablage übernommen.");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -113,11 +113,6 @@ $pagination_entity_name = "Zustimmungserklärungen";
|
|||||||
<th>Objekttyp</th>
|
<th>Objekttyp</th>
|
||||||
<th>Objektadresse</th>
|
<th>Objektadresse</th>
|
||||||
<th>GST-Nr.</th>
|
<th>GST-Nr.</th>
|
||||||
<!-- <th title="Grundstücksnummer">GST-Nr.</th>-->
|
|
||||||
<!-- <th title="Grundbuch Einlagezahl">EZ</th>-->
|
|
||||||
<!-- <th>Besitzer</th>-->
|
|
||||||
<!-- <th>Besitzer Adresse</th>-->
|
|
||||||
<!-- <th>Besitzer Kontakt</th>-->
|
|
||||||
<th>Anfragestatus</th>
|
<th>Anfragestatus</th>
|
||||||
<th>Anfrageresultat</th>
|
<th>Anfrageresultat</th>
|
||||||
<th></th>
|
<th></th>
|
||||||
@@ -139,23 +134,6 @@ $pagination_entity_name = "Zustimmungserklärungen";
|
|||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</td>
|
</td>
|
||||||
<td><?=$item->gst?></td>
|
<td><?=$item->gst?></td>
|
||||||
<!-- <td>--><?php //=$item->ez?><!--</td>-->
|
|
||||||
<!-- <td>--><?php //=$item->owner_name?><!--</td>-->
|
|
||||||
<!-- <td>-->
|
|
||||||
<!-- --><?php //=$item->owner_street?><!--<br />-->
|
|
||||||
<!-- --><?php //=$item->owner_zip?><!-- --><?php //=$item->owner_city?><!--<br />-->
|
|
||||||
<!-- </td>-->
|
|
||||||
<!-- <td>-->
|
|
||||||
<!-- --><?php //if($item->phone): ?>
|
|
||||||
<!-- Tel: --><?php //=$item->phone?><!--<br />-->
|
|
||||||
<!-- --><?php //endif; ?>
|
|
||||||
<!-- --><?php //if($item->fax): ?>
|
|
||||||
<!-- Fax: --><?php //=$item->fax?><!--<br />-->
|
|
||||||
<!-- --><?php //endif; ?>
|
|
||||||
<!-- --><?php //if($item->email): ?>
|
|
||||||
<!-- Email: --><?php //=$item->email?>
|
|
||||||
<!-- --><?php //endif; ?>
|
|
||||||
<!-- </td>-->
|
|
||||||
<td><?=($item->status) ? __($item->status,"consent") : ""?></td>
|
<td><?=($item->status) ? __($item->status,"consent") : ""?></td>
|
||||||
<td>
|
<td>
|
||||||
<?php
|
<?php
|
||||||
@@ -178,9 +156,8 @@ $pagination_entity_name = "Zustimmungserklärungen";
|
|||||||
<?php if(!$item->result): ?>
|
<?php if(!$item->result): ?>
|
||||||
<a href="<?=self::getUrl("ConstructionConsent", "edit", ["id" => $item->id])?>"><i class="far fa-edit" title="Bearbeiten"></i></a>
|
<a href="<?=self::getUrl("ConstructionConsent", "edit", ["id" => $item->id])?>"><i class="far fa-edit" title="Bearbeiten"></i></a>
|
||||||
|
|
||||||
<?php if($item->status == "new"): ?>
|
<a href="<?=self::getUrl("ConstructionConsent", "delete", ["id" => $item->id])?>" onclick="if(!confirm('Zustimmungserklärung wirklich löschen?')) return false;" class="text-danger" title="Löschen"><i class="fas fa-trash"></i></a>
|
||||||
<a href="<?=self::getUrl("ConstructionConsent", "delete", ["id" => $item->id])?>" onclick="if(!confirm('Zustimmungserklärung wirklich löschen?')) return false;" class="text-danger" title="Löschen"><i class="fas fa-trash"></i></a>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,33 @@ class ConstructionConsent extends mfBaseModel {
|
|||||||
return $data;
|
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() {
|
protected function afterSave() {
|
||||||
$this->createHistory();
|
$this->createHistory();
|
||||||
}
|
}
|
||||||
@@ -181,7 +208,7 @@ class ConstructionConsent extends mfBaseModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if($name == "file") {
|
if($name == "file") {
|
||||||
if(!$this->id) return [];
|
if(!$this->id) return null;
|
||||||
$file = ConstructionConsentFile::getFirst(["constructionconsent_id" => $this->id]);
|
$file = ConstructionConsentFile::getFirst(["constructionconsent_id" => $this->id]);
|
||||||
if($file) {
|
if($file) {
|
||||||
$this->file = $file;
|
$this->file = $file;
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ class ConstructionConsentController extends mfBaseController {
|
|||||||
$pagination['maxItems'] = ConstructionConsent::count($filter);
|
$pagination['maxItems'] = ConstructionConsent::count($filter);
|
||||||
$this->layout()->set("pagination", $pagination);
|
$this->layout()->set("pagination", $pagination);
|
||||||
|
|
||||||
$items = ConstructionConsent::search($filter);
|
$items = ConstructionConsent::search($filter, $pagination);
|
||||||
$this->layout->set("items", $items);
|
$this->layout->set("items", $items);
|
||||||
|
|
||||||
if(array_key_exists("project_id", $filter) && $filter["project_id"]) {
|
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() {
|
protected function saveDate() {
|
||||||
$r = $this->request;
|
$r = $this->request;
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,12 @@ class ConstructionConsentFile extends mfBaseModel {
|
|||||||
private $creator;
|
private $creator;
|
||||||
private $editor;
|
private $editor;
|
||||||
|
|
||||||
|
protected function beforeDelete() {
|
||||||
|
if(!$this->id) return true;
|
||||||
|
$this->getProperty("file")->delete();
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public function getProperty($name) {
|
public function getProperty($name) {
|
||||||
if($this->$name == null) {
|
if($this->$name == null) {
|
||||||
|
|||||||
@@ -10,6 +10,15 @@ class ConstructionConsentOwner extends mfBaseModel {
|
|||||||
$this->createHistory();
|
$this->createHistory();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function beforeDelete() {
|
||||||
|
if(!$this->id) return true;
|
||||||
|
foreach($this->getProperty("files") as $file) {
|
||||||
|
$file->delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
protected function beforeUpdate($data) {
|
protected function beforeUpdate($data) {
|
||||||
if(!array_key_exists("edit_by", $data)) {
|
if(!array_key_exists("edit_by", $data)) {
|
||||||
$me = new User();
|
$me = new User();
|
||||||
@@ -45,13 +54,16 @@ class ConstructionConsentOwner extends mfBaseModel {
|
|||||||
if($this->$name == null) {
|
if($this->$name == null) {
|
||||||
|
|
||||||
if($name == "files") {
|
if($name == "files") {
|
||||||
if(!$this->id) return null;
|
if(!$this->id) return [];
|
||||||
$files = ConstructionConsentOwnerFile::search(["constructionconsentowner_id" => $this->id]);
|
$files = ConstructionConsentOwnerFile::search(["constructionconsentowner_id" => $this->id]);
|
||||||
if(count($files)) {
|
|
||||||
foreach($files as $file) {
|
if(!count($files)) {
|
||||||
$this->files[$file->filename] = $file;
|
return [];
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
foreach($files as $file) {
|
||||||
|
$this->files[$file->filename] = $file;
|
||||||
|
}
|
||||||
|
|
||||||
return $this->files;
|
return $this->files;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user