예제 #1
0
    def show_createcont(choice, pk):
        reqobject = RequestGateway.find_by_id(_id=pk)
        print(reqobject.lastname)
        if choice == u'show':
            print(0)

            #reqobject.department = DepartGateway.find_by_id(reqobject.department_id).full_name()
            #reqobject.position=PositionGateway.find_by_id(reqobject.position_id).name
            pos = PositionGateway.find_by_id(_id=reqobject.position_id)
            dep = DepartGateway.find_by_id(_id=reqobject.department_id)
            if pos != None:
                reqobject.position = pos.name
            if dep != None:
                reqobject.depart = dep.full_name()

            context = {
                'reqobject': reqobject,
                'answer': 1
            }
            return context

        if choice == u'createcont':               #ABSTRACT
            lastname = reqobject.lastname
            firstname = reqobject.firstname
            patronymic = reqobject.patronymic
            position_id = reqobject.position_id
            department_id = reqobject.department_id
            passport_serial = reqobject.passport_serial
            passport_number = reqobject.passport_number
            phone_number = reqobject.phone_number

            person = PersonGateway(lastname=lastname, firstname=firstname, patronymic=patronymic,
                                   position_id=position_id, department_id=department_id,
                                   passport_serial=passport_serial,
                                   passport_number=passport_number, phone_number=phone_number, is_active=True)
            person.save()

            position_id = person.position_id
            department_id = person.department_id

            permit = ContinuousPermitEmplementation.create_permit(person.id, reqobject.registration_date, reqobject.end_date,
                                                                  lastname, firstname, patronymic,
                                                             position_id, department_id)
            pos = PositionGateway.find_by_id(_id=permit.position_id)
            dep = DepartGateway.find_by_id(_id=permit.department_id)
            if pos != None:
                permit.position = pos.name
            if dep != None:
                permit.department = dep.full_name()



            reqobject.done()          #DOMAIN in request system

            context = {

                'permit': permit,
                'answer': u'cont'
            }
            return context
예제 #2
0
    def show_createcont(choice, pk):
        reqobject = RequestGateway.find_by_id(_id=pk)
        print(reqobject.lastname)
        if choice == u'show':
            print(0)

            #reqobject.department = DepartGateway.find_by_id(reqobject.department_id).full_name()
            #reqobject.position=PositionGateway.find_by_id(reqobject.position_id).name
            pos = PositionGateway.find_by_id(_id=reqobject.position_id)
            dep = DepartGateway.find_by_id(_id=reqobject.department_id)
            if pos != None:
                reqobject.position = pos.name
            if dep != None:
                reqobject.depart = dep.full_name()

            context = {'reqobject': reqobject, 'answer': 1}
            return context

        if choice == u'createcont':  #ABSTRACT
            lastname = reqobject.lastname
            firstname = reqobject.firstname
            patronymic = reqobject.patronymic
            position_id = reqobject.position_id
            department_id = reqobject.department_id
            passport_serial = reqobject.passport_serial
            passport_number = reqobject.passport_number
            phone_number = reqobject.phone_number

            person = PersonGateway(lastname=lastname,
                                   firstname=firstname,
                                   patronymic=patronymic,
                                   position_id=position_id,
                                   department_id=department_id,
                                   passport_serial=passport_serial,
                                   passport_number=passport_number,
                                   phone_number=phone_number,
                                   is_active=True)
            person.save()

            position_id = person.position_id
            department_id = person.department_id

            permit = ContinuousPermitEmplementation.create_permit(
                person.id, reqobject.registration_date, reqobject.end_date,
                lastname, firstname, patronymic, position_id, department_id)
            pos = PositionGateway.find_by_id(_id=permit.position_id)
            dep = DepartGateway.find_by_id(_id=permit.department_id)
            if pos != None:
                permit.position = pos.name
            if dep != None:
                permit.department = dep.full_name()

            reqobject.done()  #DOMAIN in request system

            context = {'permit': permit, 'answer': u'cont'}
            return context
예제 #3
0
    def temp_permit(request,pk):
        person = PersonGateway.find_by_id(_id=pk)
        lastname = person.lastname
        firstname = person.firstname
        patronymic = person.patronymic
        registration_date = datetime.date.today()
        end_date = datetime.date.today()
        position_id = person.position_id
        department_id = person.department_id

        permit = TemporaryPermitEmplementation.create_permit(person.id, registration_date,
                                                              end_date,
                                                              lastname, firstname, patronymic,
                                                              position_id, department_id)
        pos = PositionGateway.find_by_id(_id=permit.position_id)
        dep = DepartGateway.find_by_id(_id=permit.department_id)
        if pos != None:
            permit.position = pos.name
        if dep != None:
            permit.department = dep.full_name()

        context = {

            'permit': permit,
            'answer': u'temp'
        }
        return context
