From: Vladimir Fomichev Date: Tue, 7 Oct 2025 08:20:48 +0000 (+0300) Subject: Добавление type_id X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=84f957cb530a35ac242a92bfada4bf46b50be88f;p=erp24_rep%2Fyii-erp24%2F.git Добавление type_id --- diff --git a/erp24/api2/controllers/DataController.php b/erp24/api2/controllers/DataController.php index 742f5dfc..f08e3ce6 100644 --- a/erp24/api2/controllers/DataController.php +++ b/erp24/api2/controllers/DataController.php @@ -477,13 +477,19 @@ class DataController extends BaseController $writeOff[$key]['items'] = $writeOffProductsRow; } } - + $analytics = AnalystsBusinessOperations::find() + ->select(['guid']) + ->indexBy('name') + ->asArray() + ->all(); foreach ($writeOff as $row) { $typeWithPrefix = $this->setPrefixToWriteOffsType($row['write_offs_type']); + $analyticGuid = $analytics[$typeWithPrefix]['guid'] ?? ''; $writeOffResult[] = [ 'id' => $row['guid'], 'store_id' => $row['store_guid'], 'type' => $typeWithPrefix, + 'type_id' => $analyticGuid, 'cause' => 'Документ списания в ERP ' . $row['number'], 'items' => $row['items'], 'summ' => $row['summ'], diff --git a/erp24/records/AnalystsBusinessOperations.php b/erp24/records/AnalystsBusinessOperations.php index 82185b8c..32c9280d 100644 --- a/erp24/records/AnalystsBusinessOperations.php +++ b/erp24/records/AnalystsBusinessOperations.php @@ -16,6 +16,7 @@ use Yii; */ class AnalystsBusinessOperations extends \yii\db\ActiveRecord { + const TYPE_ID_WAYBILL_WRITE_OFFS = ''; /**