I’m trying to understand how to customize Quotations to cater for rental options also known as hire purchase. It’s similar to payment terms, but offers the customer the option of paying for the goods over a period of time, normally up to 60 months. The term (number of months) and the interest rate (escalation) has to be captured on the Quote > Edit view. This can be achieved with custom fields. Both of these are then used to calculate a monthly payment amount. These custom fields can be accessed on the PDF template like any other field.
My difficulty is with the Quotation PDF template. How do I conditionally add the rental option values to the PDF. In other words, only add the rental option values if the sales person wants to offer it to the customer and has filled in the custom fields, otherwise do not add it to the PDF.
@pgr, can this scenario be solved with one of your power plugins?
Power Replacer can grab all your data, and run any condition for you. However, currently it only works for one-off Emails (Compose window) and for Campaigns using email templates. So you could send this stuff to your customers, but not as a PDF. It would be in the body of the email.
I plan to add PDF features, it shouldn’t be too hard, and would be quite useful, I agree.
Click the link above to see my demo video, that should explain things for you.
I got tired of the terrible quality of all Templating code in SuiteCRM and decided to just swap out the whole system with a proper templating language, Twig. It’s working great and I’m really happy with it.
I’m quite close to making it all work with PDF’s. But unfortunately I am not seeing much response to my campaign to get sponsorships and stay with SuiteCRM. It’s getting more difficult to justify all the money I’m losing by working on this.
But getting back to your question - If you can find the code, you can try hacking it. Probably one of these two places:
As a matter of interest:
1 are you using tinyMCE or Mozaik as a drag-and-drop GUI to build the HTML or are you building the HTML in an editor and then copy it into the database directly
2 are you using mPDF to render the PDF document from the HTML or does Twig impose a different library?
I’m very eager to use this… so please keep me up to date
I use mPDF and feed it with HTML produced by Twig. I started using that HTML for emails, optimized it for emails, but yesterday when feeding it into mPDF I didn’t have to make a single change. It rendered perfectly at the first try.
About the editors: I use direct HTML editor. Both TinyMCE and Mozaik (which is really just TinyMCE in disguise) are terrible to produce HTML that you really fine-tune and control. That’s not what they’re designed for.
It took me a long time but I was able to make the user-profile defined editor work in Emails Compose screen.
For the PDF templates I didn’t look into the editors yet, I just put the code directly into the database. But my plan would be to use Direct HTML Editor for that also, and avoid going into the database.
Note that 90% of the editor problems in SuiteCRM aren’t editor problems, they’re bogus security clean-up problems. It’s basically SuiteCRM over-zealously cleaning up strings and ruining its own data. I’ll be fixing that too, hopefully…
I just tried entering templates from the PDF Templates module and I can confirm that it’s also ignoring the Editor defined in the user profile. It always gives you TinyMCE. For my Twig templates to work I think there’s no point in fighting TinyMCE, it’s really necessary to use Direct HTML editor. So I’ll have a look into upgrading this screen for that purpose.
Ah… I thought as much. I also compile the HTML in an editor and copy it directly into the database as tinyMCE invariably interferes and amends the HTML, breaking the subsequent PDF rendering in the process. I’ve spent many frustrating DAYS learning this