Topic: Journal Inquiry & GL Inquiry not remembering date

Hello,,
is there any way for GL and journal inquiry not to keep resetting the selected period every time the page is refreshed?
i mean when i want to view the transactions for a selected period.. lets say from 1 Jan 2017 to 31 Dec 2017 i get the result,
then when i log out or just reload the page the period is reseted to the last 30 days.. so it become 24 Oct to 24 Nov.

i checked the Remember last document date option in the preferences but it doesn't seem to be working.

other inquires and reports work just fine.

Re: Journal Inquiry & GL Inquiry not remembering date

See this wiki page.

This functionality has now been integrated into FA 2.4.x with the settings in the users table as the fields:

sticky_doc_date
transaction_days
save_report_selections

Make sure that the browser cache is cleared and the company's js_cache is also cleared. Logout and login again and see what gives. In the last case above, this user choice data are stored in cookies and you must have it enabled. The others store it in the session.

The function date_cells() is the one that sets the form element. There appears to be no mention of sticky_doc_date(), new_doc_date(), etc there to remember the dates. The _last_val attribute of the date cell should be set from the sticky value.

@joe: needs a check to extend it to search forms as well?

Post's attachments

Remember_Last_Doc_Date.png 37.6 kb, file has never been downloaded. 

You don't have the permssions to download the attachments of this post.

3 (edited by Alaa 11/24/2017 01:10:46 pm)

Re: Journal Inquiry & GL Inquiry not remembering date

i couldn't get it to work..
is it possible to hard code it for the journal inquiry ?

Re: Journal Inquiry & GL Inquiry not remembering date

Actually, in all cases involving reports, the cookies will store the parameters so it did not matter if there were more than one date in the form. The screen forms for data entry generally had just 1 sticky date that was remembered in the session user variable's sticky_date property. In case of all inquiry forms this feature has not yet been coded to work.

The alternative would be to temporarily change the transaction days value to a figure that would generate the desired starting date from now.

@joe: can we code it to use cookies to store the various date ranges in screen inquiry forms?

Re: Journal Inquiry & GL Inquiry not remembering date

Note: https://github.com/apmuthu/frontac24/pull/8 addressed this issue.

Re: Journal Inquiry & GL Inquiry not remembering date

@BraathWaate: The reason this part of your Pull Request was not taken into the core is probably because the browser back button usage is not advised in FA and that is why we have a Back link on practically every key FA page which takes us to a known state each time it is clicked. Browser Cache is another issue that will affect such operations.

Re: Journal Inquiry & GL Inquiry not remembering date

This will be my last post on alaa's question, because I don't mean to redirect it off-topic.

However, for the record, the back link in FA calls javascript history.go(), which is identical to the browser back button (see, https://www.w3schools.com/jsref/met_his_back.asp).

Thus, both techniques are open to exactly the same browser cache issue (will the back button display the cached page or will it refresh it?).   I haven't run into this issue with FA, as it seems to always refresh the page in my testing.  If it doesn't, a coder can force it to refresh using cache-control.

The pull request is a standard AJAX coding approach, nothing more (see, https://webmasters.stackexchange.com/questions/88790/how-should-the-back-button-behave-when-a-site-is-built-with-ajax-and-javascript). 

Finally, Web user interface design recommendations discourage placing a back link on a page if it duplicates the browser back button (page clutter).  If it does not duplicate the browser back button, then then link should be called something else.

Re: Journal Inquiry & GL Inquiry not remembering date

In my installation 2.4.3 The behavior of the Back link and the (back arrow) on the browser are identical. They both produce the same unexpected result as Alaa and Braath Waate described it. Even after clearing cash. It is the same behavior on the demo site..so I took it for granted it is how it is.

Re: Journal Inquiry & GL Inquiry not remembering date

Hi,
I have been testing this pull request as above (https://github.com/apmuthu/frontac24/pull/8) and its working ok but for the following scenario its not OK. Let me explain:

1) Click Sales Quotation Inquiry
2) Change the from Date to a past date.
3) Click the edit pencil
4) Click the Back or browser Back arrow

The result is I am presented with Search all Orders Screen which is not expected. I was expecting back to Sales Quotation Inquiry.

Is this a bug?

Re: Journal Inquiry & GL Inquiry not remembering date

Yes, this is a bug.  Add "type" to the array in get_js_history() and set_posts()

The original pull request is out-of-date.  As stated therein, many pages would benefit from the concept, and not all was implemented at that time.   There have been other bug fixes and improvements to it.

Re: Journal Inquiry & GL Inquiry not remembering date

Thanks Braath.. where can I get the latest pull request from?

Re: Journal Inquiry & GL Inquiry not remembering date

There isn't an updated pull request.

This feature (among others) is in my production code base at https://github.com/braathwaate/frontac24 in the wwh branch.   By searching for "ajax sync" in the commits you could find some of the changes.  I admit this is confusing.  I made changes under other commit names, so you won't find everything this way.

One improvement was adding a nocache parameter to the core page() function.  The inquiry functions set this, so that after a return to the inquiry page after an edit, the page refreshes and shows the updated transaction, still using the same search parameters originally set by the user.