Add saving of data to archive table. #762
This commit is contained in:
parent
4c0460bdb5
commit
4eca65cc59
1 changed files with 13 additions and 4 deletions
|
|
@ -126,6 +126,8 @@ class GetJobOrderArchiveDataCommand extends Command
|
||||||
$backup_data[] = $this->createBackupData($row);
|
$backup_data[] = $this->createBackupData($row);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
error_log('count ' . count($backup_data));
|
||||||
|
|
||||||
// create the load file for the backup data
|
// create the load file for the backup data
|
||||||
$this->createLoadDataFileForBackupData($backup_data, $archive_table_name);
|
$this->createLoadDataFileForBackupData($backup_data, $archive_table_name);
|
||||||
|
|
||||||
|
|
@ -238,7 +240,6 @@ class GetJobOrderArchiveDataCommand extends Command
|
||||||
if ($row['date_fulfill'] != NULL)
|
if ($row['date_fulfill'] != NULL)
|
||||||
$date_fulfill = $row['date_schedule'];
|
$date_fulfill = $row['date_schedule'];
|
||||||
|
|
||||||
$coordinates = $row['coordinates'];
|
|
||||||
$flag_advance = $row['flag_advance'];
|
$flag_advance = $row['flag_advance'];
|
||||||
$service_type = $row['service_type'];
|
$service_type = $row['service_type'];
|
||||||
$source = $row['source'];
|
$source = $row['source'];
|
||||||
|
|
@ -248,6 +249,8 @@ class GetJobOrderArchiveDataCommand extends Command
|
||||||
$date_cancel = $row['date_cancel'];
|
$date_cancel = $row['date_cancel'];
|
||||||
|
|
||||||
$status = $row['status'];
|
$status = $row['status'];
|
||||||
|
|
||||||
|
// TODO: might need to clean delivery address and delivery instructions
|
||||||
$del_instructions = $row['delivery_instructions'];
|
$del_instructions = $row['delivery_instructions'];
|
||||||
$del_address = $row['delivery_address'];
|
$del_address = $row['delivery_address'];
|
||||||
|
|
||||||
|
|
@ -312,6 +315,10 @@ class GetJobOrderArchiveDataCommand extends Command
|
||||||
|
|
||||||
$coord_long = $row['coord_long'];
|
$coord_long = $row['coord_long'];
|
||||||
$coord_lat = $row['coord_lat'];
|
$coord_lat = $row['coord_lat'];
|
||||||
|
|
||||||
|
// coordinates needs special handling since it's a spatial column
|
||||||
|
$coordinates = 'POINT(' . $coord_lat . ' ' . $coord_long .')';
|
||||||
|
|
||||||
$priority = $row['priority'];
|
$priority = $row['priority'];
|
||||||
$meta = $row['meta'];
|
$meta = $row['meta'];
|
||||||
|
|
||||||
|
|
@ -471,11 +478,11 @@ class GetJobOrderArchiveDataCommand extends Command
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
|
|
||||||
$conn = $this->em->getConnection();
|
$conn = $this->em->getConnection();
|
||||||
$stmt = $conn->prepare('LOAD DATA LOCAL INFILE \'' . $file . '\' INTO TABLE ' . $table_name . '
|
$stmt = $conn->prepare('LOAD DATA LOCAL INFILE \'' . $file . '\' INTO TABLE ' . $table_name . '
|
||||||
FIELDS TERMINATED BY \'|\'
|
FIELDS TERMINATED BY \'|\'
|
||||||
LINES TERMINATED BY \'\\r\\n\'
|
LINES TERMINATED BY \'\\r\\n\'
|
||||||
(id, customer_id, cvehicle_id, rider_id, date_create,
|
(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,
|
source, date_cancel, status, delivery_instructions, delivery_address,
|
||||||
create_user_id, assign_user_id, date_assign, warranty_class, process_user_id,
|
create_user_id, assign_user_id, date_assign, warranty_class, process_user_id,
|
||||||
hub_id, cancel_reason, ref_jo_id, tier1_notes, tier2_notes,
|
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,
|
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,
|
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,
|
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();
|
$result = $stmt->execute();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue