* @return array
*/
public static function getColumn($query, $args = []) {
- $GLOBALS["sql_cnt"]++;
+ $GLOBALS["sql_cnt"] = ($GLOBALS["sql_cnt"] ?? 0) + 1;
return self::run($query, $args)->fetchAll(PDO::FETCH_COLUMN);
}
public static function getCol($query, $args = []) {
- $GLOBALS["sql_cnt"]++;
+ $GLOBALS["sql_cnt"] = ($GLOBALS["sql_cnt"] ?? 0) + 1;
return self::run($query, $args)->fetch(PDO::FETCH_NAMED);
}
public static function sql($query, $args = [])
- { $GLOBALS["sql_cnt"]++;
+ {
+ $GLOBALS["sql_cnt"] = ($GLOBALS["sql_cnt"] ?? 0) + 1;
self::run($query, $args);
}
{
$ret_arr=array();
$data= self::run($query, $args)->fetchAll();
- $GLOBALS["sql_cnt"]++;
+ $GLOBALS["sql_cnt"] = ($GLOBALS["sql_cnt"] ?? 0) + 1;;
foreach($data as $row) $ret_arr[$row["id"]]=$row["name"];
return $ret_arr;
}
--- /dev/null
+<?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"templates/top.php";
+
+//if($_SESSION["group_id"]>2) exit("У вас нет доступа");
+
+$roles=$db::mapping("SELECT id, name FROM admin_group WHERE id=7 or id=30 or id=17 or id=70 or id=71 or id=9 or id=51 or id=1 or id=10");
+
+echo "<div class='m-5'>";
+
+echo'<h1 class="page-title mb-0 text-primary">Настройка статусов в заказе у поставщиков кто может ставить статусы</h1>';
+
+
+if(!empty($_POST["save"])){
+
+ foreach($_POST["description"] as $idr => $val) {
+
+ $db::sql("UPDATE store_orders_fields SET description=? WHERE id=?",[$val,$idr]);
+
+ }
+
+
+}
+
+$data=$db::getRows("SELECT id, dostup FROM `store_orders_statuses` WHERE 1");
+foreach($data as $row) {
+ $dostup[$row["id"]] = json_decode($row["dostup"], true);
+
+}
+
+
+echo'<form method=post action="/shipment/fields/">';
+?><input type="hidden" name="_csrf" value="<?=Yii::$app->request->getCsrfToken()?>" /><?php
+
+
+$data=$db::getRows("SELECT * FROM store_orders_fields");
+echo'<table class="table table-hover"><thead><th width=100>название кратко</th>
+<th>name_eng</th>
+<th>SQL таблица сохранения</th>
+
+<th>тип</th>
+<th>тип данных</th>
+
+<th>сумма по столбцу</th>
+<th>сохраняем цвета в ячейке</th>
+
+
+</thead><tbody>';
+foreach($data as $row) {
+
+ echo"
+ <tr><td><b>".$row["name"]."<b><br>
+ <small>".$row["name_full"]."</small></td>
+
+
+ <td>".$row["name_eng"]."</td>
+ <td>".$row["sql_table_values"]."</td>
+ <td>".$row["type"]."";
+
+ if(in_array($row["type"],array("multiplication","avg","difference")))
+ echo" <input type=text class=\"form-control\" name=func_content[".$row["id"]."] value=\"".$row["func_content"]."\">";
+
+ echo"</td>
+ <td>".$row["tip"]."</td>
+
+ <td>"; if($row["summ"]) echo"да"; echo"</td>
+ <td>"; if($row["colors_save"]) echo"да"; echo"</td>
+ </tr><tr><td colspan=7><textarea class=\"form-control\" name=description[".$row["id"]."] rows=1>".$row["description"]."</textarea></td></tr>";
+ /*
+ echo'<tr><td colspan=7><table>';
+ foreach($statuses as $gid => $name) {
+ if(!empty($roles[$gid])) {
+
+ echo"<tr><td class=\"text-right\">".$name."</td><td style=\"min-width:300px\"> ";
+
+ // $dostup[$status_id]
+
+ echo' </td></tr>';
+
+
+
+ }
+ }
+ echo'</table></td></tr>';
+ */
+
+}
+echo'</tbody></table><button class="btn btn-success" name="save" value=1>сохранить</button></div></form>';
+
+echo "</div>";
+
+//include"templates/bottom.php";
+
+
+
+
+
+