]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
fix ajax-update-step
authorAlexander Smirnov <fredeom@mail.ru>
Sun, 19 May 2024 15:28:25 +0000 (18:28 +0300)
committerAlexander Smirnov <fredeom@mail.ru>
Sun, 19 May 2024 15:28:25 +0000 (18:28 +0300)
erp24/controllers/ShipmentController.php
erp24/modul/shipment/ajaxUpdateStep.php
erp24/modul/shipment/fields/min_lot.php
erp24/modul/shipment/fields/min_order.php
erp24/modul/shipment/shipment.php
erp24/views/shipment/ajax-update-step.php [new file with mode: 0644]

index 22abb6431b0654ef15d594118fbac7a7fb394db4..188e20c75247d8fcc49142679a0863d6df3944fa 100755 (executable)
@@ -31,4 +31,5 @@ class ShipmentController extends Controller
     public function actionAjaxField() { return $this->renderPartial('ajax-field'); }
     public function actionPolnogramm() { return $this->render('polnogramm'); }
     public function actionAjaxUpdateStoreZakup() { return $this->renderPartial('ajax-update-store-zakup'); }
+    public function actionAjaxUpdateStep() { return $this->renderPartial('ajax-update-step'); }
 }
\ No newline at end of file
index a53261e95625095474410d5749c2be5db8f071fc..533aff7685c5ce8d47b966b6e5ef7ff5881ccfec 100644 (file)
@@ -1,8 +1,8 @@
-<?
-include_once("startup.php");
-include_once("inc/db.php");
-include_once("inc/base_new.php");
-include_once("inc/design_new.php");
+<?php
+include_once(dirname(__DIR__, 2) . "/startup.php");
+include_once(dirname(__DIR__, 2) . "/inc/db.php");
+include_once(dirname(__DIR__, 2) . "/inc/base_new.php");
+include_once(dirname(__DIR__, 2) . "/inc/design_new.php");
 
 ini_set('error_reporting', E_ALL);
 ini_set('display_errors', 1);
