Revize 262
Přidáno uživatelem Tomáš Dulík před více než 15 roky(ů)
freenetis/trunk/kohana/application/controllers/accounts.php | ||
---|---|---|
protected $editation = FALSE;
|
||
protected $acc_id = NULL;
|
||
protected $sel_member;
|
||
/**
|
||
* @var object parsed_account obsahuje data o parsovaném účtu (z tabulky accounts)
|
||
* Používá se v callback funkci store_transfer
|
||
*/
|
||
protected $parsed_account = NULL;
|
||
/**
|
||
* @var object $parsed_bank_account obsahuje data o parsovaném bank. účtu (z tabluky bank_accounts)
|
||
* Používá se v callback funkci store_transfer
|
||
*/
|
||
protected $parsed_bank_account = NULL;
|
||
|
||
//const acc_nr="184932848";
|
||
//const acc_url="http://www.rb.cz/firemni-finance/transparentni-ucty/?root=firemni-finance&item1=transparentni-ucty&tr_acc=vypis&account_number=";
|
||
... | ... | |
*/
|
||
|
||
// init the parsed_account instance by looking it in database
|
||
if (!isset($this->parsed_account)) // tato promenna bude nastavena pouze pokud se parsuje ucet zvoleny v gridu uzivatelem
|
||
|
||
if (!isset($this->parsed_account)) { // tato promenna bude nastavena pouze pokud se parsuje ucet zvoleny v gridu uzivatelem
|
||
if (isset($data->parsed_account_nr) && isset($data->parsed_account_bank_nr)) {
|
||
// jinak parsovany ucet dopredu nezname, muze byt ale v parsovanem vypisu (pokud neni transparentni)
|
||
$acc_model=$this->parsed_account=new Account_Model();
|
||
$bank_acc_model=new Bank_account_Model();
|
||
|
||
$parsed_bank_acc=$bank_acc_model->find_by_account_nr_and_bank_nr($data->parsed_account_nr, $data->parsed_account_bank_nr);
|
||
$id=$parsed_acc->id;
|
||
if (!$parsed_acc->id) { // parsovany ucet neexistuje?
|
||
// tak si ho vytvorime
|
||
$acc_model->name="Účet $data->parsed_account_nr/$data->parsed_account_bank_nr";
|
||
$acc_model->member_id=1;
|
||
$enum_type=new Enum_type_Model();
|
||
$enum_type_bank=$enum_type->find_by_value("bank");
|
||
$acc_model->type_id=$enum_type_bank->id;
|
||
$acc_model->save();
|
||
$acc_model=$this->parsed_account=new Account_Model();
|
||
$bank_acc_model=new Bank_account_Model();
|
||
|
||
$bank_acc_model->account_id=$acc_model->id;
|
||
$bank_acc_model->account_nr=$data->parsed_account_nr;
|
||
$bank_acc_model->bank_nr=$data->parsed_account_bank_nr;
|
||
$bank_acc_model->save();
|
||
$bank_acc_model=$bank_acc_model->find_by_account_nr_and_bank_nr($data->parsed_account_nr, $data->parsed_account_bank_nr);
|
||
if (!$bank_acc_model->id) { // parsovany ucet neexistuje?
|
||
// tak si ho vytvorime
|
||
$acc_model->name="Účet $data->parsed_account_nr/$data->parsed_account_bank_nr";
|
||
$acc_model->member_id=1;
|
||
$enum_type=new Enum_type_Model();
|
||
$enum_type_bank=$enum_type->find_by_value("bank");
|
||
$acc_model->type_id=$enum_type_bank->id;
|
||
$acc_model->save();
|
||
$this->parsed_account=$acc_model;
|
||
|
||
$bank_acc_model->account_id=$acc_model->id;
|
||
$bank_acc_model->account_nr=$data->parsed_account_nr;
|
||
$bank_acc_model->bank_nr=$data->parsed_account_bank_nr;
|
||
$bank_acc_model->save();
|
||
}
|
||
} else { // if (isset($data->parsed_account_nr) && isset($data->parsed_account_bank_nr
|
||
$this->session->set_flash('message', url_lang::lang('texts.The parsed account is unknown.'));
|
||
return;
|
||
}
|
||
|
||
} else { // if (!isset($this->parsed_account)...
|
||
}
|
||
|
||
} else { // if (!isset($this->parsed_account)... = parsovany ucet uz zname
|
||
$acc_model=$this->parsed_account;
|
||
$bank_acc_model=$acc_model->bank;
|
||
}
|
||
// init the source and destination members and account to "unknown" (objects with empty values)
|
||
|
||
$dst_member=$src_member=new Member_Model();
|
||
... | ... | |
* @param $account_id - ID of the account whose data will be parsed.
|
||
* @return void
|
||
*/
|
||
public function parse_ebank_account($url="", $account_id=NULL) {
|
||
if (isset($account_id)) $this->parsed_account=new Account_Model($account_id);
|
||
public function parse_ebank_account($account_id=NULL, $url="") {
|
||
|
||
$parser=new Parser_Ebanka();
|
||
|
||
... | ... | |
echo"parse - start: ".($start=microtime(true))."<p>\n";
|
||
|
||
//$parser->set_callback(array($this, "print_row"));
|
||
$parser->set_callback(array($this, "store_transfer"));
|
||
$parser->set_callback(array($this, "store_transfer"));
|
||
// pokud z gridu dostáváme $account_id, pak si ho uložíme pro potřeby callback funkce
|
||
if (isset($account_id)) $this->parsed_account=new Account_Model($account_id);
|
||
|
||
//print_r ($parser);
|
||
echo "<table border=1>\n";
|
||
|
Také k dispozici: Unified diff
Pridana promenna parsed_bank_account