TT#61105 allow modifying billing profile/networks if not actual (6.5+)

Change-Id: I3a32eb99062464aca9a8c383a0a412e3469e5240
changes/65/31565/2
Rene Krenn 6 years ago
parent 6351678560
commit 3478751223

@ -448,8 +448,19 @@ sub switch_prepaid {
}
sub get_contract_count_stmt {
#die("todo");
return "select count(distinct c.id) from `billing`.`contracts_billing_profile_network` cbpn join `billing`.`contracts` c on c.id = cbpn.contract_id where cbpn.`billing_profile_id` = `me`.`id` and c.status != 'terminated' and (cbpn.end_date is null or cbpn.end_date >= now())";
return <<EOS;
select
count(distinct c.id)
from billing.contracts_billing_profile_network_schedule cbpns
join billing.contracts_billing_profile_network cbpn on cbpns.profile_network_id = cbpn.id
join billing._v_actual_effective_start_time est on est.contract_id = cbpn.contract_id and cbpns.effective_start_time = est.effective_start_time
join billing.contracts as c on est.contract_id = c.id
where
cbpn.billing_profile_id = me.id
and c.status != 'terminated'
EOS
}
sub get_package_count_stmt {
return "select count(distinct pp.id) from `billing`.`package_profile_sets` pps join `billing`.`profile_packages` pp on pp.id = pps.package_id where pps.`profile_id` = `me`.`id`"; # and pp.status != 'terminated'";

@ -150,7 +150,19 @@ sub _validate_ip {
}
sub get_contract_count_stmt {
return "select count(distinct c.id) from `billing`.`contracts_billing_profile_network` cbpn join `billing`.`contracts` c on c.id = cbpn.contract_id where cbpn.`billing_network_id` = `me`.`id` and c.status != 'terminated' and (cbpn.end_date is null or cbpn.end_date >= now())";
return <<EOS;
select
count(distinct c.id)
from billing.contracts_billing_profile_network_schedule cbpns
join billing.contracts_billing_profile_network cbpn on cbpns.profile_network_id = cbpn.id
join billing._v_actual_effective_start_time est on est.contract_id = cbpn.contract_id and cbpns.effective_start_time = est.effective_start_time
join billing.contracts as c on est.contract_id = c.id
where
cbpn.billing_network_id = me.id
and c.status != 'terminated'
EOS
}
sub get_package_count_stmt {
return "select count(distinct pp.id) from `billing`.`package_profile_sets` pps join `billing`.`profile_packages` pp on pp.id = pps.package_id where pps.`network_id` = `me`.`id`"; # and pp.status != 'terminated'";

Loading…
Cancel
Save