]> wagnertech.de Git - timetracker.git/blobdiff - plugins/MonthlyQuota.class.php
Started using quota percent for users if defined.
[timetracker.git] / plugins / MonthlyQuota.class.php
index 29d8cfb7baae124b881143d0eafad5835d1bee04..a1c1b5d0985ef06acb1fefecc3898ce69aa9cd0b 100644 (file)
@@ -84,6 +84,16 @@ class MonthlyQuota {
     return $numWorkdays * $user->getWorkdayMinutes();
   }
 
+  // getUserQuota - obtains a quota for user for a single month.
+  // This quota is adjusted by quota_percent value for user.
+  public function getUserQuota($year, $month) {
+    global $user;
+
+    $minutes = $this->getSingle($year, $month);
+    $userMinutes = (int) $minutes * $user->getQuotaPercent() / 100;
+    return $userMinutes;
+  }
+
   // getMany - returns an array of quotas for a given year for group.
   private function getMany($year){
     $sql = "select month, minutes from tt_monthly_quotas".