コード例 #1
0
 protected function _mapEricssonModelToModel(array $data)
 {
     $model = parent::_mapEricssonModelToModel($data);
     if (!empty($model['zoneGroups'])) {
         foreach ($model['zoneGroups'] as &$zoneGroup) {
             if (!isset($zoneGroup['isDeleted'])) {
                 $zoneGroup['isDeleted'] = false;
             }
         }
     }
     if (isset($model['zonePlanModified']) && !$model['zonePlanModified']) {
         unset($model['zonePlanModified']);
     }
     return $model;
 }
コード例 #2
0
 /**
  * TODO Rename all _mapModelToXxxModel to _mapModelToProtoModel like here
  *
  * Maps application model fields to proto message fields
  * @param  array $data
  * @return array
  */
 protected function _mapModelToProtoModel(array $data)
 {
     $data = parent::_mapModelToEricssonModel($data);
     if (!isset($data['customer_id'])) {
         $data['customer_id'] = self::$organizationId;
     }
     $data['id'] = isset($data['id']) && is_array($data['id']) ? $data['id'] : array();
     if (isset($data['name'])) {
         $data['id']['name'] = $data['name'];
         unset($data['name']);
     }
     if (isset($data['customer_id'])) {
         $data['id']['customer']['name'] = OrganizationMapper::cleanOrgId($data['customer_id']);
         unset($data['customer_id']);
     }
     if (isset($data['subscriber_count'])) {
         unset($data['subscriber_count']);
         // Not in protos
     }
     return $data;
 }
コード例 #3
0
 protected function _mapModelToEricssonModel(array $data)
 {
     $restrictions = array();
     $types = array('voice', 'sms', 'data');
     foreach ($types as $type) {
         if (isset($data[$type]) && is_array($data[$type])) {
             foreach ($data[$type] as $sector1 => $sector1Items) {
                 if (is_array($sector1Items)) {
                     foreach ($sector1Items as $sector2 => $value) {
                         $restrictions[$type . ucfirst($sector1) . ucfirst($sector2)] = $value;
                     }
                 } else {
                     $restrictions[$type . ucfirst($sector1)] = $sector1Items;
                 }
             }
         }
         unset($data[$type]);
     }
     unset($data['restrictionsModified']);
     $data['restrictions'] = $restrictions;
     $data = parent::_mapModelToEricssonModel($data);
     return $data;
 }
コード例 #4
0
 protected function _mapModelToEricssonModel(array $data)
 {
     $aux = array();
     //Default Tariff
     $defaultTariff = array('defaultData', 'defaultOrigVoice', 'defaultTermVoice', 'defaultSms');
     foreach ($defaultTariff as $field) {
         if (isset($data[$field])) {
             $aux[$field] = $this->_mapTariffModelToEricsson($data[$field], isset($data['published']) ? $data['published'] : ServicePackModel::STATUS_NOT_PUBLISHED);
         }
         unset($data[$field]);
     }
     //Tariff lists
     $tariffLists = array('data', 'origVoice', 'termVoice', 'sms');
     foreach ($tariffLists as $field) {
         if (isset($data[$field]) && is_array($data[$field])) {
             $tariffs = array();
             foreach ($data[$field] as $tariff) {
                 $tariffs[] = $this->_mapTariffModelToEricsson($tariff, $data['published']);
             }
             if (!empty($tariffs)) {
                 $aux[$field] = $tariffs;
             }
         }
         unset($data[$field]);
     }
     $data['data'] = $aux;
     $data = parent::_mapModelToEricssonModel($data);
     return $data;
 }
コード例 #5
0
 protected function _mapModelToEricssonModel(array $data)
 {
     $data['data'] = array();
     $data['data']['states'] = $data['status'];
     if (isset($data['status']) && is_array($data['status'])) {
         $mappedStatus = array();
         foreach ($data['status'] as $status) {
             $mappedStatus[] = $this->_mapModelStatusToEricsson($status);
         }
         $data['data']['states'] = $mappedStatus;
     }
     unset($data['status']);
     $data = parent::_mapModelToEricssonModel($data);
     return $data;
 }
