AllToolKits.com Posted June 24, 2015 Report Posted June 24, 2015 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 ?
0 Tyson Posted June 24, 2015 Report Posted June 24, 2015 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 AllToolKits.com Posted June 24, 2015 Author Report Posted June 24, 2015 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. PauloV 1
0 Tyson Posted June 26, 2015 Report Posted June 26, 2015 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.
Question
AllToolKits.com
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
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now