Jump to content

Question

Posted

Hi,

 

addService method of Module is getting called when i create a new service and also when i change status of a service from pending to activate.

 

Is there a way i can distinguish between those two calls ?

 

That's i would like to know weather the addService is called to add a new service or it's called to change  status.

How i can understand that ?

3 answers to this question

Recommended Posts

  • 0
Posted

A module's addService method is called when the system determines the service is being added using the module, whether or not a pending/draft/etc. service already exists in Blesta or if it's being added concurrently. The module is not given enough information to make a distinction on this difference, and it is out of the module's scope to do so.

 

So what does your module do that you think it needs to make this distinction?

  • 0
Posted

From module i am adding a domain.   When adding i check weather the domain already exist or not

$details = $this->Services-> searchServiceFields($module_id, "serv_options1", $domain);
if($add) {
            $rules['serv_opt1']['unique'] = array(
                            'rule' =>   empty($details) ? true:false ,
                            'message' => "Domain " . $domain . " already exist"
            );
 }

I don't want  the above rule if  the status is changing, so need a way to know that fresh creation of service or status change is going on.

  • 0
Posted

Take a look at this post. There is not a way to perform unique checks on service data at the time it is being added without updating the core to support it.

 

I'm not sure your unique domain rule is a very good one though. If a service is canceled in Blesta that uses a specific domain, your rule would not allow that same domain to be ordered again for a subsequent service.

Join the conversation

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

Guest
Answer this question...

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