Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

send_rx_pdf_is_updated is getting set to 0 when no RX fields are being modified #92

Open
pbchase opened this issue Feb 25, 2019 · 0 comments

Comments

@pbchase
Copy link
Contributor

pbchase commented Feb 25, 2019

send_rx_pdf_is_updated is getting set to zero when no fields on the Prescription form are being modified. Reviewing hook_save_record in ExternalModule.php, it appears that there are no qualifiers around this code block:

// New PDF needs to be generated as changes are made to form after PDF is created.
// Reset pdf_is_updated flag to generate new PDF.
$field_name = 'send_rx_pdf_is_updated';
send_rx_save_record_field($project_id, $event_id, $record, $field_name, '0');

See

// New PDF needs to be generated as changes are made to form after PDF is created.
to see that code in context.

My suspicion is that this code is firing when other forms are updating data. This resets the send_rx_pdf_is_updated to zero. Subsequent access to the Review and Send RX form will cause a PDF regeneration even though no data was updated on the Prescription form. If this is right, the above code block would need to be wrapped in a test to verify that the current instrument is the instrument holds a field we know is on the Prescription form. send_rx_prescriber_email would be a good candidate.

This code might work in place of the above at line 759:

        // Checking if we are on Prescription form step.
        if ($Proj->metadata['send_rx_prescriber_email']['form_name'] == $instrument) {
            // New PDF needs to be generated as changes are made to form after PDF is created.
            // Reset pdf_is_updated flag to generate new PDF.
            $field_name = 'send_rx_pdf_is_updated';
            send_rx_save_record_field($project_id, $event_id, $record, $field_name, '0');
        }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant