Rodrigo Posted July 14, 2014 Report Posted July 14, 2014 This patch should help to use the Universal Module for manually provisioning services that need administrators to fill service fields with data after they do the activation. e.g. dedicated servers, IP needs to be shown at control panel after the service is activated, but it shouldn't be asked at order page.Requirements.- Blesta 3.2.1 Update: I Upgraded to Blesta 3.5.1 and It worked fineInstructions:1. Open components/modules/universal_module/universal_module.phpFind: public function getClientAddFields($package, $vars=null) { // Same as admin return $this->getAdminAddFields($package, $vars); } Replace with: public function getClientAddFields($package, $vars=null) { $fields = new ModuleFields(); if (!isset($vars->meta)) $vars->meta = array(); if (isset($package->module_row) && $package->module_row > 0) { $row = $this->getModuleRow($package->module_row); // Set the module row, which will allow us to reference it later when getName() is invoked $this->setModuleRow($row); $row_fields = array(); if ($row->meta) { $row_fields = $this->formatModuleRowFields($row->meta); $field_data = array(); // Reformat package fields into a more usable format foreach ($row_fields['service_fields'] as $key => $values) { foreach ($values as $i => $value) { $field_data[$i][$key] = $value; } } $newfield_data = array(); foreach($field_data as $field) { if(strpos($field['name'], "dontask_") !== false) { continue; } $newfield_data[] = $field; } $this->setModuleFields($fields, $newfield_data, $vars); } } return $fields; } 2. Add "_dontask" in any part of the service field name3. Protip: you should combine this patch with Universal Module Workaround: Show Service Fields At Client Panel , for best experience. Preview (Using both patches): Setting up Universal Module for showing certain service fields in Client's Manage Service (Workaround 1) and Hiding some service fields from being asked at order page Order Page with hidden fields Admin CP: Manually activating service, all fields being shown Fields Shown to Client (Workaround 1 + 2) Download universal_module.php with both workarounds applied (Only for Blesta 3.2.1): universal_module.php PauloV, Michael and Jonathan 3 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.