/**
  * Get an specific user by its Id
  */
 public function getAction()
 {
     if (!$this->_hasParam('id')) {
         throw new InvalidArgumentException("Null Identifier recived");
     }
     $spId = $this->_getParam('id');
     $sp = $this->_spSrv->load($spId);
     if (empty($sp)) {
         throw new NotFoundException("ServicePack {$spId} not found", 404);
     }
     //        $this->_helper->allowed('read', $sp);
     $this->_spSrv->loadSubModels($sp);
     $modified = false;
     $tpModified = false;
     $lcModified = false;
     if (!empty($sp->tariffPlanServices)) {
         $tariffPlan = $sp->tariffPlanServices;
         // Check if there's any modified tariff
         $entries = array('defaultTermVoice', 'origVoice', 'defaultData', 'data', 'defaultOrigVoice', 'defaultSms', 'termVoice');
         $fields = array('q1Modified', 't2SModified', 't2QModified', 't4QModified', 't6QModified');
         foreach ($entries as $entry) {
             foreach ($fields as $field) {
                 if (!empty($tariffPlan->{$entry}->{$field})) {
                     $modified = true;
                     $tpModified = true;
                     break 2;
                 }
             }
         }
         if (isset($tariffPlan->zonePlan)) {
             $zoneGroups = $tariffPlan->zonePlan->zoneGroups;
             if (!empty($zoneGroups)) {
                 foreach ($zoneGroups as $zoneGroup) {
                     if (!empty($zoneGroup->zonesModified)) {
                         $modified = true;
                         $tpModified = true;
                         break;
                     }
                 }
             }
         }
     }
     if (!empty($sp->tariffPlanLifeCycle)) {
         $tariffPlan = $sp->tariffPlanLifeCycle;
         if (!empty($tariffPlan->status)) {
             foreach ($tariffPlan->status as $status) {
                 if (!empty($status->costModified)) {
                     $modified = true;
                     $lcModified = true;
                     break;
                 }
             }
         }
         if (!$lcModified && !empty($tariffPlan->transitions)) {
             foreach ($tariffPlan->transitions as $transition) {
                 if (!empty($transition->costModified)) {
                     $modified = true;
                     $lcModified = true;
                     break;
                 }
             }
         }
     }
     $this->view->data = $sp->exportData();
     try {
         $this->_helper->allowed('view_discounts', $sp);
         $discounts = $this->_spSrv->getDiscounts($sp);
     } catch (Exception $e) {
         $org = \App::getOrgUserLogged();
         try {
             $acl = \App::get('acl');
             if ($acl->existsPrivilege(\App::getUserLogged(), $org, 'read_field_discounts')) {
                 $this->_helper->allowed('read_field_discounts', $org);
             } else {
                 $this->_helper->allowed('read_field_default', $org);
             }
             $discounts = array();
             if ($org->getType() === \Application\Model\Organization\OrgCustomerModel::ORG_TYPE && $org->getServicepacksDiscounts() && $org->getServicepacksDiscounts()->customerServicepack) {
                 // Search current service pack
                 $spDisc = $org->getServicepacksDiscounts()->customerServicepack;
                 foreach ($spDisc as $disc) {
                     if ($disc->servicepackId == $sp->id) {
                         // See \Application\Model\ServicePack\Discount
                         $discounts[] = array('customerId' => $org->getId(), 'customerName' => $org->getName(), 'voice' => $disc->getVoiceDiscount(), 'sms' => $disc->getSmsDiscount(), 'data' => $disc->getDataDiscount());
                     }
                 }
             }
         } catch (Exception $e) {
             // Do nothing
         }
     }
     if (!empty($discounts)) {
         $this->view->data['discounts'] = $discounts;
     }
     try {
         $this->_helper->allowed('view_voucher_only_discounts', $sp);
         $voucherOnlyDiscounts = $this->_spSrv->getVoucherOnlyDiscounts($sp);
     } catch (Exception $e) {
         $org = \App::getOrgUserLogged();
         try {
             $acl = \App::get('acl');
             if ($acl->existsPrivilege(\App::getUserLogged(), $org, 'read_field_voucher_only_discounts')) {
                 $this->_helper->allowed('read_field_voucher_only_discounts', $org);
             } else {
                 $this->_helper->allowed('read_field_default', $org);
             }
             $voucherOnlyDiscounts = array();
             if ($org->getType() === \Application\Model\Organization\OrgCustomerModel::ORG_TYPE && $org->getServicepacksDiscounts() && $org->getServicepacksDiscounts()->customerServicepack) {
                 // Search current service pack
                 $spVoucherDisc = $org->getServicepacksDiscounts()->customerServicepack;
                 foreach ($spVoucherDisc as $disc) {
                     if ($disc->servicepackId == $sp->id) {
                         // See \Application\Model\ServicePack\Discount
                         $voucherOnlyDiscounts[] = array('customerId' => $org->getId(), 'customerName' => $org->getName(), 'voice' => $disc->getVoucherOnlyVoiceDiscount(), 'sms' => $disc->getVoucherOnlySmsDiscount(), 'data' => $disc->getVoucherOnlyDataDiscount());
                     }
                 }
             }
         } catch (Exception $e) {
             // Do nothing
         }
     }
     if (!empty($voucherOnlyDiscounts)) {
         $this->view->data['voucherOnlyDiscounts'] = $voucherOnlyDiscounts;
     }
     $this->view->data['tariffPlanServices']['modified'] = $tpModified;
     $this->view->data['tariffPlanLifeCycle']['modified'] = $lcModified;
     $this->view->modified = $modified;
 }