Changeset 719 for trunk/Common/Setup/Updates.php
- Timestamp:
- Jan 2, 2015, 11:16:56 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Common/Setup/Updates.php
r718 r719 1030 1030 $Manager->Execute("INSERT INTO `MenuItem` (`Id` ,`Name` ,`Parent` ,`Action` ,`Menu`) ". 1031 1031 "VALUES (NULL , 'Firmy', ".$DbRow['Id'].", '".$ActionId."', '1');"); 1032 } 1033 } 1034 1035 /* 1036 function UpdateTo719($Manager) 1037 { 1038 $Manager->Execute('ALTER TABLE `FinanceOperation` DROP FOREIGN KEY `FinanceOperation_ibfk_1`;'); 1039 $Manager->Execute('ALTER TABLE `FinanceOperation` CHANGE `Subject` `SubjectFrom` INT(11) NULL DEFAULT "";'); 1040 $Manager->Execute('ALTER TABLE `FinanceOperation` ADD `SubjectTo` INT NULL AFTER `SubjectFrom`, ADD INDEX (`SubjectTo`) ;'); 1041 $Manager->Execute('ALTER TABLE `FinanceOperation` ADD FOREIGN KEY (`SubjectFrom`) REFERENCES `Subject`(`Id`) ON DELETE RESTRICT ON UPDATE RESTRICT;'); 1042 $Manager->Execute('ALTER TABLE `FinanceOperation` ADD FOREIGN KEY (`SubjectTo`) REFERENCES `Subject`(`Id`) ON DELETE RESTRICT ON UPDATE RESTRICT;'); 1043 // Set target subject to 1 = company subject id 1044 $Manager->Execute('UPDATE `FinanceOperation` SET `SubjectTo` = 1;'); 1045 $Manager->Execute('UPDATE `FinanceOperation` SET `SubjectTo` = `SubjectFrom` WHERE `Value` < 0'); 1046 $Manager->Execute('UPDATE `FinanceOperation` SET `SubjectFrom` = 1,`Value`= -`Value` WHERE `Value` < 0'); 1047 1048 } 1049 */ 1050 1051 function UpdateTo719($Manager) 1052 { 1053 $Manager->Execute('ALTER TABLE `FinanceOperation` ADD `Direction` INT NOT NULL AFTER `Cash`;'); 1054 $Manager->Execute('UPDATE `FinanceOperation` SET `Direction` = 1 WHERE `Value` >= 0 ;'); 1055 $Manager->Execute('UPDATE `FinanceOperation` SET `Direction` = -1 WHERE `Value` < 0 ;'); 1056 $Manager->Execute('UPDATE `FinanceOperation` SET `Value` = -`Value` WHERE `Value` < 0 ;'); 1057 1058 // IS menu item 1059 $DbResult = $Manager->Execute('SELECT `Id` FROM `MenuItem` WHERE `Name`="Příjmy a výdaje"'); 1060 if($DbResult->num_rows > 0) 1061 { 1062 $DbRow = $DbResult->fetch_assoc(); 1063 $Manager->Execute('INSERT INTO `Action` (`Id` ,`Name` ,`Title` ,`Type` ,`URL` , 1064 `Group` ,`Icon` ,`PermissionOperation` ,`Enable`) VALUES ( 1065 NULL , "", "Příjem do pokladny", "1", "/is/?t=FinanceTreasuryIn&a=list", NULL , NULL , NULL , "1");'); 1066 $ActionId = $Manager->Database->insert_id; 1067 $Manager->Execute("INSERT INTO `MenuItem` (`Id` ,`Name` ,`Parent` ,`Action` ,`Menu`) ". 1068 "VALUES (NULL , 'Příjem do pokladny', ".$DbRow['Id'].", '".$ActionId."', '1');"); 1069 $Manager->Execute('INSERT INTO `Action` (`Id` ,`Name` ,`Title` ,`Type` ,`URL` , 1070 `Group` ,`Icon` ,`PermissionOperation` ,`Enable`) VALUES ( 1071 NULL , "", "Výdej z pokladny", "1", "/is/?t=FinanceTreasuryOut&a=list", NULL , NULL , NULL , "1");'); 1072 $ActionId = $Manager->Database->insert_id; 1073 $Manager->Execute("INSERT INTO `MenuItem` (`Id` ,`Name` ,`Parent` ,`Action` ,`Menu`) ". 1074 "VALUES (NULL , 'Výdej z pokladny', ".$DbRow['Id'].", '".$ActionId."', '1');"); 1075 $Manager->Execute('INSERT INTO `Action` (`Id` ,`Name` ,`Title` ,`Type` ,`URL` , 1076 `Group` ,`Icon` ,`PermissionOperation` ,`Enable`) VALUES ( 1077 NULL , "", "Příjem na účet", "1", "/is/?t=FinanceAccountIn&a=list", NULL , NULL , NULL , "1");'); 1078 $ActionId = $Manager->Database->insert_id; 1079 $Manager->Execute("INSERT INTO `MenuItem` (`Id` ,`Name` ,`Parent` ,`Action` ,`Menu`) ". 1080 "VALUES (NULL , 'Příjem na účet', ".$DbRow['Id'].", '".$ActionId."', '1');"); 1081 $Manager->Execute('INSERT INTO `Action` (`Id` ,`Name` ,`Title` ,`Type` ,`URL` , 1082 `Group` ,`Icon` ,`PermissionOperation` ,`Enable`) VALUES ( 1083 NULL , "", "Výdej z účtu", "1", "/is/?t=FinanceAccountOut&a=list", NULL , NULL , NULL , "1");'); 1084 $ActionId = $Manager->Database->insert_id; 1085 $Manager->Execute("INSERT INTO `MenuItem` (`Id` ,`Name` ,`Parent` ,`Action` ,`Menu`) ". 1086 "VALUES (NULL , 'Výdej z účtu', ".$DbRow['Id'].", '".$ActionId."', '1');"); 1032 1087 } 1033 1088 } … … 1086 1141 696 => array('Revision' => 697, 'Function' => 'UpdateTo697'), 1087 1142 697 => array('Revision' => 707, 'Function' => 'UpdateTo707'), 1088 710 => array('Revision' => 715, 'Function' => 'UpdateTo715'), 1143 707 => array('Revision' => 710, 'Function' => 'UpdateTo710'), 1144 710 => array('Revision' => 715, 'Function' => 'UpdateTo715'), 1089 1145 715 => array('Revision' => 718, 'Function' => 'UpdateTo718'), 1146 718 => array('Revision' => 719, 'Function' => 'UpdateTo719'), 1090 1147 )); 1091 1148 }
Note:
See TracChangeset
for help on using the changeset viewer.