Do not create orders with the auto-draft status
This commit is contained in:
parent
adfc893c95
commit
3ba2f1662e
@ -241,9 +241,9 @@ if ( ! class_exists( 'WC_Retailcrm_Orders' ) ) :
|
|||||||
));
|
));
|
||||||
|
|
||||||
if (empty($crmCorporate)) {
|
if (empty($crmCorporate)) {
|
||||||
$crmCorporate = $this->customers->searchCorporateCustomer(array(
|
$crmCorporate = $this->customers->searchCorporateCustomer(array(
|
||||||
'companyName' => $wcOrder->get_billing_company()
|
'companyName' => $wcOrder->get_billing_company()
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($crmCorporate)) {
|
if (empty($crmCorporate)) {
|
||||||
@ -371,6 +371,10 @@ if ( ! class_exists( 'WC_Retailcrm_Orders' ) ) :
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($order->get_status() == 'auto-draft') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if ($update === true) {
|
if ($update === true) {
|
||||||
$this->orders->is_new = false;
|
$this->orders->is_new = false;
|
||||||
}
|
}
|
||||||
|
@ -56,15 +56,16 @@ class WC_Retailcrm_Order extends WC_Retailcrm_Abstracts_Data
|
|||||||
$firstName = $order->get_shipping_first_name();
|
$firstName = $order->get_shipping_first_name();
|
||||||
$lastName = $order->get_shipping_last_name();
|
$lastName = $order->get_shipping_last_name();
|
||||||
|
|
||||||
if(empty($firstName) && empty($lastName))
|
if (empty($firstName) && empty($lastName)) {
|
||||||
{
|
|
||||||
$firstName = $order->get_billing_first_name();
|
$firstName = $order->get_billing_first_name();
|
||||||
$lastName = $order->get_billing_last_name();
|
$lastName = $order->get_billing_last_name();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$dateCreate = $order->get_date_created();
|
||||||
|
|
||||||
$data = array(
|
$data = array(
|
||||||
'externalId' => $order->get_id(),
|
'externalId' => $order->get_id(),
|
||||||
'createdAt' => $order->get_date_created()->date('Y-m-d H:i:s'),
|
'createdAt' => !empty($dateCreate) ? $dateCreate->date('Y-m-d H:i:s') : date('Y-m-d H:i:s'),
|
||||||
'firstName' => $firstName,
|
'firstName' => $firstName,
|
||||||
'lastName' => $lastName,
|
'lastName' => $lastName,
|
||||||
'email' => strtolower($order->get_billing_email()),
|
'email' => strtolower($order->get_billing_email()),
|
||||||
@ -105,14 +106,14 @@ class WC_Retailcrm_Order extends WC_Retailcrm_Abstracts_Data
|
|||||||
/**
|
/**
|
||||||
* @param WC_Order $order
|
* @param WC_Order $order
|
||||||
*/
|
*/
|
||||||
protected function set_number($order)
|
protected function set_number($order)
|
||||||
{
|
{
|
||||||
if (isset($this->settings['update_number']) && $this->settings['update_number'] == WC_Retailcrm_Base::YES ) {
|
if (isset($this->settings['update_number']) && $this->settings['update_number'] == WC_Retailcrm_Base::YES ) {
|
||||||
$this->set_data_field('number', $order->get_order_number());
|
$this->set_data_field('number', $order->get_order_number());
|
||||||
} else {
|
} else {
|
||||||
unset($this->data['number']);
|
unset($this->data['number']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function reset_data()
|
public function reset_data()
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user