SAAS-1229 - add default bandwidth limit values

This commit is contained in:
Duncan Sommerville 2015-11-25 15:04:45 -05:00
parent 82544f34d9
commit 3f241b2f25
2 changed files with 45 additions and 1 deletions

View file

@ -5,6 +5,43 @@ define("WHMCS_AIRTIME_GROUP_ID", 15);
class Billing class Billing
{ {
// TODO: remove this once all existing customers have bandwidth limits set
public static $PLAN_TYPE_DEFAULTS = array(
"hobbyist" => array(
"bandwidth_limit" => 1099511627776
),
"starter" => array(
"bandwidth_limit" => 3298534883328
),
"starter2" => array(
"bandwidth_limit" => 3298534883328
),
"plus" => array(
"bandwidth_limit" => 10995116277760
),
"plus2" => array(
"bandwidth_limit" => 10995116277760
),
"premium" => array(
"bandwidth_limit" => 43980465111040
),
"premium2" => array(
"bandwidth_limit" => 43980465111040
),
"enterprise" => array(
"bandwidth_limit" => 164926744166400
),
"complimentary" => array(
"bandwidth_limit" => 32985348833280
),
"sida" => array(
"bandwidth_limit" => 32985348833280
),
"custom" => array(
"bandwidth_limit" => 10995116277760
),
);
public static function getAPICredentials() public static function getAPICredentials()
{ {
return array( return array(

View file

@ -1591,7 +1591,14 @@ class Application_Model_Preference
public static function getBandwidthLimit() { public static function getBandwidthLimit() {
$val = self::getValue("bandwidth_limit"); $val = self::getValue("bandwidth_limit");
return empty($val) ? 0 : $val; if (empty($val)) {
// Set and return the plan defaults
// TODO: remove this once all existing customers have this pref set
$planType = self::GetPlanLevel();
$val = Billing::$PLAN_TYPE_DEFAULTS[$planType]["bandwidth_limit"];
self::setBandwidthLimit($val);
}
return $val;
} }
public static function setBandwidthLimit($value) { public static function setBandwidthLimit($value) {