Add checking for null rider ids. #654

This commit is contained in:
Korina Cordero 2022-05-12 07:04:52 +00:00
parent 0dda309a76
commit 559a61bb13

View file

@ -115,14 +115,21 @@ class FulfillOpenJobOrderCommand extends Command
$fulfill_jo_stmt = $conn->prepare($fulfill_jo_sql);
$fulfill_jo_stmt->execute([
'fulfilled' => JOStatus::FULFILLED,
'del_fulfilled' => DeliveryStatus::FULFILLED
'del_fulfilled' => DeliveryStatus::FULFILLED,
'jo_id' => $jo_id,
]);
// create jo event
// set user to admin that has id of 1
$user_id = 1;
$jo_event_values = '(' . $user_id . ',' . $jo_id . ',\'' . $str_current_date . '\',\'' . $str_current_date . '\',\'' . JOEventType::FULFILL . '\',' . $rider_id . ')';
$r_id = 'NULL';
// check if rider is null
if ($rider_id != NULL)
$r_id = $rider_id;
// need to check rider id if null since that will change the jo_event_values
$jo_event_values = '(' . $user_id . ',' . $jo_id . ',\'' . $str_current_date . '\',\'' . $str_current_date . '\',\'' . JOEventType::FULFILL . '\',' . $r_id . ')';
$create_jo_event_sql = 'INSERT into `jo_event` (create_user_id, job_order_id, date_create, date_happen, type_id, rider_id) VALUES ' . $jo_event_values . ';' . "\n";
@ -224,6 +231,8 @@ class FulfillOpenJobOrderCommand extends Command
$sap_code = $batt_info['sap_code'];
// populate the values string for the values to be inserted into warranty
// TODO: add checking for sap code. we need another value string and sql statement if sap_code is blank
// where sap_code is not inserted
$value_string = '(' . $model_id . ',' . $size_id . ',\'' . $sap_code . '\',\'' . $warranty_class . '\',\''
. $plate_number . '\',\'' . $warranty_status . '\',\'' . $str_current_date . '\',\'' . $str_date_schedule
. '\',\'' . $str_date_expire . '\',\'' . $first_name . '\',\'' . $last_name . '\',\'' . $mobile . '\',' . 1 . ',' . $vehicle_id . ',' . $cust_id . ',\'' . WarrantySource::ADMIN_PANEL . '\')';