예제 #1
0
 /**
  * This function get a database resource as the input and creates a HSP objects array
  * containing the data of the resource.
  */
 private static function _buildSummaryObjects($result)
 {
     $dbConnection = new DMLFunctions();
     $hspObjArr = null;
     while ($row = $dbConnection->dbObject->getArray($result)) {
         $hspObj = new Hsp();
         $empName = EmpInfo::getFullName($row[1]);
         if (isset($empName)) {
             // For excluding deleted employees
             $hspObj->setSummaryId($row[0]);
             $hspObj->setEmployeeId($row[1]);
             $hspObj->setHspPlanId($row[2]);
             $hspObj->setHspPlanName(DefineHsp::getHspPlanName($row[2]));
             $hspObj->setEmployeeName($empName);
             $hspObj->setHspPlanYear($row[3]);
             $hspObj->setHspPlanStatus($row[4]);
             $hspObj->setAnnualLimit($row[5]);
             $hspObj->setEmployerAmount($row[6]);
             $hspObj->setEmployeeAmount($row[7]);
             $hspObj->setTotalAccrued($row[8]);
             $hspObj->setTotalUsed($row[9]);
             $currentHspPlan = Config::getHspCurrentPlan();
             if ($currentHspPlan == 3 || $currentHspPlan == 4 || $currentHspPlan == 5) {
                 // If FSA is avaialbe in current plan
                 if ($row[2] == 3) {
                     $hspObj->setFsaBalance(self::_fetchLastYearFsaBalance($row[1], $row[3] - 1));
                 } else {
                     $hspObj->setFsaBalance("NA");
                 }
             }
             $hspObjArr[] = $hspObj;
         }
     }
     return $hspObjArr;
 }
예제 #2
0
 */
ob_start();
session_start();
if (!defined('ROOT_PATH')) {
    define('ROOT_PATH', $_SESSION['path']);
}
require_once ROOT_PATH . '/lib/models/benefits/Hsp.php';
require_once ROOT_PATH . '/lib/models/benefits/mail/HspMailNotification.php';
try {
    $hspSummaryId = $_GET['hspSummaryId'];
    $newHspStatus = $_GET['newHspStatus'];
    $empId = $_GET['empId'];
    $hsp = new Hsp();
    $hsp->setEmployeeId($empId);
    $hsp->setSummaryId($hspSummaryId);
    $hsp->setHspPlanStatus($newHspStatus);
    $hspMailNotification = new HspMailNotification();
    if (Hsp::updateStatus($hspSummaryId, $newHspStatus)) {
        switch ($newHspStatus) {
            case Hsp::HSP_STATUS_HALTED:
                $hspMailNotification->sendHspPlanHaltedByHRAdminNotification($hsp);
                break;
            case Hsp::HSP_STATUS_ACTIVE:
                break;
            case Hsp::HSP_STATUS_ESS_HALTED:
                $hspMailNotification->sendHspPlanHaltedByHRAdminOnRequestNotification($hsp);
                break;
            case Hsp::HSP_STATUS_PENDING_HALT:
                $hspMailNotification->sendHspPlanHaltRequestedByESSNotification($hsp);
                break;
        }