Partner productchange done
This commit is contained in:
@@ -429,6 +429,21 @@ class ContractController extends mfBaseController
|
||||
$contract_data['termination_id'] = null;
|
||||
}
|
||||
|
||||
//var_dump($r->links);
|
||||
// lookup credit contract and if it's missing in $r->links
|
||||
if(!$this->me->is("Admin")) {
|
||||
$credit_link = ContractLinkModel::includesContractId($contract->id, ["type" => "credit"]);
|
||||
if($credit_link) {
|
||||
if(is_array($r->links) && !array_key_exists($credit_link->id, $r->links)) {
|
||||
$r->links[$credit_link->id] = [];
|
||||
}
|
||||
$r->links[$credit_link->id]["action"] = "keep";
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//var_dump($r->links);exit;
|
||||
|
||||
|
||||
$new_contract->update($contract_data);
|
||||
$new_contract_id = $new_contract->save();
|
||||
@@ -455,6 +470,8 @@ class ContractController extends mfBaseController
|
||||
]);
|
||||
$journal->save();
|
||||
|
||||
|
||||
|
||||
if (is_array($r->links) && count($r->links)) {
|
||||
foreach ($r->links as $link_id => $link_data) {
|
||||
$action = $link_data["action"];
|
||||
@@ -597,7 +614,7 @@ class ContractController extends mfBaseController
|
||||
|
||||
$this->layout()->setFlash("Produktwechsel erfolgreich erstellt", "success");
|
||||
if($f == "o") {
|
||||
$this->redirect("Order");
|
||||
$this->redirect("Order","Upgrades");
|
||||
} else {
|
||||
$this->redirect("Contract", "view", ["contract_id" => $new_contract_id]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user