Auto Calculating LAEA and code in Building::save
This commit is contained in:
@@ -23,6 +23,7 @@ class BuildingController extends mfBaseController {
|
||||
$this->layout()->setTemplate("Building/Form");
|
||||
$this->layout()->set("networks", NetworkModel::getAll());
|
||||
$this->layout()->set("types", BuildingtypeModel::getAll());
|
||||
$this->layout()->set("statuses", BuildingstatusModel::getAll());
|
||||
}
|
||||
|
||||
protected function editAction() {
|
||||
@@ -83,7 +84,6 @@ class BuildingController extends mfBaseController {
|
||||
$data['description'] = $r->description;
|
||||
$data['note'] = $r->note;
|
||||
|
||||
|
||||
$data['edit_by'] = 1;
|
||||
|
||||
if($mode == "add") {
|
||||
@@ -102,6 +102,16 @@ class BuildingController extends mfBaseController {
|
||||
$this->layout()->set("building", $building);
|
||||
return $this->add();
|
||||
}
|
||||
|
||||
// generate object code and LAEA coords
|
||||
if(!$building->code) {
|
||||
$building->code = $building->getNewObjectCode();
|
||||
$building->save();
|
||||
}
|
||||
if(!$building->laea) {
|
||||
$building->laea = $building->getLaeaCoordinates();
|
||||
$building->save();
|
||||
}
|
||||
|
||||
|
||||
$this->layout()->setFlash("Objekt erfolgreich gespeichert.", "success");
|
||||
|
||||
Reference in New Issue
Block a user