xtuple/qt-client — pull request #516 by krauseo (2014-10-07 00:57:51+00:00)
Title: Issue #24702 - correctly handle source id changes

In the sSaveItem() function, which is called when the source item id changes, if the value of _inTransaction is true the function just exits the function. Change to do a ROLLBACK and then move on to the rest of that function, which will create a new TEMPCOPY item record and populate the values of target item description and newitemid.

After a successful copy, the system sets _inTransaction to false and runs the clear() function, which sets source(id) to -1. This will cause sSaveItem to run again. This will set _inTransaction to false, but since the CopyItem function called there won't throw an error, it will just return no data, and _inTransaction will be set to true. Then, when an actual new item is selected and SSaveCopy is called again, the system won't run the CopyItem function and update target item description or _newitem. Change sSaveItem to just return if the value of _source->id() is -1, to ensure values are reset when the next source item is chosen.