<?php

$sql_query = 'UPDATE ' . $config['table_prefix'] . 'calc_template SET ';
$sql_query .= <<<'EOT'
params = '{
    "title": "Дата: Разница между датами",
    "help": "tpl_diff_dates",
    "parameters": {
        "field": {
            "type": "Field",
            "name": "field",
            "type_field": [2,12],
            "description": "Выберите поле первой даты",
            "help": "tpl_first_field"
        },
        "cur_field": {
            "type": "Field",
            "name": "cur_field",
            "type_field": [2,12],
            "description": "Выберите поле второй даты",
            "help": "tpl_second_field"
        },
        "case_type": {
            "type": "List",
            "name": "case_type",
            "values":{"1":"Текст","2":"Число"},
            "description": "Записывать результат в виде",
            "help": "tpl_to_field"
        },
        "value": {            
            "type": "Field",            
            "name": "value",            
            "type_field": [1,3],            
            "description": "Выберите поле, в которое сохранять значение",            
            "no_system": true,            
            "help": "tpl_to_field"        
        }, 
        "time": {
            "type": "Checkbox",
            "name": "time",
            "description": "Учитывать рабочее время",
            "values": {"0": "Нет", "1": "Да"},
            "help": "tpl_checkbox_working_time"
        },
        "time_work_on": {
            "type": "String",
            "name": "time_work_on",
            "description": "Введите время начала работы",
            "help": "tpl_time_work_on"
        },
         "time_work_off": {
            "type": "String",
            "name": "time_work_off",
            "description": "Введите время завершения работы",
            "help": "tpl_time_work_off"
        },
        "day_off": {
            "type": "Checkbox",
            "name": "day_off",
            "description": "Не учитывать выходные дни",
           "values": {"0": "Нет", "1": "Да"},
           "help": "tpl_checkbox_day_off"
        },
        "holiday": {
            "type": "Checkbox",
            "name": "holiday",
            "description": "Не учитывать праздничные дни",
            "values": {"0": "Нет", "1": "Да"},
           "help": "tpl_checkbox_holiday"
        },
        "gen_field": {
            "type": "TableField",
            "name": "gen_field",
            "description": "Таблица праздничных дат",
            "field_description": "Поле-источник праздничных дат",
            "check_link_field": "true",
            "help": "tpl_holiday",
            "field_help": "tpl_one_holiday"
        },
        "case_measure": {
            "type": "List",
            "name": "case_measure",
            "values":{"1":"Секунд","2":"Минут","3":"Часов","4":"Дней","5":"Недель","6":"Месяцев","7":"Лет"},
            "description": "Выберите единицу измерения",
            "help": "tpl_chose_unit"
        },
        "floor_round": {
            "type": "List",
            "name": "floor_round",
            "values":{"1":"Да","0":"Нет"},
            "description": "Округлять в меньшую сторону",
            "help": "tpl_round_down"
        }
    },
    "events": [
        {
            "type": 3,
            "field": "field"
        },
        {
            "type": 3,
            "field": "field1"
        },
        {
            "type": 3,
            "field": "gen_field"
         }
    ]
}' WHERE id = 84
EOT;
run_query($sql_query);