Ignore:
Timestamp:
Nov 5, 2015, 11:19:31 PM (9 years ago)
Author:
chronos
Message:
  • Fixed: Import from bank account API.
Location:
trunk/Modules/FinanceBankAPI
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/FinanceBankAPI/FileImport.php

    r755 r764  
    6969  var $ParentClass = 'PageFinance';
    7070
    71   function Show()
     71  function Import($Id)
    7272  {
    7373    $Output = '';
    74     if(!$this->System->User->CheckPermission('Finance', 'SubjectList')) return('Nemáte oprávnění');
    7574
    76     $DbResult = $this->Database->select('FinanceBankAccount', '*', 'Id='.$_GET['i']);
     75    $DbResult = $this->Database->select('FinanceBankAccount', '*', 'Id='.$Id);
    7776    $BankAccount = $DbResult->fetch_assoc();
    7877
     
    9089      $Import->PairOperations();
    9190    }
     91    return($Output);
     92  }
     93
     94  function Show()
     95  {
     96    if(!$this->System->User->CheckPermission('Finance', 'SubjectList'))
     97      return('Nemáte oprávnění');
     98
     99    $Output = $this->Import($_GET['i']);
    92100    return($Output);
    93101  }
  • trunk/Modules/FinanceBankAPI/FinanceBankAPI.php

    r761 r764  
    101101  {
    102102    $Output = '';
    103     $DbResult = $this->Database->select('FinanceBankAccount', 'Id, Comment',
    104       '(`AutoImport`=1) AND ((`TimeEnd` IS NULL) OR (`TimeEnd` > NOW()))');
     103    $DbResult = $this->Database->select('FinanceBankAccount', '`Id`, `Comment`',
     104      '(`AutoImport`=1) AND (`TimeCreate` < NOW()) AND '.
     105      '((`TimeEnd` IS NULL) OR (`TimeEnd` > NOW()))');
    105106    while($DbRow = $DbResult->fetch_assoc())
    106107    {
    107108      echo($DbRow['Comment']."\n");
    108109      $Page = new PageImportAPI($this->System);
    109       $Output .= $Page->Show();
     110      $Output .= $Page->Import($DbRow['Id']);
    110111    }
    111112    return($Output);
Note: See TracChangeset for help on using the changeset viewer.