Merge branch 'fronkdev' into 'master'
counting units again after deleting unit See merge request fronk/thetool!1113
This commit is contained in:
@@ -140,6 +140,20 @@ class ADBWohneinheitController extends mfBaseController {
|
||||
$this->redirect("AddressDB", "view", ["id" => $hausnummer_id]);
|
||||
}
|
||||
|
||||
if(ADBWohneinheitModel::count(["hausnummer_id" => $hausnummer_id])) {
|
||||
$count_unit = ADBWohneinheitModel::getFirst(["hausnummer_id" => $hausnummer_id]);
|
||||
if($count_unit) {
|
||||
$count_unit->refreshUnitCount();
|
||||
}
|
||||
} else {
|
||||
$hausnummer = new ADBHausnummer($hausnummer_id);
|
||||
if($hausnummer->id) {
|
||||
$hausnummer->unit_count = 0;
|
||||
$hausnummer->save();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$this->layout()->setFlash("Wohneinheit erfolgreich gelöscht.", "success");
|
||||
$this->redirect("AddressDB", "view", ["id" => $hausnummer_id]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user