I just wanted to report an issue with the _soheadtrigger() that prevents me from using the api.salesorder view (or cohead for that matter) to insert data in certain cases. I’ve reproduced the operation within the xt5 masterref database.
Steps to reproduce in masterref. Go to the TTOYS customer and on the Addresses tab select “Ship to” and disable the “Default” attribute from any of the stored ship to addresses.
Execute this query:
" INSERT INTO api.salesorder(order_number, order_date, customer_number, sale_type,
shipto_name, shipto_address1, shipto_address2, shipto_city,
shipto_state, shipto_country, shipto_postal_code,
shipto_shipzone, freight, shipping_chgs, ship_via,
shipto_phone, shipto_contact_phone, shipto_contact_email, hold_type, tax_zone,
VALUES(‘999999’,‘2019-09-24’, ‘TTOYS’, ‘Phone’,
‘SHIP TO NAME’,’ Shipto Addr1’, ‘Shipto Addr2’, ‘Shipto City’,
‘OK’, ‘US’, ‘74074-2345’,
‘405-377-6570’,‘405-377-6570’, ‘firstname.lastname@example.org’,‘Credit’, ‘VA Sales Tax’,
The order is inserted with no line items so you’ll get an error regarding that fact when you open the order to view.
The problem is that none of the shipto address information is imported.
Looking at the code in the trigger function it looks like around Line#145 all the passed in shipto address values are being overwritten. This effectively eliminates the ability to do freeform shipto addresses. I’ve modified the trigger to get it to work for us but I’m hoping that the _soheadtrigger function can be reviewed and tested and changed if that is not the way it was intended to function.