/** * Apply leave Quota multiple Years * */ private function _addLeaveQuota() { $fromYearArray = explode("-", $this->getLeaveFromDate()); $toYearArray = explode("-", $this->getLeaveToDate()); if (trim($fromYearArray[0]) == trim($toYearArray[0])) { $leaveQuata = new LeaveQuota(); $leaveQuata->setEmployeeId($this->getEmployeeId()); $leaveQuata->setLeaveTypeId($this->getLeaveTypeId()); $leaveQuata->setNoOfDaysAllotted(0); $leaveQuata->setYear(trim($fromYearArray[0])); if ($leaveQuata->addLeaveQuotaAdmin()) { return true; } else { return false; } } else { $leaveQuata = new LeaveQuota(); $leaveQuata->setEmployeeId($this->getEmployeeId()); $leaveQuata->setLeaveTypeId($this->getLeaveTypeId()); $leaveQuata->setNoOfDaysAllotted(0); $leaveQuata->setYear(trim($fromYearArray[0])); $quotaFrom = $leaveQuata->addLeaveQuotaAdmin(); $leaveQuata->setYear(trim($toYearArray[0])); $quotaTo = $leaveQuata->addLeaveQuotaAdmin(); if ($quotaFrom && $quotaTo) { return true; } else { return false; } } }