<?php
$sql_query = 'UPDATE ' . $config['table_prefix'] . 'calc_template SET ';
$sql_query .= <<<'EOT'
calculate_tpl = '$orig_date = strtotime($line[\'{$cur_field1}\']);\r\n$number = {if $number_value}{$number_value}{else}$line[\'{$cur_field2}\']{/if};\r\n{if $case_measure == 1}\r\n$new_date = $orig_date {$operand} $number;\r\n{elseif $case_measure == 2}\r\n$new_date = $orig_date {$operand} $number * 60;\r\n{elseif $case_measure == 3}\r\n$new_date = $orig_date {$operand} $number * 3600;\r\n{elseif $case_measure == 4}\r\n$new_date = $orig_date {$operand} $number * 3600 * 24;\r\n{elseif $case_measure == 5}\r\n$new_date = $orig_date {$operand} $number * 3600 * 24 * 7;\r\n{elseif $case_measure == 6}\r\n$new_date = mktime(date(\'H\', $orig_date), date(\'i\', $orig_date), date(\'s\', $orig_date), date(\'n\', $orig_date) {$operand} $number, date(\'j\', $orig_date), date(\'Y\', $orig_date));\r\n{elseif $case_measure == 7}\r\n$new_date = mktime(date(\'H\', $orig_date), date(\'i\', $orig_date), date(\'s\', $orig_date), date(\'n\', $orig_date), date(\'j\', $orig_date), date(\'Y\', $orig_date) {$operand} $number);\r\n{/if}\r\n$line[\'{$cur_field3}\'] = date(\'Y-m-d H:i:s\', $new_date);'
WHERE id = 86
EOT;
run_query($sql_query);