Fixed Billingaddress export to IVT

This commit is contained in:
Frank Schubert
2022-05-03 13:21:36 +02:00
parent bc7db102ab
commit 7c12599ecf
@@ -10,7 +10,7 @@ class IvtCustomerController extends mfBaseController {
$this->redirect("Order"); $this->redirect("Order");
} }
$contact = $order->$billingaddress; $contact = $order->billingaddress;
if(!$contact) { if(!$contact) {
$contact = $order->owner; $contact = $order->owner;
} else { } else {
@@ -23,14 +23,12 @@ class IvtCustomerController extends mfBaseController {
} }
$ivtc = new IvtCustomer($contact->customer_number); $ivtc = new IvtCustomer($contact->customer_number);
//var_dump($ivtc);
if($ivtc->id) { if($ivtc->id) {
$return = ['status' => 'error', 'reason' => "ivt-exist"]; $return = ['status' => 'error', 'reason' => "ivt-exist"];
$this->returnJson($return); $this->returnJson($return);
} }
$ivtc->title = ""; $ivtc->title = "";
$ivtc->nick = ""; $ivtc->nick = "";
$ivtc->pwd = ""; $ivtc->pwd = "";
@@ -50,7 +48,7 @@ class IvtCustomerController extends mfBaseController {
$ivtc->firstname = ""; $ivtc->firstname = "";
$ivtc->surname = str_replace("\r\n", " ", str_replace("\n", " ", $contact->company)); $ivtc->surname = str_replace("\r\n", " ", str_replace("\n", " ", $contact->company));
} }
$ivtc->UID = $ivtc->uid; // XXX $ivtc->UID = $contact->uid; // XXX
$ivtc->zip = $contact->zip; $ivtc->zip = $contact->zip;
$ivtc->location = $contact->city; $ivtc->location = $contact->city;
@@ -103,14 +101,14 @@ class IvtCustomerController extends mfBaseController {
//var_dump($ivtc); //var_dump($ivtc);
$this->log->debug("new IVT customer:\n".print_r($ivtc, true));
if($ivtc->save()) { if($ivtc->save()) {
$return = ['status' => 'OK', 'reason' => ""]; $return = ['status' => 'OK', 'reason' => ""];
} else { } else {
$return = ['status' => 'error', 'reason' => "save"]; $return = ['status' => 'error', 'reason' => "save"];
} }
$this->log->debug("new IVT customer:\n".print_r($ivtc));
$this->returnJson($return); $this->returnJson($return);
} }
} }