AddessLink WIP

This commit is contained in:
Frank Schubert
2022-06-28 13:25:37 +02:00
parent a6652c5ab8
commit bbfc6c6eb5
7 changed files with 393 additions and 2 deletions

View File

@@ -104,7 +104,7 @@ class AddressController extends mfBaseController {
protected function saveAction() {
$r = $this->request;
$id = $r->id;
//var_dump($r);exit;
//var_dump($r->get());exit;
if(is_numeric($id) && $id > 0) {
$mode = "edit";
$address = new Address($id);
@@ -228,6 +228,24 @@ class AddressController extends mfBaseController {
}
}
$address->deleteLinks();
//var_dump($r->links);exit;
if(is_array($r->links) && count($r->links)) {
//var_dump($r->links);exit;
foreach($r->links as $linknum => $link) {
if(!$link['type'] || !$link['address_id']) {
continue;
}
$l = AddressLinkModel::create([
'origin_address_id' => $new_id,
'type' => $link['type'],
'address_id' => $link['address_id']
]);
$l->save();
}
}
$this->layout()->setFlash("Adresse erfolgreich gespeichert.", "success");
$this->redirect("Address", "Edit", ['id' => $new_id]);
}
@@ -287,6 +305,12 @@ class AddressController extends mfBaseController {
$role = "billing";
$po = 0;
}
if($this->request->role == "techcontact") {
$role = "techcontact";
$po = 0;
}
$this->log->debug(print_r($this->request->get(),true));
$addresses = [];