/*1*/ INSERT INTO `form_group` (`id`, `form_id`, `nazov`, `code`, `position`) VALUES (35000, 350, 'Základné informácie', 'dokument_zakladne_informacie', 10);
/*2*/ INSERT INTO `form_element_type` (`id`, `code`) VALUES (16, 'file');
/*3*/ INSERT INTO `form_element` (`id`, `form_group_id`, `form_element_type_id`, `db_table`, `db_column`, `column_title`, `position`, `direct_to_db`, `required`) VALUES (35000, 35000, 1, 'dokument', 'nazov', 'Názov', 10, 1, 1);
/*4*/ INSERT INTO `form_element` (`id`, `form_group_id`, `form_element_type_id`, `db_table`) VALUES (35001, 35000, 1, 'dokument');
/*5*/ UPDATE `form_element` SET `db_column`='nazov_u_zakaznika', `column_title`='Názov u zákazníka' WHERE  `id`=35001;
/*6*/ UPDATE `form_element` SET `position`=20, `direct_to_db`=1 WHERE  `id`=35001;

/*8*/ INSERT INTO `form_element` (`id`, `form_group_id`, `form_element_type_id`, `db_table`, `db_column`, `db_multi_table`, `column_title`, `position`, `direct_to_db`, `required`, `css_class`, `direct_multi_label`, `add_empty_option`) VALUES (35002, 35000, 5, 'dokument', 'typ_dokumentu_id', 'typ_dokumentu', 'Typ dokumentu', 40, 1, 1, 'select2', 1, 1);
/*9*/ INSERT INTO `form_element` (`id`, `form_group_id`, `form_element_type_id`, `db_table`, `db_column`, `db_multi_table`, `column_title`, `position`, `direct_to_db`, `required`, `css_class`, `add_empty_option`) VALUES (35003, 35000, 5, 'dokument', 'smernica_id', 'smernica', 'Smernica', 30, 1, 1, 'select2', 1);
/*10*/ INSERT INTO `form_element` (`id`, `form_group_id`, `form_element_type_id`, `db_table`, `db_column`, `column_title`, `position`, `direct_to_db`, `required`) VALUES (35004, 35000, 10, 'dokument', 'revizia', 'Revízia', 50, 1, 1);
/*11*/ INSERT INTO `form_element` (`id`, `form_group_id`, `form_element_type_id`, `db_table`, `db_column`, `column_title`, `position`, `read_only`) VALUES (35005, 35000, 4, 'dokument', 'datum_pridania', 'Dátum pridania', 60, 1);
/*12*/ INSERT INTO `form_element` (`id`, `form_group_id`, `form_element_type_id`, `db_table`, `db_column`, `db_multi_table`, `column_title`, `position`, `css_class`, `direct_multi_label`, `read_only`) VALUES (35006, 35000, 5, 'dokument', 'vytvoril_id', 'zamestnanec', 'Vytvoril', 70, 'select2', 1, 1);
/*13*/ INSERT INTO `form_element` (`id`, `form_group_id`, `form_element_type_id`, `db_table`, `db_column`, `db_multi_table`, `column_title`, `position`, `direct_to_db`, `required`) VALUES (35007, 35000, 16, 'dokument', 'subor_id', 'subor', 'Súbor', 80, 1, 1);
/*14*/ UPDATE `form_element` SET `form_element_type_id`=1 WHERE  `id`=35004;
/*15*/ INSERT INTO `form_element` (`id`, `form_group_id`, `form_element_type_id`, `db_table`, `db_column`, `db_multi_table`, `column_title`, `position`, `css_class`, `direct_multi_label`, `read_only`) VALUES (35008, 35000, 5, 'dokument', 'obchodny_partner_id', 'obchodny_partner', 'Typ firmy', 25, 'select2', 1, 1);
/*16*/ ALTER TABLE `dokument`
	ADD COLUMN `obchodny_partner_id` INT(10) NULL DEFAULT NULL AFTER `nazov_u_zakaznika`,
	ADD COLUMN `smernica_id` INT(10) NULL DEFAULT NULL AFTER `obchodny_partner_id`,
	CHANGE COLUMN `subor` `subor_id` INT(10) NULL DEFAULT NULL AFTER `smernica_id`;

	UPDATE dokument SET subor_id = NULL;

