]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
shipment add
authorAlexander Smirnov <fredeom@mail.ru>
Tue, 16 Apr 2024 16:29:43 +0000 (19:29 +0300)
committerAlexander Smirnov <fredeom@mail.ru>
Tue, 16 Apr 2024 16:29:43 +0000 (19:29 +0300)
erp24/actions/shipment/AddAction.php
erp24/controllers/ShipmentController.php
erp24/inc/uni.php
erp24/inc/uni2.php
erp24/modul/shipment/add.php
erp24/records/StoreOrders.php
erp24/views/shipment/add2.php [new file with mode: 0644]

index 7dbf9c049e2066857e725b4b0c125ab12a5e7960..1ed7bbb7c30639c68ca05046ca484bc0a5a4226f 100644 (file)
@@ -17,6 +17,7 @@ class AddAction extends Action
 
         if (Yii::$app->request->isPost && $model->load(Yii::$app->request->post())) {
             $model->setProviders();
+            $model->price_logistic = 0;
             if ($model->validate()) {
                 $model->save();
             }
index 62a22a31b89ef3d6fdbfdd01431098242e463bc8..31ab8c648dd9feae61d41d8098619bb8efa7d63d 100755 (executable)
@@ -13,7 +13,7 @@ class ShipmentController extends Controller
     }
 
     public function actionIndex() { return $this->render('index'); }
-
+    //public function actionAdd() { return $this->render('add'); }
     public function actionStoreOrders() { return $this->render('store-orders'); }
     public function actionShipment() { return $this->render('shipment'); }
 }
\ No newline at end of file
index 8c0d1fce9c5ccaedf6b93aeb222559237d01e9d3..b55f72612580bfa16539389d4ef4819529ed2e5e 100644 (file)
@@ -2399,7 +2399,7 @@ foreach ($data as $it) {
  $array[$it[$id]]=$it[$name];  
     }  
 
-return $array
+return $array ?? [];
 }
        
 
index 34fc1e2b134d93ecdcde7044bdb8a2d3e1d569bc..26817c97206b44be39ab668d49dea27d237dfd06 100644 (file)
@@ -1,7 +1,4 @@
-<?php
-
-//error_reporting(E_ALL ^ E_NOTICE);
-
+<?
 $_CONFIG["entity_arr"]=array(
     "lead"=>array("name"=>"Сделки/заказы", "table"=>"orders_amo"),
     "client"=>array("name"=>"Клиент", "table"=>"contacts","type_id"=>0),
@@ -178,7 +175,7 @@ $r .='</tbody>
 .dd-handle, .dd-content {display: block; margin: 0px 0;padding: 1px 0px; }
 </style>*/
 $fields_table_edit ="
-<form method=post role=\"form\" enctype=\"multipart/form-data\" class=\"form-horizontal\" autocomplete=\"off\">
+<form method=post role=\"form\" enctype=\"multipart/form-data\" class=\"form-horizontal\" action=\"/$modul/$act/\" autocomplete=\"off\">
 <div class=\"table-responsive\">
 $r</div>
 
@@ -224,7 +221,7 @@ $r .=' </tbody></table>';
  //<script type=\"text/javascript\">$(document).ready(function($){ $('.dd').nestable({});});</script>
  //<div id=\"list-2\" class=\"nested-list dd with-margins custom-drag-button\">$r</div>
 $fields_edit ="
-<form method=post role=\"form\" enctype=\"multipart/form-data\" class=\"form-horizontal\" autocomplete=\"off\">
+<form method=post role=\"form\" enctype=\"multipart/form-data\" class=\"form-horizontal\" action=\"/$modul/$act/\" autocomplete=\"off\">
 <div class=\"row\"><div class=\"col-12 m-10\">$r</div>
 <div class=\"col-12\">
 
@@ -281,10 +278,10 @@ if(!empty($act)) $action .="$act/";
 
 
 
- unif_fields_show($forma, $table_sql) ;
+ unif_fields_show($forma, $table_sql) ;        
 
        
-$idname=$forma["id"]["name"];  
+$idname=$forma["id"]["name"] ?? '';
 $item=array();
 
 
@@ -456,7 +453,7 @@ $form_field_uni[$row["name_eng"]]=$arr_2;
 }
        
        
-construct_form_submit_uni($forma, $table_sql,$modul_uni,$form_field_hide_array);
+construct_form_submit_uni($forma, $table_sql,$modul_uni,$form_field_hide_array);               
        
 /////////      
        
@@ -602,7 +599,7 @@ $p=0;
 $sql="";
 $param2=array();
 $param2['id2']=$id;
