Needs review
Project:
UberPOS
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
22 Jun 2011 at 08:43 UTC
Updated:
22 Jun 2011 at 14:05 UTC
Jump to comment: Most recent file
Comments
Comment #1
rbayliss commentedHaven't had a chance to review this yet, but can't this be done with conditional actions?
Comment #2
rhmtts commentedThe conditional actions supplied by up_multi themselves call up_multi_stock_adjust, so rather than wrap the stock adjustment process in a whole bunch of "stuff" (conditional actions and such) that most likely duplicate a lot of functionality, I figured it'd be cleaner to just plug into the process in one place only.
Conceptually this seems simpler to me.
Comment #3
rbayliss commentedYeah, I agree you'd want to keep it all in a single conditional action. My initial reaction was that this doesn't need to go into Uberpos, since you could pretty easily write a custom conditional action to replace the default one, but since we're managing stock completely outside of Ubercart in up_multi, I can see where this would make sense. One comment though... Instead of using a return value from the hook invocations, let's do something like this:
Then the hooks can accept the parameters by reference and change them as needed. I think this is cleaner and requires less error handling code in up_multi.
Comment #4
rhmtts commentedYou're right, that's much cleaner.
Attached is the complete patch.
I've also added another thing: it seems there is no way for products to be added to the up_store_stock table automatically. So either you have to add them manually (as we've done up until now) or you add them the first time the stock is adjusted, inside the up_multi_stock_adjust function (which seems to me to make the most sense - by the time you get there it's very certain that you want an entry for the given product in te given location).