From 6382cfda1e62806bdb9e2096a891f2ac7548fe17 Mon Sep 17 00:00:00 2001 From: Korina Cordero Date: Thu, 7 Sep 2023 18:01:13 +0800 Subject: [PATCH] Add checking for nulls when creating the data for backup. #762 --- src/Command/GetJobOrderArchiveDataCommand.php | 89 ++++++++++++++----- 1 file changed, 69 insertions(+), 20 deletions(-) diff --git a/src/Command/GetJobOrderArchiveDataCommand.php b/src/Command/GetJobOrderArchiveDataCommand.php index ec5266e6..704c509f 100644 --- a/src/Command/GetJobOrderArchiveDataCommand.php +++ b/src/Command/GetJobOrderArchiveDataCommand.php @@ -311,34 +311,83 @@ class GetJobOrderArchiveDataCommand extends Command $fac_type = $row['facilitated_type']; $coord_long = $row['coord_long']; - $coord_lat = $row['coord_lat']; $priority = $row['priority']; $meta = $row['meta']; - $status_autoassign = $row['status_autoassign']; + + $status_autoassign = '\N'; + if ($row['status_autoassign'] != NULL) + $status_autoassign = $row['status_autoassign']; + $first_name = $row['first_name']; $last_name = $row['last_name']; $plate_number = $row['plate_number']; $phone_mobile = $row['phone_mobile']; - $no_trade_in_reason = $row[' no_trade_in_reason']; + + $no_trade_in_reason = '\N'; + if ($row['no_trade_in_reason'] != NULL) + $no_trade_in_reason = $row[' no_trade_in_reason']; + $will_wait = $row['will_wait']; - $reason_not_waiting = $row['reason_not_waiting']; - $not_waiting_notes = $row['not_waiting_notes']; - $del_status = $row['delivery_status']; - $emergency_type_id = $row['emergency_type_id']; - $owner_type_id = $row['ownership_type_id']; - $cust_location_id = $row['cust_location_id']; - $source_of_awareness = $row['source_of_awareness']; - $remarks = $row['remarks']; - $initial_concern = $row['initial_concern']; - $initial_concern_notes = $row['initial_concern_notes']; - $gender = $row['gender']; - $caller_class = $row['caller_classification']; + + $reason_not_waiting = '\N'; + if ($row['reason_not_waiting'] != NULL) + $reason_not_waiting = $row['reason_not_waiting']; + + $not_waiting_notes = '\N'; + if ($row['not_waiting_notes'] != NULL) + $not_waiting_notes = $row['not_waiting_notes']; + + $del_status = '\N'; + if ($row['delivery_status'] != NULL) + $del_status = $row['delivery_status']; + + $emergency_type_id = '\N'; + if ($row['emergency_type_id'] != NULL) + $emergency_type_id = $row['emergency_type_id']; + + $owner_type_id = '\N'; + if ($row['ownership_type_id'] != NULL) + $owner_type_id = $row['ownership_type_id']; + + $cust_location_id = '\N'; + if ($row['cust_location_id'] != NULL) + $cust_location_id = $row['cust_location_id']; + + $source_of_awareness = '\N'; + if ($row['source_of_awareness'] != NULL) + $source_of_awareness = $row['source_of_awareness']; + + $remarks = '\N'; + if ($row['remarks'] != NULL) + $remarks = $row['remarks']; + + $initial_concern = '\N'; + if ($row['initial_concern'] != NULL) + $initial_concern = $row['initial_concern']; + + $initial_concern_notes = '\N'; + if ($row['initial_concern_notes'] != NULL) + $initial_concern_notes = $row['initial_concern_notes']; + + $gender = '\N'; + if ($row['gender'] != NULL) + $gender = $row['gender']; + + $caller_class = '\N'; + if ($row['caller_classification'] != NULL) + $caller_class = $row['caller_classification']; + $inv_count = $row['inventory_count']; - // check for nulls. check the ff fields since these can be null: date_fulfill, date_cancel, date_assign, create_user_id, - // assign_user_id, proces_user_id, hub_id, rider_id, cancel_reason, ref_jo_id, or_num, trade_in_type, - // flag_rider_rating, facilitated_type, facilitated_hub_id, status_autoassign, reason_not_waiting, - // not_waiting_notes, no_trade_in_reason, delivery_status, source_of_awareness, remarks, initial_concern, - // initial_concern_notes, gender, caller_classifications, emergency_type_id, ownership_type_id, cust_location_id + // create the array for the file + $data = [ + $id, + $cust_id, + // TODO: finish writing to array + ]; + + return $data; } + + // TODO: write the load data file function }