Ignore:
Timestamp:
Nov 20, 2020, 12:08:12 AM (3 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.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/Finance/Import.php

    r874 r887  
    33class PageFinanceImportPayment extends Page
    44{
    5   var $FullTitle = 'Import plateb';
    6   var $ShortTitle = 'Import plateb';
    7   var $ParentClass = 'PageFinance';
     5  function __construct(System $System)
     6  {
     7    parent::__construct($System);
     8    $this->FullTitle = 'Import plateb';
     9    $this->ShortTitle = 'Import plateb';
     10    $this->ParentClass = 'PageFinance';
     11  }
    812
    9   function Show()
     13  function Show(): string
    1014  {
    11     if (!$this->System->User->CheckPermission('Finance', 'SubjectList')) return 'Nemáte oprávnění';
     15    if (!ModuleUser::Cast($this->System->GetModule('User'))->User->CheckPermission('Finance', 'SubjectList')) return 'Nemáte oprávnění';
    1216    if (array_key_exists('Operation', $_GET))
    1317    {
     
    2630  }
    2731
    28   function Prepare()
     32  function Prepare(): string
    2933  {
    30     $Finance = $this->System->Modules['Finance'];
     34    $Finance = &ModuleFinance::Cast($this->System->GetModule('Finance'))->Finance;
    3135    $Finance->LoadMonthParameters(0);
    3236    $Data = explode("\n", $_POST['Source']);
     
    124128  }
    125129
    126   function InsertMoney($Subject, $Value, $Cash, $Taxable, $Time, $Text, $Group)
     130  function InsertMoney(string $Subject, string $Value, string $Cash, string $Taxable, string $Time, string $Text, array $Group)
    127131  {
    128132    $Year = date('Y', $Time);
    129     $BillCode = $this->System->Modules['Finance']->GetNextDocumentLineNumberId($Group['DocumentLine'], $Year);
     133    $BillCode = ModuleFinance::Cast($this->System->GetModule('Finance'))->Finance->GetNextDocumentLineNumberId($Group['DocumentLine'], $Year);
    130134    // TODO: Fixed BankAccount=1, allow to select bank account for import
    131135    $this->Database->insert('FinanceOperation', array('Text' => $Text,
     
    136140  }
    137141
    138   function Insert()
     142  function Insert(): string
    139143  {
    140     $Finance = $this->System->Modules['Finance'];
     144    $Finance = &ModuleFinance::Cast($this->System->GetModule('Finance'))->Finance;
    141145    $Finance->LoadMonthParameters(0);
    142146    $Output = '';
     
    144148    for ($I = $_POST['ItemCount'] - 1; $I >= 0 ; $I--)
    145149    {
    146       if ($_POST['Money'.$I] < 0) {
    147         $FinanceGroup = $this->System->Modules['Finance']->GetFinanceGroupById(OPERATION_GROUP_ACCOUNT_OUT, 'FinanceOperationGroup');
    148       } else {
    149         $FinanceGroup = $this->System->Modules['Finance']->GetFinanceGroupById(OPERATION_GROUP_ACCOUNT_OUT, 'FinanceOperationGroup');
     150      if ($_POST['Money'.$I] < 0)
     151      {
     152        $FinanceGroup = $Finance->GetFinanceGroupById(OPERATION_GROUP_ACCOUNT_OUT, 'FinanceOperationGroup');
     153      } else
     154      {
     155        $FinanceGroup = $Finance->GetFinanceGroupById(OPERATION_GROUP_ACCOUNT_OUT, 'FinanceOperationGroup');
    150156      }
    151157      $Date = explode('-', $_POST['Date'.$I]);
     
    154160        0, $_POST['Taxable'.$I], $Date, $_POST['Text'.$I], $FinanceGroup);
    155161      $Output .= $I.', ';
    156       $this->System->ModuleManager->Modules['Log']->NewRecord('Finance', 'NewPaymentInserted');
     162      ModuleLog::Cast($this->System->GetModule('Log'))->NewRecord('Finance', 'NewPaymentInserted');
    157163    }
    158164    return $Output;
Note: See TracChangeset for help on using the changeset viewer.