コード例 #6
0
 protected function _mapModelToEricssonModel(array $data)
 {
     // Transformations before "underscoring" names
     if (isset($data['simType'])) {
         $this->_mapEnumToEricssonEnum($data['simType'], $this->_simTypeMap);
     }
     if (isset($data['gprsStatus']) && isset($data['gprsStatus']['status'])) {
         $this->_mapEnumToEricssonEnum($data['gprsStatus']['status'], $this->_connStatusMap);
     }
     if (isset($data['ipStatus']) && isset($data['ipStatus']['status'])) {
         $this->_mapEnumToEricssonEnum($data['ipStatus']['status'], $this->_connStatusMap);
     }
     if (isset($data['staticIpApnIndex']) && $data['staticIpApnIndex'] == '-') {
         $data['staticIpApnIndex'] = -1;
         $data['staticIpAddress'] = "";
     }
     if (isset($data['lteEnabled'])) {
         $data['isLteEnabled'] = $data['lteEnabled'];
         unset($data['lteEnabled']);
     }
     $erasableFields = array('alias', 'customField_1', 'customField_2', 'customField_3', 'customField_4');
     foreach ($erasableFields as $field) {
         if (isset($data[$field]) && $data[$field] == '-') {
             $data[$field] = "";
         }
     }
     if (isset($data['apns'])) {
         foreach ($data['apns'] as $key => $value) {
             $data['apn']['apn' . ($key + 1)] = $value;
             unset($data['apn'][$key]);
         }
     }
     // Ericsson issue
     if (isset($data['regionId']) && $data['regionId'] == -1) {
         unset($data['regionId']);
     }
     $data = parent::_mapModelToEricssonModel($data);
     if (isset($data['aggregator_id'])) {
         unset($data['aggregator_id']);
     }
     if (isset($data['end_user_id'])) {
         unset($data['end_user_id']);
     }
     return $data;
 }
コード例 #7
0
 protected function _mapPoolsFromEricssonModelToModel($data)
 {
     $poolInformationAttributes = array('dataPools', 'smsPools', 'voiceOriginatedPools', 'voiceTerminatedPools');
     $refDataAttributes = array('zoneGroup', 'destination');
     $result = parent::_mapEricssonModelToModel($data);
     $data = $result['data'] ? $result['data'] : null;
     foreach ($poolInformationAttributes as $poolInfoAttr) {
         if ($data && $data[$poolInfoAttr]) {
             $pools = array();
             foreach ($data[$poolInfoAttr] as $pool) {
                 foreach ($refDataAttributes as $refDataAttr) {
                     if ($pool[$refDataAttr]) {
                         if ($pool[$refDataAttr]['id']) {
                             $pool[$refDataAttr . 'Id'] = $pool[$refDataAttr]['id'];
                         }
                         if ($pool[$refDataAttr]['name']) {
                             $pool[$refDataAttr . 'Name'] = $pool[$refDataAttr]['name'];
                         }
                         unset($pool[$refDataAttr]);
                     }
                 }
                 array_push($pools, $pool);
             }
             $data[$poolInfoAttr] = $pools;
         }
     }
     $result['data'] = $data;
     return $result;
 }
コード例 #8
0
 protected function _mapEricssonModelToModel(array $data)
 {
     \App_Util_Array::changePropertyName($data, 'customer', 'customerData');
     $data = parent::_mapEricssonModelToModel($data);
     \App_Util_Array::changePropertyName($data, 'customerData.fiscalNumber', 'customerData.defaultBillingAccount.fiscalNumber');
     if (isset($data['customerData'])) {
         $data['customer'] = OrgCustomerMapper::getInstance()->mapToModel($data['customerData']);
         unset($data['customerData']);
     }
     if (isset($data['serviceProviderData'])) {
         $data['serviceProvider'] = OrgServiceProviderMapper::getInstance()->mapToModel($data['serviceProviderData']);
         unset($data['serviceProviderData']);
     }
     if (isset($data['billingAccountData'])) {
         $data['billingAccountName'] = $data['billingAccountData']['name'];
         if (isset($data['billingAccountData']['region'])) {
             $data['billingAccountRegion'] = $data['billingAccountData']['region'];
         }
         unset($data['billingAccountData']);
     }
     \App_Util_Array::changePropertyName($data, 'prebillBillingcycle', 'billingCycle');
     if (isset($data['billingCycle'])) {
         foreach ($data['billingCycle'] as &$bc) {
             $this->_mapReference($bc, 'billingAccount');
         }
     }
     $this->_mapReference($data, 'billingAccount');
     if (isset($data['datesData'])) {
         $data += $data['datesData'];
         unset($data['datesData']);
     }
     \App_Util_Array::changePropertiesNames($data, array('totalChargeData' => 'totalCharge', 'totalCharge.adjusts.adjustList' => 'totalCharge.adjusts', 'adjusts.adjustList' => 'adjusts', 'serviceGlobalCharges.basicServicesCustomerCharges' => 'serviceGlobalCharges.basicServices', 'serviceGlobalCharges.basicServices.commercialGroupData' => 'serviceGlobalCharges.basicServices.commercialGroup', 'serviceGlobalCharges.supplementaryServicesCustomerCharges' => 'serviceGlobalCharges.supplServices', 'subscriptionsChargesSummary.basicServices.commercialGroupData' => 'subscriptionsChargesSummary.basicServices.commercialGroup', 'subscriptionsChargesSummary.supplementaryServices' => 'subscriptionsChargesSummary.supplServices'));
     if (isset($data['serviceGlobalCharges']) && isset($data['serviceGlobalCharges']['basicServices']) && isset($data['serviceGlobalCharges']['basicServices']['commercialGroup'])) {
         foreach ($data['serviceGlobalCharges']['basicServices']['commercialGroup'] as &$item) {
             $this->_mapReference($item, 'aggregator');
         }
     }
     if (isset($data['subscriptionsChargesSummary']) && isset($data['subscriptionsChargesSummary']['basicServices']) && isset($data['subscriptionsChargesSummary']['basicServices']['commercialGroup'])) {
         foreach ($data['subscriptionsChargesSummary']['basicServices']['commercialGroup'] as &$item) {
             \App_Util_Array::changePropertiesNames($item, array('oneTimeFee.lifecycleStateChangeEvent' => 'oneTimeFee.lifecycleStatusChangeEvent', 'monthlyFee.activeStateRecurrentFee' => 'monthlyFee.activeStatusRecurrentFee', 'monthlyFee.deactivatedStateRecurrentFee' => 'monthlyFee.deactivatedStatusRecurrentFee', 'monthlyFee.activationReadyRecurrentFee' => 'monthlyFee.activationReadyStatusRecurrentFee', 'monthlyFee.activationPendingRecurrentFee' => 'monthlyFee.activationPendingStatusRecurrentFee'));
             $this->_mapReference($item, 'aggregator');
         }
     }
     if (!isset($data["published"])) {
         $data["published"] = isset($data["issuedDate"]) && $data["issuedDate"];
     }
     $customerDiscounts = \App_Util_Array::getItem($data, 'totalCharge.discounts.customer');
     if (empty($customerDiscounts)) {
         \App_Util_Array::unsetItem($data, 'totalCharge.discounts.customer');
     }
     return $data;
 }
