From: Marina Zozirova Date: Sat, 27 Apr 2024 13:34:27 +0000 (+0000) Subject: Insert ignore from mysql to pgsql X-Git-Tag: 1.1~93^2 X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=2727e47e88c438ee5d5c819fa0e025aee950c458;p=erp24_rep%2Fyii-erp24%2F.git Insert ignore from mysql to pgsql --- 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); }