added new features
This commit is contained in:
@@ -20,14 +20,16 @@ class ConstructionConsentOwnerController extends mfBaseController
|
||||
|
||||
protected function uploadDocumentAction() {
|
||||
$owner_id = $this->request->owner_id;
|
||||
$filename = trim($this->request->name);
|
||||
|
||||
$owner = new ConstructionConsentOwner($owner_id);
|
||||
if(!$owner->id) {
|
||||
$this->layout()->setFlash("Besitzer nicht gefunden!", "error");
|
||||
$this->redirect("ConstructionConsent");
|
||||
}
|
||||
|
||||
$constructionConsent = new ConstructionConsent($owner->constructionconsent_id);
|
||||
$filename = "ZU_KG" . $constructionConsent->kg . "_EZ" . $constructionConsent->ez . "_GST" . $constructionConsent->gst . "_" . $constructionConsent->name . "_" . $owner->lastname . ".pdf";
|
||||
$_FILES['consentOwnerUpload']['name'] = $filename;
|
||||
|
||||
if(is_array($_FILES) && array_key_exists("consentOwnerUpload", $_FILES) && !$_FILES['consentOwnerUpload']['error']) {
|
||||
try {
|
||||
// returns File object or throws Exception on error
|
||||
@@ -221,4 +223,23 @@ class ConstructionConsentOwnerController extends mfBaseController
|
||||
return ["message" => "Result saved successfully", "update" => ["id" => $owner->id, "result" => $owner->result, "result_text" => __($owner->result, "consent")]];
|
||||
|
||||
}
|
||||
|
||||
protected function searchOwnerAction() {
|
||||
$search = $this->request->search;
|
||||
|
||||
$results = PreorderModel::search(['add-where' => " AND firstname LIKE '%$search%' OR lastname LIKE '%$search%'"]);
|
||||
self::returnJson(array_map(function($result) {
|
||||
return [
|
||||
'id' => $result->id,
|
||||
'firstname' => $result->firstname,
|
||||
'lastname' => $result->lastname,
|
||||
'street' => $result->street,
|
||||
'zip' => $result->zip,
|
||||
'city' => $result->city,
|
||||
'phone' => $result->phone,
|
||||
'email' => $result->email,
|
||||
'text' => $result->firstname . " " . $result->lastname . " (" . $result->street . ", " . $result->zip . " " . $result->city . ") [" . $result->phone . " | " . $result->email . "]"
|
||||
];
|
||||
}, $results));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user