Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PCHR-4346: Fix undefined index error when using the HRJobContract.get…
…FullDetails API This API call is an optimized way to fetch all the information for a Job Contract, which is stored in multiple different database tables. It does that by running a single SQL query, joining all the tables and the necessary fields. In the resultset, in order to differentiate which field belongs to which entity, each field is prefixed with the entity name (examplei: details__<field_name>). After the data is fetched from the database, the `HRJobContractRevision::normalizeFullDetailsResult()` was used to loop through all the fields in the resultset, detect to which entity they belong to and organize the data in a proper way. Besides the fields returned by the query, the resultset object also contains some internal fields. In the past, all of these fields were prefixed with an underscore, but on civicrm/civicrm-core#12276 a new `resultCopies` field was added, and since it does not start with an underscore, the logic to filter out the internal fields stopped working. To fix that, instead of looping through all of the fields from the resultset, we call the `toArray()` method which will return a list of fields and values containing only those returned by the SQL query.
- Loading branch information