Skip to content

Commit

Permalink
Fixes openemr#7570 list service search by codes (openemr#7572)
Browse files Browse the repository at this point in the history
Fixes openemr#7570 search for an option by the codes column
  • Loading branch information
adunsulag authored Jul 18, 2024
1 parent 4c48728 commit 77cd668
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/Services/ListService.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,21 @@ public function getListOption($list_id, $option_id)
return null;
}

/**
* Retrieves a list option for a given list by the code value
* @param string $list_id
* @param string $code The exact code(s) to match. This must match the string precisely and fuzzy matching is not currently supported.
* @return array|null
*/
public function getListOptionByCode(string $list_id, string $code)
{
$records = $this->getOptionsByListName($list_id, ['codes' => $code]);
if (!empty($records)) { // should only be one record
return $records[0];
}
return null;
}

public function getOne($pid, $list_type, $list_id)
{
$sql = "SELECT * FROM lists WHERE pid=? AND type=? AND id=? ORDER BY date DESC";
Expand Down

0 comments on commit 77cd668

Please sign in to comment.