Revize 271
Přidáno uživatelem Jiří Sviták před asi 15 roky(ů)
freenetis/trunk/kohana/application/i18n/cs_CZ/texts.php | ||
---|---|---|
'date of foundation' => 'Datum založení',
|
||
'date to' => 'Datum do',
|
||
'debit payment rate' => 'Výše splátek',
|
||
'debtors' => 'Dlužníci',
|
||
'delete this contact' => 'Smazat tento kontakt',
|
||
'delete_member' => 'Smazat tohoto člena',
|
||
'delete_user' => 'Smazat tohoto uživatele',
|
||
... | ... | |
'delete' => 'Smazat',
|
||
'description' => 'Popis',
|
||
'destination account' => 'Cílový účet',
|
||
'destination credit account' => 'Cílový kreditní účet',
|
||
'destination language' => 'Cílový jazyk',
|
||
'detail of transfer number' => 'Detail převodu č.',
|
||
'details' => 'Detaily',
|
||
... | ... | |
'device admins' => 'Správci zařízení',
|
||
'device engineers' => 'Technici zařízení',
|
||
'device detail' => 'Detail zařízení',
|
||
'device is successfully saved' => 'Zařízení bylo úspěšně uloženo.',
|
||
'device is successfully updated' => 'Zařízení bylo úspěšně upraveno.',
|
||
'device has been successfully saved' => 'Zařízení bylo úspěšně uloženo.',
|
||
'device has been successfully updated' => 'Zařízení bylo úspěšně upraveno.',
|
||
'device name' => 'Název zařízení',
|
||
'devices list' => 'Seznam zařízení',
|
||
'devices list of member' => 'Seznam zařízení člena',
|
||
... | ... | |
'member name' => 'Jméno člena (organizace)',
|
||
'members account' => 'Účet člena',
|
||
'members name' => 'Jméno člena (organizace)',
|
||
'members firstname and surname' => 'Jméno a příjmení člena (jméno organizace)',
|
||
'members surname and first name' => 'Jméno a příjmení člena (jméno organizace)',
|
||
'members' => 'Členové',
|
||
'membership interrupts' => 'Přerušení členství',
|
||
'membership interruption has been succesfully added' => 'Přerušení členství bylo úspěšně přidáno',
|
||
... | ... | |
'password' => 'Heslo',
|
||
'pay from account' => 'Platit z účtu',
|
||
'payment' => 'Platba',
|
||
'payment has been successfully assigned' => 'Platba byla úspěšně přiřazena.',
|
||
'payment information' => 'Informace o platbě',
|
||
'penalty' => 'Pokuta',
|
||
'penalty and fee' => 'Poplatky a pokuty',
|
||
'penalty have to be a number' => 'Pokuta musí být číslo',
|
||
... | ... | |
'users in group' => 'Uživatelé ve skupině',
|
||
'vacating member' => 'Přerušené členství',
|
||
'value' => 'Hodnota',
|
||
'variable symbol' => 'variabilní symbol',
|
||
'variable symbol' => 'Variabilní symbol',
|
||
'vlan detail' => 'Detail VLANu',
|
||
'vlan interface detail' => 'Detail VLAN rozhraní',
|
||
'vlan interface has been successfully saved' => 'VLAN rozhraní bylo úspěšně uloženo.',
|
freenetis/trunk/kohana/application/models/money_transfer.php | ||
---|---|---|
{
|
||
if ($order_by == 'amount')
|
||
$order_by = 'IF( mt.destination_id = '.$account_id.', amount, amount*-1 )';
|
||
return self::$db->query('SELECT
|
||
return self::$db->query("SELECT
|
||
a.id AS aid, a.name AS aname,
|
||
mt.id AS mtid, IF(mt.destination_id = '.$account_id.', FALSE, TRUE) AS trans_type
|
||
mt.text, mt.amount
|
||
mt.id AS mtid, IF(mt.destination_id = ".$account_id.", FALSE, TRUE) AS trans_type,
|
||
mt.text, mt.amount, mt.datetime,
|
||
CONCAT(ba.account_nr, '/', ba.bank_nr) AS account_number
|
||
FROM money_transfers mt
|
||
LEFT JOIN accounts a ON a.id = IF(mt.origin_id = '.$account_id.', mt.destination_id, mt.origin_id)
|
||
WHERE mt.origin_id = '.$account_id.' OR mt.destination_id = '.$account_id.'
|
||
ORDER BY '.$order_by.' '.$order_by_direction.'
|
||
LIMIT '.$limit_from.' , '.$limit_results.''
|
||
LEFT JOIN accounts a ON a.id = IF(mt.origin_id = ".$account_id.", mt.destination_id, mt.origin_id)
|
||
LEFT JOIN bank_accounts ba ON a.id = ba.account_id
|
||
WHERE mt.origin_id = ".$account_id." OR mt.destination_id = ".$account_id."
|
||
ORDER BY ".$order_by." ".$order_by_direction."
|
||
LIMIT ".$limit_from." , ".$limit_results
|
||
);
|
||
}
|
||
|
||
... | ... | |
);
|
||
}
|
||
|
||
/**
|
||
* It gets unidentified transfer including bank information
|
||
* @param $trans_id
|
||
* @return unknown_type
|
||
*/
|
||
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,
|
||
mt.id AS mtid, mt.datetime, mt.text, mt.amount,
|
||
bi.variable_symbol AS varsym
|
||
FROM money_transfers mt
|
||
LEFT JOIN accounts oa ON oa.id = mt.origin_id
|
||
LEFT JOIN bank_accounts oba ON oa.id = oba.account_id
|
||
LEFT JOIN accounts da ON da.id = mt.destination_id
|
||
LEFT JOIN bank_accounts dba ON da.id = dba.account_id
|
||
LEFT JOIN money_transfer_bank_infos bi ON mt.id = bi.transfer_id
|
||
WHERE mt.id =".$trans_id."
|
||
ORDER BY mt.id DESC"
|
||
)->current();
|
||
}
|
||
|
||
|
||
public function get_last_transfers($account_id = null)
|
||
{
|
||
return self::$db->query('SELECT mt. * , mt.id AS mtid, bi.*
|
||
... | ... | |
return (int) self::$db->orwhere(array('origin_id' => $account_id, 'destination_id' => $account_id))->count_records('money_transfers');
|
||
}
|
||
|
||
public function count_credit($acc_id = null, $start = false)
|
||
{
|
||
$cout_credit = (float)self::$db->query('SELECT (
|
||
IFNULL(sum( amount ),0) - IFNULL( a.odchozi, 0 )
|
||
) AS credit
|
||
FROM (
|
||
SELECT sum( amount ) AS odchozi
|
||
FROM money_transfers
|
||
WHERE `origin_id` = '.$acc_id.'
|
||
)a, money_transfers mt
|
||
WHERE mt.destination_id = '.$acc_id.''
|
||
)->current()->credit;
|
||
if ($start)
|
||
{
|
||
$cout_credit += (float)self::$db->query('SELECT IFNULL(start_amount,0) AS start_amount
|
||
FROM accounts
|
||
WHERE `id` = '.$acc_id
|
||
)->current()->start_amount;
|
||
}
|
||
return $cout_credit;
|
||
}
|
||
|
||
public function count_all_money_transfers()
|
||
{
|
||
return self::$db->count_records('money_transfers');
|
freenetis/trunk/kohana/application/models/member.php | ||
---|---|---|
$query=self::$db->query($q);
|
||
return $query->current();
|
||
|
||
}
|
||
|
||
/**
|
||
* @author Jiri Svitak
|
||
* It gets all debtors from database.
|
||
* @param $limit_from starting row
|
||
* @param $limit_results number of rows
|
||
* @param $order_by sorting column
|
||
* @param $order_by_direction sorting direction
|
||
* @return unknown_type
|
||
*/
|
||
public function get_debtors($limit_from = 0, $limit_results = 50, $order_by = 'm.id', $order_by_direction = 'ASC')
|
||
{
|
||
// to do - correct this query...
|
||
return self::$db->query('SELECT aid, mid, mname, mstreet, mtown,
|
||
(IFNULL(SUM(amount), 0) - IFNULL(sel2.outbound, 0)) AS credit
|
||
FROM (SELECT
|
||
SUM(amount) AS outbound, aid, mid, mname, mstreet, mtown
|
||
FROM (SELECT a.id AS aid, m.id AS mid, m.name AS mname, m.street AS mstreet, m.town AS mtown
|
||
FROM members m
|
||
JOIN accounts a ON a.member_id = m.id
|
||
) sel1, money_transfers mt1
|
||
WHERE mt1.origin_id = sel1.aid
|
||
) sel2, money_transfers mt2
|
||
WHERE mt2.destination_id = sel2.aid AND credit < 0
|
||
ORDER BY '.$order_by.' '.$order_by_direction.'
|
||
LIMIT '.$limit_from.','.$limit_results);
|
||
}
|
||
|
||
/**
|
freenetis/trunk/kohana/application/models/account.php | ||
---|---|---|
|
||
/**
|
||
* @author Jiri Svitak
|
||
* It gets balance of account. It subtracts all outbound transfers from all incoming transfers.
|
||
* @param $account_id
|
||
* @return unknown_type
|
||
*/
|
||
public function get_account_balance($account_id)
|
||
{
|
||
$outbound = self::$db->query('SELECT SUM(amount) AS total
|
||
FROM money_transfers mt
|
||
WHERE mt.origin_id = '.$account_id.'
|
||
GROUP BY amount
|
||
');
|
||
$out = 0;
|
||
foreach($outbound as $row)
|
||
{
|
||
$out = $row->total;
|
||
}
|
||
|
||
$inbound = self::$db->query('SELECT SUM(amount) AS total
|
||
FROM money_transfers mt
|
||
WHERE mt.destination_id = '.$account_id.'
|
||
GROUP BY amount
|
||
');
|
||
$in = 0;
|
||
foreach($inbound as $row)
|
||
{
|
||
$in = $row->total;
|
||
}
|
||
return $in - $out;//(float)$inbound->current()->total - (float)$outbound->current()->total;
|
||
}
|
||
|
||
/**
|
||
* @author Jiri Svitak
|
||
* It gets all bank accounts of association.
|
||
* @return unknown_type
|
||
*/
|
||
... | ... | |
return $ba_nr->current()->account_number;
|
||
}
|
||
|
||
/**
|
||
* @author Jiri Svitak
|
||
* It gets all credit accounts from database.
|
||
* @return unknown_type
|
||
*/
|
||
public function get_credit_accounts()
|
||
{
|
||
return self::$db->query("SELECT a.*, IFNULL(t.translated_term, e.value) AS type
|
||
FROM accounts a
|
||
JOIN enum_types e ON e.id = a.type_id
|
||
LEFT JOIN translations t ON t.original_term = e.value AND t.lang = '".Config::item('locale.lang')."'
|
||
WHERE e.value = 'credit'");
|
||
}
|
||
|
||
/**
|
||
* @author Jiri Svitak
|
||
* It gets balance of account. It subtracts all outbound transfers from all incoming transfers.
|
||
* @param $account_id
|
||
* @return unknown_type
|
||
*/
|
||
public function get_account_balance($account_id)
|
||
{
|
||
$credit = (float)self::$db->query("SELECT
|
||
(IFNULL(SUM(amount), 0) - IFNULL(a.outbound, 0)) AS credit
|
||
FROM (
|
||
SELECT SUM(amount) AS outbound
|
||
FROM money_transfers
|
||
WHERE `origin_id` = '".$account_id."'
|
||
) a, money_transfers mt
|
||
WHERE mt.destination_id = '".$account_id."'"
|
||
)->current()->credit;
|
||
return $credit;
|
||
}
|
||
|
||
}
|
||
|
||
?>
|
freenetis/trunk/kohana/application/controllers/members.php | ||
---|---|---|
}
|
||
|
||
} // end of show function
|
||
|
||
/**
|
||
* Shows list of all debtors.
|
||
* @param $limit_results
|
||
* @param $order_by
|
||
* @param $order_by_direction
|
||
* @return unknown_type
|
||
*/
|
||
function debtors($limit_results = 500, $order_by = 'id', $order_by_direction = 'ASC')
|
||
{
|
||
// checks access control
|
||
if (!$this->acl_check_view(get_class($this),'members'))
|
||
Controller::Error(1);
|
||
// gets new selector
|
||
if (is_numeric($this->input->get('record_per_page')))
|
||
$limit_results = (int) $this->input->get('record_per_page');
|
||
|
||
// parameters control
|
||
$allowed_order_type = array('name', 'street', 'street_number', 'town', 'ZIP_code', 'qos_ceil', 'qos_rate', 'entrance_fee', 'debt_payment_rate', 'entrance_fee_left', 'must_pay_regular_fee', 'current_credit', 'entrance_date', 'comment');
|
||
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';
|
||
|
||
// creates member model
|
||
$model_members = new Member_Model();
|
||
|
||
/** @todo Co je toto za hrůza?? Klímo, jak toto může fungovat na instalaci Freenetisu,
|
||
* která je třeba v nějakém 3. podadresáři www root-a ??
|
||
*/
|
||
// unknown... what's this? to do - comment
|
||
$url_array = explode('/', trim(url::current(), '/'));
|
||
$sql_offset = (isset($url_array[7])) ? (int) ($url_array[7] - 1) * $limit_results : 0;
|
||
|
||
// gets debtors from database
|
||
$query = $model_members->get_debtors($sql_offset, (int)$limit_results, $order_by, $order_by_direction);
|
||
$total_members = $model_members->count_all_members();
|
||
|
||
unset($url_array);
|
||
$sql_offset = ($sql_offset>$total_members) ? 0 : $sql_offset;
|
||
|
||
$arr_gets = array();
|
||
foreach ($this->input->get() as $key=>$value) $arr_gets[] = $key.'='.$value;
|
||
$query_string = '?'.implode('&',$arr_gets);
|
||
|
||
$grid = new Grid(url_lang::base().'members', url_lang::lang('texts.Debtors'),array(
|
||
//'separator' => '<br />-----------',
|
||
//'use_paginator' => false,
|
||
//'use_selector' => false,
|
||
'current' => $limit_results, // current selected 'records_per_page' value
|
||
'selector_increace' => 500, // increace
|
||
'selector_min' => 500, // minimum where selector start
|
||
'selector_max_multiplier' => 10,
|
||
'base_url' => Config::item('locale.lang').'/members/show_all/'.$limit_results.'/'.$order_by.'/'.$order_by_direction ,
|
||
'uri_segment' => 'page', // pass a string as uri_segment to trigger former 'label' functionality
|
||
'total_items' => $total_members, // 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,
|
||
'query_string' => $query_string
|
||
));
|
||
|
||
$grid->order_field('id')->label('ID');
|
||
$grid->order_field('registration')->label(url_lang::lang('texts.Reg'))->bool(array(url_lang::lang('texts.No'),url_lang::lang('texts.Yes')))->class('center');
|
||
$grid->order_field('name')->label(url_lang::lang('texts.Name'));
|
||
$grid->order_field('street')->label(url_lang::lang('texts.Street'));
|
||
$grid->order_field('street_number')->label(url_lang::lang('texts.Street number'));
|
||
//$grid->order_field('phone')->label(url_lang::lang('texts.Phone'));
|
||
$grid->order_field('town')->label(url_lang::lang('texts.Town'));
|
||
if ($this->acl_check_view(get_class($this), 'members'))
|
||
$grid->action_field('id') ->label(url_lang::lang('texts.Member')) ->url(url_lang::base().'members/show') ->action(url_lang::lang('texts.Show'));
|
||
$grid->datasource($query);
|
||
|
||
$view = new View('template');
|
||
$view->header = new View('base/header');
|
||
$view->content = $grid;
|
||
$view->footer = new View('base/footer');
|
||
$view->header->menu = Controller::render_menu();
|
||
$view->header->title = url_lang::lang('texts.Debtors');
|
||
$view->render(TRUE);
|
||
} // end of debtors function
|
||
|
||
/**
|
||
* Adds new member to database. Creates special user assigned to this member.
|
||
* @return unknown_type
|
||
... | ... | |
$form->set_attr('class', 'form_class')->set_attr('method', 'post');
|
||
|
||
$form->group('')->label(url_lang::lang('texts.Basic informations'));
|
||
$form->input('membername')->label(url_lang::lang('texts.Members firstname and surname').':')->rules('required|length[3,60]');
|
||
$form->input('membername')->label(url_lang::lang('texts.Members surname and first name').':')->rules('required|length[3,60]');
|
||
$form->input('login')->label(url_lang::lang('texts.username').':')
|
||
->rules('required|length[3,50]')
|
||
->callback(array($this, 'valid_username'));
|
||
... | ... | |
$enum = new Enum_type_Model();
|
||
|
||
$account->type_id = $enum->get_type_id('credit');
|
||
$account->name = $form_data['membername'];
|
||
$account->name = $form_data['surname'].' '.$formdata['name'];
|
||
|
||
//if ($this->acl_check_new(get_class($this),'current_credit'))
|
||
// $account->start_amount = $form_data['current_credit'];
|
||
... | ... | |
{
|
||
$user_model=new User_Model();
|
||
$value = trim($input->value);
|
||
if(!ereg("^[0-9\.\+\/\-]{9,9}$",$value))
|
||
if(!ereg("^[0-9]{9,9}$",$value))
|
||
{
|
||
$input->add_error('required', url_lang::lang('texts.Bad phone format.'));
|
||
}
|
freenetis/trunk/kohana/application/controllers/installation.php | ||
---|---|---|
function valid_phone($input)
|
||
{
|
||
$value = trim($input->value);
|
||
if(!ereg("^[0-9\.\+\/\-]{9,9}$",$value))
|
||
if(!ereg("^[0-9]{9,9}$", $value))
|
||
{
|
||
$input->add_error('required', url_lang::lang('texts.Bad phone format.'));
|
||
}
|
freenetis/trunk/kohana/application/controllers/money_transfers.php | ||
---|---|---|
$grid->order_field('mtid','mt.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.From/To'));
|
||
$grid->order_field('account_number')->label(url_lang::lang('texts.Account number'));
|
||
$grid->order_field('amount')->label(url_lang::lang('texts.Amount'));
|
||
$grid->order_field('text')->label(url_lang::lang('texts.Text'));
|
||
$grid->order_field('datetime')->label(url_lang::lang('texts.Date and time'));
|
||
... | ... | |
$order_by = 'mt.id';
|
||
if (strtolower($order_by_direction) != 'asc' && strtolower($order_by_direction) != 'desc')
|
||
$order_by_direction = 'asc';
|
||
|
||
/*
|
||
$model_bank_transfer = new Money_transfer_bank_info_Model();
|
||
$total_transfers = $model_bank_transfer->count_unidentified_transfers();
|
||
$model_account= new Account_Model();
|
||
$model_account->find_by_type('master');
|
||
$acc_name = $model_account->name;
|
||
$acc_id = $model_account->id;
|
||
*/
|
||
|
||
$mt_model = new Money_transfer_Model();
|
||
$total_transfers = $mt_model->count_unidentified();
|
||
|
||
... | ... | |
$grid->order_field('account_number')->label(url_lang::lang('texts.Account number'));
|
||
$grid->field('text')->label(url_lang::lang('texts.Text'));
|
||
//$grid->action_field('mtid') ->label(url_lang::lang('texts.Details'))->url(url_lang::base().'accounts/unidentified_detail')->action(url_lang::lang('texts.Details'))->style('style="text-align:center;"');
|
||
$grid->action_field('mtid') ->label(url_lang::lang('texts.Payment'))->url(url_lang::base().'accounts/assign_transfer')->action(url_lang::lang('texts.Assign'));
|
||
$grid->action_field('mtid') ->label(url_lang::lang('texts.Payment'))->url(url_lang::base().'money_transfers/assign_transfer')->action(url_lang::lang('texts.Assign'));
|
||
$grid->datasource($transfers);
|
||
|
||
$view = new View('template');
|
||
... | ... | |
$view->header->menu = Controller::render_menu();
|
||
$view->header->title = url_lang::lang('texts.Unidentified transfers');
|
||
$view->render(TRUE);
|
||
/*
|
||
$view = new View('template');
|
||
$view->header = new View('base/header');
|
||
$view->content = new View('content', $data);
|
||
$view->content = new View('unidentified_transfers');
|
||
$view->content->acc_name = $acc_name;
|
||
$view->content->acc_id = $acc_id;
|
||
$view->content->member_id = $model_account->owner_id;
|
||
$view->content->message = $this->session->get_once('message');
|
||
$view->content->transfers = $this->template->content;
|
||
$view->footer = new View('base/footer');
|
||
$view->header->menu = Controller::render_menu();
|
||
$view->header->title = url_lang::lang('texts.Unidentified transfers');
|
||
$view->render(TRUE);
|
||
*/
|
||
} // end of unidentified_transfers function
|
||
|
||
function assign_transfer($trans_id = NULL)
|
||
{
|
||
// to do - access rights
|
||
//if (!$this->gacl_class->acl_check('freenetis', 'new_own', 'all', $_SESSION['username'],get_class($this),'assign_transfers')) Controller::error(1);
|
||
if (isset($trans_id))
|
||
{
|
||
$account_model = new Account_Model();
|
||
$accounts = $account_model->get_credit_accounts();
|
||
foreach ($accounts as $account)
|
||
{
|
||
$arr_accounts[$account->id] = $account->name;
|
||
}
|
||
asort($arr_accounts);
|
||
|
||
$mt_model = new Money_transfer_Model();
|
||
$mt = $mt_model->get_unidentified_transfer($trans_id);
|
||
|
||
$form = new Forge(url_lang::base().'money_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').':')->rules('required')->options($arr_accounts);
|
||
$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');
|
||
$form->submit('submit')->value(url_lang::lang('texts.Assign'));
|
||
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);
|
||
}
|
||
$new_mt = new Money_transfer_Model();
|
||
$new_mt->origin_id = $trans_id->destination_id;
|
||
$new_mt->destination_id = $form_data['aname'];
|
||
$new_mt->previous_transfer_id = $trans_id->id;
|
||
$new_mt->datetime = date("Y-m-d H:i:s", time());
|
||
$new_mt->text = $form_data['text'];
|
||
// this should be amount minus transfer fee
|
||
$new_mt->amount = $trans_id->amount;
|
||
// also penalty should be generated
|
||
|
||
if ($new_mt->save())
|
||
{
|
||
$this->session->set_flash('message', url_lang::lang('texts.Transfer has been successfully assigned.'));
|
||
url::redirect(url_lang::base().'money_transfers/unidentified_transfers');
|
||
}
|
||
}
|
||
|
||
$view = new View('template');
|
||
$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('money_transfers/assign');
|
||
$view->content->mt = $mt;
|
||
$view->content->form = $form->html();
|
||
$view->footer = new View('base/footer');
|
||
$view->render(TRUE);
|
||
|
||
// commented by Jiri Svitak
|
||
/*
|
||
if ($model_transfer->origin_id == $master_acc_id)
|
||
{
|
||
// odchozi platba
|
||
$form = new Forge(url_lang::base().'accounts/assign_transfer/'.$trans_id, '', 'POST', array('id' => 'article_form'));
|
||
|
||
$form->set_attr('class', 'form_class')->set_attr('method', 'post');
|
||
$form->dropdown('account')->label(url_lang::lang('texts.Pay from account').':')->rules('required')->options(array('0'=>'----- '.url_lang::lang('texts.Select the account').' -----','operating'=>url_lang::lang('texts.Operating account'),'infrastructure'=>url_lang::lang('texts.Infrastructure account')));
|
||
$form->textarea('comment')->label(url_lang::lang('texts.Comment').':')->rules('length[0,250]')->value($model_transfer->text);
|
||
special::required_forge_style($form, ' *', 'required');
|
||
$model_transfer->clear();
|
||
if($form->validate())
|
||
{
|
||
$form_data = $form->as_array();
|
||
foreach($form_data as $key => $value)
|
||
{
|
||
$form_data[$key] = htmlspecialchars($value);
|
||
}
|
||
$model_account->clear();
|
||
|
||
if ($form_data['account']=='operating')
|
||
{
|
||
$model_account->where('type=\'operating\'')->find();
|
||
$orig_id = $model_account->id;
|
||
}
|
||
else
|
||
{
|
||
$model_account->where('type=\'infrastructure\'')->find();
|
||
$orig_id = $model_account->id;
|
||
}
|
||
$model_account->clear();
|
||
$model_account->where('type=\'suppliers\'')->find();
|
||
$suppliers_id = $model_account->id;
|
||
|
||
|
||
$model_transfer->clear();
|
||
$model_transfer->origin_id = $orig_id;
|
||
$model_transfer->destination_id = $suppliers_id;
|
||
$model_transfer->text = $form_data['comment'];
|
||
$model_transfer->amount = $amount;
|
||
$model_transfer->previous_transfer_id = $trans_id;
|
||
$model_transfer->save();
|
||
|
||
$model_bank_transfer = new Money_transfer_bank_info_Model($bank_info_id);
|
||
//if (isset($fee_id)) $model_bank_transfer->fee_transfer_id = $fee_id;
|
||
$model_bank_transfer->identified = 1;
|
||
|
||
if ($model_bank_transfer->save())
|
||
{
|
||
$this->session->set_flash('message', url_lang::lang('texts.The transfer successfully done.'));
|
||
}
|
||
else
|
||
{
|
||
$this->session->set_flash('message', url_lang::lang('texts.Error - cant do the transfer.'));
|
||
}
|
||
// url::redirect(url_lang::base().'accounts/unidentified_transfers/', 'redirect');
|
||
header ("Location: ".url_lang::base().'accounts/unidentified_transfers/'."");
|
||
}
|
||
else
|
||
{
|
||
$view->form = new View('registration');
|
||
|
||
$view = new View('template');
|
||
$view->header = new View('base/header');
|
||
$view->content = new View('transfers_assign');
|
||
$view->footer = new View('base/footer');
|
||
$view->header->menu = Controller::render_menu();
|
||
$view->header->title = url_lang::lang('texts.Assign transfer');
|
||
$view->content->form = $form->html('forge/assign_outbound_transfer',TRUE);
|
||
$view->content->amount = $amount;
|
||
$view->content->trans_id = $trans_id;
|
||
|
||
//$view->content->acc_id = $acc_id;
|
||
|
||
$view->render(TRUE);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
// naplneni selectu
|
||
$arr_users = array();
|
||
$model_user = new User_Model;
|
||
$users = $model_user->select('member_id','name','surname','login')->orderby('surname, name')->where('type!=','user')->find_all();
|
||
$arr_users[0] = '----- '.url_lang::lang('texts.Select the member').' -----';
|
||
foreach ($users as $user) {
|
||
$arr_users[$user->member_id] = $user->surname.' '.$user->name.' - '.$user->login;
|
||
}
|
||
|
||
$arr_fee = array();
|
||
$model_fee = new Bank_fee_Model;
|
||
$fees = $model_fee->find_all();
|
||
$arr_fee[0] = url_lang::lang('texts.None');
|
||
foreach ($fees as $fee) {
|
||
$arr_fee[$fee->fee] = $fee->fee.' '.url_lang::lang('texts.CZK');
|
||
}
|
||
// konec naplneni selectu
|
||
|
||
$form = new Forge(url_lang::base().'accounts/assign_transfer/'.$trans_id, '', 'POST', array('id' => 'article_form'));
|
||
|
||
$form->set_attr('class', 'form_class')->set_attr('method', 'post');
|
||
$form->dropdown('username')->label(url_lang::lang('texts.Send to member').':')->options($arr_users)->onchange('ajax_get_accounts(this.value,0)')->callback(array($this, 'callback_username'));
|
||
$form->dropdown('account')->label(url_lang::lang('texts.Members account').':')->options(array('0'=>'----- '.url_lang::lang('texts.Select the account').' -----'))->callback(array($this, 'callback_account'));
|
||
$form->dropdown('fee_penalty')->label(url_lang::lang('texts.Penalty and fee').':')->options($arr_fee);
|
||
$form->textarea('fee_comment')->label(url_lang::lang('texts.Fee or penalty comment').':')->rules('length[0,250]');
|
||
$form->textarea('comment')->label(url_lang::lang('texts.Comment').':')->rules('length[0,250]')->value($model_transfer->text);
|
||
special::required_forge_style($form, ' *', 'required');
|
||
$model_transfer->clear();
|
||
|
||
if($form->validate())
|
||
{
|
||
$form_data = $form->as_array();
|
||
foreach($form_data as $key => $value)
|
||
{
|
||
$account_data->$key = htmlspecialchars($value);
|
||
}
|
||
$model_account->clear();
|
||
$model_account->where('type=\'operating\'')->find();
|
||
$operating_acc_id = $model_account->id;
|
||
|
||
if ((float)$form_data['fee_penalty']>0)
|
||
{
|
||
// do fee transfer
|
||
$model_transfer->origin_id = $form_data['account'];
|
||
$model_transfer->destination_id = $operating_acc_id;
|
||
$model_transfer->amount = (float)$form_data['fee_penalty'];
|
||
$model_transfer->text = $form_data['fee_comment'];
|
||
$model_transfer->previous_transfer_id = $trans_id;
|
||
$model_transfer->save();
|
||
}
|
||
|
||
$model_transfer->clear();
|
||
//$model_transfer->origin_id = $master_acc_id;
|
||
$model_transfer->bank_info_id = $bank_info_id;
|
||
$model_transfer->destination_id = $form_data['account'];
|
||
$model_transfer->text = $form_data['comment'];
|
||
$model_transfer->amount = $amount;
|
||
$model_transfer->previous_transfer_id = $trans_id;
|
||
$model_transfer->save();
|
||
|
||
$model_bank_transfer = new Money_transfer_bank_info_Model($bank_info_id);
|
||
//if (isset($fee_id)) $model_bank_transfer->fee_transfer_id = $fee_id;
|
||
$model_bank_transfer->identified = 1;
|
||
|
||
if ($model_bank_transfer->save())
|
||
{
|
||
$model_account->clear();
|
||
$model_account->find($form_data['account']);
|
||
if ($model_account->type=='analytic')
|
||
{
|
||
$model_members = new Member_Model($model_account->owner_id);
|
||
$model_members->current_credit = (float)$model_members->current_credit + (float)$amount-(float)$form_data['fee_penalty'];
|
||
$model_members->save();
|
||
}
|
||
$this->session->set_flash('message', url_lang::lang('texts.The transfer successfully done.'));
|
||
}
|
||
else
|
||
{
|
||
$this->session->set_flash('message', url_lang::lang('texts.Error - cant do the transfer.'));
|
||
}
|
||
url::redirect(url_lang::base().'accounts/unidentified_transfers/');
|
||
// header ("Location: ".url_lang::base().'accounts/unidentified_transfers/'."");
|
||
}
|
||
else
|
||
{
|
||
$view->form = new View('registration');
|
||
|
||
$view = new View('template');
|
||
$view->header = new View('base/header');
|
||
$view->content = new View('transfers_assign');
|
||
$view->footer = new View('base/footer');
|
||
$view->header->menu = Controller::render_menu();
|
||
$view->header->title = url_lang::lang('texts.Assign transfer');
|
||
$view->content->form = $form->html('forge/assign_transfer',TRUE);
|
||
$view->content->amount = $amount;
|
||
$view->content->trans_id = $trans_id;
|
||
|
||
//$view->content->acc_id = $acc_id;
|
||
|
||
$view->render(TRUE);
|
||
}
|
||
}
|
||
*/
|
||
}
|
||
else
|
||
{
|
||
Controller::warning(1);;
|
||
}
|
||
|
||
} // end of assign_transfer function
|
||
|
||
}
|
||
?>
|
freenetis/trunk/kohana/application/controllers/accounts.php | ||
---|---|---|
{
|
||
// it selects only bank accounts of association
|
||
$acc_model = new Account_Model();
|
||
// to do - simplification of enum types
|
||
$accs = $acc_model->get_assoc_bank_accounts();
|
||
$total_accs = count($accs);
|
||
|
||
... | ... | |
$view->render(TRUE);
|
||
}
|
||
|
||
// probably useless function
|
||
function trans_detail($transfer_id = NULL, $member_id = NULL)
|
||
{
|
||
if (isset($transfer_id) && isset($member_id))
|
||
... | ... | |
} // end of new_transfer function
|
||
|
||
|
||
function assign_transfer($trans_id = NULL)
|
||
{
|
||
if (!$this->gacl_class->acl_check('freenetis', 'new_own', 'all', $_SESSION['username'],get_class($this),'assign_transfers')) Controller::error(1);
|
||
if (isset($trans_id))
|
||
{
|
||
$model_account = new Account_Model();
|
||
$model_account->where('type=\'master\'')->find();
|
||
$master_acc_id = $model_account->id;
|
||
|
||
$model_transfer = new Money_transfer_Model($trans_id);
|
||
$amount = $model_transfer->amount;
|
||
$bank_info_id = $model_transfer->bank_info_id;
|
||
|
||
if ($model_transfer->origin_id == $master_acc_id)
|
||
{
|
||
// odchozi platba
|
||
$form = new Forge(url_lang::base().'accounts/assign_transfer/'.$trans_id, '', 'POST', array('id' => 'article_form'));
|
||
|
||
$form->set_attr('class', 'form_class')->set_attr('method', 'post');
|
||
$form->dropdown('account')->label(url_lang::lang('texts.Pay from account').':')->rules('required')->options(array('0'=>'----- '.url_lang::lang('texts.Select the account').' -----','operating'=>url_lang::lang('texts.Operating account'),'infrastructure'=>url_lang::lang('texts.Infrastructure account')));
|
||
$form->textarea('comment')->label(url_lang::lang('texts.Comment').':')->rules('length[0,250]')->value($model_transfer->text);
|
||
special::required_forge_style($form, ' *', 'required');
|
||
$model_transfer->clear();
|
||
if($form->validate())
|
||
{
|
||
$form_data = $form->as_array();
|
||
foreach($form_data as $key => $value)
|
||
{
|
||
$form_data[$key] = htmlspecialchars($value);
|
||
}
|
||
$model_account->clear();
|
||
|
||
if ($form_data['account']=='operating')
|
||
{
|
||
$model_account->where('type=\'operating\'')->find();
|
||
$orig_id = $model_account->id;
|
||
}
|
||
else
|
||
{
|
||
$model_account->where('type=\'infrastructure\'')->find();
|
||
$orig_id = $model_account->id;
|
||
}
|
||
$model_account->clear();
|
||
$model_account->where('type=\'suppliers\'')->find();
|
||
$suppliers_id = $model_account->id;
|
||
|
||
|
||
$model_transfer->clear();
|
||
$model_transfer->origin_id = $orig_id;
|
||
$model_transfer->destination_id = $suppliers_id;
|
||
$model_transfer->text = $form_data['comment'];
|
||
$model_transfer->amount = $amount;
|
||
$model_transfer->previous_transfer_id = $trans_id;
|
||
$model_transfer->save();
|
||
|
||
$model_bank_transfer = new Money_transfer_bank_info_Model($bank_info_id);
|
||
//if (isset($fee_id)) $model_bank_transfer->fee_transfer_id = $fee_id;
|
||
$model_bank_transfer->identified = 1;
|
||
|
||
if ($model_bank_transfer->save())
|
||
{
|
||
$this->session->set_flash('message', url_lang::lang('texts.The transfer successfully done.'));
|
||
}
|
||
else
|
||
{
|
||
$this->session->set_flash('message', url_lang::lang('texts.Error - cant do the transfer.'));
|
||
}
|
||
// url::redirect(url_lang::base().'accounts/unidentified_transfers/', 'redirect');
|
||
header ("Location: ".url_lang::base().'accounts/unidentified_transfers/'."");
|
||
}
|
||
else
|
||
{
|
||
$view->form = new View('registration');
|
||
|
||
$view = new View('template');
|
||
$view->header = new View('base/header');
|
||
$view->content = new View('transfers_assign');
|
||
$view->footer = new View('base/footer');
|
||
$view->header->menu = Controller::render_menu();
|
||
$view->header->title = url_lang::lang('texts.Assign transfer');
|
||
$view->content->form = $form->html('forge/assign_outbound_transfer',TRUE);
|
||
$view->content->amount = $amount;
|
||
$view->content->trans_id = $trans_id;
|
||
|
||
//$view->content->acc_id = $acc_id;
|
||
|
||
$view->render(TRUE);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
// naplneni selectu
|
||
$arr_users = array();
|
||
$model_user = new User_Model;
|
||
$users = $model_user->select('member_id','name','surname','login')->orderby('surname, name')->where('type!=','user')->find_all();
|
||
$arr_users[0] = '----- '.url_lang::lang('texts.Select the member').' -----';
|
||
foreach ($users as $user) {
|
||
$arr_users[$user->member_id] = $user->surname.' '.$user->name.' - '.$user->login;
|
||
}
|
||
|
||
$arr_fee = array();
|
||
$model_fee = new Bank_fee_Model;
|
||
$fees = $model_fee->find_all();
|
||
$arr_fee[0] = url_lang::lang('texts.None');
|
||
foreach ($fees as $fee) {
|
||
$arr_fee[$fee->fee] = $fee->fee.' '.url_lang::lang('texts.CZK');
|
||
}
|
||
// konec naplneni selectu
|
||
|
||
$form = new Forge(url_lang::base().'accounts/assign_transfer/'.$trans_id, '', 'POST', array('id' => 'article_form'));
|
||
|
||
$form->set_attr('class', 'form_class')->set_attr('method', 'post');
|
||
$form->dropdown('username')->label(url_lang::lang('texts.Send to member').':')->options($arr_users)->onchange('ajax_get_accounts(this.value,0)')->callback(array($this, 'callback_username'));
|
||
$form->dropdown('account')->label(url_lang::lang('texts.Members account').':')->options(array('0'=>'----- '.url_lang::lang('texts.Select the account').' -----'))->callback(array($this, 'callback_account'));
|
||
$form->dropdown('fee_penalty')->label(url_lang::lang('texts.Penalty and fee').':')->options($arr_fee);
|
||
$form->textarea('fee_comment')->label(url_lang::lang('texts.Fee or penalty comment').':')->rules('length[0,250]');
|
||
$form->textarea('comment')->label(url_lang::lang('texts.Comment').':')->rules('length[0,250]')->value($model_transfer->text);
|
||
special::required_forge_style($form, ' *', 'required');
|
||
$model_transfer->clear();
|
||
|
||
if($form->validate())
|
||
{
|
||
$form_data = $form->as_array();
|
||
foreach($form_data as $key => $value)
|
||
{
|
||
$account_data->$key = htmlspecialchars($value);
|
||
}
|
||
$model_account->clear();
|
||
$model_account->where('type=\'operating\'')->find();
|
||
$operating_acc_id = $model_account->id;
|
||
|
||
if ((float)$form_data['fee_penalty']>0)
|
||
{
|
||
// do fee transfer
|
||
$model_transfer->origin_id = $form_data['account'];
|
||
$model_transfer->destination_id = $operating_acc_id;
|
||
$model_transfer->amount = (float)$form_data['fee_penalty'];
|
||
$model_transfer->text = $form_data['fee_comment'];
|
||
$model_transfer->previous_transfer_id = $trans_id;
|
||
$model_transfer->save();
|
||
}
|
||
|
||
$model_transfer->clear();
|
||
//$model_transfer->origin_id = $master_acc_id;
|
||
$model_transfer->bank_info_id = $bank_info_id;
|
||
$model_transfer->destination_id = $form_data['account'];
|
||
$model_transfer->text = $form_data['comment'];
|
||
$model_transfer->amount = $amount;
|
||
$model_transfer->previous_transfer_id = $trans_id;
|
||
$model_transfer->save();
|
||
|
||
$model_bank_transfer = new Money_transfer_bank_info_Model($bank_info_id);
|
||
//if (isset($fee_id)) $model_bank_transfer->fee_transfer_id = $fee_id;
|
||
$model_bank_transfer->identified = 1;
|
||
|
||
if ($model_bank_transfer->save())
|
||
{
|
||
$model_account->clear();
|
||
$model_account->find($form_data['account']);
|
||
if ($model_account->type=='analytic')
|
||
{
|
||
$model_members = new Member_Model($model_account->owner_id);
|
||
$model_members->current_credit = (float)$model_members->current_credit + (float)$amount-(float)$form_data['fee_penalty'];
|
||
$model_members->save();
|
||
}
|
||
$this->session->set_flash('message', url_lang::lang('texts.The transfer successfully done.'));
|
||
}
|
||
else
|
||
{
|
||
$this->session->set_flash('message', url_lang::lang('texts.Error - cant do the transfer.'));
|
||
}
|
||
url::redirect(url_lang::base().'accounts/unidentified_transfers/');
|
||
// header ("Location: ".url_lang::base().'accounts/unidentified_transfers/'."");
|
||
}
|
||
else
|
||
{
|
||
$view->form = new View('registration');
|
||
|
||
$view = new View('template');
|
||
$view->header = new View('base/header');
|
||
$view->content = new View('transfers_assign');
|
||
$view->footer = new View('base/footer');
|
||
$view->header->menu = Controller::render_menu();
|
||
$view->header->title = url_lang::lang('texts.Assign transfer');
|
||
$view->content->form = $form->html('forge/assign_transfer',TRUE);
|
||
$view->content->amount = $amount;
|
||
$view->content->trans_id = $trans_id;
|
||
|
||
//$view->content->acc_id = $acc_id;
|
||
|
||
$view->render(TRUE);
|
||
}
|
||
}
|
||
}
|
||
else
|
||
{
|
||
Controller::warning(1);;
|
||
}
|
||
|
||
} // end of assign_transfer function
|
||
|
||
function unidentified_detail($trans_id = NULL)
|
||
{
|
||
if (!$this->gacl_class->acl_check('freenetis', 'new_own', 'all', $_SESSION['username'],get_class($this),'assign_transfers')) Controller::error(1);
|
||
... | ... | |
|
||
} // end of unidentified_detail function
|
||
|
||
// commented by Jiri Svitak
|
||
// moved to money_transfers controller and rewritten
|
||
/*
|
||
function unidentified_transfers($limit_results = 50, $order_by = 'timestamp', $order_by_direction = 'DESC')
|
||
{
|
||
if (!$this->acl_check_view(get_class($this), 'unidentified_transfers')) Controller::error(1);
|
||
// get new selector
|
||
if (is_numeric($this->input->get('record_per_page'))) $limit_results = (int) $this->input->get('record_per_page');
|
||
|
||
// parameters control
|
||
$allowed_order_type = array('mt.id', 'destination_id', 'timestamp', 'amount', 'variable_symbol', 'constant_symbol', 'specific_symbol', 'name', 'date_time', 'fee_transfer_id');
|
||
if (!in_array(strtolower($order_by),$allowed_order_type)) $order_by = 'mt.id';
|
||
if (strtolower($order_by_direction) != 'asc' && strtolower($order_by_direction) != 'desc') $order_by_direction = 'asc';
|
||
|
||
$model_bank_transfer = new Money_transfer_bank_info_Model();
|
||
|
||
$total_transfers = $model_bank_transfer->count_unidentified_transfers();
|
||
|
||
$model_account= new Account_Model();
|
||
$model_account->find_by_type('master');
|
||
$acc_name = $model_account->name;
|
||
$acc_id = $model_account->id;
|
||
|
||
$url_array = explode('/', trim(url::current(), '/'));
|
||
$sql_offset = (isset($url_array[7])) ? (int) ($url_array[7] - 1) * $limit_results : 0;
|
||
unset($url_array);
|
||
|
||
$sql_offset = ($sql_offset>$total_transfers) ? 0 : $sql_offset;
|
||
|
||
$transfers = $model_bank_transfer->get_unidentified_transfers($acc_id,$sql_offset, (int)$limit_results, $order_by, $order_by_direction);
|
||
|
||
|
||
|
||
|
||
$grid = new Grid(url_lang::base().'accounts', null,array(
|
||
'separator' => '<br />',
|
||
//'use_paginator' => false,
|
||
//'use_selector' => false,
|
||
'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/unidentified_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_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,
|
||
'order_by_direction' => $order_by_direction,
|
||
'limit_results' => $limit_results,
|
||
//'variables' => $acc_id.'/',
|
||
'url_array_ofset' => 0
|
||
),'unident_grid_template');
|
||
|
||
|
||
//$grid->add_new_button(url_lang::base().'accounts/new_transfer/'.$member_id, url_lang::lang('texts.New transfer'));
|
||
$grid->order_field('mtid','mt.id')->label('ID');
|
||
$grid->order_field('timestamp')->label(url_lang::lang('texts.Time'));
|
||
$grid->order_field('amount')->label(url_lang::lang('texts.Amount'))->style('style="width:80px;"');
|
||
$grid->order_field('variable_symbol')->label(url_lang::lang('texts.Variable symbol'));
|
||
$grid->order_field('name')->label(url_lang::lang('texts.Account name'));
|
||
$grid->field('text')->label(url_lang::lang('texts.Completive informations'));
|
||
|
||
$grid->action_field('mtid') ->label(url_lang::lang('texts.Details'))->url(url_lang::base().'accounts/unidentified_detail')->action(url_lang::lang('texts.Details'))->style('style="text-align:center;"');
|
||
$grid->action_field('mtid') ->label(url_lang::lang('texts.Assign transfer'))->url(url_lang::base().'accounts/assign_transfer')->action(url_lang::lang('texts.Assign'))->style('style="text-align:center;"');
|
||
|
||
$grid->datasource( $transfers );
|
||
$this->template->content = $grid;
|
||
|
||
unset($grid);
|
||
|
||
$view = new View('template');
|
||
$view->header = new View('base/header');
|
||
// $view->content = new View('content', $data);
|
||
$view->content = new View('unidentified_transfers');
|
||
$view->content->acc_name = $acc_name;
|
||
$view->content->acc_id = $acc_id;
|
||
$view->content->member_id = $model_account->owner_id;
|
||
$view->content->message = $this->session->get_once('message');
|
||
$view->content->transfers = $this->template->content;
|
||
$view->footer = new View('base/footer');
|
||
|
||
$view->header->menu = Controller::render_menu();
|
||
$view->header->title = url_lang::lang('texts.Unidentified transfers');
|
||
//$view->content->heading = "Úprava uživatele ".$data['row']['name']." ".$data['row']['surname'];
|
||
//$view->content->form = $form->html();
|
||
$view->render(TRUE);
|
||
|
||
} // end of unidentified_transfers function
|
||
*/
|
||
|
||
/***************************** SPECIAL AND AJAX FUNCTIONS ************************
|
||
**********************************************************************************
|
||
*********************HERE ARE FUNCTIONS FOR DIRECT GET ACCESS *******************/
|
freenetis/trunk/kohana/application/controllers/devices.php | ||
---|---|---|
unset($form_data);
|
||
//$device_model->save()
|
||
if ($device_saved && $device_engineer_saved) {
|
||
$this->session->set_flash('message', url_lang::lang('texts.Device is successfully saved.'));
|
||
$this->session->set_flash('message', url_lang::lang('texts.Device has been successfully saved.'));
|
||
//url::redirect(url_lang::base().'devices/show_all');
|
||
url::redirect(url_lang::base().'devices/show/'.$device_model->id);
|
||
exit;
|
||
... | ... | |
|
||
if ($device_model_saved )//&& $device_engineer_saved)
|
||
{
|
||
$this->session->set_flash('message', url_lang::lang('texts.Device is successfully updated.'));
|
||
$this->session->set_flash('message', url_lang::lang('texts.Device has been successfully updated.'));
|
||
url::redirect(url_lang::base().'devices/show/'.$device_model->id);
|
||
exit;
|
||
}
|
freenetis/trunk/kohana/application/libraries/MY_Controller.php | ||
---|---|---|
$acc_menu = '<li>'.html::anchor(url_lang::base().'works/uncorfirmed/', url_lang::lang('texts.Unconfirmed works')).'</li>';
|
||
|
||
if ($this->acl_check_2D('menu', 'unidentified_transfers'))
|
||
$acc_menu .= '<li>'.html::anchor(url_lang::base().'money_transfers/unidentified_transfers/', url_lang::lang('texts.Unidentified transfers')).'</li>';
|
||
$acc_menu .= '<li>'.html::anchor(url_lang::base().'money_transfers/unidentified_transfers/', url_lang::lang('texts.Unidentified transfers')).'</li>
|
||
<li>'.html::anchor(url_lang::base().'members/debtors/', url_lang::lang('texts.Debtors')).'</li>';
|
||
|
||
if ($this->acl_check_2D('menu', 'accounts'))
|
||
$acc_menu .= '<li>'.html::anchor(url_lang::base().'accounts/bank_accounts', url_lang::lang('texts.Bank accounts of association')).'</li>
|
freenetis/trunk/kohana/application/views/money_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; ?>
|
Také k dispozici: Unified diff
Pridan formular pro pridavani, ale nejde v nem validace. Rozdelano zobrazovani dluzniku, ale dotaz na dluzniky jsem jeste nerozchodil. Kdo ho opravi, ma u me ... treba diplom.
SELECT aid, mid, mname, mstreet, mtown, (
IFNULL , 0 ) - IFNULL
) AS credit
FROM (
SELECT SUM AS outbound, aid, mid, mname, mstreet, mtown
FROM (
SELECT a.id AS aid, m.id AS mid, m.name AS mname, m.street AS mstreet, m.town AS mtown
FROM members m
JOIN accounts a ON a.member_id = m.id
)sel1, money_transfers mt1
WHERE mt1.origin_id = sel1.aid
)sel2, money_transfers mt2
WHERE mt2.destination_id = sel2.aid
AND credit <0
ORDER BY id ASC
LIMIT 0 , 500