Revize 2143
Přidáno uživatelem David Raška před asi 11 roky(ů)
freenetis/branches/1.1/application/controllers/bank_templates.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 controller handles work with bank templates for CSV bank listing files.
|
||
*
|
||
* @author Jiri Svitak
|
||
* @package Controller
|
||
*/
|
||
class Bank_templates_Controller extends Controller
|
||
{
|
||
/**
|
||
* Constructor, only test if finance is enabled
|
||
*/
|
||
public function __construct()
|
||
{
|
||
parent::__construct();
|
||
|
||
if (!Settings::get('finance_enabled'))
|
||
Controller::error (ACCESS);
|
||
}
|
||
|
||
/**
|
||
* Index redirects to show all
|
||
*/
|
||
public function index()
|
||
{
|
||
url::redirect('bank_templates/show_all');
|
||
}
|
||
|
||
/**
|
||
* Shows all bank templates for CSV files.
|
||
*
|
||
* @param integer $limit_results
|
||
* @param string $order_by
|
||
* @param string $order_by_direction
|
||
* @param string $page_word
|
||
* @param integer $page
|
||
*/
|
||
public function show_all(
|
||
$limit_results = 200, $order_by = 'id', $order_by_direction = 'asc',
|
||
$page_word = null, $page = 1)
|
||
{
|
||
if (!$this->acl_check_view('Accounts_Controller', 'bank_transfers'))
|
||
Controller::Error(ACCESS);
|
||
|
||
// get new selector
|
||
if (is_numeric($this->input->post('record_per_page')))
|
||
$limit_results = (int) $this->input->post('record_per_page');
|
||
|
||
// get order of grid from parameters
|
||
$allowed_order_type = array('id', 'original_term', 'translated_term', 'lang');
|
||
|
||
if (!in_array(strtolower($order_by),$allowed_order_type))
|
||
$order_by = 'id';
|
||
|
||
if (strtolower($order_by_direction) != 'desc')
|
||
$order_by_direction = 'asc';
|
||
|
||
// get data from database
|
||
$model_templates = new Bank_template_Model();
|
||
$total_templates = $model_templates->count_all();
|
||
|
||
if (($sql_offset = ($page - 1) * $limit_results) > $total_templates)
|
||
$sql_offset = 0;
|
||
|
||
$templates = $model_templates->orderby($order_by, $order_by_direction)
|
||
->limit($limit_results, $sql_offset)
|
||
->find_all();
|
||
|
||
$headline = __('Bank templates of CSV files');
|
||
|
||
$grid = new Grid('translations', null, array
|
||
(
|
||
'use_paginator' => true,
|
||
'use_selector' => true,
|
||
'current' => $limit_results,
|
||
'selector_increace' => 200,
|
||
'selector_min' => 200,
|
||
'selector_max_multiplier' => 10,
|
||
'base_url' => Config::get('lang').'/bank_templates/show_all/'
|
||
. $limit_results.'/'.$order_by.'/'.$order_by_direction,
|
||
'uri_segment' => 'page',
|
||
'total_items' => $total_templates,
|
||
'items_per_page' => $limit_results,
|
||
'style' => 'classic',
|
||
'order_by' => $order_by,
|
||
'order_by_direction' => $order_by_direction,
|
||
'limit_results' => $limit_results
|
||
));
|
||
|
||
$grid->add_new_button('bank_templates/add', __('Add new template'));
|
||
|
||
$grid->order_field('id')
|
||
->label(__('ID'));
|
||
|
||
$grid->order_field('template_name');
|
||
|
||
$actions = $grid->grouped_action_field();
|
||
|
||
$actions->add_action()
|
||
->icon_action('show')
|
||
->url('bank_templates/show');
|
||
|
||
$actions->add_action()
|
||
->icon_action('edit')
|
||
->url('bank_templates/edit');
|
||
|
||
$grid->datasource($templates);
|
||
|
||
$breadcrumbs = breadcrumbs::add()
|
||
->link('bank_accounts/show_all', 'Bank accounts',
|
||
$this->acl_check_view('Accounts_Controller', 'bank_accounts'))
|
||
->text('Bank templates')
|
||
->html();
|
||
|
||
$view = new View('main');
|
||
$view->title = $headline;
|
||
$view->breadcrumbs = $breadcrumbs;
|
||
$view->content = new View('show_all');
|
||
$view->content->headline = $headline;
|
||
$view->content->table = $grid;
|
||
$view->render(TRUE);
|
||
}
|
||
|
||
/**
|
||
* Function shows bank template of csv file.
|
||
*
|
||
* @param integer $template_id
|
||
*/
|
||
public function show($template_id = null)
|
||
{
|
||
if (!isset($template_id))
|
||
{
|
||
Controller::warning(PARAMETER);
|
||
}
|
||
|
||
$template = new Bank_template_Model($template_id);
|
||
|
||
if ($template->id == 0)
|
||
{
|
||
Controller::error(RECORD);
|
||
}
|
||
|
||
if (!$this->acl_check_view('Accounts_Controller', 'bank_transfers'))
|
||
{
|
||
Controller::Error(ACCESS);
|
||
}
|
||
|
||
$headline = __('Show bank template');
|
||
|
||
$breadcrumbs = breadcrumbs::add()
|
||
->link('bank_accounts/show_all', 'Bank accounts',
|
||
$this->acl_check_view('Accounts_Controller', 'bank_accounts'))
|
||
->link('bank_templates/show_all', 'Bank templates',
|
||
$this->acl_check_view('Accounts_Controller', 'bank_transfers'))
|
||
->disable_translation()
|
||
->text($template->template_name . ' (' . $template->id . ')')
|
||
->html();
|
||
|
||
$view = new View('main');
|
||
$view->title = $headline;
|
||
$view->breadcrumbs = $breadcrumbs;
|
||
$view->content = new View('bank_templates/show');
|
||
$view->content->template = $template;
|
||
$view->content->headline = $headline;
|
||
$view->render(TRUE);
|
||
}
|
||
|
||
/**
|
||
* Function adds new bank template for csv files.
|
||
*/
|
||
public function add()
|
||
{
|
||
if (!$this->acl_check_new('Accounts_Controller', 'bank_transfers'))
|
||
Controller::Error(ACCESS);
|
||
|
||
$form = new Forge('bank_templates/add');
|
||
|
||
$form->input('template_name')
|
||
->rules('required|length[1,50]');
|
||
|
||
$form->input('item_separator')
|
||
->rules('required|length[1,1]')
|
||
->value(';');
|
||
|
||
$form->input('string_separator')
|
||
->rules('required|length[1,1]')
|
||
->value('"');
|
||
|
||
$form->group('Column headers');
|
||
|
||
$form->input('account_name')
|
||
->rules('required|length[1,30]');
|
||
|
||
$form->input('account_number')
|
||
->rules('required|length[1,30]');
|
||
|
||
$form->input('bank_code')
|
||
->rules('required|length[1,30]');
|
||
|
||
$form->input('constant_symbol')
|
||
->rules('required|length[1,30]');
|
||
|
||
$form->input('variable_symbol')
|
||
->rules('required|length[1,30]');
|
||
|
||
$form->input('specific_symbol')
|
||
->rules('required|length[1,30]');
|
||
|
||
$form->input('counteraccount_name')
|
||
->rules('required|length[1,30]');
|
||
|
||
$form->input('counteraccount_number')
|
||
->rules('required|length[1,30]');
|
||
|
||
$form->input('counteraccount_bank_code')
|
||
->rules('required|length[1,30]');
|
||
|
||
$form->input('text')
|
||
->rules('required|length[1,30]');
|
||
|
||
$form->input('amount')
|
||
->rules('required|length[1,30]');
|
||
|
||
$form->input('expenditure_earning')
|
||
->rules('length[1,30]');
|
||
|
||
$form->input('value_for_earning')
|
||
->rules('length[1,10]');
|
||
|
||
$form->input('datetime')
|
||
->label(__('Date and time').':')
|
||
->rules('required|length[1,30]');
|
||
|
||
$form->submit('Add');
|
||
|
||
if ($form->validate())
|
||
{
|
||
$form_data = $form->as_array();
|
||
|
||
$template = new Bank_template_Model();
|
||
|
||
foreach($form_data as $key => $value)
|
||
{
|
||
$template->$key = $value;
|
||
}
|
||
|
||
if ($template->save())
|
||
{
|
||
status::success('Template has been successfully added.');
|
||
url::redirect('bank_templates/show/'.$template->id);
|
||
}
|
||
else
|
||
{
|
||
status::error('Error - cant add new template.');
|
||
url::redirect('bank_templates/show_all');
|
||
}
|
||
}
|
||
else
|
||
{
|
||
$headline = __('Add new template');
|
||
|
||
$breadcrumbs = breadcrumbs::add()
|
||
->link('bank_accounts/show_all', 'Bank accounts',
|
||
$this->acl_check_view('Accounts_Controller', 'bank_accounts'))
|
||
->link('bank_templates/show_all', 'Bank templates',
|
||
$this->acl_check_view('Accounts_Controller', 'bank_transfers'))
|
||
->disable_translation()
|
||
->text($headline)
|
||
->html();
|
||
|
||
$view = new View('main');
|
||
$view->title = __('Add new template');
|
||
$view->breadcrumbs = $breadcrumbs;
|
||
$view->content = new View('form');
|
||
$view->content->headline = __('Add new template');
|
||
$view->content->form = $form->html();
|
||
$view->render(TRUE);
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Function edits bank template for csv files.
|
||
*/
|
||
public function edit($template_id = null)
|
||
{
|
||
if (!isset($template_id))
|
||
{
|
||
Controller::warning(PARAMETER);
|
||
}
|
||
|
||
$template = new Bank_template_Model($template_id);
|
||
|
||
if ($template->id == 0)
|
||
{
|
||
Controller::error(RECORD);
|
||
}
|
||
|
||
if (!$this->acl_check_edit('Accounts_Controller', 'bank_transfers'))
|
||
{
|
||
Controller::Error(ACCESS);
|
||
}
|
||
|
||
$form = new Forge('bank_templates/edit/'.$template_id);
|
||
|
||
$form->group('Basic information');
|
||
|
||
$form->input('template_name')
|
||
->rules('required|length[1,50]')
|
||
->value($template->template_name);
|
||
|
||
$form->input('item_separator')
|
||
->rules('required|length[1,1]')
|
||
->value($template->item_separator);
|
||
|
||
$form->input('string_separator')
|
||
->rules('required|length[1,1]')
|
||
->value($template->string_separator);
|
||
|
||
$form->group('')
|
||
->label(__('Column headers'));
|
||
|
||
$form->input('account_name')
|
||
->rules('required|length[1,30]')
|
||
->value($template->account_name);
|
||
|
||
$form->input('account_number')
|
||
->rules('required|length[1,30]')
|
||
->value($template->account_number);
|
||
|
||
$form->input('bank_code')
|
||
->rules('required|length[1,30]')
|
||
->value($template->bank_code);
|
||
|
||
$form->input('constant_symbol')
|
||
->rules('required|length[1,30]')
|
||
->value($template->constant_symbol);
|
||
|
||
$form->input('variable_symbol')
|
||
->rules('required|length[1,30]')
|
||
->value($template->variable_symbol);
|
||
|
||
$form->input('specific_symbol')
|
||
->rules('required|length[1,30]')
|
||
->value($template->specific_symbol);
|
||
|
||
$form->input('counteraccount_name')
|
||
->rules('required|length[1,30]')
|
||
->value($template->counteraccount_name);
|
||
|
||
$form->input('counteraccount_number')
|
||
->rules('required|length[1,30]')
|
||
->value($template->counteraccount_number);
|
||
|
||
$form->input('counteraccount_bank_code')
|
||
->rules('required|length[1,30]')
|
||
->value($template->counteraccount_bank_code);
|
||
|
||
$form->input('text')
|
||
->rules('required|length[1,30]')
|
||
->value($template->text);
|
||
|
||
$form->input('amount')
|
||
->rules('required|length[1,30]')
|
||
->value($template->amount);
|
||
|
||
$form->input('expenditure_earning')
|
||
->label(__('Expenditure-earning').':')
|
||
->rules('length[1,30]')
|
||
->value($template->expenditure_earning);
|
||
|
||
$form->input('value_for_earning')
|
||
->rules('length[1,10]')
|
||
->value($template->value_for_earning);
|
||
|
||
$form->input('datetime')
|
||
->label(__('Date and time').':')
|
||
->rules('required|length[1,30]')
|
||
->value($template->datetime);
|
||
|
||
$form->submit('Edit');
|
||
|
||
if ($form->validate())
|
||
{
|
||
$form_data = $form->as_array(FALSE);
|
||
|
||
foreach($form_data as $key => $value)
|
||
{
|
||
if ($key != 'string_separator')
|
||
$template->$key = htmlspecialchars($value);
|
||
else
|
||
$template->$key = $value;
|
||
}
|
||
|
||
if ($template->save())
|
||
{
|
||
status::success('Template has been successfully updated.');
|
||
url::redirect('bank_templates/show/'.$template->id);
|
||
}
|
||
else
|
||
{
|
||
status::error('Error - cant update template.');
|
||
url::redirect('bank_templates/show/'.$template->id);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
$headline = __('Edit bank template');
|
||
|
||
$breadcrumbs = breadcrumbs::add()
|
||
->link('bank_accounts/show_all', 'Bank accounts',
|
||
$this->acl_check_view('Accounts_Controller', 'bank_accounts'))
|
||
->link('bank_templates/show_all', 'Bank templates',
|
||
$this->acl_check_view('Accounts_Controller', 'bank_transfers'))
|
||
->link('bank_templates/show/' . $template_id,
|
||
$template->template_name . ' (' . $template->id . ')')
|
||
->disable_translation()
|
||
->text($headline)
|
||
->html();
|
||
|
||
$view = new View('main');
|
||
$view->title = $headline;
|
||
$view->breadcrumbs = $breadcrumbs;
|
||
$view->content = new View('form');
|
||
$view->content->headline = $headline;
|
||
$view->content->form = $form->html();
|
||
$view->render(TRUE);
|
||
}
|
||
}
|
||
}
|
freenetis/branches/1.1/application/controllers/members.php | ||
---|---|---|
// has member active membership interrupt?
|
||
$active_interrupt = ORM::factory('membership_interrupt')
|
||
->has_member_interrupt_in_date($member->id, date('Y-m-d'));
|
||
|
||
$end_membership = ORM::factory('membership_interrupt')
|
||
->has_member_end_after_interrupt_end_in_date($member->id, date('Y-m-d'));
|
||
|
||
$flags = array();
|
||
|
||
if ($active_interrupt)
|
||
{
|
||
$flags[] = __('I');
|
||
}
|
||
|
||
if ($end_membership)
|
||
{
|
||
$flags[] = __('E');
|
||
}
|
||
|
||
$title = ($active_interrupt) ? $type . ' '.$member->name
|
||
. ' ('. __('I') .')' : $type . ' '.$member->name;
|
||
$title = ($flags) ? $type . ' '.$member->name
|
||
. ' ('. implode(' + ', $flags) .')' : $type . ' '.$member->name;
|
||
|
||
if ($is_applicant &&
|
||
condition::is_applicant_registration($member) &&
|
||
... | ... | |
|
||
$membership_interrupts_grid->field('to')
|
||
->label(__('Date to'));
|
||
|
||
$membership_interrupts_grid->callback_field('end_after_interrupt_end')
|
||
->callback('callback::boolean')
|
||
->class('center')
|
||
->label('End membership after end');
|
||
|
||
$membership_interrupts_grid->field('comment');
|
||
|
||
... | ... | |
if (!$is_former)
|
||
{
|
||
// end membership link
|
||
if ($this->acl_check_edit(get_class($this), 'members'))
|
||
if ($this->acl_check_edit(get_class($this), 'members') &&
|
||
!$end_membership)
|
||
{
|
||
$member_links[] = html::anchor(
|
||
'members/end_membership/'.$member->id,
|
||
... | ... | |
Controller::error(RECORD);
|
||
|
||
// access control
|
||
if (!$this->acl_check_edit(get_class($this), 'members', $member->id))
|
||
if ($member->type == Member_Model::TYPE_FORMER ||
|
||
!$this->acl_check_edit(get_class($this), 'members', $member->id))
|
||
Controller::error(ACCESS);
|
||
|
||
$this->_member_id = $member->id;
|
||
... | ... | |
|
||
$member = new Member_Model($member_id);
|
||
|
||
$end_membership = ORM::factory('membership_interrupt')
|
||
->has_member_end_after_interrupt_end_in_date($member->id, date('Y-m-d'));
|
||
|
||
// wrong id
|
||
if (!$member->id)
|
||
Controller::error(RECORD);
|
||
... | ... | |
if (!$this->acl_check_edit(get_class($this), 'members', $member_id))
|
||
Controller::error(ACCESS);
|
||
|
||
if ($end_membership)
|
||
{
|
||
status::warning('Cannot end membership when interrupt with end membership is activated.');
|
||
$this->redirect('members/show/', $member->id);
|
||
}
|
||
|
||
// cannot end membership to association (#725)
|
||
if ($member->id == Member_Model::ASSOCIATION)
|
||
{
|
||
... | ... | |
Controller::error(RECORD);
|
||
|
||
// acess
|
||
if (!$this->acl_check_edit(get_class($this), 'members', $member_id))
|
||
if ($member->type != Member_Model::TYPE_FORMER ||
|
||
!$this->acl_check_edit(get_class($this), 'members', $member_id))
|
||
Controller::error(ACCESS);
|
||
|
||
try
|
freenetis/branches/1.1/application/controllers/membership_interrupts.php | ||
---|---|---|
// saving id for callback function
|
||
$this->members_fee_id = NULL;
|
||
|
||
$arr_members[$member->id] = $member->name;
|
||
|
||
$this->form = new Forge('membership_interrupts/add/'.$member->id);
|
||
|
||
$this->form->group('Basic data');
|
||
|
||
$this->form->dropdown('member_id')
|
||
->label('Member')
|
||
->options($arr_members)
|
||
->rules('required')
|
||
->style('width: 350px');
|
||
if ($member->type != Member_Model::TYPE_FORMER)
|
||
{
|
||
$this->form->checkbox('end_after_interrupt_end')
|
||
->label('End membership after end of interrupt')
|
||
->callback(array($this, 'valid_end_after_interrupt_end'));
|
||
}
|
||
|
||
$this->form->date('from')
|
||
->label('Date from')
|
||
... | ... | |
try
|
||
{
|
||
$membership_interrupt = new Membership_interrupt_Model();
|
||
|
||
|
||
$membership_interrupt->transaction_start();
|
||
|
||
|
||
$from = date('Y-m-d', $form_data['from']);
|
||
$to = date('Y-m-d', $form_data['to']);
|
||
|
||
... | ... | |
$fee = $fee_model->get_by_special_type(Fee_Model::MEMBERSHIP_INTERRUPT);
|
||
|
||
$members_fee = new Members_fee_Model();
|
||
$members_fee->member_id = $form_data['member_id'];
|
||
$members_fee->member_id = $member->id;
|
||
$members_fee->fee_id = $fee->id;
|
||
$members_fee->activation_date = $from;
|
||
$members_fee->deactivation_date = $to;
|
||
$members_fee->priority = 0;
|
||
|
||
$members_fee->save_throwable();
|
||
|
||
$membership_interrupt->member_id = $form_data['member_id'];
|
||
|
||
$membership_interrupt->member_id = $member->id;
|
||
$membership_interrupt->members_fee_id = $members_fee->id;
|
||
$membership_interrupt->comment = $form_data['comment'];
|
||
|
||
if (isset($form_data['end_after_interrupt_end']) &&
|
||
$form_data['end_after_interrupt_end'] == '1' &&
|
||
$member->type != Member_Model::TYPE_FORMER)
|
||
{
|
||
$membership_interrupt->end_after_interrupt_end = 1;
|
||
|
||
// leaving date is validated by validator
|
||
$member->leaving_date = $to;
|
||
|
||
$member->save_throwable();
|
||
}
|
||
else
|
||
{
|
||
$membership_interrupt->end_after_interrupt_end = 0;
|
||
}
|
||
|
||
$membership_interrupt->save_throwable();
|
||
|
||
|
||
if (Settings::get('finance_enabled'))
|
||
{
|
||
Accounts_Controller::recalculate_member_fees(
|
||
$member->get_credit_account()->id
|
||
);
|
||
}
|
||
|
||
|
||
ORM::factory('member')->reactivate_messages($member->id);
|
||
|
||
|
||
// begin of redirection today? => notify member
|
||
if (module::e('notification') &&
|
||
date('Y-m-d') == $members_fee->activation_date)
|
||
... | ... | |
NULL, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE
|
||
);
|
||
}
|
||
|
||
|
||
$membership_interrupt->transaction_commit();
|
||
|
||
|
||
status::success('Membership interrupt has been succesfully added');
|
||
}
|
||
catch (Exception $e)
|
||
... | ... | |
Log::add_exception($e);
|
||
status::success('Membership interrupt has not been succesfully added');
|
||
}
|
||
|
||
|
||
$this->redirect('members/show/'.$member_id);
|
||
|
||
}
|
||
... | ... | |
// find object with id to edit
|
||
$membership_interrupt = new Membership_interrupt_Model($membership_interrupt_id);
|
||
|
||
$member = new Member_Model($membership_interrupt->member_id);
|
||
|
||
// if object with this id doesn't exist
|
||
if ($membership_interrupt->id == 0)
|
||
Controller::error(RECORD);
|
||
... | ... | |
{
|
||
Controller::Error(ACCESS);
|
||
}
|
||
|
||
$arr_members[$membership_interrupt->member->id] = $membership_interrupt->member->name;
|
||
|
||
// form
|
||
$this->form = new Forge();
|
||
|
||
$this->form->group('Basic data');
|
||
|
||
$this->form->dropdown('member_id')
|
||
->label('Member')
|
||
->options($arr_members)
|
||
->rules('required')
|
||
->selected($membership_interrupt->member_id)
|
||
->style('width:350px');
|
||
if ($member->type != Member_Model::TYPE_FORMER)
|
||
{
|
||
$this->form->checkbox('end_after_interrupt_end')
|
||
->label('End membership after end of interrupt')
|
||
->callback(array($this, 'valid_end_after_interrupt_end'))
|
||
->checked($membership_interrupt->end_after_interrupt_end);
|
||
}
|
||
|
||
$this->form->date('from')
|
||
->label('Date from (first day in month)')
|
||
... | ... | |
if ($this->form->validate())
|
||
{
|
||
$form_data = $this->form->as_array();
|
||
|
||
|
||
try
|
||
{
|
||
$membership_interrupt->transaction_start();
|
||
... | ... | |
$from = date('Y-m-d', $form_data['from']);
|
||
$to = date('Y-m-d', $form_data['to']);
|
||
|
||
$membership_interrupt->member_id = $form_data['member_id'];
|
||
$membership_interrupt->comment = $form_data['comment'];
|
||
|
||
if (isset($form_data['end_after_interrupt_end']) &&
|
||
$form_data['end_after_interrupt_end'] == '1')
|
||
{
|
||
$membership_interrupt->end_after_interrupt_end = 1;
|
||
|
||
if ($member->leaving_date < date('Y-m-d'))
|
||
{
|
||
// leaving date is validated by validator
|
||
$member->leaving_date = $to;
|
||
|
||
$member->save_throwable();
|
||
}
|
||
}
|
||
else if (isset($form_data['end_after_interrupt_end']) &&
|
||
$form_data['end_after_interrupt_end'] == '0')
|
||
{
|
||
$membership_interrupt->end_after_interrupt_end = 0;
|
||
|
||
if ($member->leaving_date < date('Y-m-d'))
|
||
{
|
||
$member->leaving_date = NULL;
|
||
|
||
$member->save_throwable();
|
||
}
|
||
}
|
||
else
|
||
{
|
||
$membership_interrupt->end_after_interrupt_end = 0;
|
||
}
|
||
|
||
$membership_interrupt->save_throwable();
|
||
|
||
$members_fee = new Members_fee_Model($membership_interrupt->members_fee_id);
|
||
|
||
$members_fee->member_id = $form_data['member_id'];
|
||
$members_fee->member_id = $membership_interrupt->member_id;
|
||
$members_fee->activation_date = $from;
|
||
$members_fee->deactivation_date = $to;
|
||
|
||
... | ... | |
{
|
||
$membership_interrupt->transaction_start();
|
||
|
||
if ($membership_interrupt->end_after_interrupt_end &&
|
||
$member->leaving_date < date('Y-m-d'))
|
||
{
|
||
$member->leaving_date = NULL;
|
||
|
||
$member->save_throwable();
|
||
}
|
||
|
||
$membership_interrupt->delete_throwable();
|
||
$members_fee->delete_throwable();
|
||
|
||
... | ... | |
).'.');
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Callback function to valid date to field when checkbox is checked
|
||
*
|
||
* @author David Raška
|
||
* @param object $input
|
||
*/
|
||
public function valid_end_after_interrupt_end($input = NULL)
|
||
{
|
||
// validators cannot be accessed
|
||
if (empty($input) || !is_object($input))
|
||
{
|
||
self::error(PAGE);
|
||
}
|
||
|
||
$method = $this->form->from->method;
|
||
$to_array = date_parse($this->input->$method('to'));
|
||
$checked = $this->input->$method('end_after_interrupt_end');
|
||
|
||
$to = mktime(0, 0, 0, $to_array['month'], $to_array['day'], $to_array['year']);
|
||
|
||
if ($checked == '1' &&
|
||
$to <= mktime(23, 59, 59))
|
||
{
|
||
$this->form->to->add_error('required', __('Date to must be in future if End membership is selected'));
|
||
}
|
||
}
|
||
}
|
freenetis/branches/1.1/application/controllers/scheduler.php | ||
---|---|---|
self::log_error('update_ulogd', $e);
|
||
}
|
||
|
||
// former members message activation (each day after midnight)
|
||
$this->update_and_redirect_former_members();
|
||
|
||
// interuption message activation and notification on interuption
|
||
// start and end (each day after midnight)
|
||
$this->update_and_redirect_interrupted_members();
|
||
|
||
// former members message activation (each day after midnight)
|
||
$this->update_and_redirect_former_members();
|
||
|
||
// bank statements import
|
||
$this->bank_statements_import();
|
||
|
freenetis/branches/1.1/application/i18n/cs_CZ/texts.php | ||
---|---|---|
'cannot delete, there are other records depending on this one' => 'Nelze smazat, na položce jsou závislé jiné záznamy',
|
||
'cannot edit, there are other records depending on this one' => 'Nelze upravit, na položce jsou závislé jiné záznamy',
|
||
'cannot enable module %s, enabled module %s is required' => 'Nelze povolit modul %s, je vyžadován povolený modul %s.',
|
||
'cannot end membership to association' => 'Sdružení nelze ukončit členství.',
|
||
'cannot end membership when interrupt with end membership is activated' => 'Nelze ukončit členství, pokud je aktivní přerušení členství s ukončením členství.',
|
||
'cannot delete group - it has at least one children group' => 'Nelze smazat skupinu - má alespoň jednu potomkovskou skupinu.',
|
||
'cannot delete group - this group is protected against deletion' => 'Nelze smazat skupinu - tato skupina je chráněná proti mazání.',
|
||
'cannot enable voip driver, allow `%s` rights for mysql user' => 'Nemohu povolit VoIP ovladač, povolte právo `%s` pro MySQL uživatele',
|
||
... | ... | |
'date of foundation' => 'Datum založení',
|
||
'date of issue' => 'Datum vystavení',
|
||
'date to' => 'Datum do',
|
||
'date to must be in future if end membership is selected' => 'Datum do musí být v budoucnosti, pokud je vybráno ukončení členství',
|
||
'date to (last day in month)' => 'Datum do (poslední den v měsíci)',
|
||
'date vat' => 'Datum uskutečnění zdanitelného plnění',
|
||
'day' => 'Den',
|
||
... | ... | |
'due date' => 'Datum splatnosti',
|
||
'duplex' => 'Duplexní',
|
||
'duplicate transaction codes' => 'Duplikující se transakční kódy',
|
||
'e' => 'U',
|
||
'economy' => 'Ekonomika',
|
||
'economic variables' => 'Ekonomické proměnné',
|
||
'economic variables have been successfully updated' => 'Ekonomické proměnné byly úspěšně aktualizovány',
|
||
... | ... | |
'enabled' => 'Zapnuto',
|
||
'end editing of registrations' => 'Ukončit upravování přihlášek',
|
||
'end membership' => 'Ukončit členství',
|
||
'end membership after end' => 'Ukončit členství po skončení',
|
||
'end membership after end of interrupt' => 'Ukončit členství po skončení přerušení',
|
||
'end of month' => 'Konec měsíce',
|
||
'end of input' => 'Konec vstupu',
|
||
'engineer' => 'Technik',
|
freenetis/branches/1.1/application/models/bank_template.php | ||
---|---|---|
<?php defined('SYSPATH') or die('No direct script access.');
|
||
/*
|
||
* This file is part of open source system FreenetIS
|
||
* and it is release 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 templates
|
||
*
|
||
* @package Model
|
||
*
|
||
* @property integer $id
|
||
* @property string $template_name
|
||
* @property string $item_separator
|
||
* @property string $string_separator
|
||
* @property string $bank_code
|
||
* @property string $account_name
|
||
* @property string $account_number
|
||
* @property string $constant_symbol
|
||
* @property string $variable_symbol
|
||
* @property string $specific_symbol
|
||
* @property string $counteraccount_name
|
||
* @property string $counteraccount_numbe
|
||
* @property string $counteraccount_bank_code
|
||
* @property string $text
|
||
* @property string amount
|
||
* @property string expenditure_earning
|
||
* @property string value_for_earning
|
||
* @property string datetime
|
||
*/
|
||
class Bank_template_Model extends ORM
|
||
{
|
||
|
||
}
|
freenetis/branches/1.1/application/models/member.php | ||
---|---|---|
public function add_today_former_members()
|
||
{
|
||
$this->db->query("
|
||
UPDATE members SET type = ? AND locked = 1
|
||
UPDATE members SET type = ? , locked = 1
|
||
WHERE type <> ? AND leaving_date <= ? AND leaving_date IS NOT NULL
|
||
AND leaving_date <> '0000-00-00'
|
||
", self::TYPE_FORMER, self::TYPE_FORMER, date('Y-m-d'));
|
freenetis/branches/1.1/application/models/membership_interrupt.php | ||
---|---|---|
? BETWEEN mf.activation_date AND mf.deactivation_date
|
||
", array($member_id, $date))->current()->count;
|
||
}
|
||
|
||
/**
|
||
* Checks if member has membership interrupt with membership end in given date
|
||
*
|
||
* @author David Raška
|
||
* @param integer $member_id
|
||
* @param string $date
|
||
* @return bool
|
||
*/
|
||
public function has_member_end_after_interrupt_end_in_date($member_id, $date)
|
||
{
|
||
return (bool) $this->db->query("
|
||
SELECT COUNT(*) AS count
|
||
FROM membership_interrupts mi
|
||
JOIN members_fees mf ON mi.members_fee_id = mf.id
|
||
WHERE mi.member_id = ? AND
|
||
? BETWEEN mf.activation_date AND mf.deactivation_date AND
|
||
mi.end_after_interrupt_end = 1
|
||
", array($member_id, $date))->current()->count;
|
||
}
|
||
|
||
/**
|
||
* Returns all membership interrupts belongs to member
|
||
... | ... | |
{
|
||
return $this->db->query("
|
||
SELECT mi.id, mi.member_id, mf.activation_date AS 'from',
|
||
mf.deactivation_date AS 'to', mi.comment
|
||
mf.deactivation_date AS 'to', mi.comment,
|
||
mi.end_after_interrupt_end
|
||
FROM membership_interrupts mi
|
||
LEFT JOIN members_fees mf ON mi.members_fee_id = mf.id
|
||
WHERE mi.member_id = ?
|
freenetis/branches/1.1/application/views/bank_templates/show.php | ||
---|---|---|
<h2><?php echo $headline ?></h2>
|
||
<br />
|
||
<?php echo html::anchor('bank_templates/edit/' . $template->id, __('Edit')); ?>
|
||
<br />
|
||
<br />
|
||
|
||
<table class="extended">
|
||
<tr>
|
||
<th colspan="2"><?php echo __('Basic information') ?></th>
|
||
</tr>
|
||
<tr>
|
||
<th>ID</th>
|
||
<td><?php echo $template->id ?></td>
|
||
</tr>
|
||
<tr>
|
||
<th><?php echo __('Template name') ?></th>
|
||
<td><?php echo $template->template_name ?></td>
|
||
</tr>
|
||
<tr>
|
||
<th><?php echo __('Item separator') ?></th>
|
||
<td><?php echo $template->item_separator ?></td>
|
||
</tr>
|
||
<tr>
|
||
<th><?php echo __('String separator') ?></th>
|
||
<td><?php echo $template->string_separator ?></td>
|
||
</tr>
|
||
</table>
|
||
|
||
<br />
|
||
|
||
<table class="extended">
|
||
<tr>
|
||
<th colspan="2"><?php echo __('Column headers') ?></th>
|
||
</tr>
|
||
<tr>
|
||
<th><?php echo __('Account name') ?></th>
|
||
<td><?php echo $template->account_name ?></td>
|
||
</tr>
|
||
<tr>
|
||
<th><?php echo __('Account number') ?></th>
|
||
<td><?php echo $template->account_number ?></td>
|
||
</tr>
|
||
<tr>
|
||
<th><?php echo __('Bank code') ?></th>
|
||
<td><?php echo $template->bank_code ?></td>
|
||
</tr>
|
||
<tr>
|
||
<th><?php echo __('Constant symbol') ?></th>
|
||
<td><?php echo $template->constant_symbol ?></td>
|
||
</tr>
|
||
<tr>
|
||
<th><?php echo __('Variable symbol') ?></th>
|
||
<td><?php echo $template->variable_symbol ?></td>
|
||
</tr>
|
||
<tr>
|
||
<th><?php echo __('Specific symbol') ?></th>
|
||
<td><?php echo $template->specific_symbol ?></td>
|
||
</tr>
|
||
<tr>
|
||
<th><?php echo __('Counteraccount name') ?></th>
|
||
<td><?php echo $template->counteraccount_name ?></td>
|
||
</tr>
|
||
<tr>
|
||
<th><?php echo __('Counteraccount number') ?></th>
|
||
<td><?php echo $template->counteraccount_number ?></td>
|
||
</tr>
|
||
<tr>
|
||
<th><?php echo __('Counteraccount bank code') ?></th>
|
||
<td><?php echo $template->counteraccount_bank_code ?></td>
|
||
</tr>
|
||
<tr>
|
||
<th><?php echo __('Text') ?></th>
|
||
<td><?php echo $template->text ?></td>
|
||
</tr>
|
||
<tr>
|
||
<th><?php echo __('Amount') ?></th>
|
||
<td><?php echo $template->amount ?></td>
|
||
</tr>
|
||
<tr>
|
||
<th><?php echo __('Expenditure-earning') ?></th>
|
||
<td><?php echo $template->expenditure_earning ?></td>
|
||
</tr>
|
||
<tr>
|
||
<th><?php echo __('Value for earning') ?></th>
|
||
<td><?php echo $template->value_for_earning ?></td>
|
||
</tr>
|
||
<tr>
|
||
<th><?php echo __('Date and time') ?></th>
|
||
<td><?php echo $template->datetime ?></td>
|
||
</tr>
|
||
</table>
|
freenetis/branches/1.1/db_upgrades/upgrade_1.1.0~alpha52.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 previous upgrades
|
||
*
|
||
* @author David Raška
|
||
*/
|
||
$upgrade_equal_to['1.1.0~alpha52'] = array();
|
||
|
||
/**
|
||
* Adds end_after_interrupt_end column to membership_interrupt and
|
||
* removes unused bank_templates table
|
||
*
|
||
* @author David Raška
|
||
*/
|
||
$upgrade_sql['1.1.0~alpha52'] = array
|
||
(
|
||
"ALTER TABLE `membership_interrupts` ADD `end_after_interrupt_end` SMALLINT NOT NULL;",
|
||
|
||
"DROP TABLE `bank_templates`;"
|
||
);
|
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~alpha51');
|
||
define('FREENETIS_VERSION', '1.1.0~alpha52');
|
Také k dispozici: Unified diff
Nove:
- closes #737: Ostraneni bank templates
- closes #736: Preruseni clenstvi s ukoncenim clenstvi
Opravy:
- Oprava SQL dotazu pro nasstaveni clena jako byvaleho