Revize 819
Přidáno uživatelem Jiří Sviták před téměř 14 roky(ů)
freenetis/branches/testing/application/models/ip_address.php | ||
---|---|---|
|
||
/**
|
||
* Gets all IP addresses
|
||
* @todo account_balances absolete
|
||
* @author Jiri Svitak
|
||
* @param $debtor_boundary
|
||
*/
|
freenetis/branches/testing/application/controllers/messages.php | ||
---|---|---|
url::redirect(url_lang::base().'messages/show_all');
|
||
}
|
||
// finding IP addresses to redirect to debtor message
|
||
/* @todo account_balances absolete
|
||
$ips = $db->query("
|
||
SELECT ip.id, ip.ip_address, ip.whitelisted
|
||
FROM ip_addresses ip
|
||
... | ... | |
JOIN account_balances ab ON ab.member_id = m.id AND m.id <> 1
|
||
WHERE ab.balance < $payment_notice_boundary AND ab.balance >= $debtor_boundary
|
||
");
|
||
*/
|
||
// delete old redirections
|
||
$db->delete('messages_ip_addresses', array('message_id' => $message_id));
|
||
// set new redirections in junction table
|
freenetis/branches/testing/application/upgrade_sql/upgrade_sql.php | ||
---|---|---|
// array of sql queries that upgrade database
|
||
$upgrade_sql[get_SVN_rev()] = array(
|
||
|
||
// GPS in address points is an point of GEOM
|
||
"RENAME TABLE `fees_members` TO `members_fees`;",
|
||
"DROP VIEW `account_balances` ,
|
||
`account_inbounds` ,
|
||
`account_outbounds` ;",
|
||
|
||
"ALTER TABLE `members_fees` ADD `activation_date` DATE NOT NULL DEFAULT '0000-00-00',
|
||
ADD `deactivation_date` DATE NULL DEFAULT NULL;",
|
||
"ALTER TABLE `accounts` ADD `balance` DOUBLE NULL DEFAULT '0' COMMENT 'Account balance, value is updated with respect to transfers of account' AFTER `account_attribute_id` "
|
||
|
||
"ALTER TABLE `members_fees` DROP PRIMARY KEY;",
|
||
|
||
"ALTER TABLE `members_fees` ADD `id` INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST;",
|
||
|
||
"ALTER TABLE `fees` CHANGE `from` `from` DATE NOT NULL ,
|
||
CHANGE `to` `to` DATE NOT NULL;",
|
||
|
||
"INSERT INTO `axo` (`id`, `section_value`, `value`, `order_value`, `name`, `hidden`) VALUES ('171', 'Members_Controller', 'fees', '0', 'Member''s fees', '0');",
|
||
|
||
"INSERT INTO `axo_map` (`acl_id`, `section_value`, `value`) VALUES ('38', 'Members_Controller', 'fees'), ('51', 'Members_Controller', 'fees');",
|
||
|
||
"INSERT INTO `acl` (`id`, `section_value`, `allow`, `enabled`, `return_value`, `note`, `updated_date`) VALUES ('75', 'user', '1', '1', NULL, 'Engineers can view tariffs of members, but they cannot edit them.', '1290348631');",
|
||
|
||
"INSERT INTO `aro_groups_map` (`acl_id`, `group_id`) VALUES ('75', '29');",
|
||
|
||
"INSERT INTO `aco_map` (`acl_id`, `section_value`, `value`) VALUES ('75', 'freenetis', 'view_all');",
|
||
|
||
"INSERT INTO `axo_map` (`acl_id`, `section_value`, `value`) VALUES ('75', 'Members_Controller', 'fees');",
|
||
|
||
"INSERT INTO `axo_map` (`acl_id`, `section_value`, `value`) VALUES ('43', 'Members_Controller', 'fees');",
|
||
|
||
"INSERT INTO `axo_map` (`acl_id`, `section_value`, `value`) VALUES ('56', 'Members_Controller', 'fees');",
|
||
|
||
"ALTER TABLE `members_fees` ADD `priority` INT( 11 ) NOT NULL DEFAULT '1';",
|
||
|
||
"INSERT INTO members_fees
|
||
SELECT NULL AS id, f.id AS fee_id, 1 AS member_id, f.from AS activation_date, f.to AS deactivation_date, 1 AS priority FROM fees f;",
|
||
|
||
"ALTER TABLE `fees` ADD `readonly` BOOLEAN NOT NULL AFTER `id`;",
|
||
|
||
"ALTER TABLE `fees` ADD `special_type_id` INT NULL DEFAULT NULL;",
|
||
|
||
"INSERT INTO fees
|
||
SELECT NULL AS id, 1 AS readonly, 0 AS fee, m.entrance_date AS 'from', '2033-07-01' AS 'to', e.id AS type_id, 'Membership interrupt' AS name, 1 AS special_type_id FROM
|
||
(SELECT entrance_date FROM members m WHERE m.id = 1) m,
|
||
(SELECT e.id FROM enum_types e WHERE value = 'regular member fee' AND type_id = 6) e;",
|
||
|
||
"INSERT INTO fees
|
||
SELECT NULL AS id, 1 AS readonly, 0 AS fee, m.entrance_date AS 'from', '2033-07-01' AS 'to', e.id AS type_id, 'Fee-free regular member' AS name, 2 AS special_type_id FROM
|
||
(SELECT entrance_date FROM members m WHERE m.id = 1) m,
|
||
(SELECT e.id FROM enum_types e WHERE value = 'regular member fee' AND type_id = 6) e;",
|
||
|
||
"INSERT INTO fees
|
||
SELECT NULL AS id, 1 AS readonly, 0 AS fee, m.entrance_date AS 'from', '2033-07-01' AS 'to', e.id AS type_id, 'Non-member' AS name, 3 AS special_type_id FROM
|
||
(SELECT entrance_date FROM members m WHERE m.id = 1) m,
|
||
(SELECT e.id FROM enum_types e WHERE value = 'regular member fee' AND type_id = 6) e;",
|
||
|
||
"INSERT INTO fees
|
||
SELECT NULL AS id, 1 AS readonly, 0 AS fee, m.entrance_date AS 'from', '2033-07-01' AS 'to', e.id AS type_id, 'Honorary member' AS name, 4 AS special_type_id FROM
|
||
(SELECT entrance_date FROM members m WHERE m.id = 1) m,
|
||
(SELECT e.id FROM enum_types e WHERE value = 'regular member fee' AND type_id = 6) e;",
|
||
|
||
"ALTER TABLE `membership_interrupts` ADD `members_fee_id` INT( 11 ) NULL DEFAULT NULL AFTER `member_id`;",
|
||
|
||
"INSERT INTO members_fees
|
||
SELECT NULL AS id, f.id AS fee_id, mi.member_id, mi.from AS activation_date, mi.to AS deactivation_date, 0 AS priority FROM membership_interrupts mi
|
||
LEFT JOIN fees f ON f.special_type_id = 1;",
|
||
|
||
"UPDATE membership_interrupts mi, members_fees mf SET mi.members_fee_id = mf.id WHERE mi.member_id = mf.member_id AND mi.from = mf.activation_date AND mi.to = mf.deactivation_date;",
|
||
|
||
"ALTER TABLE `membership_interrupts`
|
||
DROP `from`,
|
||
DROP `to`;",
|
||
|
||
"INSERT INTO members_fees
|
||
SELECT NULL AS id, f.id AS fee_id, m.id AS member_id, m.entrance_date AS activation_date, IF(m.leaving_date <> '0000-00-00', m.leaving_date, '2033-07-01') AS deactivation_date, 1 AS priority FROM members m
|
||
LEFT JOIN enum_types et ON m.type = et.id
|
||
LEFT JOIN fees f ON et.value = f.name AND f.readonly = 1
|
||
WHERE m.id <> 1 AND f.id IS NOT NULL;"
|
||
|
||
);
|
||
?>
|
freenetis/branches/testing/application/upgrade_sql/upgrade_sql_794.php | ||
---|---|---|
<?php
|
||
|
||
$upgrade_sql[794] = array(
|
||
|
||
// GPS in address points is an point of GEOM
|
||
"RENAME TABLE `fees_members` TO `members_fees`;",
|
||
|
||
"ALTER TABLE `members_fees` ADD `activation_date` DATE NOT NULL DEFAULT '0000-00-00',
|
||
ADD `deactivation_date` DATE NULL DEFAULT NULL;",
|
||
|
||
"ALTER TABLE `members_fees` DROP PRIMARY KEY;",
|
||
|
||
"ALTER TABLE `members_fees` ADD `id` INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST;",
|
||
|
||
"ALTER TABLE `fees` CHANGE `from` `from` DATE NOT NULL ,
|
||
CHANGE `to` `to` DATE NOT NULL;",
|
||
|
||
"INSERT INTO `axo` (`id`, `section_value`, `value`, `order_value`, `name`, `hidden`) VALUES ('171', 'Members_Controller', 'fees', '0', 'Member''s fees', '0');",
|
||
|
||
"INSERT INTO `axo_map` (`acl_id`, `section_value`, `value`) VALUES ('38', 'Members_Controller', 'fees'), ('51', 'Members_Controller', 'fees');",
|
||
|
||
"INSERT INTO `acl` (`id`, `section_value`, `allow`, `enabled`, `return_value`, `note`, `updated_date`) VALUES ('75', 'user', '1', '1', NULL, 'Engineers can view tariffs of members, but they cannot edit them.', '1290348631');",
|
||
|
||
"INSERT INTO `aro_groups_map` (`acl_id`, `group_id`) VALUES ('75', '29');",
|
||
|
||
"INSERT INTO `aco_map` (`acl_id`, `section_value`, `value`) VALUES ('75', 'freenetis', 'view_all');",
|
||
|
||
"INSERT INTO `axo_map` (`acl_id`, `section_value`, `value`) VALUES ('75', 'Members_Controller', 'fees');",
|
||
|
||
"INSERT INTO `axo_map` (`acl_id`, `section_value`, `value`) VALUES ('43', 'Members_Controller', 'fees');",
|
||
|
||
"INSERT INTO `axo_map` (`acl_id`, `section_value`, `value`) VALUES ('56', 'Members_Controller', 'fees');",
|
||
|
||
"ALTER TABLE `members_fees` ADD `priority` INT( 11 ) NOT NULL DEFAULT '1';",
|
||
|
||
"INSERT INTO members_fees
|
||
SELECT NULL AS id, f.id AS fee_id, 1 AS member_id, f.from AS activation_date, f.to AS deactivation_date, 1 AS priority FROM fees f;",
|
||
|
||
"ALTER TABLE `fees` ADD `readonly` BOOLEAN NOT NULL AFTER `id`;",
|
||
|
||
"ALTER TABLE `fees` ADD `special_type_id` INT NULL DEFAULT NULL;",
|
||
|
||
"INSERT INTO fees
|
||
SELECT NULL AS id, 1 AS readonly, 0 AS fee, m.entrance_date AS 'from', '2033-07-01' AS 'to', e.id AS type_id, 'Membership interrupt' AS name, 1 AS special_type_id FROM
|
||
(SELECT entrance_date FROM members m WHERE m.id = 1) m,
|
||
(SELECT e.id FROM enum_types e WHERE value = 'regular member fee' AND type_id = 6) e;",
|
||
|
||
"INSERT INTO fees
|
||
SELECT NULL AS id, 1 AS readonly, 0 AS fee, m.entrance_date AS 'from', '2033-07-01' AS 'to', e.id AS type_id, 'Fee-free regular member' AS name, 2 AS special_type_id FROM
|
||
(SELECT entrance_date FROM members m WHERE m.id = 1) m,
|
||
(SELECT e.id FROM enum_types e WHERE value = 'regular member fee' AND type_id = 6) e;",
|
||
|
||
"INSERT INTO fees
|
||
SELECT NULL AS id, 1 AS readonly, 0 AS fee, m.entrance_date AS 'from', '2033-07-01' AS 'to', e.id AS type_id, 'Non-member' AS name, 3 AS special_type_id FROM
|
||
(SELECT entrance_date FROM members m WHERE m.id = 1) m,
|
||
(SELECT e.id FROM enum_types e WHERE value = 'regular member fee' AND type_id = 6) e;",
|
||
|
||
"INSERT INTO fees
|
||
SELECT NULL AS id, 1 AS readonly, 0 AS fee, m.entrance_date AS 'from', '2033-07-01' AS 'to', e.id AS type_id, 'Honorary member' AS name, 4 AS special_type_id FROM
|
||
(SELECT entrance_date FROM members m WHERE m.id = 1) m,
|
||
(SELECT e.id FROM enum_types e WHERE value = 'regular member fee' AND type_id = 6) e;",
|
||
|
||
"ALTER TABLE `membership_interrupts` ADD `members_fee_id` INT( 11 ) NULL DEFAULT NULL AFTER `member_id`;",
|
||
|
||
"INSERT INTO members_fees
|
||
SELECT NULL AS id, f.id AS fee_id, mi.member_id, mi.from AS activation_date, mi.to AS deactivation_date, 0 AS priority FROM membership_interrupts mi
|
||
LEFT JOIN fees f ON f.special_type_id = 1;",
|
||
|
||
"UPDATE membership_interrupts mi, members_fees mf SET mi.members_fee_id = mf.id WHERE mi.member_id = mf.member_id AND mi.from = mf.activation_date AND mi.to = mf.deactivation_date;",
|
||
|
||
"ALTER TABLE `membership_interrupts`
|
||
DROP `from`,
|
||
DROP `to`;",
|
||
|
||
"INSERT INTO members_fees
|
||
SELECT NULL AS id, f.id AS fee_id, m.id AS member_id, m.entrance_date AS activation_date, IF(m.leaving_date <> '0000-00-00', m.leaving_date, '2033-07-01') AS deactivation_date, 1 AS priority FROM members m
|
||
LEFT JOIN enum_types et ON m.type = et.id
|
||
LEFT JOIN fees f ON et.value = f.name AND f.readonly = 1
|
||
WHERE m.id <> 1 AND f.id IS NOT NULL;"
|
||
|
||
);
|
||
|
||
|
||
?>
|
Také k dispozici: Unified diff
Priprava databazove struktury na ukladani castky primo na ucte oproti puvodnimu pocitani z prevodu.