Jump to content
  • 0

Need Advide About Idea In A Module


Blesta Addons

Question

Hello all

 

i have a module to write , i need your ideas about how to , maybe it can help me inspire a good solution .

 

the scenario is the fallowing .

 

i have resellers for a specific service , the reseller create/renew a service , i don't want to create invoice in any activation or renewal , but i want to create a invoice in 15 and 30 of every month . so at here is clear and that scenario already request in several threads . the difference in my situation , and don't care about saying label of service in the invoice or to see the services list in the services section , i want to generate invoice with two lines , 1st line include just total quantity of registered services, 2nd line with total quantity renewed services, the second request is we prefer to not add services line for every new services that will be shown in the services section , but we need to allow in our module for resellers , when they manage the module from inside to see the list of services and then they can manage every services .

 

i hope the idea is clear ...

 

what i have as a solution at the moment , i will create a module + plugin .

 

the module , will createa table that has the same fields as the services fields (label,activation/renew/suspend/cancel date ...ect) , the module will have option to allow resellers ceate/renew services , no renewed services will be deleted auto after x days from thier expiration date , and manage the services inside the module tab ).

 

 

the plugin will just for  cron to be execute every 15 & 30 of month to create invoice for renewed and activated new services . and delete no renewed services .

 

is that a good implementation or there are some thing that i have missed ?

 

my other custom solution is to add new status in the services status field (open/closed/suspended/canceled/my_custom_status) , here the services will not listed as i think in the services list , and i will let my plugin to generate invoice for that services .

 

adding new status can impact the function for other services or blesta work?

 

 

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

i'm not good at MVC & so not good to create plugin....

 

but the invoice creation (regroup of service), from a cron look fine, doing a loop for each user being reseller (maybe you create an user group for reseller), that calculate to total for not yet invoiced service for a given period. So the result could need to be written in a new table for better recap/history.

 

certainly add a row in service table like "reseller_invoiced" with value "1" when invoicing has be done from above cron.

 

As regarding prevent of invoicing as per the native blesta do (by service/order), I will just do a mysql trigger, that work before any insert at the invoice table, or maybe service ?, for just "abort" invoice creation, or create invoice on an single same "internal user" only, when your service given conditions are meet (say you give specifically this type of service associated with a specific package group).

Link to comment
Share on other sites

  • 0

Thanks for your reply .

but the invoice creation (regroup of service), from a cron look fine, doing a loop for each user being reseller (maybe you create an user group for reseller), that calculate to total for not yet invoiced service for a given period. So the result could need to be written in a new table for better recap/history.

the plugin idea is clear & i don't think it will cause a problem in coding or schema .

certainly add a row in service table like "reseller_invoiced" with value "1" when invoicing has be done from above cron.

you idea it will cause a problem in renewal case , the row will be already marked paid when invoice has been generated for the activation first time. also the fact changing the core tables or core files is not my best approach .

As regarding prevent of invoicing as per the native blesta do (by service/order), I will just do a mysql trigger, that work before any insert at the invoice table, or maybe service ?, for just "abort" invoice creation, or create invoice on an single same "internal user" only, when your service given conditions are meet (say you give specifically this type of service associated with a specific package group).

i always prefer be away from core files/tables . also there are no event for invoice before creating . and for that case i have opted to create my own table services that will be just accessed inside the module itself .

if blesta has or can add option to invoice periodically for certain package/client group that would be awesome, this request already discussed several time here in the forums . something like the cpanel licensing system , they invoice you for every new/renew license in 15th of the mounth .

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