Functional example of Customize Line Items at Quotes module

I almost have 100% functioning, Iā€™ll post it as soon as I have it ,although itā€™s sad that in the forum there are people with so many years of experience developing in the system and even then they can not give me a good answer :pinch:

Please do post your solution, we need more of that here!

I personally donā€™t have years of experience developing projects for SuiteCRM, I only started developing one simple project. Then I learned the rest just helping out in the forums. But I often am left without enough expertise to help in coding problems.

I know it can be frustrating to ask and not get answersā€¦ we need to ask simple, partial questions, since developers normally donā€™t have enough time to really ā€œdiveā€ into other peopleā€™s problems and figure out what could be wrong.

With time, I hope we develop better community resources (Documentation, past forum threads, blog posts, etc), and get more competent developers on board, so it becomes easier to get help coding.

Thanks for your patience and thanks in advance for posting coding tips in the future.

Ok so first Step add the columns via studio

Check if is already in vardefs i know is cache but it dont delete dosent matter if u repair and compile again

Add the custom field in to line_items.js

1 Like

This is the header i put manual but you can try to use global labels

modify sql query in to line_items.php you dont need to repair and rebuild for see the changes on php files

The Header:

Calling the variable via JSON you have to modify correctly the query for get the information of custom fields

Check if the fields is in the Database-Table

1 Like

Final Results:

I hope this could help you

1 Like

Muchas gracias @Evancio, con seguridad esto sera muy Ćŗtil para toda la comunidad.

Thanks a lot, this looks quite useful!

Did you manage to make these changes upgrade-safe? Are they all in the ā€œcustomā€ folder or did you need to edit the files in their original places?

I edited line_items.php from original folder and line_items.js from custom folder because i see this condition on line_items.php

if ($view == ā€˜EditViewā€™) {
$html .= ā€˜ā€™;
if (file_exists(ā€˜custom/modules/AOS_Products_Quotes/line_items.jsā€™)) {
$html .= ā€˜ā€™;

If line_items.js is not already on custom folder then is necesary to copy the file from original folder.

And does it still work if your changes are only in

custom/modules/AOS_Products_Quotes/Line_Items.php

but not in

modules/AOS_Products_Quotes/Line_Items.php ?

I hope that file can be customized in an upgrade-safe manner, tooā€¦

the changes are in:

modules/AOS_Products_Quotes/Line_Items.php

dont pass the file to custom folder because u cant make changes there i already tried.

Normally when you canā€™t get a customization to be picked up, it needs to be customized ā€œone file beforeā€, meaning, you need a custom version of the file that invokes that file.

So in this case you probably need custom versions of these vardefs:


/var/www/html/modules/AOS_Quotes/vardefs.php:346:                        'include' => 'modules/AOS_Products_Quotes/Line_Items.php'
/var/www/html/modules/AOS_Quotes/vardefs.php:555:                        'include' => 'modules/AOS_Products_Quotes/Line_Items.php'

/var/www/html/modules/AOS_Contracts/vardefs.php:420:                        'include' => 'modules/AOS_Products_Quotes/Line_Items.php'
/var/www/html/modules/AOS_Contracts/vardefs.php:627:                        'include' => 'modules/AOS_Products_Quotes/Line_Items.php'

/var/www/html/modules/AOS_Invoices/vardefs.php:256:                        'include' => 'modules/AOS_Products_Quotes/Line_Items.php'
/var/www/html/modules/AOS_Invoices/vardefs.php:463:                        'include' => 'modules/AOS_Products_Quotes/Line_Items.php'

Although maybe this mechanism could be improved - if we can find where these vardef ā€œincludesā€ are being evaluated, we could add a check for custom files thereā€¦

By the way, since vardefs are actual PHP that gets executed, you could try editing each of those like this:


modules/AOS_Quotes/vardefs.php:346:                        'include' => get_custom_file_if_exists('modules/AOS_Products_Quotes/Line_Items.php')

I never tried this sort of thing, I donā€™t know if it will work

Hi pgr thanks for the attention

I will review it more in detail as I am using it in different modules if something change in other modules i will post again B-)

Hi, Evancio, IĀ“m added an fnew field on line items module, but i canĀ“t visualize it the field added, I attach screenshots of the settings I made. I hope you can help me

Screenshots

I have attached a link with the screenshots since it does not allow me to upload images.

1 Like

Hello, Thanks for your help.

Can we speak by Skype or other way?

Thank you very much.

Sorry to dig up this topic, I think it is still relevant now.

Has someone the permissions to retrieve the attached screenshots ? I tried many times to add custom fields to line items groups but canā€™t succeed.

Thank you for the collaboration !

you can modify the vardefs where fields are pointing to the Line_Items.php file as mentioned by @pgr in comment

Below is what i did to show custom fields by changing line_items.js

1 Like

Can you tell me how did you manage to save the value of these custom fields into database

hey buddy @cherub-chum could you able attach the configuration that you made to add these fields in lineitem.js , if it is possible then it will be very useful for beginners like me. Thanks in advance

Other user shared the answer:

1 Like