Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 2a205303

Přidáno uživatelem Michal Kliment před více než 9 roky(ů)

Release 1.1.10

Zobrazit rozdíly:

application/controllers/accounts.php
$entrance_fee_left -= $amount;
$date = date::arithmetic($date, 'month');
$date = date::get_next_deduct_date_to($date);
}
}
......
);
}
$date = date::arithmetic($date, 'month');
$date = date::get_next_deduct_date_to($date);
}
}
......
);
}
$date = date::arithmetic($date, 'month');
$date = date::get_next_deduct_date_to($date);
}
}
application/controllers/bank_accounts.php
->url('bank_transfers/show_by_bank_account')
->label('Show transfers');
}
if ($this->acl_check_edit('Accounts_Controller', 'bank_accounts'))
{
$actions->add_conditional_action('id')
->icon_action('edit')
->url('bank_accounts/edit')
->class('popup_link');
}
$grid->datasource($ba);
}
......
$bank_account = new Bank_account_Model($bank_account_id);
// exists?
if (!$bank_account || !$bank_account->id ||
$bank_account->member_id != Member_Model::ASSOCIATION)
if (!$bank_account || !$bank_account->id)
{
self::error(RECORD);
}
// different logic for bank account of association
if ($bank_account->member_id == Member_Model::ASSOCIATION)
{
$this->edit_association($bank_account);
}
else
{
$this->edit_non_association($bank_account);
}
}
/**
* Edit form for bank account of association.
*
* @param Bank_account_Model $bank_account
*/
private function edit_association(Bank_account_Model $bank_account)
{
try
{
$ba_driver = Bank_Account_Settings::factory($bank_account->type);
......
$view->content->form = $form->html();
$view->render(TRUE);
}
/**
* Edit form for bank account that do not belongs to association.
*
* @param Bank_account_Model $bank_account
*/
private function edit_non_association(Bank_account_Model $bank_account)
{
$members = array
(
NULL => '--- ' . __('Without owner') . ' ---'
) + ORM::factory('member')->select_list_grouped(FALSE);
unset($members[Member_Model::ASSOCIATION]); // remove association
// form
$form = new Forge();
$form->group('Basic information');
$form->input('name')
->rules('required')
->value($bank_account->name)
->style('width:200px');
$form->dropdown('member_id')
->label('Owner')
->options($members)
->selected($bank_account->member_id)
->style('width:200px');
// submit button
$form->submit('Edit');
// validation
if ($form->validate())
{
$form_data = $form->as_array();
// real bank account
$bank_account->name = $form_data['name'];
$bank_account->member_id = $form_data['member_id'];
$bank_account->save();
// redirection
$this->redirect('bank_accounts/show_all');
}
else
{
$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 = $headline;
$view->breadcrumbs = $breadcrumbs;
$view->content = new View('form');
$view->content->headline = $headline;
$view->content->form = $form->html();
$view->render(TRUE);
}
}
}
application/controllers/bank_transfers.php
$grid->grouped_action_field()
->add_action('id')
->icon_action('money_add')
->url('bank_transfers/assign_transfer')
->url('bank_transfers/show_unidentified_transfer')
->label('Assign');
}
......
$view->render(TRUE);
} // end of unidentified_transfers function
/**
* Shows detail of unidentified transfer and options that are available for
* its assigning.
*
* @param integer $trans_id
*/
public function show_unidentified_transfer($trans_id = NULL)
{
// access rights
if (!$this->acl_check_view('Accounts_Controller', 'unidentified_transfers'))
{
self::error(ACCESS);
}
if (!isset($trans_id))
{
self::warning(PARAMETER);
}
if (!is_numeric($trans_id))
{
self::error(RECORD);
}
$t_model = new Transfer_Model($trans_id);
$bt_model = new Bank_transfer_Model();
$bt = $bt_model->get_bank_transfer($trans_id);
if (!is_object($bt) || !$t_model->id || $t_model->member_id ||
$t_model->origin->account_attribute_id != Account_attribute_Model::MEMBER_FEES)
{
self::error(RECORD);
}
$breadcrumbs = breadcrumbs::add()
->link('bank_accounts/show_all', 'Bank accounts',
$this->acl_check_view('Accounts_Controller', 'bank_accounts'))
->link('bank_transfers/unidentified_transfers', 'Unidentified transfers')
->disable_translation()
->text($trans_id)
->html();
$view = new View('main');
$view->title = __('Unidentified transfer');
$view->breadcrumbs = $breadcrumbs;
$view->content = new View('bank_transfers/show_unidentified_transfer');
$view->content->heading = __('Unidentified transfer');
$view->content->mt = $bt;
$view->render(TRUE);
} // end show_unidentified_transfer function
/**
* @author Jiri Svitak, Tomas Dulik
* @param integer $trans_id id of a transfer from table transfers
*/
public function assign_transfer($trans_id = NULL)
public function assign_member_transfer($trans_id = NULL)
{
// access rights
if (!$this->acl_check_edit('Accounts_Controller', 'unidentified_transfers'))
......
(
NULL => '----- '.__('Select').' -----'
) + $arr_accounts;
$t_model = new Transfer_Model($trans_id);
$bt_model = new Bank_transfer_Model();
$bt = $bt_model->get_bank_transfer($trans_id);
if (!is_object($bt))
Controller::error(RECORD);
if (!is_object($bt) || !$t_model->id || $t_model->member_id ||
$t_model->origin->account_attribute_id != Account_attribute_Model::MEMBER_FEES)
{
Controller::error(RECORD);
}
$fee_model = new Fee_Model();
// penalty
......
else
$transfer_fee = 0;
// form
$form = new Forge('bank_transfers/assign_transfer/'.$trans_id);
$form = new Forge('bank_transfers/assign_member_transfer/'.$trans_id);
$form->group('Payment');
......
->link('bank_accounts/show_all', 'Bank accounts',
$this->acl_check_view('Accounts_Controller', 'bank_accounts'))
->link('bank_transfers/unidentified_transfers', 'Unidentified transfers')
->link('bank_transfers/show_unidentified_transfer/' . $trans_id, $trans_id)
->text(__('Assign transfer as member payment'))
->html();
$view = new View('main');
$view->title = __('Assign transfer');
$view->breadcrumbs = $breadcrumbs;
$view->content = new View('form');
$view->content->headline = __('Assign transfer as member payment');
$view->content->form = $form->html();
$view->render(TRUE);
} // end of assign_member_transfer function
/**
* @author Ondrej Fibich
* @param integer $trans_id id of a transfer from table transfers
*/
public function assign_other_transfer($trans_id = NULL)
{
// access rights
if (!$this->acl_check_edit('Accounts_Controller', 'unidentified_transfers'))
{
self::error(ACCESS);
}
if (!isset($trans_id))
{
self::warning(PARAMETER);
}
if (!is_numeric($trans_id))
{
self::error(RECORD);
}
$t_model = new Transfer_Model($trans_id);
$bt_model = new Bank_transfer_Model();
$bt = $bt_model->get_bank_transfer($trans_id);
if (!is_object($bt) || !$t_model->id || $t_model->member_id ||
$t_model->origin->account_attribute_id != Account_attribute_Model::MEMBER_FEES)
{
self::error(RECORD);
}
$not_accepted_types = array
(
Account_attribute_Model::BANK,
Account_attribute_Model::CREDIT,
Account_attribute_Model::MEMBER_FEES,
Account_attribute_Model::BANK_FEES
);
$arr_accounts = array
(
NULL => '----- '.__('Select').' -----'
) + ORM::factory('account')->select_list_without_types($not_accepted_types);
// form
$form = new Forge('bank_transfers/assign_other_transfer/'.$trans_id);
$form->group('Payment');
$form->dropdown('origin_id')
->label('Origin account')
->rules('required')
->options($arr_accounts);
$form->input('text')
->rules('required')
->value(__('Assigning of unidentified payment'));
$form->submit('Assign');
// validation
if ($form->validate())
{
$form_data = $form->as_array();
// check account
$origin_acc = new Account_Model($form_data['origin_id']);
if (!$origin_acc->id ||
in_array($origin_acc->account_attribute_id, $not_accepted_types))
{
self::error(RECORD);
}
// assign
try
{
$db = new Transfer_Model();
$db->transaction_start();
// load transfer
$t = new Transfer_Model($trans_id);
$amount = $t->amount;
// update balance of old origin account
$old_origin_acc = new Account_Model($t->origin_id);
$old_origin_acc->balance += $amount;
$old_origin_acc->save_throwable();
// change source of transfer and text
$t->origin_id = $origin_acc->id;
$t->text = $form_data['text'];
$t->save_throwable();
// update balance of new origin account
$origin_acc->balance -= $amount;
$origin_acc->save_throwable();
$db->transaction_commit();
status::success('Transfer has been successfully assigned.');
}
catch (Exception $e)
{
$db->transaction_rollback();
Log::add_exception($e);
status::error('Error - cannot assign transfer.', $e);
}
url::redirect('bank_transfers/unidentified_transfers');
}
$breadcrumbs = breadcrumbs::add()
->link('bank_accounts/show_all', 'Bank accounts',
$this->acl_check_view('Accounts_Controller', 'bank_accounts'))
->link('bank_transfers/unidentified_transfers', 'Unidentified transfers')
->link('bank_transfers/show_unidentified_transfer/' . $trans_id, $trans_id)
->text(__('Assign transfer'))
->html();
$view = new View('main');
$view->title = __('Assign transfer');
$view->breadcrumbs = $breadcrumbs;
$view->content = new View('bank_transfers/assign_transfer');
$view->content = new View('form');
$view->content->headline = __('Assign transfer');
$view->content->mt = $bt;
$view->content->form = $form->html();
$view->render(TRUE);
} // end of assign_transfer function
} // end of assign_other_transfer function
/**
* Function enables adding of bank transfers manually.
application/controllers/contacts.php
else
{
$contact_model = new Contact_Model();
// do not search if duplicies enabled (#968)
if ($type == Contact_Model::TYPE_EMAIL &&
Settings::get('user_email_duplicities_enabled'))
{
return;
}
if ($type == Contact_Model::TYPE_PHONE &&
Settings::get('user_phone_duplicities_enabled'))
{
return;
}
// search for contacts
$duplicip_contacts = $contact_model->find_contacts($type, trim($input->value));
application/controllers/members.php
$form->input('email')
->rules('valid_email')
->callback(array($this, 'valid_unique_email'))
->style('width:250px');
if (Settings::get('finance_enabled'))
......
$contact_model = new Contact_Model();
// search for contacts
$contact_id = $contact_model->find_contact_id(
$p_contact_id = $contact_model->find_contact_id(
Contact_Model::TYPE_PHONE, $form_data['phone']
);
if ($contact_id)
if ($p_contact_id)
{
$contact_model = ORM::factory('contact', $contact_id);
$contact_model = ORM::factory('contact', $p_contact_id);
$contact_model->add($user);
$contact_model->save_throwable();
}
......
// email
if (!empty($form_data['email']))
{
$contact_model->type = Contact_Model::TYPE_EMAIL;
$contact_model->value = $form_data['email'];
$contact_model->save_throwable();
$contact_model->add($user);
$contact_model->save_throwable();
// search for contacts
$e_contact_id = $contact_model->find_contact_id(
Contact_Model::TYPE_EMAIL, $form_data['email']
);
if ($e_contact_id)
{
$contact_model = ORM::factory('contact', $e_contact_id);
$contact_model->add($user);
$contact_model->save_throwable();
}
else
{ // add whole contact
$contact_model->type = Contact_Model::TYPE_EMAIL;
$contact_model->value = $form_data['email'];
$contact_model->save_throwable();
$contact_model->add($user);
$contact_model->save_throwable();
}
}
// saving account
......
self::error(PAGE);
}
$user_model=new User_Model();
$user_model = new User_Model();
$value = trim($input->value);
if (!preg_match("/^[0-9]{9,9}$/",$value))
{
$input->add_error('required', __('Bad phone format.'));
}
else if ($user_model->phone_exist($value))
else if (!Settings::get('user_phone_duplicities_enabled') &&
$user_model->phone_exist($value))
{
$input->add_error('required', __('Phone already exists in database.'));
}
}
/**
* Check if non empty email is unique.
*
* @param object $input
*/
public function valid_unique_email($input = NULL)
{
// validators cannot be accessed
if (empty($input) || !is_object($input))
{
self::error(PAGE);
}
$user_model = new User_Model();
$value = trim($input->value);
// not required by default
if ($value && !Settings::get('user_email_duplicities_enabled') &&
$user_model->email_exist($value))
{
$input->add_error('required', __('Email already exists in database.'));
}
}
/**
* Entrance has to be before current date.
*
application/controllers/membership_interrupts.php
$grid->order_callback_field('member_id')
->label('Member')
->callback('callback::member_field');
->callback('callback::member_field_with_id');
$grid->order_field('from')
->label('Date from');
application/controllers/settings.php
$this->form->checkbox('former_member_auto_device_remove')
->label('Enable automatical deletion of devices of former members')
->checked(Settings::get('former_member_auto_device_remove'));
$this->form->checkbox('user_phone_duplicities_enabled')
->label('Enable multiple users to have assigned same phone contact')
->checked(Settings::get('user_phone_duplicities_enabled'));
$this->form->checkbox('user_email_duplicities_enabled')
->label('Enable multiple users to have assigned same e-mail contact')
->checked(Settings::get('user_email_duplicities_enabled'));
$this->form->group('Security');
application/controllers/transfers.php
if (!$date)
$date = $entrance_date;
$date = date_parse($date);
$year = $date['year'];
$month = $date['month'];
$day = $date['day'];
$date = date::get_closses_deduct_date_to($date);
$amount = ($account->balance + $form_data['amount'] - $transfer_fee);
while (true)
{
$date_arr = date_parse($date);
$year = $date_arr['year'];
$month = $date_arr['month'];
$day = $date_arr['day'];
$amount -= $fee_model->get_regular_member_fee_by_member_date($account->member_id, date::create($day, $month, $year));
if (isset($payments[$year][$month]))
......
if ($amount < 0)
break;
date::arithmetic_arr($day, $month, $year, 'month', 1);
$date = date::get_next_deduct_date_to($date);
}
if (!$text)
......
case 'amount':
$date = date::arithmetic($transfer_model->find_last_transfer_datetime_by_type(Transfer_Model::DEDUCT_MEMBER_FEE), 'month', 1);
$date = date::get_next_deduct_date_to($transfer_model->find_last_transfer_datetime_by_type(Transfer_Model::DEDUCT_MEMBER_FEE));
$amount = ($account->balance + $entrance_fee_paid + $devices_fee_paid - $transfer_fee) * -1;
......
{
$amount += $fee_model->get_regular_member_fee_by_member_date($account->member_id, $date);
$date = date::arithmetic($date, 'month', 1);
$date = date::get_next_deduct_date_to($date);
}
foreach ($payments as $year => $year_payments)
application/helpers/callback.php
echo '&nbsp';
}
}
/**
* Callback field for member name and member ID. Leaves blank name if needed.
*
* @author Ondřej Fibich
* @param object $item
* @param string $name
*/
public static function member_field_with_id($item, $name, $args = array())
{
if ($item->member_id)
{
if ($item->member_name)
{
$title = $item->member_name . ' (' . $item->member_id . ')';
}
else
{
$title = $item->member_id;
}
echo html::anchor("members/show/$item->member_id", $title);
}
else
{
echo '&nbsp';
}
}
/**
* Callback function to print type of member
......
public static function member_type_field ($item, $name)
{
echo Member_Model::get_type($item->$name);
// redirection flag
if (property_exists($item, 'interrupt') && $item->interrupt)
{
echo ' (' . __('I') . ')';
}
}
/**
application/helpers/date.php
// returns boundary date of month
return date('Y-m-d', mktime(0, 0, 0, $month, $deduct_day2, $year));
}
/**
/**
* Function returns next date of deduct from the given date.
* Next means that next mmonth deduct date is calculated.
*
* @author Ondřej Fibich <fibich@freenetis.org>
* @since 1.1.10
*
* @param string $date input deduct date
* @return string next deduct date from next month
*/
public static function get_next_deduct_date_to($date)
{
$d_arr = date_parse($date);
// increase month
$d_arr['month']++;
if ($d_arr['month'] > 12)
{
$d_arr['month'] = 1;
$d_arr['year']++;
}
// get deduct day for increased month
$d_arr['day'] = date::get_deduct_day_to($d_arr['month'], $d_arr['year']);
// create new date
return date::create($d_arr['day'], $d_arr['month'], $d_arr['year']);
}
/**
* Calculate deduct day of given month.
*
* @author Ondrej Fibich
......
$timestamp = mktime(0, 0, 0, $month, $day, $year);
return date('Y-m-d', $timestamp);
}
/**
* Performs arithmetic on date
*
* @author Michal Kliment
* @param integer $day
* @param integer $month
* @param integer $year
* @param string $unit
* @param integer $number
* @return type
*/
public static function arithmetic_arr(&$day, &$month, &$year, $unit, $number)
{
if ($unit != 'day' && $unit != 'month' && $unit != 'year')
return;
$$unit += $number;
$middle = date::get_deduct_day_to($month, $year);
$year += floor($month/12);
$month = ($month %12 + 12) % 12;
if ($month == 0)
{
$month = 12;
$year--;
}
while ($day <= 0)
{
date::arithmetic_arr($middle, $month, $year, 'month', -1);
$day += date::days_of_month($month, $year);
}
while ($day > date::days_of_month($month, $year))
{
$day -= date::days_of_month($month, $year);
date::arithmetic_arr($middle, $month, $year, 'month', 1);
}
}
/**
* Performs arithmetic on date
* Silimar to arithmetic_arr, but returns string
*
* @param string $date
* @param string $unit
* @param integer $number
* @return type
*/
public static function arithmetic($date, $unit, $number = 1)
{
$pd = date_parse($date);
date::arithmetic_arr($pd['day'], $pd['month'], $pd['year'], $unit, $number);
return date('Y-m-d', mktime(0, 0, 0, $pd['month'], $pd['day'], $pd['year']));
}
} // End date
application/i18n/cs_CZ/help.php
'approval_type_min_suggested_amount' => 'Tento hlasovací typ je pouze aplikován pokud navrhovaná částka u předmětu hlasování je vyšší nebo stejná.',
'aro_groups' => 'Jedná se o skupiny ARO objektů přiřazených k pravidlu. Ke každé skupině ARO objektů je přiřazena určitá skupina uživatelů.',
'aro_groups_count' => 'Jedná se o počet skupin ARO objektů přiřazených k pravidlu. Ke každé skupině ARO objektů je přiřazena určitá skupina uživatelů.',
'axo' => 'AXO objekt označuje objekty, nad kterými lze provádět operace.',
'assign_payment' => 'Neidentifikované převody jsou ve většině případů členské platby s chybně uvedeným nebo vynechaným variabilním symbolem.<br /><br />V ostatních případech se jedná o převod, který je interní záležitostí sdružení. Může se jednat například o bankovní úrok z vkladu, stažení peněz z termínovaného vkladu, vklad peněz, dobropis aj. Při přiřazení tohoto převodu je nutné určit zdrojový podvojný účet, ze kterého peníze pocházejí. Z vybraného účtu jsou následně peníze převedeny na podvojný účet banky, ke které bankovní převod náleží.',
'axo' => 'AXO objekt označuje objekty, nad kterými lze provádět operace.',
'axo_count' => 'Jedná se o počet položek AXO objektů přiřazených k pravidlu. AXO objekt označuje objekty, nad kterými lze provádět operace.',
'bank_accounts' => 'Bankovní účty jsou primárně vytvářeny automaticky během importu bankovního výpisu. V případě úspěšného rozpoznání platby je rovnou tento bankovní účet svázán s rozpoznaným členem. V případě, že člen v budoucnu splete variabilní symbol, pak toto ukládání bankovních účtů usnadňuje identifikaci platby v případě, že opět platil ze stejného účtu. Ruční přidávání bankovních účtů je vyhrazeno pro nestandardní případy.',
'bank_accounts_of_association' => 'Sdružení může mít více bankovních účtů, jeden je vždy založen po instalaci, nicméně je časem možné přidávat další. Na příslušném bankovním účtu pak lze provádět import výpisů.',
application/i18n/cs_CZ/texts.php
'assign subnet' => 'Přiřaď podsíť',
'assign subnet to cloud' => 'Přiřaď podsíť k oblasti',
'assign transfer' => 'Přiřadit převod',
'assign transfer as member payment' => 'Přiřadit převod jako platbu zaslanou členem',
'assign user' => 'Přiřadit uživatele',
'assigning of transfer' => 'Přiřazení platby',
'assigning of unidentified payment' => 'Přiřazení neidentifikované platby',
......
'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 monitoring' => 'Povolit monitoring',
'enable multiple users to have assigned same phone contact' => 'Povolit aby více uživatelů mohlo mít přiřazen stejný telefonní kontakt',
'enable multiple users to have assigned same e-mail contact' => 'Povolit aby více uživatelů mohlo mít přiřazen stejný e-mail',
'enable notification by redirection' => 'Povolit upozornění přesměrováním',
'enable notification by e-mail' => 'Povolit upozornění e-mailem',
'enable notification by sms messages' => 'Povolit upozornění SMS zprávami',
......
'open vodafone invoice in adobe reader' => 'Otevřte fakturu Vodafonu v programu Adobe Reader',
'opening balance' => 'Počáteční zůstatek',
'operating account' => 'Provozní účet',
'options for assigning (match) transfer' => 'Možnosti přiřazení (spárování) převodu',
'optional' => 'nepovinné',
'optional information' => 'Nepovinné informace',
'optional message' => 'Volitelná zpráva',
......
'transfer' => 'Převod',
'transfer details' => 'Detaily převodu',
'transfer fee' => 'Transakční poplatek',
'transfer has been successfully assigned' => 'Převod byl úspěšně přiřazen.',
'transfer has been successfully added' => 'Převod byl úspěšně přidán.',
'transfer has been successfully updated' => 'Převod byl úspěšně upraven.',
'transfer id' => 'ID převodu',
'transfer is member payment' => 'Převod je platba zaslaná členem',
'transfer is not member payment' => 'Převod není platba zaslaná členem',
'transfer information' => 'Informace o převodu',
'transfer will be effected within 15 minutes' => 'Převod bude uskutečněn během 15 minut.',
'transfered' => 'Přeneseno',
......
'ucp' => 'NPM',
'unconfirmed works' => 'Nepotvrzené práce',
'undecided' => 'Nerozhodnuto',
'unidentified transfers' => 'Neidentifikované platby',
'unidentified transfers' => 'Neidentifikované převody',
'unidentified transfer' => 'Neidentifikovaný převod',
'unknown error' => 'Neznámá chyba',
'unknown device' => 'Neznámé zařízení',
'unknown device text' => 'Text pro neznámé zařízení',
......
'who votes' => 'Kdo hlasuje',
'whole d' => 'Celé z.',
'without change' => 'Beze změny',
'without owner' => 'Bez vlastníka',
'without prefixes' => 'Bez předčíslí',
'without street' => 'Bez ulice',
'wireless' => 'Bezdrátové',
application/i18n/en_US/help.php
'approval_state' => 'State with the format in Agree / Disagree / Abstain.',
'approval_type_one_vote' => 'Voting is closed after the first vote that is not setup to "abstain".',
'approval_type_min_suggested_amount' => 'This approval type is only applied when suggested amount of voted subject is higher or equal.',
'bank_accounts' => 'Bank accounts are primarily created automatically during import bank statement. In case of successful recognition of payment is equal to the bank account linked with recognized member. In the event that a member makes a mistake in the future variable symbol, then the saving bank accounts, facilitating identification of the payment in case the back pay from the same account. Manually adding a bank account is reserved for unusual cases.',
'assign_payment' => 'Unidentified transfer is commonly a member payment with invalid or missing variable symbol.<br /><br />Otherwise it is an internal transfer in association commonly a bank interest on the deposit, withdrawal of money from time deposit, deposit money or credit note. During assigning of this other transfer it is required to specify origin double-entry account from which money comes from. Money are than transfered from the selected origin double-entry account to double-entry account of the bank of original bank transfer.',
'bank_accounts' => 'Bank accounts are primarily created automatically during import bank statement. In case of successful recognition of payment is equal to the bank account linked with recognized member. In the event that a member makes a mistake in the future variable symbol, then the saving bank accounts, facilitating identification of the payment in case the back pay from the same account. Manually adding a bank account is reserved for unusual cases.',
'bank_accounts_of_association' => 'The Association may have multiple bank accounts, one is always based upon the installation, however, it is possible to add more time. The relevant bank account can then perform the import statements.',
'connection_request_device_type' => 'Typically the device that you are trying to access the internet (PC, laptop, mobile, ...).',
'connection_request_info' => 'To connect unregistered connections/device please fill out this form.<br/>Decision on the pass/rejection of your request will be sent to your e-mail address.',
application/libraries/Settings.php
// javascript is enabled by default
'use_javascript' => 1,
// contact duplicities
'user_email_duplicities_enabled' => FALSE,
'user_phone_duplicities_enabled' => FALSE,
// username regex #360
'username_regex' => '/^[a-z][a-z0-9_]{4,}$/',
application/libraries/Variable_Key_Generator.php
'name' => 'Checksum variable key generator',
'class' => 'Checksum_Variable_Key_Generator',
),
'member_id' => array
(
'id' => 'member_id',
'name' => 'Member ID variable key generator',
'class' => 'Member_Id_Variable_Key_Generator',
),
);
/**
application/libraries/variable_key_generators/Member_Id_Variable_Key_Generator.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/
*
*/
/**
* Generates variable keys that contains just member ID.
*
* @author Ondrej Fibich
* @since 1.1.10
*/
class Member_Id_Variable_Key_Generator extends Variable_Key_Generator
{
/**
* Generated variable key from given member ID.
*
* @param mixed $identificator Indentificator for generate from
* @return integer Variable key
*/
public function generate($identificator)
{
return $identificator;
}
/*
* @override
*/
public function errorCheckAvailable()
{
return FALSE;
}
/*
* @override
*/
public function errorCorrectionAvailable()
{
return FALSE;
}
}
application/models/account.php
->where('account_attribute_id', $account_attribute_id)
->find();
}
/**
* Select list of accounts without accounts whose attribute IDs are in
* passed argument.
*
* @param int|array $account_attribute_id
*/
public function select_list_without_types($account_attribute_id)
{
if (!is_array($account_attribute_id))
{
$account_attribute_id = array($account_attribute_id);
}
$concat = "CONCAT(
COALESCE(name, ''),
' - " . __('Account ID') . " ',
id,
CONCAT(', ', account_attribute_id)
)";
$aaids = array_map('intval', $account_attribute_id);
return $this->in('account_attribute_id', $aaids, TRUE)
->select_list('id', $concat, 'account_attribute_id');
}
}
application/models/bank_account.php
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
WHERE (ba.member_id <> 1 OR ba.member_id IS NULL) $where
ORDER BY ".$this->db->escape_column($order_by)." $order_by_direction
LIMIT " . intval($limit_from) . ", " . intval($limit_results) . "
");
......
return $this->db->query("
SELECT COUNT(*) AS total
FROM bank_accounts ba
WHERE ba.member_id <> 1 $where"
WHERE (ba.member_id <> 1 OR ba.member_id IS NULL) $where"
)->current()->total;
}
application/models/email_queue.php
LEFT JOIN contacts tc ON eq.to = tc.value AND tc.type = ?
LEFT JOIN users_contacts tuc ON tc.id = tuc.contact_id
LEFT JOIN users tu ON tuc.user_id = tu.id
WHERE eq.state = ?";
WHERE eq.state = ?
GROUP BY eq.id";
// filter
if (empty($filter_sql))
{
return $this->db->query("
$body
GROUP BY eq.id
ORDER BY ".$this->db->escape_column($order_by)." $order_by_direction
LIMIT " . intval($limit_from) . "," . intval($limit_results) . "
", $args);
......
LEFT JOIN users_contacts tuc ON tc.id = tuc.contact_id
LEFT JOIN users tu ON tuc.user_id = tu.id
WHERE eq.state = ?
GROUP BY eq.id
$having
", array
(
......
LEFT JOIN users_contacts tuc ON tc.id = tuc.contact_id
LEFT JOIN users tu ON tuc.user_id = tu.id
WHERE eq.state = ?
GROUP BY eq.id
$having
) eq
", Contact_Model::TYPE_EMAIL, Contact_Model::TYPE_EMAIL, self::STATE_OK);
......
LEFT JOIN users_contacts tuc ON tc.id = tuc.contact_id
LEFT JOIN users tu ON tuc.user_id = tu.id
WHERE eq.state = ?
GROUP BY eq.id
$having
", array
(
......
LEFT JOIN users_contacts tuc ON tc.id = tuc.contact_id
LEFT JOIN users tu ON tuc.user_id = tu.id
WHERE eq.state <> ?
GROUP BY eq.id
$having
ORDER BY ".$this->db->escape_column($order_by)." $order_by_direction
LIMIT " . intval($limit_from) . "," . intval($limit_results) . "
......
LEFT JOIN contacts tc ON eq.to = tc.value AND tc.type = ?
LEFT JOIN users_contacts tuc ON tc.id = tuc.contact_id
LEFT JOIN users tu ON tuc.user_id = tu.id
WHERE eq.state <> ?
WHERE eq.state <> ?
GROUP BY eq.id
$having
", array
(
application/models/subnet.php
WHERE s.network_address LIKE ? COLLATE utf8_general_ci
", "$ip_prefix%");
}
/**
* Function gets phone numbers and names of users of subnet to export address book.
*
* @author Lubomir Buben
* @param integer $subnet_id
* @return Mysql_Result
*/
public function get_phones_and_names_of_subnet($subnet_id)
{
return $this->db->query("
SELECT DISTINCT(co.value) as phone, CONCAT(u.surname,' ',u.name) as name, u.id
FROM subnets su
LEFT JOIN ip_addresses ip ON ip.subnet_id = su.id
LEFT JOIN ifaces i ON i.id = ip.iface_id
LEFT JOIN devices d ON d.id = i.device_id
LEFT JOIN users u ON u.id = d.user_id
LEFT JOIN members m ON m.id = u.member_id
LEFT JOIN users_contacts uc ON uc.user_id = u.id
LEFT JOIN contacts co ON co.id = uc.contact_id
WHERE su.id = ? AND co.type = ? AND m.id <> 1 AND m.locked <> 1;
", array($subnet_id, Contact_Model::TYPE_PHONE));
}
/**
* Function gets phone numbers of users of subnet.
application/models/users_contacts.php
", $type);
}
/**
* Returns all contacts by given type
*
* @author Michal Kliment
* @param integer $type
* @param bool $ignore_whitelisted
* @return Mysql_Result
*/
public function get_all_contacts_by_type ($type, $ignore_whitelisted = FALSE)
{
$whitelisted = '';
if (!$ignore_whitelisted)
{
$whitelisted = "AND m.id NOT IN
(
SELECT mw.member_id
FROM members_whitelists mw
WHERE mw.since <= CURDATE() AND mw.until >= CURDATE()
)";
}
return $this->db->query("
SELECT c.value, a.balance, m.id AS member_id, m.name AS member_name,
(
SELECT GROUP_CONCAT(vs.variable_symbol) AS variable_symbol
FROM variable_symbols vs
WHERE vs.account_id = a.id
) AS variable_symbol, u.login, cou.country_code
FROM contacts c
JOIN users_contacts uc ON uc.contact_id = c.id
JOIN users u ON uc.user_id = u.id
JOIN members m ON u.member_id = m.id
JOIN accounts a ON a.member_id = m.id
LEFT JOIN contacts_countries cc ON cc.contact_id = c.id
LEFT JOIN countries cou ON cou.id = cc.country_id
WHERE m.type <> ? AND c.type = ? $whitelisted AND m.id NOT IN
(
SELECT mi.member_id
FROM membership_interrupts mi
JOIN members_fees mf ON mi.members_fee_id = mf.id
WHERE mf.activation_date <= CURDATE() AND
mf.deactivation_date >= CURDATE()
)
GROUP BY c.id
", array(Member_Model::TYPE_FORMER, $type));
}
/**
* Finds e-mail boxes of the given user on which the inner user mail may
* be redirected.
application/vendors/deb/debianization.sh
NAMES=(freenetis freenetis-monitoring freenetis-redirection freenetis-dhcp \
freenetis-ssh-keys freenetis-qos)
DEBIANS=(lenny squeeze wheezy)
DEBIANS=(lenny squeeze wheezy jessie)
VERSION=$1
if [ $# -eq 2 ] || [ $# -eq 3 ]; then
......
if [ -f "$deb_sh" ]; then
cd "$deb_dir_sh"
./debianization.sh "$VERSION" "$debian"
if [ $? -eq 0 ]; then
green_echo ">>>> [$name+$debian] debianized"
# move builded packages
......
else
red_echo ">>>> [$name+$debian] an error occured during debianization"
fi
cd "$root_dir"
else
red_echo ">>>> [$name+$debian] not debianized (debianization utility is missing)"
application/vendors/deb/freenetis/changelog
freenetis (1.1.10) stable; urgency=hight
* New configuration option that allows duplicates in phone and e-mail contacts
* New variable symbol generator that generates member ID
* Member table displays member interrupt info in member type column
* New form for editing of bank account that is not owned by association
* New form for assigning of unidentified transfer to any account
* Member ID is displayed in membership interrupt table in member column
* Fixes of members fee recalculation if deduct day is last day in month
* Fixes issue with hidden bank accounts that do not have owner
-- Ondrej Fibich <ondrej.fibich@gmail.com> Thu, 16 Apr 2015 22:45:27 +0200
freenetis (1.1.9) stable; urgency=hight
* Fix release of invalid DEB package
-- Ondrej Fibich <ondrej.fibich@gmail.com> Tue, 03 Mar 2015 18:18:18 +0100
application/vendors/deb/freenetis/debianization.sh
usr/share/doc/${NAME}/copyright
# compress doc
gzip --best usr/share/doc/${NAME}/changelog
gzip --best usr/share/doc/${NAME}/changelog
gzip --best usr/share/doc/${NAME}/changelog.Debian
# count size
......
# scripts ######################################################################
cp -a -f ../../${NAME}/preinst DEBIAN/preinst
cp -a -f ../../${NAME}/postinst DEBIAN/postinst
if [ $DEBIAN = "jessie" ]; then
cp -a -f ../../${NAME}/postinst.jessie DEBIAN/postinst
else
cp -a -f ../../${NAME}/postinst DEBIAN/postinst
fi
cp -a -f ../../${NAME}/prerm DEBIAN/prerm
cp -a -f ../../${NAME}/postrm DEBIAN/postrm
if [ $DEBIAN = "jessie" ]; then
cp -a -f ../../${NAME}/postrm.jessie DEBIAN/postrm
else
cp -a -f ../../${NAME}/postrm DEBIAN/postrm
fi
cp -a -f ../../${NAME}/templates DEBIAN/templates
cp -a -f ../../${NAME}/config DEBIAN/config
cp -a -f ../../${NAME}/conffiles DEBIAN/conffiles
application/vendors/deb/freenetis/postinst.jessie
#!/bin/bash
# FreenetIS DEB: actions after installing of package
set -e
. /usr/share/debconf/confmodule
SERVER=apache2
CONFIGFILE=/etc/freenetis/freenetis.conf
CONFIG_SAMPLE_PHP=/usr/share/freenetis/config-sample.php
# Generate config file, if it doesn’t exist.
# An alternative is to copy in a template
# file from elsewhere.
if [ ! -e $CONFIGFILE ]; then
mkdir /etc/freenetis/
echo "# Config file for FreenetIS" > $CONFIGFILE
echo "SERVERNAME=\"localhost/freenetis\"" >> $CONFIGFILE
echo "PROTOCOL=\"http\"" >> $CONFIGFILE
fi
# load configure file
. $CONFIGFILE || true
# Version 1.1 is located in /usr/share/freenetis but previous versions were
# located in /var/www/freeenetis, we try to use old config files if they are
# exists. The old configuration must not replace new configuration!
OLD_PATH=/var/www/freenetis
CURRENT_PATH=/usr/share/freenetis
# DB config
if [ -f "${OLD_PATH}/config.php" ] && [ ! -f "${CURRENT_PATH}/config.php" ]; then
echo "Copying old DB configuration from ${OLD_PATH}/config.php file"
cp "${OLD_PATH}/config.php" "${CURRENT_PATH}/config.php"
fi
# .htaccess
if [ -f "${OLD_PATH}/.htaccess" ] && [ ! -f "${CURRENT_PATH}/.htaccess" ]; then
echo "Copying old apache configuration from ${OLD_PATH}/.htaccess file"
cp "${OLD_PATH}/.htaccess" "${CURRENT_PATH}/.htaccess"
chmod 0666 "${CURRENT_PATH}/.htaccess" || true
fi
# Substitute in the values from the debconf db.
# There are obvious optimizations possible here.
# The cp before the sed ensures we do not mess up
# the config file’s ownership and permissions.
db_get freenetis/server_type
SERVER_TYPE="$RET"
db_get freenetis/servername
SERVERNAME="$RET"
db_get freenetis/protocol
PROTOCOL="$RET"
db_get freenetis/https_add_redir
HTTPS_ADD_REDIR="$RET"
cp -a -f $CONFIGFILE $CONFIGFILE.tmp
# h@ck for enable reloading vars from config file
db_set freenetis/hack_reload true
db_go || true
# If the admin deleted or commented some variables but then set
# them via debconf, (re-)add them to the conffile.
test -z "$SERVERNAME" || grep -Eq '^ *SERVERNAME=' $CONFIGFILE || echo "SERVERNAME=" >> $CONFIGFILE
test -z "$PROTOCOL" || grep -Eq '^ *PROTOCOL=' $CONFIGFILE || echo "PROTOCOL=" >> $CONFIGFILE
SERVERNAME_ESCAPED="${SERVERNAME//\//\\/}"
sed -e "s/^ *SERVERNAME=.*/SERVERNAME=\"$SERVERNAME_ESCAPED\"/" \
-e "s/^ *PROTOCOL=.*/PROTOCOL=\"$PROTOCOL\"/" < $CONFIGFILE > $CONFIGFILE.tmp
mv -f $CONFIGFILE.tmp $CONFIGFILE
# check server name
if [ -z "$SERVERNAME" ]; then
echo "Wrong server name, configuration failed!"
exit 3
fi
# check protocol
if [ -z "$PROTOCOL" ]; then
echo "Wrong protocol, configuration failed!"
exit 3
fi
# check SSL keys
if [ "$PROTOCOL" = "https" ]; then
if [ ! -f "$SSL_CERTIFICATE_FILE" ]; then
echo "SSL certificate file and key file not set properly."
echo "File $SSL_CERTIFICATE_FILE does not exists"
echo " => switching protocol from https to http"
PROTOCOL="http"
fi
if [ ! -f "$SSL_CERTIFICATE_KEY_FILE" ]; then
echo "SSL certificate file and key file not set properly."
echo "File $SSL_CERTIFICATE_KEY_FILE does not exists"
echo " => switching protocol from https to http"
PROTOCOL="http"
fi
fi
# Make post install things
# 0) Access rights to some directories
chmod ugo+w /usr/share/freenetis
chmod ugo+w /usr/share/freenetis/upload
mkdir -m 0777 /usr/share/freenetis/logs 2>/dev/null || true
# 1) Apache config
echo "Preparing Apache"
A2CF=/etc/$SERVER/conf-enabled/freenetis.conf
# activate redirection
a2enmod rewrite > /dev/null
# activate SSL if https selected
if [ "$PROTOCOL" = "https" ]; then
a2enmod ssl > /dev/null
fi
# PHP settings
php_settings="
# PHP settings
php_flag register_globals Off
php_flag magic_quotes_gpc Off
php_flag magic_quotes_runtime Off
php_flag file_uploads On
php_flag short_open_tag On
# large inputs (fixes #358, #410)
php_value max_input_vars 100000
php_admin_value suhosin.post.max_vars 100000
php_admin_value suhosin.request.max_vars 100000"
# make config for FN
if [ "$SERVER_TYPE" = localhost ]; then
echo "Alias /freenetis /usr/share/freenetis" > $A2CF
echo "<Directory /usr/share/freenetis>" >> $A2CF
echo " Options Indexes FollowSymLinks MultiViews" >> $A2CF
echo " AllowOverride All" >> $A2CF
echo " Order allow,deny" >> $A2CF
echo " allow from all" >> $A2CF
echo " ${php_settings}" >> $A2CF
echo "</Directory>" >> $A2CF
else
if [ "$PROTOCOL" = "https" ]; then
echo "NameVirtualHost *:443" > $A2CF
echo "<VirtualHost *:443>" >> $A2CF
else
echo "NameVirtualHost *:80" > $A2CF
echo "<VirtualHost *:80>" >> $A2CF
fi
echo " ServerName ${SERVERNAME}" >> $A2CF
echo " ServerAlias www.${SERVERNAME}" >> $A2CF
echo " DocumentRoot /usr/share/freenetis" >> $A2CF
echo " <Directory /usr/share/freenetis>" >> $A2CF
echo " Options Indexes FollowSymLinks MultiViews" >> $A2CF
echo " AllowOverride All" >> $A2CF
echo " Order allow,deny" >> $A2CF
echo " allow from all" >> $A2CF
echo " ${php_settings}" >> $A2CF
echo " </Directory>" >> $A2CF
echo " ErrorLog $ERROR_LOG_FILE" >> $A2CF
echo " CustomLog $CUSTOM_LOG_FILE common" >> $A2CF
if [ "$PROTOCOL" = "https" ]; then
echo " SSLEngine on" >> $A2CF
echo " SSLProtocol all -SSLv2" >> $A2CF
echo " SSLCipherSuite ALLADHEXPORTSSLv2:RC4+RSA:+HIGH:+MEDIUM" >> $A2CF
if [ -f "$SSL_CERTIFICATE_FILE" ]; then
echo " SSLCertificateFile $SSL_CERTIFICATE_FILE" >> $A2CF
fi
if [ -f "$SSL_CERTIFICATE_KEY_FILE" ]; then
echo " SSLCertificateKeyFile $SSL_CERTIFICATE_KEY_FILE" >> $A2CF
fi
if [ -f "$SSL_CERTIFICATE_CHAIN_FILE" ]; then
echo " SSLCertificateChainFile $SSL_CERTIFICATE_CHAIN_FILE" >> $A2CF
fi
if [ -f "$SSL_CA_CERTIFICATE_FILE" ]; then
echo " SSLCACertificateFile $SSL_CA_CERTIFICATE_FILE" >> $A2CF
fi
echo " SetEnvIf User-Agent \".*MSIE.*\" nokeepalive ssl-unclean-shutdown" >> $A2CF
fi
echo "</VirtualHost>" >> $A2CF
# redirection from http to https
if [ "$PROTOCOL" = "https" ] && [ "$HTTPS_ADD_REDIR" = true ]; then
echo "<VirtualHost *:80>" >> $A2CF
echo " ServerName ${SERVERNAME}" >> $A2CF
echo " ServerAlias www.${SERVERNAME}" >> $A2CF
echo " KeepAlive Off" >> $A2CF
echo " RewriteEngine On" >> $A2CF
echo " RewriteRule ^/(.*) https://${SERVERNAME}/\$1 [L,R=301]" >> $A2CF
echo "</VirtualHost>" >> $A2CF
fi
fi
# pre-configure protocol
sed -e "s/^ *\$config\['protocol'\] *=.*/\$config['protocol'] = '$PROTOCOL';/" < $CONFIG_SAMPLE_PHP > $CONFIG_SAMPLE_PHP.tmp
mv -f $CONFIG_SAMPLE_PHP.tmp $CONFIG_SAMPLE_PHP
# restart
if [ -x /usr/sbin/invoke-rc.d ]; then
invoke-rc.d apache2 restart 3>/dev/null || true
else
/etc/init.d/apache2 restart 3>/dev/null || true
fi
# 2) CRON
echo "Preparing CRON"
... Rozdílový soubor je zkrácen, protože jeho délka přesahuje max. limit.

Také k dispozici: Unified diff