Beispiel #1
0
 public function copyLeaveQuotaFromLastYear($currYear)
 {
     if ($_SESSION['isAdmin'] !== 'Yes') {
         trigger_error("Unauthorized access", E_USER_NOTICE);
     }
     $leaveQuotaObj = new LeaveQuota();
     $res = false;
     if ($this->_validToCopyQuotaFromLastYear($currYear)) {
         $res = $leaveQuotaObj->copyQuota($currYear - 1, $currYear);
     }
     if ($res) {
         /*
          * This part was changed to fix the bug 1927022 - Supervisor approve leave and apply
          * leave, in same screen
          *
          * In case of broken functionality, this need to be changed. The old code was:
          *
          * $this->redirect("LEAVE_QUOTA_COPY_SUCCESS", null, null, "&year=$currYear&id=0");
          *
          */
         $this->redirect(null, array("?leavecode=Leave&action=Leave_Summary&year={$currYear}&id=0&message=LEAVE_QUOTA_COPY_SUCCESS"));
     } else {
         /*
          * This part was changed to fix the bug 2030001 - Leave:Copy leave quota misbehaves
          * Seems like the redirect method of this controller is not working properly
          * when called as in the earlier statement, causing errors in IE
          *
          * Earlier statement was:
          * $this->redirect("LEAVE_QUOTA_COPY_FAILURE", null, null, "&year=$currYear&id=0");
          *
          */
         $this->redirect(null, array("?leavecode=Leave&action=Leave_Summary&year={$currYear}&id=0&message=LEAVE_QUOTA_COPY_FAILURE"));
     }
 }