I recently updated the system using the built-in Modules Window on the Admin's Side and encountered an error on the update, so I decided to do a complete rebuild of the system using ANT SMARTBUILD just to wipe any problem that could have been created on the incomplete update process.
Prior to this, I had manually created a column on the C_ORDER table, which was PO_Reference (to input my customer's PO Number).
After the ANT Smartbuild everything was apparently fine, but a couple of days later when I tried to print an Invoice it did not work.
After half an hour of reading logs to try to see what was happening, I noticed that the print was failing because the SQL Query on the Invoice Template did not find my custom field (the PO Number is printed on the Invoice), so I went to the DB to check if the column was there, and IT WAS GONE!!!
I re-created it manually (just to get the templates to print again), but the old information was gone.
There are two things to I need to do to solve this problem:
1- Manually restore restore the PO_Reference from a backup to my new DB. (Done!)
2-Make this custom column "upgrade safe" so it won't be deleted on the next Smartbuild. (Pending...)
UPDATE: This also happened with another field "c_order.tracking_number" so the Goods Shipment is not printing. I will definitely have to restore the old DB Columns as the tracking numbers are crucial for audit purposes.
Custom DB Columns Created: