Details
-
Type: Bug
-
Status: Closed
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 5.1.0-b1
-
Component/s: None
-
Labels:None
Description
To reproduce:
- Create a regular domain package for a registrar
- Create a restricted domain package for a registrar with different TLDs in the same package group
- Create a domain order form using the package group
- Give a client access to the restricted package
- View the order form as that client
- See that the TLDs from the restricted package are not shown
To resolve change lib/order_types/domain/order_type_domain.php in getTlds():
if (!isset($this->Packages)) { Loader::loadModels($this, ['Packages']); }
To:
if (!isset($this->Packages)) { Loader::loadModels($this, ['Packages']); } if (!isset($this->Clients)) { Loader::loadModels($this, ['Clients']); } if (!isset($this->Session)) { Loader::loadComponents($this, ['Session']); }
And also in getTlds() change:
foreach ($packages[$group->package_group_id] as $package) { $package = $this->Packages->get($package->id); if ($package && $package->status == 'active' && isset($package->meta->tlds)) { foreach ($package->meta->tlds as $tld) { if (isset($tlds[$tld])) { continue; } $tlds[$tld] = [$package, $group]; } } }
To:
foreach ( $this->Clients->getRestrictedPackages($this->Session->read('blesta_client_id')) as $client_package ) { $package = $this->Packages->get($client_package->package_id); foreach ($package->groups as $package_group) { if ($package_group->id == $group->package_group_id && isset($package->meta->tlds)) { foreach ($package->meta->tlds as $tld) { if (isset($tlds[$tld])) { continue; } $tlds[$tld] = [$package, $group]; } break; } } } foreach ($packages[$group->package_group_id] as $package) { $package = $this->Packages->get($package->id); if ($package && $package->status == 'active' && isset($package->meta->tlds)) { foreach ($package->meta->tlds as $tld) { if (isset($tlds[$tld])) { continue; } $tlds[$tld] = [$package, $group]; } } }