Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 9c8950bf

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

Issue #1096: Big debtor message + notification auto activation e-mail report

Zobrazit rozdíly:

application/controllers/import.php
// redirection reactivation
if ($debtor_redir_react)
{
if (is_numeric(Settings::get('big_debtor_boundary')))
{
$this->reactivate_redir(Message_Model::BIG_DEBTOR_MESSAGE);
}
$this->reactivate_redir(Message_Model::DEBTOR_MESSAGE);
}
......
// redirection reactivation
if ($debtor_redir_react)
{
if (is_numeric(Settings::get('big_debtor_boundary')))
{
$this->reactivate_redir(Message_Model::BIG_DEBTOR_MESSAGE);
}
$this->reactivate_redir(Message_Model::DEBTOR_MESSAGE);
}
......
// redirection reactivation
if ($debtor_redir_react)
{
if (is_numeric(Settings::get('big_debtor_boundary')))
{
$this->reactivate_redir(Message_Model::BIG_DEBTOR_MESSAGE);
}
$this->reactivate_redir(Message_Model::DEBTOR_MESSAGE);
}
application/controllers/members.php
(
Message_Model::INTERRUPTED_MEMBERSHIP_MESSAGE => __('Membership interrupt'),
Message_Model::DEBTOR_MESSAGE => __('Debtor'),
Message_Model::BIG_DEBTOR_MESSAGE => __('Big debtor'),
Message_Model::PAYMENT_NOTICE_MESSAGE => __('Payment notice'),
Message_Model::UNALLOWED_CONNECTING_PLACE_MESSAGE => __('Unallowed connecting place'),
Message_Model::CONNECTION_TEST_EXPIRED => __('Connection test expired'),
application/controllers/messages.php
if (!$message->id)
Controller::error(RECORD);
if (($message->id == Message_Model::PAYMENT_NOTICE_MESSAGE ||
$message->id == Message_Model::DEBTOR_MESSAGE ||
$message->id == Message_Model::RECEIVED_PAYMENT_NOTICE_MESSAGE) && !Settings::get('finance_enabled'))
if (!Settings::get('finance_enabled') &&
Message_Model::is_finance_message($message->type))
{
Controller::error(ACCESS);
}
......
// record doesn't exist
if (!$message->id)
Controller::error(RECORD);
if (($message->id == Message_Model::PAYMENT_NOTICE_MESSAGE ||
$message->id == Message_Model::DEBTOR_MESSAGE ||
$message->id == Message_Model::RECEIVED_PAYMENT_NOTICE_MESSAGE) &&
!Settings::get('finance_enabled'))
if (!Settings::get('finance_enabled') &&
Message_Model::is_finance_message($message->type))
{
Controller::error(ACCESS);
}
......
Controller::error(RECORD);
}
if (($message->id == Message_Model::PAYMENT_NOTICE_MESSAGE ||
$message->id == Message_Model::DEBTOR_MESSAGE) &&
!Settings::get('finance_enabled'))
if (!Settings::get('finance_enabled') &&
Message_Model::is_finance_message($message->type))
{
Controller::error(ACCESS);
}
......
// shows beetween page only for interrupt payment notice and debtor
if ($message->type == Message_Model::PAYMENT_NOTICE_MESSAGE ||
$message->type == Message_Model::DEBTOR_MESSAGE)
$message->type == Message_Model::DEBTOR_MESSAGE ||
$message->type == Message_Model::BIG_DEBTOR_MESSAGE)
{
if (!isset($_POST) || !isset($_POST['ids']))
{
......
{
$message = new Message_Model($this->message_id);
if ($message->type != Message_Model::DEBTOR_MESSAGE &&
if ($message->type != Message_Model::BIG_DEBTOR_MESSAGE &&
$message->type != Message_Model::DEBTOR_MESSAGE &&
$message->type != Message_Model::PAYMENT_NOTICE_MESSAGE &&
$message->type != Message_Model::USER_MESSAGE)
{
application/controllers/messages_auto_settings.php
->callback('callback::boolean')
->label('SMS');
}
if (Settings::get('email_enabled'))
{
$grid->field('send_activation_to_email')
->label('Report to');
}
$actions = $grid->grouped_action_field();
if ($this->acl_check_edit('Messages_Controller', 'auto_config'))
{
$actions->add_action()
->icon_action('edit')
->url('messages_auto_settings/edit')
->class('popup_link');
}
if ($this->acl_check_delete('Messages_Controller', 'auto_config'))
{
......
->label('Sending of SMS messages enabled')
->value('1');
}
if (Settings::get('email_enabled'))
{
$form->group('Activation report');
$form->input('send_activation_to_email')
->rules('valid_emails|length[0,255]')
->label('Send report to email')
->help(help::hint('messages_send_activation_to_email'));
}
$form->submit('Add');
......
$message_asettings->sms_enabled =
Settings::get('sms_enabled') &&
$form_data['sms_enabled'];
if (Settings::get('email_enabled') &&
!empty($form_data['send_activation_to_email']))
{
$message_asettings->send_activation_to_email =
$form_data['send_activation_to_email'];
}
$message_asettings->save_throwable();
// commit transaction
......
$view->render(TRUE);
}
/**
* Edits a rule.
*
* @param integer $rule_id
*/
public function edit($rule_id = NULL)
{
// check param
if (!$rule_id || !is_numeric($rule_id))
{
self::warning(PARAMETER);
}
// check access
if (!$this->acl_check_edit('Messages_Controller', 'auto_config'))
{
self::error(ACCESS);
}
$message_asettings = new Messages_automatical_activation_Model($rule_id);
// exists?
if (!$message_asettings || !$message_asettings->id)
{
self::error(RECORD);
}
$message = new Message_Model($message_asettings->message_id);
// form
$form = new Forge('messages_auto_settings/edit/' . $rule_id);
if (Settings::get('email_enabled'))
{
$form->group('Activation report');
$form->input('send_activation_to_email')
->rules('valid_emails|length[0,255]')
->label('Send report to email')
->help(help::hint('messages_send_activation_to_email'))
->value($message_asettings->send_activation_to_email);
}
$form->submit('Edit');
// validate form and save data
if ($form->validate())
{
try
{
// start transaction
$message_asettings->transaction_start();
// load data
$form_data = $form->as_array();
if (Settings::get('email_enabled') &&
!empty($form_data['send_activation_to_email']))
{
$message_asettings->send_activation_to_email =
$form_data['send_activation_to_email'];
}
$message_asettings->save_throwable();
// commit transaction
$message_asettings->transaction_commit();
// message
status::success('Message automatical activation setting rule has been succesfully updated');
// redirection
$this->redirect('messages_auto_settings/show', $message_asettings->message_id);
}
catch (Exception $e)
{
// roolback transaction
$message_asettings->transaction_rollback();
Log::add_exception($e);
// message
status::error('Error - cant add message automatical activation settings rule', $e);
}
}
// headline
$headline = __('Edit automatical activation rule');
// bread crumbs
$breadcrumbs = breadcrumbs::add()
->link('messages/show_all', 'Messages',
$this->acl_check_view('Messages_Controller', 'message'))
->text($message->name)
->disable_translation()
->text($headline)
->html();
// view
$view = new View('main');
$view->title = $headline;
$view->breadcrumbs = $breadcrumbs;
$view->content = new View('form');
$view->content->form = $form->html();
$view->content->headline = $headline;
$view->render(TRUE);
}
/**
* Deletes settings rule
*
application/controllers/redirect.php
(
Message_Model::INTERRUPTED_MEMBERSHIP_MESSAGE => __('Membership interrupt'),
Message_Model::DEBTOR_MESSAGE => __('Debtor'),
Message_Model::BIG_DEBTOR_MESSAGE => __('Big debtor'),
Message_Model::PAYMENT_NOTICE_MESSAGE => __('Payment notice'),
Message_Model::UNALLOWED_CONNECTING_PLACE_MESSAGE => __('Unallowed connecting place'),
Message_Model::CONNECTION_TEST_EXPIRED => __('Connection test expired'),
application/controllers/scheduler.php
$rules = $messages_aa->get_message_settings($message->id);
// activate flags
$a_redir = $a_email = $a_sms = FALSE;
$report_to = array();
// get all rules that match
$filtered_rules = Time_Activity_Rule::filter_rules(
$rules, self::AM_NOTIFICATION, $this->t
);
);
// check all rules if redir/email/sms should be activated now
foreach ($filtered_rules as $rule)
{
$a_redir = $a_redir || $rule->redirection_enabled;
$a_email = $a_email || $rule->email_enabled;
$a_sms = $a_sms || $rule->sms_enabled;
$any = $rule->redirection_enabled || $rule->email_enabled || $rule->sms_enabled;
if ($any && $rule->send_activation_to_email)
{
$report_to += explode(',', $rule->send_activation_to_email);
}
}
// global options
$a_redir = $a_redir && Settings::get('redirection_enabled');
......
if (count($info_messages))
{
$m = __('Notification message "%s" has been automatically activated',
array(__($message->name)));
__($message->name));
Log_queue_Model::info($m, implode("\n", $info_messages));
// send report
if (count($report_to))
{
$this->send_message_activation_report($report_to, $m, $info_messages, $members);
}
}
}
catch (Exception $e)
{
self::log_error($e->getMessage(), $e, FALSE);
self::log_error('notification_activation', $e, FALSE);
Log_queue_Model::error($e->getMessage(), $e);
}
}
}
catch (Exception $e)
{
self::log_error($error_prefix, $e, FALSE);
self::log_error('notification_activation', $e, FALSE);
Log_queue_Model::error($error_prefix, $e);
}
}
}
private function send_message_activation_report($to_emails, $description,
$actions, $activated_members)
{
$email_view = new View('email_templates/notification_activation_report');
$email_view->header = $description;
$email_view->actions = $actions;
$email_view->affected_members = $activated_members;
$email_subject = Settings::get('email_subject_prefix') . ': ' . $description;
$email_body = $email_view->render();
$from = Settings::get('email_default_email');
$email_model = new Email_queue_Model();
foreach ($to_emails as $email)
{
$email_model->push($from, $email, $email_subject, $email_body);
}
}
/**
* Deduct all fees automatically if enabled
*
application/controllers/settings.php
$this->form->checkbox('users_birthday_empty_enabled')
->label('Users birthday can be empty')
->checked(!Settings::get('users_birthday_empty_enabled'));
->checked(Settings::get('users_birthday_empty_enabled'));
$this->form->group('Security');
......
->label(__('Payment notice boundary')." (".
Settings::get('currency')."): ".
help::hint('payment_notice_boundary'))
->rules('valid_numeric')
->value(Settings::get('payment_notice_boundary'));
$this->form->input('debtor_boundary')
->label(__('Debtor boundary')." (".
Settings::get('currency')."): ".
help::hint('debtor_boundary'))
->rules('valid_numeric')
->value(Settings::get('debtor_boundary'));
$this->form->input('big_debtor_boundary')
->label(__('Big debtor boundary')." (".
Settings::get('currency')."): ".
help::hint('big_debtor_boundary'))
->rules('valid_numeric')
->value(Settings::get('big_debtor_boundary'));
$this->form->input('initial_immunity')
->label(__('Initial immunity').': '.
application/helpers/callback.php
{
switch ($message->type)
{
case Message_Model::BIG_DEBTOR_MESSAGE:
if ($item->balance < Settings::get('big_debtor_boundary')
&& !$item->interrupt
&& ($item->type != Member_Model::TYPE_FORMER)
&& (!$item->whitelisted || $message->ignore_whitelist))
{
$selected = Notifications_Controller::ACTIVATE;
}
break;
case Message_Model::DEBTOR_MESSAGE:
if ($item->balance < Settings::get('debtor_boundary')
if ($item->balance >= Settings::get('big_debtor_boundary')
&& $item->balance < Settings::get('debtor_boundary')
&& !$item->interrupt
&& ($item->type != Member_Model::TYPE_FORMER)
&& (!$item->whitelisted || $message->ignore_whitelist))
application/helpers/valid.php
return (bool) preg_match('/^(?!\.)[-+_a-z0-9.]++(?<!\.)@(?![-.])[-a-z0-9.]+(?<!\.)\.[a-z]{2,6}$/iD', $email);
}
/**
* Validate emails, commonly used characters only, separated by commas
*
* @param string email address
* @return boolean
*/
public static function emails($emails)
{
foreach (explode(',', $emails) as $email)
{
if (!self::email($email))
{
return FALSE;
}
}
return TRUE;
}
/**
* Validate email, RFC compliant version
* Note: This function is LESS strict than valid_email. Choose carefully.
application/i18n/cs_CZ/help.php
'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ů.',
'big_debtor_boundary' => 'Hranice pro velkého dlužníka umožňuje pro dlužníky, jejichž dluh přesahuje stanovenou míru zobrazit speciální přesměrovací zprávu. Pokud má být zpráva shodná pro všechny dlužníky nehledě na výšku dluhu, ponechte pole prázdné.',
'connection_request_device_type' => 'Obvykle zařízení, se kterým se snažíte přistoupit na internet (PC, notebook, mobil).',
'connection_request_info' => 'Pro připojení neregistrované přípojky/zařízení vyplňte prosím tento formulář.<br/>Rozhodnutí o vyhovění/zamítnutí Vaší žádosti Vám bude zasláno na Vaši e-mailovou adresu.',
'connection_request_info_form' => 'Informace je zobrazena ve formuláři pro přidání požadavku o připojení',
......
'mail_to_field' => 'Políčko bere jako vstup login uživatele, kterému chcete odeslat zprávu. Příjemců můžete uvést více, oddělte je čárkou.',
'member_name' => 'Vyplňujte v případě přidávání nějaké organizace. Pokud připojujete běžného člena, tak jako výsledné jméno člena se použije jeho jméno a příjmení.',
'membership_transfer' => 'Převod členství je jediná možnost pro člena jak přesunout členský podíl na jiného člena.',
'messages_send_activation_to_email' => 'Pro každou aktivaci zprávy tímto nastavením je zaslána e-mailová zpráva na vybranou e-mailovou adresu(y). Zpráva obsahuje seznam členů, pro které byla aktivace provedena. Pole zanechce prázdné pokud nechcete zprávu o aktivaci zasílat. Odeslání na více e-mailových adres je možné zadáním více adres oddělených čárkou.',
'modules' => 'Modul přidává některé nové funkce do systému. Moduly zde mohou být povoleny/zakázány.',
'monitoring_email_to' => 'E-mailová adresa, na kterou se budou odesílat informace z monitoringu.',
'monitoring_notification_down_host_interval' => 'Určuje do kolika minut od výpadku zařízení se bude zasílat upozornění. Výchozí hodnota je 10, pro zakázání zasílání nastavte 0.',
application/i18n/cs_CZ/texts.php
'activated redirections' => 'Aktivovaná přesměrování',
'activated redirections of this message have been successfuly deactivated' => 'Aktivovaná přesměrování této zprávy byla úspěšně deaktivována.',
'activation date' => 'Datum aktivace',
'activation report' => 'Zpráva o aktivaci',
'active' => 'Aktivní',
'active member' => 'Aktivní člen',
'active members' => 'Aktivní členové',
......
'basic data' => 'Základní údaje',
'basic information' => 'Základní informace',
'basic' => 'Základní',
'big debtor' => 'Velký dlužník',
'big debtor message' => 'Zpráva pro velké dlužníky',
'big debtor boundary' => 'Hranice pro velkého dlužníka',
'billing settings' => 'Nastavení Billingu',
'billing period from' => 'Zaúčtováno od',
'billing period to' => 'Zaúčtováno do',
......
'edit approval template' => 'Upravit hlasovací šablonu',
'edit approval template item' => 'Upravit položku hlasovací šablony',
'edit approval type' => 'Upravit hlasovací typ',
'edit automatical activation rule' => 'Upravit pravidlo pro automatickou aktivaci',
'edit bank account' => 'Upravit bankovní účet',
'edit bank template' => 'Upravit bankovní šablonu',
'edit cloud' => 'Upravit oblast',
......
'error - can\'t delete translation' => 'Chyba - nelze smazat překlad.',
'error - cant do the transfer' => 'Chyba - nelze provést transakci.',
'error - cant edit fee' => 'Chyba - nelze upravit poplatek.',
'error - cant edit message automatical activation settings rule' => 'Chyba - nelze upravit pravidlo pro automatickou aktivaci zprávy',
'error - cant edit phone operator' => 'Chyba - nelze editovat telefonního operátora',
'error - cant edit work report' => 'Chyba - nelze editovat pracovní výkaz',
'error - cant end membership' => 'Chyba - nelze ukončit členství.',
......
'memory consumed' => 'Spotřeba paměti',
'message' => 'Zpráva',
'message automatical activation setting rule has been succesfully added' => 'Pravidlo pro automatickou aktivaci zprávy bylo úspěšně přidáno',
'message automatical activation setting rule has been succesfully updated' => 'Pravidlo pro automatickou aktivaci zprávy bylo úspěšně upraveno',
'message automatical activation setting rule has been succesfully deleted' => 'Pravidlo pro automatickou aktivaci zprávy bylo úspěšně smazáno',
'message for user' => 'Zpráva pro uživatele',
'message has been activated' => 'Zpráva byla aktivována',
......
'remove network ip address' => 'Odebrat IP adresu sítě',
'remove this work' => 'Odstranit tuto práci',
'reply' => 'Odpovědět',
'report to' => 'Nahlásil na',
'reported by' => 'Nahlásil',
'repository root' => 'Kořen úložiště',
'repository uuid' => 'UUID úložiště',
......
'send e-mail notice about received payment to member' => 'Odeslat členovi e-mailovou zprávu s oznámením o jeho přijaté platbě',
'send mail warning to users related with invoice' => 'Odeslat upozornění uživatelům spojených s fakturou',
'send message' => 'Odeslat zprávu',
'send report to email' => 'Zaslat zprávu na e-mail',
'send sms notice about received payment to member' => 'Odeslat členovi SMS zprávu s oznámením o jeho přijaté platbě',
'select' => 'Vyber',
'select account type' => 'Vyber typ účtu',
application/i18n/cs_CZ/validation.php
'matches' => 'Pole %s se musí shodovat s polem %s.',
'valid_url' => 'Pole %s musí obsahovat platnou URL.',
'valid_email' => 'Pole %s musí obsahovat platnou emailovou adresu.',
'valid_emails' => 'Pole %s musí obsahovat platné emailové adresy oddělené čárkou.',
'valid_ip' => 'Pole %s musí obsahovat platnou IP adresu.',
'valid_type' => 'Pole %s musí obsahovat pouze %s.',
'range' => 'Pole %s musí být v definovaném rozsahu.',
application/i18n/en_US/help.php
'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.',
'big_debtor_boundary' => 'Big deptor boundary allows to show a special redirection message for deptors who exceepds the specified limit. If the message should be same to all debtors then please clear the field value.',
'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.',
'connection_request_info_form' => 'Information that is displayed to connection request add form',
......
'mail_to_field' => 'The box takes as input the user login you want to send a message. You can specify multiple recipients, separate them with commas.',
'member_name' => 'Fill in the case of adding an organization. If you connect a regular member, as the final name of the member uses his name and surname.',
'membership_transfer' => 'Transfer of membership is only way for member to move membership share to another member.',
'messages_send_activation_to_email' => 'An email message is send to specified e-mail address(es) on each message activation by this rule. The report (message) includes a list of all members for which the activation was done. Leave empty if you do not want to send report. Sending to more e-mail adresses can be done by filling addresses separated by comma.',
'modules' => 'Module adds some new functionality to system. Modules can be enabled/disabled here.',
'monitoring_notification_down_host_interval' => 'It determines for how many minutes from host failure will be send notification. Default valueis 10, to disable of sending notifications set 0.',
'monitoring_notification_up_host_interval' => 'It determines for how many minutes from host funcionality again will be send notification. Default valueis 5, to disable of sending notifications set 0.',
application/libraries/forge/Form_Input.php
{
case 'valid_url':
case 'valid_email':
case 'valid_emails':
case 'valid_ip':
// Fetch an i18n error message
$error = Kohana::lang('validation.' . $func, $args);
application/models/member.php
$where = "AND mi.id IS NOT NULL";
$order_by = 'whitelisted ASC, interrupt DESC';
break;
case Message_Model::BIG_DEBTOR_MESSAGE:
// without interrupted members, former members, applicants
$where = "AND mi.id IS NULL "
. " AND m.type <> " . intval(Member_Model::TYPE_APPLICANT)
. " AND m.type <> " . Member_Model::TYPE_FORMER
. " AND a.balance < ".intval(Settings::get('big_debtor_boundary'))
." AND DATEDIFF(CURDATE(), m.entrance_date) >= ".intval(Settings::get('initial_debtor_immunity'));
$order_by = "whitelisted ASC, balance ASC, m.name ASC";
break;
case Message_Model::DEBTOR_MESSAGE:
// without interrupted members, former members, applicants
// without interrupted members, former members, applicants, big debtors (if enabled)
$where = "AND mi.id IS NULL "
. " AND m.type <> " . intval(Member_Model::TYPE_APPLICANT)
. " AND m.type <> " . Member_Model::TYPE_FORMER
. " AND a.balance < ".intval(Settings::get('debtor_boundary'))
. " AND m.type <> " . Member_Model::TYPE_FORMER;
if (is_numeric(Settings::get('big_debtor_boundary')))
{
$where .= " AND a.balance >= ".intval(Settings::get('big_debtor_boundary'));
}
$where .= " AND a.balance < ".intval(Settings::get('debtor_boundary'))
." AND DATEDIFF(CURDATE(), m.entrance_date) >= ".intval(Settings::get('initial_debtor_immunity'));
$order_by = "whitelisted ASC, balance ASC, m.name ASC";
break;
......
if (Settings::get('finance_enabled'))
{
$big_debtor_message_id = $message_model
->get_message_id_by_type(
Message_Model::BIG_DEBTOR_MESSAGE
);
$debtor_message_id = $message_model
->get_message_id_by_type(
Message_Model::DEBTOR_MESSAGE
......
continue; // no other messages for applicants
}
// variables
$idi = Settings::get('initial_debtor_immunity');
$ii = Settings::get('initial_immunity');
$ed_diff = (time() - strtotime($member->entrance_date)) / 86400;
// member is debtor
if (Settings::get('finance_enabled') && !$has_membership_interrupt &&
$balance < Settings::get('debtor_boundary') &&
($ed_diff >= $idi))
// finance redirections
if (Settings::get('finance_enabled') && !$has_membership_interrupt)
{
$messages_ip_addresses_model
->add_redirection_to_ip_address(
$debtor_message_id, $ip_address->id, ''
);
}
// member is almost debtor
if (Settings::get('finance_enabled') && !$has_membership_interrupt &&
$balance < Settings::get('payment_notice_boundary') && (
$balance >= Settings::get('debtor_boundary') &&
($ed_diff >= $idi)
) || (($ed_diff < $idi) && ($ed_diff >= $ii)))
{
$messages_ip_addresses_model
->add_redirection_to_ip_address(
$payment_notice_message_id, $ip_address->id, ''
);
$idi = Settings::get('initial_debtor_immunity');
$ii = Settings::get('initial_immunity');
$ed_diff = (time() - strtotime($member->entrance_date)) / 86400;
if (is_numeric(Settings::get('big_debtor_boundary')) &&
$balance < Settings::get('big_debtor_boundary') &&
($ed_diff >= $idi))
{ // member is big debtor
$messages_ip_addresses_model
->add_redirection_to_ip_address(
$big_debtor_message_id, $ip_address->id, ''
);
}
else if ($balance < Settings::get('debtor_boundary') &&
($ed_diff >= $idi))
{ // member is debtor
$messages_ip_addresses_model
->add_redirection_to_ip_address(
$debtor_message_id, $ip_address->id, ''
);
}
else if ($balance < Settings::get('payment_notice_boundary') && (
$balance >= Settings::get('debtor_boundary') &&
($ed_diff >= $idi)
) || (($ed_diff < $idi) && ($ed_diff >= $ii)))
{ // member is almost debtor
$messages_ip_addresses_model
->add_redirection_to_ip_address(
$payment_notice_message_id, $ip_address->id, ''
);
}
}
}
application/models/message.php
* when the end membership begins
*/
const FORMER_MEMBER_MESSAGE = 19;
/**
* content of page for big debtors, this redirection can be set in system
*/
const BIG_DEBTOR_MESSAGE = 20;
// self-cancel constants
......
self::UNKNOWN_DEVICE_MESSAGE => 'Unknown device',
self::INTERRUPTED_MEMBERSHIP_MESSAGE => 'Interrupted membership message',
self::DEBTOR_MESSAGE => 'Debtor message',
self::BIG_DEBTOR_MESSAGE => 'Big debtor message',
self::PAYMENT_NOTICE_MESSAGE => 'Payment notice',
self::UNALLOWED_CONNECTING_PLACE_MESSAGE => 'Unallowed connecting place',
self::RECEIVED_PAYMENT_NOTICE_MESSAGE => 'Received payment notice',
......
$type == self::USER_MESSAGE ||
$type == self::INTERRUPTED_MEMBERSHIP_MESSAGE ||
$type == self::DEBTOR_MESSAGE ||
$type == self::BIG_DEBTOR_MESSAGE ||
$type == self::PAYMENT_NOTICE_MESSAGE ||
$type == self::UNALLOWED_CONNECTING_PLACE_MESSAGE ||
$type == self::INTERRUPTED_MEMBERSHIP_BEGIN_NOTIFY_MESSAGE ||
......
$type == self::INTERRUPTED_MEMBERSHIP_END_NOTIFY_MESSAGE
);
}
/**
* Check if message is from finance module.
*
* @author Ondřej Fibich
* @param integer $type Type of message
* @return boolean
*/
public static function is_finance_message($type)
{
return (
$type == self::BIG_DEBTOR_MESSAGE ||
$type == self::DEBTOR_MESSAGE ||
$type == self::PAYMENT_NOTICE_MESSAGE
);
}
/**
* Check if message contains redirection content.
......
return (
$type == self::USER_MESSAGE ||
$type == self::DEBTOR_MESSAGE ||
$type == self::BIG_DEBTOR_MESSAGE ||
$type == self::PAYMENT_NOTICE_MESSAGE ||
$type == self::RECEIVED_PAYMENT_NOTICE_MESSAGE ||
$type == self::APPLICANT_APPROVE_MEMBERSHIP ||
......
return (
$type == self::USER_MESSAGE ||
$type == self::DEBTOR_MESSAGE ||
$type == self::BIG_DEBTOR_MESSAGE ||
$type == self::PAYMENT_NOTICE_MESSAGE ||
$type == self::RECEIVED_PAYMENT_NOTICE_MESSAGE ||
$type == self::CONNECTION_REQUEST_APPROVE ||
......
{
return (
$type == self::DEBTOR_MESSAGE ||
$type == self::BIG_DEBTOR_MESSAGE ||
$type == self::PAYMENT_NOTICE_MESSAGE
);
}
......
{
$where[] = "m.type <> " . intval(self::PAYMENT_NOTICE_MESSAGE);
$where[] = "m.type <> " . intval(self::DEBTOR_MESSAGE);
$where[] = "m.type <> " . intval(self::BIG_DEBTOR_MESSAGE);
$where[] = "m.type <> " . intval(self::RECEIVED_PAYMENT_NOTICE_MESSAGE);
}
else if (!is_numeric(Settings::get('big_debtor_boundary')))
{
$where[] = "m.type <> " . intval(self::BIG_DEBTOR_MESSAGE);
}
if (!Settings::get('membership_interrupt_enabled'))
{
application/models/messages_automatical_activation.php
* @property boolean $redirection_enabled
* @property boolean $email_enabled
* @property boolean $sms_enabled
* @property string $send_activation_to_email
*/
class Messages_automatical_activation_Model extends Time_Activity_Rule
{
application/views/email_templates/notification_activation_report.php
<p><?php echo $header ?>:</p>
<ul>
<?php foreach ($actions as $action): ?>
<li><?php echo $action ?></li>
<?php endforeach; ?>
</ul>
<p><?php echo __('Members') ?>:</p>
<table border="1" style="border-collapse: collapse;">
<thead>
<tr>
<th><?php echo __('ID') ?></th>
<th><?php echo __('Name') ?></th>
<th><?php echo __('Balance') ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($affected_members as $member): ?>
<tr>
<td><?php echo html::anchor('members/show/' . $member->id, $member->id) ?></td>
<td><?php echo $member->name ?></td>
<td><?php echo number_format((float) $member->balance, 2, ',', ' ') ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
db_upgrades/upgrade_1.1.23.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/
*
*/
/**
* Adds a new notification message for big debtors.
*
* @author Ondřej Fibich <ondrej.fibich@gmail.com>
*/
$upgrade_sql['1.1.23'] = array
(
"INSERT INTO `messages` (`id`, `name`, `text`, `email_text`, `sms_text`, `type`, `self_cancel`, `ignore_whitelist`) VALUES
(NULL, 'Big debtor message', 'Content of page for big debtors', NULL, NULL, 20, 0, 0);",
"ALTER TABLE messages_automatical_activations ADD COLUMN send_activation_to_email VARCHAR(255) DEFAULT NULL;"
);
system/i18n/en_US/validation.php
'matches' => 'The %s field must match the %s field.',
'valid_url' => 'The %s field must contain a valid URL.',
'valid_email' => 'The %s field must contain a valid e-mail.',
'valid_emails' => 'The %s field must contain a valid e-mails delimited by comma.',
'valid_ip' => 'The %s field must contain a valid IP address.',
'valid_type' => 'The %s field must only contain %s characters.',
'range' => 'The %s field must be between specified ranges.',

Také k dispozici: Unified diff