Add customer source when new customer is created via admin panel. #548

This commit is contained in:
Korina Cordero 2021-04-05 06:18:17 +00:00
parent 3f2467f8f7
commit 20dd3f51df
2 changed files with 24 additions and 0 deletions

View file

@ -0,0 +1,20 @@
<?php
namespace App\Ramcar;
class CustomerSource extends NameValue
{
const MOBILE = 'mobile_api';
const THIRD_PARTY = 'third_party_api';
const WARRANTY = 'warranty';
const ADMIN_PANEL = 'admin_panel';
const LEGACY = 'legacy';
const COLLECTION = [
'mobile_api' => 'Mobile API',
'third_party_api' => 'Third Party API',
'warranty' => 'Warranty',
'admin_panel' => 'Admin Panel',
'legacy' => 'Legacy',
];
}

View file

@ -15,6 +15,7 @@ use App\Ramcar\CustomerClassification;
use App\Ramcar\FuelType;
use App\Ramcar\VehicleStatusCondition;
use App\Ramcar\CrudException;
use App\Ramcar\CustomerSource;
use App\Entity\Customer;
use App\Entity\CustomerVehicle;
@ -185,6 +186,9 @@ class ResqCustomerHandler implements CustomerHandlerInterface
$this->setObject($row, $req);
// set customer source only when new customer
$row->setCreateSource(CustomerSource::ADMIN_PANEL);
// custom validation for vehicles
$vehicles = json_decode($req->request->get('vehicles'));