Jump to content

why does _ChangePackage run twice?


PixelPaul

Recommended Posts

Hello All,

I have a module and i noticed that when there  are 2 configurable options ( in the 1 config group ) that the _ChangePackage function runs twice when the customer does the upgrade.

And the first time it runs, it has one of the option changes. The next time it runs it has both of the option changes. So it seems it runs for each option change.

Interesting tho, when i click the button "Change Package" on the admin side for the service, it only runs  the _ChangePackage function once, for all the options in one go.

So why the difference of running in twice for the customer, but once for the admin?

Edited by PixelPaul
Link to comment
Share on other sites

I just tried now with 3 option changes at once as a customer, and the _ChangePackage ran 3 times. What the??? this seems like a bad process. Specially seeing as it runs once when the admin does the change package.

 

does anyone know how to get a function or hook, after ALL configuration option upgrades are completed? Instead of a function run for each option change?

Edited by PixelPaul
Link to comment
Share on other sites

  • 2 weeks later...
  • WHMCS Support Manager

Hi @PixelPaul,

ChangePackage will be invoked for each line item of upgrade (in this case for each configuration option), and that before each invocation of ChangePackage the service record is updated for the value of that line items, followed by a re-read of all service values.  This means that subsequent invocations of ChangePackage always have the previous values.  This ensures there is no issue with stale data being passed in those subsequent calls to ChangePackage.

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated