OAIDs can be released now
This commit is contained in:
@@ -86,7 +86,56 @@ class OpenAccessIdController extends mfBaseController {
|
||||
|
||||
return $new_filter;
|
||||
}
|
||||
|
||||
|
||||
protected function releaseAction() {
|
||||
$id = $this->request->id;
|
||||
if(!$id || $id <1) {
|
||||
$this->layout()->setFlash("Ungültige OAID", "error");
|
||||
$this->redirect("OpenAccessId");
|
||||
}
|
||||
|
||||
$oaid = new OpenAccessId($id);
|
||||
if(!$oaid->id) {
|
||||
$this->layout()->setFlash("Ungültige OAID", "error");
|
||||
$this->redirect("OpenAccessId");
|
||||
}
|
||||
|
||||
$oaid->startTransaction();
|
||||
|
||||
// remove from Preorders
|
||||
foreach(PreorderModel::search(["oaid" => $oaid->oaid]) as $preorder) {
|
||||
$preorder->oaid = null;
|
||||
$preorder->save(["no_oaid_update" => true, "dont_cascade" => true]);
|
||||
}
|
||||
|
||||
// remove from Wohneinheiten
|
||||
foreach(ADBWohneinheitModel::search(["oaid" => $oaid->oaid]) as $unit) {
|
||||
$unit->oaid = null;
|
||||
$unit->save(["no_updates" => 1]);
|
||||
|
||||
$ftu_id = $unit->ftu_data["id"];
|
||||
if($ftu_id) {
|
||||
$this->log->debug(__METHOD__.": trying to unassign Oaid ".$oaid->oaid." from Rimo FTU ".$ftu_id);
|
||||
//Rimoapi::unassignOaid($oaid->oaid, $ftu_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$oaid->assigned = 0;
|
||||
$oaid->adb_wohneinheit_id = null;
|
||||
$oaid->exported = 0;
|
||||
$oaid->exported_to = null;
|
||||
$oaid->export_data = null;
|
||||
$oaid->address = null;
|
||||
$oaid->unit_string = null;
|
||||
$oaid->save();
|
||||
|
||||
$oaid->commitTransaction();
|
||||
|
||||
$this->layout()->setFlash("OAID erfolgreich freigegeben");
|
||||
$this->redirect("OpenAccessId");
|
||||
}
|
||||
|
||||
protected function changeADBWohneinheitAction() {
|
||||
$this->layout()->setTemplate("OpenAccessId/ChangeUnit");
|
||||
$id = $this->request->id;
|
||||
|
||||
Reference in New Issue
Block a user