public function testLoadByName()
 {
     $this->_org->save();
     $org = $this->_service->loadByName($this->_org->getName());
     $this->assertNotNull($org);
     $this->assertInstanceOf('\\Application\\Model\\Organization\\OrgMasterModel', $org);
     $this->assertEquals($this->_org->getId(), $org->getId());
 }
 public function testLoadOrg()
 {
     // Persist the org model
     $this->_org->save();
     $org = $this->_service->load($this->_org->getId());
     $this->assertNotNull($org);
     $this->assertInstanceOf('\\Application\\Model\\Organization\\OrgServiceProviderModel', $org);
     $this->assertEquals($this->_org->getId(), $org->getId());
 }
 public function importData(array $data)
 {
     $this->clear('otherContact_1');
     $this->clear('otherContact_2');
     $this->clear('otherContact_3');
     return parent::importData($data);
 }
 public function testActivate()
 {
     // Persist the org model
     $this->_org->save();
     $this->_service->deactivate($this->_org->getId());
     $org = $this->_service->load($this->_org->getId());
     $this->assertEquals($org->status, OrgAggregatorModel::ORG_STATUS_DEACTIVATED);
     $this->_service->activate($this->_org->getId());
     $org = $this->_service->load($this->_org->getId());
     $this->assertEquals($org->status, OrgAggregatorModel::ORG_STATUS_ACTIVATED);
 }
Exemplo n.º 5
0
 public function getServiceProviderLevelId(\Application\Model\OrgModelAbstract $org)
 {
     switch (true) {
         case $org instanceof \Application\Model\Organization\OrgServiceProviderModel:
             return $org->getId();
         case $org instanceof \Application\Model\Organization\OrgCustomerModel:
             return $org->getParentId();
         default:
             // Search customer parent for aggregator or enduser
             $org = $this->getParentByType($org, OrgCustomerModel::ORG_TYPE);
             return $org ? $org->getParentId() : null;
     }
 }
Exemplo n.º 6
0
 /**
  *
  * @param  OrganizationModel $organization
  * @return UserModel
  */
 public function setOrganization(OrgModelAbstract $organization)
 {
     if ($organization instanceof OrgModelAbstract) {
         $this->setOrganizationId($organization->getId());
     }
     return $this;
 }
 /**
  *
  * @param  OrgModelAbstract $parent
  * @return OrgModelAbstract
  */
 public function setParent(OrgModelAbstract $parent)
 {
     $this->setParentId($parent->getId());
     $this->_parent = null;
     return $this;
 }
 protected function _createProtoData(OrgModelAbstract $organization, $dataType)
 {
     $dataClass = static::$_protoMessageClasses['data'][$dataType];
     $protoData = new $dataClass();
     $data = $organization->exportData();
     $mappedData = $this->_custommapModelToEricssonModel($data);
     $protoData->parse($mappedData, new \DrSlump\Protobuf\Codec\PhpArray());
     return $protoData;
 }
 /**
  * @param  Application\Model\ServicePackModel $service
  * @return boolean
  */
 public function removeCustomer(ServicePackModel $service, OrgModelAbstract $org)
 {
     if (!strlen((string) $service->getId())) {
         throw new AppEx\InvalidArgumentException("Service pack does not have an Id");
     }
     if (!$org instanceof OrgCustomerModel) {
         throw new AppEx\InvalidArgumentException("Organization must be a customer.");
     }
     $orgId = $org->getId();
     if (!isset($orgId) && !strlen($orgId)) {
         throw new AppEx\InvalidArgumentException("Organization customer does not have an Id");
     }
     if ($service->commercialGroup) {
         $errors[] = "\t- " . \Zend_Json::encode('Service Pack already has commercial groups assigned ');
         $errors = implode("\n", $errors);
         throw new AppEx\ValidateException("The supplServices model does not pass the validation rules:\n" . $errors);
     }
     $result = $this->getMapper()->removeCustomer($service->getId(), $org->getId());
     \App::audit('Removed customer ' . $org->getId() . ' from service pack with Id ' . $service->getId(), $service);
     return $result;
 }