Iām currently running SuiteCRM 7.5.1.
Alright, so I should preface that I have made modifications to the āServiceā Line Item feature in the Quotes module.
In mine, I changed the āService Nameā Textarea field to be a relate field that links to a custom module I created called āPoliciesā.
After the painstaking work of modifying all the files required to get this to work, I was able to achieve this. Similar to the Products Line Items, I was hoping to be able to populate the line items with related data from those specific records for each line item. For your knowledge, there is a service_policy_id field in the AOS_Products_Quotes table in the DB that stores the IDās for each record similarly to how the Products link works. If more information on what I changed is needed, I can certainly provide that.
Continuingā¦
I then went to the PDF Templates module, I created a custom view.edit.php file in custom/modules/AOS_PDF_Templates/views.
I copied the original, but added the following code right after the Service and Currency options are populated around line 188.
//Policies
$options_array = array(''=>'');
$policies = new p_policies();
foreach($policies->field_defs as $line_name => $line_arr){
if(!((isset($line_arr['dbType']) && strtolower($line_arr['dbType']) == 'id') || $line_arr['type'] == 'id' || $line_arr['type'] == 'link')){
if((!isset($line_arr['reportable']) || $line_arr['reportable']) && $line_arr['vname'] != 'LBL_NAME'){
$options_array['$'.$policies->table_name.'_'.$line_name] = translate($line_arr['vname'],$policies->module_dir);
}
}
}
$s_line_module_name = 'p_policies';
$fmod_options_array[$s_line_module_name] = translate('LBL_LINE_ITEMS','AOS_Quotes').' : '.translate('LBL_POLICIES','p_policies');
$insert_fields_js2 .="'$s_line_module_name':$options,\n";
So, I checked the Template again, and sure enough my new options were present from the custom module. I went ahead and popped them into the Template, hit save and then headed over the Quotes module.
In the quotes module, I clicked āAdd Service Line Itemā, and clicked on my new relate field and entered a few line items from my Custom Policies Module. I then hit save and could see that the data was saved correctly on the DetailView. I clicked āPrint PDFā from the options. However, the policies fields I inserted into the Template did not get populated.
Iām guessing Iām missing a step somewhere, does anyone know where I would go to ensure that the related Policy Record data for each line item can be populated onto the form?
E.G.
I select my relate field and select policy name āRL51232ā, if I were to navigate to that record, I have a field called āLE_Monthsā, if I put āp_policies_le_monthsā onto the PDF Template for line items, Iām hoping to populate each line item with the respective Field data.
Hope this makes sense, and if anyone needs more information on my custom changes, please tell me.