Index: civicrm/trunk/sites/all/modules/queue2civicrm/queue2civicrm_common.inc |
— | — | @@ -289,14 +289,14 @@ |
290 | 290 | */ |
291 | 291 | $dbs = _queue2civicrm_get_dbs(); |
292 | 292 | $dbs->use_civicrm(); |
293 | | - $query = "SELECT id, custom_group_id, label, default_value, table_name FROM civicrm_custom_field WHERE custom_group_id IN (SELECT id FROM civicrm_custom_group WHERE extends='Contribution' && is_active='1');"; |
| 293 | + $query = "SELECT id, table_name FROM civicrm_custom_group WHERE extends='Contribution' && is_active='1';"; |
294 | 294 | $dao = CRM_Core_DAO::executeQuery( $query ); // Execute's query using CiviCRM data object stuff |
295 | 295 | while ( $dao->fetch() ) { |
296 | | - if ( $dao->label == 'Donor Comment' ) { |
| 296 | + if ( $dao->name == 'Contribution_Comments' ) { |
297 | 297 | $comment = ( $msg[ 'comment' ] ) ? $msg[ 'comment'] : ''; |
298 | 298 | $query = "INSERT INTO {" . $dao->table_name . "} (entity_id, donor_comment) VALUES ( %d, '%s' )"; |
299 | 299 | db_query( $query, $contribution[ 'id' ], $comment ); |
300 | | - } elseif ( $dao->default_value ) { // if we dont make sure $dao->default_value has some value, Civi breaks when we try to insert |
| 300 | + } else { // if we dont make sure $dao->default_value has some value, Civi breaks when we try to insert |
301 | 301 | $query = "INSERT INTO {" . $dao->table_name . "} (entity_id) VALUES (%d)"; |
302 | 302 | db_query( $query, $contribution[ 'id' ] ); |
303 | 303 | } |