Skip to content

Commit

Permalink
Merge pull request #19 from yudistirasd/location
Browse files Browse the repository at this point in the history
#fix FHIR Location
  • Loading branch information
ivanwilliammd authored Mar 21, 2024
2 parents 0d5fe21 + ea55f4e commit b818c70
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/FHIR/Location.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public function addPosition($latitude = null, $longitude = null)

public function setManagingOrganization($managing_organization = null)
{
$this->location['managingOrganization']['reference'] = 'Organization/'.$managing_organization ? $managing_organization : $this->organization_id;
$this->location['managingOrganization']['reference'] = 'Organization/' . ($managing_organization ? $managing_organization : $this->organization_id);
}

public function json()
Expand All @@ -133,27 +133,27 @@ public function json()
$this->addAddress();

// Add physicalType if not exist
if (array_key_exists('physicalType', $this->location)) {
if (!array_key_exists('physicalType', $this->location)) {
$this->addPhysicalType();
}

// Add latitude & longitude if not exist
if (array_key_exists('position', $this->location)) {
if (!array_key_exists('position', $this->location)) {
$this->addPosition();
}

// Add default managing organization from parent (registered sarana)
if (array_key_exists('managingOrganization', $this->location)) {
if (!array_key_exists('managingOrganization', $this->location)) {
$this->setManagingOrganization();
}

// Name is required
if (! array_key_exists('name', $this->location)) {
if (!array_key_exists('name', $this->location)) {
return 'Please use location->setName($location_name) to pass the data';
}

// Identifier is required
if (! array_key_exists('identifier', $this->location)) {
if (!array_key_exists('identifier', $this->location)) {
return 'Please use location->addIdentifier($location_identifier) to pass the data';
}

Expand Down

0 comments on commit b818c70

Please sign in to comment.