Jump to content
  • 0

Deleting a service


DTD1941

Question

We are testing blesta. We created some clients and a package . We added the package as a service for one of the clients. We then wanted to delete a client and all the services and the package associated with the deleted client. We then the following for the client to be deleted: (1) voided hist invoices; (2) canceled all services for that client; (3) delete the client. At this point we want to remove the package that is no longer connected to a client. This gives the error "The package could not be deleted because a service is currently using it."

This error happens because the `services` table links to the `client` table and the `packages` table. You can delete the package if the client's records are removed from the `package` table. I also removed that client from `service_invoices`. This is okay in the test because all invoices were voided.

So the question is can a package that has been assigned to a user ever be delete? It appears that the answer to this question is no. My "solution: allows orphan packages to be removed. In what we were doing, i.e. testing, the need to be able to do this clear. We are learing blesta and di not want all the 'crud' we entered as test data to remain. Also the interface and documentation suggest a package can be deleted.

If the case of real removing orphan packages has value in avoiding confusion and data entry mistakes.As long as the package table are no used in view or printing an invoice it would seem that moving the records is okay. In our test it did not break anything. We do need to test this with an orphan package associated with a client with some non-voided invoices.

A lots to words to support there seems to be a bug in the deletion of a package.

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0
1 hour ago, DTD1941 said:

So the question is can a package that has been assigned to a user ever be delete? It appears that the answer to this question is no. My "solution: allows orphan packages to be removed. In what we were doing, i.e. testing, the need to be able to do this clear. We are learing blesta and di not want all the 'crud' we entered as test data to remain. Also the interface and documentation suggest a package can be deleted.

A Package can be deleted if there are no services that are linked to the Package, which includes cancelled services. This is the case because services have a direct relationship with Packages and a service floating around without a Package could cause issues. The typical recommended action is to mark old Packages as "Inactive" instead of deleting them. But, if you are doing some testing you can delete the services in the services table in the database manually, and then you should be able to delete the Package in the UI. Always use the UI where possible. So, service deleted in database, then delete Package in Blesta.

We may change this in the future, but the restriction is there to be safe and we need to spend more time determining whether it's safe to delete a Package that has linked services.

Link to comment
Share on other sites

  • 0
On 8/29/2019 at 5:05 PM, Paul said:

Thank you for the quick answer. As far as I can see what that means is in "normal" use the only packages that can be deleted are  ones that have never been used. If that's right I understand your answer. If I am missing something here I would appreciate knowing what as means I do not understand the overall database design.

Assuming I am not missing anything I see no risk as long none of the service tables are required to print or review a non-voided invoice. Entries in the service table are unique to a client. If a package only consists of orphaned services it seems safe to me to remove it. But you guys are the experts.

 

Link to comment
Share on other sites

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