Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 1273

Přidáno uživatelem Jiří Sviták před asi 13 roky(ů)

zatim jeste nedoladene automaticke stahovani fio vypisu

Zobrazit rozdíly:

freenetis/branches/testing/application/i18n/cs_CZ/texts.php
'e-mail variables havent been successfully updated' => 'Proměnné e-mailu nebyly úspěšně aktualizovány.',
'e-mails' => 'E-maily',
'enable action logs' => 'Zapnout logy akcí',
'enable automatic fio import' => 'Povolit automatický import Fio',
'enable integrity test (all numbers in invoice has to be in extended statement)' => 'Povolit test na celistvost (každé číslo ve faktuře musí být v podrobném výpisu)',
'enable mysql event scheduler' => 'Povolit MySQL plánovač akcí',
'enable this subnet' => 'Povolit tuto podsíť',
......
'filter' => 'Filtrovat',
'finances' => 'Finance',
'financial state of member' => 'Finanční stav člena',
'fio settings' => 'Nastavení Fio',
'first-degree certified engineers' => 'Certifikovaní technici prvního stupně',
'first number can\'t be larger then second number' => 'První číslo nesmí být větší než druhé číslo',
'first or last day of month is not valid' => 'První nebo poslední den v měsíci není správně.',
......
'wireless setting has been successfully saved' => 'Bezdrátové nastavení bylo úspěšně uloženo.',
'wireless setting has been successfully updated' => 'Bezdrátové nastavení bylo úspěšně upraveno.',
'without inner transfers' => 'Bez vnitřních převodů',
'view name' => 'Název pohledu',
'voicemail data' => 'Údaje o hlasové schránce',
'voicemail has been successfully changed' => 'Hlasová schránka byla úspěšně změněna.',
'voip account' => 'VoIP účet',
freenetis/branches/testing/application/models/bank_statement.php
LIMIT " . intval($limit_from) . ", " . intval($limit_results) . "
", array($ba_id));
}
public function get_last_statement()
{
return $this->db->query("
SELECT * FROM bank_statements bs
ORDER BY bs.to ASC
LIMIT 1
");
}
}
freenetis/branches/testing/application/controllers/bank_accounts.php
'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('Show transfers');
}
if ($this->acl_check_new('Accounts_Controller', 'bank_statements'))
if ($this->acl_check_view('Accounts_Controller', 'bank_statements'))
{
$actions->add_action('id')
->icon_action('dumps')
......
$view->render(TRUE);
}
/**
* Settings for daily Fio imports.
* @author Jiri Svitak
*/
public function fio_settings()
{
// access control
if (!$this->acl_check_new('Accounts_Controller', 'bank_transfers'))
Controller::error(ACCESS);
$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') . ':')
->value(Settings::get('fio_password'));
$this->form->input('fio_account_number')
->label(__('Account number') . ':')
->value(Settings::get('fio_account_number'));
$this->form->input('fio_view_name')
->label(__('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_data = $this->form->as_array();
$config_model = new Config_Model();
$issaved = true;
foreach ($form_data as $name => $value)
{
$value = addslashes($value);
// check if variable exists
if ($config_model->check_exist_variable($name))
// update of variable
{
$issaved = $issaved && $config_model->update_variable($name,$value);
}
else
// insert new variable
{
$issaved = $issaved && $config_model->insert_variable($name,$value);
}
}
if ($issaved)
{ // if all action were succesfull
status::success('System variables have been successfully updated.');
}
else
{ // if not
status::error('System variables havent been successfully updated.');
}
url::redirect('bank_accounts/fio_settings');
}
// create view for this template
$view = new View('main');
$view->title = __('Fio settings');
$view->breadcrumbs = __('Fio settings');
$view->content = new View('form');
$view->content->form = $this->form->html();
$view->content->headline = __('Fio settings');
$view->render(TRUE);
}
}
freenetis/branches/testing/application/controllers/scheduler.php
*
*/
require_once APPPATH."libraries/importers/Fio/FioConnection.php";
require_once APPPATH."libraries/importers/Fio/FioConfig.php";
require_once APPPATH."libraries/importers/Fio/FioImport.php";
require_once APPPATH."libraries/importers/Fio/FioSaver.php";
/**
* Controller performs specified actions at specified time.
* This part of system has to be added to CRON.
......
// script needs to be run from its server machine
if (server::remote_addr() != server::server_addr())
{
echo "access denied";
die();
}
// update system lock status every day
// daily actions
if ((date('H:i') == '00:00'))
{
try
{
ORM::factory('member')->update_lock_status();
......
{
echo $e->__toString();
}
}
// manage logs
if ((date('H:i') == '00:00'))
{
try
{
if (Settings::get('action_logs_active') == '1')
......
{
echo $e->__toString();
}
/*
try
{
if (Settings::get('fio_import_daily') == '1')
{
self::fio_import_daily();
}
}
catch (Exception $e)
{
echo $e->getMessage();
}
*
*/
}
// update ulogd
try
{
if (Settings::get('ulogd_enabled'))
......
}
/**
* @author Jiri Svitak
*/
public static function fio_import_daily()
{
try
{
$db = new Transfer_Model();
$db->transaction_start();
$bs_model = new Bank_statement_Model();
$bs = $bs_model->get_last_statement();
if (count($bs) > 0)
{
$from = $bs->to;
}
else
{
$from = "2000-01-01";
}
$downloadConfig = new FioConfig(Settings::get("fio_user"),
Settings::get("fio_password"),
Settings::get("fio_account_number"),
Settings::get("fio_view_name"));
$connection = new FioConnection($downloadConfig);
$csvData = $connection->getCSV($fromDate, null);
$csvData = iconv('cp1250', 'UTF-8', $csvData);
$data = FioParser::parseCSV($csvData);
FioImport::correctData($data);
$header = FioImport::getListingHeader();
FioSaver($data);
$db->transaction_commit();
}
catch(Exception $e)
{
$db->transaction_rollback();
echo $e->getMessage();
}
}
/**
* Manage partitions of log table.
* Add partition for current day and removes 31 days old partition.
*

Také k dispozici: Unified diff