]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
Форматирование
authorfomichev <vladimir.fomichev@erp-flowers.ru>
Thu, 28 Nov 2024 08:34:37 +0000 (11:34 +0300)
committerfomichev <vladimir.fomichev@erp-flowers.ru>
Thu, 28 Nov 2024 08:34:37 +0000 (11:34 +0300)
erp24/api2/controllers/DataController.php

index 338c76beb5042e3fd50516eefc3b9a88f30ba33b..d8b43180316f3039878e529b5d8f2c96111640ae 100644 (file)
@@ -577,46 +577,37 @@ class DataController extends BaseController {
                     }
 
                     if (!empty($arr["AdditionCharacteristics"])) {
-
-
-                            $passedCharacteristics = array_column($arr["AdditionCharacteristics"], null, "id");
-
-
-                            $currentCharacteristics = Products1cAdditionalCharacteristics::find()
-                                ->where(['product_id' => $arr["id"]])
-                                ->indexBy('property_id')
-                                ->all();
-
-
-                            foreach ($currentCharacteristics as $propertyId => $currentCharacteristic) {
-                                if (!isset($passedCharacteristics[$propertyId])) {
-
-                                    if (!$currentCharacteristic->delete()) {
-                                        LogService::apiErrorLog(json_encode([
-                                            "error_id" => 8.3,
-                                            "error" => $currentCharacteristic->getErrors()
-                                        ], JSON_UNESCAPED_UNICODE));
-                                    }
+                        $passedCharacteristics = array_column($arr["AdditionCharacteristics"], null, "id");
+                        $currentCharacteristics = Products1cAdditionalCharacteristics::find()
+                            ->where(['product_id' => $arr["id"]])
+                            ->indexBy('property_id')
+                            ->all();
+
+                        foreach ($currentCharacteristics as $propertyId => $currentCharacteristic) {
+                            if (!isset($passedCharacteristics[$propertyId])) {
+                                if (!$currentCharacteristic->delete()) {
+                                    LogService::apiErrorLog(json_encode([
+                                        "error_id" => 8.3,
+                                        "error" => $currentCharacteristic->getErrors()
+                                    ], JSON_UNESCAPED_UNICODE));
                                 }
                             }
+                        }
 
-
-
-
-                            foreach ($arr["AdditionCharacteristics"] as $characteristic) {
-
+                        foreach ($arr["AdditionCharacteristics"] as $characteristic) {
                             $propertyType = Products1cPropType::findOne(['id' => $characteristic["id"]]);
                             if (!$propertyType) {
                                 $propertyType = new Products1cPropType();
                                 $propertyType->id = $characteristic["id"];
                                 $propertyType->name = $characteristic["name"];
                                 if (!$propertyType->save()) {
-                                    LogService::apiErrorLog(json_encode(["error_id" => 8.1, "error" => $propertyType->getErrors()], JSON_UNESCAPED_UNICODE));
+                                    LogService::apiErrorLog(json_encode(["error_id" => 8.1,
+                                                                        "error" => $propertyType->getErrors()],
+                                                                        JSON_UNESCAPED_UNICODE));
                                     continue;
                                 }
                             }
 
-
                             $additionalCharacteristic = Products1cAdditionalCharacteristics::findOne([
                                 'product_id' => $arr["id"],
                                 'property_id' => $characteristic["id"]
@@ -630,7 +621,9 @@ class DataController extends BaseController {
 
                             $additionalCharacteristic->value = $characteristic["value_name"];
                             if (!$additionalCharacteristic->save()) {
-                                LogService::apiErrorLog(json_encode(["error_id" => 8.2, "error" => $additionalCharacteristic->getErrors()], JSON_UNESCAPED_UNICODE));
+                                LogService::apiErrorLog(json_encode(["error_id" => 8.2,
+                                                                    "error" => $additionalCharacteristic->getErrors()],
+                                                                JSON_UNESCAPED_UNICODE));
                             }
                         }
                     }