conditional oaid assignment on unit creation
This commit is contained in:
@@ -370,7 +370,9 @@ class AddressDBController extends mfBaseController {
|
||||
$this->layout()->setFlash("Fehler beim Erstellen einer Wohneinheit!", "warning");
|
||||
return $this->addAction();
|
||||
}
|
||||
$wohneinheit->oaid = $wohneinheit->getNewOAID();
|
||||
if($hausnummer->netzgebiet->unit_create_oaid) {
|
||||
$wohneinheit->oaid = $wohneinheit->getNewOAID();
|
||||
}
|
||||
$wohneinheit->save();
|
||||
$w++;
|
||||
}
|
||||
@@ -472,6 +474,9 @@ class AddressDBController extends mfBaseController {
|
||||
case 'findBuildings':
|
||||
$return = $this->findBuildingsApi();
|
||||
break;
|
||||
case 'getUnit':
|
||||
$return = $this->getUnitApi();
|
||||
break;
|
||||
case "findUnit":
|
||||
break;
|
||||
default:
|
||||
@@ -487,6 +492,18 @@ class AddressDBController extends mfBaseController {
|
||||
$this->returnJson($data);
|
||||
}
|
||||
|
||||
private function getUnitApi() {
|
||||
$id = $this->request->id;
|
||||
if(!$id) return false;
|
||||
|
||||
$unit = new ADBWohneinheit($id);
|
||||
if(!$unit->id) return false;
|
||||
|
||||
$return = $unit->hausnummer->getAddress();
|
||||
if((string)$unit) $return .= " ".(string)$unit;
|
||||
return["string" => $return];
|
||||
}
|
||||
|
||||
private function findAddressApi() {
|
||||
$addresses = [];
|
||||
$search = trim($this->request->q);
|
||||
|
||||
Reference in New Issue
Block a user