diff --git a/app/Classes/Exceptions/ConnectionErrorException.php b/app/Classes/Exceptions/ConnectionErrorException.php new file mode 100644 index 00000000..52189ac8 --- /dev/null +++ b/app/Classes/Exceptions/ConnectionErrorException.php @@ -0,0 +1,20 @@ +listsHelpMenuUserAnswerSelected = $listsHelpMenuUserAnswerSelected; } + + /** + * @param int $userId + * @param int $questionId + * @param Request $request + * @return void + * @throws ResourceNotFoundException + */ public function execute($userId, $questionId, $request){ if ($request->has('isPrevious')) { //Get current and previous question's answer diff --git a/app/Classes/Modules/HelpMenu/Processors/FetchFirstQuestionQAProcessor.php b/app/Classes/Modules/HelpMenu/Processors/FetchFirstQuestionQAProcessor.php index 9f463418..c4f81f27 100644 --- a/app/Classes/Modules/HelpMenu/Processors/FetchFirstQuestionQAProcessor.php +++ b/app/Classes/Modules/HelpMenu/Processors/FetchFirstQuestionQAProcessor.php @@ -23,7 +23,7 @@ class FetchFirstQuestionQAProcessor public function execute(Request $request){ try { - $query = $this->fetchesHelpMenuQuestion->execute(['questionnaire_set_id' => 1]); + $query = $this->fetchesHelpMenuQuestion->execute(['questionnaire_set_id' => $request->route('set_id')]); return $query; } catch (\Exception $exception){ throw new ErrorException($exception->getMessage(), $exception->getCode()); diff --git a/app/Classes/Modules/HelpMenu/Processors/FetchNextQuestionQAProcessor.php b/app/Classes/Modules/HelpMenu/Processors/FetchNextQuestionQAProcessor.php index d9fc9a0a..39188cf5 100644 --- a/app/Classes/Modules/HelpMenu/Processors/FetchNextQuestionQAProcessor.php +++ b/app/Classes/Modules/HelpMenu/Processors/FetchNextQuestionQAProcessor.php @@ -38,6 +38,7 @@ class FetchNextQuestionQAProcessor $nextQuestionNumber = 0; $nextNestedQuestion = 0; $nextMainQuestion= 0; + $questionnaireSetId = 0; $currentQuestion = $request->question; $questionType = QAType::DEFAULT; $returnQuestion = null; @@ -48,7 +49,9 @@ class FetchNextQuestionQAProcessor $questionType = $currentQuestion['question_type']; $nextNestedQuestion = $currentQuestion['next_nested_question']; $nextMainQuestion = $currentQuestion['next_main_question']; + $questionnaireSetId = $currentQuestion['questionnaire_set_id']; } + if ($request->has('answerObj')) { $nextQuestionNumber = $request->answerObj['next_question_number']; } @@ -58,7 +61,7 @@ class FetchNextQuestionQAProcessor $previousAnswer = $this->listsHelpMenuUserAnswerSelected->execute(['user_id' => $userId, 'order_by' => (object)['column' => 'id','DESC' => true]])[0]; //Get previous question - $previousQuestion = $this->fetchesHelpMenuQuestion->execute(['questionnaire_set_id' => 1, 'id' => $previousAnswer['question_id']]); + $previousQuestion = $this->fetchesHelpMenuQuestion->execute(['questionnaire_set_id' => $questionnaireSetId, 'id' => $previousAnswer['question_id']]); $returnQuestion = $previousQuestion; } else{ @@ -79,11 +82,11 @@ class FetchNextQuestionQAProcessor $returnQuestion = null; } else if($question_number != 0){ - $nextQuestion = $this->fetchesHelpMenuQuestion->execute(['questionnaire_set_id' => 1, 'question_number' => $question_number]); + $nextQuestion = $this->fetchesHelpMenuQuestion->execute(['questionnaire_set_id' => $questionnaireSetId, 'question_number' => $question_number]); $returnQuestion = $nextQuestion; } else if (array_key_exists('id', $request->input('question'))) { - $nextQuestion = $this->fetchesHelpMenuQuestion->execute(['questionnaire_set_id' => 1, 'id_next' => $questionId, 'next_main_question' => null]); + $nextQuestion = $this->fetchesHelpMenuQuestion->execute(['questionnaire_set_id' => $questionnaireSetId, 'id_next' => $questionId, 'next_main_question' => null]); $returnQuestion = $nextQuestion; } } diff --git a/app/Classes/Modules/PerfexCRM/Services/ConvertsPerfexCRMLeadToCustomer.php b/app/Classes/Modules/PerfexCRM/Services/ConvertsPerfexCRMLeadToCustomer.php index 3abf292a..0e41b5a7 100644 --- a/app/Classes/Modules/PerfexCRM/Services/ConvertsPerfexCRMLeadToCustomer.php +++ b/app/Classes/Modules/PerfexCRM/Services/ConvertsPerfexCRMLeadToCustomer.php @@ -4,6 +4,7 @@ namespace App\Classes\Modules\PerfexCRM\Services; use Illuminate\Support\Facades\Http; use App\Classes\Exceptions\MalformedRequestException; +use App\Classes\Exceptions\ConnectionErrorException; use Illuminate\Support\Facades\Log; class ConvertsPerfexCRMLeadToCustomer @@ -27,8 +28,13 @@ class ConvertsPerfexCRMLeadToCustomer Log::error('ConvertsPerfexCRMLeadToCustomer: '.$response); return null; } - }catch(\Exception $exception){ - throw new MalformedRequestException('Unable to get correct response from Perfex CRM server' . $exception->getMessage()); + } + catch(\Illuminate\Http\Client\ConnectionException $exception){ + $error = 'Failed to connect to CRM'; + throw new ConnectionErrorException($error, $exception->getMessage(), $email, $exception->getTraceAsString()); + } + catch(\Exception $exception){ + throw new MalformedRequestException('Unable to get correct response from Perfex CRM server: ' . $exception->getMessage()); } } } diff --git a/app/Classes/Modules/PerfexCRM/Services/CreatesPerfexCRMCustomer.php b/app/Classes/Modules/PerfexCRM/Services/CreatesPerfexCRMCustomer.php index 289abac5..9555c61b 100644 --- a/app/Classes/Modules/PerfexCRM/Services/CreatesPerfexCRMCustomer.php +++ b/app/Classes/Modules/PerfexCRM/Services/CreatesPerfexCRMCustomer.php @@ -4,6 +4,7 @@ namespace App\Classes\Modules\PerfexCRM\Services; use Illuminate\Support\Facades\Http; use App\Classes\Exceptions\MalformedRequestException; +use App\Classes\Exceptions\ConnectionErrorException; use Illuminate\Support\Facades\Log; class CreatesPerfexCRMCustomer @@ -30,8 +31,13 @@ class CreatesPerfexCRMCustomer Log::error('CreatesPerfexCRMCustomer: '.$response); return null; } - }catch(\Exception $exception){ - throw new MalformedRequestException('Unable to get correct response from Perfex CRM server' . $exception->getMessage()); + } + catch(\Illuminate\Http\Client\ConnectionException $exception){ + $error = 'Failed to connect to CRM'; + throw new ConnectionErrorException($error, $exception->getMessage(), $companyName, $exception->getTraceAsString()); + } + catch(\Exception $exception){ + throw new MalformedRequestException('Unable to get correct response from Perfex CRM server: ' . $exception->getMessage()); } } } diff --git a/app/Classes/Modules/PerfexCRM/Services/CreatesPerfexCRMCustomerContact.php b/app/Classes/Modules/PerfexCRM/Services/CreatesPerfexCRMCustomerContact.php index 1e76a02b..1f5478eb 100644 --- a/app/Classes/Modules/PerfexCRM/Services/CreatesPerfexCRMCustomerContact.php +++ b/app/Classes/Modules/PerfexCRM/Services/CreatesPerfexCRMCustomerContact.php @@ -5,6 +5,7 @@ namespace App\Classes\Modules\PerfexCRM\Services; use App\Classes\Modules\PerfexCRM\DataTransferObjects\CustomerContactObject; use Illuminate\Support\Facades\Http; use App\Classes\Exceptions\MalformedRequestException; +use App\Classes\Exceptions\ConnectionErrorException; use Illuminate\Support\Facades\Log; class CreatesPerfexCRMCustomerContact @@ -37,8 +38,13 @@ class CreatesPerfexCRMCustomerContact Log::error('CreatesPerfexCRMCustomerContact: '.$response); return null; } - }catch(\Exception $exception){ - throw new MalformedRequestException('Unable to get correct response from Perfex CRM server' . $exception->getMessage()); + } + catch(\Illuminate\Http\Client\ConnectionException $exception){ + $error = 'Failed to connect to CRM'; + throw new ConnectionErrorException($error, $exception->getMessage(), "", $exception->getTraceAsString()); + } + catch(\Exception $exception){ + throw new MalformedRequestException('Unable to get correct response from Perfex CRM server: ' . $exception->getMessage()); } } } diff --git a/app/Classes/Modules/PerfexCRM/Services/CreatesPerfexCRMCustomerProject.php b/app/Classes/Modules/PerfexCRM/Services/CreatesPerfexCRMCustomerProject.php index 33d9c3d2..2b6fa9de 100644 --- a/app/Classes/Modules/PerfexCRM/Services/CreatesPerfexCRMCustomerProject.php +++ b/app/Classes/Modules/PerfexCRM/Services/CreatesPerfexCRMCustomerProject.php @@ -4,6 +4,7 @@ namespace App\Classes\Modules\PerfexCRM\Services; use Illuminate\Support\Facades\Http; use App\Classes\Exceptions\MalformedRequestException; +use App\Classes\Exceptions\ConnectionErrorException; use Illuminate\Support\Facades\Log; class CreatesPerfexCRMCustomerProject @@ -36,8 +37,13 @@ class CreatesPerfexCRMCustomerProject Log::error('CreatesPerfexCRMCustomerProject: '.$response); return null; } - }catch(\Exception $exception){ - throw new MalformedRequestException('Unable to get correct response from Perfex CRM server' . $exception->getMessage()); + } + catch(\Illuminate\Http\Client\ConnectionException $exception){ + $error = 'Failed to connect to CRM'; + throw new ConnectionErrorException($error, $exception->getMessage(), "", $exception->getTraceAsString()); + } + catch(\Exception $exception){ + throw new MalformedRequestException('Unable to get correct response from Perfex CRM server: ' . $exception->getMessage()); } } } diff --git a/app/Classes/Modules/PerfexCRM/Services/CreatesPerfexCRMInvoice.php b/app/Classes/Modules/PerfexCRM/Services/CreatesPerfexCRMInvoice.php index 5991025e..21de87e5 100644 --- a/app/Classes/Modules/PerfexCRM/Services/CreatesPerfexCRMInvoice.php +++ b/app/Classes/Modules/PerfexCRM/Services/CreatesPerfexCRMInvoice.php @@ -4,6 +4,7 @@ namespace App\Classes\Modules\PerfexCRM\Services; use Illuminate\Support\Facades\Http; use App\Classes\Exceptions\MalformedRequestException; +use App\Classes\Exceptions\ConnectionErrorException; use Illuminate\Support\Facades\Log; use App\Classes\Modules\PerfexCRM\DataTransferObjects\InvoicePerfexCRMObject; @@ -56,8 +57,13 @@ class CreatesPerfexCRMInvoice Log::error('CreatesPerfexCRMInvoice: '.$response); return null; } - }catch(\Exception $exception){ - throw new MalformedRequestException('Unable to get correct response from Perfex CRM server' . $exception->getMessage()); + } + catch(\Illuminate\Http\Client\ConnectionException $exception){ + $error = 'Failed to connect to CRM'; + throw new ConnectionErrorException($error, $exception->getMessage(), "", $exception->getTraceAsString()); + } + catch(\Exception $exception){ + throw new MalformedRequestException('Unable to get correct response from Perfex CRM server: ' . $exception->getMessage()); } } } diff --git a/app/Classes/Modules/PerfexCRM/Services/CreatesPerfexCRMInvoicePayment.php b/app/Classes/Modules/PerfexCRM/Services/CreatesPerfexCRMInvoicePayment.php index 05eec8b7..4e58d59f 100644 --- a/app/Classes/Modules/PerfexCRM/Services/CreatesPerfexCRMInvoicePayment.php +++ b/app/Classes/Modules/PerfexCRM/Services/CreatesPerfexCRMInvoicePayment.php @@ -4,6 +4,7 @@ namespace App\Classes\Modules\PerfexCRM\Services; use Illuminate\Support\Facades\Http; use App\Classes\Exceptions\MalformedRequestException; +use App\Classes\Exceptions\ConnectionErrorException; use Illuminate\Support\Facades\Log; use App\Classes\Modules\PerfexCRM\DataTransferObjects\InvoicePaymentPerfexCRMObject; @@ -36,8 +37,13 @@ class CreatesPerfexCRMInvoicePayment Log::error('CreatesPerfexCRMInvoicePayment: '.$response); return null; } - }catch(\Exception $exception){ - throw new MalformedRequestException('Unable to get correct response from Perfex CRM server' . $exception->getMessage()); + } + catch(\Illuminate\Http\Client\ConnectionException $exception){ + $error = 'Failed to connect to CRM'; + throw new ConnectionErrorException($error, $exception->getMessage(), "", $exception->getTraceAsString()); + } + catch(\Exception $exception){ + throw new MalformedRequestException('Unable to get correct response from Perfex CRM server: ' . $exception->getMessage()); } } } diff --git a/app/Classes/Modules/PerfexCRM/Services/CreatesPerfexCRMLead.php b/app/Classes/Modules/PerfexCRM/Services/CreatesPerfexCRMLead.php index ea7b7917..b2ac9c23 100644 --- a/app/Classes/Modules/PerfexCRM/Services/CreatesPerfexCRMLead.php +++ b/app/Classes/Modules/PerfexCRM/Services/CreatesPerfexCRMLead.php @@ -4,6 +4,7 @@ namespace App\Classes\Modules\PerfexCRM\Services; use Illuminate\Support\Facades\Http; use App\Classes\Exceptions\MalformedRequestException; +use App\Classes\Exceptions\ConnectionErrorException; use Illuminate\Support\Facades\Log; use App\Classes\Modules\PerfexCRM\DataTransferObjects\CreateLeadPerfexCRMObject; @@ -43,8 +44,13 @@ class CreatesPerfexCRMLead Log::error('CreatesPerfexCRMLead: '.$response); return null; } - }catch(\Exception $exception){ - throw new MalformedRequestException('Unable to get correct response from Perfex CRM server ' . $exception->getMessage()); + } + catch(\Illuminate\Http\Client\ConnectionException $exception){ + $error = 'Failed to connect to CRM'; + throw new ConnectionErrorException($error, $exception->getMessage(), "", $exception->getTraceAsString()); + } + catch(\Exception $exception){ + throw new MalformedRequestException('Unable to get correct response from Perfex CRM server: ' . $exception->getMessage()); } } } diff --git a/app/Classes/Modules/PerfexCRM/Services/CreatesPerfexCRMMilestone.php b/app/Classes/Modules/PerfexCRM/Services/CreatesPerfexCRMMilestone.php index 27bdf44e..37342882 100644 --- a/app/Classes/Modules/PerfexCRM/Services/CreatesPerfexCRMMilestone.php +++ b/app/Classes/Modules/PerfexCRM/Services/CreatesPerfexCRMMilestone.php @@ -4,6 +4,7 @@ namespace App\Classes\Modules\PerfexCRM\Services; use Illuminate\Support\Facades\Http; use App\Classes\Exceptions\MalformedRequestException; +use App\Classes\Exceptions\ConnectionErrorException; use Illuminate\Support\Facades\Log; class CreatesPerfexCRMMilestone @@ -39,8 +40,13 @@ class CreatesPerfexCRMMilestone Log::error('CreatesPerfexCRMMilestone: '.$response); return null; } - }catch(\Exception $exception){ - throw new MalformedRequestException('Unable to get correct response from Perfex CRM server' . $exception->getMessage()); + } + catch(\Illuminate\Http\Client\ConnectionException $exception){ + $error = 'Failed to connect to CRM'; + throw new ConnectionErrorException($error, $exception->getMessage(), "", $exception->getTraceAsString()); + } + catch(\Exception $exception){ + throw new MalformedRequestException('Unable to get correct response from Perfex CRM server: ' . $exception->getMessage()); } } } diff --git a/app/Classes/Modules/PerfexCRM/Services/CreatesPerfexCRMSupportTicket.php b/app/Classes/Modules/PerfexCRM/Services/CreatesPerfexCRMSupportTicket.php index 48058509..b15f09c1 100644 --- a/app/Classes/Modules/PerfexCRM/Services/CreatesPerfexCRMSupportTicket.php +++ b/app/Classes/Modules/PerfexCRM/Services/CreatesPerfexCRMSupportTicket.php @@ -4,6 +4,7 @@ namespace App\Classes\Modules\PerfexCRM\Services; use Illuminate\Support\Facades\Http; use App\Classes\Exceptions\MalformedRequestException; +use App\Classes\Exceptions\ConnectionErrorException; use Illuminate\Support\Facades\Log; class CreatesPerfexCRMSupportTicket @@ -36,9 +37,15 @@ class CreatesPerfexCRMSupportTicket Log::error($response); return null; } - }catch(\Exception $exception){ - $error = 'Support Ticket creation failed: ' . $exception->getMessage(); - Log::error($error.'\nPayload to create ticket: '.json_encode($data)); + } + catch(\Illuminate\Http\Client\ConnectionException $exception){ + $error = 'Failed to connect to CRM'; + throw new ConnectionErrorException($error, $exception->getMessage(), "", $exception->getTraceAsString()); + } + catch(\Exception $exception){ + $error = 'Support Ticket creation failed'; + Log::error($error. ": ". $exception->getMessage()); + Log::error('Payload: '.json_encode($data)); throw new MalformedRequestException($error); } } diff --git a/app/Classes/Modules/PerfexCRM/Services/CreatesPerfexCRMTask.php b/app/Classes/Modules/PerfexCRM/Services/CreatesPerfexCRMTask.php index 4c89a3db..1d04ce5e 100644 --- a/app/Classes/Modules/PerfexCRM/Services/CreatesPerfexCRMTask.php +++ b/app/Classes/Modules/PerfexCRM/Services/CreatesPerfexCRMTask.php @@ -4,6 +4,7 @@ namespace App\Classes\Modules\PerfexCRM\Services; use Illuminate\Support\Facades\Http; use App\Classes\Exceptions\MalformedRequestException; +use App\Classes\Exceptions\ConnectionErrorException; use Illuminate\Support\Facades\Log; use App\Classes\ValueObjects\Constants\PerfexCRMCustomFields; use App\Classes\Modules\PerfexCRM\DataTransferObjects\CreateTaskPerfexCRMObject; @@ -60,8 +61,13 @@ class CreatesPerfexCRMTask Log::error('CreatesPerfexCRMTask: '.$response); return null; } - }catch(\Exception $exception){ - throw new MalformedRequestException('Unable to get correct response from Perfex CRM server' . $exception->getMessage()); + } + catch(\Illuminate\Http\Client\ConnectionException $exception){ + $error = 'Failed to connect to CRM'; + throw new ConnectionErrorException($error, $exception->getMessage(), "", $exception->getTraceAsString()); + } + catch(\Exception $exception){ + throw new MalformedRequestException('Unable to get correct response from Perfex CRM server: ' . $exception->getMessage()); } } } diff --git a/app/Classes/Modules/PerfexCRM/Services/FetchesPerfexCRMCustomer.php b/app/Classes/Modules/PerfexCRM/Services/FetchesPerfexCRMCustomer.php index dd5acff1..decc51bc 100644 --- a/app/Classes/Modules/PerfexCRM/Services/FetchesPerfexCRMCustomer.php +++ b/app/Classes/Modules/PerfexCRM/Services/FetchesPerfexCRMCustomer.php @@ -4,6 +4,7 @@ namespace App\Classes\Modules\PerfexCRM\Services; use Illuminate\Support\Facades\Http; use App\Classes\Exceptions\MalformedRequestException; +use App\Classes\Exceptions\ConnectionErrorException; use Illuminate\Support\Facades\Log; class FetchesPerfexCRMCustomer @@ -27,8 +28,15 @@ class FetchesPerfexCRMCustomer Log::error('FetchesPerfexCRMCustomer: '.$response); return null; } - }catch(\Exception $exception){ - throw new MalformedRequestException('Unable to get correct response from Perfex CRM server: ' . $exception->getMessage()); + } + catch(\Illuminate\Http\Client\ConnectionException $exception){ + $error = 'Failed to connect to CRM'; + throw new ConnectionErrorException($error, $exception->getMessage(), $email, $exception->getTraceAsString()); + } + catch(\Exception $exception){ + $error = 'Unable to get correct response from Perfex CRM server: ' . $exception->getMessage(); + Log::error($error); + throw new MalformedRequestException($error); } } } diff --git a/app/Classes/Modules/PerfexCRM/Services/FetchesPerfexCRMInvoice.php b/app/Classes/Modules/PerfexCRM/Services/FetchesPerfexCRMInvoice.php index 3d4f9222..9104a3a9 100644 --- a/app/Classes/Modules/PerfexCRM/Services/FetchesPerfexCRMInvoice.php +++ b/app/Classes/Modules/PerfexCRM/Services/FetchesPerfexCRMInvoice.php @@ -4,6 +4,7 @@ namespace App\Classes\Modules\PerfexCRM\Services; use Illuminate\Support\Facades\Http; use App\Classes\Exceptions\MalformedRequestException; +use App\Classes\Exceptions\ConnectionErrorException; use Illuminate\Support\Facades\Log; class FetchesPerfexCRMInvoice @@ -29,7 +30,12 @@ class FetchesPerfexCRMInvoice Log::error('FetchesPerfexCRMInvoice: '.$response); return null; } - }catch(\Exception $exception){ + } + catch(\Illuminate\Http\Client\ConnectionException $exception){ + $error = 'Failed to connect to CRM'; + throw new ConnectionErrorException($error, $exception->getMessage(), "", $exception->getTraceAsString()); + } + catch(\Exception $exception){ throw new MalformedRequestException('Unable to get correct response from Perfex CRM server: ' . $exception->getMessage()); } } diff --git a/app/Classes/Modules/PerfexCRM/Services/FetchesPerfexCRMLead.php b/app/Classes/Modules/PerfexCRM/Services/FetchesPerfexCRMLead.php index 773b602c..09f1af6e 100644 --- a/app/Classes/Modules/PerfexCRM/Services/FetchesPerfexCRMLead.php +++ b/app/Classes/Modules/PerfexCRM/Services/FetchesPerfexCRMLead.php @@ -4,6 +4,7 @@ namespace App\Classes\Modules\PerfexCRM\Services; use Illuminate\Support\Facades\Http; use App\Classes\Exceptions\MalformedRequestException; +use App\Classes\Exceptions\ConnectionErrorException; use Illuminate\Support\Facades\Log; class FetchesPerfexCRMLead @@ -27,7 +28,12 @@ class FetchesPerfexCRMLead Log::error('FetchesPerfexCRMLead: '.$response); return null; } - }catch(\Exception $exception){ + } + catch(\Illuminate\Http\Client\ConnectionException $exception){ + $error = 'Failed to connect to CRM'; + throw new ConnectionErrorException($error, $exception->getMessage(), $email, $exception->getTraceAsString()); + } + catch(\Exception $exception){ throw new MalformedRequestException('Unable to get correct response from Perfex CRM server: ' . $exception->getMessage()); } } diff --git a/app/Classes/Modules/PerfexCRM/Services/FetchesPerfexCRMMilestone.php b/app/Classes/Modules/PerfexCRM/Services/FetchesPerfexCRMMilestone.php index 6d2ab27f..77433f6e 100644 --- a/app/Classes/Modules/PerfexCRM/Services/FetchesPerfexCRMMilestone.php +++ b/app/Classes/Modules/PerfexCRM/Services/FetchesPerfexCRMMilestone.php @@ -4,6 +4,7 @@ namespace App\Classes\Modules\PerfexCRM\Services; use Illuminate\Support\Facades\Http; use App\Classes\Exceptions\MalformedRequestException; +use App\Classes\Exceptions\ConnectionErrorException; use Illuminate\Support\Facades\Log; class FetchesPerfexCRMMilestone @@ -33,8 +34,13 @@ class FetchesPerfexCRMMilestone Log::error('FetchesPerfexCRMMilestone: '.$response); return null; } - }catch(\Exception $exception){ - throw new MalformedRequestException('Unable to get correct response from Perfex CRM server' . $exception->getMessage()); + } + catch(\Illuminate\Http\Client\ConnectionException $exception){ + $error = 'Failed to connect to CRM'; + throw new ConnectionErrorException($error, $exception->getMessage(), "", $exception->getTraceAsString()); + } + catch(\Exception $exception){ + throw new MalformedRequestException('Unable to get correct response from Perfex CRM server: ' . $exception->getMessage()); } } } diff --git a/app/Classes/Modules/PerfexCRM/Services/FetchesPerfexCRMProject.php b/app/Classes/Modules/PerfexCRM/Services/FetchesPerfexCRMProject.php index 94797363..a6f43b7e 100644 --- a/app/Classes/Modules/PerfexCRM/Services/FetchesPerfexCRMProject.php +++ b/app/Classes/Modules/PerfexCRM/Services/FetchesPerfexCRMProject.php @@ -4,6 +4,7 @@ namespace App\Classes\Modules\PerfexCRM\Services; use Illuminate\Support\Facades\Http; use App\Classes\Exceptions\MalformedRequestException; +use App\Classes\Exceptions\ConnectionErrorException; use Illuminate\Support\Facades\Log; class FetchesPerfexCRMProject @@ -33,8 +34,13 @@ class FetchesPerfexCRMProject Log::error('FetchesPerfexCRMProject: '.$response); return null; } - }catch(\Exception $exception){ - throw new MalformedRequestException('Unable to get correct response from Perfex CRM server' . $exception->getMessage()); + } + catch(\Illuminate\Http\Client\ConnectionException $exception){ + $error = 'Failed to connect to CRM'; + throw new ConnectionErrorException($error, $exception->getMessage(), "", $exception->getTraceAsString()); + } + catch(\Exception $exception){ + throw new MalformedRequestException('Unable to get correct response from Perfex CRM server: ' . $exception->getMessage()); } } } diff --git a/app/Classes/Modules/PerfexCRM/Services/FetchesPerfexCRMTask.php b/app/Classes/Modules/PerfexCRM/Services/FetchesPerfexCRMTask.php index 6cd4f052..a83eb112 100644 --- a/app/Classes/Modules/PerfexCRM/Services/FetchesPerfexCRMTask.php +++ b/app/Classes/Modules/PerfexCRM/Services/FetchesPerfexCRMTask.php @@ -4,6 +4,7 @@ namespace App\Classes\Modules\PerfexCRM\Services; use Illuminate\Support\Facades\Http; use App\Classes\Exceptions\MalformedRequestException; +use App\Classes\Exceptions\ConnectionErrorException; use Illuminate\Support\Facades\Log; use App\Classes\General\Helper; @@ -47,8 +48,13 @@ class FetchesPerfexCRMTask Helper::debugLogger($response); return null; } - }catch(\Exception $exception){ - throw new MalformedRequestException('Unable to get correct response from Perfex CRM server' . $exception->getMessage()); + } + catch(\Illuminate\Http\Client\ConnectionException $exception){ + $error = 'Failed to connect to CRM'; + throw new ConnectionErrorException($error, $exception->getMessage(), "", $exception->getTraceAsString()); + } + catch(\Exception $exception){ + throw new MalformedRequestException('Unable to get correct response from Perfex CRM server: ' . $exception->getMessage()); } } } diff --git a/app/Classes/Modules/PerfexCRM/Services/UpdatesPerfexCRMCustomer.php b/app/Classes/Modules/PerfexCRM/Services/UpdatesPerfexCRMCustomer.php index 74706e49..193155e3 100644 --- a/app/Classes/Modules/PerfexCRM/Services/UpdatesPerfexCRMCustomer.php +++ b/app/Classes/Modules/PerfexCRM/Services/UpdatesPerfexCRMCustomer.php @@ -4,6 +4,7 @@ namespace App\Classes\Modules\PerfexCRM\Services; use Illuminate\Support\Facades\Http; use App\Classes\Exceptions\MalformedRequestException; +use App\Classes\Exceptions\ConnectionErrorException; use Illuminate\Support\Facades\Log; use App\Classes\ValueObjects\Constants\PerfexCRMCustomFields; use App\Classes\General\Helper; @@ -41,8 +42,13 @@ class UpdatesPerfexCRMCustomer // Helper::debugLogger($response); return null; } - }catch(\Exception $exception){ - throw new MalformedRequestException('Unable to get correct response from Perfex CRM server' . $exception->getMessage()); + } + catch(\Illuminate\Http\Client\ConnectionException $exception){ + $error = 'Failed to connect to CRM'; + throw new ConnectionErrorException($error, $exception->getMessage(), "", $exception->getTraceAsString()); + } + catch(\Exception $exception){ + throw new MalformedRequestException('Unable to get correct response from Perfex CRM server: ' . $exception->getMessage()); } } } diff --git a/app/Classes/Modules/PerfexCRM/Services/UpdatesPerfexCRMInvoice.php b/app/Classes/Modules/PerfexCRM/Services/UpdatesPerfexCRMInvoice.php index d7a467c1..5f21cd32 100644 --- a/app/Classes/Modules/PerfexCRM/Services/UpdatesPerfexCRMInvoice.php +++ b/app/Classes/Modules/PerfexCRM/Services/UpdatesPerfexCRMInvoice.php @@ -4,6 +4,7 @@ namespace App\Classes\Modules\PerfexCRM\Services; use Illuminate\Support\Facades\Http; use App\Classes\Exceptions\MalformedRequestException; +use App\Classes\Exceptions\ConnectionErrorException; use Illuminate\Support\Facades\Log; class UpdatesPerfexCRMInvoice @@ -63,7 +64,12 @@ class UpdatesPerfexCRMInvoice Log::error('UpdatesPerfexCRMInvoice: '.$response); return null; } - }catch(\Exception $exception){ + } + catch(\Illuminate\Http\Client\ConnectionException $exception){ + $error = 'Failed to connect to CRM'; + throw new ConnectionErrorException($error, $exception->getMessage(), "", $exception->getTraceAsString()); + } + catch(\Exception $exception){ throw new MalformedRequestException('Unable to get correct response from Perfex CRM server: ' . $exception->getMessage()); } } diff --git a/app/Classes/Modules/PerfexCRM/Services/UpdatesPerfexCRMLead.php b/app/Classes/Modules/PerfexCRM/Services/UpdatesPerfexCRMLead.php index 0e992c32..6ac332f7 100644 --- a/app/Classes/Modules/PerfexCRM/Services/UpdatesPerfexCRMLead.php +++ b/app/Classes/Modules/PerfexCRM/Services/UpdatesPerfexCRMLead.php @@ -4,6 +4,7 @@ namespace App\Classes\Modules\PerfexCRM\Services; use Illuminate\Support\Facades\Http; use App\Classes\Exceptions\MalformedRequestException; +use App\Classes\Exceptions\ConnectionErrorException; use Illuminate\Support\Facades\Log; use App\Classes\ValueObjects\Constants\PerfexCRMCustomFields; @@ -44,7 +45,12 @@ class UpdatesPerfexCRMLead Log::error('UpdatesPerfexCRMLead: '.$response); return null; } - }catch(\Exception $exception){ + } + catch(\Illuminate\Http\Client\ConnectionException $exception){ + $error = 'Failed to connect to CRM'; + throw new ConnectionErrorException($error, $exception->getMessage(), "", $exception->getTraceAsString()); + } + catch(\Exception $exception){ throw new MalformedRequestException('Unable to get correct response from Perfex CRM server: ' . $exception->getMessage()); } } diff --git a/app/Classes/Modules/PerfexCRM/Services/UpdatesPerfexCRMProject.php b/app/Classes/Modules/PerfexCRM/Services/UpdatesPerfexCRMProject.php index 535f128b..9dceba4c 100644 --- a/app/Classes/Modules/PerfexCRM/Services/UpdatesPerfexCRMProject.php +++ b/app/Classes/Modules/PerfexCRM/Services/UpdatesPerfexCRMProject.php @@ -4,6 +4,7 @@ namespace App\Classes\Modules\PerfexCRM\Services; use Illuminate\Support\Facades\Http; use App\Classes\Exceptions\MalformedRequestException; +use App\Classes\Exceptions\ConnectionErrorException; use Illuminate\Support\Facades\Log; class UpdatesPerfexCRMProject @@ -36,7 +37,12 @@ class UpdatesPerfexCRMProject Log::error('UpdatesPerfexCRMProject: '.$response); return null; } - }catch(\Exception $exception){ + } + catch(\Illuminate\Http\Client\ConnectionException $exception){ + $error = 'Failed to connect to CRM'; + throw new ConnectionErrorException($error, $exception->getMessage(), "", $exception->getTraceAsString()); + } + catch(\Exception $exception){ throw new MalformedRequestException('Unable to get correct response from Perfex CRM server: ' . $exception->getMessage()); } } diff --git a/app/Classes/Modules/PerfexCRM/Services/UpdatesPerfexCRMTask.php b/app/Classes/Modules/PerfexCRM/Services/UpdatesPerfexCRMTask.php index 1c9f047b..1ece3431 100644 --- a/app/Classes/Modules/PerfexCRM/Services/UpdatesPerfexCRMTask.php +++ b/app/Classes/Modules/PerfexCRM/Services/UpdatesPerfexCRMTask.php @@ -4,6 +4,7 @@ namespace App\Classes\Modules\PerfexCRM\Services; use Illuminate\Support\Facades\Http; use App\Classes\Exceptions\MalformedRequestException; +use App\Classes\Exceptions\ConnectionErrorException; use Illuminate\Support\Facades\Log; class UpdatesPerfexCRMTask @@ -41,8 +42,13 @@ class UpdatesPerfexCRMTask Log::error('UpdatesPerfexCRMTask: '.$response); return null; } - }catch(\Exception $exception){ - throw new MalformedRequestException('Unable to get correct response from Perfex CRM server' . $exception->getMessage()); + } + catch(\Illuminate\Http\Client\ConnectionException $exception){ + $error = 'Failed to connect to CRM'; + throw new ConnectionErrorException($error, $exception->getMessage(), "", $exception->getTraceAsString()); + } + catch(\Exception $exception){ + throw new MalformedRequestException('Unable to get correct response from Perfex CRM server: ' . $exception->getMessage()); } } } diff --git a/resources/assets/vue/components/general/elements/HelpMenuComponent.vue b/resources/assets/vue/components/general/elements/HelpMenuComponent.vue new file mode 100644 index 00000000..2f1a6e34 --- /dev/null +++ b/resources/assets/vue/components/general/elements/HelpMenuComponent.vue @@ -0,0 +1,68 @@ + + + + + diff --git a/resources/assets/vue/components/general/forms/HelpMenuFormComponent.vue b/resources/assets/vue/components/general/forms/HelpMenuFormComponent.vue index 7ad96fdf..423e1765 100644 --- a/resources/assets/vue/components/general/forms/HelpMenuFormComponent.vue +++ b/resources/assets/vue/components/general/forms/HelpMenuFormComponent.vue @@ -77,16 +77,6 @@