=== modified file 'local/bd/dhis-web-linelisting-manpower/src/main/java/org/hisp/dhis/ll/action/lldataentry/SaveEmplyeePostAction.java' --- local/bd/dhis-web-linelisting-manpower/src/main/java/org/hisp/dhis/ll/action/lldataentry/SaveEmplyeePostAction.java 2010-11-19 12:52:40 +0000 +++ local/bd/dhis-web-linelisting-manpower/src/main/java/org/hisp/dhis/ll/action/lldataentry/SaveEmplyeePostAction.java 2010-11-20 12:16:50 +0000 @@ -10,6 +10,8 @@ import org.apache.struts2.ServletActionContext; import org.hisp.dhis.dbmanager.DataBaseManagerInterface; import org.hisp.dhis.i18n.I18nFormat; +import org.hisp.dhis.linelisting.Employee; +import org.hisp.dhis.linelisting.EmployeeService; import org.hisp.dhis.linelisting.LineListDataValue; import org.hisp.dhis.linelisting.LineListElement; import org.hisp.dhis.linelisting.LineListGroup; @@ -27,9 +29,11 @@ implements Action { - // --------------------------------------------------------------------------- + //-------------------------------------------------------------------------- + // - // Dependencies - // --------------------------------------------------------------------------- + //-------------------------------------------------------------------------- + // - private LineListService lineListService; @@ -73,18 +77,27 @@ this.periodService = periodService; } - // --------------------------------------------------------------------------- + private EmployeeService employeeService; + + public void setEmployeeService( EmployeeService employeeService ) + { + this.employeeService = employeeService; + } + + //-------------------------------------------------------------------------- + // - // Input/Output - // --------------------------------------------------------------------------- + //-------------------------------------------------------------------------- + // - private String department; public void setDepartment( String department ) { this.department = department; } - + private String post; - + public void setPost( String post ) { this.post = post; @@ -110,14 +123,14 @@ { this.reportingDate = reportingDate; } - + public String getReportingDate() { return reportingDate; } - + private String dataValueMapKey; - + public String getDataValueMapKey() { return dataValueMapKey; @@ -140,12 +153,11 @@ this.dataValue = dataValue; } - private LineListGroup lineListGroup; - // -------------------------------------------------------------------------- + //-------------------------------------------------------------------------- // Action Implementation - // -------------------------------------------------------------------------- + //-------------------------------------------------------------------------- public String execute() { @@ -156,6 +168,8 @@ Collection linelistElements = lineListService.getLineListGroup( groupid ) .getLineListElements(); + String pdsCode = ""; + lineListGroup = selectedStateManager.getSelectedLineListGroup(); OrganisationUnit organisationUnit = selectedStateManager.getSelectedOrganisationUnit(); @@ -165,30 +179,39 @@ int recordNo = dbManagerInterface.getMaxRecordNumber( department ) + 1; Map llElementValuesMap = new HashMap(); + LineListDataValue llDataValue = new LineListDataValue(); + int i = 0; for ( LineListElement linelistElement : linelistElements ) { String linelistElementValue = request.getParameter( linelistElement.getShortName() ); - - System.out.println("Linelist Em=lement name is :" + linelistElement.getShortName() + " And Linlelist Value is:" + linelistElementValue ); - - if( linelistElementValue == null ) + + // Hardcoding to get PDSCode of Employee + + if ( i == 0 ) + { + pdsCode = linelistElementValue; + } + + System.out.println( "Linelist Element name is :" + linelistElement.getShortName() + + " And Linlelist Value is:" + linelistElementValue ); + + if ( linelistElementValue == null ) { continue; } - + if ( linelistElementValue != null && linelistElementValue.trim().equals( "" ) ) { - linelistElementValue = ""; + linelistElementValue = ""; } llElementValuesMap.put( linelistElement.getShortName(), linelistElementValue ); - + i++; } String postColumnId = linelistElements.iterator().next().getShortName(); llElementValuesMap.put( postColumnId, post ); - System.out.println("*********"+postColumnId + " ------ " + post + "**********"); - + // add map in linelist data value llDataValue.setLineListValues( llElementValuesMap ); @@ -198,7 +221,6 @@ // add recordNumber to pass to the update query llDataValue.setRecordNumber( recordNo ); - // add stored by, timestamp in linelist data value storedBy = currentUserService.getCurrentUsername(); @@ -215,6 +237,13 @@ { System.out.println( "Values Successfully Inserted in DB" ); } + Employee employee = employeeService.getEmployeeByPDSCode( pdsCode ); + + if ( employee != null ) + { + employee.setIsTransferred( false ); + employeeService.updateEmployee( employee ); + } return SUCCESS; } === modified file 'local/bd/dhis-web-linelisting-manpower/src/main/java/org/hisp/dhis/ll/action/lldataentry/UpdateEmployeePostAction.java' --- local/bd/dhis-web-linelisting-manpower/src/main/java/org/hisp/dhis/ll/action/lldataentry/UpdateEmployeePostAction.java 2010-11-19 12:52:40 +0000 +++ local/bd/dhis-web-linelisting-manpower/src/main/java/org/hisp/dhis/ll/action/lldataentry/UpdateEmployeePostAction.java 2010-11-20 12:16:50 +0000 @@ -12,6 +12,8 @@ import org.apache.struts2.ServletActionContext; import org.hisp.dhis.dbmanager.DataBaseManagerInterface; import org.hisp.dhis.i18n.I18nFormat; +import org.hisp.dhis.linelisting.Employee; +import org.hisp.dhis.linelisting.EmployeeService; import org.hisp.dhis.linelisting.LineListDataValue; import org.hisp.dhis.linelisting.LineListElement; import org.hisp.dhis.linelisting.LineListGroup; @@ -38,6 +40,13 @@ { this.lineListService = lineListService; } + + private EmployeeService employeeService; + + public void setEmployeeService( EmployeeService employeeService ) + { + this.employeeService = employeeService; + } private SelectedStateManager selectedStateManager; @@ -141,15 +150,36 @@ Map llElementValuesMap = new HashMap(); LineListDataValue llDataValue = new LineListDataValue(); + int i = 0; + int lineListElementsSize = linelistElements.size() - 1; + String leftReason = null; + String pdsCode = ""; for ( LineListElement linelistElement : linelistElements ) { + String linelistElementValue = request.getParameter( linelistElement.getShortName() ); - + System.out.println("i="+i+" The Linelist Element value is ::::::::: " + linelistElementValue ); + + if ( i == 1 ) + { + pdsCode = linelistElementValue; + } + else if ( i == lineListElementsSize ) + { + leftReason = linelistElementValue; + } + + if ( linelistElementValue == null ) + { + i++; + continue; + } if ( linelistElementValue != null && linelistElementValue.trim().equals( "" ) ) { linelistElementValue = ""; } llElementValuesMap.put( linelistElement.getShortName(), linelistElementValue ); + i++; } String postColumnId = linelistElements.iterator().next().getShortName(); @@ -173,15 +203,26 @@ llDataValue.setStoredBy( storedBy ); List llDataValuesList = new ArrayList(); - + llDataValuesList.add( llDataValue ); + System.out.println("The values are ::::::::::" + llDataValuesList + " ----------and the table name is " + department ); boolean valueUpdated = dbManagerInterface.updateLLValue( llDataValuesList, department ); - + if ( valueUpdated ) { System.out.println( "Values Successfully Updated in DB" ); } + + Employee employee = employeeService.getEmployeeByPDSCode( pdsCode ); + + System.out.println("The PDSCode is :" + pdsCode + " And LeftReason is :" + leftReason ); + + if( employee != null && leftReason == "Transfer Reason" ) + { + employee.setIsTransferred( true ); + employeeService.updateEmployee( employee ); + } return SUCCESS; } === modified file 'local/bd/dhis-web-linelisting-manpower/src/main/resources/META-INF/dhis/beans.xml' --- local/bd/dhis-web-linelisting-manpower/src/main/resources/META-INF/dhis/beans.xml 2010-11-19 12:52:40 +0000 +++ local/bd/dhis-web-linelisting-manpower/src/main/resources/META-INF/dhis/beans.xml 2010-11-20 12:16:50 +0000 @@ -558,6 +558,9 @@ + + + @@ -588,6 +591,9 @@ + + + === modified file 'local/bd/dhis-web-linelisting-manpower/src/main/webapp/dhis-web-linelisting-mp/employeePost.vm' --- local/bd/dhis-web-linelisting-manpower/src/main/webapp/dhis-web-linelisting-mp/employeePost.vm 2010-11-19 12:52:40 +0000 +++ local/bd/dhis-web-linelisting-manpower/src/main/webapp/dhis-web-linelisting-mp/employeePost.vm 2010-11-20 12:16:50 +0000 @@ -65,7 +65,7 @@   - + === modified file 'local/bd/dhis-web-linelisting-manpower/src/main/webapp/dhis-web-linelisting-mp/select.vm' --- local/bd/dhis-web-linelisting-manpower/src/main/webapp/dhis-web-linelisting-mp/select.vm 2010-10-20 06:14:25 +0000 +++ local/bd/dhis-web-linelisting-manpower/src/main/webapp/dhis-web-linelisting-mp/select.vm 2010-11-20 12:16:50 +0000 @@ -7,17 +7,13 @@
- + - === modified file 'local/bd/dhis-web-linelisting-manpower/src/main/webapp/dhis-web-linelisting-mp/updateEmployeePostForm.vm' --- local/bd/dhis-web-linelisting-manpower/src/main/webapp/dhis-web-linelisting-mp/updateEmployeePostForm.vm 2010-11-19 12:52:40 +0000 +++ local/bd/dhis-web-linelisting-manpower/src/main/webapp/dhis-web-linelisting-mp/updateEmployeePostForm.vm 2010-11-20 12:16:50 +0000 @@ -59,7 +59,7 @@  
- +