Exemple #1
0
    def getReservations2():
        from MaKaC.rb_room import RoomBase
        
        Test.dalManager.connect()
        
        resvEx = Factory.newReservation()
        resvEx.startDT = datetime( 2006, 12, 01, 10 )
        resvEx.endDT = datetime( 2006, 12, 14, 15 )
        resvEx.repeatability = 0 # Daily
        
        #ReservationBase.getReservations( \
        #    roomExample = roomEx, 
        #    resvExample = resvEx,
        #    available = True )

        resv = ReservationBase.getReservations( resvID = 363818 )
        print resv
        r = Reservation()
        r.room = resv.room
        r.startDT = datetime( 2006, 10, 13, 8, 30 )
        r.endDT = datetime( 2006, 10, 13, 17, 30 )
        col = r.getCollisions()
        print col

        Test.dalManager.disconnect()
Exemple #2
0
    def _process( self ):
        from MaKaC.rb_room import RoomBase
        from datetime import datetime,timedelta
        from MaKaC.rb_reservation import ReservationBase

        startdt = enddt = datetime.now()
        today = startdt.date()
        startdt.replace( hour = 0, minute = 0)
        enddt.replace( hour = 23, minute = 59)

        self._responseUtil.content_type = 'text/xml'
        XG = xmlGen.XMLGen()
        XG.openTag("response")

        rooms = RoomBase.getRooms()
        nbRooms = len(rooms)
        nbPublicRooms = nbPrivateRooms = nbSemiPrivateRooms = 0
        for r in rooms:
            if not r.isReservable:
                nbPrivateRooms += 1
            elif not r.resvsNeedConfirmation:
                nbPublicRooms += 1
            else:
                nbSemiPrivateRooms += 1

        self._createIndicator(XG, "total", "total number of managed rooms", nbRooms)
        self._createIndicator(XG, "public", "number of public rooms", nbPublicRooms)
        self._createIndicator(XG, "semiprivate", "number of semi-private rooms", nbSemiPrivateRooms)
        self._createIndicator(XG, "private", "number of private rooms", nbPrivateRooms)

        resvex = ReservationBase()
        resvex.isConfirmed = True
        resvex.isCancelled = False
        nbResvs = len(ReservationBase.getReservations( resvExample = resvex, days = [ startdt.date() ] ))
        resvex.usesAVC = True
        nbAVResvs = len(ReservationBase.getReservations( resvExample = resvex, days = [ startdt.date() ] ))
        resvex.needsAVCSupport = True
        resvex.needsAssistance = False
        nbAVResvsWithSupport = len(ReservationBase.getReservations( resvExample = resvex, days = [ startdt.date() ] ))

        self._createIndicator(XG, "nbbookings", "total number of bookings for today", nbResvs)
        self._createIndicator(XG, "nbvc", "number of remote collaboration bookings (video or phone conference)", nbAVResvs)
        self._createIndicator(XG, "nbvcsupport", "number of remote collaboration bookings with planned IT support", nbAVResvsWithSupport)

        XG.closeTag("response")
        return XG.getXml()
Exemple #3
0
    def _process( self ):
        from MaKaC.rb_room import RoomBase
        from datetime import datetime,timedelta
        from MaKaC.rb_reservation import ReservationBase

        startdt = enddt = datetime.now()
        today = startdt.date()
        startdt.replace( hour = 0, minute = 0)
        enddt.replace( hour = 23, minute = 59)

        self._req.content_type = "text/xml"
        XG = xmlGen.XMLGen()
        XG.openTag("response")

        rooms = RoomBase.getRooms()
        nbRooms = len(rooms)
        nbPublicRooms = nbPrivateRooms = nbSemiPrivateRooms = 0
        for r in rooms:
            if not r.isReservable:
                nbPrivateRooms += 1
            elif not r.resvsNeedConfirmation:
                nbPublicRooms += 1
            else:
                nbSemiPrivateRooms += 1

        self._createIndicator(XG, "total", "total number of managed rooms", nbRooms)
        self._createIndicator(XG, "public", "number of public rooms", nbPublicRooms)
        self._createIndicator(XG, "semiprivate", "number of semi-private rooms", nbSemiPrivateRooms)
        self._createIndicator(XG, "private", "number of private rooms", nbPrivateRooms)

        resvex = ReservationBase()
        resvex.isConfirmed = True
        resvex.isCancelled = False
        nbResvs = len(ReservationBase.getReservations( resvExample = resvex, days = [ startdt.date() ] ))
        resvex.usesAVC = True
        nbAVResvs = len(ReservationBase.getReservations( resvExample = resvex, days = [ startdt.date() ] ))
        resvex.needsAVCSupport = True
        resvex.needsAssistance = False
        nbAVResvsWithSupport = len(ReservationBase.getReservations( resvExample = resvex, days = [ startdt.date() ] ))

        self._createIndicator(XG, "nbbookings", "total number of bookings for today", nbResvs)
        self._createIndicator(XG, "nbvc", "number of remote collaboration bookings (video or phone conference)", nbAVResvs)
        self._createIndicator(XG, "nbvcsupport", "number of remote collaboration bookings with planned IT support", nbAVResvsWithSupport)

        XG.closeTag("response")
        return XG.getXml()
