Open SpudR opened 7 years ago
The issue has been tested on recent version of SuiteCRM(7.7.4), and it appear, We will label this issue as a bug. @SpudR , thanks for raise this issue.
Hello SpudR, thank you for the very good explanation of the problem and a good test example.
The reason why your test fails is that you don't follow the proper template structure.
For instance in case of group line items, the template need to "know" where the group starts - $aos_line_item_groups_name (please see the default Invoices -> Invoice Group Sample template).
If this variable is omitted, then in case of your test example, the following code modules/AOS_PDF_Templates/generatePdf.php function populate_group_lines() line 198 $parts = explode($firstValue, $text); will split the template into 3 parts instead of 2 parts as the first item it splits on is $aos_line_item_groups_total_amt and there is a similar variable $aos_line_item_groups_total_amt_usdollar, so it will split on this variable also. Then it processes the wrong parts and finally fails.
There are two possible options here:
Ok - could you please update my test template to use this variable and therefore work? Should be a fairly easy thing to add a table row or two in there :)
Adding just this variable will not help - in your template you also use Line Items: Services and Line Items: Products. Both of them would need to follow their related template structures.
So instead of adding fields to the test template that you provided, the fields should be added to the appropriate templates with the correct structure. This will make it work. I tested all the fields listed in your template in the correct templates.
Not sure I'm following this then - are you saying that these variables cannot be mixed? That each set of variables must follow its own structure? As you can see from my template you can show all the variables mentioned except the 'Line items: Groups' members... ???
@SpudR I've just spent way too much time figuring this out. Instead ot the theoretical advice above, here is the practical solution: You need to put $aos_line_item_groups_total_amount at the end of the table so that the engine knows where to stop the grouping process:
`
$aos_line_item_groups_name | |||
Menge | Produkt | Einzelpreis | Gesamt |
$aos_products_quotes_product_qty | $aos_products_quotes_name | $aos_products_quotes_product_unit_price € | $aos_products_quotes_product_total_price € |
$aos_products_quotes_item_description | |||
Gruppensumme: | $aos_line_item_groups_total_amount € |
Issue
Whilst I was looking for a field that was simply the unit cost x the quantity (which there doesn't seem to be - can you tell me?) I found this:
I have a PDF template which I have inserted all the possible price options from all the fields (to verify which value is correct). If I enter anything from the Invoices >> Line Items: Groups drop box, then the PDF breaks - sometimes it's blank, sometimes it generates that field then shows field names for any other results.
Grab the below, then manually insert the field name in the appropriate table cell - then create a PDF from an invoice (preferably with multiple items and quantities)
Here's the HTML so you don't have to manually enter it all:
Looks like it's broken in the demo too...
Expected Behavior
The PDF is created with all appropriate fields completed
Actual Behavior
PDF breaks (blank or just shows field names)
Steps to Reproduce
As above
Context
It's hard to find the correct field to enter in PDF templates, but this helps to identify the correct field.
Your Environment