|
|
@@ -113,24 +113,50 @@ class OrganizationFactory
|
|
|
throw $e;
|
|
|
}
|
|
|
|
|
|
+ $withError = false;
|
|
|
+
|
|
|
// Création de la société Dolibarr
|
|
|
- $dolibarrId = $this->dolibarrApiService->createSociety(
|
|
|
- $organization,
|
|
|
- $organizationCreationRequest->isClient()
|
|
|
- );
|
|
|
- $this->logger->info("New dolibarr structure created (uid : " . $dolibarrId . ")");
|
|
|
+ try {
|
|
|
+ $dolibarrId = $this->dolibarrApiService->createSociety(
|
|
|
+ $organization,
|
|
|
+ $organizationCreationRequest->isClient()
|
|
|
+ );
|
|
|
+ $this->logger->info("New dolibarr structure created (uid : " . $dolibarrId . ")");
|
|
|
+ } catch (\Exception $e) {
|
|
|
+ $this->logger->critical("An error happened while creating the dolibarr society, please proceed manually.");
|
|
|
+ $this->logger->debug($e);
|
|
|
+ $withError = true;
|
|
|
+ }
|
|
|
|
|
|
// Register the subdomain into the BindFile (takes up to 5min to take effect)
|
|
|
- $this->bindFileService->registerSubdomain($organizationCreationRequest->getSubdomain());
|
|
|
- $this->logger->info("Subdomain registered");
|
|
|
-
|
|
|
+ try {
|
|
|
+ $this->bindFileService->registerSubdomain($organizationCreationRequest->getSubdomain());
|
|
|
+ $this->logger->info("Subdomain registered");
|
|
|
+ } catch (\Exception $e) {
|
|
|
+ $this->logger->critical("An error happened while updating the bind file, please proceed manually.");
|
|
|
+ $this->logger->debug($e);
|
|
|
+ $withError = true;
|
|
|
+ }
|
|
|
// Création du site typo3 (on est obligé d'attendre que l'organisation soit persistée en base)
|
|
|
if ($organizationCreationRequest->getCreateWebsite()) {
|
|
|
- $this->createTypo3Website($organization);
|
|
|
+ try {
|
|
|
+ $this->createTypo3Website($organization);
|
|
|
+ } catch (\Exception $e) {
|
|
|
+ $this->logger->critical("An error happened while creating the typo3 website, please proceed manually.");
|
|
|
+ $this->logger->debug($e);
|
|
|
+ $withError = true;
|
|
|
+ }
|
|
|
} else {
|
|
|
$this->logger->warning("Typo3 website creation was not required");
|
|
|
}
|
|
|
|
|
|
+ if ($withError) {
|
|
|
+ $organizationCreationRequest->setStatus(OrganizationCreationRequest::STATUS_OK_WITH_ERRORS);
|
|
|
+ $this->logger->warning("-- Operation ended with errors, check the logs for more information --");
|
|
|
+ } else {
|
|
|
+ $organizationCreationRequest->setStatus(OrganizationCreationRequest::STATUS_OK);
|
|
|
+ }
|
|
|
+
|
|
|
return $organization;
|
|
|
}
|
|
|
|