commit 61b645cae1f263a8c93763343dc72d9d1918c0f7 Author: Matthew Radcliffe Date: Wed Feb 20 14:01:23 2013 -0500 Issue #1258026 by mradcliffe: Add todo about fields being read-only or not. diff --git a/userpoints.admin.inc b/userpoints.admin.inc index d6272d7..36f6222 100644 --- a/userpoints.admin.inc +++ b/userpoints.admin.inc @@ -318,6 +318,7 @@ function userpoints_admin_txn($form, &$form_state, $mode, $txn = NULL) { ); } + // @todo Should fields also be disabled if read-only? field_attach_form('userpoints_transaction', $txn, $form, $form_state); return $form; } commit 8e7e5d76c2306d4fd8b5ce797be66bd8ddfba798 Author: Matthew Radcliffe Date: Wed Feb 20 13:58:43 2013 -0500 Issue #1258026 by mradcliffe: Fix issue with no tid when taxonomy is disabled. diff --git a/userpoints.admin.inc b/userpoints.admin.inc index 6ac037c..d6272d7 100644 --- a/userpoints.admin.inc +++ b/userpoints.admin.inc @@ -474,6 +474,11 @@ function userpoints_admin_txn_submit($form, &$form_state) { field_attach_submit('userpoints_transaction', $transaction, $form, $form_state); + if (!isset($form_state['values']['tid'])) { + // Set default tid if taxonomy is disabled. + $form_state['values']['tid'] = userpoints_get_default_tid(); + } + // Set common properties and save the transaction. $transaction ->setTid($form_state['values']['tid']) commit 12193fb64c1ef06c0c0093f89ad9ccc915f55b32 Author: Matthew Radcliffe Date: Wed Feb 20 13:41:26 2013 -0500 Issue #1258026 by mradcliffe: Add upgrade path to make transaction table an entity table with bundle column. diff --git a/userpoints.install b/userpoints.install index 5074f11..3f460cb 100644 --- a/userpoints.install +++ b/userpoints.install @@ -258,7 +258,6 @@ function userpoints_schema() { function userpoints_install() { // Create the default userpoints bundle that is defined in // userpoints_entity_info(). - $bundle_info = array( 'name' => 'userpoints', 'label' => st('Default'), @@ -405,3 +404,41 @@ function userpoints_update_7004(&$sandbox) { // Set #finished based on sandbox. $sandbox['#finished'] = (empty($sandbox['max']) || $last_uid == 0) ? 1 : ($sandbox['current_uid'] / $sandbox['max']); } + +/** + * Add userpoints transaction type table, and default bundle. + */ +function userpoints_update_7100() { + + // Add transaction type table from schema. + $txn_type_table = drupal_get_schema('userpoints_txn_type', TRUE); + db_add_table('userpoints_txn_type', $txn_type_table); + + // Add bundle column to transaction table. + $type_field = array( + 'description' => 'Bundle', + 'type' => 'varchar', + 'length' => 100, + 'not null' => TRUE, + ); + db_add_field('userpoints_txn', 'type', $type_field); + + // Create the default userpoints bundle that is defined in + // userpoints_entity_info(). + $bundle_info = array( + 'name' => 'userpoints', + 'label' => st('Default'), + 'status' => 0x02, // Default bundle + 'module' => 'userpoints', + ); + + $bundle = new UserpointsTransactionType($bundle_info); + $bundle->save(); + variable_set('userpoints_default_bundle', 'userpoints'); + + // Update all transactions. + db_update('userpoints_txn')->fields(array('type' => 'userpoints'))->execute(); + + return t('Created userpoints_txn_type table, added bundle column to userpoints_txn table, and add default bundle.'); +} + commit 0a6c30428dec0ccce4e6dc9c51ee128b900b00b7 Author: mradcliffe Date: Wed Feb 20 14:17:25 2013 -0500 Issue 1250826 by mradcliffe: Remove unused constant for default bundle. diff --git a/userpoints.module b/userpoints.module index a76d6c1..745b4ef 100644 --- a/userpoints.module +++ b/userpoints.module @@ -20,7 +20,6 @@ define('USERPOINTS_REPORT_USERCOUNT', 'userpoints_report_usercount'); define('USERPOINTS_REPORT_LIMIT', 'userpoints_report_limit'); define('USERPOINTS_REPORT_DISPLAYZERO', 'userpoints_report_displayzero'); -// define('USERPOINTS_DEFAULT_BUNDLE', 'userpoints_default_bundle'); define('USERPOINTS_CATEGORY_NAME', 'Userpoints'); define('USERPOINTS_CATEGORY_DEFAULT_VID', 'userpoints_category_default_vid'); define('USERPOINTS_CATEGORY_DEFAULT_TID', 'userpoints_category_default_tid');