Revize 468
Přidáno uživatelem Jiří Sviták před asi 15 roky(ů)
freenetis/trunk/kohana/media/css/forms.css | ||
---|---|---|
}
|
||
.submit {
|
||
width:100px;
|
||
margin-top:0px;
|
||
background-color:#ffffff;
|
||
font-weight:bold;
|
||
padding:0px;
|
||
}
|
||
|
||
.form .submit {
|
||
width:100px;
|
||
margin-top:10px;
|
||
background-color:#ffffff;
|
||
font-weight:bold;
|
||
padding:2px;
|
||
|
||
}
|
||
|
||
.required {
|
freenetis/trunk/kohana/application/i18n/cs_CZ/texts.php | ||
---|---|---|
'add' => 'Přidat',
|
||
'add member fee payment by cash' => 'Přidat platbu členského příspěvku hotově',
|
||
'add new account' => 'Přidat nový účet',
|
||
'add new bank account' => 'Přidat nový bankovní účet',
|
||
'add new bank account of association' => 'Přidat nový bankovní účet sdružení',
|
||
'add new bank transfer' => 'Přidat novou bankovní platbu',
|
||
'add new contact' => 'Přidat nový kontakt',
|
freenetis/trunk/kohana/application/controllers/transfers.php | ||
---|---|---|
$transfer = new Transfer_Model();
|
||
$transfer->origin_id = $origin_account;
|
||
$transfer->destination_id = $form_data['aname'];
|
||
$transfer->user_id = $this->session->get('user_id');
|
||
$transfer->datetime = $form_data['datetime'];
|
||
$transfer->creation_datetime = date('Y-m-d H:i:s', time());
|
||
$transfer->text = $form_data['text'];
|
||
... | ... | |
$transfer1 = new Transfer_Model();
|
||
$transfer1->origin_id = $member_fees->id;
|
||
$transfer1->destination_id = $cash->id;
|
||
$transfer1->user_id = $this->session->get('user_id');
|
||
$transfer1->datetime = date('Y-m-d', $form_data['datetime']);
|
||
$transfer1->creation_datetime = date('Y-m-d H:i:s', time());
|
||
$transfer1->text = $form_data['text'];
|
||
... | ... | |
$transfer2 = new Transfer_Model();
|
||
$transfer2->origin_id = $operating->id;
|
||
$transfer2->destination_id = $credit->id;
|
||
$transfer2->user_id = $this->session->get('user_id');
|
||
$transfer2->datetime = date('Y-m-d', $form_data['datetime']);
|
||
$transfer2->creation_datetime = date('Y-m-d H:i:s', time());
|
||
$transfer2->text = $form_data['text'];
|
freenetis/trunk/kohana/application/controllers/redirect.php | ||
---|---|---|
$gateway_ip = implode('.',$arr_ip);
|
||
$ip_address_model = new Ip_address_Model();
|
||
$ap = $ip_address_model->where('ip_address',$gateway_ip)->find();
|
||
// admin of access point
|
||
// admin of access point - only if ap exists
|
||
if ($ap->id != 0)
|
||
{
|
||
// if ap has interface
|
||
$iface = new Iface_Model($ap->iface_id);
|
||
if ($iface->id != 0)
|
||
{
|
freenetis/trunk/kohana/application/controllers/bank_transfers.php | ||
---|---|---|
* @param $account_id
|
||
* @return unknown_type
|
||
*/
|
||
function show_by_bank_account($bank_account_id = NULL, $limit_results = 500, $order_by = 'datetime', $order_by_direction = 'desc', $page_word = null, $page = 1)
|
||
function show_by_bank_account($bank_account_id = NULL, $limit_results = 500, $order_by = 'id', $order_by_direction = 'desc', $page_word = null, $page = 1)
|
||
{
|
||
if (!isset($bank_account_id))
|
||
Controller::warning(PARAMETER);
|
||
... | ... | |
$limit_results = (int) $this->input->get('record_per_page');
|
||
$allowed_order_type = array('id', 'name', 'amount', 'datetime', 'trans_type', 'account_number', 'variable_symbol');
|
||
if (!in_array(strtolower($order_by), $allowed_order_type))
|
||
$order_by = 'datetime';
|
||
$order_by = 'id';
|
||
if (strtolower($order_by_direction) != 'asc' && strtolower($order_by_direction) != 'desc')
|
||
$order_by_direction = 'desc';
|
||
|
||
$transfer_model = new Bank_transfer_Model();
|
||
$total_transfers = $transfer_model->count_bank_transfers($bank_account_id);
|
||
if (($sql_offset = ($page - 1) * $limit_results) > $total_transfers)
|
||
$bt_model = new Bank_transfer_Model();
|
||
$total_bank_transfers = $bt_model->count_bank_transfers($bank_account_id);
|
||
if (($sql_offset = ($page - 1) * $limit_results) > $total_bank_transfers)
|
||
$sql_offset = 0;
|
||
$transfers = $transfer_model->get_bank_transfers($bank_account_id, $sql_offset, (int)$limit_results, $order_by, $order_by_direction);
|
||
$bts = $bt_model->get_bank_transfers($bank_account_id, $sql_offset, (int)$limit_results, $order_by, $order_by_direction);
|
||
|
||
$headline = url_lang::lang('texts.Transfers of bank account');
|
||
$grid = new Grid(url_lang::base().'transfers', null, array(
|
||
... | ... | |
'selector_max_multiplier' => 10,
|
||
'base_url' => Config::item('locale.lang').'/bank_transfers/show_by_bank_account/'.$bank_account_id.'/'.$limit_results.'/'.$order_by.'/'.$order_by_direction ,
|
||
'uri_segment' => 'page', // pass a string as uri_segment to trigger former 'label' functionality
|
||
'total_items' => $total_transfers, // use db count query here of course
|
||
'total_items' => $total_bank_transfers, // use db count query here of course
|
||
'items_per_page' => $limit_results, // it may be handy to set defaults for stuff like this in config/pagination.php
|
||
'style' => 'classic',
|
||
'order_by' => $order_by,
|
||
... | ... | |
$grid->order_field('text')->label(url_lang::lang('texts.Text'));
|
||
$grid->order_field('variable_symbol')->label(url_lang::lang('texts.VS'));
|
||
$grid->order_field('amount')->label(url_lang::lang('texts.Amount'));
|
||
$grid->datasource($transfers);
|
||
$grid->datasource($bts);
|
||
|
||
$view = new View('main');
|
||
$view->title = $headline;
|
||
... | ... | |
$arr_gets[] = $key.'='.$value;
|
||
$query_string = '?'.implode('&',$arr_gets);
|
||
// bank transfer model
|
||
$mt_model = new Bank_transfer_Model();
|
||
$total_transfers = $mt_model->count_unidentified_transfers($filter->values());
|
||
$bt_model = new Bank_transfer_Model();
|
||
$total_transfers = $bt_model->count_unidentified_transfers($filter->values());
|
||
if (($sql_offset = ($page - 1) * $limit_results) > $total_transfers)
|
||
$sql_offset = 0;
|
||
$transfers = $mt_model->get_unidentified_transfers($sql_offset, (int)$limit_results, $order_by, $order_by_direction, $filter->values());
|
||
$bank_transfers = $bt_model->get_unidentified_transfers($sql_offset, (int)$limit_results, $order_by, $order_by_direction, $filter->values());
|
||
$headline = url_lang::lang('texts.Unidentified transfers');
|
||
$grid = new Grid(url_lang::base().'transfers', null, array(
|
||
//'separator' => '<br />',
|
||
... | ... | |
'url_array_ofset' => 0,
|
||
'filter' => $filter->view
|
||
));
|
||
|
||
$grid->order_field('id')->label('ID');
|
||
$grid->order_field('datetime')->label(url_lang::lang('texts.Date and time'));
|
||
$grid->order_field('account_nr')->label(url_lang::lang('texts.Account number'));
|
||
... | ... | |
$grid->order_field('text')->label(url_lang::lang('texts.Text'));
|
||
$grid->order_field('variable_symbol')->label(url_lang::lang('texts.Variable symbol'));
|
||
$grid->order_field('amount')->label(url_lang::lang('texts.Amount'));
|
||
|
||
$grid->action_field('id') ->label(url_lang::lang('texts.Payment'))->url(url_lang::base().'bank_transfers/assign_transfer')->action(url_lang::lang('texts.Assign'));
|
||
$grid->datasource($transfers);
|
||
$grid->datasource($bank_transfers);
|
||
|
||
$view = new View('main');
|
||
$view->title = $headline;
|
||
... | ... | |
$form->input('text')->label(url_lang::lang('texts.Text'))->rules('required');
|
||
// bank transfer
|
||
$form->group('')->label(url_lang::lang('texts.Bank transfer'));
|
||
$form->dropdown('destination')->label(url_lang::lang('texts.Counter-account').':')->options($arr_bas)->rules('required');
|
||
$form->input('variable_symbol')->label(url_lang::lang('texts.Variable symbol'.':'));
|
||
$form->input('constant_symbol')->label(url_lang::lang('texts.Constant symbol'.':'));
|
||
$form->input('specific_symbol')->label(url_lang::lang('texts.Specific symbol'.':'));
|
||
$form->input('comment')->label(url_lang::lang('texts.Comment').':');
|
||
$form->dropdown('counteraccount')->label(url_lang::lang('texts.Counteraccount').':')->options($arr_bas)->rules('required');
|
||
$form->input('variable_symbol')->label(url_lang::lang('texts.Variable symbol').':');
|
||
$form->input('constant_symbol')->label(url_lang::lang('texts.Constant symbol').':');
|
||
$form->input('specific_symbol')->label(url_lang::lang('texts.Specific symbol').':');
|
||
// bank transfer fee
|
||
$form->group('')->label(url_lang::lang('texts.Bank transfer fee'));
|
||
$form->input('bank_transfer_fee')->label(url_lang::lang('texts.Amount').':')->value(0);
|
||
$form->input('fee_text')->label(url_lang::lang('texts.Text').':')->value(url_lang::lang('texts.Bank transfer fee'));
|
||
// comment is needless
|
||
//$form->input('comment')->label(url_lang::lang('texts.Comment').':');
|
||
// submit
|
||
$form->submit('submit')->value(url_lang::lang('texts.Add'));
|
||
special::required_forge_style($form, ' *', 'required');
|
||
... | ... | |
switch ($form_data['type'])
|
||
{
|
||
case self::$member_fee:
|
||
// origin bank account
|
||
$origin_ba = new Bank_account_Model($form_data['counteraccount']);
|
||
// origin account
|
||
$origin_account = ORM::factory('account')->
|
||
find_by_account_attribute_id(Account_attribute_Model::$member_fees);
|
||
$dba = new Bank_account_Model($form_data['destination']);
|
||
$destination_account = $dba->get_related_account_by_attribute_id(
|
||
// destination bank account
|
||
$destination_ba = new Bank_account_Model($baa_id);
|
||
// destination account
|
||
$destination_account = $destination_ba->get_related_account_by_attribute_id(
|
||
Account_attribute_Model::$bank);
|
||
// destination bank fees account
|
||
$destination_bank_fees = $destination_ba->get_related_account_by_attribute_id(
|
||
Account_attribute_Model::$bank_fees);
|
||
// origin bank fees account
|
||
$origin_bank_fees = $destination_account;
|
||
break;
|
||
}
|
||
// double-entry transfer
|
||
$transfer = new Transfer_Model();
|
||
$transfer->origin_id = $origin_account->id;
|
||
$transfer->destination_id = $destination_account->id;
|
||
$transfer->user_id = $this->session->get('user_id');
|
||
$transfer->origin_id = $origin_account;
|
||
$transfer->destination_id = $destination_account;
|
||
$transfer->datetime = $form_data['datetime'];
|
||
$transfer->datetime = date('Y-m-d', $form_data['datetime']);
|
||
$transfer->creation_datetime = $time_now;
|
||
$transfer->text = $form_data['text'];
|
||
$transfer->amount = $form_data['amount'];
|
||
... | ... | |
// bank transfer
|
||
$bt = new Bank_transfer_Model();
|
||
$bt->transfer_id = $transfer->id;
|
||
$bt->origin_id = $baa_id;
|
||
$bt->destination_id = $form_data['destination'];
|
||
$bt->origin_id = $origin_ba->id;
|
||
$bt->destination_id = $destination_ba->id;
|
||
$bt->constant_symbol = $form_data['constant_symbol'];
|
||
$bt->variable_symbol = $form_data['variable_symbol'];
|
||
$bt->specific_symbol = $form_data['specific_symbol'];
|
||
$bank_transfer_saved = $bt->save();
|
||
if ($transfer_saved && $bank_transfer_saved)
|
||
// if bank transfer fee has been set, then it is generated
|
||
$bank_transfer_fee_saved = true;
|
||
if ($form_data['bank_transfer_fee'] > 0)
|
||
{
|
||
// fee transfer
|
||
$ft = new Transfer_Model();
|
||
$ft->origin_id = $origin_bank_fees->id;
|
||
$ft->destination_id = $destination_bank_fees->id;
|
||
$ft->user_id = $this->session->get('user_id');
|
||
$ft->datetime = date('Y-m-d', $form_data['datetime']);
|
||
$ft->creation_datetime = $time_now;
|
||
$ft->text = $form_data['fee_text'];
|
||
$ft->amount = $form_data['bank_transfer_fee'];
|
||
$bank_transfer_fee_saved = $ft->save();
|
||
}
|
||
// everything successful - setting message and redirection
|
||
if ($transfer_saved && $bank_transfer_saved && $bank_transfer_fee_saved)
|
||
{
|
||
$this->session->set_flash('message', url_lang::lang('texts.Bank transfer has been successfully added'));
|
||
url::redirect(url_lang::base().'bank_transfers/show_by_bank_account/'.$baa_id);
|
||
}
|
freenetis/trunk/kohana/application/controllers/bank_accounts.php | ||
---|---|---|
$baa_grid->add_new_button(url_lang::base().'members/show/1', url_lang::lang('texts.Back to profile of association'));
|
||
// adding bank account
|
||
if ($this->acl_check_new('Accounts_Controller', 'bank_accounts'))
|
||
$baa_grid->add_new_button(url_lang::base().'bank_accounts/add', url_lang::lang('texts.Add new bank account of association'));
|
||
$baa_grid->add_new_button(url_lang::base().'bank_accounts/add/1', url_lang::lang('texts.Add new bank account of association'));
|
||
// csv file templates for bank listings
|
||
if ($this->acl_check_view('Accounts_Controller', 'bank_transfers'))
|
||
$baa_grid->add_new_button(url_lang::base().'bank_templates/show_all', url_lang::lang('texts.CSV file templates'));
|
||
... | ... | |
'filter' => $filter->view,
|
||
'query_string' => $query_string
|
||
));
|
||
// adding bank account
|
||
if ($this->acl_check_new('Accounts_Controller', 'bank_accounts'))
|
||
$grid->add_new_button(url_lang::base().'bank_accounts/add', url_lang::lang('texts.Add new bank account'));
|
||
$grid->order_field('id')->label('ID');
|
||
$grid->order_field('baname')->label(url_lang::lang('texts.Account name'));
|
||
$grid->order_field('account_nr')->label(url_lang::lang('texts.Account number'));
|
||
... | ... | |
}
|
||
|
||
/**
|
||
* Function adds bank account of association. Bank accounts of members are added during import.
|
||
* Function adds bank account. If member id 1 is specified, then it is new bank account of association.
|
||
* @return unknown_type
|
||
*/
|
||
function add()
|
||
function add($member_id = null)
|
||
{
|
||
if (!$this->acl_check_new('Accounts_Controller', 'bank_accounts'))
|
||
Controller::error(ACCESS);
|
||
// form
|
||
$form = new Forge(url_lang::base()."bank_accounts/add", '', 'POST', array('id' => 'article_form'));
|
||
$form->set_attr('class', 'form_class')->set_attr('method', 'post');
|
||
// input boxes
|
||
if (!isset($member_id) || $member_id != 1)
|
||
{
|
||
$member_model = new Member_Model();
|
||
$members = $member_model->find_all();
|
||
foreach ($members as $member)
|
||
{
|
||
$arr_members[$member->id] = $member->name;
|
||
}
|
||
asort($arr_members, SORT_LOCALE_STRING);
|
||
$form = new Forge(url_lang::base()."bank_accounts/add/", '', 'POST', array('id' => 'article_form'));
|
||
$form->set_attr('class', 'form_class')->set_attr('method', 'post');
|
||
$form->dropdown('member_id')->label(url_lang::lang('texts.Member name'))->options($arr_members)->selected($this->session->get('member_id'));
|
||
}
|
||
else
|
||
{
|
||
$form = new Forge(url_lang::base()."bank_accounts/add/$member_id", '', 'POST', array('id' => 'article_form'));
|
||
$form->set_attr('class', 'form_class')->set_attr('method', 'post');
|
||
}
|
||
$form->input('account_name')->label(url_lang::lang('texts.Account name'))->rules('required|length[3,50]');
|
||
$form->input('account_comment')->label(url_lang::lang('texts.Comment'));
|
||
$form->input('account_nr')->label(url_lang::lang('texts.Account number'))->rules('required|length[3,50]|valid_numeric');
|
||
... | ... | |
{
|
||
$form_data[$key] = htmlspecialchars($value);
|
||
}
|
||
// determining owner's id
|
||
if (!isset($member_id) || $member_id != 1)
|
||
$member_id = $form_data["member_id"];
|
||
// real bank account
|
||
$bank_account = new Bank_account_Model();
|
||
$bank_account->name = $form_data["account_name"];
|
||
$bank_account->member_id = 1;
|
||
$bank_account->member_id = $member_id;
|
||
$bank_account->account_nr = $form_data["account_nr"];
|
||
$bank_account->bank_nr = $form_data["bank_nr"];
|
||
$bank_account->IBAN = $form_data["IBAN"];
|
||
... | ... | |
// these three double-entry accounts are related to one bank account through relation table
|
||
// double-entry bank account
|
||
$doubleentry_bank_account = new Account_Model();
|
||
$doubleentry_bank_account->member_id = 1;
|
||
$doubleentry_bank_account->member_id = $member_id;
|
||
$doubleentry_bank_account->name = $form_data["account_name"];
|
||
$doubleentry_bank_account->account_attribute_id = Account_attribute_Model::$bank;
|
||
$doubleentry_bank_account->comment = url_lang::lang('texts.Bank accounts');
|
||
... | ... | |
$doubleentry_bank_account->add_bank_account($bank_account);
|
||
// double-entry account of bank fees
|
||
$bank_fees_account = new Account_Model();
|
||
$bank_fees_account->member_id = 1;
|
||
$bank_fees_account->member_id = $member_id;
|
||
$bank_fees_account->name = $form_data["account_name"].' - '.url_lang::lang('texts.Bank fees');
|
||
$bank_fees_account->account_attribute_id = Account_attribute_Model::$bank_fees;
|
||
$bank_fees_account->comment = url_lang::lang('texts.Bank fees');
|
||
... | ... | |
$bank_fees_account->add_bank_account($bank_account);
|
||
// double-entry account of bank interests
|
||
$bank_interests_account = new Account_Model();
|
||
$bank_interests_account->member_id = 1;
|
||
$bank_interests_account->member_id = $member_id;
|
||
$bank_interests_account->name = $form_data["account_name"].' - '.url_lang::lang('texts.Bank interests');
|
||
$bank_interests_account->account_attribute_id = Account_attribute_Model::$bank_interests;
|
||
$bank_interests_account->comment = url_lang::lang('texts.Bank interests');
|
freenetis/trunk/kohana/application/controllers/devices.php | ||
---|---|---|
}
|
||
$view->render(TRUE);
|
||
} // end of function add_whole
|
||
|
||
/**
|
||
* Function adds empty device with empty interface and one ip address. Used only by regular users to
|
||
* unblock redirection by adding this ap address to system.
|
||
* @return unknown_type
|
||
*/
|
||
function add_simple()
|
||
{
|
||
$ip = server::remote_addr();
|
||
$ip_address = ORM::factory('ip_address')->find_by_ip_address($ip);
|
||
// if this ip address exists in the system, then process is stopped
|
||
if ($ip_address->ip_address != 0)
|
||
return;
|
||
$enum_type_model = new Enum_type_Model();
|
||
$device_model = new Device_Model();
|
||
$device_model->user_id = $this->session->get('user_id');
|
||
$device_model->type = $enum_type->get_type_id('pc');
|
||
/**
|
||
* @todo not finished yet
|
||
*/
|
||
}
|
||
|
||
/**
|
||
* Function edits device.
|
Také k dispozici: Unified diff
Nova moznost rucniho pridavani bankovnich uctu, pridano rucni pridavani bankovnich plateb (zatim jen clenskych prispevku).