Blesta Addons Posted May 6, 2014 Report Share Posted May 6, 2014 Hello all i want to share my logicbox modified modules with you . the module is the same as the core module , i just added some featuring code to avoid the imported domains problemes . for domains imported there is no order-id and ns fields , so there is no possiblity to change the name servers and settings . so , my module get the order-id and affiche it in the admin edit interface , it need just a update click to update the domains flieds . i also added the tabs nav . i'm searching now a way to make the fields updated auto when the admin or the client enter the manage domains . question for dev , how i can push update to databse inside getAdminEditFields function ? PauloV, sedudohost and Michael 3 Quote Link to comment Share on other sites More sharing options...
Blesta Addons Posted May 6, 2014 Author Report Share Posted May 6, 2014 how can i call the editService function inside the getAdminEditFields/getAdminServiceInfo/getClientServiceInfo functions ? Quote Link to comment Share on other sites More sharing options...
Tyson Posted May 6, 2014 Report Share Posted May 6, 2014 You can call Services::edit(), and it will then call YourModule::editService(). You can take a look at the VPS.net and SolusVM modules for an example. Michael 1 Quote Link to comment Share on other sites More sharing options...
Blesta Addons Posted May 19, 2014 Author Report Share Posted May 19, 2014 i get this error Non-static method Services::edit() should not be called statically, assuming $this from incompatible context on line 946 in /home/xxxxxxx/public_html/blesta/components/modules/logicboxes/logicboxes.php when i use the $this->editService i get this fatal error : Fatal error: Cannot access private property ModuleFields::$fields in /home/xxxxxxx/public_html/blesta/components/modules/logicboxes/logicboxes.php on line 374 my code is the fallowing : $this->editService($package, $fields , array('domain-name' => $vars->{'domain-name'} , 'order-id' => $order_id)); EDIT : this is because maybe i should send the service with the call function . How i can get the $service inside the "getAdminEditFields" . Quote Link to comment Share on other sites More sharing options...
Tyson Posted May 19, 2014 Report Share Posted May 19, 2014 i get this error when i use the $this->editService i get this fatal error : my code is the fallowing : $this->editService($package, $fields , array('domain-name' => $vars->{'domain-name'} , 'order-id' => $order_id)); Don't call YourModule::editService() directly. Load the Services model and call that instead. Loader::loadModels($this, array("Services")); $this->Services->edit($service->id, array()); // performs service edit, and also calls YourModule::editService() $errors = $this->Services->errors(); EDIT : this is because maybe i should send the service with the call function . How i can get the $service inside the "getAdminEditFields" . The service isn't available to getAdminEditFields--why do you need it? Blesta Addons 1 Quote Link to comment Share on other sites More sharing options...
Blesta Addons Posted May 19, 2014 Author Report Share Posted May 19, 2014 The service isn't available to getAdminEditFields--why do you need it? i will give you my scenario . after importing from v2.5 , all the domains (logicbox) has not the order-id fields . we should change it manually in phpmyadmin (about 3500 fields is like imposible now ) what i have found as solution ; make the logicbox module get the order-id by the domain , that we have made it . make the logicbox module update the order-id in the adminedit view , that we have made it . now we need to make the update silence in editadmin view and the client service info function , when a client/staff/admin enter to the service view , we check if the order-id field exist , if not we get the order-id and update the services fields auto . we have all don now , it remain just hwo we can update the service fields with the domain-name and order-id public function getAdminEditFields($package, $vars=null) { if ($package->meta->type == "domain") { Loader::loadHelpers($this, array("Html")); $fields = new ModuleFields(); // Get The orderid if missing in the database (usefull for imported services) if (property_exists($fields, "order-id")) $order_id = $vars->{'order-id'}; else { $order_id = $this->getorderid($package->module_row , $vars->{'domain-name'}); $parts = explode('/', $_SERVER['REQUEST_URI']); // here we get the servie id $this->editService($package, $parts[sizeof($parts)-2] , array('domain-name' => $vars->{'domain-name'} , 'order-id' => $order_id) , $parent_package=null, $parent_service=null); } // Create domain label $domain = $fields->label(Language::_("Logicboxes.domain.domain-name", true), "domain-name"); // Create domain field and attach to domain label $domain->attach($fields->fieldText("domain-name", $this->Html->ifSet($vars->{'domain-name'}), array('id'=>"domain-name"))); // Set the label as a field $fields->setField($domain); // Create Order-id label $orderid = $fields->label(Language::_("Logicboxes.domain.order-id", true), "order-id"); // Create orderid field and attach to orderid label $orderid->attach($fields->fieldText("order-id", $this->Html->ifSet($order_id), array('id'=>"order-id"))); // Set the label as a field $fields->setField($orderid); return $fields; } else { return new ModuleFields(); } } Quote Link to comment Share on other sites More sharing options...
Blesta Addons Posted May 19, 2014 Author Report Share Posted May 19, 2014 thanks tyson , i have got it with your code . $parts = explode('/', $_SERVER['REQUEST_URI']); // get the service id from $this->Services->edit($parts[sizeof($parts)-2], array('domain-name' => $vars->{'domain-name'} , 'order-id' => $order_id)); $errors = $this->Services->errors(); best regards . Quote Link to comment Share on other sites More sharing options...
Blesta Addons Posted May 19, 2014 Author Report Share Posted May 19, 2014 now it remain to do it in the client interface . as i know is not possible to do it in the client tab service info ? any thing e can do it in the client side ? Quote Link to comment Share on other sites More sharing options...
Blesta Addons Posted May 19, 2014 Author Report Share Posted May 19, 2014 Hello Tyson ...after checking and testing the code , the data is not saved in database , and no error is returnedcan please check with me Loader::loadModels($this, array("Services")); $order_id = $this->getorderid($package->module_row , $vars->{'domain-name'}); $parts = explode('/', $_SERVER['REQUEST_URI']); // get the service id from url $this->Services->edit($parts[sizeof($parts)-2], array('domain-name' => $vars->{'domain-name'} , 'order-id' => $order_id)); if (($errors = $this->Services->errors())) { echo $errors ; } Quote Link to comment Share on other sites More sharing options...
Blesta Addons Posted May 20, 2014 Author Report Share Posted May 20, 2014 is corrected now ... Work like a charm Quote Link to comment Share on other sites More sharing options...
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.