r80670 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r80669‎ | r80670 | r80671 >
Date:00:50, 21 January 2011
Author:awjrichards
Status:deferred
Tags:
Comment:
Updating contribution insert function custom data hack with correct query to get custom data tables
Modified paths:
  • /civicrm/trunk/sites/all/modules/queue2civicrm/queue2civicrm_common.inc (modified) (history)

Diff [purge]

Index: civicrm/trunk/sites/all/modules/queue2civicrm/queue2civicrm_common.inc
@@ -289,14 +289,14 @@
290290 */
291291 $dbs = _queue2civicrm_get_dbs();
292292 $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';";
294294 $dao = CRM_Core_DAO::executeQuery( $query ); // Execute's query using CiviCRM data object stuff
295295 while ( $dao->fetch() ) {
296 - if ( $dao->label == 'Donor Comment' ) {
 296+ if ( $dao->name == 'Contribution_Comments' ) {
297297 $comment = ( $msg[ 'comment' ] ) ? $msg[ 'comment'] : '';
298298 $query = "INSERT INTO {" . $dao->table_name . "} (entity_id, donor_comment) VALUES ( %d, '%s' )";
299299 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
301301 $query = "INSERT INTO {" . $dao->table_name . "} (entity_id) VALUES (%d)";
302302 db_query( $query, $contribution[ 'id' ] );
303303 }

Status & tagging log