diff --git a/src/bb-modules/Paidsupport/Service.php b/src/bb-modules/Paidsupport/Service.php index 5c1745fb7..e230a9047 100644 --- a/src/bb-modules/Paidsupport/Service.php +++ b/src/bb-modules/Paidsupport/Service.php @@ -54,8 +54,9 @@ class Service implements InjectionAwareInterface $paidSupportService = $di['mod_service']('Paidsupport'); $paidSupportService->setDi($di); - $paidSupportService->enoughInBalanceToOpenTicket($client); - + if ($paidSupportService->hasHelpdeskPaidSupport($params['support_helpdesk_id'])) { + $paidSupportService->enoughInBalanceToOpenTicket($client); + } return true; } @@ -73,6 +74,10 @@ class Service implements InjectionAwareInterface $paidSupportService = $di['mod_service']('Paidsupport'); $paidSupportService->setDi($di); + if (!$paidSupportService->hasHelpdeskPaidSupport($supportTicket->support_helpdesk_id)) { + return true; + } + $paidSupportService->enoughInBalanceToOpenTicket($client); $clientBalanceService = $di['mod_service']('Client', 'Balance'); @@ -110,6 +115,12 @@ class Service implements InjectionAwareInterface return isset($config['error_msg']) ? $config['error_msg'] : 'Configure paid support module!'; } + public function getPaidHelpdeskConfig() + { + $config = $this->di['mod_config']('Paidsupport'); + return isset($config['helpdesk']) ? $config['helpdesk'] : array(); + } + public function enoughInBalanceToOpenTicket(\Model_Client $client) { $clientBalanceService = $this->di['mod_service']('Client', 'Balance'); @@ -122,5 +133,22 @@ class Service implements InjectionAwareInterface return true; } + /** + * @param $id + * @return bool + */ + public function hasHelpdeskPaidSupport($id) + { + $helpdeskConfig = $this->getPaidHelpdeskConfig(); + + if (empty ($helpdeskConfig)) { + return true; + } + + if (isset($helpdeskConfig[$id]) && $helpdeskConfig[$id] == 1){ + return true; + } + return false; + } } \ No newline at end of file diff --git a/src/bb-modules/Paidsupport/html_admin/mod_paidsupport_settings.phtml b/src/bb-modules/Paidsupport/html_admin/mod_paidsupport_settings.phtml index 7906b7994..186d0e66d 100644 --- a/src/bb-modules/Paidsupport/html_admin/mod_paidsupport_settings.phtml +++ b/src/bb-modules/Paidsupport/html_admin/mod_paidsupport_settings.phtml @@ -35,6 +35,38 @@
+{% trans 'Paid support applied for all of them if nothing is selected' %}
+| + + + | ++ | |
| {% trans 'The list is empty' %} | +||
|
+ |
+ ||