Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 1990

Přidáno uživatelem Ondřej Fibich před více než 11 roky(ů)

freenetis_1.1.0~alpha35\nNovinky:\ncloses #550: Bankovni ucty - vlastnosti

Zobrazit rozdíly:

freenetis/branches/1.1/application/controllers/bank_accounts.php
if ($this->acl_check_new('Accounts_Controller', 'bank_accounts'))
{
$baa_grid->add_new_button(
'bank_accounts/add/1', __('Add new bank account of association')
'bank_accounts/add/1', 'Add new bank account of association'
);
}
/*if ($this->acl_check_new('Accounts_controller', 'bank_transfers'))
{
$baa_grid->add_new_button(
'bank_accounts/fio_settings', __('Fio settings')
);
}*/
$baa_grid->field('id')
->label(__('ID'));
->label('ID');
$baa_grid->field('baname')
->label(__('Account name'));
->label('Account name');
$baa_grid->callback_field('type')
->callback('callback::bank_account_type');
$baa_grid->field('account_number');
$baa_grid->field('mname')
->label(__('Member name'));
->label('Member name');
$actions = $baa_grid->grouped_action_field();
......
if ($this->acl_check_new('Accounts_Controller', 'bank_transfers'))
{
$actions->add_action('id')
$actions->add_conditional_action('id')
->condition('is_import_of_statement_available')
->icon_action('import')
->url('import/upload_bank_file')
->label('Import');
}
if ($this->acl_check_edit('Accounts_Controller', 'bank_accounts'))
{
$actions->add_conditional_action('id')
->icon_action('edit')
->url('bank_accounts/edit');
}
$baa_grid->datasource($baa);
......
// adding bank account
if ($this->acl_check_new('Accounts_Controller', 'bank_accounts'))
{
$grid->add_new_button('bank_accounts/add', __('Add new bank account'));
$grid->add_new_button('bank_accounts/add', 'Add new bank account');
}
$grid->order_field('id')
->label('ID');
$grid->order_field('baname')
->label(__('Account name'));
->label('Account name');
$grid->order_field('account_nr')
->label(__('Account number'));
->label('Account number');
$grid->order_field('bank_nr')
->label(__('Bank code'));
->label('Bank code');
$grid->order_link_field('member_id')
->link('members/show', 'member_name')
->label(__('Member name'));
->label('Member name');
$actions = $grid->grouped_action_field();
......
* Function adds bank account.
* If member id 1 is specified, then it is new bank account of association.
*/
public function add($member_id = null)
public function add($member_id = NULL)
{
// access
if (!$this->acl_check_new('Accounts_Controller', 'bank_accounts'))
......
}
// form
if (!isset($member_id) || $member_id != 1)
if (!isset($member_id) || $member_id != Member_Model::ASSOCIATION)
{
// members list
$arr_members = ORM::factory('member')->select_list();
......
}
else
{
$form = new Forge("bank_accounts/add/$member_id");
$form = new Forge('bank_accounts/add/' . $member_id);
$form->dropdown('type')
->options(Bank_account_Model::get_type_names())
->style('width:200px');
}
$form->input('account_name')
->rules('required|length[3,50]');
$form->input('account_comment')
->label('Comment');
$form->input('account_nr')
->label('Account number')
->rules('required|length[3,50]|valid_numeric');
......
$member_id = $form_data["member_id"];
}
// determinig type
if ($member_id == Member_Model::ASSOCIATION)
{
$type = $form_data["type"];
}
else
{
$type = Bank_account_Model::TYPE_OTHER;
}
// real bank account
$bank_account = new Bank_account_Model();
$bank_account->name = $form_data["account_name"];
$bank_account->member_id = $member_id;
$bank_account->account_nr = $form_data["account_nr"];
$bank_account->bank_nr = $form_data["bank_nr"];
$bank_account->IBAN = $form_data["IBAN"];
$bank_account->SWIFT = $form_data["SWIFT"];
$bank_account->name = $form_data['account_name'];
$bank_account->member_id = $member_id;
$bank_account->type = $type;
$bank_account->account_nr = $form_data['account_nr'];
$bank_account->bank_nr = $form_data['bank_nr'];
$bank_account->IBAN = $form_data['IBAN'];
$bank_account->SWIFT = $form_data['SWIFT'];
$bank_account->save();
// only member 1 - association itself - has related double-entry accounts to added bank account
if ($member_id == 1)
......
// double-entry bank account
$doubleentry_bank_account = new Account_Model();
$doubleentry_bank_account->member_id = $member_id;
$doubleentry_bank_account->name = $form_data["account_name"];
$doubleentry_bank_account->name = $form_data['account_name'];
$doubleentry_bank_account->account_attribute_id = Account_attribute_Model::BANK;
$doubleentry_bank_account->comment = __('Bank accounts');
$doubleentry_bank_account->add($bank_account);
......
// double-entry account of bank fees
$bank_fees_account = new Account_Model();
$bank_fees_account->member_id = $member_id;
$bank_fees_account->name = $form_data["account_name"].' - '.__('Bank fees');
$bank_fees_account->name = $form_data['account_name'].' - '.__('Bank fees');
$bank_fees_account->account_attribute_id = Account_attribute_Model::BANK_FEES;
$bank_fees_account->comment = __('Bank fees');
$bank_fees_account->add($bank_account);
......
// double-entry account of bank interests
$bank_interests_account = new Account_Model();
$bank_interests_account->member_id = $member_id;
$bank_interests_account->name = $form_data["account_name"].' - '.__('Bank interests');
$bank_interests_account->name = $form_data['account_name'].' - '.__('Bank interests');
$bank_interests_account->account_attribute_id = Account_attribute_Model::BANK_INTERESTS;
$bank_interests_account->comment = __('Bank interests');
$bank_interests_account->add($bank_account);
......
$view->content = new View('form');
$view->content->headline = $headline;
$view->content->form = $form->html();
$view->render(TRUE);
$view->render(TRUE);
}
/**
* Settings for daily Fio imports.
* @author Jiri Svitak
/**
* Enables to edit bank account of association.
*
* @param integer $bank_account_id
*/
/*public fun ction fio_settings()
public function edit($bank_account_id = NULL)
{
// access control
if (!$this->acl_check_new('Accounts_Controller', 'bank_transfers'))
Controller::error(ACCESS);
// param
if (!intval($bank_account_id))
{
self::warning(PARAMETER);
}
// access
if (!$this->acl_check_edit('Accounts_Controller', 'bank_accounts'))
{
self::error(ACCESS);
}
$bank_account = new Bank_account_Model($bank_account_id);
// exists?
if (!$bank_account || !$bank_account->id ||
$bank_account->member_id != Member_Model::ASSOCIATION)
{
self::error(RECORD);
}
try
{
$ba_driver = Bank_Account_Settings::factory($bank_account->type);
$ba_driver->loadColumnData($bank_account->settings);
}
catch (InvalidArgumentException $e)
{
$ba_driver = NULL;
}
// form
$form = new Forge();
$form->group('Basic information');
$arr_bool = array
(
'1' => __('Yes'),
'0' => __('No')
);
// creating of new forge
$this->form = new Forge('bank_accounts/fio_settings');
$this->form->group('General settings');
$this->form->radio('fio_import_daily')
->label(__('Enable automatic Fio import').": ".
help::hint('fio_import_daily'))
->options($arr_bool)
->default(Settings::get('fio_import_daily'));
$this->form->input('fio_user')
->label(__('User') . ':')
->value(Settings::get('fio_user'));
$this->form->input('fio_password')
->label(__('Password') . ': '.
help::hint('fio_password'))
->value(Settings::get('fio_password'));
$this->form->input('fio_account_number')
->label(__('Account number') . ': '.
help::hint('fio_account_number'))
->value(Settings::get('fio_account_number'));
$this->form->input('fio_view_name')
->label(__('View name') . ': '.
help::hint('fio_view_name'))
->value(Settings::get('fio_account_number'));
$this->form->submit('submit')->value(__('Save'));
special::required_forge_style($this->form, ' *', 'required');
// form validate
if ($this->form->validate())
$form->dropdown('type')
->options(Bank_account_Model::get_type_names())
->selected($bank_account->type)
->style('width:200px');
$form->input('IBAN')
->value($bank_account->IBAN);
$form->input('SWIFT')
->value($bank_account->SWIFT);
// bank account settings
if ($ba_driver && count($ba_driver->getColumnFields()))
{
$form_data = $this->form->as_array(FALSE);
$issaved = true;
foreach ($form_data as $name => $value)
$form->group('Settings');
$columns = $ba_driver->getColumnFields();
foreach ($columns as $column => $info)
{
$issaved = $issaved && Settings::set($name, $value);
$input = $form->input($column)->value($ba_driver->$column);
if (isset($info['name']))
$input->label($info['name']);
if (isset($info['help']))
$input->help(help::hint($info['help']));
if (isset($info['rules']))
$input->rules($info['rules']);
}
}
// submit button
$form->submit('Edit');
// validation
if ($form->validate())
{
$form_data = $form->as_array();
// real bank account
$bank_account->type = $form_data['type'];
$bank_account->IBAN = $form_data['IBAN'];
$bank_account->SWIFT = $form_data['SWIFT'];
if ($ba_driver && count($ba_driver->getColumnFields()))
{
unset($form_data['type']);
unset($form_data['IBAN']);
unset($form_data['SWIFT']);
if ($issaved)
{ // if all action were succesfull
status::success('System variables have been successfully updated.');
foreach ($form_data as $key => $value)
{
$ba_driver->$key = $value;
}
$bank_account->settings = $ba_driver->getColumnData();
}
else
{ // if not
status::error('System variables havent been successfully updated.');
}
url::redirect('bank_accounts/fio_settings');
$bank_account->save();
// redirection
url::redirect('bank_accounts/show_all');
}
// create view for this template
$headline = __('Edit bank account');
// breadcrubs
$breadcrumbs = breadcrumbs::add()
->link('members/show/1', 'Profile of association',
$this->acl_check_view('Members_Controller', 'members'))
->link('bank_accounts/show_all', 'Bank accounts')
->disable_translation()
->text($bank_account->account_nr . '/' . $bank_account->bank_nr)
->text($headline)
->html();
// view
$view = new View('main');
$view->title = __('Fio settings');
$view->breadcrumbs = __('Fio settings');
$view->title = $headline;
$view->breadcrumbs = $breadcrumbs;
$view->content = new View('form');
$view->content->form = $this->form->html();
$view->content->headline = __('Fio settings');
$view->render(TRUE);
}*/
$view->content->headline = $headline;
$view->content->form = $form->html();
$view->render(TRUE);
}
}
freenetis/branches/1.1/application/controllers/import.php
*/
class Import_Controller extends Controller
{
// static constants of supported bank listing types
const HTML_RAIFFEISENBANK = 1;
const CSV_FIO = 2;
const CSV_UNICREDIT = 3;
/**
* Types of import documents (supported bank listings)
*
* @var array
*/
private static $file_types = array
(
Bank_account_Model::TYPE_RAIFFEISENBANK => 'HTML Raiffeisenbank',
Bank_account_Model::TYPE_FIO => 'Fio CSV',
Bank_account_Model::TYPE_UNICREDIT => 'Unicredit CSV'
);
private static $types = array();
/**
* Contruct - check if finance is enabled and upload dir is writable
*/
......
if (!Settings::get('finance_enabled'))
Controller::error(ACCESS);
// supported bank listings
self::$types = array();
self::$types[self::HTML_RAIFFEISENBANK] = 'HTML Raiffeisenbank';
self::$types[self::CSV_FIO] = 'Fio CSV';
self::$types[self::CSV_UNICREDIT] = 'Unicredit CSV';
if (!is_writable('upload'))
{
Controller::error(WRITABLE, __(
......
if ($bank_acc_model->id == 0)
Controller::error(RECORD);
try
{
$ba_drive = Bank_Account_Settings::factory($bank_acc_model->type);
$ba_drive->loadColumnData($bank_acc_model->settings);
}
catch (InvalidArgumentException $e)
{
$ba_drive = NULL;
}
if (!$ba_drive || !$ba_drive->canImportStatements())
Controller::error(RECORD);
// form
$form = new Forge('import/upload_bank_file/' . $id);
$form->group('File type');
$form->group(__('File') . ' - ' . self::$file_types[$bank_acc_model->type]);
$form->dropdown('type')
->label('File type')
->options(self::$types)
->rules('required')
->style('width:200px');
$form->upload('listing', TRUE)
->label('File with bank transfer listing')
->rules('required');
......
{
$form_data = $form->as_array();
switch ($form_data['type'])
switch ($bank_acc_model->type)
{
case self::HTML_RAIFFEISENBANK:
case Bank_account_Model::TYPE_RAIFFEISENBANK:
$this->import_ebank(
$id, $form->listing->value,
Settings::get('email_enabled') &&
......
@$form_data['reactivate_payment_notice_redir'] == 1
);
break;
case self::CSV_FIO:
case Bank_account_Model::TYPE_FIO:
$this->import_fio(
$id, $form->listing->value,
Settings::get('email_enabled') &&
......
@$form_data['reactivate_payment_notice_redir'] == 1
);
break;
case self::CSV_UNICREDIT:
case Bank_account_Model::TYPE_UNICREDIT:
$this->import_unicredit(
$id, $form->listing->value,
Settings::get('email_enabled') &&
......
$statement->set_logger(FALSE);
$statement->bank_account_id = $bank_account_id;
$statement->user_id = $this->session->get('user_id');
$statement->type = self::$types[self::CSV_FIO];
$statement->type = self::$file_types[Bank_account_Model::TYPE_FIO];
$statement->from = $header["from"];
$statement->to = $header["to"];
$statement->opening_balance = $header["opening_balance"];
......
$statement->set_logger(FALSE);
$statement->bank_account_id = $bank_account_id;
$statement->user_id = $this->session->get('user_id');
$statement->type = self::$types[self::HTML_RAIFFEISENBANK];
$statement->type = self::$file_types[Bank_account_Model::TYPE_RAIFFEISENBANK];
$statement->save_throwable();
RB_Importer::$bank_statement_id = $statement->id;
......
$statement->set_logger(FALSE);
$statement->bank_account_id = $bank_account_id;
$statement->user_id = $this->user_id;
$statement->type = self::$types[self::CSV_UNICREDIT];
$statement->type = self::$file_types[Bank_account_Model::TYPE_UNICREDIT];
$statement->from = $header['from'];
$statement->to = $header['to'];
$statement->save_throwable();
freenetis/branches/1.1/application/helpers/callback.php
}
/**
* Bank account type field.
*
* @param object $item
* @param string $name
*/
public static function bank_account_type($item, $name)
{
echo Bank_account_Model::get_type_name($item->$name);
}
/**
* Callback function to print rate of speed class
*
* @param object $item
freenetis/branches/1.1/application/helpers/condition.php
return ($item->type == Message_Model::USER_MESSAGE);
}
/**
* Checks whether the given bank account has capability for automatical
* sownload of bank statements.
*
* @param object $item
* @return boolean
*/
public static function is_automatical_down_of_statement_available($item)
{
try
{
$bas = Bank_Account_Settings::factory($item->type);
return $bas->canDownloadStatementsAutomatically();
}
catch (InvalidArgumentException $e)
{
return FALSE;
}
}
/**
* Checks whether the given bank account has capability for importing of
* bank statement.
*
* @param object $item
* @return boolean
*/
public static function is_import_of_statement_available($item)
{
try
{
$bas = Bank_Account_Settings::factory($item->type);
return $bas->canImportStatements();
}
catch (InvalidArgumentException $e)
{
return FALSE;
}
}
}
freenetis/branches/1.1/application/helpers/guid.php
*
* @author Jan Dubina
*/
class guid
{
public static function getGUID()
{
mt_srand((double) microtime() * 10000);
$charid = strtoupper(md5(uniqid(rand(), true)));
$hyphen = chr(45); // "-"
$uuid = substr($charid, 0, 8) . $hyphen
. substr($charid, 8, 4) . $hyphen
. substr($charid, 12, 4) . $hyphen
. substr($charid, 16, 4) . $hyphen
. substr($charid, 20, 12);
return $uuid;
}
class guid {
public static function getGUID() {
mt_srand((double)microtime()*10000);
$charid = strtoupper(md5(uniqid(rand(), true)));
$hyphen = chr(45);// "-"
$uuid = substr($charid, 0, 8).$hyphen
.substr($charid, 8, 4).$hyphen
.substr($charid,12, 4).$hyphen
.substr($charid,16, 4).$hyphen
.substr($charid,20,12);
return $uuid;
}
}
?>
freenetis/branches/1.1/application/i18n/cs_CZ/texts.php
'edit approval template' => 'Upravit hlasovací šablonu',
'edit approval template item' => 'Upravit položku hlasovací šablony',
'edit approval type' => 'Upravit hlasovací typ',
'edit bank account' => 'Upravit bankovní účet',
'edit bank template' => 'Upravit bankovní šablonu',
'edit cloud' => 'Upravit oblast',
'edit comment' => 'Upravit komentář',
......
'this subnet is disabled' => 'Tato podsíť je zakázána.',
'this subnet is enabled' => 'Tato podsíť je povolena.',
'this week traffic' => 'Provoz za tento týden',
'this token can be obtain in the administration of this bank account' => 'Tento token můžete získat v administraci tohoto bankovního účtu',
'time' => 'Čas',
'time constraints' => 'Časová omezení',
'time deposits' => 'Termínované vklady',
......
'title' => 'Titul',
'to' => 'Komu',
'to member' => 'Na člena',
'token for api' => 'Token pro API',
'today traffic' => 'Dnešní provoz',
'too short' => 'Příliš krátké',
'tools' => 'Nástroje',
freenetis/branches/1.1/application/libraries/Bank_Account_Settings.php
<?php defined('SYSPATH') or die('No direct script access.');
/*
* This file is part of open source system FreenetIS
* and it is released under GPLv3 licence.
*
* More info about licence can be found:
* http://www.gnu.org/licenses/gpl-3.0.html
*
* More info about project can be found:
* http://www.freenetis.org/
*
*/
/**
* Bank account settings enables to store different types of settings to
* bank account (e.g. API key) in order to type of the bank account.
*
* types of bank account are specified at Bank_Account_Model database entity.
*
* @author Ondrej Fibich
* @see Bank_Account_Model
*/
abstract class Bank_Account_Settings
{
/**
* Dir with driver classes
*/
const DIR = 'bank_account_settings';
// Type constants
/** Integer type */
const FIELD_TYPE_INT = 'integer';
/** String type */
const FIELD_TYPE_STRING = 'string';
/** Data of settings */
private $data = array();
/**
* Creates bank account setting for bank account with given type.
* If an new bank account type will be added, it must be added also
* to this method.
*
* @param integer $type type of bank account (from ORM model)
* @return BankAccountSettings An instance of driver
* @throws InvalidArgumentException On unknown type
*/
public static function factory($type)
{
// class path dir
$cp_dir = dirname(__FILE__) . '/' . self::DIR . '/';
// require class and return it
switch ($type)
{
case Bank_account_Model::TYPE_FIO:
require_once $cp_dir . 'Fio_Bank_Account_Settings.php';
return new Fio_Bank_Account_Settings();
case Bank_account_Model::TYPE_UNICREDIT:
require_once $cp_dir . 'Unicredit_Bank_Account_Settings.php';
return new Unicredit_Bank_Account_Settings();
case Bank_account_Model::TYPE_RAIFFEISENBANK:
require_once $cp_dir . 'Raiffeisenbank_Bank_Account_Settings.php';
return new Raiffeisenbank_Bank_Account_Settings();
}
// invalid type
throw new InvalidArgumentException('Unknown driver for type: ' . $type);
}
/**
* Can be bank statements automatically downloaded (using API) in this
* type of bank?
*
* @return boolean
*/
public abstract function canDownloadStatementsAutomatically();
/**
* Can be bank statements imported in this type of bank?
*
* @return boolean
*/
public abstract function canImportStatements();
/**
* Gets fields array (key is a name of field and value contains a another
* array with fields type, name, help, rules, etc.)
*
* @return array Fields array
*/
public abstract function getColumnFields();
/**
* Gets settings data in JSON format. This method is used for retrieving
* new value in order to store it into a database table.
*
* @return array Settings
*/
public function getColumnData()
{
return json_encode($this->data);
}
/**
* Loads data settings from a given JSON data.
*
* @param string JSON data
*/
public function loadColumnData($json)
{
// init columns
$columns = $this->getColumnFields();
foreach ($columns as $column => $type)
{
$this->data[$column] = NULL;
}
// laod values (only if not empty)
if (!empty($json))
{
$data = json_decode($json, TRUE);
if (!$data)
{
$m = 'Wrong data settings in the database: ' . $json;
throw new InvalidArgumentException($m);
}
foreach ($data as $column => $value)
{
$this->$column = $value; // call setter
}
}
}
/**
* Gets value from the column data.
*
* @param string $column Column name
* @throws InvalidArgumentException On invalid column
*/
public function __get($column)
{
$columns = $this->getColumnFields();
if (!array_key_exists($column, $columns))
{
throw new InvalidArgumentException('Column not founded: ' . $column);
}
return $this->data[$column];
}
/**
* Sets value from the column data.
*
* @param string $column Column name
* @param mixed $data
* @throws InvalidArgumentException On invalid column or invalid data format
*/
public function __set($column, $data)
{
$columns = $this->getColumnFields();
if (!array_key_exists($column, $columns))
{
throw new InvalidArgumentException('Column not founded: ' . $column);
}
if (!empty($data) && isset($columns[$column]['type']))
{
switch ($columns[$column]['type'])
{
case self::FIELD_TYPE_INT:
if (!preg_match('/^[0-9]+$/', $data))
{
$m = 'Invalid integer format: ' . data;
throw new InvalidArgumentException($m);
}
$data = intval($data);
break;
case self::FIELD_TYPE_STRING:
$data = strval($data);
break;
}
$this->data[$column] = $data;
}
else
{
$this->data[$column] = NULL;
}
}
}
freenetis/branches/1.1/application/libraries/bank_account_settings/Fio_Bank_Account_Settings.php
<?php defined('SYSPATH') or die('No direct script access.');
/*
* This file is part of open source system FreenetIS
* and it is released under GPLv3 licence.
*
* More info about licence can be found:
* http://www.gnu.org/licenses/gpl-3.0.html
*
* More info about project can be found:
* http://www.freenetis.org/
*
*/
/**
* Bank setting for FIO accounts.
*/
class Fio_Bank_Account_Settings extends Bank_Account_Settings
{
/*
* @Override
*/
public function canImportStatements()
{
return TRUE;
}
/*
* @Override
*/
public function canDownloadStatementsAutomatically()
{
return TRUE;
}
/*
* @Override
*/
public function getColumnFields()
{
return array
(
// API token
'api_token' => array
(
'name' => __('Token for API'),
'help' => __('This token can be obtain in the administration of this bank account'),
'type' => self::FIELD_TYPE_STRING,
)
);
}
}
freenetis/branches/1.1/application/libraries/bank_account_settings/Raiffeisenbank_Bank_Account_Settings.php
<?php defined('SYSPATH') or die('No direct script access.');
/*
* This file is part of open source system FreenetIS
* and it is released under GPLv3 licence.
*
* More info about licence can be found:
* http://www.gnu.org/licenses/gpl-3.0.html
*
* More info about project can be found:
* http://www.freenetis.org/
*
*/
/**
* Bank setting for Reiffeisenbank accounts.
*/
class Raiffeisenbank_Bank_Account_Settings extends Bank_Account_Settings
{
/*
* @Override
*/
public function canImportStatements()
{
return TRUE;
}
/*
* @Override
*/
public function canDownloadStatementsAutomatically()
{
return TRUE;
}
/*
* @Override
*/
public function getColumnFields()
{
return array();
}
}
freenetis/branches/1.1/application/libraries/bank_account_settings/Unicredit_Bank_Account_Settings.php
<?php defined('SYSPATH') or die('No direct script access.');
/*
* This file is part of open source system FreenetIS
* and it is released under GPLv3 licence.
*
* More info about licence can be found:
* http://www.gnu.org/licenses/gpl-3.0.html
*
* More info about project can be found:
* http://www.freenetis.org/
*
*/
/**
* Bank setting for UniCredit accounts.
*/
class Unicredit_Bank_Account_Settings extends Bank_Account_Settings
{
/*
* @Override
*/
public function canImportStatements()
{
return TRUE;
}
/*
* @Override
*/
public function canDownloadStatementsAutomatically()
{
return TRUE;
}
/*
* @Override
*/
public function getColumnFields()
{
return array();
}
}
freenetis/branches/1.1/application/models/bank_account.php
* @property integer $bank_nr
* @property string $IBAN
* @property string $SWIFT
* @property integer $type
* @property string $settings
* @property ORM_Iterator $accounts
*/
class Bank_account_Model extends ORM
{
// type of bank account (bank)
/** Other (unknown) bank account */
const TYPE_OTHER = 0;
/* FIO bank account */
const TYPE_FIO = 1;
/** Unicredit bank account */
const TYPE_UNICREDIT = 2;
/** Raiffeisenbank */
const TYPE_RAIFFEISENBANK = 3;
/**
* Type message names
*
* @var array
*/
private static $type_name = array
(
self::TYPE_OTHER => '',
self::TYPE_FIO => 'FIO',
self::TYPE_UNICREDIT => 'UniCredit',
self::TYPE_RAIFFEISENBANK => 'Raiffeisebank'
);
// db relations
protected $belongs_to = array('member');
protected $has_and_belongs_to_many = array('accounts');
/**
* Get settings driver for managing of bank account settings.
*
* @return BankAccountSettings
* @throws InvalidArgumentException On unsuported type of bank account
*/
public function getSettingsDriver()
{
$driver = Bank_Account_Settings::factory($this->type);
$driver->loadColumnData($this->settings);
return $driver;
}
/**
* Contruct of app, shutdown action logs by default
......
// disable action log
$this->set_logger(FALSE);
}
/**
* Types of bank account (key is type, value is name).
*
* @return array
*/
public static function get_type_names()
{
return self::$type_name;
}
/**
* Type of bank account type name.
*
* @return array
*/
public static function get_type_name($type)
{
if (isset(self::$type_name[$type]))
{
return self::$type_name[$type];
}
return self::NULL;
}
/**
* @author Tomas Dulik
......
{
return $this->db->query("
SELECT ba.id, ba.name AS baname, m.name AS mname,
CONCAT(ba.account_nr, '/', ba.bank_nr) AS account_number
CONCAT(ba.account_nr, '/', ba.bank_nr) AS account_number,
ba.type, ba.settings
FROM bank_accounts ba
LEFT JOIN members m ON m.id = ba.member_id
WHERE ba.member_id = 1
......
// query
return $this->db->query("
SELECT ba.id, ba.name AS baname, ba.account_nr, ba.bank_nr,
m.name AS member_name, ba.member_id
m.name AS member_name, ba.member_id, ba.type, ba.settings
FROM bank_accounts ba
LEFT JOIN members m ON m.id = ba.member_id
WHERE ba.member_id <> 1 $where
freenetis/branches/1.1/db_upgrades/upgrade_1.1.0~alpha35.php
<?php defined('SYSPATH') or die('No direct script access.');
/*
* This file is part of open source system FreenetIS
* and it is released under GPLv3 licence.
*
* More info about licence can be found:
* http://www.gnu.org/licenses/gpl-3.0.html
*
* More info about project can be found:
* http://www.freenetis.org/
*
*/
/**
* This upgrade is not equal to any of previos upgrades
*
* @author Ondřej Fibich <ondrej.fibich@gmail.com>
*/
$upgrade_equal_to['1.1.0~alpha35'] = array();
/**
* Columns for bank account settings.
*
* @author Ondřej Fibich <ondrej.fibich@gmail.com>
*/
$upgrade_sql['1.1.0~alpha35'] = array
(
"ALTER TABLE `bank_accounts` ADD `type` INT NOT NULL DEFAULT '0' AFTER `bank_nr`;",
"ALTER TABLE `bank_accounts` ADD `settings` TEXT NULL COMMENT 'JSON' AFTER `type`;"
);
freenetis/branches/1.1/system/views/kohana_error_page.php
<h1><?php echo Kohana::lang('core.Server error') ?></h1>
<p><?php echo Kohana::lang('core.Please report this error as bug using form below') ?>:</p>
<form action="<?php echo url_lang::base() ?>email/send_email_to_developers" class="form" method="post" style="margin-bottom: 20px">
<table cellspacing="4" class="form">
<table cellspacing="4" class="form" style="background: #F1F1F1">
<tr>
<td><label for="uname"><?php echo url_lang::lang('texts.Your name') ?>:</label></td>
<td><input type="text" name="uname" class="required" /></td>
freenetis/branches/1.1/version.php
* The current version of FreenetIS.
* This value must be changed by developers in a new release of FreenetIS.
*/
define('FREENETIS_VERSION', '1.1.0~alpha34');
define('FREENETIS_VERSION', '1.1.0~alpha35');

Také k dispozici: Unified diff