Jump to content

Input->SetError no longer works on addservice() method


Recommended Posts

Posted

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.

Posted
  On 12/25/2017 at 1:54 PM, 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.

Expand  

the same code was working before ?

Posted
  On 12/25/2017 at 9:57 PM, Blesta Addons said:

the same code was working before ?

Expand  

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.

Posted
  On 12/25/2017 at 10:06 PM, 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.

Expand  

try

 

            $this->Input->setErrors(
                ['module_row' => ['error' => "error here"]]
            );
            return;

 

Posted

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.

Posted
  On 12/26/2017 at 5:01 PM, 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.

Expand  

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>
Posted

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

Posted
  On 12/26/2017 at 6:14 PM, 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".

Expand  

well I found that setting company_settings not $client_settings as app/models/invoices.php is referring to hence the error.

  • 5 months later...
Posted

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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...