Add saving of data to archive table. #762

This commit is contained in:
Korina Cordero 2023-09-08 17:24:43 +08:00
parent 4c0460bdb5
commit 4eca65cc59

View file

@ -126,6 +126,8 @@ class GetJobOrderArchiveDataCommand extends Command
$backup_data[] = $this->createBackupData($row);
}
error_log('count ' . count($backup_data));
// create the load file for the backup data
$this->createLoadDataFileForBackupData($backup_data, $archive_table_name);
@ -238,7 +240,6 @@ class GetJobOrderArchiveDataCommand extends Command
if ($row['date_fulfill'] != NULL)
$date_fulfill = $row['date_schedule'];
$coordinates = $row['coordinates'];
$flag_advance = $row['flag_advance'];
$service_type = $row['service_type'];
$source = $row['source'];
@ -248,6 +249,8 @@ class GetJobOrderArchiveDataCommand extends Command
$date_cancel = $row['date_cancel'];
$status = $row['status'];
// TODO: might need to clean delivery address and delivery instructions
$del_instructions = $row['delivery_instructions'];
$del_address = $row['delivery_address'];
@ -312,6 +315,10 @@ class GetJobOrderArchiveDataCommand extends Command
$coord_long = $row['coord_long'];
$coord_lat = $row['coord_lat'];
// coordinates needs special handling since it's a spatial column
$coordinates = 'POINT(' . $coord_lat . ' ' . $coord_long .')';
$priority = $row['priority'];
$meta = $row['meta'];
@ -475,7 +482,7 @@ class GetJobOrderArchiveDataCommand extends Command
FIELDS TERMINATED BY \'|\'
LINES TERMINATED BY \'\\r\\n\'
(id, customer_id, cvehicle_id, rider_id, date_create,
date_schedule, date_fulfill, coordinates, flag_advance, service_type,
date_schedule, date_fulfill, @coordinates, flag_advance, service_type,
source, date_cancel, status, delivery_instructions, delivery_address,
create_user_id, assign_user_id, date_assign, warranty_class, process_user_id,
hub_id, cancel_reason, ref_jo_id, tier1_notes, tier2_notes,
@ -485,7 +492,9 @@ class GetJobOrderArchiveDataCommand extends Command
first_name, last_name, plate_number, phone_mobile, no_trade_in_reason,
will_wait, reason_not_waiting, not_waiting_notes, delivery_status, emergency_type_id,
ownership_type_id, cust_location_id, source_of_awareness, remarks, initial_concern,
initial_concern_notes, gender, caller_classification, inventory_count)');
initial_concern_notes, gender, caller_classification, inventory_count)
SET coordinates=ST_GeomFromText(@coordinates)'
);
$result = $stmt->execute();