Merge branch '318-error_log-cleanup' into '270-final-cmb-fixes'

Resolve "error_log cleanup"

See merge request jankstudio/resq!364
This commit is contained in:
Kendrick Chan 2020-01-30 04:16:03 +00:00
commit ed606a87af
7 changed files with 81 additions and 14 deletions

View file

@ -313,17 +313,14 @@ class CreateCustomerFromWarrantyCommand extends Command
protected function loadCustomers()
{
error_log('starting query...');
// get all customers
$customers = $this->em->getRepository(Customer::class)->findAll();
$cust_q = $this->em->createQuery('select c from App\Entity\Customer c');
$cust_iter = $q->iterate();
error_log('looping through query...');
$this->cust_index = [];
foreach ($cust_iter as $customer)
{
error_log('here');
$mobile = trim($customer->getPhoneMobile());
if (!empty($mobile))
{

View file

@ -166,7 +166,7 @@ class HubController extends Controller
{
$this->denyAccessUnlessGranted('hub.add', null, 'No access.');
error_log($req->request->get('time_open'));
//error_log($req->request->get('time_open'));
// create new object
$em = $this->getDoctrine()->getManager();

View file

@ -148,7 +148,6 @@ class StaticContentController extends Controller
$result = $em->getRepository(StaticContent::class)->find($id);
if ($result != null)
{
error_log($id);
$error_array['id'] = 'Duplicate ID exists.';
}
@ -226,7 +225,6 @@ class StaticContentController extends Controller
$result = $em->getRepository(StaticContent::class)->find($id);
if ($result != null)
{
error_log($id);
$error_array['id'] = 'Duplicate ID exists.';
}

View file

@ -243,7 +243,6 @@ class VehicleController extends Controller
// get current batteries of vehicle to be updated
$current_batteries = $row->getBatteries();
error_log('count of current batteries ' . count($current_batteries));
// set and save values
$row->setMake($req->request->get('make'))

View file

@ -567,7 +567,7 @@ class WarrantyController extends Controller
{
// call service to check if warranty details is incomplete and then update warranty
// using details from csv file
error_log('Updating warranty for ' . $warr->getID());
// error_log('Updating warranty for ' . $warr->getID());
$wh->updateWarranty($warr, $first_name, $last_name, $mobile_number, $batt_list, $date_purchase);
}
}
@ -582,7 +582,7 @@ class WarrantyController extends Controller
continue;
}
error_log('Creating warranty for serial ' . $serial . ' and plate number ' . $plate_number);
// error_log('Creating warranty for serial ' . $serial . ' and plate number ' . $plate_number);
$wh->createWarranty($serial, $plate_number, $first_name, $last_name, $mobile_number, $batt_list, $date_purchase, $warranty_class);
}

View file

@ -594,7 +594,7 @@ class ResqInvoiceGenerator implements InvoiceGeneratorInterface
$diesel_price = self::REFUEL_FEE_DIESEL;
$fuel = new InvoiceItem();
error_log('fuel type - ' . $ftype);
//error_log('fuel type - ' . $ftype);
switch ($ftype)
{
case FuelType::GAS:
@ -631,4 +631,77 @@ class ResqInvoiceGenerator implements InvoiceGeneratorInterface
$total['vat'] = $vat;
}
public function processCriteria(InvoiceCriteria $criteria)
{
// initialize
$invoice = new Invoice();
$total = [
'sell_price' => 0.0,
'vat' => 0.0,
'vat_ex_price' => 0.0,
'ti_rate' => 0.0,
'total_price' => 0.0,
'discount' => 0.0,
];
$stype = $criteria->getServiceType();
$cv = $criteria->getCustomerVehicle();
$has_coolant = $criteria->hasCoolant();
// error_log($stype);
switch ($stype)
{
case ServiceType::JUMPSTART_TROUBLESHOOT:
$this->processJumpstart($total, $invoice);
break;
case ServiceType::JUMPSTART_WARRANTY:
$this->processJumpstartWarranty($total, $invoice);
case ServiceType::BATTERY_REPLACEMENT_NEW:
$this->processEntries($total, $criteria, $invoice);
/*
$this->processBatteries($total, $criteria, $invoice);
$this->processTradeIns($total, $criteria, $invoice);
*/
$this->processDiscount($total, $criteria, $invoice);
break;
case ServiceType::BATTERY_REPLACEMENT_WARRANTY:
$this->processWarranty($total, $criteria, $invoice);
break;
case ServiceType::POST_RECHARGED:
$this->processRecharge($total, $invoice);
break;
case ServiceType::POST_REPLACEMENT:
$this->processReplacement($total, $invoice);
break;
case ServiceType::TIRE_REPAIR:
$this->processTireRepair($total, $invoice, $cv);
// $this->processOtherServices($total, $invoice, $stype);
break;
case ServiceType::OVERHEAT_ASSISTANCE:
$this->processOverheat($total, $invoice, $cv, $has_coolant);
break;
case ServiceType::EMERGENCY_REFUEL:
//error_log('processing refuel');
$ftype = $criteria->getCustomerVehicle()->getFuelType();
$this->processRefuel($total, $invoice, $cv);
break;
}
// TODO: check if any promo is applied
// apply discounts
$promos = $criteria->getPromos();
$invoice->setTotalPrice($total['total_price'])
->setVATExclusivePrice($total['vat_ex_price'])
->setVAT($total['vat'])
->setDiscount($total['discount'])
->setTradeIn($total['ti_rate']);
// dump
//Debug::dump($invoice, 1);
return $invoice;
}
}

View file

@ -93,7 +93,7 @@ class WarrantyHandler
public function updateCustomerVehicle($serial, $batteries, $plate_number, $date_expire)
{
// find customer vehicle using plate number
error_log('Finding customer vehicle with plate number ' . $plate_number);
// error_log('Finding customer vehicle with plate number ' . $plate_number);
$cv_q = $this->em->createQuery('select count(cv) from App\Entity\CustomerVehicle cv where cv.plate_number = :plate_number')
->setParameter('plate_number', $plate_number);
$cv_result = $cv_q->getSingleScalarResult();
@ -288,7 +288,7 @@ class WarrantyHandler
if (empty($warranty_class))
{
error_log('Warranty class is empty for warranty id ' . $warr->getID());
//error_log('Warranty class is empty for warranty id ' . $warr->getID());
return null;
}
@ -301,12 +301,12 @@ class WarrantyHandler
{
if ($batt_model == null)
{
error_log('Battery model is null for warranty id ' . $warr->getID());
//error_log('Battery model is null for warranty id ' . $warr->getID());
return null;
}
if ($batt_size == null)
{
error_log('Battery size is null for warranty id ' . $warr->getID());
//error_log('Battery size is null for warranty id ' . $warr->getID());
return null;
}