We recently updated a couple sites to the latest release of Ubercart. We've realized all of our credit card data, which was stored in past orders has since been erased. Has this happened to anyone else? Is there anything we can do to get that data back? Help!
Hasn't happened here... are you saying it got wiped from the DB or it just isn't visible through the order administration any more?
It got wiped from the database on all of our sites that were updated.
We're actually seeing the database cc info getting cleared almost every day.
Same here. I thought this was a setting in the payment settings
"Oh snap!"
I'll check it out... that's not cool.
EDIT: Apparently, there was a check in there for order_status = 0. This wasn't updated with the new order status system. Fixing and committing as soon as I can... until then I'd recommend stopping your cron runs. (Just rename cron.php until the fix goes in.)
Alright, I had searched for the old functions and made the changes, but there were two queries in uc_credit_cron() that needed to be updated, too. The function should resemble this:
<?php
function uc_credit_cron() {
// Empty anonymous carts.
$time = strtotime(variable_get('uc_cart_anon_duration', '4') .' '
. variable_get('uc_cart_anon_unit', 'hours') .' ago');
db_query("DELETE upc.* FROM {uc_orders} AS uo LEFT JOIN {uc_payment_credit} "
."AS upc ON uo.order_id = upc.order_id WHERE uo.modified <= %d AND "
."uo.order_status = '%s'", $time, uc_order_state_default('in_checkout'));
// Mask old stored credit card numbers.
$time = strtotime(variable_get('uc_credit_number_duration', '1') .' '
. variable_get('uc_credit_number_unit', 'years') .' ago');
db_query("UPDATE {uc_orders} AS uo LEFT JOIN {uc_payment_credit} AS upc "
."ON uo.order_id = upc.order_id SET upc.cc_number = "
."RIGHT(upc.cc_number, 4), upc.cc_cvv = '000' WHERE uo.modified "
."<= %d AND uo.order_status = '%s' AND CHAR_LENGTH(upc.cc_number) > 4",
$time, variable_get('uc_credit_clear_status', uc_order_state_default('completed')));
}
?>Changes are in Bazaar.
Updated to latest bazaar and I get "Fatal error: require_once() [function.require]: Failed opening required 'uc_payment_workflow.inc' (include_path='.:/usr/local/lib/php') in /home/ograce/public_html/sites/all/modules/ubercart/payment/uc_payment/uc_payment.module on line 19"
Hi Guys,
I've got a related problem, with a fresh install of UC Alpha7e, anytime I run cron.php i got a warning :
user warning: Not unique table/alias: 'upc' query: DELETE upc.* FROM uc_orders AS uo LEFT JOIN uc_payment_credit AS upc ON uo.order_id = upc.order_id WHERE uo.modified <= 1193501589 AND uo.order_status = 0
Any help would be greatly appreciated,
Thanks
Check to make sure lines 60-62 in your uc_credit.module look like this:
<?php
db_query("DELETE upc.* FROM {uc_orders} AS uo LEFT JOIN {uc_payment_credit} "
."AS upc ON uo.order_id = upc.order_id WHERE uo.modified <= %d AND "
."uo.order_status = '%s'", $time, uc_order_state_default('in_checkout'));
?>If not, it may be you were updating from a version prior to the directory structure changes and as such will need to remove duplicate directories from root that exist in the /payment and /shipping subdirectories.
Hi Ryan, and thanks for looking into this.
Here are the lines included in ubercart-5.x-1.0-alpha7e.tar.gz /payement/credit/uc_credit.module
function uc_credit_cron() {
// Empty anonymous carts.
$time = strtotime(variable_get('uc_cart_anon_duration', '4') .' '
. variable_get('uc_cart_anon_unit', 'hours') .' ago');
db_query("DELETE upc.* FROM {uc_orders} AS uo LEFT JOIN {uc_payment_credit} "
."AS upc ON uo.order_id = upc.order_id WHERE uo.modified <= %d AND "
."uo.order_status = 0", $time);
// Mask old stored credit card numbers.
$time = strtotime(variable_get('uc_credit_number_duration', '1') .' '
. variable_get('uc_credit_number_unit', 'years') .' ago');
db_query("UPDATE {uc_orders} AS uo LEFT JOIN {uc_payment_credit} AS upc "
."ON uo.order_id = upc.order_id SET upc.cc_number = "
."RIGHT(upc.cc_number, 4), upc.cc_cvv = '000' WHERE uo.modified "
."<= %d AND uo.order_status = %d AND CHAR_LENGTH(upc.cc_number) > 4",
$time, variable_get('uc_credit_clear_status', 4));
}
I did not update from any previous version of UC, it's a clean install, so my directory structure is as it should be (all payement stuff below ubercart/payement/)
I've replaced the query by the one you suggested, but still got the same kind of error:
user warning: Not unique table/alias: 'upc' query: DELETE upc.* FROM uc_orders AS uo LEFT JOIN uc_payment_credit AS upc ON uo.order_id = upc.order_id WHERE uo.modified <= 1193669983 AND uo.order_status = 'in_checkout'Could it be that there is no order in the tables ? (site is still in construction)
Thanks a lot,
Sebastien
// Sorry for double post, was not logged during last post
Hi Ryan, and thanks for looking into this.
Here are the lines included in ubercart-5.x-1.0-alpha7e.tar.gz /payement/credit/uc_credit.module
function uc_credit_cron() {
// Empty anonymous carts.
$time = strtotime(variable_get('uc_cart_anon_duration', '4') .' '
. variable_get('uc_cart_anon_unit', 'hours') .' ago');
db_query("DELETE upc.* FROM {uc_orders} AS uo LEFT JOIN {uc_payment_credit} "
."AS upc ON uo.order_id = upc.order_id WHERE uo.modified <= %d AND "
."uo.order_status = 0", $time);
// Mask old stored credit card numbers.
$time = strtotime(variable_get('uc_credit_number_duration', '1') .' '
. variable_get('uc_credit_number_unit', 'years') .' ago');
db_query("UPDATE {uc_orders} AS uo LEFT JOIN {uc_payment_credit} AS upc "
."ON uo.order_id = upc.order_id SET upc.cc_number = "
."RIGHT(upc.cc_number, 4), upc.cc_cvv = '000' WHERE uo.modified "
."<= %d AND uo.order_status = %d AND CHAR_LENGTH(upc.cc_number) > 4",
$time, variable_get('uc_credit_clear_status', 4));
}
I did not update from any previous version of UC, it's a clean install, so my directory structure is as it should be (all payement stuff below ubercart/payement/)
I've replaced the query by the one you suggested, but still got the same kind of error:
user warning: Not unique table/alias: 'upc' query: DELETE upc.* FROM uc_orders AS uo LEFT JOIN uc_payment_credit AS upc ON uo.order_id = upc.order_id WHERE uo.modified <= 1193669983 AND uo.order_status = 'in_checkout'Could it be that there is no order in the tables ? (site is still in construction)
Thanks a lot,
Sebastien
Nah, the problem is just with the delete query. You'll notice in your version it's looking for orders with a status of 0 whereas in the current code I posted it's using a %s and a function to get the order status name. This was one place where the order status changes slipped through the cracks. You can replace the code manually, update to the latest Bazaar version (will need Workflow-ng), or wait for Alpha 8 to come out. Shouldn't be too far away.




