Ignore:
Timestamp:
Apr 14, 2015, 10:20:16 PM (10 years ago)
Author:
chronos
Message:
  • Removed: Spaces on end of line.
  • Modified: Tabs converted to spaces.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Common/Setup/Updates.php

    r736 r738  
    538538function UpdateTo627($Manager)
    539539{
    540         $Manager->Execute('ALTER TABLE `FinanceInvoice` CHANGE `TimeCreation` `Time` DATETIME NOT NULL DEFAULT "0000-00-00 00:00:00";');
    541         $Manager->Execute('ALTER TABLE `FinanceYear` ADD `Closed` INT NOT NULL ;');
     540  $Manager->Execute('ALTER TABLE `FinanceInvoice` CHANGE `TimeCreation` `Time` DATETIME NOT NULL DEFAULT "0000-00-00 00:00:00";');
     541  $Manager->Execute('ALTER TABLE `FinanceYear` ADD `Closed` INT NOT NULL ;');
    542542}
    543543
    544544function UpdateTo632($Manager)
    545545{
    546         $Manager->Execute('CREATE TABLE IF NOT EXISTS `FinanceInvoiceOperationRel` (
     546  $Manager->Execute('CREATE TABLE IF NOT EXISTS `FinanceInvoiceOperationRel` (
    547547  `Id` int(11) NOT NULL AUTO_INCREMENT,
    548548  `Invoice` int(11) NOT NULL,
     
    559559function UpdateTo633($Manager)
    560560{
    561         $Manager->Execute('ALTER TABLE `UserOnline` ADD `StayLoggedHash` VARCHAR( 40 ) NOT NULL ;');
     561  $Manager->Execute('ALTER TABLE `UserOnline` ADD `StayLoggedHash` VARCHAR( 40 ) NOT NULL ;');
    562562}
    563563
    564564function UpdateTo645($Manager)
    565565{
    566         $Manager->Execute('CREATE TABLE IF NOT EXISTS `FinanceVATType` (
     566  $Manager->Execute('CREATE TABLE IF NOT EXISTS `FinanceVATType` (
    567567  `Id` int(11) NOT NULL,
    568568  `Name` varchar(255) NOT NULL,
     
    578578function UpdateTo646($Manager)
    579579{
    580         $Manager->Execute('CREATE TABLE IF NOT EXISTS `Contract` (
     580  $Manager->Execute('CREATE TABLE IF NOT EXISTS `Contract` (
    581581  `Id` int(11) NOT NULL AUTO_INCREMENT,
    582582  `BillCode` varchar(255) NOT NULL,
     
    614614function UpdateTo647($Manager)
    615615{
    616         $Manager->Execute('ALTER TABLE `EmployeeSalary` ADD FOREIGN KEY ( `Employee` ) REFERENCES `Employee` (
     616  $Manager->Execute('ALTER TABLE `EmployeeSalary` ADD FOREIGN KEY ( `Employee` ) REFERENCES `Employee` (
    617617`Id`
    618618) ON DELETE RESTRICT ON UPDATE RESTRICT ;');
     
    649649function UpdateTo656($Manager)
    650650{
    651         $Manager->Execute('CREATE TABLE IF NOT EXISTS `Measure` (
     651  $Manager->Execute('CREATE TABLE IF NOT EXISTS `Measure` (
    652652  `Id` int(11) NOT NULL AUTO_INCREMENT,
    653653  `Name` varchar(255) NOT NULL,
     
    708708function UpdateTo657($Manager)
    709709{
    710         $Manager->Execute('CREATE TABLE IF NOT EXISTS `NetworkInterfaceUpDown` (
     710  $Manager->Execute('CREATE TABLE IF NOT EXISTS `NetworkInterfaceUpDown` (
    711711  `Id` int(11) NOT NULL AUTO_INCREMENT,
    712712  `Time` datetime NOT NULL,
     
    873873  if($DbResult->num_rows > 0)
    874874  {
    875         $DbRow = $DbResult->fetch_assoc();
     875    $DbRow = $DbResult->fetch_assoc();
    876876    $Manager->Execute("INSERT INTO `MenuItem` (`Id` ,`Name` ,`Parent` ,`Action` ,`Menu`) ".
    877877      "VALUES (NULL , 'Oblíbené položky nabídky', ".$DbRow['Id'].", '".$ActionId."', '1');");
     
    887887function UpdateTo688($Manager)
    888888{
    889         // Convert monthly plus payment for consumption to regular service
     889  // Convert monthly plus payment for consumption to regular service
    890890  $DbResult = $Manager->Execute('SELECT `MonthlyPlus`, `Member` FROM `MemberPayment` WHERE `MonthlyPlus` > 0');
    891891  while($DbRow = $DbResult->fetch_assoc)
     
    935935
    936936function UpdateTo710($Manager)
    937 {       
     937{
    938938  $Manager->Execute('RENAME TABLE `StockItem` TO `StockSerialNumber`;');
    939939  $Manager->Execute('UPDATE `Action` SET `URL`="/is/?t=StockSerialNumber&a=list",`Title`="Sériová čísla" WHERE `URL`="/is/?t=StockItem&a=list";');
    940  
     940
    941941  // StockMove
    942942  $Manager->Execute('CREATE TABLE IF NOT EXISTS `StockMove` (
     
    949949  `File` int(11) DEFAULT NULL
    950950  ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;');
    951    
     951
    952952  $Manager->Execute('ALTER TABLE `StockMove`
    953953  ADD PRIMARY KEY (`Id`), ADD KEY `DocumentLine` (`DocumentLine`), ADD KEY `StockFrom` (`StockFrom`), ADD KEY `StockTo` (`StockTo`), ADD KEY `File` (`File`);');
    954    
     954
    955955  $Manager->Execute('ALTER TABLE `StockMove`
    956956  MODIFY `Id` int(11) NOT NULL AUTO_INCREMENT;');
    957  
     957
    958958  $Manager->Execute('ALTER TABLE `StockMove`
    959959  ADD CONSTRAINT `StockMove_ibfk_1` FOREIGN KEY (`StockFrom`) REFERENCES `Stock` (`Id`),
    960960  ADD CONSTRAINT `StockMove_ibfk_2` FOREIGN KEY (`StockTo`) REFERENCES `Stock` (`Id`),
    961961  ADD CONSTRAINT `StockMove_ibfk_3` FOREIGN KEY (`DocumentLine`) REFERENCES `DocumentLine` (`Id`);');
    962  
     962
    963963  // StockMoveItem
    964964  $Manager->Execute('CREATE TABLE IF NOT EXISTS `StockMoveItem` (
     
    970970  `UnitPrice` int(11) NOT NULL
    971971  ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;');
    972  
     972
    973973  $Manager->Execute('ALTER TABLE `StockMoveItem`
    974974  ADD PRIMARY KEY (`Id`), ADD KEY `Product` (`Product`), ADD KEY `StockMove` (`StockMove`);');
    975  
     975
    976976  $Manager->Execute('ALTER TABLE `StockMoveItem`
    977977  MODIFY `Id` int(11) NOT NULL AUTO_INCREMENT;');
     
    979979  $Manager->Execute('ALTER TABLE `StockMoveItem`
    980980  ADD CONSTRAINT `StockMoveItem_ibfk_2` FOREIGN KEY (`Product`) REFERENCES `Product` (`Id`),
    981   ADD CONSTRAINT `StockMoveItem_ibfk_1` FOREIGN KEY (`StockMove`) REFERENCES `StockMove` (`Id`);'); 
     981  ADD CONSTRAINT `StockMoveItem_ibfk_1` FOREIGN KEY (`StockMove`) REFERENCES `StockMove` (`Id`);');
    982982
    983983  // IS menu item
     
    989989  if($DbResult->num_rows > 0)
    990990  {
    991         $DbRow = $DbResult->fetch_assoc();
     991    $DbRow = $DbResult->fetch_assoc();
    992992    $Manager->Execute("INSERT INTO `MenuItem` (`Id` ,`Name` ,`Parent` ,`Action` ,`Menu`) ".
    993993      "VALUES (NULL , 'Skladové pohyby', ".$DbRow['Id'].", '".$ActionId."', '1');");
     
    997997function UpdateTo715($Manager)
    998998{
    999         $Manager->Execute('ALTER TABLE `StockSerialNumber` DROP FOREIGN KEY `StockSerialNumber_ibfk_6`;');
    1000         $Manager->Execute('ALTER TABLE `StockSerialNumber` DROP `Segment`');
    1001         $Manager->Execute('ALTER TABLE `Member` DROP `NetworkSegment`');
    1002         $Manager->Execute('DROP TABLE `NetworkSegment`');
    1003         $Manager->Execute('DELETE FROM `MenuItem` WHERE `Name`="Úseky sítě"');
    1004         $Manager->Execute('DELETE FROM `Action` WHERE `Title`="Úseky sítě"');
     999  $Manager->Execute('ALTER TABLE `StockSerialNumber` DROP FOREIGN KEY `StockSerialNumber_ibfk_6`;');
     1000  $Manager->Execute('ALTER TABLE `StockSerialNumber` DROP `Segment`');
     1001  $Manager->Execute('ALTER TABLE `Member` DROP `NetworkSegment`');
     1002  $Manager->Execute('DROP TABLE `NetworkSegment`');
     1003  $Manager->Execute('DELETE FROM `MenuItem` WHERE `Name`="Úseky sítě"');
     1004  $Manager->Execute('DELETE FROM `Action` WHERE `Title`="Úseky sítě"');
    10051005}
    10061006
    10071007function UpdateTo718($Manager)
    1008 {       
     1008{
    10091009  $Manager->Execute('CREATE TABLE IF NOT EXISTS `Company` (
    10101010`Id` int(11) NOT NULL,
     
    10271027  if($DbResult->num_rows > 0)
    10281028  {
    1029         $DbRow = $DbResult->fetch_assoc();
     1029    $DbRow = $DbResult->fetch_assoc();
    10301030    $Manager->Execute("INSERT INTO `MenuItem` (`Id` ,`Name` ,`Parent` ,`Action` ,`Menu`) ".
    10311031      "VALUES (NULL , 'Firmy', ".$DbRow['Id'].", '".$ActionId."', '1');");
     
    10341034
    10351035function UpdateTo719($Manager)
    1036 {       
     1036{
    10371037  $Manager->Execute('ALTER TABLE `FinanceOperation` ADD `Direction` INT NOT NULL AFTER `Cash`;');
    10381038  $Manager->Execute('UPDATE `FinanceOperation` SET `Direction` = 1 WHERE `Value` >= 0 ;');
    10391039  $Manager->Execute('UPDATE `FinanceOperation` SET `Direction` = -1 WHERE `Value` < 0 ;');
    10401040  $Manager->Execute('UPDATE `FinanceOperation` SET `Value` = -`Value` WHERE `Value` < 0 ;');
    1041   // Set missing FinanceOperation DocumentLine according BillCode 
     1041  // Set missing FinanceOperation DocumentLine according BillCode
    10421042  $Manager->Execute('UPDATE `FinanceOperation` SET `DocumentLine` = 1 WHERE (`BillCode` LIKE "PP%") AND (`DocumentLine` IS NULL)');
    10431043  $Manager->Execute('UPDATE `FinanceOperation` SET `DocumentLine` = 2 WHERE (`BillCode` LIKE "VP%") AND (`DocumentLine` IS NULL)');
    10441044  $Manager->Execute('UPDATE `FinanceOperation` SET `DocumentLine` = 3 WHERE (`BillCode` LIKE "BV%") AND (`DocumentLine` IS NULL)');
    10451045  $Manager->Execute('UPDATE `FinanceOperation` SET `DocumentLine` = 4 WHERE (`BillCode` LIKE "PR%") AND (`DocumentLine` IS NULL)');
    1046  
     1046
    10471047  // IS menu item
    10481048  $DbResult = $Manager->Execute('SELECT `Id` FROM `MenuItem` WHERE `Name`="Příjmy a výdaje"');
    10491049  if($DbResult->num_rows > 0)
    10501050  {
    1051         $DbRow = $DbResult->fetch_assoc();
     1051    $DbRow = $DbResult->fetch_assoc();
    10521052    $Manager->Execute('INSERT INTO `Action` (`Id` ,`Name` ,`Title` ,`Type` ,`URL` ,
    10531053    `Group` ,`Icon` ,`PermissionOperation` ,`Enable`) VALUES (
    10541054    NULL , "", "Příjem do pokladny", "1", "/is/?t=FinanceTreasuryIn&a=list", NULL , NULL , NULL , "1");');
    10551055    $ActionId = $Manager->Database->insert_id;
    1056         $Manager->Execute("INSERT INTO `MenuItem` (`Id` ,`Name` ,`Parent` ,`Action` ,`Menu`) ".
     1056    $Manager->Execute("INSERT INTO `MenuItem` (`Id` ,`Name` ,`Parent` ,`Action` ,`Menu`) ".
    10571057      "VALUES (NULL , 'Příjem do pokladny', ".$DbRow['Id'].", '".$ActionId."', '1');");
    10581058    $Manager->Execute('INSERT INTO `Action` (`Id` ,`Name` ,`Title` ,`Type` ,`URL` ,
     
    10601060    NULL , "", "Výdej z pokladny", "1", "/is/?t=FinanceTreasuryOut&a=list", NULL , NULL , NULL , "1");');
    10611061    $ActionId = $Manager->Database->insert_id;
    1062         $Manager->Execute("INSERT INTO `MenuItem` (`Id` ,`Name` ,`Parent` ,`Action` ,`Menu`) ".
     1062    $Manager->Execute("INSERT INTO `MenuItem` (`Id` ,`Name` ,`Parent` ,`Action` ,`Menu`) ".
    10631063      "VALUES (NULL , 'Výdej z pokladny', ".$DbRow['Id'].", '".$ActionId."', '1');");
    10641064    $Manager->Execute('INSERT INTO `Action` (`Id` ,`Name` ,`Title` ,`Type` ,`URL` ,
     
    10661066    NULL , "", "Příjem na účet", "1", "/is/?t=FinanceAccountIn&a=list", NULL , NULL , NULL , "1");');
    10671067    $ActionId = $Manager->Database->insert_id;
    1068         $Manager->Execute("INSERT INTO `MenuItem` (`Id` ,`Name` ,`Parent` ,`Action` ,`Menu`) ".
     1068    $Manager->Execute("INSERT INTO `MenuItem` (`Id` ,`Name` ,`Parent` ,`Action` ,`Menu`) ".
    10691069      "VALUES (NULL , 'Příjem na účet', ".$DbRow['Id'].", '".$ActionId."', '1');");
    10701070    $Manager->Execute('INSERT INTO `Action` (`Id` ,`Name` ,`Title` ,`Type` ,`URL` ,
     
    10721072    NULL , "", "Výdej z účtu", "1", "/is/?t=FinanceAccountOut&a=list", NULL , NULL , NULL , "1");');
    10731073    $ActionId = $Manager->Database->insert_id;
    1074         $Manager->Execute("INSERT INTO `MenuItem` (`Id` ,`Name` ,`Parent` ,`Action` ,`Menu`) ".
     1074    $Manager->Execute("INSERT INTO `MenuItem` (`Id` ,`Name` ,`Parent` ,`Action` ,`Menu`) ".
    10751075      "VALUES (NULL , 'Výdej z účtu', ".$DbRow['Id'].", '".$ActionId."', '1');");
    10761076  }
     
    10791079function UpdateTo720($Manager)
    10801080{
    1081         $Manager->Execute('ALTER TABLE `FinanceInvoice` ADD `Direction` INT NOT NULL AFTER `TimePayment`;');
    1082         $Manager->Execute('UPDATE `FinanceInvoice` SET `Direction` = 1 WHERE `Value` >= 0 ;');
    1083         $Manager->Execute('UPDATE `FinanceInvoice` SET `Direction` = -1 WHERE `Value` < 0 ;');
    1084         $Manager->Execute('UPDATE `FinanceInvoice` SET `Value` = -`Value` WHERE `Value` < 0 ;');
    1085         // Set missing FinanceInvoice DocumentLine according BillCode
    1086         $Manager->Execute('UPDATE `FinanceInvoice` SET `DocumentLine` = 5 WHERE (`BillCode` LIKE "PF%") AND (`DocumentLine` IS NULL)');
    1087         $Manager->Execute('UPDATE `FinanceInvoice` SET `DocumentLine` = 6 WHERE (`BillCode` LIKE "VF%") AND (`DocumentLine` IS NULL)');
    1088        
    1089         // IS menu item
    1090         $DbResult = $Manager->Execute('SELECT `Id` FROM `MenuItem` WHERE `Name`="Závazky a pohledávky"');
    1091         if($DbResult->num_rows > 0)
    1092         {
    1093                 $DbRow = $DbResult->fetch_assoc();
    1094                 $Manager->Execute('INSERT INTO `Action` (`Id` ,`Name` ,`Title` ,`Type` ,`URL` ,
     1081  $Manager->Execute('ALTER TABLE `FinanceInvoice` ADD `Direction` INT NOT NULL AFTER `TimePayment`;');
     1082  $Manager->Execute('UPDATE `FinanceInvoice` SET `Direction` = 1 WHERE `Value` >= 0 ;');
     1083  $Manager->Execute('UPDATE `FinanceInvoice` SET `Direction` = -1 WHERE `Value` < 0 ;');
     1084  $Manager->Execute('UPDATE `FinanceInvoice` SET `Value` = -`Value` WHERE `Value` < 0 ;');
     1085  // Set missing FinanceInvoice DocumentLine according BillCode
     1086  $Manager->Execute('UPDATE `FinanceInvoice` SET `DocumentLine` = 5 WHERE (`BillCode` LIKE "PF%") AND (`DocumentLine` IS NULL)');
     1087  $Manager->Execute('UPDATE `FinanceInvoice` SET `DocumentLine` = 6 WHERE (`BillCode` LIKE "VF%") AND (`DocumentLine` IS NULL)');
     1088
     1089  // IS menu item
     1090  $DbResult = $Manager->Execute('SELECT `Id` FROM `MenuItem` WHERE `Name`="Závazky a pohledávky"');
     1091  if($DbResult->num_rows > 0)
     1092  {
     1093    $DbRow = $DbResult->fetch_assoc();
     1094    $Manager->Execute('INSERT INTO `Action` (`Id` ,`Name` ,`Title` ,`Type` ,`URL` ,
    10951095    `Group` ,`Icon` ,`PermissionOperation` ,`Enable`) VALUES (
    10961096    NULL , "", "Příjaté", "1", "/is/?t=FinanceInvoiceIn&a=list", NULL , NULL , NULL , "1");');
    1097                 $ActionId = $Manager->Database->insert_id;
    1098                 $Manager->Execute("INSERT INTO `MenuItem` (`Id` ,`Name` ,`Parent` ,`Action` ,`Menu`) ".
    1099                                 "VALUES (NULL , 'Přijaté', ".$DbRow['Id'].", '".$ActionId."', '1');");
    1100                
    1101                 $Manager->Execute('INSERT INTO `Action` (`Id` ,`Name` ,`Title` ,`Type` ,`URL` ,
     1097    $ActionId = $Manager->Database->insert_id;
     1098    $Manager->Execute("INSERT INTO `MenuItem` (`Id` ,`Name` ,`Parent` ,`Action` ,`Menu`) ".
     1099        "VALUES (NULL , 'Přijaté', ".$DbRow['Id'].", '".$ActionId."', '1');");
     1100
     1101    $Manager->Execute('INSERT INTO `Action` (`Id` ,`Name` ,`Title` ,`Type` ,`URL` ,
    11021102    `Group` ,`Icon` ,`PermissionOperation` ,`Enable`) VALUES (
    11031103    NULL , "", "Vydané", "1", "/is/?t=FinanceInvoiceOut&a=list", NULL , NULL , NULL , "1");');
    1104                 $ActionId = $Manager->Database->insert_id;
    1105                 $Manager->Execute("INSERT INTO `MenuItem` (`Id` ,`Name` ,`Parent` ,`Action` ,`Menu`) ".
    1106                                 "VALUES (NULL , 'Vydané', ".$DbRow['Id'].", '".$ActionId."', '1');");
    1107         }
     1104    $ActionId = $Manager->Database->insert_id;
     1105    $Manager->Execute("INSERT INTO `MenuItem` (`Id` ,`Name` ,`Parent` ,`Action` ,`Menu`) ".
     1106        "VALUES (NULL , 'Vydané', ".$DbRow['Id'].", '".$ActionId."', '1');");
     1107  }
    11081108}
    11091109
    11101110function UpdateTo722($Manager)
    11111111{
    1112         $Manager->Execute('ALTER TABLE `Service` DROP `CustomerCount`;');
     1112  $Manager->Execute('ALTER TABLE `Service` DROP `CustomerCount`;');
    11131113}
    11141114
    11151115function UpdateTo725($Manager)
    11161116{
    1117         // Text column of invoices is not used. Text from invoice items is taken instead.
    1118         $DbResult = $Manager->Execute('ALTER TABLE `FinanceInvoice` DROP `Text`;');
    1119        
    1120         $SearchText = 'Připojení k síti';
    1121         $DbResult = $Manager->Execute('SELECT * FROM `FinanceInvoiceItem` WHERE `Description` LIKE "'.$SearchText.' za období%";');
    1122         while($DbRow = $DbResult->fetch_assoc())
    1123         {
    1124                 $Text = trim(substr($DbRow['Description'], strlen($SearchText.' za období') + 1));
    1125                 $Text = explode('-', $Text);           
    1126                 $PeriodFrom = explode('.', trim($Text[0]));
    1127                 $PeriodFrom = $PeriodFrom[2].'-'.$PeriodFrom[1].'-'.$PeriodFrom[0];
    1128                 $PeriodTo = explode('.', trim($Text[1]));
    1129                 $PeriodTo = $PeriodTo[2].'-'.$PeriodTo[1].'-'.$PeriodTo[0];
    1130                 $Manager->Execute('UPDATE `FinanceInvoice` SET `PeriodFrom`="'.$PeriodFrom.'", `PeriodTo`="'.$PeriodTo.'" WHERE `Id`='.$DbRow['FinanceInvoice']);
    1131         }
    1132         $DbResult = $Manager->Execute('UPDATE `FinanceInvoiceItem` SET `Description` = "'.$SearchText.'" WHERE `Description` LIKE "'.$SearchText.' za období%";');
    1133        
    1134         $SearchText = 'Připojení k Internetu';
    1135         $DbResult = $Manager->Execute('SELECT * FROM `FinanceInvoiceItem` WHERE `Description` LIKE "'.$SearchText.' za období%";');
    1136         while($DbRow = $DbResult->fetch_assoc())
    1137         {
    1138                 $Text = trim(substr($DbRow['Description'], strlen($SearchText.' za období') + 1));
    1139                 $Text = explode('-', $Text);           
    1140                 $PeriodFrom = explode('.', trim($Text[0]));
    1141                 $PeriodFrom = $PeriodFrom[2].'-'.$PeriodFrom[1].'-'.$PeriodFrom[0];
    1142                 $Text[1] = trim($Text[1]);
    1143                 if(strpos($Text[1], ' ') !== false) $Text[1] = substr($Text[1], 0, strpos($Text[1], ' '));
    1144                 $PeriodTo = explode('.', trim($Text[1]));
    1145                 $PeriodTo = $PeriodTo[2].'-'.$PeriodTo[1].'-'.$PeriodTo[0];
    1146                 $Manager->Execute('UPDATE `FinanceInvoice` SET `PeriodFrom`="'.$PeriodFrom.'", `PeriodTo`="'.$PeriodTo.'" WHERE `Id`='.$DbRow['FinanceInvoice']);
    1147         }
    1148         $DbResult = $Manager->Execute('UPDATE `FinanceInvoiceItem` SET `Description` = "'.$SearchText.'" WHERE `Description` LIKE "'.$SearchText.' za období%";');
     1117  // Text column of invoices is not used. Text from invoice items is taken instead.
     1118  $DbResult = $Manager->Execute('ALTER TABLE `FinanceInvoice` DROP `Text`;');
     1119
     1120  $SearchText = 'Připojení k síti';
     1121  $DbResult = $Manager->Execute('SELECT * FROM `FinanceInvoiceItem` WHERE `Description` LIKE "'.$SearchText.' za období%";');
     1122  while($DbRow = $DbResult->fetch_assoc())
     1123  {
     1124    $Text = trim(substr($DbRow['Description'], strlen($SearchText.' za období') + 1));
     1125    $Text = explode('-', $Text);
     1126    $PeriodFrom = explode('.', trim($Text[0]));
     1127    $PeriodFrom = $PeriodFrom[2].'-'.$PeriodFrom[1].'-'.$PeriodFrom[0];
     1128    $PeriodTo = explode('.', trim($Text[1]));
     1129    $PeriodTo = $PeriodTo[2].'-'.$PeriodTo[1].'-'.$PeriodTo[0];
     1130    $Manager->Execute('UPDATE `FinanceInvoice` SET `PeriodFrom`="'.$PeriodFrom.'", `PeriodTo`="'.$PeriodTo.'" WHERE `Id`='.$DbRow['FinanceInvoice']);
     1131  }
     1132  $DbResult = $Manager->Execute('UPDATE `FinanceInvoiceItem` SET `Description` = "'.$SearchText.'" WHERE `Description` LIKE "'.$SearchText.' za období%";');
     1133
     1134  $SearchText = 'Připojení k Internetu';
     1135  $DbResult = $Manager->Execute('SELECT * FROM `FinanceInvoiceItem` WHERE `Description` LIKE "'.$SearchText.' za období%";');
     1136  while($DbRow = $DbResult->fetch_assoc())
     1137  {
     1138    $Text = trim(substr($DbRow['Description'], strlen($SearchText.' za období') + 1));
     1139    $Text = explode('-', $Text);
     1140    $PeriodFrom = explode('.', trim($Text[0]));
     1141    $PeriodFrom = $PeriodFrom[2].'-'.$PeriodFrom[1].'-'.$PeriodFrom[0];
     1142    $Text[1] = trim($Text[1]);
     1143    if(strpos($Text[1], ' ') !== false) $Text[1] = substr($Text[1], 0, strpos($Text[1], ' '));
     1144    $PeriodTo = explode('.', trim($Text[1]));
     1145    $PeriodTo = $PeriodTo[2].'-'.$PeriodTo[1].'-'.$PeriodTo[0];
     1146    $Manager->Execute('UPDATE `FinanceInvoice` SET `PeriodFrom`="'.$PeriodFrom.'", `PeriodTo`="'.$PeriodTo.'" WHERE `Id`='.$DbRow['FinanceInvoice']);
     1147  }
     1148  $DbResult = $Manager->Execute('UPDATE `FinanceInvoiceItem` SET `Description` = "'.$SearchText.'" WHERE `Description` LIKE "'.$SearchText.' za období%";');
    11491149}
    11501150
    11511151function UpdateTo726($Manager)
    11521152{
    1153         $Manager->Execute('ALTER TABLE `ServiceCustomerRel` CHANGE `Action` `ChangeAction` ENUM("add","modify","remove") CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL;');
    1154         $Manager->Execute('ALTER TABLE `ServiceCustomerRel` ADD `ChangeTime` DATETIME NULL AFTER `ChangeAction`;');
    1155         $Manager->Execute('ALTER TABLE `ServiceCustomerRel` DROP FOREIGN KEY `ServiceCustomerRel_ibfk_4`;');
    1156         $Manager->Execute('ALTER TABLE `ServiceCustomerRel` CHANGE `ReplaceId` `ChangeReplaceId` INT(11) NULL DEFAULT NULL;');
    1157         $Manager->Execute('ALTER TABLE `ServiceCustomerRel` ADD FOREIGN KEY (`ChangeReplaceId`) REFERENCES `ServiceCustomerRel`(`Id`) ON DELETE RESTRICT ON UPDATE RESTRICT;');
    1158 
    1159         $Manager->Execute('ALTER TABLE `Service` CHANGE `Action` `ChangeAction` ENUM("add","modify","remove") CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL;');
    1160         $Manager->Execute('ALTER TABLE `Service` ADD `ChangeTime` DATETIME NULL AFTER `ChangeAction`;');
    1161         $Manager->Execute('ALTER TABLE `Service` DROP FOREIGN KEY `Service_ibfk_2`;');
    1162         $Manager->Execute('ALTER TABLE `Service` CHANGE `ReplaceId` `ChangeReplaceId` INT(11) NULL DEFAULT NULL;');
    1163         $Manager->Execute('ALTER TABLE `Service` ADD FOREIGN KEY (`ChangeReplaceId`) REFERENCES `Service`(`Id`) ON DELETE RESTRICT ON UPDATE RESTRICT;');
    1164 
    1165         $Manager->Execute('ALTER TABLE `FinanceCharge` CHANGE `Action` `ChangeAction` ENUM("add","modify","remove") CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL;');
    1166         $Manager->Execute('ALTER TABLE `FinanceCharge` ADD `ChangeTime` DATETIME NULL AFTER `ChangeAction`;');
    1167         $Manager->Execute('ALTER TABLE `FinanceCharge` DROP FOREIGN KEY `FinanceCharge_ibfk_1`;');
    1168         $Manager->Execute('ALTER TABLE `FinanceCharge` CHANGE `ReplaceId` `ChangeReplaceId` INT(11) NULL DEFAULT NULL;');
    1169         $Manager->Execute('ALTER TABLE `FinanceCharge` ADD FOREIGN KEY (`ChangeReplaceId`) REFERENCES `FinanceCharge`(`Id`) ON DELETE RESTRICT ON UPDATE RESTRICT;');
    1170        
    1171         $Manager->Execute('ALTER TABLE `MemberPayment` DROP `NetworkDevice`;');
     1153  $Manager->Execute('ALTER TABLE `ServiceCustomerRel` CHANGE `Action` `ChangeAction` ENUM("add","modify","remove") CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL;');
     1154  $Manager->Execute('ALTER TABLE `ServiceCustomerRel` ADD `ChangeTime` DATETIME NULL AFTER `ChangeAction`;');
     1155  $Manager->Execute('ALTER TABLE `ServiceCustomerRel` DROP FOREIGN KEY `ServiceCustomerRel_ibfk_4`;');
     1156  $Manager->Execute('ALTER TABLE `ServiceCustomerRel` CHANGE `ReplaceId` `ChangeReplaceId` INT(11) NULL DEFAULT NULL;');
     1157  $Manager->Execute('ALTER TABLE `ServiceCustomerRel` ADD FOREIGN KEY (`ChangeReplaceId`) REFERENCES `ServiceCustomerRel`(`Id`) ON DELETE RESTRICT ON UPDATE RESTRICT;');
     1158
     1159  $Manager->Execute('ALTER TABLE `Service` CHANGE `Action` `ChangeAction` ENUM("add","modify","remove") CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL;');
     1160  $Manager->Execute('ALTER TABLE `Service` ADD `ChangeTime` DATETIME NULL AFTER `ChangeAction`;');
     1161  $Manager->Execute('ALTER TABLE `Service` DROP FOREIGN KEY `Service_ibfk_2`;');
     1162  $Manager->Execute('ALTER TABLE `Service` CHANGE `ReplaceId` `ChangeReplaceId` INT(11) NULL DEFAULT NULL;');
     1163  $Manager->Execute('ALTER TABLE `Service` ADD FOREIGN KEY (`ChangeReplaceId`) REFERENCES `Service`(`Id`) ON DELETE RESTRICT ON UPDATE RESTRICT;');
     1164
     1165  $Manager->Execute('ALTER TABLE `FinanceCharge` CHANGE `Action` `ChangeAction` ENUM("add","modify","remove") CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL;');
     1166  $Manager->Execute('ALTER TABLE `FinanceCharge` ADD `ChangeTime` DATETIME NULL AFTER `ChangeAction`;');
     1167  $Manager->Execute('ALTER TABLE `FinanceCharge` DROP FOREIGN KEY `FinanceCharge_ibfk_1`;');
     1168  $Manager->Execute('ALTER TABLE `FinanceCharge` CHANGE `ReplaceId` `ChangeReplaceId` INT(11) NULL DEFAULT NULL;');
     1169  $Manager->Execute('ALTER TABLE `FinanceCharge` ADD FOREIGN KEY (`ChangeReplaceId`) REFERENCES `FinanceCharge`(`Id`) ON DELETE RESTRICT ON UPDATE RESTRICT;');
     1170
     1171  $Manager->Execute('ALTER TABLE `MemberPayment` DROP `NetworkDevice`;');
    11721172}
    11731173
     
    11751175{
    11761176 $Manager->Execute('ALTER TABLE `FinanceBankAccount` ADD `AutoImport` INT NOT NULL ;');
    1177  
     1177
    11781178  $Manager->Execute('CREATE TABLE IF NOT EXISTS `Scheduler` (
    11791179  `Id` int(11) NOT NULL,
     
    11891189  $Manager->Execute('ALTER TABLE `Scheduler`
    11901190 ADD PRIMARY KEY (`Id`);');
    1191  
     1191
    11921192  $Manager->Execute('ALTER TABLE `Scheduler`
    11931193MODIFY `Id` int(11) NOT NULL AUTO_INCREMENT;');
     
    12011201  if($DbResult->num_rows > 0)
    12021202  {
    1203         $DbRow = $DbResult->fetch_assoc();
     1203    $DbRow = $DbResult->fetch_assoc();
    12041204    $Manager->Execute("INSERT INTO `MenuItem` (`Id` ,`Name` ,`Parent` ,`Action` ,`Menu`) ".
    12051205      "VALUES (NULL , 'Plánovač', ".$DbRow['Id'].", '".$ActionId."', '1');");
    12061206  }
    1207  
     1207
    12081208  $Manager->Execute('INSERT INTO `Module` (`Id`, `Name`, `Title`) VALUES (NULL, "Plánovač", "Scheduler");');
    12091209}
     
    12111211function UpdateTo730($Manager)
    12121212{
    1213         $Manager->Execute('CREATE TABLE IF NOT EXISTS `SchedulerAction` (
     1213  $Manager->Execute('CREATE TABLE IF NOT EXISTS `SchedulerAction` (
    12141214  `Id` int(11) NOT NULL AUTO_INCREMENT,
    12151215  `Name` varchar(255) NOT NULL,
    12161216  `Class` varchar(255) NOT NULL,
    1217         PRIMARY KEY (`Id`)
    1218 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;');     
     1217  PRIMARY KEY (`Id`)
     1218) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;');
    12191219  $Manager->Execute('ALTER TABLE `Scheduler` CHANGE `Class` `Action` INT(11) NOT NULL;');
    12201220  $Manager->Execute("ALTER TABLE `Scheduler` ADD INDEX ( `Action` ) ");
     
    12261226function UpdateTo731($Manager)
    12271227{
    1228         // NetworkDomain
    1229         $Manager->Execute('CREATE TABLE IF NOT EXISTS `NetworkDomain` (
     1228  // NetworkDomain
     1229  $Manager->Execute('CREATE TABLE IF NOT EXISTS `NetworkDomain` (
    12301230`Id` int(11) NOT NULL,
    12311231`Name` varchar(255) NOT NULL,
     
    12521252  if($DbResult->num_rows > 0)
    12531253  {
    1254         $DbRow = $DbResult->fetch_assoc();
    1255         $Manager->Execute("INSERT INTO `MenuItem` (`Id` ,`Name` ,`Parent` ,`Action` ,`Menu`) ".
    1256                 "VALUES (NULL , 'Síťová doména', ".$DbRow['Id'].", '".$ActionId."', '1');");
    1257   } 
    1258        
    1259         // Model additions
    1260         $Manager->Execute('ALTER TABLE `Model` ADD `Title` VARCHAR(255) NOT NULL , '.
    1261                 'ADD `Query` VARCHAR(255) NOT NULL , '.
    1262                 'ADD `DefaultSortColumn` VARCHAR(255) NOT NULL , '.
    1263                 'ADD `DefaultSortOrder` INT NOT NULL ;');
    1264        
    1265         // ModelField
    1266         $Manager->Execute('CREATE TABLE IF NOT EXISTS `ModelField` (
    1267         `Id` int(11) NOT NULL,
    1268         `Name` varchar(255) NOT NULL,
    1269         `Model` int(11) NOT NULL,
    1270         `Query` varchar(255) NOT NULL,
    1271         `Type` varchar(255) NOT NULL,
    1272         `Title` varchar(255) NOT NULL,
    1273         `DefaultValue` varchar(255) NOT NULL,
    1274         `IsNull` int(11) NOT NULL,
    1275         `Suffix` varchar(255) NOT NULL
    1276         ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;');
    1277        
    1278         $Manager->Execute('ALTER TABLE `ModelField`
    1279         ADD PRIMARY KEY (`Id`), ADD KEY `Model` (`Model`);');
    1280        
    1281         $Manager->Execute('ALTER TABLE `ModelField`
    1282         MODIFY `Id` int(11) NOT NULL AUTO_INCREMENT;');
    1283        
    1284         $Manager->Execute('ALTER TABLE `ModelField`
    1285         ADD CONSTRAINT `ModelField_ibfk_1` FOREIGN KEY (`Model`) REFERENCES `Model` (`Id`);');
    1286        
    1287         // Module additions
    1288         $Manager->Execute('ALTER TABLE `Module` ADD `Version` VARCHAR(255) NOT NULL , '.
    1289                 'ADD `Creator` VARCHAR(255) NOT NULL , '.
    1290                 'ADD `License` VARCHAR(255) NOT NULL , '.
    1291                 'ADD `Installed` INT NOT NULL , '.
    1292                 'ADD `HomePage` VARCHAR(255) NOT NULL , '.
    1293                 'ADD `Description` TEXT NOT NULL ;');
    1294        
    1295         // ModuleLink
    1296         $Manager->Execute('CREATE TABLE IF NOT EXISTS `ModuleLink` (
     1254    $DbRow = $DbResult->fetch_assoc();
     1255    $Manager->Execute("INSERT INTO `MenuItem` (`Id` ,`Name` ,`Parent` ,`Action` ,`Menu`) ".
     1256      "VALUES (NULL , 'Síťová doména', ".$DbRow['Id'].", '".$ActionId."', '1');");
     1257  }
     1258
     1259  // Model additions
     1260  $Manager->Execute('ALTER TABLE `Model` ADD `Title` VARCHAR(255) NOT NULL , '.
     1261    'ADD `Query` VARCHAR(255) NOT NULL , '.
     1262    'ADD `DefaultSortColumn` VARCHAR(255) NOT NULL , '.
     1263    'ADD `DefaultSortOrder` INT NOT NULL ;');
     1264
     1265  // ModelField
     1266  $Manager->Execute('CREATE TABLE IF NOT EXISTS `ModelField` (
     1267  `Id` int(11) NOT NULL,
     1268  `Name` varchar(255) NOT NULL,
     1269  `Model` int(11) NOT NULL,
     1270  `Query` varchar(255) NOT NULL,
     1271  `Type` varchar(255) NOT NULL,
     1272  `Title` varchar(255) NOT NULL,
     1273  `DefaultValue` varchar(255) NOT NULL,
     1274  `IsNull` int(11) NOT NULL,
     1275  `Suffix` varchar(255) NOT NULL
     1276  ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;');
     1277
     1278  $Manager->Execute('ALTER TABLE `ModelField`
     1279  ADD PRIMARY KEY (`Id`), ADD KEY `Model` (`Model`);');
     1280
     1281  $Manager->Execute('ALTER TABLE `ModelField`
     1282  MODIFY `Id` int(11) NOT NULL AUTO_INCREMENT;');
     1283
     1284  $Manager->Execute('ALTER TABLE `ModelField`
     1285  ADD CONSTRAINT `ModelField_ibfk_1` FOREIGN KEY (`Model`) REFERENCES `Model` (`Id`);');
     1286
     1287  // Module additions
     1288  $Manager->Execute('ALTER TABLE `Module` ADD `Version` VARCHAR(255) NOT NULL , '.
     1289    'ADD `Creator` VARCHAR(255) NOT NULL , '.
     1290    'ADD `License` VARCHAR(255) NOT NULL , '.
     1291    'ADD `Installed` INT NOT NULL , '.
     1292    'ADD `HomePage` VARCHAR(255) NOT NULL , '.
     1293    'ADD `Description` TEXT NOT NULL ;');
     1294
     1295  // ModuleLink
     1296  $Manager->Execute('CREATE TABLE IF NOT EXISTS `ModuleLink` (
    12971297`Id` int(11) NOT NULL,
    12981298  `Module` int(11) NOT NULL,
     
    13051305
    13061306  $Manager->Execute('ALTER TABLE `ModuleLink`
    1307         MODIFY `Id` int(11) NOT NULL AUTO_INCREMENT;');
     1307    MODIFY `Id` int(11) NOT NULL AUTO_INCREMENT;');
    13081308}
    13091309
    13101310function UpdateTo735($Manager)
    13111311{
    1312         $Manager->Execute('CREATE TABLE IF NOT EXISTS `NetworkFreeAccess` (
     1312  $Manager->Execute('CREATE TABLE IF NOT EXISTS `NetworkFreeAccess` (
    13131313`Id` int(11) NOT NULL,
    13141314`IPAddress` varchar(255) NOT NULL,
    13151315`Time` datetime NOT NULL
    13161316) ENGINE=InnoDB DEFAULT CHARSET=utf8;');
    1317        
    1318         $Manager->Execute('ALTER TABLE `NetworkFreeAccess`
    1319         ADD PRIMARY KEY (`Id`);');
    1320        
    1321         $Manager->Execute('ALTER TABLE `NetworkFreeAccess`
    1322         MODIFY `Id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=1;');
    1323        
    1324         $Manager->Execute('ALTER TABLE `NetworkFreeAccess` ADD `Configured` INT NOT NULL ;');
    1325         $DbResult = $Manager->Execute('INSERT INTO `SchedulerAction` (`Id`, `Name`, `Class`) VALUES '.
    1326                 '(NULL, "Konfigurace internetu zdarma", "ScheduleConfigureFreeAccess");');
    1327         $ActionId = $Manager->Database->insert_id;
    1328         $Manager->Execute('INSERT INTO `Scheduler` (`Id`, `Name`, `Enabled`, `Action`,
    1329                 `Log`, `LastExecutedTime`, `ScheduledTime`, `Period`) VALUES (NULL, "Internet zdarma",
    1330                 1, '.$ActionId.', "", NULL, "", 5);');
    1331         $Manager->Execute('ALTER TABLE `Scheduler` CHANGE `ScheduledTime` `ScheduledTime` DATETIME NULL;');
     1317
     1318  $Manager->Execute('ALTER TABLE `NetworkFreeAccess`
     1319  ADD PRIMARY KEY (`Id`);');
     1320
     1321  $Manager->Execute('ALTER TABLE `NetworkFreeAccess`
     1322  MODIFY `Id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=1;');
     1323
     1324  $Manager->Execute('ALTER TABLE `NetworkFreeAccess` ADD `Configured` INT NOT NULL ;');
     1325  $DbResult = $Manager->Execute('INSERT INTO `SchedulerAction` (`Id`, `Name`, `Class`) VALUES '.
     1326    '(NULL, "Konfigurace internetu zdarma", "ScheduleConfigureFreeAccess");');
     1327  $ActionId = $Manager->Database->insert_id;
     1328  $Manager->Execute('INSERT INTO `Scheduler` (`Id`, `Name`, `Enabled`, `Action`,
     1329    `Log`, `LastExecutedTime`, `ScheduledTime`, `Period`) VALUES (NULL, "Internet zdarma",
     1330    1, '.$ActionId.', "", NULL, "", 5);');
     1331  $Manager->Execute('ALTER TABLE `Scheduler` CHANGE `ScheduledTime` `ScheduledTime` DATETIME NULL;');
    13321332}
    13331333
    13341334function UpdateTo736($Manager)
    13351335{
    1336         $Manager->Execute('CREATE TABLE IF NOT EXISTS `NetworkLinkType` (
     1336  $Manager->Execute('CREATE TABLE IF NOT EXISTS `NetworkLinkType` (
    13371337`Id` int(11) NOT NULL,
    13381338`Name` varchar(255) NOT NULL
     
    13991399      697 => array('Revision' => 707, 'Function' => 'UpdateTo707'),
    14001400      707 => array('Revision' => 710, 'Function' => 'UpdateTo710'),
    1401         710 => array('Revision' => 715, 'Function' => 'UpdateTo715'),
     1401      710 => array('Revision' => 715, 'Function' => 'UpdateTo715'),
    14021402      715 => array('Revision' => 718, 'Function' => 'UpdateTo718'),
    14031403      718 => array('Revision' => 719, 'Function' => 'UpdateTo719'),
    1404         719 => array('Revision' => 720, 'Function' => 'UpdateTo720'),
    1405         720 => array('Revision' => 722, 'Function' => 'UpdateTo722'),
    1406         722 => array('Revision' => 725, 'Function' => 'UpdateTo725'),
    1407         725 => array('Revision' => 726, 'Function' => 'UpdateTo726'),
    1408         726 => array('Revision' => 729, 'Function' => 'UpdateTo729'),
    1409         729 => array('Revision' => 730, 'Function' => 'UpdateTo730'),
    1410         730 => array('Revision' => 731, 'Function' => 'UpdateTo731'),
    1411         731 => array('Revision' => 735, 'Function' => 'UpdateTo735'),
    1412         735 => array('Revision' => 736, 'Function' => 'UpdateTo736'),
     1404      719 => array('Revision' => 720, 'Function' => 'UpdateTo720'),
     1405      720 => array('Revision' => 722, 'Function' => 'UpdateTo722'),
     1406      722 => array('Revision' => 725, 'Function' => 'UpdateTo725'),
     1407      725 => array('Revision' => 726, 'Function' => 'UpdateTo726'),
     1408      726 => array('Revision' => 729, 'Function' => 'UpdateTo729'),
     1409      729 => array('Revision' => 730, 'Function' => 'UpdateTo730'),
     1410      730 => array('Revision' => 731, 'Function' => 'UpdateTo731'),
     1411      731 => array('Revision' => 735, 'Function' => 'UpdateTo735'),
     1412      735 => array('Revision' => 736, 'Function' => 'UpdateTo736'),
    14131413    ));
    14141414  }
Note: See TracChangeset for help on using the changeset viewer.