mirror of
https://github.com/SuiteCRM/SuiteCRM.git
synced 2026-03-02 19:16:58 -05:00
Unable to generate PDF quotes after migrating to 7.14.6 #5334
Labels
No labels
Area: API
Area: Campaigns
Area: Cases
Area: Clean Up
Area: Clean Up: Performance
Area: Dashlets
Area: Databases
Area: Developer Tools
Area: Elasticsearch
Area: Elasticsearch
Area: Emails
Area: Emails:Campaigns
Area: Emails:Cases
Area: Emails:Compose
Area: Emails:Config
Area: Emails:Templates
Area: Environment
Area: Installation
Area: Language
Area: Mobile
Area: Module
Area: PDFs
Area: PHP8
Area: Reports
Area: Studio
Area: Styling
Area: Upgrading
Area: Workflow
Area:Activity Stream
Area:Calls
Area:Import
Area:Projects
Area:Search
Area:Surveys
Area:Themes
Area:Users
Branch:Hotfix
Good First Issue
Hacktoberfest
Help Wanted
PR:Community Contribution
PR:Type:Enhancement
Priority:Critical
Priority:Important
Priority:Moderate
Severity: Major
Severity: Minor
Severity: Moderate
Status: Requires Code Review
Status: Requires Updates
Status: Stale
Status: Team Investigating
Status:Assessed
Status:Fix Proposed
Status:Needs Assessed
Status:Requires Automated Tests
Type: Bug
Type:Deprecated
Type:Discussion
Type:Duplicate
Type:Invalid
Type:Question
Type:Suggestion
Type:Suggestion
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/SuiteCRM-SuiteCRM#5334
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @vmw on GitHub (Jul 1, 2025).
Issue
Problem
After migrating to SuiteCRM version 7.14.6 (migrating from from 7.11.18 to 7.12.8 to 7.14.6) we are no longer able to generate PDF quotes.
Reproduction
Expected
We get generate a PDF quote.
Observed
When trying to generate a quote,
The specific error message is being printed by:
/langford/suitecrm/vendor/tecnickcom/tcpdf/tcpdf.php:7745This only occurs when trying to generate PDF-quotes. We are otherwise able to generate PDF reports and invoices. Just not quotes.
Workaround
After making some code changes, discussed below, I was able to get to a point where I can get pdf-quotes working, but ONLY if they do NOT have a corresponding opportunity associated with them. If the quote has an opportunity associated with it, I continue to get the error above.
Discussion
Given that this occurred after updating SuiteCRM, I thought it might be related to the shift from php7.4 to 8.2.
More specifically, I believe it might be due to how php82 vs php74 handle type inferences. After the initial upgrade, we had problems converting leads to opportunities, and it was because not all of the custom lead fields had default attributes. When using php82, some of the operations that previously worked with null inputs failed with an error message. After updating those attributes to have default values, I was able to get the lead conversion working.
This may also be related to issue #10650 , but applying the commit in the pull request did not seem to fix the issue.
Possible Fix
Attempts to fix
After some experimenting with changing some of the quote properties, and modifying the templates, I was able to trigger the following error:
This seemed promising, as the previous issue mentioned there may be some problems with that part of the code. In addition, this seems to be related to the change from php7.2 to 8.2, as indicated here:
https://stackoverflow.com/questions/75591411/abs-argument-1-num-must-be-of-type-intfloat-string-given-in-php-8-2
So I tried doing exactly what stackover flow suggested and modified:
suitecrm/modules/Currencies/Currencies.php:412 to read:
This resulted in the following error message:
After change suitecrm/modules/AOS_PDF_Templates:131 as follows:
This change got me to the point where I realized that I could generate a pdf quote from our templates, but ONLY if there was no opportunity attached to the quote.
I'm not able to get any additional debugging messages, and, I think perhaps some one of the changes I made to get to the point that I was able to work around the issue may have caused additional problems.
Given that the first lead I had was with Currencies.php, I think this issue may somehow be related to #10650 , but I don't understand how the presence of the opportunity field could cause additional issues here.
Versions
This occurred on SuiteCRM 7.14.6
Steps to Reproduce the Issue
Context
This bug is impacting our ability to generate PDF quotes.
Version
7.14.8
What browser are you currently using?
Firefox
Browser Version
Firefox 139.0.4 (64 bit)
Environment Information
mariadb from 11.0.2-MariaDB, client 15.2 for Linux (x86_64) using readline 5.1, PHP8.2
Operating System and Version
ArchLinux
@vmw commented on GitHub (Jul 4, 2025):
Additional Discussion
The root cause of this issue is that, for some reason, by the time we hit
modules/AOS_PDF_Templates/generatePdf.php:142
the output buffer has been written to with a single space " " in it.
As a consequence, when we hit vendor/tecnickcom/tcpdf/tcpdf.php:7744 , we return true for ob_get_contents().
Within generatePdf.php, the output buffer is empty, until we hit:
generatePdf.php :~55
$bean = BeanFactory::getBean($_REQUEST['module'], $_REQUEST['uid']);
For some reason, which I have not yet finished investigating, after this call, the output buffer is filled with a space.
Workaround
To avoid this issue, I have added a blanket ob_flush() in modules/AOS_PDF_Templates/generatePdf.php:142
right before the if ( $task === 'pdf' || ... ) statement. This seems reasonably safe and ensures that the output buffer is empty prior to attempting to generate a pdf.
If I have time over the weekend, I'll see whether I can further isolate the cause of this issue, or else I will simply add the line to flush the output buffer prior to attempting to generate a pdf.
@johnM2401 commented on GitHub (Aug 5, 2025):
Hey!
Thank you for raising this issue.
I've given this some tries locally, but I haven't been able to replicate the issue as of yet.
I've tried the
Quotes->Print as PDFaction with various Currencies / Thousand Separators / Related Opportunities, but it appears to be generating the PDF as expected.Could you perhaps share some more information to help us in trying to narrow this down?
Anything that might seem relevant, such as:
.for Decimal /,for Thousand)Thank you again for raising this, and thank you for your time investigating!