コード例 #9
0
 protected function _mapModelToEricssonModel(array $data)
 {
     $data['data'] = array();
     if (isset($data['status'])) {
         $data['data']['states'] = $data['status'];
         unset($data['status']);
         foreach ($data['data']['states'] as $key => $state) {
             $data['data']['states'][$key]['state'] = LifeCycleMapper::getInstance()->mapLifeCycleStatusToEricsson($state['status']);
             unset($data['data']['states'][$key]['status']);
             if ($data['published'] !== ServicePackModel::STATUS_NOT_PUBLISHED && isset($data['data']['states'][$key]['cost'])) {
                 $data['data']['states'][$key]['cost_modified'] = $data['data']['states'][$key]['cost'];
                 unset($data['data']['states'][$key]['cost']);
             }
         }
     }
     if (isset($data['transitions'])) {
         $data['data']['transitions'] = $data['transitions'];
         unset($data['transitions']);
         foreach ($data['data']['transitions'] as $key => $transition) {
             $data['data']['transitions'][$key]['stateStart'] = LifeCycleMapper::getInstance()->mapLifeCycleStatusToEricsson($transition['statusStart']);
             $data['data']['transitions'][$key]['stateFinal'] = LifeCycleMapper::getInstance()->mapLifeCycleStatusToEricsson($transition['statusFinal']);
             if ($data['published'] !== ServicePackModel::STATUS_NOT_PUBLISHED && isset($data['data']['transitions'][$key]['cost'])) {
                 $data['data']['transitions'][$key]['cost_modified'] = $data['data']['transitions'][$key]['cost'];
                 unset($data['data']['transitions'][$key]['cost']);
             }
         }
     }
     $data = parent::_mapModelToEricssonModel($data);
     return $data;
 }
コード例 #10
0
 protected function _mapModelDiscountToEricsson($discount)
 {
     $discount = parent::_mapModelToEricssonModel($discount);
     if (isset($discount['customer_id'])) {
         $discount['customer'] = array('id' => OrganizationMapper::cleanOrgId($discount['customer_id']), 'name' => '');
         unset($discount['customer_id']);
     }
     return $discount;
 }
コード例 #11
0
 protected function _mapModelToEricssonModel(array $data)
 {
     $data = parent::_mapModelToEricssonModel($data);
     if (isset($data['tariffs'])) {
         $data['tariffs']['current_tariffs'] = $data['tariffs'];
     }
     if (isset($data['additional_msisdn'])) {
         unset($data['additional_msisdn']);
     }
     if (isset($data['ready_for_multiple_sms_oa'])) {
         unset($data['ready_for_multiple_sms_oa']);
     }
     if (isset($data['monthly_voucher_units_pending_to_update'])) {
         unset($data['monthly_voucher_units_pending_to_update']);
     }
     return $data;
 }
コード例 #12
0
 public function update($obj)
 {
     $this->_checkOrgDescription($obj);
     return parent::update($obj);
 }