CREATE TABLE `perioda_prolongacie` (
                                       `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
                                       `nazov` varchar(50) NOT NULL,
                                       PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;

INSERT INTO `perioda_prolongacie` (`id`, `nazov`)
VALUES
(1, '1 rok'),
(2, '2 roky'),
(3, '3 roky');

/* 07:14:17 */ ALTER TABLE `zmluva` ADD `automaticka_prolongacia` TINYINT(1)  NOT NULL  DEFAULT '0'  AFTER `poznamka_k_zmene`;

/* 07:14:31 */ ALTER TABLE `zmluva` ADD `perioda_prolongacie_id` INT(11)  UNSIGNED  NULL  DEFAULT NULL  AFTER `automaticka_prolongacia`;
/* 07:15:42 */ ALTER TABLE `zmluva` ADD CONSTRAINT `FK_zmluva_perioda_prolongacie_id` FOREIGN KEY (`perioda_prolongacie_id`) REFERENCES `perioda_prolongacie` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT;

/* 07:18:13 */ INSERT INTO `menu` (`id`, `menu_id`, `nazov`, `page`, `poradie`, `level`, `visibility_type`) VALUES ('35', '1', 'Automatická prolongácia', 'zmluva_automaticka_prolongacia_vypis', '40', '2', '1');
/* 07:19:00 */ INSERT INTO `permission` (`id`, `nazov`) VALUES ('158', 'zmluva_automaticka_prolongacia_vypis');
/* 07:19:07 */ INSERT INTO `role_permission` (`role_id`, `permission_id`) VALUES ('2', '158');
/* 07:19:12 */ INSERT INTO `role_permission` (`role_id`, `permission_id`) VALUES ('5', '158');

/* 07:22:48 */ ALTER TABLE `zmluva` ADD `datum_prolongacie` DATE  NULL  AFTER `perioda_prolongacie_id`;
/* 17:24:51 */ ALTER TABLE `zmluva` ADD `automaticka_prolongacia_odsuhlasena` TINYINT(1)  NOT NULL  DEFAULT '0'  AFTER `datum_prolongacie`;

/* 07:24:17 */ INSERT INTO `form_element` (`id`, `form_group_id`, `form_element_type_id`, `db_table`, `db_column`, `db_multi_table`, `db_multivalue_table`, `column_title`, `position`, `attribute`, `width`, `height`, `help`, `example`, `direct_to_db`, `required`, `number`, `float_number`, `email`, `css_style`, `css_class`, `javascript`, `direct_multi_label`, `direct_multi_data`, `default_val`, `vdaemon`, `add_empty_option`, `html`, `lang_code`, `read_only`) VALUES ('146', '11', '3', 'zmluva', 'automaticka_prolongacia', NULL, NULL, 'Automatická prolongácia', '65', NULL, NULL, NULL, NULL, NULL, '1', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '1');
/* 07:24:49 */ INSERT INTO `form_element` (`id`, `form_group_id`, `form_element_type_id`, `db_table`, `db_column`, `db_multi_table`, `db_multivalue_table`, `column_title`, `position`, `attribute`, `width`, `height`, `help`, `example`, `direct_to_db`, `required`, `number`, `float_number`, `email`, `css_style`, `css_class`, `javascript`, `direct_multi_label`, `direct_multi_data`, `default_val`, `vdaemon`, `add_empty_option`, `html`, `lang_code`, `read_only`) VALUES ('147', '11', '4', 'zmluva', 'datum_prolongacie', NULL, NULL, 'Dátum prolongácie', '66', NULL, NULL, NULL, NULL, NULL, '1', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '1');
/* 07:25:54 */ INSERT INTO `form_element` (`id`, `form_group_id`, `form_element_type_id`, `db_table`, `db_column`, `db_multi_table`, `db_multivalue_table`, `column_title`, `position`, `attribute`, `width`, `height`, `help`, `example`, `direct_to_db`, `required`, `number`, `float_number`, `email`, `css_style`, `css_class`, `javascript`, `direct_multi_label`, `direct_multi_data`, `default_val`, `vdaemon`, `add_empty_option`, `html`, `lang_code`, `read_only`) VALUES ('148', '11', '5', 'zmluva', 'perioda_prolongacie_id', 'perioda_prolongacie', NULL, 'Perióda prolongácie', '67', NULL, NULL, NULL, NULL, NULL, '1', NULL, NULL, NULL, NULL, NULL, 'select2', NULL, '1', NULL, NULL, NULL, '1', NULL, NULL, '1');
/* 07:29:37 */ UPDATE `form_element` SET `read_only` = NULL WHERE `id` = '146';
/* 07:29:41 */ UPDATE `form_element` SET `read_only` = NULL WHERE `id` = '147';
/* 07:29:42 */ UPDATE `form_element` SET `read_only` = NULL WHERE `id` = '148';

/* 20:36:20 */ INSERT INTO `priradenie_komunikacie` (`id`, `nazov`, `code`) VALUES ('1', 'Zmluva', 'zmluva');
/* 21:03:14 */ INSERT INTO `log_type` (`id`, `nazov`, `code`, `primary_table`) VALUES ('67', 'Automatická prolongácia', 'zmluva_automaticka_prolongacia', NULL);
/* 21:26:44 */ UPDATE `form_element` SET `vdaemon` = '<vlvalidator name=\"customAutomatickaProlongacia\" type=\"custom\" function=\"vdaemonAutomatickaPrologacia\" />' WHERE `id` = '146';

/* 22:45:39 */ ALTER TABLE `zmluva` ADD `prolongovat_pred_ukoncenim` INT (10) UNSIGNED  NULL  DEFAULT NULL  AFTER `datum_prolongacie`;
/* 22:46:14 */ ALTER TABLE `zmluva` DROP `datum_prolongacie`;
/* 22:47:21 */ UPDATE `form_element` SET `form_element_type_id` = '1', `db_column` = 'prolongovat_pred_ukoncenim', `column_title` = 'Prolongovať pred ukončením', `example` = 'počet dní', `number` = '1' WHERE `id` = '147';
/* 22:55:33 */ UPDATE `form_element` SET `example` = 'dní' WHERE `id` = '147';
