Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 240

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

Pridano zobrazovani transakci clena. Pridana moznost pridavani a mazani uctu clena, pozdeji zakomentovano. Analyticky ucet clena je vzdy jeden, ucty pro projekty se vyresi pozdeji, jeste by mozna bylo vhodne zobrazovat u clena jeho identifikovane bankovni ucty.

Zobrazit rozdíly:

freenetis/trunk/kohana/application/i18n/cs_CZ/texts.php
$lang = array
(
'access rights' => 'Přístupová práva',
'account' => 'Účet',
'account informations' => 'Informace o účtu',
'account successfully added' => 'Účet úspěšně přidán',
'account successfully updated' => 'Účet byl úspěšně upraven',
'account name' => 'Název účtu',
'account has been successfully added' => 'Účet byl úspěšně přidán.',
'account has been successfully updated' => 'Účet byl úspěšně upraven.',
'account transfers' => 'Transakce účtu',
'account type' => 'Typ účtu',
'accounts overview' => 'Přehled účtů',
'acount deleted' => 'Účet byl smazán',
'add new account' => 'Přidat nový účet',
'add new contact' => 'Přidat nový kontakt',
'add new credit account' => 'Přidat nový kreditní účet',
'add new device' => 'Přidat nové zařízení',
'add new device admin' => 'Přidat nového správce zařízení',
'add new device engineer' => 'Přidat nového technika zařízení',
......
'create new vlan interface' => 'Vytvoření nového VLAN rozhraní',
'create new vlan' => 'Vytvořit nový VLAN',
'create whole new device' => 'Vytvořit celé nové zařízení',
'credit accounts' => 'Kreditní účty',
'current credit' => 'Stav kreditu',
'current credit on this account is' => 'Stav kreditu na tomto účtu je',
'czk' => 'Kč',
......
'member have to own ONE double entry account' => 'Člen musí mít jeden podvojný účet',
'member successfully added' => 'Člen úspěšně přidán.',
'member successfully updated' => 'Člen úspěšně upraven.',
'member name' => 'Jméno člena (organizace)',
'members account' => 'Účet člena',
'member name' => 'Jméno člena (organizace)',
'members name' => 'Jméno člena (organizace)',
'members name' => 'Jméno člena (organizace)',
'members firstname and surname' => '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',
'membership interruption has been succesfully deleted' => 'Přerušení členství bylo úspěšně smazáno',
'membership interruption has been succesfully updated' => 'Přerušení členství bylo úspěšně aktualizováno',
......
'middle name' => 'Prostřední jméno',
'minimal duration of interrupt is one month' => 'Minimální délka přerušení je jeden měsíc',
'money transfers' => 'Převody peněz',
'money transfers of member' => 'Převody peněz člena',
'must be logged in' => 'Musíte se přihlásit.',
'must pay regular fee' => 'Platí pravidelný příspěvek',
'my profile' => 'Můj profil',
......
'send sms' => 'Pošli SMS',
'send to member' => 'Pošli členovi',
'show all transfers on the account' => 'Ukaž všechny transakce tohoto účtu',
'show account transfers' => 'Zobrazit transakce',
'show his transfers' => 'Zobrazit jeho transakce',
'show his devices' => 'Zobrazit jeho zařízení',
'show transfer' => 'ukaž transakci',
'show transfers on this account' => 'Ukaž transakce tohoto účtu',
freenetis/trunk/kohana/application/models/money_transfer.php
<?php
class Money_transfer_Model extends ORM {
class Money_transfer_Model extends ORM
{
/**
* Gets all money transfers of member's analytic account.
* @param $account_id
* @param $limit_from
* @param $limit_results
* @param $order_by
* @param $order_by_direction
* @return unknown_type
*/
public function get_transfers($account_id = null, $limit_from = 0, $limit_results = 20, $order_by = 'mt.id', $order_by_direction = 'DESC')
{
if ($order_by=='amount') $order_by = 'IF( mt.destination_id = '.$account_id.', amount, amount*-1 )';
if ($order_by == 'amount')
$order_by = 'IF( mt.destination_id = '.$account_id.', amount, amount*-1 )';
return self::$db->query('SELECT a.name AS aname, a.id AS aid, a.member_id, mt. * , mt.id AS mtid, IF( mt.destination_id = '.$account_id.', FALSE, TRUE ) AS trans_type
FROM money_transfers mt
LEFT JOIN accounts a ON a.id = IF( mt.origin_id = '.$account_id.', mt.destination_id, mt.origin_id )
......
{
return self::$db->query('SELECT mt.id AS mtid, mt.timestamp, mt.text, mt.amount,
bi.variable_symbol, bi.comment,
oa.name AS origin, oa.type AS origin_type,
oa.name AS origin,
CONCAT(oba.account_nr, "/", oba.bank_nr),
da.name AS destination, da.type AS destination_type,
da.name AS destination,
CONCAT(dba.account_nr, "/", dba.bank_nr)
FROM money_transfers mt
LEFT JOIN money_transfer_bank_infos bi
freenetis/trunk/kohana/application/controllers/members.php
$model_members = new Member_Model();
$member_data = $model_members->get_member($member_id)->current();
// print_r($member_data);
$model_translation = new Translation_Model();
$member_type = $model_translation->get_translation($member_data->member_type);
......
// $user_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').'\');"');;
$user_grid->datasource($users);
// membership interrupts - not finished
// membership interrupts
$mi_model = new Membership_interrupt_Model();
$mis = $mi_model->where('member_id', $member_id)->orderby('from')->find_all();
$mi_grid = new Grid(url_lang::base().'members', null, array(
......
$mi_grid->action_field('id') ->label(url_lang::lang('texts.Delete'))->url(url_lang::base().'membership_interrupts/delete')->action(url_lang::lang('texts.Delete'));
$mi_grid->datasource($mis);
// member has only one analytic account
// he should be able to add project accounts
// he should be able to see his bank accounts
/*
$acc_model = new Account_Model();
$accs = $acc_model->where('member_id', $member_id)->find_all();
$acc_grid = new Grid(url_lang::base().'members', null, array(
'separator' => '<br /><br />',
'use_paginator' => false,
'use_selector' => false,
'order_by' => $order_by,
'order_by_direction' => $order_by_direction,
'variables' => $member_id.'/'
));
// 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_credit_account/'.$member_id, url_lang::lang('texts.Add new credit account'));
$acc_grid->field('id')->label('ID');
$acc_grid->field('name')->label(url_lang::lang('texts.Account name'));
$acc_grid->field('comment')->label(url_lang::lang('texts.Comment'));
// to do - access rights
//if ($this->acl_check_edit(get_class($this), 'membership_interrupts', $member_id))
$acc_grid->action_field('id')->label(url_lang::lang('texts.Transfers'))->url(url_lang::base().'money_transfers/show_by_account')->action(url_lang::lang('texts.Show'));
//if ($this->acl_check_delete(get_class($this), 'membership_interrupts', $member_id))
$acc_grid->action_field('id') ->label(url_lang::lang('texts.Account'))->url(url_lang::base().'accounts/delete')->action(url_lang::lang('texts.Delete'));
$acc_grid->datasource($accs);
*/
// view for this
$view = new View('template');
$view->header = new View('base/header');
$view->content = new View('members_show');
......
$view->header->menu = Controller::render_menu();
$view->content->users = $user_grid;
$view->content->mis = $mi_grid;
// bank and projects accounts should be here
//$view->content->accs = $acc_grid;
foreach($member_data as $key=>$val)
{
// IE dont render TD border if content is NULL, so we must put nbsp into empty fields.
......
$account->type = 'analytic';
$account->name = $form_data['membername'];
if ($this->acl_check_new(get_class($this),'current_credit'))
$account->start_amount = $form_data['current_credit'];
$user->name = $form_data['name'];
$user->middle_name = $form_data['middle_name'];
$user->name = $form_data['name'];
$user->middle_name = $form_data['middle_name'];
$user->login = $form_data['login'];
$user->surname = $form_data['surname'];
$user->surname = $form_data['surname'];
$user->pre_title = $form_data['pre_title'];
$user->post_title = $form_data['post_title'];
$user->birthday = date("Y-m-d",$form_data['birthday']);
$user->phone = $form_data['phone'];
$user->email = $form_data['email'];
$user->password = sha1($form_data['passwd']);
$user->type = "member";
$user->type = "member";
$member->type = $form_data['type'];
$member->comment = $form_data['comment'];
$member->entrance_date = date("Y-m-d",$form_data['entrance_date']);
$member->name = $form_data['membername'];;
$member->street = $form_data['street'];
$member->street_number = $form_data['street_number'];
$member->type = $form_data['type'];
$member->comment = $form_data['comment'];
$member->entrance_date = date("Y-m-d",$form_data['entrance_date']);
$member->name = $form_data['membername'];;
$member->street = $form_data['street'];
$member->street_number = $form_data['street_number'];
$member->town = $form_data['town'];
$member->ZIP_code = $form_data['zip_code'];
$member->qos_ceil = $form_data['qos_ceil'];
$member->qos_rate = $form_data['qos_rate'];
$member->entrance_fee = $form_data['entrance_fee'];
$member->entrance_fee_left = $form_data['entrance_fee_left'];
$member->debt_payment_rate = $form_data['debt_payment_rate'];
$member->entrance_fee_left = $form_data['entrance_fee_left'];
$member->debt_payment_rate = $form_data['debt_payment_rate'];
if ($this->acl_check_new(get_class($this),'current_credit'))
$member->current_credit = $form_data['current_credit'];
freenetis/trunk/kohana/application/controllers/money_transfers.php
url::redirect(url_lang::base().'money_transfers/show_all');
}
/**
* Shows all items from money_transfers table.
* @param $limit_results
* @param $order_by
* @param $order_by_direction
* @return unknown_type
*/
function show_all($limit_results = 500, $order_by = 'id', $order_by_direction = 'ASC')
{
// to do - correct access control
......
$grid->order_field('destination')->label(url_lang::lang('texts.To'));
$grid->order_field('destination_type')->label(url_lang::lang('texts.Type'));
//$grid->order_field('previous_transfer_id')->label('Previous transfer id');
$grid->datasource($alltransfers);
$grid->datasource($alltransfers);
$this->template->content = $grid;
$view = new View('template');
$view->header = new View('base/header');
$view->content = $this->template->content;
$view->content = $grid;
$view->footer = new View('base/footer');
$view->header->menu = Controller::render_menu();
$view->header->title = url_lang::lang('texts.Money transfers');
//$view->content->heading = "Úprava uživatele ".$data['row']['name']." ".$data['row']['surname'];
//$view->content->form = $form->html();
$view->render(TRUE);
}
/**
* @author Jiri Svitak
* Shows transactions of member's analytic account.
* @param $account_id
* @return unknown_type
*/
function show_by_member($member_id = NULL, $limit_results = 50, $order_by = 'mt.id', $order_by_direction = 'DESC')
{
if (isset($member_id))
{
// to do - access control
//if(!$this->acl_check_view(get_class($this),'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');
$allowed_order_type = array('mt.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 = 'mt.id';
if (strtolower($order_by_direction) != 'asc' && strtolower($order_by_direction) != 'desc')
$order_by_direction = 'asc';
$member = new Member_Model($member_id);
$account_model = new Account_Model();
$account = $account_model->find_by_member_id($member_id);
$money_transfer_model = new Money_transfer_Model();
$total_transfers = $money_transfer_model->count_my_transfers($account->id);
$url_array = explode('/', trim(url::current(), '/'));
$sql_offset = (isset($url_array[8])) ? (int) ($url_array[8] - 1) * $limit_results : 0;
unset($url_array);
$sql_offset = ($sql_offset>$total_transfers) ? 0 : $sql_offset;
$transfers = $money_transfer_model->get_transfers($account->id,$sql_offset, (int)$limit_results, $order_by, $order_by_direction);
$grid = new Grid(url_lang::base().'money_transfers', url_lang::lang('texts.Money transfers of member').' '.$member->name, 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').'/money_transfers/show_by_member/'.$member_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
'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' => $member_id.'/',
'url_array_ofset' => 1
));//,'acc_grid_template');
//if($this->acl_check_new(get_class($this),'transfers',$member_id))
// $grid->add_new_button(url_lang::base().'accounts/new_transfer/'.$account->id, url_lang::lang('texts.New transfer'));
$grid->add_new_button(url_lang::base().'members/show/'.$member_id, url_lang::lang('texts.Back to the member'));
$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('amount')->label(url_lang::lang('texts.Amount'));
$grid->order_field('text')->label(url_lang::lang('texts.Text'));
$grid->order_field('timestamp')->label(url_lang::lang('texts.Date and time'));
$grid->datasource($transfers);
$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.Money transfers of member').' '.$member->name;
$view->render(TRUE);
}
else
{
Controller::warning(1);;
}
} // end of show_by_member function
}
?>
freenetis/trunk/kohana/application/controllers/accounts.php
} // end of account_transfers function
// commented by Jiri Svitak
// moved to Money_transfers controller and rewritten
/*
function transfers($member_id = NULL, $limit_results = 50, $order_by = 'mt.id', $order_by_direction = 'DESC')
{
if (isset($member_id))
......
unset($grid);
/* ****************** ZOBRAZENI VSECH PROJEKTOVYCH UCTU ******************/
// ****************** ZOBRAZENI VSECH PROJEKTOVYCH UCTU
$projects = $account_model->where('type','project')->find_all_by_member_id($member_id);
$arr_projects = array();
$i = 0;
......
/******************* KONEC PROJEKTOVYCH UCTU *****************************/
/******************* KONEC PROJEKTOVYCH UCTU ************************
......
}
} // end of transfers function
*/
function trans_detail($transfer_id = NULL, $member_id = NULL)
{
......
} // end of add function
/**
* @author Jiri Svitak
* Adds new credit account. Available from member's screen.
* @param $member_id
* @return unknown_type
*/
function add_credit_account($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_credit_account/'.$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 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)
{
if (!$this->gacl_class->acl_check('freenetis', 'edit_own', 'all', $_SESSION['username'],get_class($this),'edit_accounts')) Controller::error(1);
......
} // end of detail function
/**
* @author Jiri Svitak
* Deletes account. Available from member's screen.
* @param $acc_id
* @return unknown_type
*/
function delete($acc_id = NULL)
{
if (!$this->gacl_class->acl_check('freenetis', 'delete_own', 'all', $_SESSION['username'],get_class($this),'delete_accounts')) Controller::error(1);
// to do - access rights
//if (!$this->gacl_class->acl_check('freenetis', 'delete_own', 'all', $_SESSION['username'],get_class($this),'delete_accounts'))
// Controller::error(1);
if (isset($acc_id))
{
$model_account = new Account_Model($acc_id);
$owner = $model_account->owner_id;
$owner = $model_account->member_id;
$model_account->delete();
$this->session->set_flash('message', url_lang::lang('texts.Acount deleted.'));
url::redirect(url_lang::base().'accounts/transfers/'.(int)$owner);
url::redirect(url_lang::base().'members/show/'.(int)$owner);
}
else
{
Controller::warning(1);;
}
} // end of detail function
} // end of delete function
function new_transfer($account_id = NULL)
{
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().'accounts/transfers/'.$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().'money_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>';
......
$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 style="padding-bottom:8px;">'.html::anchor(url_lang::base().'accounts/unidentified_transfers/', url_lang::lang('texts.Unidentified transfers')).'</li>';
$acc_menu .= '<li>'.html::anchor(url_lang::base().'accounts/unidentified_transfers/', url_lang::lang('texts.Unidentified transfers')).'</li>';
if ($this->acl_check_2D('menu', 'accounts'))
$acc_menu .= '<li>'.html::anchor(url_lang::base().'accounts/main_accounts/master', url_lang::lang('texts.Bank account')).'</li>
freenetis/trunk/kohana/application/views/members_show.php
if (($member_data->member_id == $_SESSION['member_id'] && $this->gacl_class->acl_check('freenetis', 'view_own', 'all', $_SESSION['username'],'Devices_Controller','devices')) OR ($this->gacl_class->acl_check('freenetis', 'view_all', 'all', $_SESSION['username'],'Devices_Controller','devices')))
$links[] = html::anchor(url_lang::base().'devices/show_by_member/'.$member_data->member_id,url_lang::lang('texts.Show his devices'));
// to do - access rights
//if (($member_data->member_id == $_SESSION['member_id'] && $this->gacl_class->acl_check('freenetis', 'view_own', 'all', $_SESSION['username'],'Account_Controller','accounts')))
$links[] = html::anchor(url_lang::base().'money_transfers/show_by_member/'.$member_data->member_id,url_lang::lang('texts.Show his transfers'));
if (($member_data->member_id == $_SESSION['member_id'] && $this->gacl_class->acl_check('freenetis', 'view_own', 'all', $_SESSION['username'],'Accounts_Controller','transfers')))
$links[] = html::anchor(url_lang::base().'accounts/transfers/'.$member_data->member_id,url_lang::lang('texts.Show account transfers'));
echo implode (' | ', $links)
?>
<br />
......
</table>
<br class="clear" /><br />
<h3><?php echo url_lang::lang('texts.Users')?></h3>
<?php echo $users ?>
<br />
<h3><?php echo url_lang::lang('texts.Membership interrupts')?></h3>
<?php echo $mis ?>
<br />
<h3><?php // not credit accounts, there should be only bank and project accounts
// echo url_lang::lang('texts.Credit accounts')?></h3>
<?php // echo $accs ?>
<?php
echo $users.'<br>';
echo $mis;
?>

Také k dispozici: Unified diff