Questions and discussion about developing processes and programming in PHP, JavaScript, web services & REST API.
Forum rules: Please search to see if a question has already asked before creating a new topic. Please don't post the same question in multiple forums.
By Gonch131
#814872
Hello everyone,

I'm testing the version ProcessMaker 3.2-community, where I want to stock some cookies in the Search filter.
The goal of this, is to keep in cache the last searched filter.

Can anyone help me, how I can change the code to put some cookies in the Processmaker, please ?

Best Regards,
User avatar
By amosbatto
#814883
In workflow/engine/templates/cases/casesListExtJs.php:122, change from:
Code: Select all
$oHeadPublisher->assign( 'enableEnterprise', $enableEnterprise ); //sending the page size

/*----------------------------------********---------------------------------*/
To:
Code: Select all
$oHeadPublisher->assign( 'enableEnterprise', $enableEnterprise ); //sending the page size
//added by ABB to display last search in cases list search box:
$searchText = isset($_SESSION['last_cases_search']) ? $_SESSION['last_cases_search'] : '';
$oHeadPublisher->assign( 'lastSearchText', $searchText );    
//end ABB edit
/*----------------------------------********---------------------------------*/
In workflow/engine/methods/cases/proxCasesList.php:31, change from:
Code: Select all
$search = isset($_REQUEST["search"]) ? $_REQUEST["search"] : "";
$action = isset($_GET["action"]) ? $_GET["action"] : (isset($_REQUEST["action"]) ? $_REQUEST["action"] : "todo");
To:
Code: Select all
$search = isset($_REQUEST["search"]) ? $_REQUEST["search"] : "";
//added by ABB to save last search text as a session variable:
if (trim($search) != '') {
   $_SESSION['last_cases_search'] = $search;
}

$action = isset($_GET["action"]) ? $_GET["action"] : (isset($_REQUEST["action"]) ? $_REQUEST["action"] : "todo");

In workflow/engine/templates/cases/casesList.js:1233, change from:
Code: Select all
    var textSearch = new Ext.form.TextField ({
        allowBlank: true,
        ctCls:'pm_search_text_field',
        width: 140,
        emptyText: _('ID_EMPTY_SEARCH'),
To:
Code: Select all
    var textSearch = new Ext.form.TextField ({
        allowBlank: true,
        ctCls:'pm_search_text_field',
        width: 140,
        value: (typeof lastSearchText === 'undefined' ? '' : lastSearchText), //added by ABB
        emptyText: _('ID_EMPTY_SEARCH'),
Then in ProcessMaker go to Admin > Clear Cache and mark all the options and click on "Clear".
Then, in your web browser, press CTRL+F5 in Windows or F5 in Linux to clear the browser's cache.

Now the last text searched in the "Search" box will be automatically entered in the field when the user goes to Home and clicks on one of the case lists. The user only has to click on the search icon next to the "Search" field to do the same search as before.

To convert MBOX to PST, start by downloading and i[…]

My Assignment Services stands out as one of the be[…]

Erectile Dysfunction, commonly known as impotence,[…]

Want to create your own meme coin?

In the world of cryptocurrencies, a unique and exc[…]