correct recalculation of resource usage for admins
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
@@ -129,8 +129,7 @@ class User
|
|||||||
'email_forwarders',
|
'email_forwarders',
|
||||||
'email_quota',
|
'email_quota',
|
||||||
'subdomains'
|
'subdomains'
|
||||||
] as $field
|
] as $field) {
|
||||||
) {
|
|
||||||
self::addResourceCount($admin_resources[$cur_adm], $customer, $field . '_used', $field);
|
self::addResourceCount($admin_resources[$cur_adm], $customer, $field . '_used', $field);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -262,8 +261,18 @@ class User
|
|||||||
// now get the customer resource usage which we have re-calculated previously
|
// now get the customer resource usage which we have re-calculated previously
|
||||||
foreach ($admin_customers as $acustomer) {
|
foreach ($admin_customers as $acustomer) {
|
||||||
foreach ($resource_fields as $field) {
|
foreach ($resource_fields as $field) {
|
||||||
|
if ($field == 'diskspace_used') {
|
||||||
|
// admin/reseller-usage == what has been assign to the customer
|
||||||
|
$admin[$field . '_new'] += $acustomer['diskspace'];
|
||||||
|
} else if ($field != 'traffic_used') {
|
||||||
|
if ($acustomer[str_replace("_used", "", $field)] != '-1') {
|
||||||
|
$admin[$field . '_new'] += $acustomer[str_replace("_used", "", $field)];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// traffic is always the current usage, not the assigned value
|
||||||
$admin[$field . '_new'] += $acustomer[$field];
|
$admin[$field . '_new'] += $acustomer[$field];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// check for std-subdomain
|
// check for std-subdomain
|
||||||
if ($acustomer['standardsubdomain'] > 0) {
|
if ($acustomer['standardsubdomain'] > 0) {
|
||||||
// std-subdomain does not count as assigned resource
|
// std-subdomain does not count as assigned resource
|
||||||
@@ -326,9 +335,9 @@ class User
|
|||||||
{
|
{
|
||||||
self::initArrField($used_field, $arr, 0);
|
self::initArrField($used_field, $arr, 0);
|
||||||
if ($field == 'diskspace' && ($customer_arr[$field] / 1024) != '-1') {
|
if ($field == 'diskspace' && ($customer_arr[$field] / 1024) != '-1') {
|
||||||
$arr[$used_field] += intval($customer_arr[$used_field]);
|
$arr[$used_field] += intval($customer_arr[$field]);
|
||||||
} elseif ($field == 'traffic_used') {
|
} elseif ($field == 'traffic_used') {
|
||||||
$arr[$used_field] += intval($customer_arr[$used_field]);
|
$arr[$used_field] += intval($customer_arr[$field]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user