Revize 1300
Přidáno uživatelem Michal Kliment před asi 13 roky(ů)
freenetis/branches/testing/application/vendors/unit_tester/unit_testing_config.xml | ||
---|---|---|
</input>
|
||
</values>
|
||
</method>
|
||
<method name="get_ip_addresses_of_members_in_protective_period" autogenerate="on">
|
||
<attributes></attributes>
|
||
<values>
|
||
<input></input>
|
||
</values>
|
||
</method>
|
||
<method name="set_whitelist" autogenerate="on">
|
||
<attributes>
|
||
<attribute name="whitelist" default_value="" />
|
||
... | ... | |
</input>
|
||
</values>
|
||
</method>
|
||
<method name="set_protective_period" autogenerate="on">
|
||
<attributes></attributes>
|
||
<values>
|
||
<input></input>
|
||
</values>
|
||
</method>
|
||
</model>
|
||
<model name="members_domicile"></model>
|
||
<model name="members_fee">
|
||
... | ... | |
<values>
|
||
</values>
|
||
</method>
|
||
<method name="aco_count_field" autogenerate="on">
|
||
<method name="aco_count_field" autogenerate="off">
|
||
<attributes>
|
||
<attribute name="item" default_value="" />
|
||
<attribute name="name" default_value="" />
|
||
<attribute name="item" default_value=""/>
|
||
<attribute name="name" default_value=""/>
|
||
</attributes>
|
||
<values>
|
||
<input>
|
||
<param value="" />
|
||
<param value="" />
|
||
</input>
|
||
</values>
|
||
</method>
|
||
<method name="aco_value_field" autogenerate="on">
|
||
<method name="aco_value_field" autogenerate="off">
|
||
<attributes>
|
||
<attribute name="item" default_value="" />
|
||
<attribute name="name" default_value="" />
|
||
<attribute name="item" default_value=""/>
|
||
<attribute name="name" default_value=""/>
|
||
</attributes>
|
||
<values>
|
||
<input>
|
||
<param value="" />
|
||
<param value="" />
|
||
</input>
|
||
</values>
|
||
</method>
|
||
<method name="active_field" autogenerate="off">
|
||
... | ... | |
</attributes>
|
||
<values/>
|
||
</method>
|
||
<method name="aro_groups_count_field" autogenerate="on">
|
||
<method name="aro_groups_count_field" autogenerate="off">
|
||
<attributes>
|
||
<attribute name="item" default_value="" />
|
||
<attribute name="name" default_value="" />
|
||
<attribute name="item" default_value=""/>
|
||
<attribute name="name" default_value=""/>
|
||
</attributes>
|
||
<values>
|
||
<input>
|
||
<param value="" />
|
||
<param value="" />
|
||
</input>
|
||
</values>
|
||
</method>
|
||
<method name="axo_count_field" autogenerate="on">
|
||
<method name="axo_count_field" autogenerate="off">
|
||
<attributes>
|
||
<attribute name="item" default_value="" />
|
||
<attribute name="name" default_value="" />
|
||
<attribute name="item" default_value=""/>
|
||
<attribute name="name" default_value=""/>
|
||
</attributes>
|
||
<values>
|
||
<input>
|
||
<param value="" />
|
||
<param value="" />
|
||
</input>
|
||
</values>
|
||
</method>
|
||
<method name="balance_field" autogenerate="off">
|
||
... | ... | |
<values>
|
||
</values>
|
||
</method>
|
||
<method name="connected_device_field" autogenerate="on">
|
||
<method name="connected_device_field" autogenerate="off">
|
||
<attributes>
|
||
<attribute name="item" default_value="" />
|
||
<attribute name="name" default_value="" />
|
||
<attribute name="item" default_value=""/>
|
||
<attribute name="name" default_value=""/>
|
||
</attributes>
|
||
<values>
|
||
<input>
|
||
<param value="" />
|
||
<param value="" />
|
||
</input>
|
||
</values>
|
||
</method>
|
||
<method name="email_from_field" autogenerate="off">
|
||
... | ... | |
<values>
|
||
</values>
|
||
</method>
|
||
<method name="iface_type_field" autogenerate="on">
|
||
<method name="iface_type_field" autogenerate="off">
|
||
<attributes>
|
||
<attribute name="item" default_value="" />
|
||
<attribute name="name" default_value="" />
|
||
<attribute name="item" default_value=""/>
|
||
<attribute name="name" default_value=""/>
|
||
</attributes>
|
||
<values>
|
||
<input>
|
||
<param value="" />
|
||
<param value="" />
|
||
</input>
|
||
</values>
|
||
</method>
|
||
<method name="iface_vlan_iface_field" autogenerate="off">
|
||
... | ... | |
<values>
|
||
</values>
|
||
</method>
|
||
<method name="member_type_field" autogenerate="on">
|
||
<method name="member_type_field" autogenerate="off">
|
||
<attributes>
|
||
<attribute name="item" default_value="" />
|
||
<attribute name="name" default_value="" />
|
||
<attribute name="item" default_value=""/>
|
||
<attribute name="name" default_value=""/>
|
||
</attributes>
|
||
<values>
|
||
<input>
|
||
<param value="" />
|
||
<param value="" />
|
||
</input>
|
||
</values>
|
||
</method>
|
||
<method name="message_activate_field" autogenerate="off">
|
||
... | ... | |
<values>
|
||
</values>
|
||
</method>
|
||
<method name="sms_receiver_field" autogenerate="on">
|
||
<method name="sms_receiver_field" autogenerate="off">
|
||
<attributes>
|
||
<attribute name="item" default_value="" />
|
||
<attribute name="name" default_value="" />
|
||
<attribute name="item" default_value=""/>
|
||
<attribute name="name" default_value=""/>
|
||
</attributes>
|
||
<values>
|
||
<input>
|
||
<param value="" />
|
||
<param value="" />
|
||
</input>
|
||
</values>
|
||
</method>
|
||
<method name="sms_sender_field" autogenerate="on">
|
||
<method name="sms_sender_field" autogenerate="off">
|
||
<attributes>
|
||
<attribute name="item" default_value="" />
|
||
<attribute name="name" default_value="" />
|
||
<attribute name="item" default_value=""/>
|
||
<attribute name="name" default_value=""/>
|
||
</attributes>
|
||
<values>
|
||
<input>
|
||
<param value="" />
|
||
<param value="" />
|
||
</input>
|
||
</values>
|
||
</method>
|
||
<method name="traffic_field" autogenerate="off">
|
||
... | ... | |
<values>
|
||
</values>
|
||
</method>
|
||
<method name="vlans_field" autogenerate="on">
|
||
<method name="vlans_field" autogenerate="off">
|
||
<attributes>
|
||
<attribute name="item" default_value="" />
|
||
<attribute name="name" default_value="" />
|
||
<attribute name="item" default_value=""/>
|
||
<attribute name="name" default_value=""/>
|
||
</attributes>
|
||
<values>
|
||
<input>
|
||
<param value="" />
|
||
<param value="" />
|
||
</input>
|
||
</values>
|
||
</method>
|
||
<method name="voip_caller" autogenerate="off">
|
||
... | ... | |
<values>
|
||
</values>
|
||
</method>
|
||
<method name="wireless_segment_frequence" autogenerate="on">
|
||
<method name="wireless_segment_frequence" autogenerate="off">
|
||
<attributes>
|
||
<attribute name="item" default_value="" />
|
||
<attribute name="name" default_value="" />
|
||
<attribute name="item" default_value=""/>
|
||
<attribute name="name" default_value=""/>
|
||
</attributes>
|
||
<values>
|
||
<input>
|
||
<param value="" />
|
||
<param value="" />
|
||
</input>
|
||
</values>
|
||
</method>
|
||
<method name="wireless_segment_norm" autogenerate="off">
|
||
... | ... | |
</attributes>
|
||
<values>
|
||
</values>
|
||
</method>
|
||
</helper>
|
||
</method></helper>
|
||
<helper name="condition">
|
||
<method name="is_own" autogenerate="off">
|
||
<attributes>
|
freenetis/branches/testing/application/helpers/date.php | ||
---|---|---|
*/
|
||
public static function decrease_day($year, $month, $day)
|
||
{
|
||
$day = (int) $day;
|
||
$month = (int) $month;
|
||
$year = (int) $year;
|
||
|
||
$day -= 1;
|
||
if ($day == 0)
|
||
{
|
freenetis/branches/testing/application/models/ip_address.php | ||
---|---|---|
JOIN members m ON m.id = ip.member_id
|
||
JOIN accounts a ON a.member_id = m.id AND m.id <> ?
|
||
WHERE a.balance < ?
|
||
AND CURDATE() - m.entrance_date >= ?
|
||
AND DATEDIFF(CURDATE(), m.entrance_date) >= ?
|
||
AND (ip.whitelisted IS NULL OR ip.whitelisted = 0)
|
||
",
|
||
array
|
||
... | ... | |
JOIN accounts a ON a.member_id = m.id AND m.id <> ?
|
||
WHERE
|
||
(
|
||
CURDATE() - m.entrance_date >= ? AND a.balance >= ?
|
||
OR CURDATE() - m.entrance_date < ? AND CURDATE() - m.entrance_date >= ?
|
||
DATEDIFF(CURDATE(), m.entrance_date) >= ? AND a.balance >= ?
|
||
OR DATEDIFF(CURDATE(), m.entrance_date) < ? AND DATEDIFF(CURDATE(), m.entrance_date) >= ?
|
||
)
|
||
AND a.balance < ?
|
||
AND (ip.whitelisted IS NULL OR ip.whitelisted = 0)
|
||
... | ... | |
}
|
||
|
||
/**
|
||
* Returns all IP addresses of members belongs to protective period
|
||
* (too new members to be redirected)
|
||
*
|
||
* @author Michal Kliment
|
||
* @return Mysql_Result object
|
||
*/
|
||
public function get_ip_addresses_of_members_in_protective_period ()
|
||
{
|
||
return $this->db->query("
|
||
SELECT DISTINCT IFNULL(m.ip_address_id,ip.id) AS id
|
||
FROM
|
||
(
|
||
SELECT m.id, IFNULL(ip1.id,ip2.id) AS ip_address_id
|
||
FROM
|
||
(
|
||
SELECT m.id
|
||
FROM members m
|
||
WHERE (CURDATE() - m.entrance_date) <= 100 AND m.id NOT IN
|
||
(
|
||
SELECT mi.member_id
|
||
FROM membership_interrupts mi
|
||
LEFT JOIN members_fees mf ON mi.members_fee_id = mf.id
|
||
WHERE mf.activation_date <= CURDATE()
|
||
AND mf.deactivation_date >= CURDATE()
|
||
)
|
||
) m
|
||
LEFT JOIN users u ON u.member_id = m.id
|
||
LEFT JOIN devices d ON d.user_id = u.id
|
||
LEFT JOIN ifaces i ON i.device_id = d.id
|
||
LEFT JOIN vlan_ifaces vi ON vi.iface_id = i.id
|
||
LEFT JOIN ip_addresses ip1 ON ip1.iface_id = i.id
|
||
AND (ip1.whitelisted IS NULL OR ip1.whitelisted = 0)
|
||
LEFT JOIN ip_addresses ip2 ON ip2.vlan_iface_id = vi.id
|
||
AND (ip2.whitelisted IS NULL OR ip2.whitelisted = 0)
|
||
) m
|
||
LEFT JOIN ip_addresses ip ON ip.member_id = m.id
|
||
WHERE IFNULL(m.ip_address_id,ip.id) IS NOT NULL
|
||
");
|
||
}
|
||
|
||
/**
|
||
* Sets whitelist
|
||
*
|
||
* @param ineteger $whitelist
|
freenetis/branches/testing/application/models/users_contacts.php | ||
---|---|---|
JOIN membership_interrupts mi ON mi.member_id = m.id
|
||
JOIN members_fees mf ON mi.members_fee_id = mf.id
|
||
WHERE mf.activation_date <= CURDATE() AND mf.deactivation_date >= CURDATE()
|
||
) AND CURDATE() - m.entrance_date >= ".intval(Settings::get('initial_debtor_immunity'))."
|
||
) AND DATEDIFF(CURDATE(), m.entrance_date) >= ".intval(Settings::get('initial_debtor_immunity'))."
|
||
AND a.balance < ".intval($debtor_boundary)
|
||
, $type, self::NO_WHITELIST, Member_Model::TYPE_FORMER);
|
||
}
|
||
... | ... | |
AND a.balance < ".intval($payment_notice_boundary)."
|
||
AND
|
||
(
|
||
CURDATE() - m.entrance_date >= ".intval(Settings::get('initial_debtor_immunity'))."
|
||
DATEDIFF(CURDATE(), m.entrance_date) >= ".intval(Settings::get('initial_debtor_immunity'))."
|
||
AND a.balance >= ".intval($debtor_boundary)."
|
||
OR CURDATE() - m.entrance_date < ".intval(Settings::get('initial_debtor_immunity'))."
|
||
AND CURDATE() - m.entrance_date >= ".intval(Settings::get('initial_immunity'))."
|
||
OR DATEDIFF(CURDATE(), m.entrance_date) < ".intval(Settings::get('initial_debtor_immunity'))."
|
||
AND DATEDIFF(CURDATE(), m.entrance_date) >= ".intval(Settings::get('initial_immunity'))."
|
||
)
|
||
",
|
||
array
|
freenetis/branches/testing/application/models/member.php | ||
---|---|---|
",array(isset($registrations[$id]), $id));
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Sets protective period for new members
|
||
*/
|
||
public function set_protective_period ()
|
||
{
|
||
$ip_address_model = new Ip_address_Model();
|
||
|
||
$ip_addresses = $ip_address_model
|
||
->get_ip_addresses_of_members_in_protective_period();
|
||
|
||
foreach ($ip_addresses as $ip_address)
|
||
{
|
||
$ip_address_model
|
||
->set_whitelist(
|
||
Ip_address_Model::TEMPORARY_WHITELIST,
|
||
$ip_address->id
|
||
);
|
||
}
|
||
}
|
||
}
|
freenetis/branches/testing/application/controllers/users.php | ||
---|---|---|
}
|
||
else
|
||
{
|
||
$view->form = new View('registration');
|
||
|
||
// breadcrumbs navigation
|
||
$breadcrumbs = breadcrumbs::add()
|
||
->link('members/show_all', 'Members',
|
Také k dispozici: Unified diff
Oprava mensi chyby pri pocitani rozdilu mezi daty v MySQL. Odladeny mensi chyby pomoc unit testeru.