It should, at least in case when it was active and it continues to be.

It is not a stressed function can I post a patch that do check existence of stock and its value and call module_invoke_all at the end? It will be reviewed?

Comments

douglasmiller’s picture

Assigned: smartango » douglasmiller
Status: Active » Needs review
StatusFileSize
new489 bytes

I was very surprised to find that hook_uc_stock_adjusted was not fired when an admin manually adjusts the stock. This seems contrary to the intent of the hook.

I have adjusted uc_stock.admin.inc to invoke the hook with the correct values upon form submission.

douglasmiller’s picture

The above patch fires for all save events on a node's edit/stock page.

This may not always be desirable, so I have created this new patch that will only invoke the hook if the stock management is set to active.

SilviuChingaru’s picture

I think the hook should be called on every stock update not only for active stocks. Maybe we want to keep track of units without decreasing the stock

SilviuChingaru’s picture

Assigned: douglasmiller » Unassigned
Category: Feature request » Bug report
Issue summary: View changes

I think this is a bug not a feature request because hook_uc_stock_adjusted() should and is docomented as the hook that is called on any stock adjustment.

longwave’s picture

StatusFileSize
new650 bytes

We should fire the hook for all variants, but only when the stock level actually changes.

tr’s picture

StatusFileSize
new650 bytes

Uploading the patch in #5 again for the new testbot to see. It still applies, and no changes were made.