The issue involves a straightforward logic fix in a single function.
The issue identifies a logical error in the transform_pdf function where it incorrectly returns the body instead of the output parameter when both header and footer are absent. The fix requires modifying the return logic to consistently handle the output parameter. There are no apparent blockers or complex dependencies.
Output of bench version
erpnext 16.0.0-dev
frappe 16.0.0-dev
def transform_pdf(self, output=None):
from pypdf import PdfWriter
header = self.header_pdf
body = self.body_pdf
footer = self.footer_pdf
# issue
if not header and not footer:
return body
...
if output:
output.append_pages_from_reader(body)
return output
When the parameter output is specified, the transform_pdf function should return output.
but if output is set and if not header and not footer , transform_pdf return body. This is incorrect.
It should:
output.append_pages_from_reader(body)
return output
(paste here)
OS version / distribution, Frappe install method, etc.
Claim this issue to let others know you're working on it. You'll earn 10 points when you complete it!