Пример #1
0
def create_p3_auto_assigned_conference_tickets(sender, params=None, **kws):

    #print ('create_p3_conference_tickets: %r %r %r' % (sender, params, kws))
    fare = sender

    # Only create conference tickets with this helper
    if fare.ticket_type != 'conference':
        return

    # Get parameters sent by Fare.create_tickets()
    if params is None:
        return
    created_tickets = params['tickets']
    user = params['user']

    # Tickets may have not yet been created, so do this now. This
    # overrides the default ticket in Fare.created_tickets(), but
    # allows us to apply the auto-assign below, even for the first
    # ticket
    if not created_tickets:
        ticket = Ticket(user=user, fare=fare)
        ticket.fare_description = fare.name
        ticket.save()
        created_tickets.append(ticket)

    # Create P3 TicketConference records and assign them to the user,
    # if not already done
    from p3 import utils
    for ticket in created_tickets:
        utils.assign_ticket_to_user(ticket, user)
Пример #2
0
def create_hotel_tickets(sender, **kw):
    # only for bookings of full rooms I need to create multiple tickets, in
    # all other cases it's ok the default behavior
    if sender.code[:2] == 'HR':
        room_size = int(sender.code[2])
        for ix in range(room_size):
            t = Ticket(user=kw['params']['user'], fare=sender)
            t.fare_description = sender.name + (' (Occupant %s/%s)' % (ix+1, room_size))
            t.save()
            kw['params']['tickets'].append(t)
Пример #3
0
def create_hotel_tickets(sender, **kw):
    # solo per le prenotazioni di intere camere devo creare più biglietti, per
    # tutti gli altri casi mi va bene il comportamento standard
    if sender.code[:2] == 'HR':
        room_size = int(sender.code[2])
        for ix in range(room_size):
            t = Ticket(user=kw['params']['user'], fare=sender)
            t.fare_description = sender.name + (' (Occupant %s/%s)' % (ix+1, room_size))
            t.save()
            kw['params']['tickets'].append(t)
Пример #4
0
def create_hotel_tickets(sender, **kw):
    # only for bookings of full rooms I need to create multiple tickets, in
    # all other cases it's ok the default behavior
    if sender.code[:2] == 'HR':
        room_size = int(sender.code[2])
        for ix in range(room_size):
            t = Ticket(user=kw['params']['user'], fare=sender)
            t.fare_description = sender.name + (' (Occupant %s/%s)' %
                                                (ix + 1, room_size))
            t.save()
            kw['params']['tickets'].append(t)
Пример #5
0
def create_hotel_tickets(sender, **kw):
    # solo per le prenotazioni di intere camere devo creare più biglietti, per
    # tutti gli altri casi mi va bene il comportamento standard
    if sender.code[:2] == 'HR':
        room_size = int(sender.code[2])
        for ix in range(room_size):
            t = Ticket(user=kw['params']['user'], fare=sender)
            t.fare_description = sender.name + (' (Occupant %s/%s)' %
                                                (ix + 1, room_size))
            t.save()
            kw['params']['tickets'].append(t)