Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 259

Přidáno uživatelem Tomáš Dulík před více než 15 roky(ů)

Rozdelana prace v store_transfer

Zobrazit rozdíly:

freenetis/trunk/kohana/application/controllers/accounts.php
public $linenr=0;
public function store_transfer($data) {
public function store_transfer_ebanka($data) {
/**
* [parsed_account_nr] => 184932848
* [parsed_account_bank_nr]=> 2400
......
*/
// init the parsed_account instance by looking it in database
if (!isset($this->parsed_account)) {
$parsed_acc=$this->parsed_account=new Account_Model();
$bank_acc=new Bank_account_Model();
$bank_acc->find_by_account_nr_and_bank_nr($data->parsed_account_nr,$data->parsed_account_bank_nr);
if (empty($bank_acc->id)) // the parsed account not found in database
die("Nemohu uložit data, účet, který parsuji, nemám v databázi. Končím!\n");
else $parsed_acc=$bank_acc->account;
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();
$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($this->parsed_account)...
}
// init the source and destination members and account to "unknown" (objects with empty values)
$dst_member=$src_member=new Member_Model();

Také k dispozici: Unified diff