Jump to content

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


Recommended Posts

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

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

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

 

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

  • 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

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