Hi All ,
i fixed it , m happy to share the solution so here i aim to have button or link to list view on click of that it will give me new list view with status = converted in leads module
so i copy fille from inclue/ searchForm/tpl/SearchFormGeneric.tpl and paste it to folder /custom/include/SearchForm/tpl/SearchFormGeneric.tpl
and added some code in that
{if $module eq 'Leads'}
<a id="go_select" href="javascript:void(0);" >Converted </a>
{/if}
{literal}
<script type="text/javascript">
$( document ).ready(function() {
$ ('#go_select').click(function(){
var newLoc = 'index.php?module=Leads&action=subscriber';
document.location = newLoc;
});
});
</script>
{/literal}
add this code be four help icon
so it will check if module is lead than it will show the converted link ( like advance search near to that ) and we have also added on click js function at the end
Do repair and rebuild and see the changes happen
so now on click of the converted link i will redirect to index.php?module=Leads&action=converted
but till now we did not create a action in controller
so create a controller in custom/modules/leads/controller.php file
and add the following code in that
<?php
class LeadsController extends SugarController
{
public function action_subscriber()
{
$this->view = 'converted';
}
}
so that’s it we have created a controller now and we have specify that what ever comes to this controller it will redirect to view page converted
so now we have to create a view page converted that will give us a list of leads with converted status
so go on and create a file custom/modules/Leads/views/view.subscriber.php
and now we need a list of leads with status converted so that we have to manage here :whistle:
<?php
require_once('include/MVC/View/views/view.list.php');
require_once('custom/modules/Leads/LeadsListViewSmarty.php');
require_once 'modules/Configurator/Configurator.php';
class LeadsViewSubscriber extends ViewList
{
/**
* @see ViewList::preDisplay()
*/
var $where = "leads.status='Converted'";
public function preDisplay(){
require_once('modules/AOS_PDF_Templates/formLetter.php');
formLetter::LVPopupHtml('Leads');
parent::preDisplay();
$this->lv = new LeadsListViewSmarty();
}
public function display(){
parent::display();
}
public function listViewProcess() // genrating listview
{
$this->processSearchForm();
$this->lv->searchColumns = $this->searchForm->searchColumns;
if(!$this->headers)
return;
if(empty($_REQUEST['search_form_only']) || $_REQUEST['search_form_only'] == false){
$this->lv->ss->assign("SEARCH",true);
$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']);
$configObject = new Configurator();
$configObject->loadConfig();
$configObject->config['save_query'] = 'no';
$configObject->saveConfig();
echo $this->lv->display();
}
}
}
so mainly we are setting where condition over here so list will generate with that condition
and we have are updating the gable config save_query =‘no’ so every time when page loads i will start from pagination offset 0
so that’s it Do repair and rebuild and see the changes :cheer:
i hope this helps