You are here

function sms_actions_command_save in SMS Framework 6

Same name and namespace in other branches
  1. 6.2 modules/sms_actions/sms_actions.module \sms_actions_command_save()
  2. 7 modules/sms_actions/sms_actions.module \sms_actions_command_save()

Save a command.

1 call to sms_actions_command_save()
sms_actions_edit_command_form_submit in modules/sms_actions/sms_actions.module

File

modules/sms_actions/sms_actions.module, line 316
Provides a "Send SMS" action and the ability to define custom triggers for incoming messages.

Code

function sms_actions_command_save($command) {
  $commands = sms_actions_get_commands();
  $is_existing = FALSE;
  $existing_discriminator = !empty($command->old_discriminator) ? $command->old_discriminator : $command->discriminator;
  $is_existing = count($commands[$existing_discriminator]);
  if ($is_existing) {
    db_query("UPDATE {trigger_assignments} SET op = '%s' WHERE op = '%s'", array(
      'sms_actions_' . $command->discriminator,
      'sms_actions_' . $existing_discriminator,
    ));
  }
  unset($commands[$existing_discriminator]);
  $commands[$command->discriminator] = $command;
  variable_set('sms_actions_commands', $commands);
}