Rodrigo Posted July 14, 2014 Report Posted July 14, 2014 Hello,As other users reported in the forum, this issue is making troubles for services that doesn't have proper provisioning modules.By doing the following changes, a Tab will appear at client's manage service page, showing all the service fields that have the public_ tag on their name.Instructions:1. Open components/modules/universal_module/universal_module.phpFind: private function isUrl($str) { return preg_match("#^\S+://\S+\.\S+.+$#", $str); } Add After: /** * Returns all tabs to display to a client when managing a service whose * package uses this module * * @param stdClass $package A stdClass object representing the selected package * @return array An array of tabs in the format of method => title. Example: array('methodName' => "Title", 'methodName2' => "Title2") */ public function getClientTabs($package) { return array( 'moreinfo' => array('name' => "More Info", 'icon' => "fa fa-gears") ); } /** * The More Info tab * * @param stdClass $package A stdClass object representing the current package * @param stdClass $service A stdClass object representing the current service * @param array $get Any GET parameters * @param array $post Any POST parameters * @param array $files Any FILES parameters * @return string The string representing the contents of this tab */ public function moreinfo($package, $service, array $get=null, array $post=null, array $files=null) { $row = $this->getModuleRow($package->module_row); $out = ''; $servicefields = array(); foreach ($row->meta as $key=>$value ) { if (strpos($key, "service_field_name") !== false) { // Here we match the service field label with their key and value foreach($service->fields as $field) { if($field->key == $value) { $name = 'service_field_label_' . str_replace('service_field_name_', '', $key); $servicefields[] = array("label" => $row->meta->$name, "key" => $value, "value" => $field->value); } } } } foreach($servicefields as $field) { // Filter out for showing only public fields if(strpos($field['key'], "public_") === 0 ) { $out .= "<p><b>". $field['label'] . ":</b> " . $field['value'] . "</p>"; } } return "<h4>Service Information</h4><br />" . $out ; } 2. Make sure that the service fields that you want to show to the client start with "public_" prefixPreviewSetting up public service fieldsService fields being shown on client's "Manage Service" pageDownload drop-in replacement file (if you don't want to manually add the above lines) (Only for Blesta 3.2.1): universal_module.phpCaution: This file will be overwritten if you update Blesta and the Tab will disappear (there is no other risk or any service data loss). If you change the service field name of a existing field, the data will not be preserved (bug?) EDIT: This still works for Blesta 3.5.1. I'm not sure if it's still needed, but I'm already using it for my production blesta website so there's no way back Michael, lamlai, ServZoo and 2 others 5 Quote
ServZoo Posted July 29, 2014 Report Posted July 29, 2014 This is just what I needed! Thanks for sharing! Quote
FiRaRi Posted October 18, 2014 Report Posted October 18, 2014 i use that codes, but there are nothing seem on home page. to detail page not problem, but home page downslide not working. You can check screen shot Quote
FiRaRi Posted May 12, 2015 Report Posted May 12, 2015 i use that codes, but there are nothing seem on home page. to detail page not problem, but home page downslide not working. You can check screen shot I still did not solve this problem . Surely , I think we see a little detail about this issue Quote
Blesta Addons Posted May 12, 2015 Report Posted May 12, 2015 i hope somebody answer me the hack is for service info page as i se from the first page . also the hack is for v3.2.1 , not sur if something changed in v3.3 and more . Quote
Jonathan Posted June 15, 2017 Report Posted June 15, 2017 This is absolutely wonderful. MiikaaQC and Michael 2 Quote
Tiny Posted August 30, 2018 Report Posted August 30, 2018 On 6/16/2017 at 12:18 AM, Jonathan said: This is absolutely wonderful. Yes, however, in blesta 4.3 ... it's not doing. Just been testing. Not only this, but all otherr changes from the OP. I wish, there would come an update 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.