From 2727e47e88c438ee5d5c819fa0e025aee950c458 Mon Sep 17 00:00:00 2001 From: Marina Zozirova Date: Sat, 27 Apr 2024 13:34:27 +0000 Subject: [PATCH] Insert ignore from mysql to pgsql --- erp24/modul/shipment/Functions.php | 11 +++++++++-- erp24/modul/shipment/clone.php | 11 +++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/erp24/modul/shipment/Functions.php b/erp24/modul/shipment/Functions.php index e8be714a..663d2d6a 100644 --- a/erp24/modul/shipment/Functions.php +++ b/erp24/modul/shipment/Functions.php @@ -166,8 +166,15 @@ $new_id=99999; //store_order_status статусы по магазинам - оставляем статусы по магазинам (возможно надо не все статусы оставлять а только статус - уточняем!!!) $data=$db::getRows("SELECT * FROM store_order_status WHERE order_id=?",[$OrderId]); foreach($data as $row) { -$insert="INSERT IGNORE INTO store_order_status (order_id, store_id, status_id, status, date, admin_id) -VALUES ('$new_id', '".$row["store_id"]."', '".$row["status_id"]."', '".$row["status"]."', '".$row["date"]."', '".$row["admin_id"]."')"; + $insert = "INSERT INTO store_order_status (order_id, store_id, status_id, status, date, admin_id) + VALUES ('$new_id', '" . $row["store_id"] . "', '" . $row["status_id"] . "', '" . $row["status"] . "', '" . $row["date"] . "', '" . $row["admin_id"] . "') + ON CONFLICT (id) DO UPDATE SET + order_id = '$new_id', + store_id = " . $row["store_id"] . ", + status_id = " . $row["status_id"] . ", + status = '" . $row["status"] . "', + date = '" . $row["date"] . "', + admin_id = " . $row["admin_id"] . ";"; //echo"
+ $insert"; // $db::sql($insert); } diff --git a/erp24/modul/shipment/clone.php b/erp24/modul/shipment/clone.php index aa4add4c..5c176a43 100644 --- a/erp24/modul/shipment/clone.php +++ b/erp24/modul/shipment/clone.php @@ -141,8 +141,15 @@ echo"$where"; $data=$db::getRows("SELECT * FROM store_order_status WHERE order_id=? $where ",[$OrderId]); foreach($data as $row) { -$insert="INSERT IGNORE INTO store_order_status (order_id, store_id, status_id, status, date, admin_id) -VALUES ('$new_id', '".$row["store_id"]."', '".$row["status_id"]."', '".$row["status"]."', '".$row["date"]."', '".$row["admin_id"]."')"; + $insert = "INSERT INTO store_order_status (order_id, store_id, status_id, status, date, admin_id) + VALUES ('$new_id', '" . $row["store_id"] . "', '" . $row["status_id"] . "', '" . $row["status"] . "', '" . $row["date"] . "', '" . $row["admin_id"] . "') + ON CONFLICT (id) DO UPDATE SET + order_id = '$new_id', + store_id = " . $row["store_id"] . ", + status_id = " . $row["status_id"] . ", + status = '" . $row["status"] . "', + date = '" . $row["date"] . "', + admin_id = " . $row["admin_id"] . ";"; //echo"
+ $insert"; $db::sql($insert); } -- 2.39.5