Resolve "Add checking for warranty serial length" #1634
1 changed files with 20 additions and 2 deletions
|
|
@ -23,7 +23,8 @@ use DateTime;
|
|||
|
||||
class LoadWarrantySerialCommand extends Command
|
||||
{
|
||||
const FIELD_COUNT = 7;
|
||||
const FIELD_COUNT = 7;
|
||||
const SERIAL_LENGTH = 20;
|
||||
|
||||
protected $em;
|
||||
protected $upload_logger;
|
||||
|
|
@ -277,8 +278,25 @@ class LoadWarrantySerialCommand extends Command
|
|||
return $data;
|
||||
}
|
||||
|
||||
// validate the date created
|
||||
// check length of serial
|
||||
$serial = trim($row[0]);
|
||||
if (strlen($serial) > SELF::SERIAL_LENGTH)
|
||||
{
|
||||
// log
|
||||
$error = 'Serial length too long';
|
||||
$this->logLoadInfo($user_id, false, $serial, $error);
|
||||
|
||||
$data = [
|
||||
'serial' => $serial,
|
||||
'status' => 'error',
|
||||
'has_error' => true,
|
||||
'error_message' => $error,
|
||||
];
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
// validate the date created
|
||||
$str_date_create = trim($row[3]);
|
||||
|
||||
$date_create = $this->convertDateCreate($str_date_create);
|
||||
|
|
|
|||
Loading…
Reference in a new issue