xtuple/qt-client — pull request #502 by krauseo (2014-09-28 04:21:28+00:00)
Title: Issue 24615 - modify free-form ship-to check

I started looking at this bug three days ago because my company doesn’t allow free-form ship-tos for any customer and this bug could cause major problems for us. There’s a quick check to see if the shipto_id is -1 and the shipto_addr field is disabled, and if so, it’s supposed to throw the error. The system disables the shipto_addr field if the customer’s cust_ffshipto field is false. I spent three days tracing through the program trying to determine how it could set the shipto_id to something other than -1 for a customer that doesn’t allow free-form ship-tos. Couldn’t find anything. So, I started doing some test scripting with core disconnects in the system to check the value of shipto_id after different events in the PopulateCustomerInfo function in the code. That showed me that shipto_id was -1 throughout. So, I finally realized after three days that the problem wasn’t with shipto_id, it was the disabling of shipto_addr. The setFreeFormShipto function in the code is not disabling either shipto_addr or shipto_cntct, though it is disabling shipto_name. I have no idea why. In a script, if I say, “mywindow.findChild(“_shipToAddr”).enabled = false”, it gets disabled. But, in the code, saying “_shipToAddr->setEnabled(ffShipto), when ffShipto is false, doesn’t disable the field. Same goes for “_shipToCntct->setEnabled(ffShipto). This could be an issue with how address cluster and contact cluster widgets are set up, but that’s beyond my ken. All I know is that switching the error check from _shipToAddr to _shipToName (which will only be enabled if the customer allows free-form ship-tos) fixes this bug in advance of someone with more C++ knowledge than me figuring out the larger issue of why the SetEnabled commands aren’t working on the other two fields. You can see on a New Sales Order screen that right after you select a customer that doesn’t allow free-form ship-tos, you can click into the first line of the ship-to address field and into the ship-to contact name field. You should not be able to do that. I am going to post this fix here, and then put something into a script on my own system to forcibly set the ship-to address to disabled in advance of the fix getting into the core system.