From 88709765d9f7296f9f12da60ae231d0ca14e64fe Mon Sep 17 00:00:00 2001 From: Arsen Mirzaev Tatyano-Muradovich Date: Mon, 8 Apr 2024 02:35:06 +0700 Subject: [PATCH] =?UTF-8?q?=D0=BD=D0=BE=D1=80=D0=BC=D0=B0=D0=BB=D0=B8?= =?UTF-8?q?=D0=B7=D0=B0=D1=82=D0=BE=D1=80=20=D0=B8=D0=B4=D0=B5=D0=BD=D1=82?= =?UTF-8?q?=D0=B8=D1=84=D0=B8=D0=BA=D0=B0=D1=82=D0=BE=D1=80=D0=BE=D0=B2=20?= =?UTF-8?q?=D0=BC=D0=B0=D0=B3=D0=B0=D0=B7=D0=B8=D0=BD=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../google_sheets/parser/system/public/markets.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mirzaev/spetsresurs/google_sheets/parser/system/public/markets.php b/mirzaev/spetsresurs/google_sheets/parser/system/public/markets.php index 15757c1..b707dba 100755 --- a/mirzaev/spetsresurs/google_sheets/parser/system/public/markets.php +++ b/mirzaev/spetsresurs/google_sheets/parser/system/public/markets.php @@ -84,8 +84,11 @@ function sync(Row &$row): void // Инициализация ФИО $name = explode(' ', $_row['name']); + // Инициализация идентификатора + if (empty($id = preg_replace('/([^^\d]?)(\d+).*/u', 'K$2', $_row['id']))) return; + if (collection::init($arangodb->session, 'market')) - if (!empty($_row['id']) && $market = collection::search($arangodb->session, sprintf("FOR d IN market FILTER d.id == '%s' RETURN d", $_row['id']))) { + if ($market = collection::search($arangodb->session, sprintf("FOR d IN market FILTER d.id == '%s' RETURN d", $id))) { // Найдена запись магазина (строки) в базе данных и включен режим перезаписи (приоритет - google sheets) if (false && $market->transfer_to_sheets) { @@ -127,7 +130,7 @@ function sync(Row &$row): void sprintf( "FOR d IN market FILTER d._id == '%s' RETURN d", document::write($arangodb->session, 'market', [ - 'id' => $_row['id'] ?? '', + 'id' => $id, 'type' => $_row['type'] ?? '', 'name' => [ 'first' => $name[1] ?? $_row['name'] ?? '',