From 517efafed3c5a72524f320678dd747ac02c379a0 Mon Sep 17 00:00:00 2001 From: Bart Van Der Meerssche Date: Tue, 9 Mar 2010 12:55:25 +0000 Subject: [PATCH] web: provision an entry in the logger_users table when a first device is added --- web/drupal/modules/logger/logger.admin.inc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/web/drupal/modules/logger/logger.admin.inc b/web/drupal/modules/logger/logger.admin.inc index a62d955..bec48d4 100644 --- a/web/drupal/modules/logger/logger.admin.inc +++ b/web/drupal/modules/logger/logger.admin.inc @@ -67,6 +67,10 @@ function _logger_account_devices_submit($form, &$form_state) { db_query("UPDATE {logger_devices} SET uid = %d WHERE serial = %d", $user->uid, $serial); db_query("UPDATE {logger_meters} SET uid = %d WHERE device = '%s'", $user->uid, $device); + if (db_result(db_query("SELECT COUNT(*) FROM {logger_users} WHERE uid = %d", $user->uid)) == 0) { + db_query("INSERT INTO {logger_users} (uid, private) VALUES (%d, %d)", $user->uid, 0); + } + drupal_set_message(t("The device is now associated with your account.")); }