diff --git a/src/Controller/APIController.php b/src/Controller/APIController.php index 4510fbf8..3965c4f2 100644 --- a/src/Controller/APIController.php +++ b/src/Controller/APIController.php @@ -1890,17 +1890,12 @@ class APIController extends Controller return $res->getReturnResponse(); } - // get first entry - $warranty = current($warranty_results); - if ($warranty->isActivated()) + // activate all entries + foreach ($warranty_results as $warranty) { - $res->setError(true) - ->setErrorMessage('Warranty already activated'); - return $res->getReturnResponse(); + $warranty->setActivated(); } - $warranty->setActivated(); - $em->flush(); return $res->getReturnResponse();