Skip to content

Commit

Permalink
fix: allow for saving insurance when country is empty (openemr#7332)
Browse files Browse the repository at this point in the history
* fix: allow for saving insurance when country is empty

* styling

* revert FALSE array key
  • Loading branch information
stephenwaite authored Apr 11, 2024
1 parent ed9ffcc commit 10bcaed
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 11 deletions.
4 changes: 2 additions & 2 deletions _rest_routes.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -6533,7 +6533,7 @@
* description="The type or category of OpenEMR insurance policy, 'primary', 'secondary', or 'tertiary'. If this field is missing it will default to 'primary'.",
* type="string"
* ),
* required={"provider", "policy_number", "subscriber_fname", "subscriber_lname", "subscriber_relationship", "subscriber_ss", "subscriber_DOB", "subscriber_street", "subscriber_postal_code", "subscriber_city", "subscriber_state", "subscriber_country", "subscriber_sex", "accept_assignment"},
* required={"provider", "policy_number", "subscriber_fname", "subscriber_lname", "subscriber_relationship", "subscriber_ss", "subscriber_DOB", "subscriber_street", "subscriber_postal_code", "subscriber_city", "subscriber_state", "subscriber_sex", "accept_assignment"},
* example={
* "provider": "33",
* "plan_name": "Some Plan",
Expand Down Expand Up @@ -12110,7 +12110,7 @@
// for the currently logged in user
if ($request->getRequestUserUUIDString() == $uuid) {
$return = (new FhirPersonRestController())->getOne($uuid);
} else if (!$request->isPatientRequest()) {
} elseif (!$request->isPatientRequest()) {
// not a patient ,make sure we have access to the users ACL
RestConfig::authorization_check("admin", "users");
$return = (new FhirPersonRestController())->getOne($uuid);
Expand Down
2 changes: 1 addition & 1 deletion interface/patient_file/summary/insurance_edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
// policy_types is defined in patient.inc.php
,'policy_types' => $GLOBALS['policy_types']
,'uspsVerifyAddress' => $GLOBALS['usps_webtools_enable']
,'languageDirection' => $GLOBALS['language_direction']
,'languageDirection' => $GLOBALS['language_direction'] ?? ''
,'rightJustifyLabels' => $GLOBALS['right_justify_labels_demographics']
]
);
Expand Down
4 changes: 3 additions & 1 deletion src/Common/Http/HttpRestParsedRoute.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ class HttpRestParsedRoute
*/
private $requestRoute;

private $requestMethod;

public function __construct($requestMethod, $requestRoute, $routeDefinition)
{
$this->routeDefinition = $routeDefinition;
Expand Down Expand Up @@ -182,7 +184,7 @@ private function parseRouteParams($routeParams, $routeDefinition)
// standard api allows for nesting of resources so we have to handle the other possibilities there.
if ($apiType === 'fhir') {
$this->resource = $parts[2] ?? null;
} else if (!empty($finalArg) && !\in_array($finalArg, ['portal', 'api'])) {
} elseif (!empty($finalArg) && !\in_array($finalArg, ['portal', 'api'])) {
$this->resource = $finalArg;
}

Expand Down
8 changes: 4 additions & 4 deletions src/RestControllers/RestControllerHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public static function handleProcessingResult(ProcessingResult $processingResult
$httpResponseBody["internalErrors"] = $processingResult->getInternalErrors();
(new SystemLogger())->debug("RestControllerHelper::handleProcessingResult() 500 error", ['internalErrors' => $processingResult->getValidationMessages()]);
} else {
http_response_code($successStatusCode);
http_response_code($successStatusCode ?? 0);
$dataResult = $processingResult->getData();
$recordsCount = count($dataResult);
(new SystemLogger())->debug("RestControllerHelper::handleFhirProcessingResult() Records found", ['count' => $recordsCount]);
Expand Down Expand Up @@ -290,18 +290,18 @@ public function addOperations($resource, $items, FHIRCapabilityStatementResource
$fhirOperation->setName($operationName);
$fhirOperation->setDefinition(new FHIRCanonical('http://hl7.org/fhir/uv/bulkdata/OperationDefinition/' . $definitionName));
$capResource->addOperation($fhirOperation);
} else if ($operation === '$bulkdata-status') {
} elseif ($operation === '$bulkdata-status') {
$fhirOperation = new FHIRCapabilityStatementOperation();
$fhirOperation->setName($operation);
$fhirOperation->setDefinition($this->restURL . '/OperationDefinition/$bulkdata-status');
$capResource->addOperation($fhirOperation);
// TODO: @adunsulag we should document in our capability statement how to use the bulkdata-status operation
} else if ($operation === '$docref') {
} elseif ($operation === '$docref') {
$fhirOperation = new FHIRCapabilityStatementOperation();
$fhirOperation->setName($operation);
$fhirOperation->setDefinition(new FHIRCanonical('http://hl7.org/fhir/us/core/OperationDefinition/docref'));
$capResource->addOperation($fhirOperation);
} else if (is_string($operation) && strpos($operation, '$') === 0) {
} elseif (is_string($operation) && strpos($operation, '$') === 0) {
(new SystemLogger())->debug("Found operation that is not supported in system", ['resource' => $resource, 'operation' => $operation, 'items' => $items]);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/Validators/CoverageValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,12 @@ function (Validator $context) {
$context->required('subscriber_postal_code')->lengthBetween(2, 255);
$context->required('subscriber_city')->lengthBetween(2, 255);
$context->required('subscriber_state')->listOption($GLOBALS['state_list']);
$context->required('subscriber_country')->listOption($GLOBALS['country_list']);
$context->optional('subscriber_country')->listOption($GLOBALS['country_list']);
$context->optional('subscriber_phone')->lengthBetween(2, 255);
$context->required('subscriber_sex')->listOption('sex');
$context->required('accept_assignment')->inArray(['TRUE', 'FALSE']);
// policy type has a Not Applicable(NA) option which is an empty string so we allow empty here
$context->required('policy_type')->allowEmpty(true)->inArray(InsurancePolicyTypes::POLICY_TYPES);
$context->optional('policy_type')->allowEmpty(true)->inArray(InsurancePolicyTypes::POLICY_TYPES);
$context->optional('subscriber_employer')->lengthBetween(2, 255);
$context->optional('subscriber_employer_street')->lengthBetween(2, 255);
$context->optional('subscriber_employer_postal_code')->lengthBetween(2, 255);
Expand Down
2 changes: 1 addition & 1 deletion templates/patient/insurance/insurance_edit.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ files for editing and adding new insurance policies for a patient.
,skip: not useStateTerminology
}, {
name: "Country"|xl
,required: true
,required: false
,data_type: country_data_type
,field_id: "subscriber_country"
,fld_length: 10
Expand Down

0 comments on commit 10bcaed

Please sign in to comment.