timnboys Posted December 25, 2017 Report Posted December 25, 2017 Hello could anyone including @Paul @Tyson @Cody @Jono help me with stopping the addservice() function in a module on error. $this->Input->setErrors(array('api' => array('internal' => "ErrorMessage", true))); return; ^ that seems to no longer stop the service from being added as it should. Quote
Blesta Addons Posted December 25, 2017 Report Posted December 25, 2017 8 hours ago, timnboys said: Hello could anyone including @Paul @Tyson @Cody @Jono help me with stopping the addservice() function in a module on error. $this->Input->setErrors(array('api' => array('internal' => "ErrorMessage", true))); return; ^ that seems to no longer stop the service from being added as it should. the same code was working before ? Quote
timnboys Posted December 25, 2017 Author Report Posted December 25, 2017 8 minutes ago, Blesta Addons said: the same code was working before ? I don't know to be honest, after checking the functionality of the module everything was screwed up because it returned to modules/installed after trying to delete a module row, so maybe it was related to that, who knows. Quote
Blesta Addons Posted December 25, 2017 Report Posted December 25, 2017 1 minute ago, timnboys said: I don't know to be honest, after checking the functionality of the module everything was screwed up because it returned to modules/installed after trying to delete a module row, so maybe it was related to that, who knows. try $this->Input->setErrors( ['module_row' => ['error' => "error here"]] ); return; Quote
Tyson Posted December 26, 2017 Report Posted December 26, 2017 I don't encounter this issue myself. YourModule::addService can set errors to the Input component in order to prevent service creation. I'd need more context to determine the issue you're experiencing. Quote
timnboys Posted December 26, 2017 Author Report Posted December 26, 2017 40 minutes ago, Tyson said: I don't encounter this issue myself. YourModule::addService can set errors to the Input component in order to prevent service creation. I'd need more context to determine the issue you're experiencing. I fixed that somewhat already now I am running into another issue on the backend api, it seems this is erroring on trying to create a invoice from the service: Undefined index: inv_type on line <strong>2853</strong> in <strong>/var/www/html/app/models/invoices.php</strong> Quote
Tyson Posted December 26, 2017 Report Posted December 26, 2017 It sounds like your company does not have all of its settings defined for some reason. You may want to update the company settings under Settings > Billing/Payment > Invoice Customization and re-save the settings. The one you're missing based on that error is the "Invoice Type". Quote
timnboys Posted December 26, 2017 Author Report Posted December 26, 2017 1 hour ago, Tyson said: It sounds like your company does not have all of its settings defined for some reason. You may want to update the company settings under Settings > Billing/Payment > Invoice Customization and re-save the settings. The one you're missing based on that error is the "Invoice Type". well I found that setting company_settings not $client_settings as app/models/invoices.php is referring to hence the error. Quote
Tyson Posted December 27, 2017 Report Posted December 27, 2017 Settings are inheritable, so the company setting 'inv_type' should exist or you'll encounter that error. Quote
tb1982 Posted June 17, 2018 Report Posted June 17, 2018 Hello, maybe it's not related to your problem but in my case setting an error in the "addService" module method raise an error on line 5742 of /app/controllers/admin_clients.php. On line 5707: $service_id = $this->Services->add($item, $package_ids, $notify); the method is returning null since an Error has been set on the Input module, however on line 5713 "$service_id" is appended to the array "$service_ids": $service_ids[] = $service_id; So on line 5716 the array $service_ids is not empty, raising then the error with the updateServicesRenewalForProration function. I solved the problem editing the admin_clients.php on line 5713, appending the $service_id to $service_ids only if not empty: if (!empty($service_id)) { $service_ids[] = $service_id; } I'm using Blesta 4.2.2, PHP 7.0.27 Tyson 1 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.