Details
-
Type: Bug
-
Status: Closed
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 5.2.2
-
Component/s: None
-
Labels:None
Description
To reproduce:
- Install Domain Manager
- Uninstall all registrar modules
- Visit Billing > Services
- See error
PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ') AND `client_groups`.`company_id`='1' GROUP BY `services`.`id`)) AS `t_64614...' at line 1
This is caused by the following code block in app/models/services.php:
// Filter on type if (isset($filters['type']) && !is_null($filters['type'])) { // Build a list of all the registrar modules $registrar_modules = []; $modules = $this->ModuleManager->getInstalled(['type' => 'registrar']); foreach ($modules as $module) { $registrar_modules[] = $module->id; } // Filter by domains if ($filters['type'] == 'domains') { $this->Record->where('packages.module_id', 'in', $registrar_modules); } // Filter by services if ($filters['type'] == 'services') { $this->Record->where('packages.module_id', 'not in', $registrar_modules); } }
Which causes an error when $registrar_modules is empty.
A potential solution is to update to
// Filter on type if (isset($filters['type']) && !is_null($filters['type'])) { // Build a list of all the registrar modules $registrar_modules = []; $modules = $this->ModuleManager->getInstalled(['type' => 'registrar']); foreach ($modules as $module) { $registrar_modules[] = $module->id; } // Filter by domains if ($filters['type'] == 'domains') { $this->Record->where('packages.module_id', 'in', (empty($registrar_modules) ? [null] : $registrar_modules)); } // Filter by services if ($filters['type'] == 'services' && !empty($registrar_modules)) { $this->Record->where('packages.module_id', 'not in', $registrar_modules); } }
Activity
Jonathan Reissmueller
created issue -
Jonathan Reissmueller
made changes -
Field | Original Value | New Value |
---|---|---|
Rank | Ranked higher |
Jonathan Reissmueller
made changes -
Rank | Ranked higher |
Jonathan Reissmueller
made changes -
Description |
To reproduce:
* Install Domain Manager * Uninstall all registrar modules * Visit Billing > Services * See error {quote}PDOException: SQLSTATE\[42000\]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ') AND `client_groups`.`company_id`='1' GROUP BY `services`.`id`)) AS `t_64614...' at line 1{quote} This is caused by the following code block in app/models/services.php: {code:java} // Filter on type if (isset($filters['type']) && !is_null($filters['type'])) { // Build a list of all the registrar modules $registrar_modules = []; $modules = $this->ModuleManager->getInstalled(['type' => 'registrar']); foreach ($modules as $module) { $registrar_modules[] = $module->id; } // Filter by domains if ($filters['type'] == 'domains') { $this->Record->where('packages.module_id', 'in', $registrar_modules); } // Filter by services if ($filters['type'] == 'services') { $this->Record->where('packages.module_id', 'not in', $registrar_modules); } } {code} Which causes an error when $registrar_modules is empty. |
To reproduce:
* Install Domain Manager * Uninstall all registrar modules * Visit Billing > Services * See error {quote}PDOException: SQLSTATE\[42000\]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ') AND `client_groups`.`company_id`='1' GROUP BY `services`.`id`)) AS `t_64614...' at line 1{quote} This is caused by the following code block in app/models/services.php: {code:java} // Filter on type if (isset($filters['type']) && !is_null($filters['type'])) { // Build a list of all the registrar modules $registrar_modules = []; $modules = $this->ModuleManager->getInstalled(['type' => 'registrar']); foreach ($modules as $module) { $registrar_modules[] = $module->id; } // Filter by domains if ($filters['type'] == 'domains') { $this->Record->where('packages.module_id', 'in', $registrar_modules); } // Filter by services if ($filters['type'] == 'services') { $this->Record->where('packages.module_id', 'not in', $registrar_modules); } } {code} Which causes an error when $registrar_modules is empty. A potential solution is to update to {code:java} // Filter on type if (isset($filters['type']) && !is_null($filters['type'])) { // Build a list of all the registrar modules $registrar_modules = []; $modules = $this->ModuleManager->getInstalled(['type' => 'registrar']); foreach ($modules as $module) { $registrar_modules[] = $module->id; } // Filter by domains if ($filters['type'] == 'domains') { $this->Record->where('packages.module_id', 'in', (empty($registrar_modules) ? [null] : $registrar_modules)); } // Filter by services if ($filters['type'] == 'services' && !empty($registrar_modules)) { $this->Record->where('packages.module_id', 'not in', $registrar_modules); } } {code} |
Jonathan Reissmueller
made changes -
Sprint | 5.3.0 Sprint 4 [ 145 ] |
Jonathan Reissmueller
made changes -
Rank | Ranked lower |
Jonathan Reissmueller
made changes -
Assignee | Jonathan Reissmueller [ jonathan ] |
Jonathan Reissmueller
made changes -
Status | Open [ 1 ] | In Progress [ 3 ] |
Jonathan Reissmueller
made changes -
Status | In Progress [ 3 ] | In Review [ 5 ] |
Resolution | Fixed [ 1 ] |
Jonathan Reissmueller
made changes -
Remaining Estimate | 0 minutes [ 0 ] | |
Time Spent | 14 minutes [ 840 ] | |
Worklog Id | 15389 [ 15389 ] |
Abdy Franco
made changes -
Time Spent | 14 minutes [ 840 ] | 32 minutes [ 1920 ] |
Worklog Id | 15395 [ 15395 ] |
Abdy Franco
made changes -
Status | In Review [ 5 ] | Closed [ 6 ] |