That might turn out to be difficult, these Invoices screens are not very standard, not very configurable from Studio…
You will surely be able to do it from PHP/Javascript, but even that I am not sure about the details. Have you searched the Forums? I remember there were some threads about people editing Invoices LineItems, but maybe not Groups…
I tried searching the forums.
With the help of the same, I have been able to customize Invoice Header, and also the Line Items. Both of these are directly exposed in the Studio.
I have been able to create new modules in the Module Builder, and link them to the Invoice Header and Line Items.
However, not quite able to find any info on customizing Line Item Groups for some reason.
When designing PDF Templates, I see that there is a direct reference to “Line Items: Groups” and we can pull in fields from the same. However I can’t seem to find away to customize them.
I am digging through the PHP files to see if I can find a way to add relate fields, normal text fields etc.
In case you can help me with any pointers, it would be a big help
I found the module “\modules\AOS_Line_Item_Groups” and have been playing with the PHP files directly to get over this limitation, specifically vardefs.php
I was able to add a field successfully, and the same now shows in the PDF Template creation for Invoices.
I also extended the database core, to add a column to the table “aos_line_item_groups” to save the value in the new field.
I have a couple of follow up questions that I would sincerely appreciate some help with -
Is this the correct approach ?
How do I expose this field in the UI for Invoices ?
Is this kind of hacking upgrade proof, in case we decide to upgrade our Suite CRM installation in future ?
Appreciate your time, and help with this one.
It’s turning out to be slightly trickier than what I had initially anticipated
I was hoping someone else would pick up on this thread, because I don’t have much to offer, I don’t know how to do these customizations very well.
If you want these changes to be upgrade-safe, you need to make them in custom directory. If I remember correctly, there are two LineItems files, one php and one js, and I think you can make a custom php file, and that one can call the custom js file. But you still need to be careful when upgrading, to see if there are any changes to these files that you might need to integrate into your own. The upgrades installer will warn you of that.
If you create the fileds properly in the vardefs, you should have normal access to them from Studio so you can add to views.
The issue is that the “Line Item: Groups” module is not exposed in the Studio in the first place.
I was able to successfully create simple text fields using vardefs.php and these started reflecting in the PDF Templates for use. However, there doesn’t seem to be a clean way to do it since it’s not exposed in the Studio for some reason.
Still wondering how to create the Relate type of fields and also, how to expose these new fields on the Invoices UI so that the user can enter values which can then be saved in the database for these new, custom fields.
Still wondering how this kind of customization would behave when upgrading Suite CRM versions
Not quite sure how to create custom files to “extend” the functionality which would be upgrade safe. While I am also doing my own research on the sie, any kind of documentation, or online links that you may be able to share, with regards to the same would be a big help !
I created a new field by editing, vardefs.php in the module “AOS_Line_Item_Groups”
Further, I edited “lineitems.js” in the module “AOS_Products_Quotes” to expose a new field onto the UI.
Now, I am trying to link the two so that the value in the DB reflects in the UI, and vice versa when trying to save it.
I edited “AOS_Line_Item_Groups.php” in the module “AOS_Line_Item_Groups”, function save_groups() to save the field in the database.
However, this throws and error that the corresponding field is not being passed from the UI to this file in the _POST request.
I would appreciate if somebody could point me out in the right direction to link the backend with the frontend in the this case.
if you can, instead, add the field in the viewdefs, it should probably take care of all that, and get everything properly linked when saving. But you will have to Google for details and try it to see if it works.
I can’t find a __viewdefs file for “AOS_Line_Item_Groups”
For viewdefs corresponding to AOS_Invoices, and AOS_Product_Quotes, there is no reference to the Line Item groups.
i wonder how all of these are tied together, since the js file would obviously only show an extra field. The same would obviously need to be passed back onto the backend so that it’s saved to the database as well, and retrieved.
I had a look at the file already. No reference to “group” anywhere unfortunately !
Also, no reference to “groups” anywhere in any of the files in the metadata folder corresponding to “AOS_Products_Quotes” in my search.
I just remembered something. When you added to the Line GRoups vardefs, did you do a QR&R and scroll down to the bottom to “sync database with vardefs”? This button doesn’t always appear there, but if it does, press it.
Because you mention you added to the database manually, and normally that is not necessary (or recommended).
Yes, I did the quick repair and build.
I also did create a relate field at the AOS_Products_Quote level in vardefs, and was able to fetch the field. So, I am able to fetch the data that I entered manually in the backend. However, it doesn’t save the data back, when I enter it through the frontend.
Yes, I created the field manually in the db to save the corresponding data.
Do you mean that if I just add it to vardefs and do a QR&R, it would create a corresponding column in the backed db on its own ?