Closed (duplicate)
Project:
UC Gift Certificate
Version:
6.x-1.1
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
22 Dec 2009 at 18:28 UTC
Updated:
22 Dec 2009 at 20:36 UTC
Jump to comment: Most recent file
Comments
Comment #1
torgospizzaI noticed this too today. It seems that hook_order() is called twice, for some reason.
I've edited line 680 (found inside uc_gift_certificate_create_new_certs() which is called based on the status settings in the Store Settings page. Now it looks like this:
This helps us in two ways:
1) Now instead of looking for the attribute "Recipient's Email Address" we're looking to see if a Dollar Amount attribute is present, which is common for all certificates - at least, I think. This means we can sell physical Gift Card-type certificates that are printed in our office and mailed to the purchaser.
2) When hook_order is called twice, this new condition checks to make sure that a Certificate Code doesn't already exist (and only creates new certificates if it doesn't). This way, if the order data already has a Certificate Code, then it's not generated again.
The only potential issue I see with this fix, that I don't have time to investigate yet, is what if someone orders 2x certificates? One for one person, another for a second person? I had this working in my local copy of the 5.x module, I'll look through it and see if I can make a similar patch for the 6.x version.
Comment #2
torgospizzaMarking this as duplicate of #543430: Gift Certificate module re-issues multiple certificates when order status is changed. - my solution is similar to the one proposed in a comment on that page, except I changed the Email address attribute to Dollar Amount. jrust, let me know if you think this is better, or if there's another solution that will work.
Comment #3
Clint Eagar commentedJust tested the code change in post #1 and no certificate is generated, no email is sent, no code is generated.