From 6794db5f6a341de0f5fbef0eb89f054a4be38dab Mon Sep 17 00:00:00 2001 From: Korina Cordero Date: Thu, 29 Sep 2022 05:50:46 +0000 Subject: [PATCH] Add checking if any file was processed. #708 --- src/Command/LoadWarrantySerialCommand.php | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/Command/LoadWarrantySerialCommand.php b/src/Command/LoadWarrantySerialCommand.php index 6dfe53d8..9abb600e 100644 --- a/src/Command/LoadWarrantySerialCommand.php +++ b/src/Command/LoadWarrantySerialCommand.php @@ -63,7 +63,7 @@ class LoadWarrantySerialCommand extends Command $db = $em->getConnection(); $ws_query_sql = 'SELECT id, file_serial, file_id, api_user, orig_file_serial FROM warranty_serial_queue - WHERE status = :status LIMIT 1'; + WHERE status = :status ORDER BY id LIMIT 1'; $ws_query_stmt = $db->prepare($ws_query_sql); $ws_query_stmt->bindValue('status', $status); @@ -84,12 +84,15 @@ class LoadWarrantySerialCommand extends Command $this->updateWarrantySerialQueue($id); } - // error_log(print_r($this->log_data, true)); - // load log data into db - $this->load_logger->logWarrantySerialLoadInfo($this->log_data); + if (count($output_info) > 0) + { + // error_log(print_r($this->log_data, true)); + // load log data into db + $this->load_logger->logWarrantySerialLoadInfo($this->log_data); - // send results back to third party - $this->sendResults($output_info); + // send results back to third party + $this->sendResults($output_info); + } return 0; } @@ -133,7 +136,7 @@ class LoadWarrantySerialCommand extends Command // valid entry, we parse and insert $serial = trim(strtoupper($row[0])); - // error_log('Processing ' . $serial); + error_log('Processing ' . $serial); $sku = trim(strtoupper($row[1])); $dispatch_status = trim($row[2]); @@ -445,7 +448,7 @@ class LoadWarrantySerialCommand extends Command curl_close($curl); // check result - // error_log('Result ' . $res); + error_log('Result ' . $res); } }