diff --git a/src/Controller/APIController.php b/src/Controller/APIController.php index 127d37f8..4c6d8932 100644 --- a/src/Controller/APIController.php +++ b/src/Controller/APIController.php @@ -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' => '', ]; diff --git a/src/Controller/CAPI/CustomerWarrantyController.php b/src/Controller/CAPI/CustomerWarrantyController.php index 96b0a43c..6ec8f88d 100644 --- a/src/Controller/CAPI/CustomerWarrantyController.php +++ b/src/Controller/CAPI/CustomerWarrantyController.php @@ -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' => '', ];