->indexBy('code')
->asArray()
->all();
+ $cancelledStatusId = $statuses[MarketplaceOrderStatusTypes::CANSELLED_CODE]['id'];
+ $readyStatusId = $statuses[MarketplaceOrderStatusTypes::READY_CODE]['id'];
+ $statuses1cWithCancelledId = ArrayHelper::getColumn(MarketplaceOrder1cStatuses::find()
+ ->select(['status_id'])
+ ->where(['order_status_id' => $cancelledStatusId])
+ ->asArray()
+ ->all(), 'status_id');
+ $statuses1cToChangeYandexMarketFakeOrderId = ArrayHelper::getColumn(MarketplaceOrder1cStatuses::find()
+ ->select(['status_id'])
+ ->where(['order_status_id' => $cancelledStatusId])
+ ->orWhere(['order_substatus_id' => $readyStatusId])
+ ->andWhere(['marketplace_id' => 2])
+ ->asArray()
+ ->all(), 'status_id');
+
+
$statuses = ArrayHelper::map($statuses, 'code', 'id');
$statusCodes = array_unique(array_keys($statuses));
$substatus = $statusId1C->orderStatus;
if (
- in_array($statusId1C->status_id, ['1013', '1010']) &&
+ in_array($statusId1C->status_id, $statuses1cToChangeYandexMarketFakeOrderId) &&
$order->marketplace_id == 2
) {
if (!$debug) {
if($orderSellerId) {
$order->seller_id = $orderSellerId;
}
- if (in_array($statusId1C->status_id, ['1013', '1006'])) {
- $marketplaceOrder->cancelled_order_source = '1c';
- $marketplaceOrder->cancelled_order_date = date('Y-m-d H:m:s');
+ if (in_array($statusId1C->status_id, $statuses1cWithCancelledId)) {
+ $order->cancelled_order_source = '1c';
+ $order->cancelled_order_date = date('Y-m-d H:m:s');
}
$order->status_processing_1c = $statusId1C->id;