Revize 687
Přidáno uživatelem Jiří Sviták před asi 14 roky(ů)
freenetis/trunk/kohana/application/i18n/cs_CZ/texts.php | ||
---|---|---|
'description' => 'Popis',
|
||
'destination' => 'Destinace',
|
||
'destination account' => 'Cílový účet',
|
||
'destination account (account name, account id)' => 'Cílový účet (název účtu, ID účtu)',
|
||
'destination bank account' => 'Cílový bankovní účet',
|
||
'destination credit account' => 'Cílový kreditní účet',
|
||
'destination language' => 'Cílový jazyk',
|
||
... | ... | |
'organization identifier' => 'IČ',
|
||
'organization_identifier' => 'IČ',
|
||
'origin account' => 'Zdrojový účet',
|
||
'origin account (account name, account id)' => 'Zdrojový účet (název účtu, ID účtu)',
|
||
'origin bank account' => 'Zdrojový bankovní účet',
|
||
'original term' => 'Původní výraz',
|
||
'originating call' => 'Odchozí volání',
|
freenetis/trunk/kohana/application/controllers/transfers.php | ||
---|---|---|
'filter' => $filter->view
|
||
));
|
||
if ($this->acl_check_edit('Accounts_Controller', 'transfers')) {
|
||
$grid->add_new_button(url_lang::base().'transfers/add', url_lang::lang('texts.Add'));
|
||
$grid->add_new_button(url_lang::base().'transfers/add', url_lang::lang('texts.Add new transfer'));
|
||
$grid->add_new_button(url_lang::base().'transfers/deduct_fees', url_lang::lang('texts.Deduction of member fees'));
|
||
$grid->add_new_button(url_lang::base().'transfers/deduct_entrance_fees', url_lang::lang('texts.Deduction of entrance fees'), array('onclick' => 'return potvrd(\''.url_lang::lang('texts.Are you sure you want to deduct all entrance fees').'\')'));
|
||
}
|
||
... | ... | |
$view->render(TRUE);
|
||
}
|
||
|
||
function add_from_account($origin_account)
|
||
/**
|
||
* Adds transfers from single origin account.
|
||
* @todo set of accounts choosen by account_attribute_id, must be done by ajax
|
||
* @author Jiri Svitak
|
||
* @param $origin_account_id
|
||
* @return unknown_type
|
||
*/
|
||
function add_from_account($origin_account_id = null)
|
||
{
|
||
echo $origin_account;
|
||
if (!isset($origin_account_id) || !is_numeric($origin_account_id))
|
||
Controller::warning(PARAMETER);
|
||
// save for callback function valid_amount_to_send
|
||
$this->origin = $origin_account_id;
|
||
$origin_account = new Account_Model($origin_account_id);
|
||
if ($origin_account->id == 0)
|
||
Controller::error(RECORD);
|
||
if (!$this->acl_check_new('Accounts_Controller', 'transfers', $origin_account->member_id))
|
||
Controller::error(ACCESS);
|
||
// destination account, instead of origin one
|
||
$dst_account_model = new Account_Model();
|
||
$dst_accounts = $dst_account_model->get_some_doubleentry_account_names($origin_account_id);
|
||
foreach ($dst_accounts as $dst_account)
|
||
{ // convert the object into array (used for HTML select list)
|
||
$arr_dst_accounts[$dst_account->id] = $dst_account->name.' '.$dst_account->id.' ('.$dst_account->addr.')';
|
||
//"$dst_account->name, $dst_account->addr - ".url_lang::lang('texts.Account ID')." $dst_account->id - "
|
||
//.url_lang::lang('texts.Member ID')." $dst_account->member_id - "
|
||
//.url_lang::lang('texts.Account type'). " $dst_account->account_attribute_id";
|
||
}
|
||
// default destination account
|
||
$operating = ORM::factory('account')->where('account_attribute_id', Account_attribute_Model::$operating)->find();
|
||
// array with only one origin account
|
||
$arr_orig_accounts[$origin_account->id] = $origin_account->name.' '.$origin_account->id;
|
||
// account attributes for types of accounts
|
||
$aa_model = new Account_attribute_Model();
|
||
$account_attributes = $aa_model->get_account_attributes();
|
||
foreach($account_attributes as $account_attribute)
|
||
{
|
||
$arr_attributes[$account_attribute->id] = $account_attribute->id.' '.$account_attribute->name;
|
||
}
|
||
// form
|
||
$form = new Forge(url_lang::base().'transfers/add_from_account/'.$origin_account_id, '', 'POST', array('id' => 'article_form'));
|
||
$form->set_attr('class', 'form_class')->set_attr('method', 'post');
|
||
// origin account
|
||
$form->group('')->label(url_lang::lang('texts.Origin account'));
|
||
//$form->dropdown('')->label(url_lang::lang('texts.Account type').':')->options($arr_attributes);
|
||
$form->dropdown('oname')->label(url_lang::lang('texts.Origin account (account name, account ID)').':')->options($arr_orig_accounts)->rules('required');
|
||
// destination account
|
||
$form->group('')->label(url_lang::lang('texts.Destination account'));
|
||
//$form->dropdown('')->label(url_lang::lang('texts.Account type').':')->options($arr_attributes);
|
||
$form->dropdown('aname')->label(url_lang::lang('texts.Destination account (account name, account ID)').':')->options($arr_dst_accounts)->rules('required')->selected($operating->id);
|
||
// other information
|
||
$form->group('')->label(url_lang::lang('texts.Transfer'));
|
||
$form->date('datetime')->label(url_lang::lang('texts.Date and time').':')->years(date('Y')-20, date('Y'))->rules('required');
|
||
$form->input('amount')->label(url_lang::lang('texts.Amount').':')->rules('required|valid_numeric')->callback(array($this, 'valid_amount_to_send'));
|
||
$form->input('text')->label(url_lang::lang('texts.Text').':')->rules('required');
|
||
$form->submit('submit')->value(url_lang::lang('texts.Send'));
|
||
special::required_forge_style($form, ' *', 'required');
|
||
if ($form->validate())
|
||
{
|
||
$form_data = $form->as_array();
|
||
foreach($form_data as $key => $value)
|
||
{
|
||
$form_data[$key] = htmlspecialchars($value);
|
||
}
|
||
$transfer = new Transfer_Model();
|
||
$transfer->origin_id = $form_data['oname'];
|
||
$transfer->destination_id = $form_data['aname'];
|
||
$transfer->user_id = $this->session->get('user_id');
|
||
$transfer->datetime = date('Y-m-d', $form_data['datetime']);
|
||
$transfer->creation_datetime = date('Y-m-d H:i:s');
|
||
$transfer->text = $form_data['text'];
|
||
$transfer->amount = $form_data['amount'];
|
||
if ($transfer->save())
|
||
{
|
||
$this->session->set_flash('message', url_lang::lang('texts.Transfer has been successfully added'));
|
||
url::redirect(url_lang::base().'transfers/show_by_account/'.$origin_account_id);
|
||
}
|
||
}
|
||
|
||
//if ($this->acl_check_view('Members_Controller','members', $origin_account->member_id))
|
||
// $links[] = html::anchor(url_lang::base().'members/show/'.$origin_account->member_id, url_lang::lang('texts.Back to the member'));
|
||
|
||
$links[] = html::anchor(url_lang::base().'transfers/show_by_account/'.$origin_account_id, url_lang::lang('texts.Back to account transfers'));
|
||
|
||
$headline = url_lang::lang('texts.Add new transfer');
|
||
$view = new View('main');
|
||
$view->title = $headline;
|
||
$view->content = new View('form');
|
||
$view->content->headline = $headline;
|
||
$view->content->form = $form->html();
|
||
$view->content->link_back = implode (' | ', $links);
|
||
$view->render(TRUE);
|
||
}
|
||
|
||
/**
|
||
* Function adds transfers. Transfer can be send only.
|
||
* Function adds transfers from one arbitrary account to another arbitrary account.
|
||
* @todo set of accounts choosen by account_attribute_id, must be done by ajax
|
||
* @author Jiri Svitak, Tomas Dulik
|
||
* @param $origin_account
|
||
* @return unknown_type
|
||
*/
|
||
function add()
|
||
{
|
||
echo 'zkus to priste';
|
||
die();
|
||
// transfer from specific account ?
|
||
if (isset($origin_account_id))
|
||
{
|
||
// save for callback function valid_amount_to_send
|
||
$this->origin = $origin_account_id;
|
||
$origin_account = new Account_Model($origin_account_id);
|
||
if ($origin_account->id == 0)
|
||
Controller::error(RECORD);
|
||
if (!$this->acl_check_new('Accounts_Controller', 'transfers', $origin_account->member_id))
|
||
Controller::error(ACCESS);
|
||
// destination account, instead of origin one
|
||
$dst_account_model = new Account_Model();
|
||
$dst_accounts = $dst_account_model->get_some_doubleentry_account_names($origin_account_id);
|
||
}
|
||
else
|
||
// transfer from arbitrary account to arbitrary account
|
||
{
|
||
if (!$this->acl_check_new('Accounts_Controller', 'transfers'))
|
||
Controller::error(ACCESS);
|
||
$account_model = new Account_Model();
|
||
$accounts = $account_model->get_some_doubleentry_account_names();
|
||
$origin_accounts = $accounts;
|
||
$dst_accounts = $accounts;
|
||
if (!$this->acl_check_new('Accounts_Controller', 'transfers'))
|
||
Controller::error(ACCESS);
|
||
$account_model = new Account_Model();
|
||
$accounts = $account_model->get_some_doubleentry_account_names();
|
||
$origin_accounts = $accounts;
|
||
$dst_accounts = $accounts;
|
||
|
||
}
|
||
|
||
foreach ($dst_accounts as $dst_account)
|
||
{ // convert the object into array (used for HTML select list)
|
||
$arr_dst_accounts[$dst_account->id] = $dst_account->id.' '.$dst_account->name.', '.$dst_account->addr;
|
||
$arr_dst_accounts[$dst_account->id] = $dst_account->name.' '.$dst_account->id.' ('.$dst_account->addr.')';
|
||
//"$dst_account->name, $dst_account->addr - ".url_lang::lang('texts.Account ID')." $dst_account->id - "
|
||
//.url_lang::lang('texts.Member ID')." $dst_account->member_id - "
|
||
//.url_lang::lang('texts.Account type'). " $dst_account->account_attribute_id";
|
||
}
|
||
asort($arr_dst_accounts);
|
||
|
||
|
||
if (isset($origin_account_id))
|
||
{
|
||
$arr_orig_accounts[$origin_account->id] = $origin_account->id.' '.$origin_account->name;
|
||
//"$origin_account->name - ".url_lang::lang('texts.Account ID')." $origin_account->name - "
|
||
//.url_lang::lang('texts.Member ID')." $origin_account->member_id";
|
||
}
|
||
else
|
||
{
|
||
// array for dropdown
|
||
$arr_orig_accounts = $arr_dst_accounts;
|
||
}
|
||
|
||
// array origin accounts for dropdown
|
||
$arr_orig_accounts = $arr_dst_accounts;
|
||
// default destination account
|
||
$operating = ORM::factory('account')->where('account_attribute_id', Account_attribute_Model::$operating)->find();
|
||
|
||
// account attributes for types of accounts
|
||
$aa_model = new Account_attribute_Model();
|
||
$account_attributes = $aa_model->get_account_attributes();
|
||
foreach($account_attributes as $account_attribute)
|
||
{
|
||
$arr_attributes[$account_attribute->id] = $account_attribute->id.' '.$account_attribute->name;
|
||
$arr_attributes[$account_attribute->id] = $dst_account->name.' '.$dst_account->id;
|
||
}
|
||
|
||
// form
|
||
$form = new Forge(url_lang::base().'transfers/add/'.$origin_account_id, '', 'POST', array('id' => 'article_form'));
|
||
$form = new Forge(url_lang::base().'transfers/add', '', 'POST', array('id' => 'article_form'));
|
||
$form->set_attr('class', 'form_class')->set_attr('method', 'post');
|
||
// origin account
|
||
$form->group('')->label(url_lang::lang('texts.Origin account'));
|
||
$form->dropdown('')->label(url_lang::lang('texts.Account type').':')->options($arr_attributes);
|
||
$form->dropdown('oname')->label(url_lang::lang('texts.Origin account').':')->options($arr_orig_accounts);
|
||
//$form->dropdown('')->label(url_lang::lang('texts.Account type').':')->options($arr_attributes);
|
||
$form->dropdown('oname')->label(url_lang::lang('texts.Origin account (account name, account ID)').':')->options($arr_orig_accounts)->rules('required');
|
||
// destination account
|
||
$form->group('')->label(url_lang::lang('texts.Destination account'));
|
||
$form->dropdown('')->label(url_lang::lang('texts.Account type').':')->options($arr_attributes);
|
||
$form->dropdown('aname')->label(url_lang::lang('texts.Destination account').':')->options($arr_dst_accounts)->rules('required')->selected($operating->id);
|
||
//$form->dropdown('')->label(url_lang::lang('texts.Account type').':')->options($arr_attributes);
|
||
$form->dropdown('aname')->label(url_lang::lang('texts.Destination account (account name, account ID)').':')->options($arr_dst_accounts)->rules('required')->selected($operating->id);
|
||
// other information
|
||
$form->group('')->label(url_lang::lang('texts.Transfer'));
|
||
$form->date('datetime')->label(url_lang::lang('texts.Date and time').':')->years(date('Y')-20, date('Y'))->rules('required');
|
||
$form->input('amount')->label(url_lang::lang('texts.Amount').':')->rules('required|valid_numeric')->callback(array($this, 'valid_amount_to_send'));
|
||
// no amount on origin account is required, this arbitrary transfers should only admin or accountant of association who knows what is he doing
|
||
$form->input('amount')->label(url_lang::lang('texts.Amount').':')->rules('required|valid_numeric')->callback(array($this, 'valid_amount'));//->callback(array($this, 'valid_amount_to_send'));
|
||
$form->input('text')->label(url_lang::lang('texts.Text').':')->rules('required');
|
||
$form->submit('submit')->value(url_lang::lang('texts.Send'));
|
||
special::required_forge_style($form, ' *', 'required');
|
||
... | ... | |
if ($this->acl_check_view('Members_Controller','members', $origin_account->member_id))
|
||
$links[] = html::anchor(url_lang::base().'members/show/'.$origin_account->member_id, url_lang::lang('texts.Back to the member'));
|
||
*/
|
||
//$links[] = html::anchor(url_lang::base().'transfers/show_by_account/'.$origin_account_id, url_lang::lang('texts.Back to transfers of account'));
|
||
$links[] = html::anchor(url_lang::base().'transfers/show_all', url_lang::lang('texts.Back to day book'));
|
||
|
||
$headline = url_lang::lang('texts.Add new transfer');
|
||
$view = new View('main');
|
Také k dispozici: Unified diff
Pridavani financnich prevodu opet funguje, castecne predelano, je potreba dodelat vyber typu uctu pomoci ajaxu.