Introduce functions in OpenlmisCachedResource that fetch data both online and offline
In OpenlmisCachedResource we should have functions that allow us to fetch the data no matter if we are online or offline. The functions should discover if we are online or offline.
If we are online, it fetches the data from the remote resource (server) with If-Modified-Since param. If there are changes it updates them in the cache. Then we return the resource from the cache.
If we are offline, it attempts to fetch the data from the cache.
The above error no longer occurs.
Thank you for the explanation! I thought you have to go to the right screen every time to load the data
According to the 2nd issue - after opening Adjustment in online mode, all the necessary data (both for Adjustments and Issue) was cached, therefore we can enter Issue in offline mode.
Now internal error only shows up for EM and only the first time. If I wait a while and click the "Make Adjustment" or "Make Issue" button, the correct error is already visible as with FP.
Clear the cache.
Log in to the application.
Go to Stock Management> Issue / Adjustment.
Click "Make Adjustment" / "Make Issue" button.
Internal error appears.
Try to click the button again after some time or after returning from another tab.
The information takes longer to load, but it is already correct.
2. I also noticed that when I go online only to Adjustment (or only to Issue) and then go offline, Issue also opens.
Clear the cache and log in to the application.
Go to Stock Management> Adjustment.
Click e.g. "Make Adjustment" for FP.
Go offline and go to Stock Management> Issue.
Click the "Make Issue" button.
Issue is also opening.
I haven't loaded data for Issue before, so an error should appear.
Could you check it again? Now it should work properly.