PixelPaul Posted October 17, 2022 Share Posted October 17, 2022 (edited) 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 October 17, 2022 by PixelPaul 0 Quote Link to comment Share on other sites More sharing options...
PixelPaul Posted October 17, 2022 Author Share Posted October 17, 2022 (edited) 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 October 17, 2022 by PixelPaul 0 Quote Link to comment Share on other sites More sharing options...
WHMCS Support Manager WHMCS John Posted October 26, 2022 WHMCS Support Manager Share Posted October 26, 2022 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. 0 Quote Link to comment Share on other sites More sharing options...
PixelPaul Posted October 26, 2022 Author Share Posted October 26, 2022 so why does it run the hook just once when the admin does it, even tho he changes 2 or more values? And is there a hook that will run just once with all updated values for client and admin making the change? 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.