예제 #4
0
    def permits_of_person(pk):
        person = PersonGateway.find_by_id(_id=pk)
        person.department = DepartGateway.find_by_id(
            _id=person.department_id).full_name()
        person.position = PositionGateway.find_by_id(
            _id=person.position_id).name
        permits = PermitGateway.find_by_fields(person=person)
        for permit in permits:
            pos = PositionGateway.find_by_id(_id=permit.position_id)
            dep = DepartGateway.find_by_id(_id=permit.department_id)
            if pos != None:
                permit.position = pos.name
            if dep != None:
                permit.department = dep.full_name()

        context = {'permits': permits, 'person': person}
        return context
예제 #5
0
    def permits_of_person(pk):
        person = PersonGateway.find_by_id(_id = pk)
        person.department = DepartGateway.find_by_id(_id= person.department_id).full_name()
        person.position = PositionGateway.find_by_id(_id = person.position_id).name
        permits = PermitGateway.find_by_fields(person = person)
        for permit in permits:
            pos = PositionGateway.find_by_id(_id=permit.position_id)
            dep = DepartGateway.find_by_id(_id=permit.department_id)
            if pos != None:
                permit.position = pos.name
            if dep != None:
                permit.department = dep.full_name()

        context = {
            'permits': permits,
            'person': person
        }
        return context
예제 #6
0
 def request_for_permit(id):
     req = RequestGateway.find_by_id(_id=id)
     position = PositionGateway.find_by_id(_id=req.position_id)
     depart = DepartGateway.find_by_id(_id=req.department_id)
     if position != None:
         req.position = position.name
     if depart != None:
         req.depart = depart.full_name()
     context = {'request': req}
     return context
예제 #7
0
 def request_for_permit(id):
     req = RequestGateway.find_by_id(_id=id)
     position = PositionGateway.find_by_id(_id=req.position_id)
     depart = DepartGateway.find_by_id(_id=req.department_id)
     if position != None:
         req.position = position.name
     if depart != None:
         req.depart = depart.full_name()
     context = {
         'request': req
     }
     return context
예제 #8
0
 def requests(request):
     requests = RequestGateway.all()
     for req in requests:
         position = PositionGateway.find_by_id(_id=req.position_id)
         depart = DepartGateway.find_by_id(_id=req.department_id)
         if position != None:
             req.position = position.name
         if depart != None:
             req.depart = depart.full_name()
     context = {
         'requests': requests,
     }
     return context
예제 #9
0
 def print_permit(pk):
     permit = PermitGateway.find_by_id(_id=pk)
     pos = PositionGateway.find_by_id(_id=permit.position_id)
     dep = DepartGateway.find_by_id(_id=permit.department_id)
     if pos != None:
         permit.position = pos.name
     if dep != None:
         permit.department = dep.full_name()
     permit.id = pk
     context = {
         'permit': permit,
     }
     return context
예제 #10
0
 def requests(request):
     requests = RequestGateway.all()
     for req in requests:
         position = PositionGateway.find_by_id(_id= req.position_id)
         depart = DepartGateway.find_by_id(_id = req.department_id)
         if position != None:
             req.position = position.name
         if depart != None:
             req.depart = depart.full_name()
     context = {
         'requests': requests,
     }
     return context
예제 #11
0
 def print_permit(pk):
     permit = PermitGateway.find_by_id(_id=pk)
     pos = PositionGateway.find_by_id(_id=permit.position_id)
     dep = DepartGateway.find_by_id(_id=permit.department_id)
     if pos != None:
         permit.position = pos.name
     if dep != None:
         permit.department = dep.full_name()
     permit.id = pk
     context = {
         'permit': permit,
     }
     return context
예제 #12
0
    def persons(request):
        persons = PersonGateway.all()
        for per in persons:
            pos = PositionGateway.find_by_id(_id=per.position_id)
            if pos != None:
                per.position = pos.name
            dep = DepartGateway.find_by_id(_id=per.department_id)
            if dep != None:
                per.department = dep.full_name()

        context = {
            'persons': persons,
        }
        return context
예제 #13
0
    def persons(request):
        persons = PersonGateway.all()
        for per in persons:
            pos = PositionGateway.find_by_id(_id=per.position_id)
            if pos != None:
                per.position = pos.name
            dep = DepartGateway.find_by_id(_id=per.department_id)
            if dep !=None:
                per.department = dep.full_name()

        context = {
            'persons': persons,
        }
        return context
예제 #14
0
    def temp_permit(request, pk):
        person = PersonGateway.find_by_id(_id=pk)
        lastname = person.lastname
        firstname = person.firstname
        patronymic = person.patronymic
        registration_date = datetime.date.today()
        end_date = datetime.date.today()
        position_id = person.position_id
        department_id = person.department_id

        permit = TemporaryPermitEmplementation.create_permit(
            person.id, registration_date, end_date, lastname, firstname,
            patronymic, position_id, department_id)
        pos = PositionGateway.find_by_id(_id=permit.position_id)
        dep = DepartGateway.find_by_id(_id=permit.department_id)
        if pos != None:
            permit.position = pos.name
        if dep != None:
            permit.department = dep.full_name()

        context = {'permit': permit, 'answer': u'temp'}
        return context