Jump to content

Squidix Web Hosting

Members
  • Posts

    109
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by Squidix Web Hosting

  1. You don't need to make a template. I modified about 3 classes and one DB column.
  2. It's dead simple, just a copy of unsuspend/suspend but with a dif api function and the plan as an argument. public function changeServicePackage($package_from, $package_to, $service, $parent_package=null, $parent_service=null) { if (($row = $this->getModuleRow())) { $api = $this->getApi($row->meta->user_id, $row->meta->key, $row->meta->host, $row->meta->port); $api->loadCommand("solusvm_vserver"); $service_fields = $this->serviceFieldsToObject($service->fields); // Attempt to change the virtual server plan try { // Load up the Virtual Server API $vserver_api = new SolusvmVserver($api); $params = array('vserverid' => $service_fields->solusvm_vserver_id, 'plan' => $package_to->meta->plan); // Change the Virtual Server Plan $this->log($row->meta->host . "|vserver-change", serialize($params), "input", true); $response = $this->parseResponse($vserver_api->change($params), $row); } catch (Exception $e) { // Internal Error $this->Input->setErrors(array('api' => array('internal' => Language::_("Solusvm.!error.api.internal", true)))); return; } } return null; }
  3. I've already implemented this in my instance, just wanted to post here to see if any interest in merging it in. Demo - softfiber.com/vps?coupon=dollar
  4. Okay I've implemented this. Tested and working. Do you all want the code?
  5. Wait, so is this just not implemented? Solusvm class: public function changeServicePackage($package_from, $package_to, $service, $parent_package=null, $parent_service=null) { // Nothing to do return null; }
  6. Here, I've fixed it: Starting at line 305 in package model. However this is not ideal, as it won't retain ordering if a group is added (even if old groups are kept) What should be done is - empty the group/package relationship table (excluding the ids of groups in the array from the submitted form), then do an array diff on the group ids, and add the new groups. that way the old relationship records are kept instead of blanked every time. since the ordering appears to be in the table for the many to many relationship between groups and packages. I'll try to implement when I have some time but keep in mind I have been working with the internal code for all of 2 days now so I am not very familiar. $group_ids = array(); foreach ($package->groups as $group) { $group_ids[] = $group->id; } // Replace all group assignments with those that are given (if any given) if (isset($vars['groups']) && $vars['groups'] != $group_ids) $this->setGroups($package_id, $vars['groups']);
  7. It appears that when a package is edited, groups are removed and re-added? If so this should be expected behavior. In edit function: if (isset($vars['groups'])) $this->setGroups($package_id, $vars['groups']); setGroups function: private function setGroups($package_id, $groups=null) { // Remove all existing groups $this->Record->from("package_group")-> where("package_id", "=", $package_id)->delete(); // Add all given groups if (!empty($groups) && is_array($groups)) { for ($i=0; $i<count($groups); $i++) { $vars = array( 'package_id'=>$package_id, 'package_group_id'=>$groups[$i] ); $this->Record->insert("package_group", $vars); } } }
  8. I don't know if I'm missing something here. But I can't change the package on an active service. I tried as admin (changing the package/term under upgrade/downgrade) and I tried from the client area. Never calls the SolusVM module. Nothing in the logs about telling Solus to change packages. Doesn't appear to be any documentation on this either. Also, if i try to price override with a price of $0, it removes the price override entirely.
  9. Every time I edit a package, it breaks the ordering. Usually bumps it up to the top of the list. a. Order packages under "groups" in the admin b. Edit a package (change any value) No errors /clients/admin/packages/ http://awesomescreenshot.com/0214qpnu6d http://awesomescreenshot.com/0af4qpo6e6 http://awesomescreenshot.com/0c64qpo5e4 cPanel + PHP 5.4, blesta 3.4.2, solusvm module
×
×
  • Create New...