Beispiel #1
0
def get_manager_emails(context):
    if settings.get('send_email_to_managers') == 'by_path':
        return get_manager_emails_by_context(context)
    elif settings.get('send_email_to_managers') == 'by_address':
        return [settings.get('manager_email')]
    else:
        return []
Beispiel #2
0
def get_manager_emails(context):
    if settings.get('send_email_to_managers') == 'by_path':
        return get_manager_emails_by_context(context)
    elif settings.get('send_email_to_managers') == 'by_address':
        return [settings.get('manager_email')]
    else:
        return []
Beispiel #3
0
def upgrade_1025_to_1026(context):

    registry = getUtility(IRegistry)
    registry.registerInterface(settings.ISeantisReservationSettings)

    settings.set('available_threshold', 75)
    settings.set('partly_available_threshold', 1)

    # ensure that the records exist now
    settings.get('available_threshold')
    settings.get('partly_available_threshold')
Beispiel #4
0
def upgrade_1025_to_1026(context):

    registry = getUtility(IRegistry)
    registry.registerInterface(settings.ISeantisReservationSettings)

    settings.set('available_threshold', 75)
    settings.set('partly_available_threshold', 1)

    # ensure that the records exist now
    settings.get('available_threshold')
    settings.get('partly_available_threshold')
Beispiel #5
0
def upgrade_1020_to_1021(context):

    send_email_to_managers = settings.get('send_email_to_managers')

    registry = getUtility(IRegistry)
    registry.registerInterface(settings.ISeantisReservationSettings)

    if send_email_to_managers is True:
        settings.set('send_email_to_managers', 'by_path')
    elif send_email_to_managers is False:
        settings.set('send_email_to_managers', 'never')

    # ensure that the records exist now
    settings.get('manager_email')
    settings.get('send_email_to_managers')
Beispiel #6
0
def on_reservation_updated(event):
    if not event.time_changed and event.old_data == event.reservation.data:
        return

    if settings.get('send_email_to_reservees'):
        send_reservation_mail(
            event.reservation, 'reservation_changed', event.language,
            to_managers=False
        )

    if settings.get('send_email_to_managers'):
        send_reservation_mail(
            event.reservation, 'reservation_updated', event.language,
            to_managers=True
        )
Beispiel #7
0
def upgrade_1020_to_1021(context):

    send_email_to_managers = settings.get('send_email_to_managers')

    registry = getUtility(IRegistry)
    registry.registerInterface(settings.ISeantisReservationSettings)

    if send_email_to_managers is True:
        settings.set('send_email_to_managers', 'by_path')
    elif send_email_to_managers is False:
        settings.set('send_email_to_managers', 'never')

    # ensure that the records exist now
    settings.get('manager_email')
    settings.get('send_email_to_managers')
Beispiel #8
0
def on_reservations_denied(event):
    if not settings.get('send_email_to_reservees'):
        return
    if not event.reservation.autoapprovable:
        send_reservation_mail(
            event.reservations, 'reservation_denied', event.language
        )
Beispiel #9
0
def on_reservations_confirmed(event):

    # send one mail to the reservee
    if settings.get('send_email_to_reservees'):
        send_reservations_confirmed(event.reservations, event.language)

    # send many mails to the admins
    if settings.get('send_email_to_managers') != 'never':
        for reservation in combine_reservations(event.reservations):

            if reservation.autoapprovable:
                send_reservation_mail(reservation,
                                      'reservation_made',
                                      event.language,
                                      to_managers=True)
            else:
                send_reservation_mail(reservation,
                                      'reservation_pending',
                                      event.language,
                                      to_managers=True)
Beispiel #10
0
def on_reservations_revoked(event):
    if not settings.get('send_email_to_reservees'):
        return

    if not event.send_email:
        return

    send_reservation_mail(
        event.reservations, 'reservation_revoked', event.language,
        to_managers=False, reason=event.reason
    )
Beispiel #11
0
def on_reservations_confirmed(event):

    # send one mail to the reservee
    if settings.get('send_email_to_reservees'):
        send_reservations_confirmed(event.reservations, event.language)

    # send many mails to the admins
    if settings.get('send_email_to_managers') != 'never':
        for reservation in combine_reservations(event.reservations):

            if reservation.autoapprovable:
                send_reservation_mail(
                    reservation,
                    'reservation_made', event.language, to_managers=True
                )
            else:
                send_reservation_mail(
                    reservation,
                    'reservation_pending', event.language, to_managers=True
                )
Beispiel #12
0
def on_reservations_revoked(event):
    if not settings.get('send_email_to_reservees'):
        return

    if not event.send_email:
        return

    send_reservation_mail(event.reservations,
                          'reservation_revoked',
                          event.language,
                          to_managers=False,
                          reason=event.reason)
Beispiel #13
0
def on_reservation_time_changed(event):
    if not settings.get('send_email_to_reservees'):
        return

    if not event.send_email:
        return

    send_reservation_mail(
        [event.reservation], 'reservation_time_changed',
        event.language, to_managers=False, reason=event.reason,
        old_time=event.old_time, new_time=event.new_time
    )
Beispiel #14
0
def on_reservations_confirmed(event):

    # send one mail to the reservee
    if settings.get('send_email_to_reservees'):
        send_reservations_confirmed(event.reservations, event.language)

    send_notification = settings.get('send_email_to_managers')
    send_approval = settings.get('send_approval_email_to_managers')
    # send many mails to the admins
    if send_notification or send_approval:
        for reservation in event.reservations:

            if reservation.autoapprovable and send_notification:
                send_reservation_mail(
                    reservation,
                    'reservation_made', event.language, to_managers=True
                )
            elif not reservation.autoapprovable and send_approval:
                send_reservation_mail(
                    reservation,
                    'reservation_pending', event.language, to_managers=True
                )
Beispiel #15
0
def on_reservation_time_changed(event):
    if not settings.get('send_email_to_reservees'):
        return

    if not event.send_email:
        return

    send_reservation_mail([event.reservation],
                          'reservation_time_changed',
                          event.language,
                          to_managers=False,
                          reason=event.reason,
                          old_time=event.old_time,
                          new_time=event.new_time)
def seconds_required():
    if not is_throttling_active():
        return 0
    return settings.get('throttle_minutes') * 60
Beispiel #17
0
def on_reservations_denied(event):
    if not settings.get('send_email_to_reservees'):
        return
    if not event.reservation.autoapprovable:
        send_reservation_mail(event.reservations, 'reservation_denied',
                              event.language)
Beispiel #18
0
def seconds_required():
    if not is_throttling_active():
        return 0
    return settings.get('throttle_minutes') * 60