Exemple #4
0
    def getReservations( self, resvExample = None, archival = None ):
        """
        FINAL (not intented to be overriden)
        Returns reservations of this room, meeting specified criteria.
        Look ReservationBase.getReservations for details.
        """
        # Simply redirect to the plugin
        from MaKaC.rb_reservation import ReservationBase

        return ReservationBase.getReservations( resvExample = resvExample, rooms = [self], archival = archival )
Exemple #5
0
    def getReservations( self, resvExample = None, archival = None ):
        """
        FINAL (not intented to be overriden)
        Returns reservations of this room, meeting specified criteria.
        Look ReservationBase.getReservations for details.
        """
        # Simply redirect to the plugin
        from MaKaC.rb_factory import Factory
        from MaKaC.rb_reservation import ReservationBase

        return ReservationBase.getReservations( resvExample = resvExample, rooms = [self], archival = archival )
Exemple #6
0
def sendStartNotifications(logger):
    if getRoomBookingOption('notificationHour') != datetime.now().hour:
        if DEBUG:
            print 'Outside notification hour. Continuing anyway due to debug mode.'
        else:
            return
    days = _getRoomSpecificNotificationBeforeDays()
    days.add(getRoomBookingOption('notificationBefore'))
    dates = [date.today() + timedelta(days=day) for day in days]
    if DEBUG:
        print 'Dates to check: %r' % map(str, dates)
    for resv in ReservationBase.getReservations(days=dates): # for testing, remove location later
        se = resv.getStartEndNotification()
        se.sendStartNotification(logger)
Exemple #7
0
    def getLiveReservations(self, resvExample=None):
        """
        FINAL (not intented to be overriden)
        Returns valid, non archival reservations of this room,
        meeting specified criteria. Look ReservationBase.getReservations for details.
        """
        from MaKaC.rb_factory import Factory
        from MaKaC.rb_reservation import ReservationBase

        if resvExample is None:
            resvExample = Factory.newReservation()
        resvExample.isCancelled = False
        resvExample.isRejected = False

        return ReservationBase.getReservations(resvExample=resvExample, rooms=[self], archival=False)
Exemple #8
0
def sendStartNotifications(logger):
    if getRoomBookingOption('notificationHour') != datetime.now().hour:
        if DEBUG:
            print 'Outside notification hour. Continuing anyway due to debug mode.'
        else:
            return
    days = _getRoomSpecificNotificationBeforeDays()
    days.add(getRoomBookingOption('notificationBefore'))
    dates = [date.today() + timedelta(days=day) for day in days]
    if DEBUG:
        print 'Dates to check: %r' % map(str, dates)
    for resv in ReservationBase.getReservations(
            days=dates):  # for testing, remove location later
        se = resv.getStartEndNotification()
        se.sendStartNotification(logger)
Exemple #9
0
    def getLiveReservations( self, resvExample = None ):
        """
        FINAL (not intented to be overriden)
        Returns valid, non archival reservations of this room,
        meeting specified criteria. Look ReservationBase.getReservations for details.
        """
        from MaKaC.rb_factory import Factory
        from MaKaC.rb_reservation import ReservationBase

        if resvExample == None:
            resvExample = Factory.newReservation()
        resvExample.isCancelled = False
        resvExample.isRejected = False

        return ReservationBase.getReservations( resvExample = resvExample,
                                                rooms = [self], archival = False )
Exemple #10
0
    def getReservations():
        from MaKaC.rb_room import RoomBase
        
        Test.dalManager.connect()

        roomEx = Factory.newRoom()
        roomEx.name = 'TH AMPHITHEATRE'
        
        resvEx = Factory.newReservation()
        resvEx.startDT = datetime( 2006, 12, 01, 10 )
        resvEx.endDT = datetime( 2006, 12, 14, 15 )
        #resvEx.bookedForName = 'Jean-Jacques Blais'
        resvs = ReservationBase.getReservations( resvExample = resvEx, rooms = [roomEx] )

        for resv in resvs:
            print "============================="
            print resv
        
        Test.dalManager.disconnect()
Exemple #11
0
 def countReservations( *args, **kwargs ):
     """ Documentation in base class. """
     kwargs['countOnly'] = True
     return ReservationBase.getReservations( **kwargs )