Add checking for serial length. #707
This commit is contained in:
parent
72dab63503
commit
b8c0fa9932
1 changed files with 20 additions and 2 deletions
|
|
@ -24,6 +24,7 @@ use DateTime;
|
||||||
class LoadWarrantySerialCommand extends Command
|
class LoadWarrantySerialCommand extends Command
|
||||||
{
|
{
|
||||||
const FIELD_COUNT = 7;
|
const FIELD_COUNT = 7;
|
||||||
|
const SERIAL_LENGTH = 20;
|
||||||
|
|
||||||
protected $em;
|
protected $em;
|
||||||
protected $upload_logger;
|
protected $upload_logger;
|
||||||
|
|
@ -277,8 +278,25 @@ class LoadWarrantySerialCommand extends Command
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
// validate the date created
|
// check length of serial
|
||||||
$serial = trim($row[0]);
|
$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]);
|
$str_date_create = trim($row[3]);
|
||||||
|
|
||||||
$date_create = $this->convertDateCreate($str_date_create);
|
$date_create = $this->convertDateCreate($str_date_create);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue