Fixed Billingaddress export to IVT
This commit is contained in:
@@ -10,7 +10,7 @@ class IvtCustomerController extends mfBaseController {
|
||||
$this->redirect("Order");
|
||||
}
|
||||
|
||||
$contact = $order->$billingaddress;
|
||||
$contact = $order->billingaddress;
|
||||
if(!$contact) {
|
||||
$contact = $order->owner;
|
||||
} else {
|
||||
@@ -23,14 +23,12 @@ class IvtCustomerController extends mfBaseController {
|
||||
}
|
||||
|
||||
$ivtc = new IvtCustomer($contact->customer_number);
|
||||
//var_dump($ivtc);
|
||||
|
||||
if($ivtc->id) {
|
||||
$return = ['status' => 'error', 'reason' => "ivt-exist"];
|
||||
$this->returnJson($return);
|
||||
}
|
||||
|
||||
|
||||
$ivtc->title = "";
|
||||
$ivtc->nick = "";
|
||||
$ivtc->pwd = "";
|
||||
@@ -50,7 +48,7 @@ class IvtCustomerController extends mfBaseController {
|
||||
$ivtc->firstname = "";
|
||||
$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->location = $contact->city;
|
||||
|
||||
@@ -103,14 +101,14 @@ class IvtCustomerController extends mfBaseController {
|
||||
|
||||
//var_dump($ivtc);
|
||||
|
||||
$this->log->debug("new IVT customer:\n".print_r($ivtc, true));
|
||||
|
||||
if($ivtc->save()) {
|
||||
$return = ['status' => 'OK', 'reason' => ""];
|
||||
} else {
|
||||
$return = ['status' => 'error', 'reason' => "save"];
|
||||
}
|
||||
|
||||
$this->log->debug("new IVT customer:\n".print_r($ivtc));
|
||||
|
||||
$this->returnJson($return);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user