/*22*/ ALTER TABLE `dokument`
	CHANGE COLUMN `obchodny_partner_id` `obchodny_partner_id` INT(10) UNSIGNED NULL DEFAULT NULL AFTER `nazov_u_zakaznika`,
	CHANGE COLUMN `smernica_id` `smernica_id` INT(10) UNSIGNED NULL DEFAULT NULL AFTER `obchodny_partner_id`,
	CHANGE COLUMN `subor_id` `subor_id` INT(11) UNSIGNED NULL DEFAULT NULL AFTER `smernica_id`,
	ADD CONSTRAINT `FK_dokument_obchodny_partner` FOREIGN KEY (`obchodny_partner_id`) REFERENCES `obchodny_partner` (`id`) ON UPDATE RESTRICT ON DELETE RESTRICT,
	ADD CONSTRAINT `FK_dokument_smernica` FOREIGN KEY (`smernica_id`) REFERENCES `smernica` (`id`) ON UPDATE RESTRICT ON DELETE RESTRICT,
	ADD CONSTRAINT `FK_dokument_subor` FOREIGN KEY (`subor_id`) REFERENCES `subor` (`id`) ON UPDATE RESTRICT ON DELETE RESTRICT;
/*23*/ UPDATE `form_element` SET `direct_to_db`=1, `required`=1, `add_empty_option`=1, `read_only`=NULL WHERE  `id`=35008;


/*2*/ ALTER TABLE `dokument`
	CHANGE COLUMN `datum_pridania` `datum_pridania` DATETIME NULL DEFAULT NULL AFTER `smernica_id`;
/*4*/ INSERT INTO `priradenie_suboru` (`id`, `nazov`, `code`) VALUES (35000, 'Dokument', 'dokument');
/*6*/ INSERT INTO `menu` (`id`, `menu_id`, `nazov`, `page`, `poradie`, `level`, `visibility_type`) VALUES (111, 105, 'Detail vzorového dokumentu', 'vzorovy_dokument_view', 10, 3, 1);
/*11*/ RENAME TABLE `obchodny_partner_typ_sluzby` TO `obchodny_partner_sluzba`;
/*12*/ UPDATE `form` SET `nazov`='Obchodný partner služba', `code`='obchodny_partner_sluzba' WHERE  `id`=10;
/*13*/ UPDATE `form_element` SET `db_table`='obchodny_partner_sluzba' WHERE  `id`=3;
/*14*/ UPDATE `form_element` SET `db_table`='obchodny_partner_sluzba' WHERE  `id`=4;
/*15*/ UPDATE `form_element` SET `db_table`='obchodny_partner_sluzba' WHERE  `id`=5;
/*16*/ UPDATE `form_element` SET `db_table`='obchodny_partner_sluzba' WHERE  `id`=6;
/*17*/ UPDATE `menu` SET `page`='obchodny_partner_sluzba_vypis' WHERE  `id`=100;
/*18*/ UPDATE `menu` SET `page`='obchodny_partner_sluzba_pridaj' WHERE  `id`=101;
/*19*/ UPDATE `menu` SET `page`='obchodny_partner_sluzba_zmaz' WHERE  `id`=102;
/*20*/ UPDATE `menu` SET `page`='obchodny_partner_sluzba_edituj' WHERE  `id`=103;
/*21*/ UPDATE `form_element` SET `vdaemon`='<vlvalidator name="customObchodnyPartnerTypSluzby" type="custom" function="vdaemonObchodnyPartnerSluzba" />' WHERE  `id`=5;
/*22*/ UPDATE `menu` SET `page`='vzorovy_dokument_pridaj' WHERE  `id`=106;
/*23*/ UPDATE `menu` SET `nazov`='Pridaj vzorový dokument malé fy.', `page`='vzorovy_dokument_male_fy_pridaj' WHERE  `id`=106;
/*24*/ INSERT INTO `menu` (`id`, `menu_id`, `nazov`, `page`, `poradie`, `level`, `visibility_type`) VALUES (112, 104, 'Pridaj vzorový dokument veľké fy.', 'vzorovy_dokument_velke_fy_pridaj', 25, 2, 1);