Skip to content
This repository was archived by the owner on Oct 1, 2025. It is now read-only.
This repository was archived by the owner on Oct 1, 2025. It is now read-only.

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

@pbchase

Description

@pbchase

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');
        }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions