Exports Update for UI MVP
What are exports?
Exports are functionality that our clients or our internal users use to get data from our system. It is done by extracting the data, storing it in the files(csv, xlsx or fixed format) and uploading it on ftp or storing it on local machine. We have two main types: manual or automatic.
Specific things in Manual Export:
Specific things in Automatic Export:
- We should have Cron Job which is active and its not started in the last Exectuion Interval. Example: If execution interval is 5 minutes, last time of starting the cron was 15:00 and time now is 15:03, it will not start the cron.
- If we have Import Export Log record which is connected to this export and its Import/Export Status IN PROGRESS, we do not start another export. If there is no export script which is running at the moment for given cron job, we change the Import Export Log > Import/Export Status to FAILED. Each Auto Export is being checked on its own - for uniqueness and if running
- Every Automatic Export has Export Layout which contains select statement. Based on the selected fields we can figure out if given export is order. We must have one column of the selected with alias ‘system_order_id’. If we have and alias 'system_order_item_id’ on column we will update and export flags in Product In Order table.
- If export is order, we will change the select statement with adding some logic which will skip already exported orders. Already exported orders are stored in Automatic Exported Order table (This logic must be changed in the new version!) and they are connected to the given export.
- If Put every order in single file is yes(its in the Export Layout) and export is order, we put every order in a different file. Otherwise all orders are going to be in one file.
- If Mark orders as exported(its in Cron Job) is yes, we insert in Automatic Exported Order all success orders with Error Export no, all failed with Error Export yes. In Order table, we update Error Export field with same logic. If we need to update and Product In Orders, we update Line Exported to yes (this is explained in point 3).