Revize 300
Přidáno uživatelem Jiří Sviták před více než 15 roky(ů)
freenetis/trunk/kohana/application/i18n/cs_CZ/texts.php | ||
---|---|---|
'add new ip address' => 'Přidat novou IP adresu',
|
||
'add new member' => 'Přidat nového člena',
|
||
'add new port' => 'Přidat nový port',
|
||
'add new project account' => 'Přidat nový projektový účet',
|
||
'add new segment' => 'Přidat nový segment',
|
||
'add new subnet' => 'Přidat novu podsíť',
|
||
'add new translation' => 'Přidat nový překlad',
|
||
'add new user' => 'Přidat nového uživatele',
|
||
'add new vlan interface' => 'Přidat nové VLAN rozhraní',
|
||
'add new vlan' => 'Přidat nový VLAN',
|
||
'add new whole device' => 'Přidat nové celé zařízení (router, PC, NB)',
|
||
'add new work' => 'Přidat novou práci',
|
||
'add' => 'Přidat',
|
||
'add whole new device' => 'Přidání celého nového zařízení',
|
||
'additional_contacts_infotext' => 'Další kontaktní informace',
|
||
'address' => 'Adresa',
|
||
'aditional contacts successfully updated' => 'Další kontakty úspěšně uloženy',
|
freenetis/trunk/kohana/application/models/account.php | ||
---|---|---|
* It gets all credit accounts from database including member name and credit.
|
||
* @return unknown_type
|
||
*/
|
||
public function get_credit_accounts($limit_from = 0, $limit_results = 20, $order_by = 'aid', $order_by_direction = 'desc')
|
||
public function get_credit_accounts($limit_from = 0, $limit_results = 20, $order_by = 'id', $order_by_direction = 'asc')
|
||
{
|
||
return self::$db->query('SELECT q3.id, a.name AS aname, a.comment, m.name AS mname, a.member_id,
|
||
return self::$db->query('SELECT a.id, a.name AS aname, a.comment, m.name AS mname, a.member_id,
|
||
q3.credit FROM
|
||
(SELECT id, member_id, (inbound - outbound) AS credit FROM
|
||
(SELECT q1.id, q1.member_id, IFNULL(SUM(amount),0) AS inbound, outbound FROM
|
||
(SELECT a.id, member_id, IFNULL(SUM(amount) , 0 ) AS outbound
|
||
(SELECT q1.id, q1.member_id, IFNULL(SUM(amount), 0) AS inbound, outbound FROM
|
||
(SELECT a.id, member_id, IFNULL(SUM(amount), 0) AS outbound
|
||
FROM accounts a
|
||
LEFT JOIN account_attributes aa ON a.account_attribute_id = aa.id
|
||
LEFT JOIN transfers t ON a.id = t.origin_id
|
||
... | ... | |
LIMIT '.$limit_from.','.$limit_results);
|
||
}
|
||
|
||
public function get_credit_account_names()
|
||
{
|
||
return self::$db->query('SELECT id, name
|
||
FROM accounts a
|
||
WHERE a.account_attribute_id = '.Account_attribute_Model::$credit
|
||
);
|
||
}
|
||
|
||
/**
|
||
* @author Jiri Svitak
|
||
* It gets count of credit accounts.
|
||
... | ... | |
);
|
||
return $count->current()->total;
|
||
}
|
||
|
||
/**
|
||
* @author Jiri Svitak
|
||
* It gets all project accounts from database including member name and credit.
|
||
* @return unknown_type
|
||
*/
|
||
public function get_project_accounts($limit_from = 0, $limit_results = 20, $order_by = 'id', $order_by_direction = 'asc')
|
||
{
|
||
return self::$db->query('SELECT a.id, a.name AS aname, a.comment, m.name AS mname, a.member_id,
|
||
q3.credit FROM
|
||
(SELECT id, member_id, (inbound - outbound) AS credit FROM
|
||
(SELECT q1.id, q1.member_id, IFNULL(SUM(amount), 0) AS inbound, outbound FROM
|
||
(SELECT a.id, member_id, IFNULL(SUM(amount), 0) AS outbound
|
||
FROM accounts a
|
||
LEFT JOIN account_attributes aa ON a.account_attribute_id = aa.id
|
||
LEFT JOIN transfers t ON a.id = t.origin_id
|
||
WHERE aa.id = '.Account_attribute_Model::$project.'
|
||
GROUP BY a.id) AS q1
|
||
LEFT JOIN transfers ON q1.id = transfers.destination_id GROUP BY q1.id) AS q2
|
||
) AS q3
|
||
LEFT JOIN members m ON q3.member_id = m.id
|
||
LEFT JOIN accounts a ON q3.id = a.id
|
||
ORDER BY '.$order_by.' '.$order_by_direction.'
|
||
LIMIT '.$limit_from.','.$limit_results);
|
||
}
|
||
|
||
/**
|
||
* @author Jiri Svitak
|
||
* It gets count of project accounts.
|
||
* @return unknown_type
|
||
*/
|
||
public function get_project_accounts_count()
|
||
{
|
||
$count = self::$db->query('SELECT COUNT(*) AS total
|
||
FROM accounts a
|
||
WHERE a.account_attribute_id = '.Account_attribute_Model::$project
|
||
);
|
||
return $count->current()->total;
|
||
}
|
||
|
||
/**
|
||
* @author Jiri Svitak
|
||
* It gets balance of account. It subtracts all outbound transfers from all incoming transfers.
|
||
* @param $account_id
|
||
* @return unknown_type
|
freenetis/trunk/kohana/application/models/user.php | ||
---|---|---|
|
||
public function get_all_users($limit_from = 0, $limit_results = 50, $order_by = 'devices.id', $order_by_direction = 'ASC', $filter_values = array(),$member_id=NULL)
|
||
{
|
||
|
||
//return self::$db->query('select m.id, m.registration, concat(u.surname,\' \',u.name) as name, ifnull(m.street,\'-\') as street,
|
||
// ifnull(m.street_number,\'-\') as street_number,ifnull(m.town,\'-\') as town from members m
|
||
// left join users u on m.id = u.member_id group by m.id order by name limit '.$min.','.$limit_results);
|
||
|
||
|
||
|
||
$where = '';
|
||
|
||
if(count($filter_values)>0) $where .= 'WHERE ';
|
||
|
||
foreach($filter_values as $key => $value)
|
||
{
|
||
if($key!='submit')
|
||
... | ... | |
$where .= $this->arr_sql[$key].' LIKE \'%'.trim($value).'%\' COLLATE utf8_general_ci';
|
||
}
|
||
}
|
||
if($member_id)
|
||
if ($member_id)
|
||
{
|
||
if($where=='') $where = 'WHERE u.member_id = '.$member_id;
|
||
else $where .= ' AND u.member_id = '.$member_id;
|
||
}
|
||
|
||
return self::$db->query('select u.id, u.name, u.surname, u.login, u.email, m.name as member_name from users u
|
||
join members m on u.member_id = m.id '.$where.' order by '.$this->arr_sql[$order_by].' '.$order_by_direction.' LIMIT '.$limit_from.','.$limit_results);
|
||
|
||
return self::$db->query('SELECT
|
||
u.id, u.name, u.surname, u.login, u.email, u.member_id
|
||
FROM users u
|
||
'.$where.'
|
||
ORDER BY '.$this->arr_sql[$order_by].' '.$order_by_direction.'
|
||
LIMIT '.$limit_from.','.$limit_results
|
||
);
|
||
}
|
||
|
||
|
freenetis/trunk/kohana/application/models/bank_transfer.php | ||
---|---|---|
if ($order_by == 'amount')
|
||
$order_by = 'IF( t.destination_id = '.$account_id.', amount, amount*-1 )';
|
||
return self::$db->query("SELECT
|
||
t.id AS tid, t.datetime, t.text, t.amount,
|
||
bt.variable_symbol AS varsym,
|
||
a.name AS aname, CONCAT(ba.account_nr, '/', ba.bank_nr) AS account_number,
|
||
IF( t.destination_id = ".$account_id.", FALSE, TRUE ) AS trans_type
|
||
t.id, t.datetime, t.text, t.amount,
|
||
bt.variable_symbol,
|
||
a.name, CONCAT(ba.account_nr, '/', ba.bank_nr) AS account_number,
|
||
IF (t.destination_id = ".$account_id.", FALSE, TRUE) AS trans_type
|
||
FROM transfers t
|
||
LEFT JOIN accounts a ON a.id = IF( t.origin_id = ".$account_id.", t.destination_id, t.origin_id )
|
||
LEFT JOIN accounts a ON a.id = IF (t.origin_id = ".$account_id.", t.destination_id, t.origin_id)
|
||
LEFT JOIN bank_accounts ba ON a.id = ba.account_id
|
||
LEFT JOIN bank_transfers bt ON t.id = bt.transfer_id
|
||
WHERE (t.origin_id = ".$account_id." OR t.destination_id = ".$account_id.")
|
||
... | ... | |
*/
|
||
public function count_bank_transfers($account_id)
|
||
{
|
||
return self::$db->query("SELECT
|
||
t.id, t.datetime, t.text, t.amount,
|
||
bt.variable_symbol AS varsym,
|
||
a.name, CONCAT(ba.account_nr, '/', ba.bank_nr) AS account_number,
|
||
IF( t.destination_id = ".$account_id.", FALSE, TRUE ) AS trans_type
|
||
return self::$db->query("SELECT COUNT(*) AS total
|
||
FROM transfers t
|
||
LEFT JOIN accounts a ON a.id = IF( t.origin_id = ".$account_id.", t.destination_id, t.origin_id )
|
||
LEFT JOIN bank_accounts ba ON a.id = ba.account_id
|
||
LEFT JOIN bank_transfers bt ON t.id = bt.transfer_id
|
||
LEFT JOIN account_attributes aa ON a.account_attribute_id = aa.id
|
||
WHERE (t.origin_id = ".$account_id." OR t.destination_id = ".$account_id.")
|
||
AND aa.id = ".Account_attribute_Model::$bank)->count();
|
||
JOIN bank_transfers bt ON bt.transfer_id = t.id"
|
||
)->current()->total;
|
||
}
|
||
|
||
/**
|
||
... | ... | |
bt.variable_symbol AS varsym,
|
||
CONCAT(ba.account_nr, '/', ba.bank_nr) AS account_number
|
||
FROM transfers t
|
||
LEFT JOIN bank_accounts ba ON ba.account_id = t.origin_id
|
||
JOIN bank_transfers bt ON bt.transfer_id = t.id
|
||
LEFT JOIN bank_accounts ba ON ba.id = bt.origin_id
|
||
LEFT JOIN accounts a ON a.id = t.origin_id
|
||
WHERE t.id NOT IN
|
||
(SELECT previous_transfer_id
|
||
FROM transfers t
|
||
WHERE t.previous_transfer_id IS NOT NULL)
|
||
AND a.account_attribute_id = ".Account_attribute_Model::$member_fees."
|
||
ORDER BY ".$order_by." ".$order_by_direction."
|
||
LIMIT ".$limit_from." , ".$limit_results
|
||
);
|
||
... | ... | |
public function get_unidentified_transfer($trans_id = null)
|
||
{
|
||
return self::$db->query("SELECT
|
||
oa.name AS oaname, oa.id AS oaid, oa.member_id AS oamember_id,
|
||
CONCAT(oba.account_nr, '/', oba.bank_nr) AS oanumber,
|
||
da.name AS daname, da.id AS daid, da.member_id AS daowner,
|
||
CONCAT(dba.account_nr, '/', dba.bank_nr) AS danumber,
|
||
t.id AS tid, t.datetime, t.text, t.amount,
|
||
bt.variable_symbol AS varsym
|
||
oba.name AS oba_name,
|
||
CONCAT(oba.account_nr, '/', oba.bank_nr) AS oba_number,
|
||
dba.name AS dba_name,
|
||
CONCAT(dba.account_nr, '/', dba.bank_nr) AS dba_number,
|
||
t.id, t.origin_id, t.destination_id, t.datetime, t.text, t.amount,
|
||
bt.variable_symbol
|
||
FROM transfers t
|
||
LEFT JOIN accounts oa ON oa.id = t.origin_id
|
||
LEFT JOIN bank_accounts oba ON oa.id = oba.account_id
|
||
LEFT JOIN accounts da ON da.id = t.destination_id
|
||
LEFT JOIN bank_accounts dba ON da.id = dba.account_id
|
||
LEFT JOIN bank_transfers bt ON t.id = bt.transfer_id
|
||
JOIN bank_transfers bt ON t.id = bt.transfer_id
|
||
LEFT JOIN bank_accounts oba ON oba.id = bt.origin_id
|
||
LEFT JOIN bank_accounts dba ON dba.id = bt.destination_id
|
||
WHERE t.id =".$trans_id
|
||
)->current();
|
||
}
|
freenetis/trunk/kohana/application/controllers/members.php | ||
---|---|---|
} // end of show_all function
|
||
|
||
/**
|
||
* Shows list of users assigned to current member.
|
||
* @param $member_id id of member to whom are users assigned to
|
||
* @param $order_by sorting column
|
||
* @param $order_by_direction sorting direction
|
||
* @return unknown_type
|
||
*/
|
||
function users($member_id = NULL, $order_by = 'member_id', $order_by_direction = 'ASC')
|
||
{
|
||
if (isset($member_id))
|
||
{
|
||
if ($member_id == $_SESSION['member_id'])
|
||
{
|
||
if (!$this->acl_check_2D('freenetis', 'view_own'))
|
||
Controller::error(1);
|
||
}
|
||
else
|
||
{
|
||
if (!$this->acl_check_2D('freenetis', 'view_all'))
|
||
Controller::error(1);
|
||
}
|
||
|
||
$model_users = new User_Model();
|
||
$users = $model_users->orderby($order_by,$order_by_direction)->find_all_by_member_id($member_id);
|
||
|
||
$grid = new Grid(url_lang::base().'members/users/', url_lang::lang('texts.My users'),array(
|
||
'separator' => '<br /><br />',
|
||
'use_paginator' => false,
|
||
'use_selector' => false,
|
||
|
||
'order_by' => $order_by,
|
||
'order_by_direction' => $order_by_direction,
|
||
'variables' => $member_id.'/'
|
||
|
||
));
|
||
|
||
if ($this->acl_check_2D('freenetis', 'new_own'))
|
||
$grid->add_new_button(url_lang::base().'users/add/'.$member_id, url_lang::lang('texts.Add new user'));
|
||
$grid->add_back_button(url_lang::lang('texts.Back'));
|
||
$grid->order_field('id','id')->label('ID');
|
||
$grid->order_field('name','name')->label(url_lang::lang('texts.Name'));
|
||
$grid->order_field('surname','surname')->label(url_lang::lang('texts.Surname'));
|
||
$grid->order_field('login','login')->label(url_lang::lang('texts.Username'));
|
||
$grid->order_field('email','email')->label('E-mail');
|
||
$grid->action_field('id') ->label(url_lang::lang('texts.Show'))->url(url_lang::base().'users/show')->action(url_lang::lang('texts.Show'));
|
||
$grid->action_field('id') ->label(url_lang::lang('texts.Edit'))->url(url_lang::base().'users/edit')->action(url_lang::lang('texts.Edit'));
|
||
$grid->action_field('id') ->label(url_lang::lang('texts.Delete'))->url(url_lang::base().'users/delete')->action(url_lang::lang('texts.Delete'))->script('onclick="return potvrd(\''.url_lang::lang('texts.delete_user').'\');"');;
|
||
$grid->datasource( $users );
|
||
|
||
// creates view
|
||
$view = new View('template');
|
||
$view->header = new View('base/header');
|
||
$view->content = $grid;
|
||
$view->footer = new View('base/footer');
|
||
$view->header->title = url_lang::lang('texts.My users');
|
||
$view->header->menu = Controller::render_menu();
|
||
$view->render(TRUE);
|
||
}
|
||
else
|
||
{
|
||
Controller::warning(1);
|
||
}
|
||
} // end of users function
|
||
|
||
/**
|
||
* Shows details of member.
|
||
* @param $member_id id of member to show
|
||
* @param $order_by sorting column
|
freenetis/trunk/kohana/application/controllers/users.php | ||
---|---|---|
'uri_segment' => 'page', // pass a string as uri_segment to trigger former 'label' functionality
|
||
'total_items' => $total_users, // 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',
|
||
'style' => 'classic',
|
||
'order_by' => $order_by,
|
||
'order_by_direction' => $order_by_direction,
|
||
'limit_results' => $limit_results,
|
||
... | ... | |
$grid->order_field('surname')->label(url_lang::lang('texts.Surname'));
|
||
$grid->order_field('login')->label(url_lang::lang('texts.Username'));
|
||
$grid->order_field('email')->label('E-mail');
|
||
$grid->order_field('member_name')->label(url_lang::lang('texts.Member'));
|
||
if ($this->acl_check_view(get_class($this),'users'))
|
||
$grid->action_field('id') ->label(url_lang::lang('texts.Show')) ->url(url_lang::base().'users/show') ->action(url_lang::lang('texts.Show'));
|
||
$grid->action_field('id') ->label(url_lang::lang('texts.User')) ->url(url_lang::base().'users/show') ->action(url_lang::lang('texts.Show'));
|
||
if ($this->acl_check_edit(get_class($this),'users'))
|
||
$grid->action_field('id') ->label(url_lang::lang('texts.Edit')) ->url(url_lang::base().'users/edit') ->action(url_lang::lang('texts.Edit'));
|
||
$grid->action_field('id') ->label(url_lang::lang('texts.User')) ->url(url_lang::base().'users/edit') ->action(url_lang::lang('texts.Edit'));
|
||
if ($this->acl_check_view(get_class($this),'users'))
|
||
$grid->action_field('member_id') ->label(url_lang::lang('texts.Member')) ->url(url_lang::base().'members/show') ->action(url_lang::lang('texts.Show'));
|
||
// user never should be deleted
|
||
// $grid->action_field('id')->label(url_lang::lang('texts.Delete'))->url(url_lang::base().'users/delete')->action(url_lang::lang('texts.Delete'))->script('onclick="return potvrd(\''.url_lang::lang('texts.delete_user').'\');"');
|
||
$grid->datasource($query);
|
||
... | ... | |
|
||
$view = new View('template');
|
||
$view->header = new View('base/header');
|
||
$view->content = $filter->view.$grid;
|
||
$view->content = $filter->view.'<br />'.$grid;
|
||
$view->footer = new View('base/footer');
|
||
$view->header->menu = Controller::render_menu();
|
||
$view->header->title = url_lang::lang('texts.List of users of member').' '.$member->name;
|
freenetis/trunk/kohana/application/controllers/bank_transfers.php | ||
---|---|---|
//if(!$this->acl_check_view('Accounts_Controller', 'bank_transfers', $account_id))
|
||
// Controller::Error(1);
|
||
|
||
// gets grid settings
|
||
if (is_numeric($this->input->get('record_per_page')))
|
||
$limit_results = (int) $this->input->get('record_per_page');
|
||
// to do - correct allowed order type array
|
||
$allowed_order_type = array('id', 'amount', 'datetime', 'trans_type', 'account_number', 'varsym', 'aname');
|
||
$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 = 'id';
|
||
if (strtolower($order_by_direction) != 'asc' && strtolower($order_by_direction) != 'desc')
|
||
... | ... | |
$grid->add_new_button(url_lang::base().'bank_accounts/show_all', url_lang::lang('texts.Back to bank accounts'));
|
||
$grid->order_field('id')->label('ID');
|
||
$grid->order_field('trans_type')->label(url_lang::lang('texts.Type'))->bool(array(url_lang::lang('texts.Arrival'),url_lang::lang('texts.Outbound')));
|
||
$grid->order_field('aname', 'name')->label(url_lang::lang('texts.Counteraccount'));
|
||
$grid->order_field( 'name')->label(url_lang::lang('texts.Counteraccount'));
|
||
$grid->order_field('account_number')->label(url_lang::lang('texts.Account number'));
|
||
$grid->order_field('datetime')->label(url_lang::lang('texts.Date and time'));
|
||
$grid->order_field('amount')->label(url_lang::lang('texts.Amount'));
|
||
$grid->order_field('varsym')->label(url_lang::lang('texts.VS'));
|
||
$grid->order_field('variable_symbol')->label(url_lang::lang('texts.VS'));
|
||
$grid->field('text')->label(url_lang::lang('texts.Text'));
|
||
$grid->datasource($transfers);
|
||
|
||
... | ... | |
$sql_offset = 0;
|
||
$transfers = $mt_model->get_unidentified_transfers($sql_offset, (int)$limit_results, $order_by, $order_by_direction);
|
||
|
||
$grid = new Grid(url_lang::base().'transfers', url_lang::lang('texts.Unidentified transfers'),array(
|
||
$grid = new Grid(url_lang::base().'transfers', null,array(
|
||
'separator' => '<br />',
|
||
//'use_paginator' => false,
|
||
//'use_selector' => false,
|
||
... | ... | |
$grid->order_field('varsym')->label(url_lang::lang('texts.Variable symbol'));
|
||
$grid->order_field('account_number')->label(url_lang::lang('texts.Account number'));
|
||
$grid->field('text')->label(url_lang::lang('texts.Text'));
|
||
$grid->action_field('id') ->label(url_lang::lang('texts.Payment'))->url(url_lang::base().'transfers/assign_transfer')->action(url_lang::lang('texts.Assign'));
|
||
$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);
|
||
|
||
$view = new View('template');
|
||
$view->header = new View('base/header');
|
||
$view->content = $grid;
|
||
$view->content = new View('bank_transfers/unidentified_transfers');
|
||
$view->content->grid = $grid;
|
||
$view->content->message = $this->session->get_once('message');
|
||
$view->footer = new View('base/footer');
|
||
$view->header->menu = Controller::render_menu();
|
||
$view->header->title = url_lang::lang('texts.Unidentified transfers');
|
||
... | ... | |
if (isset($trans_id))
|
||
{
|
||
$account_model = new Account_Model();
|
||
$accounts = $account_model->get_credit_accounts(0, $account_model->get_credit_accounts_count(), 'a.id', 'asc');
|
||
$accounts = $account_model->get_credit_account_names();
|
||
foreach ($accounts as $account)
|
||
{
|
||
$arr_accounts[$account->id] = $account->aname;
|
||
$arr_accounts[$account->id] = $account->name;
|
||
}
|
||
asort($arr_accounts);
|
||
asort($arr_accounts, SORT_LOCALE_STRING);
|
||
|
||
$mt_model = new Bank_transfer_Model();
|
||
$mt = $mt_model->get_unidentified_transfer($trans_id);
|
||
|
||
$form = new Forge(url_lang::base().'transfers/assign_transfer/'.$trans_id, '', 'POST', array('id' => 'article_form'));
|
||
$form = new Forge(url_lang::base().'bank_transfers/assign_transfer/'.$trans_id, '', 'POST', array('id' => 'article_form'));
|
||
$form->set_attr('class', 'form_class')->set_attr('method', 'post');
|
||
$form->group('')->label(url_lang::lang('texts.Payment'));
|
||
$form->dropdown('aname')->label(url_lang::lang('texts.Destination credit account').':')->options($arr_accounts)->rules('required');
|
||
$form->dropdown('name')->label(url_lang::lang('texts.Destination credit account').':')->options($arr_accounts)->rules('required');
|
||
$form->input('text')->label(url_lang::lang('texts.Text'));
|
||
$form->group('')->label(url_lang::lang('texts.Penalty'));
|
||
$form->input('penalty')->label(url_lang::lang('texts.Penalty'))->value('0')->rules('valid_numeric');
|
||
... | ... | |
$form_data[$key] = htmlspecialchars($value);
|
||
}
|
||
$new_mt = new Transfer_Model();
|
||
$new_mt->origin_id = $mt->daid;
|
||
$new_mt->destination_id = $form_data['aname'];
|
||
$new_mt->previous_transfer_id = $mt->mtid;
|
||
$new_mt->origin_id = $mt->destination_id;
|
||
$new_mt->destination_id = $form_data['name'];
|
||
$new_mt->previous_transfer_id = $mt->id;
|
||
$new_mt->datetime = date("Y-m-d H:i:s", time());
|
||
$new_mt->text = $form_data['text'];
|
||
$new_mt->amount = $mt->amount;
|
||
... | ... | |
if ($form_data['penalty'] > 0)
|
||
{
|
||
$pen = new Transfer_Model();
|
||
$pen->origin_id = $form_data['aname'];
|
||
$pen->origin_id = $form_data['name'];
|
||
$pen->destination_id = $account_model->get_operating_account();
|
||
$pen->previous_transfer_id = $mt->id;
|
||
$pen->datetime = date("Y-m-d H:i:s", time());
|
||
$pen->text = $form_data['penalty_text'];
|
||
$pen->amount = $form_data['penalty'];
|
||
... | ... | |
}
|
||
if ($new_mt->save() && $pen_save)
|
||
{
|
||
$this->session->set_flash('message', url_lang::lang('texts.Transfer has been successfully assigned.'));
|
||
url::redirect(url_lang::base().'transfers/unidentified_transfers');
|
||
$this->session->set_flash('message', url_lang::lang('texts.Payment has been successfully assigned.'));
|
||
url::redirect(url_lang::base().'bank_transfers/unidentified_transfers');
|
||
}
|
||
}
|
||
|
||
... | ... | |
$view->header = new View('base/header');
|
||
$view->header->menu = Controller::render_menu();
|
||
$view->header->title = url_lang::lang('texts.Assign transfer');
|
||
$view->content = new View('transfers/assign');
|
||
$view->content = new View('bank_transfers/assign_transfer');
|
||
$view->content->mt = $mt;
|
||
$view->content->form = $form->html();
|
||
$view->footer = new View('base/footer');
|
freenetis/trunk/kohana/application/controllers/accounts.php | ||
---|---|---|
|
||
$account_model = new Account_Model();
|
||
$total_accounts = $account_model->get_credit_accounts_count();
|
||
if (($sql_offset = ($page - 1) * $limit_results) > $total_members)
|
||
if (($sql_offset = ($page - 1) * $limit_results) > $total_accounts)
|
||
$sql_offset = 0;
|
||
$accounts = $account_model->get_credit_accounts($sql_offset, (int)$limit_results, $order_by, $order_by_direction);
|
||
|
||
... | ... | |
$view->render(TRUE);
|
||
}
|
||
}
|
||
|
||
/**
|
||
* @author Jiri Svitak
|
||
* It shows project accounts.
|
||
* @param $limit_results
|
||
* @param $order_by
|
||
* @param $order_by_direction
|
||
* @return unknown_type
|
||
*/
|
||
function project_accounts($limit_results = 500, $order_by = 'id', $order_by_direction = 'asc', $page_word = null, $page = 1)
|
||
{
|
||
// to do - correct access rights
|
||
//if(!$this->acl_check_view('Accounts_Controller','transfers',$member_id))
|
||
// Controller::Error(1);
|
||
|
||
// gets grid settings
|
||
if (is_numeric($this->input->get('record_per_page')))
|
||
$limit_results = (int) $this->input->get('record_per_page');
|
||
// to do - correct allowed order type array
|
||
$allowed_order_type = array('id', 'origin_id', 'destination_id', 'timestamp', 'amount', 'constant_symbol', 'specific_symbol', 'name', 'date_time', 'fee_transfer_id', 'trans_type', 'text');
|
||
if (!in_array(strtolower($order_by),$allowed_order_type))
|
||
$order_by = 'id';
|
||
if (strtolower($order_by_direction) != 'asc' && strtolower($order_by_direction) != 'desc')
|
||
$order_by_direction = 'asc';
|
||
|
||
$account_model = new Account_Model();
|
||
$total_accounts = $account_model->get_project_accounts_count();
|
||
if (($sql_offset = ($page - 1) * $limit_results) > $total_accounts)
|
||
$sql_offset = 0;
|
||
$accounts = $account_model->get_project_accounts($sql_offset, (int)$limit_results, $order_by, $order_by_direction);
|
||
|
||
$grid = new Grid(url_lang::base().'accounts',
|
||
null, array(
|
||
'separator' => '<br /><br />',
|
||
'current' => $limit_results, // current selected 'records_per_page' value
|
||
'selector_increace' => 50, // increace
|
||
'selector_min' => 50, // minimum where selector start
|
||
'selector_max_multiplier' => 10,
|
||
'base_url' => Config::item('locale.lang').'/accounts/credit_transfers/'.$limit_results.'/'.$order_by.'/'.$order_by_direction ,
|
||
'uri_segment' => 'page', // pass a string as uri_segment to trigger former 'label' functionality
|
||
'total_items' => $total_accounts, // 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,
|
||
'order_by_direction' => $order_by_direction,
|
||
'limit_results' => $limit_results,
|
||
));
|
||
// adding account, to do - access rights
|
||
//if ($this->acl_check_new(get_class($this), 'accounts', $member_id))
|
||
// $acc_grid->add_new_button(url_lang::base().'accounts/add_bank_account/'.$member_id, url_lang::lang('texts.Add new bank account'));
|
||
$grid->add_new_button(url_lang::base().'accounts/add_project', url_lang::lang('texts.Add new project account'));
|
||
$grid->order_field('id')->label('ID');
|
||
$grid->order_field('aname')->label(url_lang::lang('texts.Account name'));
|
||
$grid->order_field('comment')->label(url_lang::lang('texts.Comment'));
|
||
$grid->order_field('mname')->label(url_lang::lang('texts.Member name'));
|
||
$grid->order_field('credit')->label(url_lang::lang('texts.Credit'));
|
||
//$grid->action_field('id')->label(url_lang::lang('texts.Transfers'))->url(url_lang::base().'transfers/show_by_credit_account')->action(url_lang::lang('texts.Show'));
|
||
$grid->action_field('member_id')->label(url_lang::lang('texts.Member'))->url(url_lang::base().'members/show')->action(url_lang::lang('texts.Show'));
|
||
$grid->datasource($accounts);
|
||
|
||
$view = new View('template');
|
||
$view->header = new View('base/header');
|
||
$view->header->title = url_lang::lang('texts.Project accounts');
|
||
$view->header->menu = Controller::render_menu();
|
||
$view->content = new View('accounts/project');
|
||
$view->content->grid = $grid;
|
||
$view->content->message = $this->session->get_once('message');
|
||
$view->footer = new View('base/footer');
|
||
$view->render(TRUE);
|
||
}
|
||
|
||
function trans_detail($transfer_id = NULL, $member_id = NULL)
|
||
{
|
||
... | ... | |
Controller::warning(1);;
|
||
}
|
||
} // end of add_credit_account function
|
||
|
||
/**
|
||
* @author Jiri Svitak
|
||
* Adds new project account.
|
||
* @param $member_id
|
||
* @return unknown_type
|
||
*/
|
||
function add_project($member_id = NULL)
|
||
{
|
||
// to do - access rights
|
||
//if (!$this->gacl_class->acl_check('freenetis', 'new_own', 'all', $_SESSION['username'],get_class($this),'add_accounts'))
|
||
// Controller::error(1);
|
||
if (isset($member_id))
|
||
{
|
||
$this->owner_id = $member_id;
|
||
$form = new Forge(url_lang::base().'accounts/add_project/'.$member_id, '', 'POST', array('id' => 'article_form'));
|
||
$form->set_attr('class', 'form_class')->set_attr('method', 'post');
|
||
$form->group('')->label(url_lang::lang('texts.Basic informations'));
|
||
$form->input('name')->label(url_lang::lang('texts.Name').':')->rules('required|length[3,50]');
|
||
$form->textarea('comment')->label(url_lang::lang('texts.Comment').':')->rules('length[0,250]');
|
||
$form->submit('submit')->value(url_lang::lang('texts.Add'));
|
||
special::required_forge_style($form, ' *', 'required');
|
||
if($form->validate())
|
||
{
|
||
$form_data = $form->as_array();
|
||
$account = new Account_Model;
|
||
$account->name = htmlspecialchars($form_data['name']);
|
||
$account->comment = htmlspecialchars($form_data['comment']);
|
||
unset($form_data);
|
||
$account->member_id = $member_id;
|
||
if ($account->save())
|
||
{
|
||
$this->session->set_flash('message', url_lang::lang('texts.Account has been successfully added.'));
|
||
}
|
||
else
|
||
{
|
||
$this->session->set_flash('message', url_lang::lang('texts.Error - cant add new account.'));
|
||
}
|
||
url::redirect(url_lang::base().'members/show/'.$member_id);
|
||
}
|
||
else
|
||
{
|
||
$view->form = new View('registration');
|
||
$view = new View('template');
|
||
$view->header = new View('base/header');
|
||
$view->content = new View('account_add');
|
||
$view->footer = new View('base/footer');
|
||
$view->header->menu = Controller::render_menu();
|
||
$view->header->title = url_lang::lang('texts.Add new project account');
|
||
$view->content->form = $form->html();
|
||
$view->content->member_id = $member_id;
|
||
$view->render(TRUE);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
Controller::warning(1);;
|
||
}
|
||
} // end of add_credit_account function
|
||
|
||
function edit($acc_id = NULL)
|
||
{
|
freenetis/trunk/kohana/application/controllers/devices.php | ||
---|---|---|
$view->header = new View('base/header');
|
||
$view->header->title = url_lang::lang('texts.Devices list');
|
||
$view->header->menu = Controller::render_menu();
|
||
$view->content = $filter->view . $grid;
|
||
$view->content = $filter->view.'<br />'.$grid;
|
||
$view->footer = new View('base/footer');
|
||
$view->render(TRUE);
|
||
} // end of show_all function
|
||
... | ... | |
$sql_offset = 0;
|
||
$query = $device_model->get_all_by_member($sql_offset, (int)$limit_results, $order_by, $order_by_direction, $member_id);
|
||
|
||
$grid = new Grid(url_lang::base().'devices/show_by_member', null,array(
|
||
$grid = new Grid(url_lang::base().'devices/show_by_member', url_lang::lang('texts.Devices list of member').' '.$member->name,array(
|
||
//'separator' => ' - ',
|
||
//'use_paginator' => false,
|
||
//'use_selector' => false,
|
||
... | ... | |
));
|
||
|
||
if ($this->acl_check_new(get_class($this),'devices',$member_id))
|
||
$grid->add_new_button(url_lang::base().'devices/add_whole', url_lang::lang('texts.add new device').' ');
|
||
$grid->add_new_button(url_lang::base().'members/show/'.$member_id, url_lang::lang('texts.back to the member'));
|
||
$grid->add_new_button(url_lang::base().'devices/add_whole', url_lang::lang('texts.Add new device').' ');
|
||
$grid->add_new_button(url_lang::base().'members/show/'.$member_id, url_lang::lang('texts.Back to the member'));
|
||
$grid->order_field('id')->label('ID')->class('center');
|
||
$grid->order_field('name')->label(url_lang::lang('texts.Name'));
|
||
$grid->order_field('type')->label(url_lang::lang('texts.Type'));
|
||
... | ... | |
$grid->action_field('id')->label(url_lang::lang('texts.Device'))->url(url_lang::base().'devices/edit')->action(url_lang::lang('texts.Edit'))->class('center');
|
||
// to do - access control to delete
|
||
// $grid->action_field('id')->label(url_lang::lang('texts.Delete'))->url(url_lang::base().'devices/delete')->action(url_lang::lang('texts.Delete'))->class('center');
|
||
$grid->datasource( $query );
|
||
$this->template->content = $grid;
|
||
$grid->datasource($query);
|
||
|
||
|
||
$view = new View('template');
|
||
|
||
$view->header = new View('base/header');
|
||
$view->header->title = url_lang::lang('texts.Devices list');
|
||
$view->header->menu = Controller::render_menu();
|
||
|
||
$view->content = new View('show_all');
|
||
$view->content->table = $this->template->content;
|
||
$view->content->headline = url_lang::lang('texts.Devices list of member').' '.$member->name;
|
||
|
||
|
||
$view->content = $grid;
|
||
$view->footer = new View('base/footer');
|
||
|
||
$view->render(TRUE);
|
||
|
||
}
|
freenetis/trunk/kohana/application/libraries/MY_Controller.php | ||
---|---|---|
|
||
if ($this->acl_check_2D('menu', 'my_users')) $myMenu .= '<li>'.html::anchor(url_lang::base().'users/show_by_member/'.$this->session->get('member_id'), url_lang::lang('texts.My users')).'</li>';
|
||
|
||
if ($this->acl_check_2D('menu', 'my_transfers')) $myMenu .= '<li>'.html::anchor(url_lang::base().'money_transfers/show_by_member/'.$this->session->get('member_id'), url_lang::lang('texts.My transfers')).'</li>';
|
||
if ($this->acl_check_2D('menu', 'my_transfers')) $myMenu .= '<li>'.html::anchor(url_lang::base().'transfers/show_by_member/'.$this->session->get('member_id'), url_lang::lang('texts.My transfers')).'</li>';
|
||
if ($this->acl_check_2D('menu', 'my_devices')) $myMenu .= ' <li>'.html::anchor(url_lang::base().'devices/show_by_member/'.$this->session->get('member_id'), url_lang::lang('texts.My devices')).'</li>';
|
||
|
||
|
freenetis/trunk/kohana/application/views/accounts/project.php | ||
---|---|---|
<h2>
|
||
<?php echo url_lang::lang('texts.Project accounts')?>
|
||
</h2>
|
||
<?php echo $message ? '<div class="message">'.$message.'</div>' : '' ?>
|
||
|
||
<br />
|
||
<?php echo $grid ?>
|
freenetis/trunk/kohana/application/views/transfers/assign.php | ||
---|---|---|
<h2><?php echo url_lang::lang('texts.Assign transfer')?></h2>
|
||
<br />
|
||
<?php echo html::anchor(url_lang::base().'money_transfers/unidentified_transfers/', url_lang::lang('texts.Back to unidentified transfers')); ?>
|
||
<br />
|
||
<br />
|
||
<table class="extended" style="float:left">
|
||
<tr>
|
||
<th colspan="2"><?php echo url_lang::lang('texts.Payment information') ?></th>
|
||
</tr>
|
||
<tr>
|
||
<th>ID</th>
|
||
<td><?php echo $mt->mtid ?></td>
|
||
</tr>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.Date and time') ?></th>
|
||
<td><?php echo $mt->datetime ?></td>
|
||
</tr>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.Text') ?></th>
|
||
<td><?php echo $mt->text ?></td>
|
||
</tr>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.Amount') ?></th>
|
||
<td><?php echo $mt->amount ?></td>
|
||
</tr>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.Variable symbol') ?></th>
|
||
<td><?php echo $mt->varsym ?></td>
|
||
</tr>
|
||
</table>
|
||
<table class="extended" style="float:left; margin-left: 25px">
|
||
<tr>
|
||
<th colspan="2"><?php echo url_lang::lang('texts.Origin account') ?> </th>
|
||
</tr>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.Account name') ?> </th>
|
||
<td><?php echo $mt->oaname?></td>
|
||
</tr>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.Account number') ?> </th>
|
||
<td><?php echo $mt->oanumber?></td>
|
||
</tr>
|
||
<tr>
|
||
<th colspan="2"><?php echo url_lang::lang('texts.Destination account') ?> </th>
|
||
</tr>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.Account name') ?> </th>
|
||
<td><?php echo $mt->daname?></td>
|
||
</tr>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.Account number') ?> </th>
|
||
<td><?php echo $mt->danumber?></td>
|
||
</tr>
|
||
</table>
|
||
<br class="clear" />
|
||
<br />
|
||
<?php echo $form; ?>
|
freenetis/trunk/kohana/application/views/bank_transfers/unidentified_transfers.php | ||
---|---|---|
<h2><?php echo url_lang::lang('texts.Unidentified transfers'); ?></h2>
|
||
<?php echo $message ? '<div class="message">'.$message.'</div>' : '' ?>
|
||
<br />
|
||
<?php echo $grid; ?>
|
freenetis/trunk/kohana/application/views/bank_transfers/assign_transfer.php | ||
---|---|---|
<h2><?php echo url_lang::lang('texts.Assign transfer')?></h2>
|
||
<br />
|
||
<?php echo html::anchor(url_lang::base().'bank_transfers/unidentified_transfers/', url_lang::lang('texts.Back to unidentified transfers')); ?>
|
||
<br />
|
||
<br />
|
||
<table class="extended" style="float:left">
|
||
<tr>
|
||
<th colspan="2"><?php echo url_lang::lang('texts.Payment information') ?></th>
|
||
</tr>
|
||
<tr>
|
||
<th>ID</th>
|
||
<td><?php echo $mt->id ?></td>
|
||
</tr>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.Date and time') ?></th>
|
||
<td><?php echo $mt->datetime ?></td>
|
||
</tr>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.Text') ?></th>
|
||
<td><?php echo $mt->text ?></td>
|
||
</tr>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.Amount') ?></th>
|
||
<td><?php echo $mt->amount ?></td>
|
||
</tr>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.Variable symbol') ?></th>
|
||
<td><?php echo $mt->variable_symbol ?></td>
|
||
</tr>
|
||
</table>
|
||
<table class="extended" style="float:left; margin-left: 25px">
|
||
<tr>
|
||
<th colspan="2"><?php echo url_lang::lang('texts.Origin account') ?> </th>
|
||
</tr>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.Account name') ?> </th>
|
||
<td><?php echo $mt->oba_name?></td>
|
||
</tr>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.Account number') ?> </th>
|
||
<td><?php echo $mt->oba_number?></td>
|
||
</tr>
|
||
<tr>
|
||
<th colspan="2"><?php echo url_lang::lang('texts.Destination account') ?> </th>
|
||
</tr>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.Account name') ?> </th>
|
||
<td><?php echo $mt->dba_name?></td>
|
||
</tr>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.Account number') ?> </th>
|
||
<td><?php echo $mt->dba_number?></td>
|
||
</tr>
|
||
</table>
|
||
<br class="clear" />
|
||
<br />
|
||
<?php echo $form; ?>
|
Také k dispozici: Unified diff
Pridano zobrazeni projektovych uctu. Upravena identifikace plateb po zmene bankovnich plateb a uctu. Drobne upravy vzhledu gridu.