コード例 #1
0
 public function indexAction()
 {
     // Check permissions
     $dumbSim = new SimModel();
     $this->_helper->allowed('preinventory_list', $dumbSim);
     $filters = $this->_mapToModel($this->_getFilterParams(), false);
     $filters = $this->_mapToFilter($filters);
     if (isset($filters['subscriptionID'])) {
         $filters['id'] = $filters['subscriptionID'];
     }
     $this->_checkFilterParams($filters, StockFilterFields::getWhiteList());
     $filterList = $this->_stockSrv->buildFilterList($filters);
     $this->_helper->filterNotAllowedFilters('filter_by', $filterList);
     $filterHelper = $this->_helper->getHelper('filterNotAllowedFilters');
     $filterHelper->setThrowExOnNotAllowed(true);
     $filterHelper->direct('filter_by', $filterList);
     $params = $this->_getPaginatorParams();
     $simList = $this->_stockSrv->listAll($filterList, $params);
     if ($simList instanceof \Application\Model\ListResultModel) {
         $this->view->subscriptionData = array();
         foreach ($simList as $value) {
             $subscriptionData = $value->exportData();
             $subscriptionData = $this->_mapToSdp($subscriptionData);
             // Make the data available on the view
             $this->view->subscriptionData[] = $subscriptionData;
         }
     }
 }
コード例 #2
0
 /**
  * Builds a filter list based on params.
  * @param  array          $params
  * @return App_ListFilter | null
  */
 public function buildFilterList(array $params)
 {
     /**
      * Check if ICC parameter exists and if it's valid
      */
     /* REMOVED according to GLOBALPORTAL-12528 (https://jira.tid.es/browse/GLOBALPORTAL-12528)
        if (!empty($params['icc'])) {
            if (!$this->luhn($params['icc'])) {
                throw new AppEx\InvalidArgumentException('Invalid search query');
            }
        }
        */
     /**
      * Check if IMSI parameter exists and if it's valid
      */
     if (!empty($params['imsi'])) {
         $imsis = explode('<>', $params['imsi']);
         if (count($imsis) == 2) {
             /**
              * Is it a range of IMSIs?
              */
             /* REMOVED according to GLOBALPORTAL-12528 (https://jira.tid.es/browse/GLOBALPORTAL-12528)
                if (preg_match('/^[0-9]{15}$/', trim($imsis[0])) &&
                    preg_match('/^[0-9]{15}$/', trim($imsis[1]))) {
                */
             $params['imsi'] = $imsis[0] . '<>' . $imsis[1];
             /* REMOVED according to GLOBALPORTAL-12528 (https://jira.tid.es/browse/GLOBALPORTAL-12528)
                } else {
                    throw new AppEx\InvalidArgumentException('Invalid search query');
                }
                */
         } else {
             /* REMOVED according to GLOBALPORTAL-12528 (https://jira.tid.es/browse/GLOBALPORTAL-12528)
                if (!preg_match('/^[0-9]{15}$/', trim($params['imsi']))) {
                    throw new AppEx\InvalidArgumentException('Invalid search query');
                }
                */
         }
     }
     $factory = new \App_ListFilter_FilterFactory();
     $factory->setWhiteList(StockFilterFields::getWhiteList());
     $factory->getSortingWhiteList(StockSortingFields::getWhiteList());
     $filterList = $factory->constructFilter($params);
     if (!$filterList->isValid()) {
         $filterList = new \App_ListFilter();
     }
     $filterList->setResourceId(StockFilterFields::getResourceId());
     $filterList->addExtraData('filterType', 'stock');
     \App::log()->debug('Unused filters [' . implode(',', $factory->getUnusedList()) . ']');
     return $filterList;
 }