Changeset 536 for trunk/Modules/FinanceBankAPI
- Timestamp:
- May 18, 2013, 6:51:10 PM (12 years ago)
- Location:
- trunk/Modules/FinanceBankAPI
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/FinanceBankAPI/FileImport.php
r524 r536 26 26 var $FullTitle = 'Import plateb přes API'; 27 27 var $ShortTitle = 'Import plateb přes API'; 28 var $ParentClass = 'PageFinance'; 28 29 29 30 function Show() 30 31 { 32 $Output = ''; 31 33 if(!$this->System->User->CheckPermission('Finance', 'SubjectList')) return('Nemáte oprávnění'); 32 34 33 $DbResult = $this->Database->select('FinanceBankAccount', '*', 'Id='.$_GET['i d']);35 $DbResult = $this->Database->select('FinanceBankAccount', '*', 'Id='.$_GET['i']); 34 36 $BankAccount = $DbResult->fetch_assoc(); 35 37 … … 41 43 else if($Bank['Code'] == '0300') $Import = new ImportPS($this->Database); 42 44 else $Output = $this->SystemMessage('Nepodporované API', 'Pro zvolenou banku není import podporován'); 43 $Import->BankAccountId = $BankAccount['Id']; 44 $Output .= $Import->Import(); 45 45 if(isset($Import)) 46 { 47 $Import->BankAccountId = $BankAccount['Id']; 48 $Output .= $Import->Import(); 49 } 46 50 return($Output); 47 51 } … … 52 56 var $FullTitle = 'Import plateb ze souboru'; 53 57 var $ShortTitle = 'Import plateb ze souboru'; 54 58 var $ParentClass = 'PageFinance'; 59 55 60 function Show() 56 61 { -
trunk/Modules/FinanceBankAPI/FioAPI.php
r500 r536 20 20 21 21 // URL format: https://www.fio.cz/ib_api/rest/periods/{token}/{datum od}/{datum do}/transactions.{format} 22 echo('1'); 22 23 $fp = fsockopen('ssl://www.fio.cz', 443, $errno, $errstr, 30); 24 echo('2'); 23 25 if(!$fp) 24 26 { … … 37 39 38 40 // Read response 41 echo('3'); 39 42 $Response = array(); 40 43 while(!feof($fp)) 41 44 $Response .= trim(fgets($fp, 1024))."\n"; 42 45 fclose($fp); 46 echo('4'); 43 47 $Response = iconv('windows-1250', $this->Encoding, $Response); 44 48 $Response = explode("\n", $Response); … … 54 58 foreach($Response as $Index => $Line) 55 59 { 56 60 if(($Index == 0) and (substr($Line, 0, strlen(GPC_TYPE_REPORT)) != GPC_TYPE_REPORT)) $this->NoValidDataError($Response); 57 61 $GPCLine = $GPC->ParseLine($Line); 58 62 if($GPCLine != NULL) $Result[] = $GPCLine; … … 66 70 // Try to get error message 67 71 // If something go wrong fio show HTML login page and display error message 68 72 $Response = implode('', $Response); 69 73 $ErrorMessageStart = '<div id="oldform_warning">'; 70 74 if(strpos($Response, $ErrorMessageStart) !== false) 71 72 73 74 75 75 { 76 $Response = substr($Response, strpos($Response, $ErrorMessageStart) + strlen($ErrorMessageStart)); 77 $ErrorMessage = trim(substr($Response, 0, strpos($Response, '</div>'))); 78 } else $ErrorMessage = ''; 79 throw new Exception('No valid GPC data: '.$ErrorMessage); 76 80 } 77 81 }
Note:
See TracChangeset
for help on using the changeset viewer.