Add checking if any file was processed. #708

This commit is contained in:
Korina Cordero 2022-09-29 05:50:46 +00:00
parent 97d058c3d3
commit 6794db5f6a

View file

@ -63,7 +63,7 @@ class LoadWarrantySerialCommand extends Command
$db = $em->getConnection(); $db = $em->getConnection();
$ws_query_sql = 'SELECT id, file_serial, file_id, api_user, orig_file_serial FROM warranty_serial_queue $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 = $db->prepare($ws_query_sql);
$ws_query_stmt->bindValue('status', $status); $ws_query_stmt->bindValue('status', $status);
@ -84,12 +84,15 @@ class LoadWarrantySerialCommand extends Command
$this->updateWarrantySerialQueue($id); $this->updateWarrantySerialQueue($id);
} }
if (count($output_info) > 0)
{
// error_log(print_r($this->log_data, true)); // error_log(print_r($this->log_data, true));
// load log data into db // load log data into db
$this->load_logger->logWarrantySerialLoadInfo($this->log_data); $this->load_logger->logWarrantySerialLoadInfo($this->log_data);
// send results back to third party // send results back to third party
$this->sendResults($output_info); $this->sendResults($output_info);
}
return 0; return 0;
} }
@ -133,7 +136,7 @@ class LoadWarrantySerialCommand extends Command
// valid entry, we parse and insert // valid entry, we parse and insert
$serial = trim(strtoupper($row[0])); $serial = trim(strtoupper($row[0]));
// error_log('Processing ' . $serial); error_log('Processing ' . $serial);
$sku = trim(strtoupper($row[1])); $sku = trim(strtoupper($row[1]));
$dispatch_status = trim($row[2]); $dispatch_status = trim($row[2]);
@ -445,7 +448,7 @@ class LoadWarrantySerialCommand extends Command
curl_close($curl); curl_close($curl);
// check result // check result
// error_log('Result ' . $res); error_log('Result ' . $res);
} }
} }