Jump to content

Recommended Posts

Posted

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 ?

  • 2 weeks later...
Posted

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" .

Posted

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?

Posted

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();
  }
}
Posted

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 .

Posted

Hello Tyson ...

after checking and testing the code , the data is not saved in database , and no error is returned

can 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 ;
}

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...