Skip to content

Commit 0bbbece

Browse files
authored
fix(ehi-export): initialize variables in createExportTasksFromJobWith… (openemr#10830)
Fixes openemr#10808 #### Short description of what this resolves: This PR fixes "Undefined variable" notices in the EHI Export service. Previously, $tasks and $currentDocumentSize were used/returned before being initialized, which could trigger PHP errors if the patient loops were skipped or upon the first iteration of a document size calculation. #### Changes proposed in this pull request: Define the variables #### Does your code include anything generated by an AI Engine? No Testing performed: Ran devtools php-parserror (Passed). Ran devtools phpstan and confirmed the "Ignored error pattern" warnings for these variables are now appearing as "not matched," confirming the fix.
1 parent 76a172a commit 0bbbece

2 files changed

Lines changed: 2 additions & 10 deletions

File tree

.phpstan/baseline/variable.undefined.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12226,11 +12226,6 @@
1222612226
'count' => 2,
1222712227
'path' => __DIR__ . '/../../interface/modules/custom_modules/oe-module-ehi-exporter/public/index.php',
1222812228
];
12229-
$ignoreErrors[] = [
12230-
'message' => '#^Variable \\$currentDocumentSize might not be defined\\.$#',
12231-
'count' => 1,
12232-
'path' => __DIR__ . '/../../interface/modules/custom_modules/oe-module-ehi-exporter/src/Services/EhiExporter.php',
12233-
];
1223412229
$ignoreErrors[] = [
1223512230
'message' => '#^Variable \\$job might not be defined\\.$#',
1223612231
'count' => 4,
@@ -12241,11 +12236,6 @@
1224112236
'count' => 1,
1224212237
'path' => __DIR__ . '/../../interface/modules/custom_modules/oe-module-ehi-exporter/src/Services/EhiExporter.php',
1224312238
];
12244-
$ignoreErrors[] = [
12245-
'message' => '#^Variable \\$tasks might not be defined\\.$#',
12246-
'count' => 1,
12247-
'path' => __DIR__ . '/../../interface/modules/custom_modules/oe-module-ehi-exporter/src/Services/EhiExporter.php',
12248-
];
1224912239
$ignoreErrors[] = [
1225012240
'message' => '#^Variable \\$pid might not be defined\\.$#',
1225112241
'count' => 1,

interface/modules/custom_modules/oe-module-ehi-exporter/src/Services/EhiExporter.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -755,6 +755,8 @@ private function addDocumentationReadme(\ZipArchive $zip)
755755

756756
private function createExportTasksFromJobWithoutDocuments(EhiExportJob $job, array &$jobPatientIds, int $jobPatientIdsCount)
757757
{
758+
$tasks = [];
759+
$currentDocumentSize = 0;
758760
$task = new EhiExportJobTask();
759761
$task->ehi_export_job_id = $job->getId();
760762
$task->ehiExportJob = $job;

0 commit comments

Comments
 (0)