Added admin-button to remove OAID from Wohneinheit
This commit is contained in:
@@ -177,6 +177,10 @@
|
|||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<?=$unit->oaid?>
|
<?=$unit->oaid?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?php if($me->is("Admin")): ?>
|
||||||
|
<a class="text-danger ml-2" href="<?=self::getUrl("ADBWohneinheit", "removeOaid", ["id" => $unit->id])?>" title="OAID von Wohneinheit entfernen" onclick="if(!confirm('OAID wirklich ungeprüft von der Wohneinheit entfernen?')) return false;"><i class="fas fa-trash-can"></i></a>
|
||||||
|
<?php endif; ?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</td>
|
</td>
|
||||||
<td id="unit-<?=$unit->id?>-status" class="text-monospace">
|
<td id="unit-<?=$unit->id?>-status" class="text-monospace">
|
||||||
|
|||||||
@@ -159,6 +159,32 @@ class ADBWohneinheitController extends mfBaseController {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function removeOaid() {
|
||||||
|
$id = $this->request->id;
|
||||||
|
if(!is_numeric($id) || $id < 1) {
|
||||||
|
$this->layout()->setFlash("Wohneinheit nicht gefunden", "error");
|
||||||
|
$this->redirect("AddressDB");
|
||||||
|
}
|
||||||
|
|
||||||
|
$unit = new ADBWohneinheit($id);
|
||||||
|
if(!$unit->id) {
|
||||||
|
$this->layout()->setFlash("Wohneinheit nicht gefunden", "error");
|
||||||
|
$this->redirect("AddressDB");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!$unit->oaid) {
|
||||||
|
$this->layout()->setFlash("Wohneinheit hat keine OAID.", "error");
|
||||||
|
$this->redirect("AddressDB", "view", ["id" => $unit->hausnummer_id]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$unit->oaid = null;
|
||||||
|
$unit->save();
|
||||||
|
|
||||||
|
$this->layout()->setFlash("OAID erfolgreich entfernt.", "success");
|
||||||
|
$this->redirect("AddressDB", "view", ["id" => $unit->hausnummer_id]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
protected function duplicateAction() {
|
protected function duplicateAction() {
|
||||||
$duplicateHomes = array_merge(ADBWohneinheitModel::searchDuplicateExtref(),
|
$duplicateHomes = array_merge(ADBWohneinheitModel::searchDuplicateExtref(),
|
||||||
ADBWohneinheitModel::searchDuplicateOAID(),
|
ADBWohneinheitModel::searchDuplicateOAID(),
|
||||||
|
|||||||
Reference in New Issue
Block a user