Squidix Web Hosting Posted July 10, 2015 Report Posted July 10, 2015 This is necessary in a couple of cases: When a client wants to migrate over an old cpanel account - current one must be terminated before migration, but service must remain active. When a client wants an account recreated from scratch. Both of these happens on a regular basis for us. Quote
PauloV Posted July 10, 2015 Report Posted July 10, 2015 +1 This is easy, only needs a new TAB on Admin Module called for exemple "Commands" and add all commands to manually execute like: Terminate Create Suspend Unsuspend etc.. Quote
Squidix Web Hosting Posted July 10, 2015 Author Report Posted July 10, 2015 +1 This is easy, only needs a new TAB on Admin Module called for exemple "Commands" and add all commands to manually execute like: Terminate Create Suspend Unsuspend etc.. Yes, a more generic "command" capability completely detached from Blesta (simply passing commands straight to the module) would be ideal. Quote
Paul Posted July 10, 2015 Report Posted July 10, 2015 We are going to improve the staff service management page, likely breaking it up into additional tabs as the default "Basic Options" tab has too much going on with it from features added since 3.0. An "Advanced" tab or similar may be beneficial for these kinds of actions, and possibly some other options not currently available. Michael 1 Quote
Squidix Web Hosting Posted July 10, 2015 Author Report Posted July 10, 2015 We are going to improve the staff service management page, likely breaking it up into additional tabs as the default "Basic Options" tab has too much going on with it from features added since 3.0. An "Advanced" tab or similar may be beneficial for these kinds of actions, and possibly some other options not currently available. I wouldn't necessarily go that far, all I need is the ability to run the basic module commands in the basic options tab without messing with blesta data. You have abstract methods for all of this on the Module class. A simple passthrough without the extra logic in the service layer would do the trick. No actual new code, I would think. Strip the extra logic out of the Services model class and it's done. For example termination would just be (roughly) line 1470-1487 of the Services class, plus validation and logging (both already there). Quote
Squidix Web Hosting Posted July 13, 2015 Author Report Posted July 13, 2015 Termination would go something like this. COMPLETELY UNTESTED. DO NOT TRY AT HOME. ./app/models/services.php - add this method + /** + * Terminates a service. + * + * @param int $service_id The ID of the service to terminate. + */ + public function terminate($service_id, array $vars = array()) { + + extract($this->getRelations($service_id)); + + // Terminate the service. + + if (!isset($this->ModuleManager)) + Loader::loadModels($this, array("ModuleManager")); + + $module_data = $this->getModuleClassByPricingId($service->pricing_id); + + if ($module_data) { + $module = $this->ModuleManager->initModule($module_data->id, Configure::get("Blesta.company_id")); + + if ($module) { + // Set the module row used for this service + $module->setModuleRow($module->getModuleRow($service->module_row_id)); + + $service_info = $module->cancelService($package, $service, $parent_package, $parent_service); + + if (($errors = $module->errors())) { + $this->Input->setErrors($errors); + return; + } + + } + + } + + } Replace in getActions method: public function getActions($current_status = null) { $actions = array( + 'terminate' => $this->_("Services.getActions.terminate"), 'suspend' => $this->_("Services.getActions.suspend"), 'unsuspend' => $this->_("Services.getActions.unsuspend"), 'cancel' => $this->_("Services.getActions.cancel"), ./app/controllers/admin_clients.php switch ($this->post['section']) { case "action": switch ($this->post['action']) { + case "terminate": + $this->Services->terminate($service->id, $this->post); + break; case "suspend": $this->Services->suspend($service->id, $this->post); break; ./clients/language/en_us/services.php +$lang['Services.getActions.terminate'] = "Terminate"; $lang['Services.getActions.suspend'] = "Suspend"; $lang['Services.getActions.unsuspend'] = "Unsuspend"; $lang['Services.getActions.cancel'] = "Cancel"; Quote
Paul Posted September 22, 2015 Report Posted September 22, 2015 I have amended https://dev.blesta.com/browse/CORE-1808 which allows the re-provision of services through the module. This task now mentions the possibility of a new tab for performing the 4 types of module actions (create, cancel, suspend, unsuspend). The new tab seems to be more inclusive by supporting all of the standard module actions. Requires some more discussion internally, but this task may be updated/changed to fully support that idea. Quote
Blesta Addons Posted September 22, 2015 Report Posted September 22, 2015 that is a good addition , but the Sam Barrow method is not safe in same cases . but it can be done just via the module itself . Michael 1 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.