Sales Order Date Posted Override

Posted:
Tue Apr 19, 2016 2:50 pm
by Professional
We have a plugin (see attached) to allow overriding the posting date on sales orders and set the system parameter to user defined.
Please see the attached for details of the issue.
Are you able to determine why it is picking up the wrong date posted?
Thanks,
Jeff
Re: Sales Order Date Posted Override 

Posted:
Thu Apr 21, 2016 9:18 am
by Scott.Pearce
ugh, dealing with dates is always painful - I blame the Americans for writing them in a differing order.
Your plugin looks reasonable enough, although I do note some some inconsistency - in places the code is using "System.DateTime.Now" and in others it uses "System.DateTime.Today.ToString("dd/MM/yyyy")". Also I'd like to see some of the custom field contents - custom field contents is stored as string so it is possible to have a strange value that could conceivably convert to a crazy date. Also, I wonder if the system locale of the workstation is affecting the conversions - check that each workstation has it's system locale set to "English (Australia)" for each user, and also check the date formats (this is all done in Control Panel -> Region: Format/Additional Settings.../Location/
Administrative "Change System locale...").
It's a little hard to see in your attached screenshots, but does the "wrong" date look like a mangled conversion of the "correct" date (i.e. day and month reversed)? Are you able to find a pattern to the behaviour, i.e. does it only happen to a particular user, a particular workstation, for a particular type of invoice etc.? Are you able to get me I copy of the data so i can have a poke around? You could PM me a link to a password protected .rar file, or you could upload it to our ftp site (contact support if you need help doing this).
I also vaguely remember an issue we had a while ago where we found that a third party component would change the system locale for the jiwa process *if* it was accessed, and then never change it back to what it was (i.e. English Australia) - is something special happening with problem invoices like a cc payment popup is occurring or a paypal dll is being used?
Re: Sales Order Date Posted Override

Posted:
Fri Apr 22, 2016 7:41 pm
by Mike.Sheen
Scott.Pearce wrote:I also vaguely remember an issue we had a while ago where we found that a third party component would change the system locale for the jiwa process *if* it was accessed, and then never change it back to what it was (i.e. English Australia) - is something special happening with problem invoices like a cc payment popup is occurring or a paypal dll is being used?
That was the PayPal Payflow Pro doing that - when sending CC payments via PayPal it would set the culture to be EN-US and not set it back. We managed to work around that in our PayPal plugin to get the culture info first, invoke the PayPal assembly then set it back to what it was. Finding the cause of the problem was the inverse of fun.
Nasty nasty stuff on PayPal's behalf.