Пример #1
0
 public static function denyHspRequest($id)
 {
     $hspReqest = HspPaymentRequest::getHspRequest($id);
     try {
         $msg = 'DENY_SUCCESS';
         $hspReqest->denyHspRequest();
         $hspMailNotification = new HspMailNotification();
         $hspMailNotification->sendHspPaymentDenyNotification($hspReqest);
     } catch (HspPaymentRequestException $e) {
         switch ($e->getCode()) {
             case HspException::INVALID_ROW_COUNT:
                 $msg = 'DENY_FAILURE';
                 break;
             default:
                 $msg = 'UNKNOWN_ERROR_FAILURE';
                 break;
         }
     }
     self::redirect($msg, '?benefitcode=Benefits&action=List_Hsp_Due');
 }
Пример #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;
        }
        echo 'done:' . $newHspStatus;