=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java' --- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java 2014-01-05 14:04:13 +0000 +++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java 2014-01-06 13:23:58 +0000 @@ -734,7 +734,9 @@ + CaseAggregationCondition.SEPARATOR_OBJECT + max + ".age]"; updateFixedAttributeInCaseAggregate( source, target ); + // ------------------------------------------------------------- // Patient full name + // ------------------------------------------------------------- uid = CodeGenerator.generateCode(); executeSql( "INSERT INTO patientattribute (patientattributeid, uid, lastUpdated, name, description, valueType, mandatory, inherit, displayOnVisitSchedule ) VALUES (" @@ -752,7 +754,7 @@ removeFixedAttributeInCustomRegistrationForm( "fullName", uid ); // update template messsages - updateFixedAttributeInTemplateMessage(); + updateFixedAttributeInTemplateMessage(uid); executeSql( "ALTER TABLE patient DROP COLUMN gender" ); executeSql( "ALTER TABLE patient DROP COLUMN deathDate" ); @@ -802,24 +804,22 @@ } } - private void updateFixedAttributeInTemplateMessage() + private void updateFixedAttributeInTemplateMessage( String uid ) { StatementHolder holder = statementManager.getHolder(); try { Statement statement = holder.getStatement(); - ResultSet resultSet = statement.executeQuery( "" ); + ResultSet resultSet = statement + .executeQuery( "SELECT patientreminderid, templatemessage FROM patientreminder where templatemessage like '%{patient-name}%'" ); while ( resultSet.next() ) { String id = resultSet.getString( "patientreminderid" ); String expression = resultSet.getString( "templatemessage" ); - expression = expression - .replaceAll( - "SELECT patientreminderid, templatemessage FROM patientreminder where templatemessage like '%{patient-name}%'", - "Sir/Madam" ); + expression = expression.replaceAll( "{patient-name}", "{attributeid=" + uid + "}" ); executeSql( "UPDATE patientreminder SET templatemessage='" + expression + "' WHERE patientreminderid=" + id ); } === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientreminder/GetPatientReminderAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientreminder/GetPatientReminderAction.java 2014-01-06 06:29:46 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientreminder/GetPatientReminderAction.java 2014-01-06 13:23:58 +0000 @@ -27,10 +27,15 @@ package org.hisp.dhis.patient.action.patientreminder; +import java.util.ArrayList; +import java.util.List; + import org.hisp.dhis.patient.PatientReminder; import org.hisp.dhis.patient.PatientReminderService; import org.hisp.dhis.program.Program; import org.hisp.dhis.program.ProgramService; +import org.hisp.dhis.user.UserGroup; +import org.hisp.dhis.user.UserGroupService; import com.opensymphony.xwork2.Action; @@ -60,6 +65,13 @@ this.patientReminderService = patientReminderService; } + private UserGroupService userGroupService; + + public void setUserGroupService( UserGroupService userGroupService ) + { + this.userGroupService = userGroupService; + } + // ------------------------------------------------------------------------- // Input && Output // ------------------------------------------------------------------------- @@ -92,6 +104,13 @@ return reminder; } + private List userGroups; + + public List getUserGroups() + { + return userGroups; + } + // ------------------------------------------------------------------------- // Action implementation // ------------------------------------------------------------------------- @@ -103,7 +122,9 @@ reminder = patientReminderService.getPatientReminder( id ); program = programService.getProgram( programId ); - + + userGroups = new ArrayList( userGroupService.getAllUserGroups() ); + return SUCCESS; } } === added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientreminder/ShowAddProgramPatientReminderAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientreminder/ShowAddProgramPatientReminderAction.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientreminder/ShowAddProgramPatientReminderAction.java 2014-01-06 13:23:58 +0000 @@ -0,0 +1,101 @@ +/* + * Copyright (c) 2004-2013, University of Oslo + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * * Neither the name of the HISP project nor the names of its contributors may + * be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package org.hisp.dhis.patient.action.patientreminder; + +import java.util.ArrayList; +import java.util.List; + +import org.hisp.dhis.program.Program; +import org.hisp.dhis.program.ProgramService; +import org.hisp.dhis.user.UserGroup; +import org.hisp.dhis.user.UserGroupService; + +import com.opensymphony.xwork2.Action; + +/** + * @author Chau Thu Tran + * + * @version $ ShowAddProgramPatientReminderAction.java Jan 6, 2014 7:51:48 PM $ + */ +public class ShowAddProgramPatientReminderAction + implements Action +{ + private ProgramService programService; + + public void setProgramService( ProgramService programService ) + { + this.programService = programService; + } + + private UserGroupService userGroupService; + + public void setUserGroupService( UserGroupService userGroupService ) + { + this.userGroupService = userGroupService; + } + + // ------------------------------------------------------------------------- + // Input/Output + // ------------------------------------------------------------------------- + + private int id; + + public void setId( int id ) + { + this.id = id; + } + + private Program program; + + public Program getProgram() + { + return program; + } + + private List userGroups; + + public List getUserGroups() + { + return userGroups; + } + + // ------------------------------------------------------------------------- + // Action implementation + // ------------------------------------------------------------------------- + + public String execute() + throws Exception + { + program = programService.getProgram( id ); + + userGroups = new ArrayList( userGroupService.getAllUserGroups() ); + + return SUCCESS; + } + +} === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml 2014-01-06 06:29:46 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml 2014-01-06 13:23:58 +0000 @@ -1180,8 +1180,9 @@ scope="prototype"> + - + + + + + \ No newline at end of file === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml 2014-01-06 11:40:36 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml 2014-01-06 13:23:58 +0000 @@ -1180,7 +1180,7 @@ + class="org.hisp.dhis.patient.action.patientreminder.ShowAddProgramPatientReminderAction"> /main.vm /dhis-web-maintenance-patient/addProgramPatientReminder.vm javascript/commons.js,javascript/programPatientReminder.js === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramStageForm.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramStageForm.vm 2013-12-31 03:05:28 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramStageForm.vm 2014-01-06 13:23:58 +0000 @@ -275,4 +275,12 @@ #foreach($programStage in $program.programStages) programStageList.push("$programStage.displayName"); #end + + var idenAttrOptions = ""; + #foreach($identifierType in $program.patientIdentifierTypes) + idenAttrOptions+=""; + #end + #foreach($patientAttribute in $program.patientAttributes) + idenAttrOptions+=""; + #end \ No newline at end of file === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/programPatientReminder.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/programPatientReminder.js 2014-01-06 08:56:57 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/programPatientReminder.js 2014-01-06 13:23:58 +0000 @@ -159,4 +159,11 @@ else { enable('messageType'); } + + if( value == "5" ){ + enable('userGroup'); + } + else{ + disable('userGroup'); + } } === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/programStage.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/programStage.js 2013-12-17 01:29:04 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/programStage.js 2014-01-06 13:23:58 +0000 @@ -378,12 +378,12 @@ + '' + i18n_params + '' + '' + '' + '' + '' === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramPatientReminder.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramPatientReminder.vm 2014-01-06 08:56:57 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramPatientReminder.vm 2014-01-06 13:23:58 +0000 @@ -122,7 +122,7 @@ - #foreach($eachGroup in $userGroups) === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramStageForm.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramStageForm.vm 2013-12-31 03:05:28 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramStageForm.vm 2014-01-06 13:23:58 +0000 @@ -316,12 +316,17 @@ $i18n.getString( "params" ) @@ -387,4 +392,13 @@ var i18n_direct_sms = '$encoder.jsEscape( $i18n.getString( "direct_sms" ) , "'")'; var i18n_message = '$encoder.jsEscape( $i18n.getString( "message" ) , "'")'; var i18n_both = '$encoder.jsEscape( $i18n.getString( "both" ) , "'")'; + + var idenAttrOptions = ""; + #foreach($identifierType in $programStage.program.patientIdentifierTypes) + idenAttrOptions+=""; + #end + #foreach($patientAttribute in $programStage.program.patientAttributes) + idenAttrOptions+=""; + #end + \ No newline at end of file