Display category name if sku is null. #560
This commit is contained in:
parent
292aae5fa9
commit
317fd0fdf3
2 changed files with 20 additions and 6 deletions
|
|
@ -2996,8 +2996,8 @@ class APIController extends Controller implements LoggedController
|
|||
'date_purchase' => $date_purchase_cust,
|
||||
'invoice' => $invoice_url,
|
||||
'warr_card' => $warr_card_url,
|
||||
'dealer_name' => $warr->getDealerName() ?? '',
|
||||
'dealer_address' => $warr->getDealerAddress() ?? '',
|
||||
'dealer_name' => $warr->getDealerName() ?? '',
|
||||
'dealer_address' => $warr->getDealerAddress() ?? '',
|
||||
];
|
||||
}
|
||||
else
|
||||
|
|
@ -3017,8 +3017,8 @@ class APIController extends Controller implements LoggedController
|
|||
'date_purchase' => $today->format('Y-m-d'),
|
||||
'invoice' => '',
|
||||
'warr_card' => '',
|
||||
'dealer_name' => '',
|
||||
'dealer_address' => '',
|
||||
'dealer_name' => '',
|
||||
'dealer_address' => '',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -3046,8 +3046,15 @@ class APIController extends Controller implements LoggedController
|
|||
|
||||
$sku = $warr_serial->getSKU();
|
||||
$batt = null;
|
||||
$cat_name = '';
|
||||
if ($sku != null)
|
||||
$batt = $em->getRepository(SAPBattery::class)->find($sku);
|
||||
else
|
||||
{
|
||||
// get the category name of the serial
|
||||
$cat_name = $warr_serial->getMetaInfo('category_name');
|
||||
error_log($cat_name);
|
||||
}
|
||||
|
||||
// TODO: put this in a config file
|
||||
$image_url = $req->getSchemeAndHttpHost() . '/battery/generic.png';
|
||||
|
|
@ -3062,7 +3069,7 @@ class APIController extends Controller implements LoggedController
|
|||
else
|
||||
{
|
||||
$battery = [
|
||||
'brand' => '',
|
||||
'brand' => $cat_name,
|
||||
'size' => '',
|
||||
'image_url' => '',
|
||||
];
|
||||
|
|
|
|||
|
|
@ -253,8 +253,15 @@ class CustomerWarrantyController extends APIController
|
|||
$sku = $warr_serial->getSKU();
|
||||
// check if sku is null
|
||||
$batt = null;
|
||||
$cat_name = '';
|
||||
if ($sku != null)
|
||||
$batt = $em->getRepository(SAPBattery::class)->find($sku);
|
||||
else
|
||||
{
|
||||
// get the category name of the serial
|
||||
$cat_name = $warr_serial->getMetaInfo('category_name');
|
||||
}
|
||||
|
||||
|
||||
// TODO: put this in a config file
|
||||
$image_url = $req->getSchemeAndHttpHost() . '/battery/generic.png';
|
||||
|
|
@ -269,7 +276,7 @@ class CustomerWarrantyController extends APIController
|
|||
else
|
||||
{
|
||||
$battery = [
|
||||
'brand' => '',
|
||||
'brand' => $cat_name,
|
||||
'size' => '',
|
||||
'image_url' => '',
|
||||
];
|
||||
|
|
|
|||
Loading…
Reference in a new issue