/*3*/ UPDATE `form_element` SET `css_class`='select2', `direct_multi_label`='1' WHERE  `id`=118;

INSERT INTO `log_type` (`id`, `nazov`, `code`, `primary_table`) VALUES (58, 'Editovanie fakturácie pre zmluvu', 'zmluva_fakturacia_edituj', NULL);

/*83*/ INSERT INTO `form` (`id`, `nazov`, `code`) VALUES ('12', 'Položka k fakturácií zmluvy', 'zmluva_fakturacia_polozka');
/*84*/ INSERT INTO `form_group` (`id`, `form_id`, `nazov`, `code`, `position`, `poznamka`) VALUES ('27', '12', 'Základné informácie', 'zmluva_fakturacia_polozka', '10', NULL);

/*54*/ INSERT INTO `form_group` (`id`, `form_id`, `nazov`, `code`, `position`, `poznamka`) VALUES ('24', '11', 'Rozšírené informácie', 'zmluva_fakturacia_rozsirene_informacie', '40', NULL);
/*55*/ UPDATE `form_group` SET `code`='zmluva_fakturacia_zakladne_informacie' WHERE  `id`=23;
/*56*/ INSERT INTO `form_group` (`id`, `form_id`, `nazov`, `code`, `position`, `poznamka`) VALUES ('25', '11', 'Prevádzka', 'zmluva_fakturacia_prevadzka', '20', NULL);
/*57*/ INSERT INTO `form_group` (`id`, `form_id`, `nazov`, `code`, `position`, `poznamka`) VALUES ('26', '11', 'Poštová adresa', 'zmluva_fakturacia_postova_adresa', '30', NULL);

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 (119, 25, 1, 'zmluva_fakturacia', 'prevadzka_nazov', NULL, NULL, 'Prevádzka', 20, NULL, NULL, NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
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 (120, 25, 1, 'zmluva_fakturacia', 'prevadzka_ulica', NULL, NULL, 'Prevádzka - ulica', 20, NULL, NULL, NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
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 (121, 25, 1, 'zmluva_fakturacia', 'prevadzka_psc', NULL, NULL, 'Prevádzka - PSČ', 30, NULL, NULL, NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
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 (122, 25, 1, 'zmluva_fakturacia', 'prevadzka_obec', NULL, NULL, 'Prevádzka - obec', 40, NULL, NULL, NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
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 (123, 26, 1, 'zmluva_fakturacia', 'nazov', NULL, NULL, 'Poštová adresa', 50, NULL, NULL, NULL, NULL, NULL, 1, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '<span id="load_adresa_from_obchodny_partner" title=\'Načítať údaje z obchodného partnera\'></span>', NULL, NULL);
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 (124, 26, 1, 'zmluva_fakturacia', 'ulica', NULL, NULL, 'Poštová adresa - ulica', 60, NULL, NULL, NULL, NULL, NULL, 1, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
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 (125, 26, 1, 'zmluva_fakturacia', 'psc', NULL, NULL, 'Poštová adresa - PSČ', 70, NULL, NULL, NULL, NULL, NULL, 1, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
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 (126, 26, 1, 'zmluva_fakturacia', 'obec', NULL, NULL, 'Poštová adresa - obec', 80, NULL, NULL, NULL, NULL, NULL, 1, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
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 (127, 23, 5, 'zmluva_fakturacia', 'fakturovat_ku_id', 'fakturovat_ku', NULL, 'Fakturovať ku', 90, NULL, NULL, NULL, NULL, NULL, 1, 1, NULL, NULL, NULL, NULL, 'select2', NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
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 (128, 23, 5, 'zmluva_fakturacia', 'zasielanie_faktury_id', 'zasielanie_faktury', NULL, 'Zasielanie faktúry', 100, NULL, NULL, NULL, NULL, NULL, 1, 1, NULL, NULL, NULL, NULL, 'select2', NULL, 1, NULL, NULL, NULL, 1, NULL, NULL, NULL);
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 (129, 24, 2, 'zmluva_fakturacia', 'horny_text', NULL, NULL, 'Text nad položkami', 110, NULL, NULL, 40, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
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 (130, 24, 2, 'zmluva_fakturacia', 'dolny_text', NULL, NULL, 'Text pod položkami', 120, NULL, NULL, 40, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
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 (131, 23, 1, 'zmluva_fakturacia', 'splatnost_faktury', NULL, NULL, 'Splatnosť faktúry', 130, NULL, NULL, NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
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 (132, 23, 9, 'zmluva_fakturacia', 'zmluva_id', 'zmluva', NULL, 'Zmluva', 5, NULL, NULL, NULL, NULL, NULL, 1, 1, NULL, NULL, NULL, NULL, 'select2', NULL, 1, 1, NULL, '<vlvalidator name="vdaemonZmluvaId" type="custom" function="vdaemonZmluvaId" />', NULL, NULL, NULL, NULL);
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 (133, 23, 1, 'zmluva_fakturacia', 'zadany_den_v_periode', NULL, NULL, 'Zadaný deň v perióde', 91, NULL, NULL, NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
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 (134, 27, 1, 'zmluva_fakturacia_polozka', 'nazov', NULL, NULL, 'Názov', 20, NULL, NULL, NULL, NULL, NULL, 1, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
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 (135, 27, 6, 'zmluva_fakturacia_polozka', 'sluzba_id', 'sluzba', NULL, 'Služba', 10, NULL, NULL, NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1, 1, NULL, NULL, NULL, NULL, NULL, NULL);
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 (136, 27, 13, 'zmluva_fakturacia_polozka', 'zmluva_fakturacia_id', 'NULL', NULL, 'Zmluva fakturácia', 0, NULL, NULL, NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);

/*75*/ ALTER TABLE `zmluva_fakturacia`
  CHANGE COLUMN `prevadzka_mesto` `prevadzka_obec` VARCHAR(255) NULL DEFAULT NULL AFTER `prevadzka_psc`,
  CHANGE COLUMN `mesto` `obec` VARCHAR(255) NULL DEFAULT NULL AFTER `psc`;

/*90*/ ALTER TABLE `zmluva_fakturacia_polozka`
  ADD COLUMN `visibility_type` TINYINT(1) NULL AFTER `zmluva_fakturacia_id`;
/*91*/ INSERT INTO `menu` (`id`, `menu_id`, `nazov`, `page`, `poradie`, `level`, `visibility_type`) VALUES ('31', '2', 'Pridanie položky k fakturácií', 'zmluva_fakturacia_pridaj', '0', '3', '0');
/*92*/ INSERT INTO `menu` (`id`, `menu_id`, `nazov`, `page`, `poradie`, `level`, `visibility_type`) VALUES ('32', '2', 'Editovanie položky k fakturácií', 'zmluva_fakturacia_edituj', '0', '3', '0');
/*93*/ INSERT INTO `menu` (`id`, `menu_id`, `nazov`, `page`, `poradie`, `level`, `visibility_type`) VALUES ('33', '2', 'Zmazanie položky k fakturácií', 'zmluva_fakturacia_zmaz', '0', '3', '0');

CREATE TABLE `zmluva_fakturacia_polozka_sluzba` (
                                                  `zmluva_fakturacia_polozka_id` INT(11) UNSIGNED NOT NULL,
                                                  `sluzba_id` INT(11) UNSIGNED NOT NULL,
                                                  PRIMARY KEY (`zmluva_fakturacia_polozka_id`, `sluzba_id`),
                                                  INDEX `FK_zmluva_fakturacia_polozka_sluzba_sluzba_id` (`sluzba_id`),
                                                  CONSTRAINT `FK_zmluva_fakturacia_polozka_sluzba_polozka_id` FOREIGN KEY (`zmluva_fakturacia_polozka_id`) REFERENCES `zmluva_fakturacia_polozka` (`id`) ON UPDATE CASCADE ON DELETE CASCADE,
                                                  CONSTRAINT `FK_zmluva_fakturacia_polozka_sluzba_sluzba_id` FOREIGN KEY (`sluzba_id`) REFERENCES `sluzba` (`id`) ON UPDATE CASCADE ON DELETE CASCADE
)
  COLLATE='utf8_general_ci'
  ENGINE=InnoDB
;