From 222f5aa1209a974d1e461e41a3d2858d7584647b Mon Sep 17 00:00:00 2001 From: Bart Van Der Meerssche Date: Tue, 1 Dec 2009 10:33:32 +0000 Subject: [PATCH] web: improve drush _logger_create and _logger_aasign command consistency --- web/drupal/modules/logger/logger.drush.inc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/web/drupal/modules/logger/logger.drush.inc b/web/drupal/modules/logger/logger.drush.inc index 7861dd2..72259dd 100644 --- a/web/drupal/modules/logger/logger.drush.inc +++ b/web/drupal/modules/logger/logger.drush.inc @@ -41,7 +41,7 @@ function logger_drush_command() { /** * Drush command callbacks. */ -function _logger_create($serial, $country, $uid = 0) { +function _logger_create($serial, $country ="", $uid = 0) { // guard against duplicating entries for the same S/N $count = db_result(db_query("SELECT COUNT(device) FROM {logger_devices} WHERE serial = %d", $serial)); if ($count > 0) { @@ -108,19 +108,19 @@ function _logger_create($serial, $country, $uid = 0) { } } - if (!drush_get_error()) drush_log(dt('Successfully created the meter: @meter with type: @type', array('@meter' => $meter, '@type' => $type)), 'ok'); + if (!drush_get_error()) drush_log(dt('Successfully created the meter: @meter with alias: @alias and type: @type', array('@meter' => $meter, '@alias' => $alias, '@type' => $type)), 'ok'); } } } -function _logger_assign($serial, $uid) { +function _logger_assign($serial, $country, $uid) { // check the existence of S/N $device = db_result(db_query("SELECT device FROM {logger_devices} WHERE serial = %d", $serial)); if ($device == '') { drush_set_error('LOGGER_ASSIGN_SERIAL_NON_EXISTENT', dt('The S/N: @serial does not exist.', array('@serial' => $serial))); } else { - db_query("UPDATE {logger_devices} SET uid = %d WHERE serial = %d", $uid, $serial); + db_query("UPDATE {logger_devices} SET uid = %d, country = '%s' WHERE serial = %d", $uid, $country, $serial); db_query("UPDATE {logger_meters} SET uid = %d WHERE device = '%s'", $uid, $device); }