Last active
October 26, 2017 20:41
-
-
Save pcave/18a79c5b1051daae194d8278ab308b73 to your computer and use it in GitHub Desktop.
Update card_id where missing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$result = db_query("SELECT f.did FROM fundraiser_sustainers_series s | |
INNER JOIN fundraiser_sustainers f ON f.master_did = s.did | |
INNER JOIN fundraiser_donation d ON d.did = f.did | |
WHERE s.status = 'active' | |
AND gateway = 'authnet_aim|commerce_payment_authnet_aim' | |
AND card_id IS NULL | |
AND d.status = 'pending_future_payment' limit 100"); | |
foreach ($result as $record) { | |
$donation = fundraiser_donation_get_donation($record->did); | |
if (!empty($donation->data['cardonfile'])) { | |
// Save the card_id to the fundraiser_donation table for easier access. | |
db_query('UPDATE {fundraiser_donation} SET card_id = :card_id WHERE did = :did', array( | |
':card_id' => $donation->data['cardonfile'], | |
':did' => $record->did, | |
)); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment