Add WarrantySerialQueue entity. #704
This commit is contained in:
parent
7d65b1eb77
commit
3c9bdc8152
4 changed files with 95 additions and 7 deletions
|
|
@ -306,3 +306,13 @@ services:
|
|||
App\Service\WarrantyBulkUploader:
|
||||
arguments:
|
||||
$em: "@doctrine.orm.entity_manager"
|
||||
|
||||
# warranty serial file logger
|
||||
App\Service\WarrantySerialUploadLogger:
|
||||
arguments:
|
||||
$em: "@doctrine.orm.entity_manager"
|
||||
|
||||
# warranty serial load logger
|
||||
App\Service\WarrantySerialLoadLogger:
|
||||
arguments:
|
||||
$em: "@doctrine.orm.entity_manager"
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ class WarrantySerialController extends APIController
|
|||
$this->acl_gen = $acl_gen;
|
||||
}
|
||||
|
||||
public function upload(Request $req, EntityManagerInterface $em, WarrantySerialUploadLogger $upload_logger
|
||||
public function upload(Request $req, EntityManagerInterface $em, WarrantySerialUploadLogger $upload_logger,
|
||||
WarrantySerialLoadLogger $load_logger)
|
||||
{
|
||||
$this->denyAccessUnlessGranted('warrantyserial.upload', null, 'No access.');
|
||||
|
|
@ -69,7 +69,7 @@ class WarrantySerialController extends APIController
|
|||
$log_data = [
|
||||
'user_id' => $user_id,
|
||||
'is_uploaded' => false,
|
||||
'error' => $error;
|
||||
'error' => $error,
|
||||
];
|
||||
$this->upload_logger->logWarrantySerialUploadInfo($log_data);
|
||||
return new APIResponse(false, $error);
|
||||
|
|
@ -108,7 +108,7 @@ class WarrantySerialController extends APIController
|
|||
'user_id' => $user_id,
|
||||
'is_loaded' => true,
|
||||
'serial' => $serial,
|
||||
'error' => '';
|
||||
'error' => '',
|
||||
];
|
||||
|
||||
$this->upload_logger->logWarrantySeriaLoadInfo($log_data);
|
||||
|
|
@ -152,7 +152,7 @@ class WarrantySerialController extends APIController
|
|||
'user_id' => $user_id,
|
||||
'is_loaded' => false,
|
||||
'serial' => '',
|
||||
'error' => $error;
|
||||
'error' => $error,
|
||||
];
|
||||
$this->upload_logger->logWarrantySeriaLoadInfo($log_data);
|
||||
|
||||
|
|
@ -162,7 +162,7 @@ class WarrantySerialController extends APIController
|
|||
// validate the date created
|
||||
$str_date_create = trim($row[3]);
|
||||
|
||||
$date_create = $this->convertDateCreate($str_date_create)
|
||||
$date_create = $this->convertDateCreate($str_date_create);
|
||||
if ($date_create == null)
|
||||
{
|
||||
// log
|
||||
|
|
@ -172,7 +172,7 @@ class WarrantySerialController extends APIController
|
|||
'user_id' => $user_id,
|
||||
'is_loaded' => false,
|
||||
'serial' => $serial,
|
||||
'error' => $error;
|
||||
'error' => $error,
|
||||
];
|
||||
|
||||
$this->upload_logger->logWarrantySeriaLoadInfo($log_data);
|
||||
|
|
@ -180,11 +180,13 @@ class WarrantySerialController extends APIController
|
|||
return false;
|
||||
}
|
||||
|
||||
// check if serial is a dupe
|
||||
|
||||
// valid entry
|
||||
return true;
|
||||
}
|
||||
|
||||
protected convertDateCreate($str_date_create)
|
||||
protected function convertDateCreate($str_date_create)
|
||||
{
|
||||
// since some people cannot follow simple instructions...
|
||||
// check the date format on the string
|
||||
|
|
|
|||
75
src/Entity/WarrantySerialQueue.php
Normal file
75
src/Entity/WarrantySerialQueue.php
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use DateTime;
|
||||
|
||||
/**
|
||||
* @ORM\Entity
|
||||
* @ORM\Table(
|
||||
* name="warranty_serial_queue",
|
||||
* )
|
||||
*/
|
||||
class WarrantySerialQueue
|
||||
{
|
||||
// unique id
|
||||
/**
|
||||
* @ORM\Id
|
||||
* @ORM\Column(type="integer")
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
// date created
|
||||
/**
|
||||
* @ORM\Column(type="datetime")
|
||||
*/
|
||||
protected $date_create;
|
||||
|
||||
// warranty serial file
|
||||
/**
|
||||
* @ORM\Column(type="string", length=80, nullable=true)
|
||||
*/
|
||||
protected $file_serial;
|
||||
|
||||
// status
|
||||
/**
|
||||
* @ORM\Column(type="string", length=20)
|
||||
*/
|
||||
protected $status;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->date_create = new DateTime();
|
||||
$this->file_serial = null;
|
||||
$this->status = '';
|
||||
}
|
||||
|
||||
public function getID()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function setFileSerial($file = null)
|
||||
{
|
||||
$this->file_serial = $file;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getFileSerial()
|
||||
{
|
||||
return $this->file_serial;
|
||||
}
|
||||
|
||||
public function setStatus($status)
|
||||
{
|
||||
$this->status = $status;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getStatus()
|
||||
{
|
||||
return $this->status;
|
||||
}
|
||||
}
|
||||
|
|
@ -99,3 +99,4 @@ class WarrantySerialUploadLog
|
|||
{
|
||||
return $this->error;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue