<?php

$sql_query = 'UPDATE ' . $config['table_prefix'] . 'calc_template SET ';
$sql_query .= <<<'EOT'
calculate_tpl = '{if $put_field_type eq 2}\r\n{if $case_type eq 2}\r\n$line[\'{$put_field.field}\'] = date(\'Y-m-d H:i:s\');\r\n{else}\r\n$line[\'{$put_field.field}\'] = date(\'Y-m-d H:i:s\', strtotime(\'{$put_field.set_value}\'));\r\n{/if}\r\n{elseif $put_field_type eq 7}\r\n$result = sql_select_array(FIELDS_TABLE, \'id=\' . mb_substr(\'{$put_field.field}\', 1));\r\n\r\nif ($result[\'mult_value\'] == 1) {\r\n    $current_value = $line[\'{$put_field.field}\'];\r\n    $line[\'{$put_field.field}\'] = $current_value == \'\' ? \'-\'.{if $put_field.set_value == \'{текущий}\'}$user[\'id\']{else}\'{$put_field.set_value}\'{/if}.\'-\' : $current_value.{if $put_field.set_value == \'{текущий}\'}$user[\'id\']{else}\'{$put_field.set_value}\'{/if}.\'-\';\r\n} else {\r\n    $line[\'{$put_field.field}\'] = {if $put_field.set_value == \'{текущий}\'}$user[\'id\']{else}\'{$put_field.set_value}\'{/if};\r\n}\r\n{else}\r\n$line[\'{$put_field.field}\'] = \'{$put_field.set_value}\';\r\n{/if}' WHERE id = 85
EOT;
run_query($sql_query);
