fixed multiple stuff
This commit is contained in:
@@ -156,6 +156,50 @@ class ConstructionConsentOwnerController extends mfBaseController
|
||||
|
||||
}
|
||||
|
||||
protected function deleteFileAction() {
|
||||
// display errors
|
||||
ini_set('display_errors', 1);
|
||||
ini_set('display_startup_errors', 1);
|
||||
error_reporting(E_ALL);
|
||||
$id = $this->request->id;
|
||||
|
||||
$file = new ConstructionConsentOwnerFile($id);
|
||||
if(!$file->id) {
|
||||
$this->layout()->setFlash("Datei nicht gefunden!", "error");
|
||||
$this->redirect("ConstructionConsent");
|
||||
}
|
||||
|
||||
$owner = new ConstructionConsentOwner($file->constructionconsentowner_id);
|
||||
if(!$owner->id) {
|
||||
$this->layout()->setFlash("Besitzer nicht gefunden!", "error");
|
||||
$this->redirect("ConstructionConsent");
|
||||
}
|
||||
|
||||
$consent = $owner->consent;
|
||||
if(!$consent->id) {
|
||||
$this->layout()->setFlash("Zustimmungserklärung nicht gefunden!", "error");
|
||||
$this->redirect("ConstructionConsent");
|
||||
}
|
||||
|
||||
$project = new ConstructionConsentProject($consent->constructionconsentproject_id);
|
||||
|
||||
if(!$project->id) {
|
||||
$this->layout()->setFlash("Zustimmungserklärungsprojekt nicht gefunden!", "error");
|
||||
$this->redirect("ConstructionConsent");
|
||||
}
|
||||
|
||||
if (!in_array($project->id, $this->constructionConsentProjects)) {
|
||||
$this->layout()->setFlash("Sie sind nicht berechtigt, diese Zustimmungserklärung zu bearbeiten", "error");
|
||||
$this->redirect("ConstructionConsent");
|
||||
}
|
||||
|
||||
$file->file->delete();
|
||||
$file->delete();
|
||||
|
||||
$this->layout()->setFlash("Datei gelöscht!", "success");
|
||||
$this->redirect("ConstructionConsent", "View", ["id" => $owner->constructionconsent_id]);
|
||||
}
|
||||
|
||||
protected function apiAction() {
|
||||
$do = $this->request->do;
|
||||
$data = [];
|
||||
|
||||
Reference in New Issue
Block a user