Skip to content

Instantly share code, notes, and snippets.

View pcave's full-sized avatar

Phillip Cave pcave

View GitHub Profile
@pcave
pcave / gist:18a79c5b1051daae194d8278ab308b73
Last active October 26, 2017 20:41
Update card_id where missing
<?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");
@pcave
pcave / 2017-10-22 00:35:37 EDT
Created October 23, 2017 13:39
Page wrapper failure: #2
<!DOCTYPE html>
<!--[if IE 8]><html class="ie8" lang="en"> <![endif]-->
<!--[if IE 9]><html class="ie9" lang="en"> <![endif]-->
<!--[if gte IE 9]><html class="ie" lang="en"> <![endif]-->
<head profile="http://www.w3.org/1999/xhtml/vocab">
<meta name="HandheldFriendly" content="TRUE" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><script type="text/javascript">window.NREUM||(NREUM={}),__nr_require=function(e,n,t){function r(t){if(!n[t]){var o=n[t]={exports:{}};e[t][0].call(o.exports,function(n){var o=e[t][1][n];return r(o||n)},o,o.exports)}return n[t].exports}if("function"==typeof __nr_require)return __nr_require;for(var o=0;o<t.length;o++)r(t[o]);return r}({1:[function(e,n,t){function r(){}function o(e,n,t){return function(){return i(e,[c.now()].concat(u(arguments)),n?null:this,t),n?void 0:this}}var i=e("handle"),a=e(2),u=e(3),f=e("ee").get("tracer"),c=e("loader"),s=NREUM;"undefined
@pcave
pcave / 2017-10-20 22:13:18 EDT
Last active October 23, 2017 13:36
Page wrapper failure: #1
<!DOCTYPE html>
<!--[if IE 8]><html class="ie8" lang="en"> <![endif]-->
<!--[if IE 9]><html class="ie9" lang="en"> <![endif]-->
<!--[if gte IE 9]><html class="ie" lang="en"> <![endif]-->
<head profile="http://www.w3.org/1999/xhtml/vocab">
<meta name="HandheldFriendly" content="TRUE" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><script type="text/javascript">window.NREUM||(NREUM={}),__nr_require=function(e,n,t){function r(t){if(!n[t]){var o=n[t]={exports:{}};e[t][0].call(o.exports,function(n){var o=e[t][1][n];return r(o||n)},o,o.exports)}return n[t].exports}if("function"==typeof __nr_require)return __nr_require;for(var o=0;o<t.length;o++)r(t[o]);return r}({1:[function(e,n,t){function r(){}function o(e,n,t){return function(){return i(e,[c.now()].concat(u(arguments)),n?null:this,t),n?void 0:this}}var i=e("handle"),a=e(2),u=e(3),f=e("ee").get("tracer"),c=e("loader"),s=NREUM;"undefined
<?php
/**
* Implements hook_springboard_quick_donate_optin_create().
*/
function salesforce_quick_donate_springboard_quick_donate_optin_create($account, $donation, $card_id) {
// Load the full card on file entity.
$card_on_file = commerce_cardonfile_load($card_id);
// Create a quick donate subscription object and queue it up.
@pcave
pcave / gist:1842c35e4ed8df10a686730bbd705d8e
Last active July 18, 2016 16:48
Make product id and type mappable
// Add new alter hook in _salesforce_mapping_get_entity_fields
// Give other modules a chance to alter the entity fields available for mapping.
drupal_alter('salesforce_mapping_entity_fields', $entity_fields, $entity_type, $entity_bundle_type);
/**
* Implements hook_salesforce_mapping_entity_fields_alter().
*/
function salesforce_line_item_salesforce_mapping_entity_fields_alter(&$entity_fields, $entity_type, $entity_bundle_type) {
if ($entity_type == 'commerce_line_item' && $entity_bundle_type == 'designation') {
@pcave
pcave / php_error_detection.txt
Last active November 12, 2015 15:11
PHP Error Detection
/**
* There is a coding mistake in the code below. See if you can spot it and explain why the mistake
* may or may not cause an issue when executed.
*/
if (!empty($form['#node']->custom_fail_message && $node->webform['redirect_url'] != '<confirmation>')) {
drupal_get_messages('status');
drupal_set_message(check_markup($form['#node']->custom_fail_message, 'full_html', '', TRUE));
}
trigger ActionsTakenTriggerHandler on jrsbd__sb_Actions_Taken__c (after insert) {
Map<Id, Integer> actionsTaken = new Map<Id, Integer>();
Map<Id, Integer> petitionsSigned = new Map<Id, Integer>();
Map<Id, Integer> actionsLast30Days = new Map<Id, Integer>();
// Figure out how many actions taken and petitions signatures are going to be added to each Contact.
for (jrsbd__sb_Actions_Taken__c actionTaken: Trigger.new) {
if (actionTaken.jrsbd__Action_Type__c == 'Petition') {
if (petitionsSigned.containsKey(actionTaken.jrsbd__Contact__c)) {
petitionsSigned.put(actionTaken.jrsbd__Contact__c, petitionsSigned.get(actionTaken.jrsbd__Contact__c) + 1);
@pcave
pcave / gist:82bb6bd4cadb9dc220a9
Created June 8, 2015 16:00
Loader.io payload to submit message action
{
"keys": [
"details[page_num]",
"details[page_count]",
"details[finished]",
"op",
"form_build_id",
"form_id",
"form_token",
"submitted[sbp_salutation]",
@pcave
pcave / gist:b7ecfc2c33ed9f6c85a0
Created April 15, 2015 16:17
resolveTarget() response
{
"data":{
"alert_id":"Advocacy-My-Test-Ac-552d6b6a928fe",
"account_id":"208",
"test_mode":false,
"contact":{
"first_name":"Don",
"last_name":"Johnson",
"address":"104 Briarburn Lane",
"address_line_2":"",
@pcave
pcave / gist:6385f4943ad8a5ee337e
Created February 26, 2015 16:21
Message action load, attaching messages
function sba_message_action_node_load($nodes, $types) {
// If no message_action nodes are loaded no need to continue.
if (!in_array('sba_message_action', $types)) {
return;
}
// Add full messages to each node so we can utilize them later.
foreach ($nodes as $nid => $node) {
if ($node->type == 'sba_message_action') {
$messages = entity_load('sba_message', $node->message_ids);