Page 1 of 2

nuHasBeenSaved()

Posted: Mon Aug 13, 2018 8:58 am
by toms
Hi,

Two situations where the window.nuTimesSaved counter should not be incremented:

1.
After a Clone Action has taken place, nuHasBeenSaved() should return 0.

(window.nuTimesSaved = 0;)

Edit: As I see, this has been solved, it's on Github.

2.
When a new record is opened and then, if the unsaved record is refreshed (Options Menu -> Refresh or Ctrl + Shift + R) nuHasBeenSaved() is incremented.

Re: nuHasBeenSaved()

Posted: Wed Aug 15, 2018 4:09 am
by admin
toms,

Try it now.

Steven

Re: nuHasBeenSaved()

Posted: Wed Aug 15, 2018 6:36 am
by toms
hmmm, nuHasBeenSaved() still returns 1 after a refresh.

1. Open a new or existing record
2. nuHasBeenSaved() returns 0
3. Refresh the record
2. nuHasBeenSaved() returns 1

Re: nuHasBeenSaved()

Posted: Thu Aug 16, 2018 1:25 am
by admin
toms,

OK, I've changed the way it works.

You can try it again.

Steven

Re: nuHasBeenSaved()

Posted: Thu Aug 16, 2018 3:30 am
by toms
Steven,

I don't see the change on Github.

Re: nuHasBeenSaved()

Posted: Thu Aug 16, 2018 6:38 am
by admin
toms,

This is it here...
git.PNG
Steven

Re: nuHasBeenSaved()

Posted: Fri Aug 17, 2018 9:47 pm
by toms
Steven,

It still doesn't work for me.

It works if I change it to this (replace == 0 with >=0)

Code: Select all

	if(window.nuTimesSaved >= 0){	
		window.nuTimesSaved 	= -1;
	}
Tested use cases with correct results:

Action: Open Browse Screen.
[Result]: nuHasBeenSaved() returns -1

Action: Open Browse Screen, then select a record (opens Edit Screen)
[Result]: nuHasBeenSaved() returns 0

Action: Open Browse Screen, then select a record, save the record
Result: nuHasBeenSaved() returns -1

Action: Open Browse Screen, then select a record, save the record twice
Result: nuHasBeenSaved() returns 2

Action: Open Browse Screen, then select a record, save the record three times
Result: nuHasBeenSaved() returns 3

Action: Open Browse Screen, then select a record, save the record three times, return to the Browse screen
Result: nuHasBeenSaved() returns -1

Action: Add a new record, save it
Result: nuHasBeenSaved() returns 1

Action: Open a record, clone it
Result: nuHasBeenSaved() returns 0

Action: Open a record, refresh
Result: nuHasBeenSaved() returns 0

Re: nuHasBeenSaved()

Posted: Sat Aug 18, 2018 7:21 pm
by toms
This case has yet to be dealt with:

If nuReturnNewRecord() is called in PHP (AS event)
nuHasBeenSaved() returns 1 instead of 0.

This is in contradiction with nuIsNewRecord() that correctly returns true

Re: nuHasBeenSaved()

Posted: Tue Aug 28, 2018 6:42 am
by admin
toms,

Have a go now.

Steven

Re: nuHasBeenSaved()

Posted: Tue Aug 28, 2018 11:51 am
by toms
Steven,

It still doesn't work. (and I don't see any changes in the latest commit )
toms wrote:hmmm, nuHasBeenSaved() still returns 1 after a refresh.

1. Open a new or existing record
2. nuHasBeenSaved() returns 0
3. Refresh the record
2. nuHasBeenSaved() returns 1
But my suggested fix works for me (Aug 17, 2018)
toms wrote: It works if I change it to this (replace == 0 with >=0)

Code: Select all

	if(window.nuTimesSaved >= 0){	
		window.nuTimesSaved 	= -1;
	}