Changeset 743


Ignore:
Timestamp:
Sep 3, 2015, 9:25:53 AM (9 years ago)
Author:
chronos
Message:
  • Fixed: Upgrade method.
  • Modified: AppModule Upgrade method improvement.
Location:
trunk/Common
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Common/AppModule.php

    r738 r743  
    101101  {
    102102    if(!$this->Installed) return;
     103    if($this->InstalledVersion == $this->Version) return;
    103104    $List = array();
    104105    $this->Manager->EnumSuperiorDependenciesCascade($this, $List, array(ModuleCondition::Installed));
     
    175176  protected function DoUninstall()
    176177  {
     178  }
     179
     180  protected function DoUpgrade()
     181  {
     182
    177183  }
    178184}
     
    213219          if($Action == ModuleAction::Enable) $Module->Enable();
    214220          if($Action == ModuleAction::Disable) $Module->Disable();
     221          if($Action == ModuleAction::Upgrade) $Module->Upgrade();
    215222        }
    216223      }
     
    360367  }
    361368}
    362 
  • trunk/Common/Setup/Updates.php

    r742 r743  
    14321432  $Manager->Execute('ALTER TABLE `FinanceInvoiceGroup` ADD `Direction` INT NOT NULL ;');
    14331433  $Manager->Execute('UPDATE `FinanceInvoiceGroup` SET `Direction` = 1 WHERE ValueSign=1');
    1434   $Manager->Execute('ALTER TABLE `FinanceInvoice` ADD `Direction` INT NOT NULL AFTER `TimePayment`;'); 
     1434  $Manager->Execute('ALTER TABLE `FinanceInvoice` ADD `Direction` INT NOT NULL AFTER `TimePayment`;');
    14351435  $Manager->Execute('UPDATE `FinanceInvoice` SET `Direction` = 1 WHERE ValueSign=1');
    14361436}
     
    14481448  $Manager->Execute('ALTER TABLE `DocumentLineCode`
    14491449ADD CONSTRAINT `DocumentLineCode_ibfk_1` FOREIGN KEY (`DocumentLine`) REFERENCES `DocumentLine` (`Id`);');
    1450  
     1450
    14511451  // Transform finance operations
    14521452  $Manager->Execute('ALTER TABLE `FinanceOperation` CHANGE `BillCode` `BillCodeText` VARCHAR(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL');
     
    14541454  $Manager->Execute('ALTER TABLE `FinanceOperation` ADD FOREIGN KEY (`BillCode`) REFERENCES `DocumentLineCode`(`Id`) ON DELETE RESTRICT ON UPDATE RESTRICT;');
    14551455  $DbResult = $Manager->Execute('SELECT `FinanceOperation`.`Id`, `FinanceOperation`.`BillCodeText`, `FinanceOperationGroup`.`DocumentLine` '.
    1456     'FROM `FinanceInvoice` '.
     1456    'FROM `FinanceOperation` '.
    14571457    'LEFT JOIN `FinanceOperationGroup` ON `FinanceOperationGroup`.`Id` = `FinanceOperation`.`Group` '.
    14581458    'WHERE `FinanceOperation`.`BillCodeText`!=""');
     
    14661466  }
    14671467  $Manager->Execute('ALTER TABLE `FinanceOperation` DROP `BillCodeText`;');
    1468  
     1468
    14691469  // Transform invoices
    14701470  $Manager->Execute('ALTER TABLE `FinanceInvoice` CHANGE `BillCode` `BillCodeText` VARCHAR(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL');
     
    14841484  }
    14851485  $Manager->Execute('ALTER TABLE `FinanceInvoice` DROP `BillCodeText`;');
    1486  
     1486
    14871487        //$Manager->Execute('RENAME TABLE `FinanceOperationGroup` TO `FinanceOperationTemplate`');
    14881488        //$Manager->Execute('RENAME TABLE `FinanceInvoiceGroup` TO `FinanceInvoiceTemplate`');
Note: See TracChangeset for help on using the changeset viewer.