<?php
$sql_query = 'INSERT INTO ' . $config['table_prefix'] . 'calc_template (`id`, `name`, `calculate_tpl`, `params`, `type`, `tpl_name`, `javascript_tpl`, `tpl_category`, `calc_types`, `calc_num`) VALUES ';
$sql_query .= <<<'EOT'
(126, 'Создать запись в подтаблице через форму',	'foreach ($_SESSION[\'back_urls\'] as $back_url => $url) {\r\n    if (strpos($url, \"view_line2.php?table=$table_id\") && strpos($url, \"&line=$ID\")) break;\r\n}\r\nheader(\"Location: view_line2.php?table={$sub_table.subTable}&line=new&{$sub_table.link_field_id}=$ID&back_url=$back_url\");',	'{\r\n    \"title\": \"Создать запись в подтаблице через форму\",\r\n    \"help\": \"create_subrecord_by_form\",\r\n    \"parameters\": {\r\n        \"sub_table\": {\r\n            \"type\": \"SubField\",\r\n            \"name\": \"sub_table\",\r\n            \"description\": \"Подтаблица\",\r\n            \"sub_description\": \"\",\r\n            \"help\": \"tpl_sub_table\",\r\n            \"field_help\": \"tpl_sub_field\"\r\n        },\r\n        \"res_field\": {\r\n            \"type\": \"Field\",\r\n            \"name\": \"res_field\",\r\n            \"description\": \"\",\r\n            \"help\": \"\"\r\n        }\r\n    }\r\n}',	'button',	'create_line_subtable.tpl',	'',	2,	'[]',	6)
EOT;
run_query($sql_query);