From 81eeaf916a54d019c9dd227d611e48d8a60a3fb8 Mon Sep 17 00:00:00 2001 From: Alexander Smirnov Date: Tue, 16 Apr 2024 19:29:43 +0300 Subject: [PATCH] shipment add --- erp24/actions/shipment/AddAction.php | 1 + erp24/controllers/ShipmentController.php | 2 +- erp24/inc/uni.php | 2 +- erp24/inc/uni2.php | 71 +++++++++++------------- erp24/modul/shipment/add.php | 19 +++---- erp24/records/StoreOrders.php | 9 +++ erp24/views/shipment/add2.php | 5 ++ 7 files changed, 56 insertions(+), 53 deletions(-) create mode 100644 erp24/views/shipment/add2.php diff --git a/erp24/actions/shipment/AddAction.php b/erp24/actions/shipment/AddAction.php index 7dbf9c0..1ed7bbb 100644 --- a/erp24/actions/shipment/AddAction.php +++ b/erp24/actions/shipment/AddAction.php @@ -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(); } diff --git a/erp24/controllers/ShipmentController.php b/erp24/controllers/ShipmentController.php index 62a22a3..31ab8c6 100755 --- a/erp24/controllers/ShipmentController.php +++ b/erp24/controllers/ShipmentController.php @@ -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 diff --git a/erp24/inc/uni.php b/erp24/inc/uni.php index 8c0d1fc..b55f726 100644 --- a/erp24/inc/uni.php +++ b/erp24/inc/uni.php @@ -2399,7 +2399,7 @@ foreach ($data as $it) { $array[$it[$id]]=$it[$name]; } -return $array; +return $array ?? []; } diff --git a/erp24/inc/uni2.php b/erp24/inc/uni2.php index 34fc1e2..26817c9 100644 --- a/erp24/inc/uni2.php +++ b/erp24/inc/uni2.php @@ -1,7 +1,4 @@ -array("name"=>"Сделки/заказы", "table"=>"orders_amo"), "client"=>array("name"=>"Клиент", "table"=>"contacts","type_id"=>0), @@ -178,7 +175,7 @@ $r .=' .dd-handle, .dd-content {display: block; margin: 0px 0;padding: 1px 0px; } */ $fields_table_edit =" -
+
$r
@@ -224,7 +221,7 @@ $r .=' '; // //
$r
$fields_edit =" - +
$r
@@ -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"
$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"
-"; -echo "request->getCsrfToken() . "\" />"; +"; // @@ -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 ='
'; -foreach($group ?? [] as $gr_id => $nameg){ +foreach($group as $gr_id => $nameg){ if($i==0) { $script="все Основные "; $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"
"; -$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""; 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""; } -} +} echo"
"; } -/*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); diff --git a/erp24/modul/shipment/add.php b/erp24/modul/shipment/add.php index 55682af..6ffd7d3 100644 --- a/erp24/modul/shipment/add.php +++ b/erp24/modul/shipment/add.php @@ -1,15 +1,12 @@ - 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 index 0000000..1d3c801 --- /dev/null +++ b/erp24/views/shipment/add2.php @@ -0,0 +1,5 @@ +