def post(self): Guser = users.get_current_user() if Guser: strFirstnames = self.request.get('vstrFirstnames') strSurname = self.request.get('vstrSurname') strIDNumber = self.request.get('vstrIDNumber') strEmployeeCode = self.request.get('vstrEmployeeCode') strBranchCode = self.request.get('vstrBranchCode') URL = str(self.request.url) URLList = URL.split("/") strReference = URLList[len(URLList) - 1] findRequest = EmploymentDetails.query( EmploymentDetails.strReference == strReference) EmployeeList = findRequest.fetch() Employee = EmploymentDetails() if len(EmployeeList) > 0: Employee = EmployeeList[0] else: pass Employee.writeReference(strinput=strReference) Employee.writeEmployeeCode(strinput=strEmployeeCode) Employee.writeBranchWorking(strinput=strBranchCode) Employee.writeIDNumber(strinput=strIDNumber) Employee.writeSurname(strinput=strSurname) Employee.writeNames(strinput=strFirstnames) Employee.put() FindRequest = EmployeeRegRequest.query( EmployeeRegRequest.strReference == strReference) EmployeeReqList = FindRequest.fetch() findRequest = UserRights.query( UserRights.strReference == strReference) UserRightsList = findRequest.fetch() UserRight = UserRights() if len(UserRightsList) > 0: UserRight = UserRightsList[0] UserRight.writeReference(strinput=strReference) UserRight.writeEmployeeCode(strinput=strEmployeeCode) UserRight.put() if len(EmployeeReqList) > 0: EmployeeReq = EmployeeReqList[0] try: EmployeeReq.key.delete() except: pass else: pass template = template_env.get_template( 'templates/dynamic/admin/personalsresponse.html') context = { 'vstrFirstnames': strFirstnames, 'vstrSurname': strSurname, 'vstrIDNumber': strIDNumber, 'vstrEmployeeCode': strEmployeeCode, 'vstrReference': strReference, 'vstrBranchCode': strBranchCode } self.response.write(template.render(context))
def post(self): Guser = users.get_current_user() if Guser: strBranchCode = self.request.get('vstrBranchCode') strEmployeeCode = self.request.get('vstrEmployeeCode') strContractType = self.request.get('vstrContractType') strBasicSalary = self.request.get('vstrBasicSalary') strDateOfEmployment = self.request.get('vstrDateOfEmployment') strTitle = self.request.get('vstrTitle') strFullnames = self.request.get('vstrFullnames') strSurname = self.request.get('vstrSurname') strIDNumber = self.request.get('vstrIDNumber') strDateOfBirth = self.request.get('vstrDateOfBirth') strNationality = self.request.get('vstrNationality') strPhysicalAddressL1 = self.request.get('vstrPhysicalAddressL1') strPhysicalAddressL2 = self.request.get('vstrPhysicalAddressL2') strCityTown = self.request.get('vstrCityTown') strProvince = self.request.get('vstrProvince') strPhysicalPostalCode = self.request.get('vstrPhysicalPostalCode') strPostalAddressL1 = self.request.get('vstrPostalAddressL1') strPostalAddressL2 = self.request.get('vstrPostalAddressL2') strPostalCityTown = self.request.get('vstrPostalCityTown') strPostalProvince = self.request.get('vstrPostalProvince') strPostalCode = self.request.get('vstrPostalCode') strAccountHolder = self.request.get('vstrAccountHolder') strBankName = self.request.get('vstrBankName') strAccountType = self.request.get('vstrAccountType') strAccountNumber = self.request.get('vstrAccountNumber') strBankBranchCode = self.request.get('vstrBankBranchCode') strCell = self.request.get('vstrCell') strTel = self.request.get('vstrTel') strEmail = self.request.get('vstrEmail') vstrIsEmployee = self.request.get('vstrIsEmployee') vstrAccessEmployeeAdmin = self.request.get( 'vstrAccessEmployeeAdmin') vstrSearchLoans = self.request.get('vstrSearchLoans') vstrEditLoans = self.request.get('vstrEditLoans') vstrSearchLeadsForm = self.request.get('vstrSearchLeadsForm') vstrEditLeadsForm = self.request.get('vstrEditLeadsForm') vstrDeleteLoans = self.request.get('vstrDeleteLoans') vstrLoanReprint = self.request.get('vstrReprintLoans') vstrProcessPayment = self.request.get('vstrProcessPayment') vstrSendPayment = self.request.get('vstrSendPayment') findRequest = EmploymentDetails.query( EmploymentDetails.strEmployeeCode == strEmployeeCode) EmpResult = findRequest.fetch() if len(EmpResult) > 0: Employee = EmpResult[0] else: Employee = EmploymentDetails() try: Employee.writeEmployeeCode(strinput=strEmployeeCode) Employee.writeBranchWorking(strinput=strBranchCode) Employee.writeContractType(strinput=strContractType) Employee.writeBasicSalary(strinput=strBasicSalary) Employee.writeDateOfEmployment(strinput=strDateOfEmployment) Employee.writeTitle(strinput=strTitle) Employee.writeNames(strinput=strFullnames) Employee.writeSurname(strinput=strSurname) Employee.writeIDNumber(strinput=strIDNumber) Employee.writeDateOfBirth(strinput=strDateOfBirth) Employee.writeNationality(strinput=strNationality) Employee.put() except: pass findRequest = ResidentialAddress.query( ResidentialAddress.strEmployeeCode == strEmployeeCode) PhysicalResult = findRequest.fetch() if len(PhysicalResult) > 0: PhysicalAddress = PhysicalResult[0] else: PhysicalAddress = ResidentialAddress() try: PhysicalAddress.writeEmployeeCode(strinput=strEmployeeCode) PhysicalAddress.writeResAddressL1( strinput=strPhysicalAddressL1) PhysicalAddress.writeResAddressL2( strinput=strPhysicalAddressL2) PhysicalAddress.writeCityTown(strinput=strCityTown) PhysicalAddress.writeProvince(strinput=strProvince) PhysicalAddress.writePostalCode(strinput=strPhysicalPostalCode) PhysicalAddress.put() except: pass findRequest = PostalAddress.query( PostalAddress.strEmployeeCode == strEmployeeCode) PostalList = findRequest.fetch() if len(PostalList) > 0: PostalAddy = PostalList[0] else: PostalAddy = PostalAddress() try: PostalAddy.writeEmployeeCode(strinput=strEmployeeCode) PostalAddy.writePostalAddressL1(strinput=strPostalAddressL1) PostalAddy.writePostalAddressL2(strinput=strPostalAddressL2) PostalAddy.writeTownCity(strinput=strPostalCityTown) PostalAddy.writeProvince(strinput=strPostalProvince) PostalAddy.writePostalCode(strinput=strPostalCode) PostalAddy.put() except: pass findRequest = ContactDetails.query( ContactDetails.strEmployeeCode == strEmployeeCode) ContactList = findRequest.fetch() if len(ContactList) > 0: Contacts = ContactList[0] else: Contacts = ContactDetails() try: Contacts.writeEmployeeCode(strinput=strEmployeeCode) Contacts.writeCell(strinput=strCell) Contacts.writeTel(strinput=strTel) Contacts.writeEmail(strinput=strEmail) Contacts.put() except: pass findRequester = BankingDetails.query( BankingDetails.strEmployeeCode == strEmployeeCode) BankingList = findRequester.fetch() if len(BankingList) > 0: Banking = BankingList[0] else: Banking = BankingDetails() try: Banking.writeEmployeeCode(strinput=strEmployeeCode) Banking.writeAccountHolder(strinput=strAccountHolder) Banking.writeAccountNumber(strinput=strAccountNumber) Banking.writeAccountType(strinput=strAccountType) Banking.writeBankName(strinput=strBankName) Banking.writeBranchCode(strinput=strBankBranchCode) Banking.put() except: pass findRequest = WorkingAccount.query( WorkingAccount.strReference == Employee.strReference) AllOpenPolicies = findRequest.fetch() try: for OpenPols in AllOpenPolicies: OpenPols.strActivated = True OpenPols.put() except: pass findRequest = UserRights.query( UserRights.strReference == Employee.strReference) UserRightsList = findRequest.fetch() if len(UserRightsList) > 0: EmployeeRights = UserRightsList[0] EmployeeRights.writeEmployeeCode(strinput=strEmployeeCode) if vstrIsEmployee == "YES": EmployeeRights.bolIsEmployee = True else: EmployeeRights.bolIsEmployee = False if vstrAccessEmployeeAdmin == "YES": EmployeeRights.bolAccessToEmployeesAdminForm = True else: EmployeeRights.bolAccessToEmployeesAdminForm = False if vstrSearchLoans == "YES": EmployeeRights.bolEmployeesLoanFormReadAccess = True else: EmployeeRights.bolEmployeesLoanFormReadAccess = False if vstrEditLoans == "YES": EmployeeRights.bolEmployeesLoanFormWriteAccess = True else: EmployeeRights.bolEmployeesLoanFormWriteAccess = False if vstrSearchLeadsForm == "YES": EmployeeRights.bolEmployeesLeadsFormReadAccess = True else: EmployeeRights.bolEmployeesLeadsFormReadAccess = False if vstrEditLeadsForm == "YES": EmployeeRights.bolEmployeesLeadsFormWriteAccess = True else: EmployeeRights.bolEmployeesLeadsFormWriteAccess = False if vstrDeleteLoans == "YES": EmployeeRights.bolEmployeesLoanFormDeleteAccess = True else: EmployeeRights.bolEmployeesLoanFormDeleteAccess = False if vstrLoanReprint == "YES": EmployeeRights.bolEmployeesLoanFormReprintAccess = True else: EmployeeRights.bolEmployeesLoanFormReprintAccess = False if vstrProcessPayment == "YES": EmployeeRights.bolEmployeeLoanFormProcessPayment = True else: EmployeeRights.bolEmployeeLoanFormProcessPayment = False if vstrSendPayment == "YES": EmployeeRights.bolEmployeeLoanFormSendPayment = True else: EmployeeRights.bolEmployeeLoanFormSendPayment = False EmployeeRights.put() selfURL = "/admin/employees/" + strEmployeeCode self.redirect(selfURL) else: self.redirect("/")