コード例 #1
0
 /**
  * Check Whether the Employee is Allowed to Apply Requested Leave Days
  * @param array $requestedLeaveDays key => leave period id
  * @param LeaveRequest $leaveRequest
  * @return boolean 
  */
 public function isLeaveRequestNotExceededLeaveBalance($requestedLeaveDays, $leaveRequest)
 {
     foreach ($requestedLeaveDays as $leavePeriodId => $days) {
         $leaveQuota = $this->getEmployeeLeaveEntitlementDays($leaveRequest->getEmployeeId(), $leaveRequest->getLeaveTypeId(), $leavePeriodId);
         $acceptedLeaveDays = $this->getLeaveRequestService()->getNumOfAvaliableLeave($leaveRequest->getEmployeeId(), $leaveRequest->getLeaveTypeId(), $leavePeriodId);
         if ($days > $leaveQuota - $acceptedLeaveDays) {
             return false;
         }
     }
     return true;
 }