Changeset 887 for trunk/Application


Ignore:
Timestamp:
Nov 20, 2020, 12:08:12 AM (4 years ago)
Author:
chronos
Message:
  • Added: Static types added to almost all classes, methods and function. Supported by PHP 7.4.
  • Fixed: Various found code issues.
Location:
trunk/Application
Files:
5 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/Application/Core.php

    r886 r887  
    1414class Core extends Application
    1515{
    16   /** @var Type */
    17   var $Type;
    18   var $Pages;
    19   var $Bars;
    20   /** @var FormManager */
    21   var $FormManager;
    22   /** @var Config */
    23   var $ConfigManager;
    24   var $PathItems;
    25   var $RootURLFolder;
    26   var $ShowPage;
    27   var $Setup;
    28   var $CommandLine;
    29   var $PageHeaders;
    30   var $BaseView;
     16  public Type $Type;
     17  public array $Bars;
     18  public FormManager $FormManager;
     19  public array $Config;
     20  public Config $ConfigManager;
     21  public array $PathItems;
     22  public string $RootURLFolder;
     23  public bool $ShowPage;
     24  public Setup $Setup;
     25  public array $PageHeaders;
     26  public BaseView $BaseView;
     27  public LocaleManager $LocaleManager;
     28  public array $LinkLocaleExceptions;
    3129
    3230  function __construct()
    3331  {
    3432    parent::__construct();
    35     $this->Modules = array();
    36     $this->Pages = array();
     33    $this->Config = array();
    3734    $this->ModuleManager->FileName = dirname(__FILE__).'/../Config/ModulesConfig.php';
    3835    $this->FormManager = new FormManager($this->Database);
     
    4239    if (substr($this->RootURLFolder, -10, 10) == '/index.php')
    4340      $this->RootURLFolder = substr($this->RootURLFolder, 0, -10);
    44     $this->CommandLine = array();
    4541    $this->PageHeaders = array();
    46   }
    47 
    48   function RegisterPage($Path, $Handler)
    49   {
    50     if (is_array($Path))
    51     {
    52       $Page = &$this->Pages;
    53       $LastKey = array_pop($Path);
    54       foreach ($Path as $PathItem)
    55       {
    56         $Page = &$Page[$PathItem];
    57       }
    58       if (!is_array($Page)) $Page = array('' => $Page);
    59       $Page[$LastKey] = $Handler;
    60     } else $this->Pages[$Path] = $Handler;
    61   }
    62 
    63   function UnregisterPage($Path)
    64   {
    65     unset($this->Pages[$Path]);
    66   }
    67 
    68   function SearchPage($PathItems, $Pages)
     42    $this->LinkLocaleExceptions = array();
     43  }
     44
     45  function SearchPage(array $PathItems, array $Pages): ?string
    6946  {
    7047    if (count($PathItems) > 0) $PathItem = $PathItems[0];
     
    8057  }
    8158
    82   function PageNotFound()
    83   {
    84     return 'Page '.implode('/', $this->PathItems).' not found.';
    85   }
    86 
    87   function ShowPage()
     59  function ShowPage(): void
    8860  {
    8961    $this->BaseView = new BaseView($this);
     
    9466    {
    9567      $Page = new $ClassName($this);
    96     } else {
     68    } else
     69    {
    9770      $Page = new PageMissing($this);
    9871    }
     
    10073  }
    10174
    102   function ModulePresent($Name)
    103   {
    104     return array_key_exists($Name, $this->Modules);
    105   }
    106 
    107   function AddModule($Module)
    108   {
    109     $this->Modules[get_class($Module)] = $Module;
    110   }
    111 
    112   function HumanDate($Time)
     75  function ModulePresent(string $Name): bool
     76  {
     77    return array_key_exists($Name, $this->ModuleManager->Modules);
     78  }
     79
     80  function AddModule($Module): void
     81  {
     82    $this->ModuleManager->Modules[get_class($Module)] = $Module;
     83  }
     84
     85  function HumanDate(int $Time): string
    11386  {
    11487    return date('j.n.Y', $Time);
    11588  }
    11689
    117   function Link($Target)
     90  function Link(string $Target): string
    11891  {
    11992    return $this->RootURLFolder.$Target;
    12093  }
    12194
    122   function ShowAction($Id)
     95  function ShowAction(string $Id): string
    12396  {
    12497    $Output = '';
     
    131104      if ($Action['Icon'] == '') $Action['Icon'] = 'clear.png';
    132105      if (substr($Action['URL'], 0, 4) != 'http') $Action['URL'] = $this->Link($Action['URL']);
    133       if (!defined('NEW_PERMISSION') or $this->User->CheckPermission('System', 'Read', 'Item', $Id))
     106      if (!defined('NEW_PERMISSION') or ModuleUser::Cast($this->System->GetModule('User'))->User->CheckPermission('System', 'Read', 'Item', $Id))
    134107        $Output .= '<img alt="'.$Action['Title'].'" src="'.$this->Link('/images/favicons/'.$Action['Icon']).
    135108        '" width="16" height="16" /> <a href="'.$Action['URL'].'">'.$Action['Title'].'</a>';
     
    138111  }
    139112
    140   function RunCommon()
    141   {
    142     global $Database, $ScriptTimeStart, $ConfigFileName, $Mail, $Type,
    143       $DatabaseRevision, $Config, $GlobalLocaleManager;
     113  function RunCommon(): void
     114  {
     115    global $Database, $ScriptTimeStart, $ConfigFileName, $Config, $GlobalLocaleManager;
    144116
    145117    date_default_timezone_set('Europe/Prague');
     
    199171  }
    200172
    201   function Run()
     173  function Run(): void
    202174  {
    203175    $this->RunCommon();
     
    213185      {
    214186         $NewLangCode = $this->PathItems[0];
    215          if (array_key_exists($NewLangCode, $this->LocaleManager->Available)) 
     187         if (array_key_exists($NewLangCode, $this->LocaleManager->Available))
    216188         {
    217189           array_shift($this->PathItems);
     
    226198  }
    227199
    228   function RunCommandLine()
     200  function RunCommandLine(): void
    229201  {
    230202    global $argv;
     
    236208      {
    237209        $Command = $this->CommandLine[$argv[1]];
    238         $Output = call_user_func($Command['Callback'], $argv);
     210        $Output = call_user_func($Command->Callback, $argv);
    239211      } else $Output = 'Command "'.$argv[1].'" not supported.'."\n";
    240     } else $Output = 'No command was given as parameter'."\n";
     212    } else $Output = 'No command was given as parameter. Use "list" to show available commands.'."\n";
    241213    echo($Output);
    242214  }
    243215
    244   function RegisterCommandLine($Name, $Callback)
    245   {
    246     $this->CommandLine[$Name] = array('Name' => $Name, 'Callback' => $Callback);
    247   }
    248 
    249   function RegisterPageBar($Name)
     216  function RegisterPageBar(string $Name): void
    250217  {
    251218    $this->Bars[$Name] = array();
    252219  }
    253220
    254   function UnregisterPageBar($Name)
     221  function UnregisterPageBar(string $Name): void
    255222  {
    256223    unset($this->Bars[$Name]);
    257224  }
    258225
    259   function RegisterPageBarItem($BarName, $ItemName, $Callback)
     226  function RegisterPageBarItem(string $BarName, string $ItemName, callable $Callback): void
    260227  {
    261228    $this->Bars[$BarName][$ItemName] = $Callback;
    262229  }
    263230
    264   function RegisterPageHeader($Name, $Callback)
     231  function UnregisterPageBarItem(string $BarName, string $ItemName): void
     232  {
     233    unset($this->Bars[$BarName][$ItemName]);
     234  }
     235
     236  function RegisterPageHeader(string $Name, callable $Callback): void
    265237  {
    266238    $this->PageHeaders[$Name] = $Callback;
     239  }
     240
     241  function UnregisterPageHeader(string $Name): void
     242  {
     243    unset($this->PageHeaders[$Name]);
    267244  }
    268245}
     
    270247class PageMissing extends Page
    271248{
    272   var $FullTitle = 'Stránka nenalezena';
    273   var $ShortTitle = 'Stránka nenalezena';
    274 
    275   function __construct($System)
     249  function __construct(System $System)
    276250  {
    277251    parent::__construct($System);
     252    $this->FullTitle = 'Stránka nenalezena';
     253    $this->ShortTitle = 'Stránka nenalezena';
    278254    $this->ParentClass = 'PagePortal';
    279255  }
    280256
    281   function Show()
     257  function Show(): string
    282258  {
    283259    Header($_SERVER['SERVER_PROTOCOL'].' 404 Not Found');
  • trunk/Application/DefaultConfig.php

    r874 r887  
    33class DefaultConfig
    44{
    5   function Get()
     5  function Get(): array
    66  {
    77    $IsDeveloper = in_array($_SERVER['REMOTE_ADDR'], array('127.0.0.1'));
  • trunk/Application/FormClasses.php

    r844 r887  
    33// TODO: Split all form class definitions to modules
    44
    5 function RegisterFormClasses($FormManager)
     5function RegisterFormClasses(FormManager $FormManager): void
    66{
    77  $FormManager->Classes = array(
  • trunk/Application/FullInstall.php

    r782 r887  
    11<?php
    22
    3 function FullInstall($Manager)
     3function FullInstall(UpdateManager $Manager): void
    44{
    55  $Manager->Execute("
  • trunk/Application/UpdateTrace.php

    r885 r887  
    11<?php
    22
    3 function UpdateTo493($Manager)
     3function UpdateTo493(UpdateManager $Manager): void
    44{
    55  $Manager->Execute("ALTER TABLE `UserOnline` CHANGE `User` `User` INT( 11 ) NULL DEFAULT NULL COMMENT 'User.Id'");
    66}
    77
    8 function UpdateTo494($Manager)
     8function UpdateTo494(UpdateManager $Manager): void
    99{
    1010  $Manager->Execute("ALTER TABLE `FinanceOperation` DROP FOREIGN KEY `FinanceOperation_ibfk_2` ;\n".
     
    1313}
    1414
    15 function UpdateTo495($Manager)
     15function UpdateTo495(UpdateManager $Manager): void
    1616{
    1717  $Manager->Execute("INSERT INTO `MapPosition` (SELECT NULL AS `Id`, `Name`, `MapPositionX` AS `Latitude`, `MapPositionY` AS `Longitude` FROM `Subject`)");
     
    2424}
    2525
    26 function UpdateTo497($Manager)
     26function UpdateTo497(UpdateManager $Manager): void
    2727{
    2828  $Manager->Execute("ALTER TABLE `FinanceCharge` ADD `Id` INT NOT NULL AUTO_INCREMENT FIRST , ADD PRIMARY KEY ( `Id` ) ");
     
    5252}
    5353
    54 function UpdateTo498($Manager)
     54function UpdateTo498(UpdateManager $Manager): void
    5555{
    5656  $Manager->Execute("INSERT INTO `ISMenuItem` (`Id` ,`Name` ,`Parent` ,`Table` ,`IconName`) ".
     
    7676}
    7777
    78 function UpdateTo499($Manager)
     78function UpdateTo499(UpdateManager $Manager): void
    7979{
    8080  $Manager->Execute("CREATE TABLE IF NOT EXISTS `Currency` (
     
    121121}
    122122
    123 function UpdateTo500($Manager)
     123function UpdateTo500(UpdateManager $Manager): void
    124124{
    125125  $Manager->Execute("CREATE TABLE IF NOT EXISTS `FinanceBank` (
     
    145145}
    146146
    147 function UpdateTo502($Manager)
     147function UpdateTo502(UpdateManager $Manager): void
    148148{
    149149  $Manager->Execute("ALTER TABLE `FinanceBankAccount` ADD `LoginName` VARCHAR( 255 ) NOT NULL ");
     
    159159}
    160160
    161 function UpdateTo505($Manager)
     161function UpdateTo505(UpdateManager $Manager): void
    162162{
    163163  $Manager->Execute("UPDATE `ISMenuItem` SET `Name` = 'Služby', `Table` = 'Service' WHERE `ISMenuItem`.`Name` ='Tarify';");
     
    186186}
    187187
    188 function UpdateTo507($Manager)
     188function UpdateTo507(UpdateManager $Manager): void
    189189{
    190190  $Manager->Execute("INSERT INTO `ISMenuItem` (`Id` ,`Name` ,`Parent` ,`Table` ,`IconName`) ".
     
    229229}
    230230
    231 function UpdateTo515($Manager)
     231function UpdateTo515(UpdateManager $Manager): void
    232232{
    233233  $Manager->Execute("ALTER TABLE `PermissionUserAssignment` CHANGE `User` `User` INT( 11 ) NULL");
    234234}
    235235
    236 function UpdateTo517($Manager)
     236function UpdateTo517(UpdateManager $Manager): void
    237237{
    238238  $Manager->Execute("ALTER TABLE `Log` ADD `IPAddress` VARCHAR( 16 ) NOT NULL");
    239239}
    240240
    241 function UpdateTo526($Manager)
     241function UpdateTo526(UpdateManager $Manager): void
    242242{
    243243  $Manager->Execute("ALTER TABLE `Hyperlink` CHANGE `Name` `Title` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_czech_ci NOT NULL");
     
    276276}
    277277
    278 function UpdateTo527($Manager)
     278function UpdateTo527(UpdateManager $Manager): void
    279279{
    280280  $Manager->Execute("RENAME TABLE `ISMenuItem` TO `MenuItem` ;");
     
    304304}
    305305
    306 function UpdateTo535($Manager)
     306function UpdateTo535(UpdateManager $Manager): void
    307307{
    308308  // Set all string collation to utf8 general
     
    314314}
    315315
    316 function UpdateTo549($Manager)
     316function UpdateTo549(UpdateManager $Manager): void
    317317{
    318318  $Manager->Execute("ALTER TABLE `FinanceOperation` ADD `Generate` INT NOT NULL DEFAULT '0',
     
    322322}
    323323
    324 function UpdateTo550($Manager)
     324function UpdateTo550(UpdateManager $Manager): void
    325325{
    326326  $Manager->Execute('ALTER TABLE `FinanceBankAccount` ADD `LastImportId` VARCHAR( 255 ) NOT NULL ;');
     
    329329}
    330330
    331 function UpdateTo551($Manager)
     331function UpdateTo551(UpdateManager $Manager): void
    332332{
    333333  $Manager->Execute('ALTER TABLE `FinanceOperation` ADD `DocumentLine` INT NULL AFTER `Value` ,
     
    343343}
    344344
    345 function UpdateTo565($Manager)
     345function UpdateTo565(UpdateManager $Manager): void
    346346{
    347347  $Manager->Execute('CREATE TABLE IF NOT EXISTS `WikiPage` (
     
    369369}
    370370
    371 function UpdateTo571($Manager)
     371function UpdateTo571(UpdateManager $Manager): void
    372372{
    373373  $Manager->Execute('ALTER TABLE `NetworkDevice` ADD `LoginName` VARCHAR( 255 ) NOT NULL ,
     
    375375}
    376376
    377 function UpdateTo574($Manager)
     377function UpdateTo574(UpdateManager $Manager): void
    378378{
    379379  $Manager->Execute('ALTER TABLE `MapPosition` ADD `Pos` VARCHAR( 255 ) NOT NULL ;');
     
    383383}
    384384
    385 function UpdateTo584($Manager)
     385function UpdateTo584(UpdateManager $Manager): void
    386386{
    387387  $Manager->Execute("CREATE TABLE IF NOT EXISTS `Module` (
     
    441441}
    442442
    443 function UpdateTo591($Manager)
     443function UpdateTo591(UpdateManager $Manager): void
    444444{
    445445  $Manager->Execute('ALTER TABLE `StockItem` ADD `Esemble` INT NULL ,
     
    449449}
    450450
    451 function UpdateTo597($Manager)
     451function UpdateTo597(UpdateManager $Manager): void
    452452{
    453453  $Manager->Execute('CREATE TABLE IF NOT EXISTS `Model` (
     
    463463}
    464464
    465 function UpdateTo601($Manager)
     465function UpdateTo601(UpdateManager $Manager): void
    466466{
    467467  $Manager->Execute('CREATE TABLE IF NOT EXISTS `NetworkInterfaceWireless` (
     
    489489}
    490490
    491 function UpdateTo615($Manager)
     491function UpdateTo615(UpdateManager $Manager): void
    492492{
    493493  $Manager->Execute('ALTER TABLE `NetworkInterfaceWireless` ADD `AntennaPolarity` INT NOT NULL ,
     
    523523}
    524524
    525 function UpdateTo619($Manager)
     525function UpdateTo619(UpdateManager $Manager): void
    526526{
    527527  $Manager->Execute('ALTER TABLE `UserOnline` ADD `StayLogged` INT NOT NULL ;');
    528528}
    529529
    530 function UpdateTo620($Manager)
     530function UpdateTo620(UpdateManager $Manager): void
    531531{
    532532  $Manager->Execute('ALTER TABLE `NetworkInterfaceWireless` ADD `ChannelWidthLower` INT NOT NULL ,
     
    536536}
    537537
    538 function UpdateTo627($Manager)
     538function UpdateTo627(UpdateManager $Manager): void
    539539{
    540540  $Manager->Execute('ALTER TABLE `FinanceInvoice` CHANGE `TimeCreation` `Time` DATETIME NOT NULL DEFAULT "0000-00-00 00:00:00";');
     
    542542}
    543543
    544 function UpdateTo632($Manager)
     544function UpdateTo632(UpdateManager $Manager): void
    545545{
    546546  $Manager->Execute('CREATE TABLE IF NOT EXISTS `FinanceInvoiceOperationRel` (
     
    557557}
    558558
    559 function UpdateTo633($Manager)
     559function UpdateTo633(UpdateManager $Manager): void
    560560{
    561561  $Manager->Execute('ALTER TABLE `UserOnline` ADD `StayLoggedHash` VARCHAR( 40 ) NOT NULL ;');
    562562}
    563563
    564 function UpdateTo645($Manager)
     564function UpdateTo645(UpdateManager $Manager): void
    565565{
    566566  $Manager->Execute('CREATE TABLE IF NOT EXISTS `FinanceVATType` (
     
    576576}
    577577
    578 function UpdateTo646($Manager)
     578function UpdateTo646(UpdateManager $Manager): void
    579579{
    580580  $Manager->Execute('CREATE TABLE IF NOT EXISTS `Contract` (
     
    612612}
    613613
    614 function UpdateTo647($Manager)
     614function UpdateTo647(UpdateManager $Manager): void
    615615{
    616616  $Manager->Execute('ALTER TABLE `EmployeeSalary` ADD FOREIGN KEY ( `Employee` ) REFERENCES `Employee` (
     
    647647}
    648648
    649 function UpdateTo656($Manager)
     649function UpdateTo656(UpdateManager $Manager): void
    650650{
    651651  $Manager->Execute('CREATE TABLE IF NOT EXISTS `Measure` (
     
    706706}
    707707
    708 function UpdateTo657($Manager)
     708function UpdateTo657(UpdateManager $Manager): void
    709709{
    710710  $Manager->Execute('CREATE TABLE IF NOT EXISTS `NetworkInterfaceUpDown` (
     
    727727}
    728728
    729 function UpdateTo661($Manager)
     729function UpdateTo661(UpdateManager $Manager): void
    730730{
    731731  $Manager->Execute('CREATE TABLE IF NOT EXISTS `Contact` (
     
    773773}
    774774
    775 function UpdateTo662($Manager)
     775function UpdateTo662(UpdateManager $Manager): void
    776776{
    777777  $Manager->Execute('INSERT INTO `Contact` (SELECT NULL AS `Id`, 2 AS `Category`, `ICQ` AS `Value`, NULL AS `Subject`, `Id` AS `User` FROM `User`
     
    783783}
    784784
    785 function UpdateTo668($Manager)
     785function UpdateTo668(UpdateManager $Manager): void
    786786{
    787787  $Manager->Execute('CREATE TABLE IF NOT EXISTS `APIToken` (
     
    799799}
    800800
    801 function UpdateTo671($Manager)
     801function UpdateTo671(UpdateManager $Manager): void
    802802{
    803803  $Manager->Execute('CREATE TABLE IF NOT EXISTS `NetworkSignal` (
     
    834834}
    835835
    836 function UpdateTo674($Manager)
     836function UpdateTo674(UpdateManager $Manager): void
    837837{
    838838  $Manager->Execute('ALTER TABLE `NetworkSignal` ADD `RateRx` INT NOT NULL ;');
     
    840840}
    841841
    842 function UpdateTo676($Manager)
     842function UpdateTo676(UpdateManager $Manager): void
    843843{
    844844  $Manager->Execute('ALTER TABLE `NetworkSignal` ADD `Device` INT NULL ,
     
    848848}
    849849
    850 function UpdateTo678($Manager)
     850function UpdateTo678(UpdateManager $Manager): void
    851851{
    852852  $Manager->Execute('ALTER TABLE `Contact` ADD `Description` VARCHAR( 255 ) NOT NULL ;');
     
    879879}
    880880
    881 function UpdateTo679($Manager)
     881function UpdateTo679(UpdateManager $Manager): void
    882882{
    883883  $Manager->Execute('ALTER TABLE `NetworkDevice` ADD `Product` INT NOT NULL AFTER `Id` ,
     
    885885}
    886886
    887 function UpdateTo688($Manager)
     887function UpdateTo688(UpdateManager $Manager): void
    888888{
    889889  // Convert monthly plus payment for consumption to regular service
     
    899899}
    900900
    901 function UpdateTo692($Manager)
     901function UpdateTo692(UpdateManager $Manager): void
    902902{
    903903  // Convert user emails to contacts
     
    912912}
    913913
    914 function UpdateTo696($Manager)
     914function UpdateTo696(UpdateManager $Manager): void
    915915{
    916916  $Manager->Execute('ALTER TABLE `NetworkInterfaceUpDown` ADD `Duration` INT NOT NULL ;');
     
    920920}
    921921
    922 function UpdateTo697($Manager)
     922function UpdateTo697(UpdateManager $Manager): void
    923923{
    924924  $Manager->Execute('ALTER TABLE `NetworkInterfaceUpDown` CHANGE `Duration` `Duration` INT( 11 ) NULL ;');
     
    929929}
    930930
    931 function UpdateTo707($Manager)
     931function UpdateTo707(UpdateManager $Manager): void
    932932{
    933933  $Manager->Execute('ALTER TABLE `NetworkDevice` CHANGE `Product` `Product` INT(11) NULL;');
    934934}
    935935
    936 function UpdateTo710($Manager)
     936function UpdateTo710(UpdateManager $Manager): void
    937937{
    938938  $Manager->Execute('RENAME TABLE `StockItem` TO `StockSerialNumber`;');
     
    995995}
    996996
    997 function UpdateTo715($Manager)
     997function UpdateTo715(UpdateManager $Manager): void
    998998{
    999999  $Manager->Execute('ALTER TABLE `StockSerialNumber` DROP FOREIGN KEY `StockSerialNumber_ibfk_6`;');
     
    10051005}
    10061006
    1007 function UpdateTo718($Manager)
     1007function UpdateTo718(UpdateManager $Manager): void
    10081008{
    10091009  $Manager->Execute('CREATE TABLE IF NOT EXISTS `Company` (
     
    10331033}
    10341034
    1035 function UpdateTo719($Manager)
     1035function UpdateTo719(UpdateManager $Manager): void
    10361036{
    10371037  $Manager->Execute('ALTER TABLE `FinanceOperation` ADD `Direction` INT NOT NULL AFTER `Cash`;');
     
    10771077}
    10781078
    1079 function UpdateTo720($Manager)
     1079function UpdateTo720(UpdateManager $Manager): void
    10801080{
    10811081  $Manager->Execute('ALTER TABLE `FinanceInvoice` ADD `Direction` INT NOT NULL AFTER `TimePayment`;');
     
    11081108}
    11091109
    1110 function UpdateTo722($Manager)
     1110function UpdateTo722(UpdateManager $Manager): void
    11111111{
    11121112  $Manager->Execute('ALTER TABLE `Service` DROP `CustomerCount`;');
    11131113}
    11141114
    1115 function UpdateTo725($Manager)
     1115function UpdateTo725(UpdateManager $Manager): void
    11161116{
    11171117  // Text column of invoices is not used. Text from invoice items is taken instead.
     
    11491149}
    11501150
    1151 function UpdateTo726($Manager)
     1151function UpdateTo726(UpdateManager $Manager): void
    11521152{
    11531153  $Manager->Execute('ALTER TABLE `ServiceCustomerRel` CHANGE `Action` `ChangeAction` ENUM("add","modify","remove") CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL;');
     
    11721172}
    11731173
    1174 function UpdateTo729($Manager)
     1174function UpdateTo729(UpdateManager $Manager): void
    11751175{
    11761176 $Manager->Execute('ALTER TABLE `FinanceBankAccount` ADD `AutoImport` INT NOT NULL ;');
     
    12091209}
    12101210
    1211 function UpdateTo730($Manager)
     1211function UpdateTo730(UpdateManager $Manager): void
    12121212{
    12131213  $Manager->Execute('CREATE TABLE IF NOT EXISTS `SchedulerAction` (
     
    12241224}
    12251225
    1226 function UpdateTo731($Manager)
     1226function UpdateTo731(UpdateManager $Manager): void
    12271227{
    12281228  // NetworkDomain
     
    13081308}
    13091309
    1310 function UpdateTo735($Manager)
     1310function UpdateTo735(UpdateManager $Manager): void
    13111311{
    13121312  $Manager->Execute('CREATE TABLE IF NOT EXISTS `NetworkFreeAccess` (
     
    13321332}
    13331333
    1334 function UpdateTo736($Manager)
     1334function UpdateTo736(UpdateManager $Manager): void
    13351335{
    13361336  $Manager->Execute('CREATE TABLE IF NOT EXISTS `NetworkLinkType` (
     
    13451345}
    13461346
    1347 function UpdateTo739($Manager)
     1347function UpdateTo739(UpdateManager $Manager): void
    13481348{
    13491349  $Manager->Execute('ALTER TABLE `NetworkDomain` ADD KEY (`Parent`);');
     
    13641364}
    13651365
    1366 function UpdateTo740($Manager)
     1366function UpdateTo740(UpdateManager $Manager): void
    13671367{
    13681368  $Manager->Execute('CREATE TABLE IF NOT EXISTS `FinanceInvoiceGroup` (
     
    14231423}
    14241424
    1425 function UpdateTo741($Manager)
     1425function UpdateTo741(UpdateManager $Manager): void
    14261426{
    14271427        // Add Direction column
     
    14361436}
    14371437
    1438 function UpdateTo742($Manager)
     1438function UpdateTo742(UpdateManager $Manager): void
    14391439{
    14401440  $Manager->Execute('CREATE TABLE IF NOT EXISTS `DocumentLineCode` (
     
    14861486}
    14871487
    1488 function UpdateTo747($Manager)
     1488function UpdateTo747(UpdateManager $Manager): void
    14891489{
    14901490  $Manager->Execute('ALTER TABLE `FinanceOperation` ADD `ValueUser` FLOAT NOT NULL AFTER `Value`;');
     
    15091509}
    15101510
    1511 function UpdateTo748($Manager)
     1511function UpdateTo748(UpdateManager $Manager): void
    15121512{
    15131513  $DbResult = $Manager->Database->query('SELECT * FROM (SELECT `FinanceInvoice`.`Id`, ((SELECT SUM(`Price` * `Quantity`) FROM `FinanceInvoiceItem` WHERE `FinanceInvoiceItem`.`FinanceInvoice`=`FinanceInvoice`.`Id`) * `FinanceInvoiceGroup`.`ValueSign`) AS `Sum`,`FinanceInvoice`.`Value` FROM `FinanceInvoice` LEFT JOIN `FinanceInvoiceGroup` ON `FinanceInvoiceGroup`.`Id`=`FinanceInvoice`.`Group`) AS `T` WHERE `Sum` != `Value`');
     
    15181518}
    15191519
    1520 function UpdateTo752($Manager)
     1520function UpdateTo752(UpdateManager $Manager): void
    15211521{
    15221522  $Manager->Database->query('INSERT INTO `SchedulerAction` (`Id`, `Name`, `Class`) '.
     
    15541554}
    15551555
    1556 function UpdateTo755($Manager)
     1556function UpdateTo755(UpdateManager $Manager): void
    15571557{
    15581558  $Manager->Execute("INSERT INTO `FinanceInvoiceGroup` (`Id`, `Name`, `DocumentLine`, `ValueSign`, `Direction`) ".
     
    15761576}
    15771577
    1578 function UpdateTo759($Manager)
     1578function UpdateTo759(UpdateManager $Manager): void
    15791579{
    15801580  $Manager->Execute('ALTER TABLE `Scheduler` ADD `Duration` INT NOT NULL AFTER `Period`;');
     
    15821582
    15831583/*
    1584 function UpdateTo761($Manager)
     1584function UpdateTo761(UpdateManager $Manager): void
    15851585{
    15861586  $Manager->Execute('INSERT INTO `MACAddress` (SELECT "" AS `Id`,`MAC` AS `Value` FROM `NetworkSignal` GROUP BY `MAC`)');
     
    15901590*/
    15911591
    1592 function UpdateTo762($Manager)
     1592function UpdateTo762(UpdateManager $Manager): void
    15931593{
    15941594  $Manager->Execute('ALTER TABLE `NetworkDevice` ADD `OnlineNotify` INT NOT NULL AFTER `API`;');
    15951595}
    15961596
    1597 function UpdateTo763($Manager)
     1597function UpdateTo763(UpdateManager $Manager): void
    15981598{
    15991599  $Manager->Execute('ALTER TABLE `NetworkInterface` ADD `OnlineNotify` INT NOT NULL AFTER `LastOnline`;');
     
    16011601}
    16021602
    1603 function UpdateTo765($Manager)
     1603function UpdateTo765(UpdateManager $Manager): void
    16041604{
    16051605  $Manager->Execute('CREATE TABLE IF NOT EXISTS `SupportActivity` (
     
    16321632}
    16331633
    1634 function UpdateTo768($Manager)
     1634function UpdateTo768(UpdateManager $Manager): void
    16351635{
    16361636  $Manager->Execute('ALTER TABLE `NetworkDomainAlias` ADD `Domain` INT NOT NULL AFTER `Comment`;');
     
    16721672}
    16731673
    1674 function UpdateTo770($Manager)
     1674function UpdateTo770(UpdateManager $Manager): void
    16751675{
    16761676  $Manager->Execute("CREATE TABLE IF NOT EXISTS `OS` (
     
    17871787}
    17881788
    1789 function UpdateTo785($Manager)
     1789function UpdateTo785(UpdateManager $Manager): void
    17901790{
    17911791  $Manager->Execute('DROP TABLE `NetworkInterfaceStat`');
    17921792}
    17931793
    1794 function UpdateTo786($Manager)
     1794function UpdateTo786(UpdateManager $Manager): void
    17951795{
    17961796  $Manager->Execute('ALTER TABLE `Member` DROP FOREIGN KEY Member_ibfk_28;');
     
    18031803}
    18041804
    1805 function UpdateTo792($Manager)
     1805function UpdateTo792(UpdateManager $Manager): void
    18061806{
    18071807  // Transform contracts
     
    18231823}
    18241824
    1825 function UpdateTo800($Manager)
     1825function UpdateTo800(UpdateManager $Manager): void
    18261826{
    18271827  $Manager->Execute('CREATE TABLE IF NOT EXISTS `StockItemHistory` (
     
    18401840}
    18411841
    1842 function UpdateTo802($Manager)
     1842function UpdateTo802(UpdateManager $Manager): void
    18431843{
    18441844  $Manager->Execute('CREATE TABLE IF NOT EXISTS `StockMoveGroup` (
     
    18891889}
    18901890
    1891 function UpdateTo803($Manager)
     1891function UpdateTo803(UpdateManager $Manager): void
    18921892{
    18931893  $Manager->Execute('CREATE TABLE IF NOT EXISTS `StockMoveItemSerialRel` (
     
    19051905}
    19061906
    1907 function UpdateTo807($Manager)
     1907function UpdateTo807(UpdateManager $Manager): void
    19081908{
    19091909  $Manager->Execute('ALTER TABLE `Product` ADD `StockMinCount` INT NOT NULL AFTER `UnitOfMeasure`;');
    19101910}
    19111911
    1912 function UpdateTo808($Manager)
     1912function UpdateTo808(UpdateManager $Manager): void
    19131913{
    19141914  $Manager->Execute('CREATE TABLE IF NOT EXISTS `FinanceTreasuryCheck` (
     
    19481948}
    19491949
    1950 function UpdateTo814($Manager)
     1950function UpdateTo814(UpdateManager $Manager): void
    19511951{
    19521952  $Manager->Execute('CREATE TABLE IF NOT EXISTS `NetworkPort` (
     
    19721972}
    19731973
    1974 function UpdateTo817($Manager)
     1974function UpdateTo817(UpdateManager $Manager): void
    19751975{
    19761976  $Manager->Execute('ALTER TABLE `NetworkConfiguration` ADD `SysName` VARCHAR(255) NOT NULL FIRST;');
     
    19901990}
    19911991
    1992 function UpdateTo818($Manager)
     1992function UpdateTo818(UpdateManager $Manager): void
    19931993{
    19941994  $Manager->Execute('ALTER TABLE `NetworkPort` ADD `Protocol` INT NOT NULL AFTER `Enabled`;');
     
    20072007}
    20082008
    2009 function UpdateTo824($Manager)
     2009function UpdateTo824(UpdateManager $Manager): void
    20102010{
    20112011  $Manager->Execute('CREATE TABLE IF NOT EXISTS `NetworkInterfaceLatency` (
     
    20212021}
    20222022
    2023 function UpdateTo831($Manager)
     2023function UpdateTo831(UpdateManager $Manager): void
    20242024{
    20252025  $Manager->Execute('ALTER TABLE `NetworkLinkType` '.
     
    20332033}
    20342034
    2035 function UpdateTo838($Manager)
     2035function UpdateTo838(UpdateManager $Manager): void
    20362036{
    20372037  $Manager->Execute('ALTER TABLE `News` CHANGE `Date` `Date` DATETIME NULL, CHANGE `TargetDate` `TargetDate` DATETIME NULL;');
    20382038}
    20392039
    2040 function UpdateTo844($Manager)
     2040function UpdateTo844(UpdateManager $Manager): void
    20412041{
    20422042  $Manager->Execute('ALTER TABLE `DocumentLine` ADD `Yearly` BOOLEAN NOT NULL DEFAULT FALSE AFTER `Shortcut`;');
    20432043}
    20442044
    2045 function UpdateTo855($Manager)
     2045function UpdateTo855(UpdateManager $Manager): void
    20462046{
    20472047  $Manager->Execute('CREATE TABLE IF NOT EXISTS `NetworkDeviceLog` (
     
    20582058}
    20592059
    2060 function UpdateTo862($Manager)
     2060function UpdateTo862(UpdateManager $Manager): void
    20612061{
    20622062  $Manager->Execute('ALTER TABLE `NetworkInterfaceUpDown` ADD `Previous` INT NULL AFTER `Duration`');
     
    20652065}
    20662066
    2067 function UpdateTo867($Manager)
     2067function UpdateTo867(UpdateManager $Manager): void
    20682068{
    20692069  $Manager->Execute('CREATE TABLE IF NOT EXISTS `NotifyLog` (
     
    20772077}
    20782078
    2079 function UpdateTo869($Manager)
     2079function UpdateTo869(UpdateManager $Manager): void
    20802080{
    20812081  $Manager->Execute('CREATE TABLE IF NOT EXISTS `NetworkSpeedLimit` (
     
    21042104}
    21052105
    2106 function UpdateTo870($Manager)
     2106function UpdateTo870(UpdateManager $Manager): void
    21072107{
    21082108  $Manager->Execute('ALTER TABLE `NetworkSubnet`ADD COLUMN `MaskIPv6` INT(11) NOT NULL AFTER `AddressRangeIPv6`;');
     
    21112111}
    21122112
    2113 function UpdateTo878($Manager)
     2113function UpdateTo878(UpdateManager $Manager): void
    21142114{
    21152115  $Manager->Execute('ALTER TABLE `NewsImport` ADD `Method` VARCHAR(255) NOT NULL AFTER `Category`;');
     
    21182118}
    21192119
    2120 function UpdateTo880($Manager)
     2120function UpdateTo880(UpdateManager $Manager): void
    21212121{
    21222122  $Manager->Execute('ALTER TABLE `UserOnline` CHANGE `IpAddress` `IpAddress` VARCHAR(45) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT "";');
     
    21252125}
    21262126
    2127 function UpdateTo882($Manager)
     2127function UpdateTo882(UpdateManager $Manager): void
    21282128{
    21292129  $Manager->Execute('ALTER TABLE `FinanceMonthlyOverall` CHANGE `Investment` `Investment` INT(11) NOT NULL DEFAULT "0";');
    21302130}
    21312131
    2132 function UpdateTo885($Manager)
     2132function UpdateTo885(UpdateManager $Manager): void
    21332133{
    21342134  $Manager->Execute('ALTER TABLE `FinanceOperation` CHANGE `Value` `Value` FLOAT NOT NULL DEFAULT "0";');
     
    21372137class Updates
    21382138{
    2139   function Get()
     2139  function Get(): array
    21402140  {
    21412141    return array(
  • trunk/Application/View.php

    r874 r887  
    66{
    77  var $TimeStart;
    8   var $FormatHTML = false;
    9   var $ShowRuntimeInfo = false;
    10   var $ClearPage = false;
    11   var $BasicHTML = false;
    12   var $ParentClass = '';
    13   var $ShortTitle;
    14   var $FullTitle;
    15   var $Encoding;
    16   var $Style;
     8  public bool $FormatHTML = false;
     9  public bool $ShowRuntimeInfo = false;
     10  public bool $ClearPage = false;
     11  public bool $BasicHTML = false;
     12  public string $ParentClass = '';
     13  public string $ShortTitle;
     14  public string $FullTitle;
     15  public string $Encoding;
     16  public string $Style;
    1717
    18   function __construct($System)
     18  function __construct(System $System)
    1919  {
    2020    parent::__construct($System);
     
    3636  }
    3737
    38   function SystemMessage($Title, $Text)
     38  function SystemMessage(string $Title, string $Text): string
    3939  {
    4040    return '<table align="center"><tr><td><div class="SystemMessage"><h3>'.$Title.'</h3><div>'.$Text.'</div></div></td></tr></table>';
     
    4343  }
    4444
    45   function ShowNavigation($Page)
     45  function ShowNavigation(Page $Page): string
    4646  {
    4747    if (array_key_exists('REQUEST_URI', $_SERVER))
     
    7171  }
    7272
    73   function ShowHeader($Page)
     73  function ShowHeader(Page $Page): string
    7474  {
    7575    $Title = $Page->FullTitle;
     
    109109  }
    110110
    111   function ShowFooter()
     111  function ShowFooter(): string
    112112  {
    113113    global $ScriptTimeStart, $Revision, $ReleaseTime;
     
    128128  }
    129129
    130   function GetOutput($Page)
     130  function GetOutput(Page $Page): string
    131131  {
    132132    $Page->OnSystemMessage = array($this->System->BaseView, 'SystemMessage');
     
    141141  }
    142142
    143   function NewPage($ClassName)
     143  function NewPage(string $ClassName): Page
    144144  {
    145145    $Page = new $ClassName();
     
    151151
    152152  // XML formating function
    153   function FormatOutput($s)
     153  function FormatOutput(string $s): string
    154154  {
    155155    $out = '';
Note: See TracChangeset for help on using the changeset viewer.