Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 8ad48b86

Přidáno uživatelem David Raška před asi 9 roky(ů)

Fixes in Tatrabanka importer for working with no counter account in bank statement

Zobrazit rozdíly:

application/libraries/importers/Tatra_Banka_Statement_File_Importer.php
{
$counter_ba->clear();
$counter_ba->set_logger(FALSE);
$counter_ba->name = self::remove_zeros($item['counter_account']).'/'.$item['counter_bank'];
$counter_ba->account_nr = self::remove_zeros($item['counter_account']);
$counter_ba->name = ($item['counter_bank'] == '' ? $item['counter_account'] : self::remove_zeros($item['counter_account']).'/'.$item['counter_bank']);
$counter_ba->account_nr = ($item['counter_bank'] == '' ? $item['counter_account'] : self::remove_zeros($item['counter_account']));
$counter_ba->bank_nr = $item['counter_bank'];
$counter_ba->member_id = NULL;
$counter_ba->save_throwable();
......
*/
protected static function remove_zeros($value)
{
$count = preg_match('@[0-]*(\d+-?\d+)@', $value, $result);
$count = preg_match_all('/[0-]*(\d+-?\d+)/', $value, $result);
return ($count == 1 ? $result[1] : $value);
return ($count == 1 ? $result[1][0] : $value);
}
}
application/libraries/importers/Txt_Tatra_Banka_Statement_File_Importer.php
const REGEX_DATA = "@(\d{1,2}\.\d{1,2}\.\d{4} \d{1,2}:\d{2}).+(\w{2}\d{2}(\d{4})(\d{16})).* (\d+,\d{2}) (.+)\.@";
// Counter account
const REGEX_CA = "@ (\d{4})/([\d-]+)@";
const REGEX_NO_CA = "@Popis transakcie: ()(.*)@";
// Variable, specific, constant symbol
const REGEX_VS = "@VS ?(\d*)@";
const REGEX_SS = "@SS ?(\d*)@";
......
$email,
$data);
preg_match(self::REGEX_CA,
$match_ca = preg_match(self::REGEX_CA,
$email,
$ca);
if ($match_ca == 0)
{
preg_match(self::REGEX_NO_CA,
$email,
$ca);
}
$match_vs = preg_match(self::REGEX_VS,
$email,
$vs);

Také k dispozici: Unified diff