@@ -34,7 +34,7 @@ if(!empty($_REQUEST["id"])) { $orderId=(int)$_REQUEST["id"]; } else exit("Ука
 $whereDeleteData="";
 // параметр указывает на то что осток после деления распределяем автоматически в ячейки для ручной добавки к делению
 $foreachSalesHand=false; 
-if($_REQUEST["foreachSalesHand"]==1) { $foreachSalesHand=true; $whereDeleteData .=",'division_hand'"; }
+if(($_REQUEST["foreachSalesHand"] ?? 0)==1) { $foreachSalesHand=true; $whereDeleteData .=",'division_hand'"; }
 
 
 if($_REQUEST["deleteAll"]==1) { 
@@ -51,8 +51,8 @@ exit();
 //$db::sql("DELETE FROM store_orders_fields_data WHERE (field_name='division_ratio' or field_name='division_auto' or field_name='storehouse_balance') AND order_id='$orderId'");    
 //$db::sql("DELETE FROM store_orders_fields_data WHERE  field_name in ('division_hand_summ','division_summ','storehouse_balance', 'purchase_fact_difference','division_auto_all','delta_zakup','division_summ_all','delta_rejection' $whereDeleteData) AND order_id='$orderId'");    
 
-include_once("inc/shipment.php");
-include"inc/functionsFiedlsData.php";
+include_once(dirname(__DIR__, 2) . "/inc/shipment.php");
+include_once(dirname(__DIR__, 2) . "/inc/functionsFiedlsData.php");
 
 /*
 
@@ -125,7 +125,7 @@ foreach($data4 as $row) {
 
 $data=$db::getRows("SELECT sum(p.quantity) as squantity,s.store_id_1c, p.product_id 
 FROM sales as s, sales_products as p 
-WHERE s.id=p.check_id AND s.operation='Продажа' AND p.product_id $whereInProductsId  AND s.date>=? - INTERVAL 14 day  group BY p.product_id, s.store_id_1c order by 
+WHERE s.id=p.check_id AND s.operation='Продажа' AND p.product_id $whereInProductsId  AND s.date>=?::date - INTERVAL '14 day'  group BY p.product_id, s.store_id_1c order by 
 squantity DESC",[$date_start_division]);
 foreach($data as $row){
 $productsArrayStores[$row["product_id"]][$row["store_id_1c"]]=$row["squantity"];   
@@ -136,7 +136,7 @@ $productsArrayStores[$row["product_id"]][$row["store_id_1c"]]=$row["squantity"];
 
   // товар в пути  date_start<='$date_start_sale 00:00:00' AND date_start>='$date_start_sale' -interval 7 day
 
-$data=$db::getRows("SELECT  id,name,providers_arr FROM store_orders WHERE  date_add>='$order_date_add' - interval 7 day  AND date_add<='$order_date_add' ");   
+$data=$db::getRows("SELECT  id,name,providers_arr FROM store_orders WHERE  date_add>='$order_date_add'::date - interval '7 day'  AND date_add<='$order_date_add' ");
 
 
 $j=0;
@@ -331,8 +331,8 @@ foreach($colorsProductsArray[$productId] as $color) {
      if($color=="NULL") { 
          $color="";
         try {
-          $db::sql("INSERT IGNORE INTO store_orders_fields_data (product_id, order_id, store_id, field_name, field_id, value, value_text, color,hand,date_update,title)       
-          VALUES (?,?,?,?,?,?,?,?,'-1',NOW(),?)  ON DUPLICATE KEY UPDATE value=?, hand=0, value_text=?, date_update=NOW(), title=?",     
+          $db::sql("INSERT INTO store_orders_fields_data (product_id, order_id, store_id, field_name, field_id, value, value_text, color,hand,date_update,title)       
+          VALUES (?,?,?,?,?,?,?,?,'-1',NOW(),?)  ON CONFLICT (product_id, order_id, store_id, field_id, field_name, color) DO UPDATE SET value=?, hand=0, value_text=?, date_update=NOW(), title=?",
           [$productId, $orderId, $storeId, $field_name, $field_id, $value, "",  $color, $title, $value, "",$title]);  
             }
         catch (Exception $e) 
@@ -390,8 +390,8 @@ $storehouse_balance=$FiledsData["$rowFactName"][$productId]["NULL"]["NULL"]-($di
     
     
      try {    
-         $s="INSERT IGNORE INTO store_orders_fields_data (product_id, order_id, store_id, field_name, field_id, value, value_text, color,hand,date_update)       
-          VALUES (?,?,?,?,?,?,?,?,'-1',NOW())  ON DUPLICATE KEY UPDATE value=?, hand=0, value_text=?, date_update=NOW()";
+         $s="INSERT INTO store_orders_fields_data (product_id, order_id, store_id, field_name, field_id, value, value_text, color,hand,date_update)       
+          VALUES (?,?,?,?,?,?,?,?,'-1',NOW())  ON CONFLICT (product_id, order_id, store_id, field_name, field_id, color) DO UPDATE SET value=?, hand=0, value_text=?, date_update=NOW()";
       $db::sql($s,            [$productId, $orderId, $storeId, $field_name, $field_id, $value, $value_text,  $color, $value, $value_text]);     
         
         }
index 02f6de14dda3b197348cb849ac26b5167b975aa0..cef866425a72b31c5b5e30e8dbe71c18be5ab69e 100644 (file)
@@ -1,5 +1,11 @@
-<?
-$data=$db::getRows("SELECT id,min_lot FROM products_1c_options WHERE id $whereInProductsId");
-foreach($data as $row) {
- $data_up[$row["id"]][0][0]=$row["min_lot"]; 
+<?php
+
+global $whereInProductsId, $data_Up;
+
+
+if ($whereInProductsId != " in ()") {
+    $data = $db::getRows("SELECT id,min_lot FROM products_1c_options WHERE id $whereInProductsId");
+    foreach ($data as $row) {
+        $data_up[$row["id"]][0][0] = $row["min_lot"];
+    }
 }
\ No newline at end of file
index ab0316fdc4d8aedd17a764a01961048957726007..0f1c611791408336b37739de299bbb988a0b4f66 100644 (file)
@@ -1,5 +1,10 @@
-<?
-$data=$db::getRows("SELECT id,min_order FROM products_1c_options WHERE id $whereInProductsId");
-foreach($data as $row) {
- $data_up[$row["id"]][0][0]=$row["min_order"]; 
+<?php
+
+global $whereInProductsId;
+
+if ($whereInProductsId != " in ()") {
+    $data = $db::getRows("SELECT id,min_order FROM products_1c_options WHERE id $whereInProductsId");
+    foreach ($data as $row) {
+        $data_up[$row["id"]][0][0] = $row["min_order"];
+    }
 }
\ No newline at end of file
index c330fb4fb338de9e8a9200db81bf8d8d5ad3d815..76e265259c5509cedd452f8be9e9b3460bb727a4 100644 (file)
@@ -314,14 +314,15 @@ function deleteAll(){
  const result = confirm('Удаляем данные?');
     
     if (result) {
-
+const param3 = $(\"meta[name=csrf-param]\").attr(\"content\");
+ const token3 = $(\"meta[name=csrf-token]\").attr(\"content\");
  $('#modal-7 .modal-body').html('Удаляем данные');
 jQuery('#modal-7').modal('show', {backdrop: 'static'}); $('#modal-7 .modal-title').text('Удаляем данные');  
  $.ajax({
-       url: '/shipment/ajaxUpdateStep/',
+       url: '/shipment/ajax-update-step/',
        method: 'post',       
        dataType: 'html',        
-       data: { id: $orderId, deleteAll:'1'},  
+       data: { id: $orderId, deleteAll:'1', [param3]: token3},  
        success: function(data){  
     $('#modal-7 .modal-body').html(data);
      window.parent.location.reload();
diff --git a/erp24/views/shipment/ajax-update-step.php b/erp24/views/shipment/ajax-update-step.php
new file mode 100644 (file)
index 0000000..fe24971
--- /dev/null
@@ -0,0 +1,5 @@
+<?php
+
+chdir(__DIR__ . '/../../');
+
+include 'modul/shipment/ajaxUpdateStep.php';
\ No newline at end of file