How to make the custom query for popup view, I made changes in ViewList as mentioned above but it doesn't affect on the list which came in popup view list.
My requirement is to pass product type when I open this from invoice module.
In invoice, we have a product line and service line, and from product module, i have differentiated product by type while adding new product as a "Goods" or "Service".
Now i have created 2 custom files, view.list.php, and view.popup.php.
But do not understand how to pass type flag from view.popup.php to view.list.php
Will be great if someone suggests me how to filter product data when relating popup called from the service line and popup called from the product line.
Thanks
You will need to change the listing query and add condition accordingly.
Following are the steps you need to follow in order to extend the LlistView query:
Step 1: Create or edit custom/modules/Opportunities/views/view.list.php
and add following code,
processSearchForm();
if(!$current_user->is_admin) // remove this condition if you dont want admin user to view the “Closed Lost” Opportunities.
$this->params[‘custom_where’] = ‘ AND opportunities.sales_stage <> “Closed Lost” ‘;
if (empty($_REQUEST[‘search_form_only’]) || $_REQUEST[‘search_form_only’] == false) {
$this->lv->setup($this->seed, ‘include/ListView/ListViewGeneric.tpl’, $this->where, $this->params);
$savedSearchName = empty($_REQUEST[‘saved_search_select_name’]) ? ” : (‘ – ‘ . $_REQUEST[‘saved_search_select_name’]);
echo $this->lv->display();
}
}
}
Step 2: Refresh list view!
The probable customizations you will see in the query are:
- Custom_form
- Custom_where
- Custom_select
- Custom_order_by
This is what we had to do to make it upgrade safe:
- Create folder custom/modules/AOS_Products_Quotes/
- Create inside the folder a copy of the original Line_Items.php but name the function differently so it will not collide.
- Create a custom copy of the line_items.js
- Change the included script in the Line_Items.php to include the new JS
$html .= '<script src="modules/AOS_Products_Quotes/line_items.js"></script>';
- Edit the line_items.js to filter your desired field
To call your custom Line_Items.php you have to do this change on AOS_Quotes/Ext/Vardefs/vardefs.ext.php:
$dictionary['AOS_Quotes']['fields']['line_items']=array(
'required' => false,
'name' => 'line_items',
'vname' => 'LBL_LINE_ITEMS',
'type' => 'function',
'source' => 'non-db',
'massupdate' => 0,
'importable' => 'false',
'duplicate_merge' => 'disabled',
'duplicate_merge_dom_value' => 0,
'audited' => false,
'reportable' => false,
'inline_edit' => false,
'function' =>
array(
'name' => 'lx_display_lines',
'returns' => 'html',
'include' => 'custom/modules/AOS_Products_Quotes/Line_Items.php'
),
);
Make sure to edit the custom line_items.js to filter based on your needs. Look for sqs_objects
that have a condition
property where you can filter things, leaving hardcoded/default values or (what we do) get it from another JS call like window.getCurrenUserSettings
sqs_objects["product_name[" + prodln + "]"] = {