# File app/controllers/attendance_adm_controller.rb, line 245
  def register_attendance(person, tslot)
    if previous = Person.find(1).
        attendances.find(:first, :conditions =>['timeslot_id = ?', tslot.id])
      flash[:notice] << _('This person has already been registered for this ' +
                          'timeslot. No action taken.')
      return false
    end
    att = Attendance.new(:person_id => person.id,
                         :timeslot_id => tslot.id)

    # If the person did not register for this conference, add him now
    conf = tslot.conference
    if ! person.conferences.include?(conf)
      unless conf.accepts_registrations?
        flash[:error] << _('<em>%s</em> is not registered for <em>%s</em>, ' +
                           'and registrations are closed.') % 
          [person.name, conf.name]
        return false
      end

      flash[:warning] << _('Person <em>%s</em> was not yet registered for ' +
                          'this conference - Registering.') % person.name
      person.conferences << conf
    end

    if att.save
      flash[:notice] << _('Attendance successfully registered')
    else
      flash[:error] << _('Could not register person <em>%s</em> for this ' +
                         'timeslot: %s') % 
        [person.name, att.errors.full_messages.join('<br/>')]
    end
  end