Closed (fixed)
Project:
UC Down Payment
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
16 Sep 2011 at 02:57 UTC
Updated:
7 Oct 2011 at 00:02 UTC
I'm currently working on a patch to allow entry of the final payment date due by number of days from purchase.
I discovered while clearing out test orders that the downpayments module does not remove the associated records in uc_downpayment_payments.
This is very easy to fix, just requires an added case for operation (delete) and a few lines of code added to do the work at the end of the hook_order routine (uc_downpayment_order).
Existing code at line 272 reads...
case 'update':
break;
case 'load':
break;
}
Change to the following...
case 'update':
break;
case 'load':
break;
// handle removal of downpayment payments on order deletion
case 'delete':
foreach ($arg1->products as $key => $product) {
if ($product->data['downpayment']) {
db_query("DELETE FROM {uc_downpayment_payments} WHERE order_id = %d",
$product->data['downpayment']->order_id);
}
}
break;
} /* end of switch ($op) */
I will post the patch for final payment date entry by days from purchase when I have done some more testing and bug stomping.
Comments
Comment #2
sokrplare commentedNice catch, silverwing - will get this added in to the live project soon (http://drupal.org/project/uc_downpayment). Unfortunately, this sandbox project couldn't be properly promoted due to http://drupal.org/node/1104470#comment-4901344 so will fix this and then resolve the ticket out and handle future issues (like your awesome sounding final payment date entry by dates from purchase patch) in the live issue queue.
Comment #3
sokrplare commentedComment #4
sokrplare commentedComment #5
sokrplare commentedMoving to live project queue.
Comment #6
sokrplare commentedWhen an order is deleted, we can delete all down payment records related to that order, so I believe it is sufficient to add the following code:
Comment #7
sokrplare commentedThis code has been added to the most recent version. Many thanks for helping with this bug.
Comment #8
sokrplare commented