From: fomichev Date: Tue, 28 Jan 2025 15:14:17 +0000 (+0300) Subject: Заменил на функцию X-Git-Tag: 1.7~32^2 X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=9d53fd559cd12ea197fc274a34576c6828e45867;p=erp24_rep%2Fyii-erp24%2F.git Заменил на функцию --- diff --git a/erp24/api2/controllers/DataController.php b/erp24/api2/controllers/DataController.php index 34f73dff..5c3088f8 100644 --- a/erp24/api2/controllers/DataController.php +++ b/erp24/api2/controllers/DataController.php @@ -311,6 +311,16 @@ class DataController extends BaseController } } + private function setPrefixToWriteOffsType($type) + { + $typeWriteOffs = $type; + if ($type === 'Брак') { + $typeWriteOffs = '2_' . $type; + } + + return $typeWriteOffs; + } + private function getWriteOffsDoc(): array { $writeOff = []; @@ -374,7 +384,7 @@ class DataController extends BaseController } foreach ($writeOff as $row) { - $typeWithPrefix = WriteOffsErp::WRITE_OFFS_TYPE_BRAK_PREFIX . $row['write_offs_type']; + $typeWithPrefix = $this->setPrefixToWriteOffsType($row['write_offs_type']); $writeOffResult[] = [ 'id' => $row['guid'], 'store_id' => $row['store_guid'], diff --git a/erp24/records/WriteOffsErp.php b/erp24/records/WriteOffsErp.php index 3da261c7..77b135ac 100644 --- a/erp24/records/WriteOffsErp.php +++ b/erp24/records/WriteOffsErp.php @@ -118,7 +118,6 @@ class WriteOffsErp extends \yii\db\ActiveRecord const STATUS_ERROR_1С = 8; const STATUS_DISABLE = 5; const WRITE_OFFS_TYPE_BRAK = "Брак"; - const WRITE_OFFS_TYPE_BRAK_PREFIX = "2_"; const WRITE_OFFS_TYPE_RETURN_KALUGA = "Возврат нереализованного товара (Калуга)"; const WRITE_OFFS_TYPE_DELIVERY_BRAK = 'Брак с поставки'; const WRITE_OFFS_TYPE_DUE_TO_EQUIPMENT_FAILURE_BRAK = 'Брак из-за поломки оборудования';