Changeset 719 for trunk/Common
- Timestamp:
- Jan 2, 2015, 11:16:56 PM (10 years ago)
- Location:
- trunk/Common
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Common/Form/Form.php
r706 r719 3 3 include_once(dirname(__FILE__).'/../Database.php'); 4 4 include_once(dirname(__FILE__).'/Types/Type.php'); 5 6 /* 7 Form item type definition: 8 Type - identifikace typu z podporovaných 9 Caption - popisek, titulek položky 10 Default - výchozí hodnota 11 Null - hodnota nemusí být zadána 12 NotInList - sloupec neviditelný v seznamu položek 13 Hidden - neviditelný, při přidání nové položky se použije výchozí hodnota. 14 Filter - column is used as filer according default value 15 Suffix - text za hodnotou 16 Description - popis významu položky 17 ReadOnly - je položky pouze pro čtení 18 Required - položka je vyžadována 19 SQL - SQL dotaz pro zjištění hodnoty, #Id bude nahrazeno Id aktuální položky 20 */ 21 5 22 6 23 class Form … … 32 49 ($this->FormManager->FormTypes[$Item['Type']]['Type'] != 'ManyToOne'))) 33 50 { 34 if(!array_key_exists($Index, $this->Values) and isset($Item['Default'])) $this->Values[$Index] = $Item['Default']; 51 if(!array_key_exists($Index, $this->Values) and isset($Item['Default'])) 52 $this->Values[$Index] = $Item['Default']; 35 53 } 36 54 } … … 67 85 ); 68 86 foreach($this->Definition['Items'] as $Index => $Item) 87 if(!array_key_exists('Hidden', $Item) or ($Item['Hidden'] == false)) 69 88 if(!array_key_exists($Item['Type'], $this->FormManager->FormTypes) or 70 89 (array_key_exists($Item['Type'], $this->FormManager->FormTypes) and … … 115 134 if(!array_key_exists('ReadOnly', $Item)) $Item['ReadOnly'] = false; 116 135 if($Item['ReadOnly'] == false) 136 if(!array_key_exists('Hidden', $Item) or ($Item['Hidden'] == false)) 117 137 if(!array_key_exists($Item['Type'], $this->FormManager->FormTypes) or 118 138 (array_key_exists($Item['Type'], $this->FormManager->FormTypes) and … … 255 275 $Values = array(); 256 276 foreach($this->Definition['Items'] as $Index => $Item) 277 if(!array_key_exists('Hidden', $Item) or ($Item['Hidden'] == false)) 278 { 257 279 if((!array_key_exists($Item['Type'], $this->FormManager->FormTypes) or 258 280 (array_key_exists($Item['Type'], $this->FormManager->FormTypes) and … … 279 301 $Values[$Index] = $this->FormManager->Type->ExecuteTypeEvent($UseType, 'OnLoad', 280 302 $Parameters); 303 } 304 } else 305 { 306 if(isset($Item['Default'])) { 307 if(isset($Item['Null']) and ($Item['Null'] == true)) 308 $Values[$Index] = null; 309 else $Values[$Index] = $Item['Default']; 310 } 281 311 } 282 312 return($Values); -
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.