-foreach($sql_upvalue ?? [] as $nm => $vl) {
+foreach($sql_upvalue as $nm => $vl) {
  if($p>0) $sql .=",";    
 $sql .=" `$nm` = :$nm"; 
 $param2[$nm]=$vl;
@@ -810,14 +807,14 @@ elseif(empty($forma[$name]["mysql_table"])) {     $sql1 .=",$name";  $sql2 .=", '$va
        
 $val='';       
 if($name!="save" and $name!="id" and $forma[$name]["type"]!="image"   and $forma[$name]["type"]!="table"  and $forma[$name]["type"]!="video"   and $forma[$name]["type"]!="file"  and !isset($forma[$name]["no_form"]) and $forma[$name]["type"]!="html") {
-if(isset($_POST[$name])) {
-$val= htmlentities(is_array($_POST[$name]) ? $_POST[$name][0] : $_POST[$name]);
+if(isset($_POST[$name])) { 
+$val=htmlentities($_POST[$name]);
 //echo"<br> $name value=$val ";
         
         
 if($forma[$name]["tip"]=="array") {     
-$val=implode(",",$_POST[$name]);
-$massiv=[];
+$val=implode(",",htmlentities($_POST[$name])); 
+$massiv=[];    
 if($forma[$name]["type"]=="radio" or $forma[$name]["type"]=="html") {  
 foreach($_POST[$name] as $key6 => $valon) {
 if($valon=="on") $massiv[]=$key6;      
@@ -1209,8 +1206,7 @@ if(!empty($mess))  mess($mess);
 echo"<div class=\"panel-body\">
                        <div class=\"tab-content\">
                        <div class=\"tab-pane active\" id=\"profile-1\">
-<form method=post role=\"form\" class=\"form-horizontal was-validated\" id=\"erpform\" autocomplete=\"off\" enctype=\"multipart/form-data\" >";
-echo "<input type=\"hidden\" name=\"_csrf\" value=\"" . Yii::$app->request->getCsrfToken() . "\" />";
+<form method=post role=\"form\" class=\"form-horizontal was-validated\" id=\"erpform\" autocomplete=\"off\" enctype=\"multipart/form-data\" action=\"$action\">";
 //<input name=go value=\"".htmlentities($_REQUEST["go"])."\" type=hidden>
 
        
@@ -1220,7 +1216,7 @@ if(!empty($group_menu)) {
 $group=get_sql_array("uni_status", "id", "name", " WHERE type='".$modul."_group' order by posit DESC");        
 $i=0;
 $group_menu ='<div class="row">';
-foreach($group ?? [] as $gr_id => $nameg){
+foreach($group as $gr_id => $nameg){
 if($i==0) { $script="<span class=\"f_group og_\" onclick=\"$('.fdiv').show();$('.f_group').removeClass('f_act');$(this).addClass('f_act');\">все</span>
 <span class=\"f_group og_m\" onclick=\"$('.fdiv').hide(); $('.f_m').show();$('.f_group').removeClass('f_act');$(this).addClass('f_act');\">Основные</span> ";
                   $script2="$('.f_0').show();";  }  else { $script=""; $script2="";    }
@@ -1257,7 +1253,7 @@ if(!empty($pole_arr["html_begin"]) ) echo html_entity_decode($forma[$name]["html
 //echo" dostup_arr=". $pole_arr["dostup_arr"] ."";
        
 if(!empty($pole_arr["br"]) )  echo"<div class=\"row\"></div>";                 
-$id_pole=$forma["id"]["name"]
+$id_pole=$forma["id"]["name"] ?? '';
        
 /*HEDDEN*/
 if($forma[$name]["type"]=="hidden" and !empty($id) and !empty($idname) and $id_pole==$idname) {  echo"<input type=hidden name=".$idname."  value=\"".$id."\">"; if(!empty($forma[$name]["html"])) echo $forma[$name]["html"];}
@@ -1287,8 +1283,8 @@ if(!empty($forma[$name]["class"])) $class=$forma[$name]["class"];
 if(!empty($forma[$name]["name_pole_txt"])) $forma[$name]["name_pole"]=$forma[$name]["name_pole_txt"];  
        
 
-$dostup_arr=unserialize($pole_arr["dostup_arr"]);
-if($_CONFIG_SITE["dostup_fields"][$modul]==1) {$show=0; $edit=0;}
+$dostup_arr=unserialize($pole_arr["dostup_arr"] ?? '');
+if($_CONFIG_SITE["dostup_fields"][$modul] ?? 0 ==1) {$show=0; $edit=0;}
 else {$show=1; $edit=1;}
 
 if(!empty($dostup_arr[$_SESSION["group_id"]][0]["show"])) {
@@ -1771,12 +1767,12 @@ optgroup[label] {
 
        
  }
-/*end optgroup*/
-
-
-
-
-
+/*end optgroup*/               
+       
+       
+       
+       
+       
 /*multy-select*/       
 if($pole_arr["type"]=="multiple")  { 
 $item[$name]=explode(",",$item[$name]);
@@ -1800,16 +1796,16 @@ echo" id=crm$name>";
        
 if(!empty($forma[$name]["val_arr"])) {  
 foreach($forma[$name]["val_arr"] as $vid =>$namev) {  echo"<option value=$vid"; 
-if(in_array($vid,$item[$name])) echo" selected";
-if(is_array($forma[$name]["value"]) && in_array($vid,$forma[$name]["value"])) echo" selected";
+if(in_array($vid,$item[$name])) echo" selected"; 
+if(in_array($vid,$forma[$name]["value"])) echo" selected";                                                                                                             
 echo">$namev</option>";   }
-}
+}                                                               
 echo"</select></div></div>";   
        
 }
-/*end multy-select*/
-
-
+/*end multy-select*/           
+       
+       
        
        
 /*radio*/              
@@ -2245,9 +2241,9 @@ return $item;
 
 
 function construct_modul_form_azea($modul)   {
-global /*$modul,*/$db,$h1,$group_menu,$uni_fields, $_CONFIG,$forma_sql_table;
+global $modul,$db,$h1,$group_menu,$uni_fields, $_CONFIG,$forma_sql_table;
 $data=$db::getRows("SELECT * FROM modules_uni_fields WHERE modul=? ORDER BY posit DESC",[$modul]);     
-foreach ($data as $row) {
+foreach ($data as $row) {      
 
 $image_config=json_decode($row["image_config"], true,JSON_UNESCAPED_UNICODE);     
 $ext_1=explode(",",$image_config["ext"]);
@@ -2269,7 +2265,7 @@ if(!empty($uni_fields)) $uni_fields=$modul;
 
 
 
-construct_form_azea($forma,$modul,$h1,"2",$uni_fields);
+construct_form_azea($forma,$modul,$h1,"2",$uni_fields); 
 
 if(!empty($_CONFIG["bottom_content"])) echo $_CONFIG["bottom_content"];
        
@@ -2796,10 +2792,7 @@ $spiski_arr=array(
  
  );
 
-if (!isset($zz)) {
-    $zz = "";
-}
-$zz=preg_replace_callback("|{RAND}|","generate_r", $zz);
+$zz=preg_replace_callback("|{RAND}|","generate_r", $zz ?? '');
 $zz=str_replace('[YEAR]',date("Y",time()),$zz);
 $zz=str_replace('[MONTH]',date("m",time()),$zz);
 $zz=str_replace('[DAY]',date("d",time()),$zz);
index 55682afc5abdab7474df17208d6dbcbf69b64cc5..6ffd7d34b8d3d17c3a011329cc4a75b77a732d05 100644 (file)
@@ -1,15 +1,12 @@
-<?
-include_once ("startup.php");
-include_once("inc/db.php");
-include_once("inc/base_new.php");
-include_once("inc/design_new.php");
-include_once("inc/uni.php");
-include_once("inc/uni2.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");
+include_once(dirname(__DIR__, 2) . "/inc/uni.php");
+include_once(dirname(__DIR__, 2) . "/inc/uni2.php");
 
 global $h1,$group_menu,$uni_fields, $forma_sql_table;
-
-error_reporting(E_ALL ^ E_NOTICE);
-
 $h1="Добавить "; $group_menu=0; $uni_fields=0;
 $modul="shipment";
 $forma_sql_table="store_orders";
@@ -26,8 +23,6 @@ $_SESSION["default"][$modul]["cat_id"]=$catid;
 
 
 
-include"templates/top.php";
-
 construct_modul_form_azea($modul);
 
 
index 17c996fb572ccfae11822b505b2d27d02cd6376c..074dadde0f8d58ddce08951aabaabc9d571f5bef 100644 (file)
@@ -28,6 +28,9 @@ use Yii;
  */
 class StoreOrders extends \yii\db\ActiveRecord
 {
+    public $providers;
+    public $price_logistic;
+
     /**
      * {@inheritdoc}
      */
@@ -47,6 +50,7 @@ class StoreOrders extends \yii\db\ActiveRecord
             [['date_start', 'date_end', 'delivery_date', 'division_date', 'delivery_date_fact', 'date_add', 'date_update'], 'safe'],
             [['comments', 'status_logi', 'update_html'], 'string'],
             [['name', 'providers_arr'], 'string', 'max' => 255],
+            ['providers', 'safe']
         ];
     }
 
@@ -76,4 +80,9 @@ class StoreOrders extends \yii\db\ActiveRecord
             'update_html' => 'Update Html',
         ];
     }
+
+    public function setProviders()
+    {
+        $this->providers_arr = implode(',', $this->providers);
+    }
 }
diff --git a/erp24/views/shipment/add2.php b/erp24/views/shipment/add2.php
new file mode 100644 (file)
index 0000000..1d3c801
--- /dev/null
@@ -0,0 +1,5 @@
+<?php
+
+chdir(__DIR__ . '/../../');
+
+include 'modul/shipment/add.php';
\ No newline at end of file