Ignore:
Timestamp:
Mar 3, 2013, 1:03:25 PM (12 years ago)
Author:
chronos
Message:
  • Upraveno: Zobecněn proces aktualizace dat tabulek při přechodu na nové období. Nyní se používá pole Action jakožto akce přidat, změnit, odebrat a ReplaceId jakožto id položky, které se operace týká.
  • Přidáno: Podpora pro uživatelské akce v seznamech v sekci Správa dat.
  • Upraveno: Řešení procesu generování nových faktur a plateb zákazníků při přechodu na nové období.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/FullInstall.php

    r494 r497  
    33function FullInstall($Manager)
    44{
    5   $Manager->Execute("CREATE TABLE IF NOT EXISTS `ChatHistory` (
     5  $Manager->Execute("
     6--
     7-- Funkce
     8--
     9CREATE DEFINER=`centrala`@`localhost` FUNCTION `CompareNetworkPrefix`(Address1 INT(11) UNSIGNED, Address2 INT(11) UNSIGNED, Size INT(11)) RETURNS tinyint(1)
     10RETURN Address1 & (-1 << (32 - Size)) = Address2 & (-1 << (32 - Size));
     11     
     12--
     13-- Struktura tabulky `ChatHistory`
     14--
     15
     16CREATE TABLE IF NOT EXISTS `ChatHistory` (
    617  `Id` int(11) NOT NULL AUTO_INCREMENT,
    718  `Nick` varchar(64) COLLATE utf8_czech_ci NOT NULL,
     
    100111  `ValidTo` date DEFAULT NULL,
    101112  PRIMARY KEY (`Id`)
    102 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
     113) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;
    103114
    104115-- --------------------------------------------------------
     
    115126  PRIMARY KEY (`Id`),
    116127  KEY `Employee` (`Employee`)
    117 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
     128) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;
    118129
    119130-- --------------------------------------------------------
     
    127138  `Name` varchar(256) COLLATE utf8_czech_ci NOT NULL,
    128139  `Size` int(11) NOT NULL,
    129   PRIMARY KEY (`Id`)
    130 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;
     140  `Directory` int(11) DEFAULT NULL,
     141  PRIMARY KEY (`Id`),
     142  KEY `Directory` (`Directory`)
     143) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=6298 ;
     144
     145--
     146-- RELACE PRO TABULKU `File`:
     147--   `Directory`
     148--       `FileDirectory` -> `Id`
     149--
     150
     151-- --------------------------------------------------------
     152
     153--
     154-- Struktura tabulky `FileDirectory`
     155--
     156
     157CREATE TABLE IF NOT EXISTS `FileDirectory` (
     158  `Id` int(11) NOT NULL AUTO_INCREMENT,
     159  `Name` varchar(255) NOT NULL,
     160  `Parent` int(11) DEFAULT NULL,
     161  PRIMARY KEY (`Id`),
     162  KEY `Parent` (`Parent`)
     163) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;
     164
     165--
     166-- RELACE PRO TABULKU `FileDirectory`:
     167--   `Parent`
     168--       `FileDirectory` -> `Id`
     169--
    131170
    132171-- --------------------------------------------------------
     
    184223
    185224--
    186 -- Struktura tabulky `FinanceBills`
    187 --
    188 
    189 CREATE TABLE IF NOT EXISTS `FinanceBills` (
     225-- Struktura tabulky `FinanceBillsItemsOld`
     226--
     227
     228CREATE TABLE IF NOT EXISTS `FinanceBillsItemsOld` (
     229  `Id` int(11) NOT NULL AUTO_INCREMENT,
     230  `Bill` int(11) NOT NULL DEFAULT '0',
     231  `Description` varchar(255) COLLATE utf8_czech_ci NOT NULL,
     232  `Price` float NOT NULL DEFAULT '0',
     233  `Quantity` float NOT NULL DEFAULT '1',
     234  PRIMARY KEY (`Id`),
     235  KEY `Bill` (`Bill`)
     236) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=17839 ;
     237
     238--
     239-- RELACE PRO TABULKU `FinanceBillsItemsOld`:
     240--   `Bill`
     241--       `FinanceBillsOld` -> `Id`
     242--
     243
     244-- --------------------------------------------------------
     245
     246--
     247-- Struktura tabulky `FinanceBillsOld`
     248--
     249
     250CREATE TABLE IF NOT EXISTS `FinanceBillsOld` (
    190251  `Id` int(11) NOT NULL AUTO_INCREMENT,
    191252  `TimeFrom` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
     
    204265
    205266--
    206 -- RELACE PRO TABULKU `FinanceBills`:
     267-- RELACE PRO TABULKU `FinanceBillsOld`:
    207268--   `Subject`
    208269--       `Subject` -> `Id`
    209 --
    210 
    211 -- --------------------------------------------------------
    212 
    213 --
    214 -- Struktura tabulky `FinanceBillsItems`
    215 --
    216 
    217 CREATE TABLE IF NOT EXISTS `FinanceBillsItems` (
    218   `Id` int(11) NOT NULL AUTO_INCREMENT,
    219   `Bill` int(11) NOT NULL DEFAULT '0',
    220   `Description` varchar(255) COLLATE utf8_czech_ci NOT NULL,
    221   `Price` float NOT NULL DEFAULT '0',
    222   `Quantity` float NOT NULL DEFAULT '1',
    223   PRIMARY KEY (`Id`),
    224   KEY `Bill` (`Bill`)
    225 ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=17839 ;
    226 
    227 --
    228 -- RELACE PRO TABULKU `FinanceBillsItems`:
    229 --   `Bill`
    230 --       `FinanceBills` -> `Id`
    231270--
    232271
     
    252291
    253292--
    254 -- Struktura tabulky `FinanceClaimLiabilityItem`
    255 --
    256 
    257 CREATE TABLE IF NOT EXISTS `FinanceClaimLiabilityItem` (
    258   `Id` int(11) NOT NULL AUTO_INCREMENT,
    259   `FinanceClaimLiability` int(11) NOT NULL DEFAULT '0',
     293-- Struktura tabulky `FinanceGroup`
     294--
     295
     296CREATE TABLE IF NOT EXISTS `FinanceGroup` (
     297  `Id` int(11) NOT NULL AUTO_INCREMENT,
     298  `Description` varchar(128) COLLATE utf8_czech_ci NOT NULL DEFAULT '',
     299  PRIMARY KEY (`Id`)
     300) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=4 ;
     301
     302-- --------------------------------------------------------
     303
     304--
     305-- Struktura tabulky `FinanceInvoice`
     306--
     307
     308CREATE TABLE IF NOT EXISTS `FinanceInvoice` (
     309  `Id` int(11) NOT NULL AUTO_INCREMENT,
     310  `BillCode` varchar(16) COLLATE utf8_czech_ci NOT NULL,
     311  `Subject` int(11) NOT NULL DEFAULT '0',
     312  `TimeCreation` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
     313  `TimeDue` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
     314  `TimePayment` datetime DEFAULT NULL,
     315  `Value` float NOT NULL DEFAULT '0',
     316  `File` int(11) DEFAULT NULL,
     317  `Text` varchar(255) COLLATE utf8_czech_ci NOT NULL DEFAULT '',
     318  `PeriodTo` date DEFAULT NULL,
     319  `PeriodFrom` date DEFAULT NULL,
     320  PRIMARY KEY (`Id`),
     321  KEY `Subject` (`Subject`),
     322  KEY `Bill` (`File`)
     323) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=8773 ;
     324
     325--
     326-- RELACE PRO TABULKU `FinanceInvoice`:
     327--   `File`
     328--       `File` -> `Id`
     329--   `Subject`
     330--       `Subject` -> `Id`
     331--
     332
     333-- --------------------------------------------------------
     334
     335--
     336-- Struktura tabulky `FinanceInvoiceItem`
     337--
     338
     339CREATE TABLE IF NOT EXISTS `FinanceInvoiceItem` (
     340  `Id` int(11) NOT NULL AUTO_INCREMENT,
     341  `FinanceInvoice` int(11) NOT NULL DEFAULT '0',
    260342  `Description` varchar(255) COLLATE utf8_czech_ci NOT NULL,
    261343  `Price` float NOT NULL DEFAULT '0',
     
    263345  `Quantity` float NOT NULL DEFAULT '1',
    264346  PRIMARY KEY (`Id`),
    265   KEY `FinanceClaimLiability` (`FinanceClaimLiability`)
    266 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;
    267 
    268 --
    269 -- RELACE PRO TABULKU `FinanceClaimLiabilityItem`:
    270 --   `FinanceClaimLiability`
    271 --       `FinanceClaimsLiabilities` -> `Id`
    272 --
    273 
    274 -- --------------------------------------------------------
    275 
    276 --
    277 -- Struktura tabulky `FinanceClaimsLiabilities`
    278 --
    279 
    280 CREATE TABLE IF NOT EXISTS `FinanceClaimsLiabilities` (
    281   `Id` int(11) NOT NULL AUTO_INCREMENT,
    282   `BillCode` varchar(16) COLLATE utf8_czech_ci NOT NULL,
    283   `Subject` int(11) NOT NULL DEFAULT '0',
    284   `TimeCreation` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
    285   `TimeDue` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
    286   `TimePayment` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
    287   `Value` float NOT NULL DEFAULT '0',
    288   `Bill` int(11) DEFAULT '0',
    289   `Text` varchar(255) COLLATE utf8_czech_ci NOT NULL DEFAULT '',
    290   `PeriodTo` date DEFAULT NULL,
    291   `PeriodFrom` date DEFAULT NULL,
    292   PRIMARY KEY (`Id`),
    293   KEY `Subject` (`Subject`),
    294   KEY `Bill` (`Bill`)
    295 ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=8770 ;
    296 
    297 --
    298 -- RELACE PRO TABULKU `FinanceClaimsLiabilities`:
    299 --   `Subject`
    300 --       `Subject` -> `Id`
    301 --
    302 
    303 -- --------------------------------------------------------
    304 
    305 --
    306 -- Struktura tabulky `FinanceGroup`
    307 --
    308 
    309 CREATE TABLE IF NOT EXISTS `FinanceGroup` (
    310   `Id` int(11) NOT NULL AUTO_INCREMENT,
    311   `Description` varchar(128) COLLATE utf8_czech_ci NOT NULL DEFAULT '',
    312   PRIMARY KEY (`Id`)
    313 ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=4 ;
     347  KEY `FinanceClaimLiability` (`FinanceInvoice`)
     348) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=8192 ;
     349
     350--
     351-- RELACE PRO TABULKU `FinanceInvoiceItem`:
     352--   `FinanceInvoice`
     353--       `FinanceInvoice` -> `Id`
     354--
    314355
    315356-- --------------------------------------------------------
     
    362403  `BillCode` varchar(32) COLLATE utf8_czech_ci DEFAULT NULL,
    363404  `Taxable` tinyint(1) NOT NULL DEFAULT '1',
    364   `Bill` int(11) DEFAULT NULL,
     405  `File` int(11) DEFAULT NULL,
    365406  `Text` varchar(255) COLLATE utf8_czech_ci NOT NULL DEFAULT 'Vklad',
    366407  `Network` int(11) NOT NULL DEFAULT '1',
     
    371412  UNIQUE KEY `BillCode_2` (`BillCode`),
    372413  KEY `Subject` (`Subject`),
    373   KEY `Bill` (`Bill`),
     414  KEY `Bill` (`File`),
    374415  KEY `BankAccount` (`BankAccount`),
    375416  KEY `Treasury` (`Treasury`)
    376 ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=6543 ;
     417) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=6546 ;
    377418
    378419--
    379420-- RELACE PRO TABULKU `FinanceOperation`:
     421--   `File`
     422--       `File` -> `Id`
    380423--   `Subject`
    381424--       `Subject` -> `Id`
    382 --   `Bill`
    383 --       `FinanceBills` -> `Id`
    384425--   `BankAccount`
    385426--       `FinanceBankAccount` -> `Id`
    386427--   `Treasury`
    387428--       `FinanceTreasury` -> `Id`
    388 --
    389 
    390 -- --------------------------------------------------------
    391 
    392 --
    393 -- Struktura tabulky `FinanceOperationItem`
    394 --
    395 
    396 CREATE TABLE IF NOT EXISTS `FinanceOperationItem` (
    397   `Id` int(11) NOT NULL AUTO_INCREMENT,
    398   `FinanceOperation` int(11) NOT NULL DEFAULT '0',
    399   `Description` varchar(255) COLLATE utf8_czech_ci NOT NULL,
    400   `Price` float NOT NULL DEFAULT '0',
    401   `VAT` float NOT NULL DEFAULT '0',
    402   `Quantity` float NOT NULL DEFAULT '1',
    403   PRIMARY KEY (`Id`),
    404   KEY `FinanceOperation` (`FinanceOperation`)
    405 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ;
    406 
    407 --
    408 -- RELACE PRO TABULKU `FinanceOperationItem`:
    409 --   `FinanceOperation`
    410 --       `FinanceOperation` -> `Id`
    411429--
    412430
     
    525543  PRIMARY KEY (`Id`),
    526544  KEY `Parent` (`Parent`)
    527 ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=38 ;
     545) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=40 ;
    528546
    529547--
     
    561579  KEY `Time` (`Time`),
    562580  KEY `User` (`User`)
    563 ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=41115 ;
     581) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=38283 ;
    564582
    565583--
     
    581599  `Longitude` double NOT NULL,
    582600  PRIMARY KEY (`Id`)
    583 ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=260 ;
     601) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=767 ;
    584602
    585603-- --------------------------------------------------------
     
    636654  KEY `BillingPeriodNext` (`BillingPeriodNext`),
    637655  KEY `NetworkSegment` (`NetworkSegment`)
    638 ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=200 ;
     656) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=201 ;
    639657
    640658--
     
    667685  PRIMARY KEY (`Id`),
    668686  KEY `Member` (`Member`)
    669 ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=182 ;
     687) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=183 ;
    670688
    671689--
     
    787805  KEY `Type` (`Type`),
    788806  KEY `MapPosition` (`MapPosition`)
    789 ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=644 ;
     807) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=645 ;
    790808
    791809--
     
    917935  KEY `Device` (`Device`),
    918936  KEY `Type` (`Type`)
    919 ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=711 ;
     937) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=712 ;
    920938
    921939--
     
    956974  KEY `host_id` (`NetworkInterface`),
    957975  KEY `time` (`Time`)
    958 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci;
     976) ENGINE=MyISAM DEFAULT CHARSET=utf8;
    959977
    960978-- --------------------------------------------------------
     
    9871005  KEY `Interface1` (`Interface1`),
    9881006  KEY `Interface2` (`Interface2`)
    989 ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=357 ;
     1007) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=356 ;
    9901008
    9911009--
    9921010-- RELACE PRO TABULKU `NetworkLink`:
     1011--   `Interface2`
     1012--       `NetworkInterface` -> `Id`
    9931013--   `Interface1`
    9941014--       `NetworkInterface` -> `Id`
    995 --   `Interface2`
    996 --       `NetworkInterface` -> `Id`
    9971015--
    9981016
     
    10211039  PRIMARY KEY (`Id`),
    10221040  KEY `Comment` (`Comment`)
    1023 ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1422 ;
     1041) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1430 ;
    10241042
    10251043-- --------------------------------------------------------
     
    11191137  KEY `Link` (`Link`),
    11201138  KEY `User` (`User`)
    1121 ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=973330 ;
     1139) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=973387 ;
    11221140
    11231141--
     
    12541272  KEY `AssignedGroup` (`AssignedGroup`),
    12551273  KEY `AssignedOperation` (`AssignedOperation`)
    1256 ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=226 ;
     1274) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=227 ;
    12571275
    12581276--
     
    13041322  KEY `UnitOfMeasure` (`UnitOfMeasure`),
    13051323  KEY `Manufacturer` (`Manufacturer`)
    1306 ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=180 ;
     1324) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=181 ;
    13071325
    13081326--
     
    13451363--
    13461364-- RELACE PRO TABULKU `Service`:
     1365--   `ReplaceId`
     1366--       `Service` -> `Id`
    13471367--   `Category`
    13481368--       `ServiceCategory` -> `Id`
    1349 --   `ReplaceId`
    1350 --       `Service` -> `Id`
    13511369--
    13521370
     
    13771395  KEY `Service` (`Service`),
    13781396  KEY `Customer` (`Customer`)
    1379 ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=437 ;
     1397) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=511 ;
    13801398
    13811399--
    13821400-- RELACE PRO TABULKU `ServiceCustomerRel`:
     1401--   `Service`
     1402--       `Service` -> `Id`
    13831403--   `Customer`
    13841404--       `Member` -> `Id`
     
    14321452  KEY `Segment` (`Segment`),
    14331453  KEY `Location` (`Location`)
    1434 ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=182 ;
     1454) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=186 ;
    14351455
    14361456--
     
    14621482  `DIC` varchar(32) COLLATE utf8_czech_ci NOT NULL DEFAULT '',
    14631483  `PayVAT` int(11) NOT NULL,
    1464   `MapPositionX` float NOT NULL DEFAULT '0',
    1465   `MapPositionY` float NOT NULL DEFAULT '0',
     1484  `MapPosition` int(11) DEFAULT NULL,
    14661485  `WWW` varchar(255) COLLATE utf8_czech_ci NOT NULL,
    14671486  `Note` varchar(255) COLLATE utf8_czech_ci NOT NULL,
    14681487  PRIMARY KEY (`Id`),
    1469   KEY `AddressCountry` (`AddressCountry`)
    1470 ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=231 ;
     1488  KEY `AddressCountry` (`AddressCountry`),
     1489  KEY `MapPosition` (`MapPosition`)
     1490) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=233 ;
    14711491
    14721492--
    14731493-- RELACE PRO TABULKU `Subject`:
     1494--   `MapPosition`
     1495--       `MapPosition` -> `Id`
    14741496--   `AddressCountry`
    14751497--       `Country` -> `Id`
     
    16631685  UNIQUE KEY `Name` (`Login`),
    16641686  UNIQUE KEY `Nick` (`Name`)
    1665 ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=252 ;
     1687) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=253 ;
    16661688
    16671689-- --------------------------------------------------------
     
    16781700  KEY `Customer` (`Customer`),
    16791701  KEY `User` (`User`)
    1680 ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=520 ;
     1702) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=521 ;
    16811703
    16821704--
     
    16961718CREATE TABLE IF NOT EXISTS `UserOnline` (
    16971719  `Id` int(11) NOT NULL AUTO_INCREMENT,
    1698   `User` int(11) NOT NULL DEFAULT '0' COMMENT 'User.Id',
     1720  `User` int(11) DEFAULT NULL COMMENT 'User.Id',
    16991721  `ActivityTime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
    17001722  `LoginTime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
     
    17051727  PRIMARY KEY (`Id`),
    17061728  KEY `User` (`User`)
    1707 ) ENGINE=MEMORY  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=2 ;
     1729) ENGINE=MEMORY  DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=2430 ;
    17081730
    17091731-- --------------------------------------------------------
     
    17471769
    17481770--
     1771-- Omezení pro tabulku `File`
     1772--
     1773ALTER TABLE `File`
     1774  ADD CONSTRAINT `File_ibfk_1` FOREIGN KEY (`Directory`) REFERENCES `FileDirectory` (`Id`);
     1775
     1776--
     1777-- Omezení pro tabulku `FileDirectory`
     1778--
     1779ALTER TABLE `FileDirectory`
     1780  ADD CONSTRAINT `FileDirectory_ibfk_1` FOREIGN KEY (`Parent`) REFERENCES `FileDirectory` (`Id`);
     1781
     1782--
    17491783-- Omezení pro tabulku `FinanceBankAccount`
    17501784--
     
    17531787
    17541788--
    1755 -- Omezení pro tabulku `FinanceBills`
    1756 --
    1757 ALTER TABLE `FinanceBills`
    1758   ADD CONSTRAINT `FinanceBills_ibfk_1` FOREIGN KEY (`Subject`) REFERENCES `Subject` (`Id`);
    1759 
    1760 --
    1761 -- Omezení pro tabulku `FinanceBillsItems`
    1762 --
    1763 ALTER TABLE `FinanceBillsItems`
    1764   ADD CONSTRAINT `FinanceBillsItems_ibfk_1` FOREIGN KEY (`Bill`) REFERENCES `FinanceBills` (`Id`);
    1765 
    1766 --
    1767 -- Omezení pro tabulku `FinanceClaimLiabilityItem`
    1768 --
    1769 ALTER TABLE `FinanceClaimLiabilityItem`
    1770   ADD CONSTRAINT `FinanceClaimLiabilityItem_ibfk_1` FOREIGN KEY (`FinanceClaimLiability`) REFERENCES `FinanceClaimsLiabilities` (`Id`);
    1771 
    1772 --
    1773 -- Omezení pro tabulku `FinanceClaimsLiabilities`
    1774 --
    1775 ALTER TABLE `FinanceClaimsLiabilities`
    1776   ADD CONSTRAINT `FinanceClaimsLiabilities_ibfk_1` FOREIGN KEY (`Subject`) REFERENCES `Subject` (`Id`);
     1789-- Omezení pro tabulku `FinanceBillsItemsOld`
     1790--
     1791ALTER TABLE `FinanceBillsItemsOld`
     1792  ADD CONSTRAINT `FinanceBillsItemsOld_ibfk_1` FOREIGN KEY (`Bill`) REFERENCES `FinanceBillsOld` (`Id`);
     1793
     1794--
     1795-- Omezení pro tabulku `FinanceBillsOld`
     1796--
     1797ALTER TABLE `FinanceBillsOld`
     1798  ADD CONSTRAINT `FinanceBillsOld_ibfk_1` FOREIGN KEY (`Subject`) REFERENCES `Subject` (`Id`);
     1799
     1800--
     1801-- Omezení pro tabulku `FinanceInvoice`
     1802--
     1803ALTER TABLE `FinanceInvoice`
     1804  ADD CONSTRAINT `FinanceInvoice_ibfk_2` FOREIGN KEY (`File`) REFERENCES `File` (`Id`),
     1805  ADD CONSTRAINT `FinanceInvoice_ibfk_1` FOREIGN KEY (`Subject`) REFERENCES `Subject` (`Id`);
     1806
     1807--
     1808-- Omezení pro tabulku `FinanceInvoiceItem`
     1809--
     1810ALTER TABLE `FinanceInvoiceItem`
     1811  ADD CONSTRAINT `FinanceInvoiceItem_ibfk_1` FOREIGN KEY (`FinanceInvoice`) REFERENCES `FinanceInvoice` (`Id`);
    17771812
    17781813--
     
    17801815--
    17811816ALTER TABLE `FinanceOperation`
     1817  ADD CONSTRAINT `FinanceOperation_ibfk_5` FOREIGN KEY (`File`) REFERENCES `File` (`Id`),
    17821818  ADD CONSTRAINT `FinanceOperation_ibfk_1` FOREIGN KEY (`Subject`) REFERENCES `Subject` (`Id`),
    1783   ADD CONSTRAINT `FinanceOperation_ibfk_2` FOREIGN KEY (`Bill`) REFERENCES `FinanceBills` (`Id`),
    17841819  ADD CONSTRAINT `FinanceOperation_ibfk_3` FOREIGN KEY (`BankAccount`) REFERENCES `FinanceBankAccount` (`Id`),
    17851820  ADD CONSTRAINT `FinanceOperation_ibfk_4` FOREIGN KEY (`Treasury`) REFERENCES `FinanceTreasury` (`Id`);
    1786 
    1787 --
    1788 -- Omezení pro tabulku `FinanceOperationItem`
    1789 --
    1790 ALTER TABLE `FinanceOperationItem`
    1791   ADD CONSTRAINT `FinanceOperationItem_ibfk_1` FOREIGN KEY (`FinanceOperation`) REFERENCES `FinanceOperation` (`Id`);
    17921821
    17931822--
     
    18681897--
    18691898ALTER TABLE `NetworkLink`
    1870   ADD CONSTRAINT `NetworkLink_ibfk_1` FOREIGN KEY (`Interface1`) REFERENCES `NetworkDevice` (`Id`),
    1871   ADD CONSTRAINT `NetworkLink_ibfk_2` FOREIGN KEY (`Interface1`) REFERENCES `NetworkInterface` (`Id`),
    1872   ADD CONSTRAINT `NetworkLink_ibfk_3` FOREIGN KEY (`Interface2`) REFERENCES `NetworkInterface` (`Id`);
     1899  ADD CONSTRAINT `NetworkLink_ibfk_2` FOREIGN KEY (`Interface2`) REFERENCES `NetworkInterface` (`Id`),
     1900  ADD CONSTRAINT `NetworkLink_ibfk_1` FOREIGN KEY (`Interface1`) REFERENCES `NetworkInterface` (`Id`);
    18731901
    18741902--
     
    19251953--
    19261954ALTER TABLE `Service`
    1927   ADD CONSTRAINT `Service_ibfk_1` FOREIGN KEY (`Category`) REFERENCES `ServiceCategory` (`Id`),
    1928   ADD CONSTRAINT `Service_ibfk_2` FOREIGN KEY (`ReplaceId`) REFERENCES `Service` (`Id`);
     1955  ADD CONSTRAINT `Service_ibfk_2` FOREIGN KEY (`ReplaceId`) REFERENCES `Service` (`Id`),
     1956  ADD CONSTRAINT `Service_ibfk_1` FOREIGN KEY (`Category`) REFERENCES `ServiceCategory` (`Id`);
    19291957
    19301958--
     
    19321960--
    19331961ALTER TABLE `ServiceCustomerRel`
     1962  ADD CONSTRAINT `ServiceCustomerRel_ibfk_3` FOREIGN KEY (`Service`) REFERENCES `Service` (`Id`),
    19341963  ADD CONSTRAINT `ServiceCustomerRel_ibfk_2` FOREIGN KEY (`Customer`) REFERENCES `Member` (`Id`);
    19351964
     
    19531982--
    19541983ALTER TABLE `Subject`
     1984  ADD CONSTRAINT `Subject_ibfk_2` FOREIGN KEY (`MapPosition`) REFERENCES `MapPosition` (`Id`),
    19551985  ADD CONSTRAINT `Subject_ibfk_1` FOREIGN KEY (`AddressCountry`) REFERENCES `Country` (`Id`);
    19561986
     
    19992029ALTER TABLE `Work`
    20002030  ADD CONSTRAINT `Work_ibfk_1` FOREIGN KEY (`User`) REFERENCES `User` (`Id`),
    2001   ADD CONSTRAINT `Work_ibfk_2` FOREIGN KEY (`Task`) REFERENCES `Task` (`Id`);");
     2031  ADD CONSTRAINT `Work_ibfk_2` FOREIGN KEY (`Task`) REFERENCES `Task` (`Id`);
     2032      ");
    20022033  $Manager->Execute("INSERT INTO `SystemVersion` (`Id`, `Revision`) VALUES
    2003 (1, 491);");
     2034(1, 495);");
    20042035 
    20052036}
     
    20182049  $Manager->Execute("INSERT INTO `User` (`Id`, `Login`, `Name`, `Password`, `Salt`, `Email`, `LastIpAddress`, `LastLoginTime`, `RegistrationTime`, `Locked`, `ICQ`, `PhoneNumber`, `InitPassword`) VALUES
    20192050(1, 'admin', 'Správce', '05d97409afcce47d028c0d2a04cf359998cbaaf1', 'b295d117135a9763da282e7dae73a5ca7d3e5b11', 'admin@localhost', '', '0000-00-00 00:00:00', '2013-03-01 19:40:22', 0, 0, '+420123456789', '');");
    2020   $Manager->Execute("INSERT INTO `Subject` (`Id`, `Name`, `AddressStreet`, `AddressTown`, `AddressPSC`, `AddressCountry`, `IC`, `DIC`, `PayVAT`, `MapPositionX`, `MapPositionY`, `WWW`, `Note`) VALUES
    2021 (1, 'Franta Vopršálek', 'Na hradě 1001', 'Bouzov', 12345, 1, '12345667', 'CZ1234567890', 0, 1, 2, '', '');");
     2051  $Manager->Execute("INSERT INTO `MapPosition` (`Id`, `Name`, `Latitude`, `Longitude`) VALUES
     2052(1, 'Franta Vopršálek', 47.555, 11.082)");
     2053  $Manager->Execute("INSERT INTO `Subject` (`Id`, `Name`, `AddressStreet`, `AddressTown`, `AddressPSC`, `AddressCountry`, `IC`, `DIC`, `PayVAT`, `MapPosition`, `WWW`, `Note`) VALUES
     2054(1, 'Franta Vopršálek', 'Na hradě 1001', 'Bouzov', 12345, 1, '12345667', 'CZ1234567890', 0, 1, '', '');");
    20222055  $Manager->Execute("INSERT INTO `UnitOfMeasure` (`Id`, `Unit`, `Name`) VALUES
    20232056(1, 'ks', 'kus'),
     
    21862219(15, 'Kino Vatra', 0, 15, 1, 'http://www.dkvsetin.cz/rss/kino/8'),
    21872220(16, 'Obec Hovězí', 0, 16, 1, 'http://www.obec-hovezi.cz/web/rss.xml');");
    2188   $Manager->Execute("INSERT INTO `MapPosition` (`Id`, `Name`, `Latitude`, `Longitude`) VALUES
    2189 (1, 'Franta Vopršálek', 47.555, 11.082)");
    21902221  $Manager->Execute("INSERT INTO `FinanceBillingPeriod` (`Id`, `Name`, `MonthCount`) VALUES
    21912222(1, 'Nikdy', 0),
     
    23622393  $Manager->Execute("INSERT INTO `ServiceCustomerRel` (`Id`, `Service`, `Customer`, `Period`) VALUES
    23632394(1, 1, 1, 0), (2, 1, 1, 1);");
    2364   $Manager->Execute("INSERT INTO `File` (`Id` ,`Name` ,`Size` ,`Directory`) VALUES (NULL , 'invoice_1.pdf', '123', NULL);");
     2395  $Manager->Execute("INSERT INTO `File` (`Id` ,`Name` ,`Size` ,`Directory`) ".
     2396    "VALUES (1 , 'invoice_1.pdf', '123', NULL);");
    23652397  $Manager->Execute("INSERT INTO `FinanceInvoice` (`Id` ,`BillCode` ,`Subject` ,`TimeCreation` ,`TimeDue` ,`TimePayment` ,`Value` ,`File` ,`Text` ,`PeriodTo` ,`PeriodFrom`) ".
    23662398    "VALUES (1 , 'VF123/2013', '1', NOW( ) , '0000-00-00 00:00:00', NULL , '300', '1', 'Měsíční paušál', '2013-01-01', '2013-01-31');");
    23672399  $Manager->Execute("INSERT INTO `FinanceInvoiceItem` (`Id` ,`FinanceInvoice` ,`Description` ,`Price` ,`VAT` ,`Quantity`) ".
    2368      "VALUES (1 , '1', 'Internet 16M', '300', '21', '1');");
     2400    "VALUES (1 , '1', 'Internet 16M', '300', '21', '1');");
    23692401  $Manager->Execute("INSERT INTO `FinanceYear` (`Id`, `Year`, `DateStart`, `DateEnd`) VALUES
    23702402(1, 2007, '2007-12-01', '2007-12-31'),
     
    23782410(1, 10000, 100000, 10000, 50, 6, 1024, 50, 138),
    23792411(0, 10000, 100000, 10000, 50, 6, 1024, 50, 138);");
     2412  $Manager->Execute("INSERT INTO `DocumentLine` (`Id`, `Name`, `Shortcut`) VALUES
     2413(1, 'Příjmy do pokladny', 'PP'),
     2414(2, 'Výdeje z pokladny', 'VP'),
     2415(3, 'Příjem na účet', 'BV'),
     2416(4, 'Výdej z účtu', 'PR'),
     2417(5, 'Přijaté faktury', 'PF'),
     2418(6, 'Vydané faktury', 'VF'),
     2419(7, 'Výdej ze skladu', 'VS'),
     2420(8, 'Příjem na sklad', 'PS');");
    23802421}
    23812422
Note: See TracChangeset for help on using the changeset viewer.