Ignore:
Timestamp:
Jan 2, 2015, 11:16:56 PM (10 years ago)
Author:
chronos
Message:
  • Added: Support for Hidden items in form types values.
  • Added: Support for Filtered items in form types values.
  • Modified: FinanceOperation Value splitted to (Direction * Value). Direction can be +1 or -1 depends on if money goes out or in company.
  • Added: Menu "Incomes and spends" is now splitted to incomes/spends of bank account or treasury. Direction and document line is filled automatically.
File:
1 edited

Legend:

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

    r718 r719  
    10301030    $Manager->Execute("INSERT INTO `MenuItem` (`Id` ,`Name` ,`Parent` ,`Action` ,`Menu`) ".
    10311031      "VALUES (NULL , 'Firmy', ".$DbRow['Id'].", '".$ActionId."', '1');");
     1032  }
     1033}
     1034
     1035/*
     1036function 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
     1051function 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');");
    10321087  }
    10331088}
     
    10861141      696 => array('Revision' => 697, 'Function' => 'UpdateTo697'),
    10871142      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'),
    10891145      715 => array('Revision' => 718, 'Function' => 'UpdateTo718'),
     1146      718 => array('Revision' => 719, 'Function' => 'UpdateTo719'),
    10901147    ));
    10911148  }
Note: See TracChangeset for help on using the changeset viewer.