dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #29552
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 14947: Apply web-api for Visit Schedule function ( DONE )
------------------------------------------------------------
revno: 14947
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2014-04-23 07:05:35 +0800
message:
Apply web-api for Visit Schedule function ( DONE )
removed:
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetDataRecordsAction.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/reminder/SendSmsToListAction.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/SearchTrackedEntityInstanceAction.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/activityPlanRecords.vm
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/event/EventStatus.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceService.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceStore.java
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/JdbcEventStore.java
dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityInstanceService.java
dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/hibernate/HibernateTrackedEntityInstanceStore.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/reminder/GetProgramStageInstanceByIdAction.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/activityPlan.js
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/smsReminder.js
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/searchTrackedEntityInstanceCriteria.vm
dhis-2/dhis-web/dhis-web-sms/src/main/java/org/hisp/dhis/sms/outcoming/SearchPatientAction.java
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/event/EventStatus.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/event/EventStatus.java 2014-04-19 12:01:55 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/event/EventStatus.java 2014-04-22 23:05:35 +0000
@@ -71,7 +71,7 @@
return false;
}
- return ACTIVE.equals( status ) || COMPLETED.equals( status ) || VISITED.equals( status );
+ return COMPLETED.equals( status ) || VISITED.equals( status );
}
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceService.java 2014-04-22 00:23:35 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceService.java 2014-04-22 23:05:35 +0000
@@ -380,4 +380,47 @@
*/
Collection<TrackedEntityInstance> getTrackedEntityInstancesByAttributeValue( String searchText, int attributeId,
Integer min, Integer max );
+
+ /**
+ * Search entityInstances by attribute values and/or a program which
+ * entityInstances enrolled into
+ *
+ * @param searchKeys The key for searching entityInstances by attribute
+ * values, identifiers and/or a program
+ * @param orgunit Organisation unit where entityInstances registered
+ * @param followup Only getting entityInstances with program risked if this
+ * property is true. And getting entityInstances without program
+ * risked if its value is false
+ * @param attributes The attribute values of these attribute are displayed
+ * into result
+ * @param statusEnrollment The status of program of entityInstances. There
+ * are three status, includes Active enrollments only, Completed
+ * enrollments only and Active and completed enrollments
+ * @param min
+ * @param max
+ *
+ * @return An object
+ */
+ Collection<TrackedEntityInstance> searchTrackedEntityInstances( List<String> searchKeys,
+ Collection<OrganisationUnit> orgunit, Boolean followup, Collection<TrackedEntityAttribute> attributes,
+ Integer statusEnrollment, Integer min, Integer max );
+
+ /**
+ * Get the number of entityInstances who meet the criteria for searching
+ *
+ * @param searchKeys The key for searching entityInstances by attribute
+ * values and/or a program
+ * @param orgunit Organisation unit where entityInstances registered
+ * @param followup Only getting entityInstances with program risked if this
+ * property is true. And getting entityInstances without program
+ * risked if its value is false
+ * @param statusEnrollment The status of program of entityInstances. There
+ * are three status, includes Active enrollments only, Completed
+ * enrollments only and Active and completed enrollments
+ *
+ * @return The number of entityInstances
+ */
+ int countSearchTrackedEntityInstances( List<String> searchKeys, Collection<OrganisationUnit> orgunit,
+ Boolean followup, Integer statusEnrollment );
+
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceStore.java 2014-04-22 00:23:35 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceStore.java 2014-04-22 23:05:35 +0000
@@ -50,9 +50,9 @@
final int MAX_RESULTS = 50000;
List<Map<String, String>> getTrackedEntityInstances( TrackedEntityInstanceQueryParams params );
-
+
int getTrackedEntityInstanceCount( TrackedEntityInstanceQueryParams params );
-
+
/**
* Search entityInstances who registered in a certain organisation unit
*
@@ -125,7 +125,7 @@
* @return List of instances
*/
Collection<TrackedEntityInstance> getByPhoneNumber( String phoneNumber, Integer min, Integer max );
-
+
/**
* Search events which meet the criteria for searching
*
@@ -161,17 +161,17 @@
Collection<TrackedEntityInstance> getByProgram( Program program, Integer min, Integer max );
/**
- * Validate entity-instances attribute values and validation criteria by program
- * before registering / updating information
+ * Validate entity-instances attribute values and validation criteria by
+ * program before registering / updating information
*
* @param entityinstance TrackedEntityInstance object
* @param program Program which person needs to enroll. If this parameter is
* null, the system check attribute values of the instances
* @param format I18nFormat
*
- * @return Error code 0 : Validation is OK
- * 1_<duplicate-value> : The attribute value is duplicated
- * 2_<validation-criteria-id> : Violate validation criteria of the program
+ * @return Error code 0 : Validation is OK 1_<duplicate-value> : The
+ * attribute value is duplicated 2_<validation-criteria-id> :
+ * Violate validation criteria of the program
*/
String validate( TrackedEntityInstance entityinstance, Program program, I18nFormat format );
@@ -185,7 +185,7 @@
*
* @return ValidationCriteria object which is violated
*/
- ValidationCriteria validateEnrollment(TrackedEntityInstance entityinstance, Program program, I18nFormat format );
+ ValidationCriteria validateEnrollment( TrackedEntityInstance entityinstance, Program program, I18nFormat format );
/**
* Validate instances attribute values and validation criteria by program
@@ -197,4 +197,46 @@
* @return TrackedEntityInstance list
*/
Collection<TrackedEntityInstance> getByAttributeValue( String searchText, int attributeId, Integer min, Integer max );
+
+ /**
+ * Search entityInstances by attribute values and/or a program which
+ * entityInstances enrolled into
+ *
+ * @param searchKeys The key for searching entityInstances by attribute
+ * values, identifiers and/or a program
+ * @param orgunit Organisation unit where entityInstances registered
+ * @param followup Only getting entityInstances with program risked if this
+ * property is true. And getting entityInstances without program
+ * risked if its value is false
+ * @param attributes The attribute values of these attribute are displayed
+ * into result
+ * @param statusEnrollment The status of program of entityInstances. There
+ * are three status, includes Active enrollments only, Completed
+ * enrollments only and Active and completed enrollments
+ * @param min
+ * @param max
+ *
+ * @return An object
+ */
+ Collection<TrackedEntityInstance> search( List<String> searchKeys, Collection<OrganisationUnit> orgunits,
+ Boolean followup, Collection<TrackedEntityAttribute> attributes, Integer statusEnrollment, Integer min,
+ Integer max );
+
+ /**
+ * Get the number of entityInstances who meet the criteria for searching
+ *
+ * @param searchKeys The key for searching entityInstances by attribute
+ * values and/or a program
+ * @param orgunit Organisation unit where entityInstances registered
+ * @param followup Only getting entityInstances with program risked if this
+ * property is true. And getting entityInstances without program
+ * risked if its value is false
+ * @param statusEnrollment The status of program of entityInstances. There
+ * are three status, includes Active enrollments only, Completed
+ * enrollments only and Active and completed enrollments
+ *
+ * @return The number of entityInstances
+ */
+ int countSearch( List<String> searchKeys, Collection<OrganisationUnit> orgunits, Boolean followup,
+ Integer statusEnrollment );
}
=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/JdbcEventStore.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/JdbcEventStore.java 2014-04-19 12:01:55 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/JdbcEventStore.java 2014-04-22 23:05:35 +0000
@@ -119,8 +119,9 @@
event.setProgramStage( rowSet.getString( "ps_uid" ) );
event.setStoredBy( rowSet.getString( "psi_completeduser" ) );
event.setOrgUnit( rowSet.getString( "ou_uid" ) );
- event.setEventDate( StringUtils.defaultIfEmpty( rowSet.getString( "psi_executiondate" ), rowSet.getString( "psi_duedate" ) ) );
-
+ event.setEventDate( StringUtils.defaultIfEmpty( rowSet.getString( "psi_executiondate" ),
+ rowSet.getString( "psi_duedate" ) ) );
+
if ( rowSet.getBoolean( "ps_capturecoordinates" ) )
{
Double longitude = rowSet.getDouble( "psi_longitude" );
@@ -176,14 +177,13 @@
{
SqlHelper hlp = new SqlHelper();
- String sql =
- "select p.uid as p_uid, ps.uid as ps_uid, ps.capturecoordinates as ps_capturecoordinates, pa.uid as pa_uid, psi.uid as psi_uid, psi.status as psi_status, ou.uid as ou_uid, " +
- "psi.executiondate as psi_executiondate, psi.duedate as psi_duedate, psi.completeduser as psi_completeduser, psi.longitude as psi_longitude, psi.latitude as psi_latitude, " +
- "pdv.value as pdv_value, pdv.storedby as pdv_storedby, pdv.providedelsewhere as pdv_providedelsewhere, de.uid as de_uid " +
- "from program p " +
- "left join programstage ps on ps.programid=p.programid " +
- "left join programstageinstance psi on ps.programstageid=psi.programstageid " +
- "left join programinstance pi on pi.programinstanceid=psi.programinstanceid ";
+ String sql = "select p.uid as p_uid, ps.uid as ps_uid, ps.capturecoordinates as ps_capturecoordinates, pa.uid as pa_uid, psi.uid as psi_uid, psi.status as psi_status, ou.uid as ou_uid, "
+ + "psi.executiondate as psi_executiondate, psi.duedate as psi_duedate, psi.completeduser as psi_completeduser, psi.longitude as psi_longitude, psi.latitude as psi_latitude, "
+ + "pdv.value as pdv_value, pdv.storedby as pdv_storedby, pdv.providedelsewhere as pdv_providedelsewhere, de.uid as de_uid "
+ + "from program p "
+ + "left join programstage ps on ps.programid=p.programid "
+ + "left join programstageinstance psi on ps.programstageid=psi.programstageid "
+ + "left join programinstance pi on pi.programinstanceid=psi.programinstanceid ";
if ( status == null || EventStatus.isExistingEvent( status ) )
{
@@ -191,15 +191,13 @@
}
else
{
- sql +=
- "left join trackedentityinstance tei on tei.trackedentityinstanceid=pi.trackedentityinstanceid " +
- "left join organisationunit ou on (tei.organisationunitid=ou.organisationunitid) ";
+ sql += "left join trackedentityinstance tei on tei.trackedentityinstanceid=pi.trackedentityinstanceid "
+ + "left join organisationunit ou on (tei.organisationunitid=ou.organisationunitid) ";
}
- sql +=
- "left join trackedentitydatavalue pdv on psi.programstageinstanceid=pdv.programstageinstanceid " +
- "left join dataelement de on pdv.dataelementid=de.dataelementid " +
- "left join trackedentityinstance pa on pa.trackedentityinstanceid=pi.trackedentityinstanceid ";
+ sql += "left join trackedentitydatavalue pdv on psi.programstageinstanceid=pdv.programstageinstanceid "
+ + "left join dataelement de on pdv.dataelementid=de.dataelementid "
+ + "left join trackedentityinstance pa on pa.trackedentityinstanceid=pi.trackedentityinstanceid ";
if ( trackedEntityInstanceId != null )
{
@@ -226,24 +224,60 @@
sql += hlp.whereAnd() + " pi.followup is " + (followUp ? "true" : "false") + " ";
}
- if ( orgUnitIds != null && !orgUnitIds.isEmpty() )
- {
- sql += hlp.whereAnd() + " ou.organisationunitid in (" + getCommaDelimitedString( orgUnitIds ) + ") ";
- }
-
- if ( startDate != null )
- {
- sql += hlp.whereAnd() + " psi.executiondate >= '" + getMediumDateString( startDate ) + "' ";
- }
-
- if ( endDate != null )
- {
- sql += hlp.whereAnd() + " psi.executiondate <= '" + getMediumDateString( endDate ) + "' ";
- }
-
- if ( status != null )
- {
- sql += hlp.whereAnd() + " psi.status = " + status.getValue() + " ";
+ if ( status == null || EventStatus.isExistingEvent( status ) )
+ {
+ if ( orgUnitIds != null && !orgUnitIds.isEmpty() )
+ {
+ sql += hlp.whereAnd() + " psi.organisationunitid in (" + getCommaDelimitedString( orgUnitIds ) + ") ";
+ }
+
+ if ( startDate != null )
+ {
+ sql += hlp.whereAnd() + " psi.executiondate >= '" + getMediumDateString( startDate ) + "' ";
+ }
+
+ if ( endDate != null )
+ {
+ sql += hlp.whereAnd() + " psi.executiondate <= '" + getMediumDateString( endDate ) + "' ";
+ }
+ }
+ else
+ {
+ if ( orgUnitIds != null && !orgUnitIds.isEmpty() )
+ {
+ sql += hlp.whereAnd() + " tei.organisationunitid in (" + getCommaDelimitedString( orgUnitIds ) + ") ";
+ }
+
+ if ( startDate != null )
+ {
+ sql += hlp.whereAnd() + " psi.duedate >= '" + getMediumDateString( startDate ) + "' ";
+ }
+
+ if ( endDate != null )
+ {
+ sql += hlp.whereAnd() + " psi.duedate <= '" + getMediumDateString( endDate ) + "' ";
+ }
+
+ if( status == EventStatus.VISITED )
+ {
+ sql = "and psi.completed = false and psi.status = 0";
+ }
+ else if( status == EventStatus.COMPLETED )
+ {
+ sql = "and psi.completed = true and psi.status = 0 ";
+ }
+ else if ( status == EventStatus.FUTURE_VISIT )
+ {
+ sql += "and psi.executiondate is null and date(now()) <= date(psi.duedate) and psi.status = 0 ";
+ }
+ else if ( status == EventStatus.LATE_VISIT )
+ {
+ sql += "and psi.executiondate is null and date(now()) > date(psi.duedate) and psi.status = 0 ";
+ }
+ else
+ {
+ sql += "and psi.status = " + status.getValue() + " ";
+ }
}
sql += " order by psi_uid;";
=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityInstanceService.java'
--- dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityInstanceService.java 2014-04-22 00:23:35 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityInstanceService.java 2014-04-22 23:05:35 +0000
@@ -81,7 +81,7 @@
implements TrackedEntityInstanceService
{
private static final Log log = LogFactory.getLog( DefaultTrackedEntityInstanceService.class );
-
+
// -------------------------------------------------------------------------
// Dependencies
// -------------------------------------------------------------------------
@@ -106,7 +106,7 @@
{
this.attributeService = attributeService;
}
-
+
private TrackedEntityService trackedEntityService;
public void setTrackedEntityService( TrackedEntityService trackedEntityService )
@@ -127,27 +127,27 @@
{
this.relationshipTypeService = relationshipTypeService;
}
-
+
private ProgramService programService;
public void setProgramService( ProgramService programService )
{
this.programService = programService;
}
-
+
private OrganisationUnitService organisationUnitService;
public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
{
this.organisationUnitService = organisationUnitService;
}
-
+
// -------------------------------------------------------------------------
// Implementation methods
// -------------------------------------------------------------------------
-
- //TODO lower index on attribute value?
-
+
+ // TODO lower index on attribute value?
+
@Override
public Grid getTrackedEntityInstances( TrackedEntityInstanceQueryParams params )
{
@@ -161,13 +161,14 @@
{
if ( !organisationUnit.hasLevel() )
{
- organisationUnit.setLevel( organisationUnitService.getLevelOfOrganisationUnit( organisationUnit.getId() ) );
+ organisationUnit
+ .setLevel( organisationUnitService.getLevelOfOrganisationUnit( organisationUnit.getId() ) );
}
}
-
+
// ---------------------------------------------------------------------
// If params of type query and no attributes or filters defined, use
- // attributes from program if exists, if not, use display-in-list
+ // attributes from program if exists, if not, use display-in-list
// attributes.
// ---------------------------------------------------------------------
@@ -175,14 +176,16 @@
{
if ( params.hasProgram() )
{
- params.addAttributesIfNotExist( QueryItem.getQueryItems( params.getProgram().getTrackedEntityAttributes() ) );
+ params.addAttributesIfNotExist( QueryItem.getQueryItems( params.getProgram()
+ .getTrackedEntityAttributes() ) );
}
- else
+ else
{
Collection<TrackedEntityAttribute> filters = attributeService.getAllTrackedEntityAttributes();
- Collection<TrackedEntityAttribute> attributes = attributeService.getTrackedEntityAttributesDisplayInList( true );
+ Collection<TrackedEntityAttribute> attributes = attributeService
+ .getTrackedEntityAttributesDisplayInList( true );
filters.removeAll( attributes );
-
+
params.addAttributesIfNotExist( QueryItem.getQueryItems( attributes ) );
params.addFiltersIfNotExist( QueryItem.getQueryItems( filters ) );
}
@@ -205,12 +208,12 @@
grid.addHeader( new GridHeader( LAST_UPDATED_ID, "Last updated" ) );
grid.addHeader( new GridHeader( ORG_UNIT_ID, "Org unit" ) );
grid.addHeader( new GridHeader( TRACKED_ENTITY_ID, "Tracked entity" ) );
-
+
for ( QueryItem item : params.getAttributes() )
{
grid.addHeader( new GridHeader( item.getItem().getUid(), item.getItem().getName() ) );
}
-
+
List<Map<String, String>> entities = trackedEntityInstanceStore.getTrackedEntityInstances( params );
// ---------------------------------------------------------------------
@@ -218,49 +221,49 @@
// ---------------------------------------------------------------------
Set<String> tes = new HashSet<String>();
-
+
for ( Map<String, String> entity : entities )
- {
+ {
grid.addRow();
grid.addValue( entity.get( TRACKED_ENTITY_INSTANCE_ID ) );
grid.addValue( entity.get( CREATED_ID ) );
grid.addValue( entity.get( LAST_UPDATED_ID ) );
grid.addValue( entity.get( ORG_UNIT_ID ) );
grid.addValue( entity.get( TRACKED_ENTITY_ID ) );
-
+
tes.add( entity.get( TRACKED_ENTITY_ID ) );
-
+
for ( QueryItem item : params.getAttributes() )
{
grid.addValue( entity.get( item.getItemId() ) );
}
}
- Map<Object, Object> metaData = new HashMap<Object, Object>();
+ Map<Object, Object> metaData = new HashMap<Object, Object>();
if ( params.isPaging() )
{
int count = trackedEntityInstanceStore.getTrackedEntityInstanceCount( params );
-
+
Pager pager = new Pager( params.getPageWithDefault(), count, params.getPageSizeWithDefault() );
metaData.put( PAGER_META_KEY, pager );
}
-
+
if ( !params.isSkipMeta() )
- {
+ {
Map<String, String> names = new HashMap<String, String>();
-
+
for ( String te : tes )
{
TrackedEntity entity = trackedEntityService.getTrackedEntity( te );
names.put( te, entity != null ? entity.getDisplayName() : null );
}
-
+
metaData.put( META_DATA_NAMES_KEY, names );
}
grid.setMetaData( metaData );
-
+
return grid;
}
@@ -269,7 +272,7 @@
throws IllegalQueryException
{
String violation = null;
-
+
if ( params == null )
{
throw new IllegalQueryException( "Params cannot be null" );
@@ -279,64 +282,65 @@
{
violation = "At least one organisation unit must be specified";
}
-
+
if ( params.hasProgram() && params.hasTrackedEntity() )
{
violation = "Program and tracked entity cannot be specified simultaneously";
}
-
+
if ( params.hasProgramStatus() && !params.hasProgram() )
{
violation = "Program must be defined when program status is defined";
}
-
+
if ( params.hasFollowUp() && !params.hasProgram() )
{
violation = "Program must be defined when follow up status is defined";
}
-
+
if ( params.hasProgramStartDate() && !params.hasProgram() )
{
violation = "Program must be defined when program start date is specified";
}
-
+
if ( params.hasProgramEndDate() && !params.hasProgram() )
{
violation = "Program must be defined when program end date is specified";
}
- if ( params.hasEventStatus() && ( !params.hasEventStartDate() || !params.hasEventEndDate() ) )
+ if ( params.hasEventStatus() && (!params.hasEventStartDate() || !params.hasEventEndDate()) )
{
violation = "Event start and end date must be specified when event status is specified";
}
-
+
if ( params.isOrQuery() && params.hasFilters() )
{
violation = "Query cannot be specified together with filters";
}
-
+
if ( !params.getDuplicateAttributes().isEmpty() )
{
violation = "Attributes cannot be specified more than once: " + params.getDuplicateAttributes();
}
-
+
if ( !params.getDuplicateFilters().isEmpty() )
{
violation = "Filters cannot be specified more than once: " + params.getDuplicateFilters();
}
-
+
if ( violation != null )
{
log.warn( "Validation failed: " + violation );
-
+
throw new IllegalQueryException( violation );
}
}
-
+
@Override
- public TrackedEntityInstanceQueryParams getFromUrl( String query, Set<String> attribute, Set<String> filter, Set<String> ou,
- OrganisationUnitSelectionMode ouMode, String program, ProgramStatus programStatus, Boolean followUp, Date programStartDate, Date programEndDate,
- String trackedEntity, EventStatus eventStatus, Date eventStartDate, Date eventEndDate, boolean skipMeta, Integer page, Integer pageSize )
+ public TrackedEntityInstanceQueryParams getFromUrl( String query, Set<String> attribute, Set<String> filter,
+ Set<String> ou, OrganisationUnitSelectionMode ouMode, String program, ProgramStatus programStatus,
+ Boolean followUp, Date programStartDate, Date programEndDate, String trackedEntity, EventStatus eventStatus,
+ Date eventStartDate, Date eventEndDate, boolean skipMeta, Integer page, Integer pageSize )
{
TrackedEntityInstanceQueryParams params = new TrackedEntityInstanceQueryParams();
@@ -345,17 +349,17 @@
for ( String attr : attribute )
{
QueryItem it = getQueryItem( attr );
-
+
params.getAttributes().add( it );
}
}
-
+
if ( filter != null )
{
for ( String filt : filter )
{
QueryItem it = getQueryItem( filt );
-
+
params.getFilters().add( it );
}
}
@@ -365,25 +369,25 @@
for ( String orgUnit : ou )
{
OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( orgUnit );
-
+
if ( organisationUnit == null )
{
throw new IllegalQueryException( "Organisation unit does not exist: " + orgUnit );
}
-
+
params.getOrganisationUnits().add( organisationUnit );
}
}
-
+
Program pr = program != null ? programService.getProgram( program ) : null;
-
+
if ( program != null && pr == null )
{
throw new IllegalQueryException( "Program does not exist: " + program );
}
-
+
TrackedEntity te = trackedEntity != null ? trackedEntityService.getTrackedEntity( trackedEntity ) : null;
-
+
if ( trackedEntity != null && te == null )
{
throw new IllegalQueryException( "Tracked entity does not exist: " + program );
@@ -403,17 +407,18 @@
params.setSkipMeta( skipMeta );
params.setPage( page );
params.setPageSize( pageSize );
-
+
return params;
}
-
+
private QueryItem getQueryItem( String item )
{
if ( !item.contains( DimensionalObjectUtils.DIMENSION_NAME_SEP ) )
{
return getItem( item, null, null );
}
- else // Filter
+ else
+ // Filter
{
String[] split = item.split( DimensionalObjectUtils.DIMENSION_NAME_SEP );
@@ -434,7 +439,7 @@
{
throw new IllegalQueryException( "Attribute does not exist: " + item );
}
-
+
if ( operator != null && filter != null )
{
return new QueryItem( at, operator, filter, at.isNumericType() );
@@ -442,9 +447,9 @@
else
{
return new QueryItem( at, at.isNumericType() );
- }
+ }
}
-
+
@Override
public int addTrackedEntityInstance( TrackedEntityInstance instance )
{
@@ -739,8 +744,8 @@
public List<Integer> getProgramStageInstances( List<String> searchKeys, Collection<OrganisationUnit> orgunits,
Boolean followup, Integer statusEnrollment, Integer min, Integer max )
{
- return trackedEntityInstanceStore.getProgramStageInstances( searchKeys, orgunits, followup, null, statusEnrollment,
- min, max );
+ return trackedEntityInstanceStore.getProgramStageInstances( searchKeys, orgunits, followup, null,
+ statusEnrollment, min, max );
}
@Override
@@ -763,11 +768,13 @@
}
@Override
- public Collection<TrackedEntityInstance> searchTrackedEntityInstancesForMobile( String searchText, int orgUnitId, int attributeId )
+ public Collection<TrackedEntityInstance> searchTrackedEntityInstancesForMobile( String searchText, int orgUnitId,
+ int attributeId )
{
Set<TrackedEntityInstance> entityInstances = new HashSet<TrackedEntityInstance>();
- entityInstances.addAll( getTrackedEntityInstancesByAttributeValue( searchText, attributeId, 0, Integer.MAX_VALUE ) );
+ entityInstances.addAll( getTrackedEntityInstancesByAttributeValue( searchText, attributeId, 0,
+ Integer.MAX_VALUE ) );
if ( orgUnitId != 0 )
{
@@ -783,7 +790,7 @@
}
entityInstances.removeAll( toRemoveList );
}
-
+
return entityInstances;
}
@@ -794,4 +801,20 @@
return trackedEntityInstanceStore.getByAttributeValue( searchText, attributeId, min, max );
}
+ @Override
+ public Collection<TrackedEntityInstance> searchTrackedEntityInstances( List<String> searchKeys,
+ Collection<OrganisationUnit> orgunits, Boolean followup, Collection<TrackedEntityAttribute> attributes,
+ Integer statusEnrollment, Integer min, Integer max )
+ {
+ return trackedEntityInstanceStore.search( searchKeys, orgunits, followup, attributes, statusEnrollment, min,
+ max );
+ }
+
+ @Override
+ public int countSearchTrackedEntityInstances( List<String> searchKeys, Collection<OrganisationUnit> orgunits,
+ Boolean followup, Integer statusEnrollment )
+ {
+ return trackedEntityInstanceStore.countSearch( searchKeys, orgunits, followup, statusEnrollment );
+ }
+
}
=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/hibernate/HibernateTrackedEntityInstanceStore.java'
--- dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/hibernate/HibernateTrackedEntityInstanceStore.java 2014-04-22 00:23:35 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/hibernate/HibernateTrackedEntityInstanceStore.java 2014-04-22 23:05:35 +0000
@@ -242,9 +242,9 @@
final String wordStart = statementBuilder.getRegexpWordStart();
final String wordEnd = statementBuilder.getRegexpWordEnd();
- String sql = "from trackedentityinstance tei " +
- "inner join trackedentity te on tei.trackedentityid = te.trackedentityid " +
- "inner join organisationunit ou on tei.organisationunitid = ou.organisationunitid ";
+ String sql = "from trackedentityinstance tei "
+ + "inner join trackedentity te on tei.trackedentityid = te.trackedentityid "
+ + "inner join organisationunit ou on tei.organisationunitid = ou.organisationunitid ";
for ( QueryItem item : params.getAttributesAndFilters() )
{
@@ -252,18 +252,18 @@
final String joinClause = item.hasFilter() ? "inner join" : "left join";
- sql += joinClause + " " +
- "trackedentityattributevalue as " + col + " " + "on " + col + ".trackedentityinstanceid = tei.trackedentityinstanceid " +
- "and " + col + ".trackedentityattributeid = " + item.getItem().getId() + " ";
+ sql += joinClause + " " + "trackedentityattributevalue as " + col + " " + "on " + col
+ + ".trackedentityinstanceid = tei.trackedentityinstanceid " + "and " + col
+ + ".trackedentityattributeid = " + item.getItem().getId() + " ";
if ( !params.isOrQuery() && item.hasFilter() )
{
for ( QueryFilter filter : item.getFilters() )
{
final String encodedFilter = statementBuilder.encode( filter.getFilter(), false );
-
+
final String queryCol = item.isNumeric() ? (col + ".value") : "lower(" + col + ".value)";
-
+
sql += "and " + queryCol + " " + filter.getSqlOperator() + " "
+ StringUtils.lowerCase( filter.getSqlFilter( encodedFilter ) ) + " ";
}
@@ -295,7 +295,8 @@
else if ( params.isOrganisationUnitMode( OrganisationUnitSelectionMode.ALL ) )
{
}
- else // SELECTED (default)
+ else
+ // SELECTED (default)
{
sql += hlp.whereAnd() + " tei.organisationunitid in ("
+ getCommaDelimitedString( getIdentifiers( params.getOrganisationUnits() ) ) + ") ";
@@ -303,20 +304,15 @@
if ( params.hasProgram() )
{
- sql += hlp.whereAnd() + " exists (" +
- "select pi.trackedentityinstanceid " +
- "from programinstance pi ";
-
+ sql += hlp.whereAnd() + " exists (" + "select pi.trackedentityinstanceid " + "from programinstance pi ";
+
if ( params.hasEventStatus() )
{
- sql +=
- "left join programstageinstance psi " +
- "on pi.programinstanceid = psi.programinstanceid ";
+ sql += "left join programstageinstance psi " + "on pi.programinstanceid = psi.programinstanceid ";
}
-
- sql +=
- "where pi.trackedentityinstanceid = tei.trackedentityinstanceid " +
- "and pi.programid = " + params.getProgram().getId() + " ";
+
+ sql += "where pi.trackedentityinstanceid = tei.trackedentityinstanceid " + "and pi.programid = "
+ + params.getProgram().getId() + " ";
if ( params.hasProgramStatus() )
{
@@ -332,16 +328,16 @@
{
sql += "and pi.enrollmentdate >= '" + getMediumDateString( params.getProgramStartDate() ) + "' ";
}
-
+
if ( params.hasProgramEndDate() )
{
sql += "and pi.enrollmentdate <= '" + getMediumDateString( params.getProgramEndDate() ) + "' ";
}
-
+
if ( params.hasEventStatus() )
{
sql += getEventStatusWhereClause( params );
- }
+ }
sql += ") ";
}
@@ -362,9 +358,8 @@
{
final String col = statementBuilder.columnQuote( item.getItemId() );
- sql +=
- "lower(" + col + ".value) " + regexp + " '" + wordStart +
- StringUtils.lowerCase( query ) + wordEnd + "' or ";
+ sql += "lower(" + col + ".value) " + regexp + " '" + wordStart + StringUtils.lowerCase( query )
+ + wordEnd + "' or ";
}
sql = removeLastOr( sql ) + ") and ";
@@ -380,33 +375,38 @@
{
String start = getMediumDateString( params.getEventStartDate() );
String end = getMediumDateString( params.getEventEndDate() );
-
+
String sql = StringUtils.EMPTY;
-
+
if ( params.isEventStatus( EventStatus.COMPLETED ) )
{
- sql = "and psi.executiondate >= '" + start + "' and psi.executiondate <= '" + end + "' and psi.completed = true ";
+ sql = "and psi.executiondate >= '" + start + "' and psi.executiondate <= '" + end
+ + "' and psi.completed = true ";
}
else if ( params.isEventStatus( EventStatus.VISITED ) )
{
- sql = "and psi.executiondate >= '" + start + "' and psi.executiondate <= '" + end + "' and psi.completed = false ";
+ sql = "and psi.executiondate >= '" + start + "' and psi.executiondate <= '" + end
+ + "' and psi.completed = false ";
}
else if ( params.isEventStatus( EventStatus.FUTURE_VISIT ) )
{
- sql = "and psi.duedate >= '" + start + "' and psi.duedate <= '" + end + "' and psi.status is not null and date(now()) < date(psi.duedate) ";
+ sql = "and psi.executiondate is null and psi.duedate >= '" + start + "' and psi.duedate <= '" + end
+ + "' and psi.status is not null and date(now()) <= date(psi.duedate) ";
}
else if ( params.isEventStatus( EventStatus.LATE_VISIT ) )
{
- sql = "and psi.duedate >= '" + start + "' and psi.duedate <= '" + end + "' and psi.status is not null and date(now()) > date(psi.duedate) ";
+ sql = "and psi.executiondate is null and psi.duedate >= '" + start + "' and psi.duedate <= '" + end
+ + "' and psi.status is not null and date(now()) > date(psi.duedate) ";
}
else if ( params.isEventStatus( EventStatus.SKIPPED ) )
{
- sql = "and psi.duedate >= '" + start + "' and psi.duedate <= '" + end + "' and psi.status = " + SKIPPED_STATUS + " ";
+ sql = "and psi.duedate >= '" + start + "' and psi.duedate <= '" + end + "' and psi.status = "
+ + SKIPPED_STATUS + " ";
}
-
+
return sql;
}
-
+
@Override
@SuppressWarnings( "unchecked" )
public Collection<TrackedEntityInstance> getByOrgUnit( OrganisationUnit organisationUnit, Integer min, Integer max )
@@ -631,7 +631,7 @@
throw new RuntimeException( ex );
}
}
-
+
@Override
public List<Integer> getProgramStageInstances( List<String> searchKeys, Collection<OrganisationUnit> orgunits,
Boolean followup, Collection<TrackedEntityAttribute> attributes, Integer statusEnrollment, Integer min,
@@ -1068,4 +1068,39 @@
return entityInstances;
}
+
+ @Override
+ public Collection<TrackedEntityInstance> search( List<String> searchKeys, Collection<OrganisationUnit> orgunits,
+ Boolean followup, Collection<TrackedEntityAttribute> attributes, Integer statusEnrollment, Integer min,
+ Integer max )
+ {
+ String sql = searchTrackedEntityInstanceSql( false, searchKeys, orgunits, followup, attributes,
+ statusEnrollment, min, max );
+ Collection<TrackedEntityInstance> instances = new HashSet<TrackedEntityInstance>();
+ try
+ {
+ instances = jdbcTemplate.query( sql, new RowMapper<TrackedEntityInstance>()
+ {
+ public TrackedEntityInstance mapRow( ResultSet rs, int rowNum )
+ throws SQLException
+ {
+ return get( rs.getInt( 1 ) );
+ }
+ } );
+ }
+ catch ( Exception ex )
+ {
+ ex.printStackTrace();
+ }
+ return instances;
+ }
+
+ @Override
+ public int countSearch( List<String> searchKeys, Collection<OrganisationUnit> orgunits, Boolean followup,
+ Integer statusEnrollment )
+ {
+ String sql = searchTrackedEntityInstanceSql( true, searchKeys, orgunits, followup, null, statusEnrollment,
+ null, null );
+ return jdbcTemplate.queryForObject( sql, Integer.class );
+ }
}
=== removed file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetDataRecordsAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetDataRecordsAction.java 2014-04-22 00:17:55 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetDataRecordsAction.java 1970-01-01 00:00:00 +0000
@@ -1,231 +0,0 @@
-package org.hisp.dhis.caseentry.action.caseentry;
-
-/*
- * Copyright (c) 2004-2014, 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.
- */
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-
-import org.hisp.dhis.common.Grid;
-import org.hisp.dhis.i18n.I18n;
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
-import org.hisp.dhis.paging.ActionPagingSupport;
-import org.hisp.dhis.program.Program;
-import org.hisp.dhis.program.ProgramInstance;
-import org.hisp.dhis.program.ProgramService;
-import org.hisp.dhis.program.ProgramStageInstance;
-import org.hisp.dhis.program.ProgramStageInstanceService;
-import org.hisp.dhis.trackedentity.TrackedEntityInstance;
-import org.hisp.dhis.trackedentity.TrackedEntityAttribute;
-import org.hisp.dhis.trackedentity.TrackedEntityInstanceService;
-
-public class GetDataRecordsAction
- extends ActionPagingSupport<TrackedEntityInstance>
-{
- // -------------------------------------------------------------------------
- // Dependencies
- // -------------------------------------------------------------------------
-
- private OrganisationUnitSelectionManager selectionManager;
-
- public void setSelectionManager( OrganisationUnitSelectionManager selectionManager )
- {
- this.selectionManager = selectionManager;
- }
-
- private TrackedEntityInstanceService entityInstanceService;
-
- public void setEntityInstanceService( TrackedEntityInstanceService entityInstanceService )
- {
- this.entityInstanceService = entityInstanceService;
- }
-
- private ProgramService programService;
-
- public void setProgramService( ProgramService programService )
- {
- this.programService = programService;
- }
-
- private ProgramStageInstanceService programStageInstanceService;
-
- public void setProgramStageInstanceService( ProgramStageInstanceService programStageInstanceService )
- {
- this.programStageInstanceService = programStageInstanceService;
- }
-
- private I18n i18n;
-
- public void setI18n( I18n i18n )
- {
- this.i18n = i18n;
- }
-
- // -------------------------------------------------------------------------
- // Input/output
- // -------------------------------------------------------------------------
-
- private String programId;
-
- public void setProgramId( String programId )
- {
- this.programId = programId;
- }
-
- private List<String> searchTexts = new ArrayList<String>();
-
- public void setSearchTexts( List<String> searchTexts )
- {
- this.searchTexts = searchTexts;
- }
-
- private Integer total;
-
- public Integer getTotal()
- {
- return total;
- }
-
- private Map<TrackedEntityInstance, ProgramInstance> programInstanceMap = new HashMap<TrackedEntityInstance, ProgramInstance>();
-
- public Map<TrackedEntityInstance, ProgramInstance> getProgramInstanceMap()
- {
- return programInstanceMap;
- }
-
- private Collection<TrackedEntityInstance> entityInstances;
-
- public Collection<TrackedEntityInstance> getEntityInstances()
- {
- return entityInstances;
- }
-
- private List<ProgramStageInstance> programStageInstances = new ArrayList<ProgramStageInstance>();
-
- public List<ProgramStageInstance> getProgramStageInstances()
- {
- return programStageInstances;
- }
-
- private List<TrackedEntityAttribute> attributes = new ArrayList<TrackedEntityAttribute>();
-
- public List<TrackedEntityAttribute> getAttributes()
- {
- return attributes;
- }
-
- private Program program;
-
- public Program getProgram()
- {
- return program;
- }
-
- private String type;
-
- public void setType( String type )
- {
- this.type = type;
- }
-
- private Grid grid;
-
- public Grid getGrid()
- {
- return grid;
- }
-
- private Boolean followup;
-
- public void setFollowup( Boolean followup )
- {
- this.followup = followup;
- }
-
- private Boolean trackingReport;
-
- public void setTrackingReport( Boolean trackingReport )
- {
- this.trackingReport = trackingReport;
- }
-
- // -------------------------------------------------------------------------
- // Implementation Action
- // -------------------------------------------------------------------------
-
- public String execute()
- throws Exception
- {
-// OrganisationUnit orgunit = selectionManager.getSelectedOrganisationUnit();
-//
-// Collection<OrganisationUnit> orgunits = new HashSet<OrganisationUnit>();
-// orgunits.add( orgunit );
-//
-// if ( programId != null )
-// {
-// program = programService.getProgram( programId );
-// }
-//
-// if ( searchTexts.size() > 0 )
-// {
-// if ( type == null )
-// {
-// total = entityInstanceService.countSearchTrackedEntityInstances( searchTexts, orgunits, followup,
-// ProgramInstance.STATUS_ACTIVE );
-// this.paging = createPaging( total );
-//
-// List<Integer> stageInstanceIds = entityInstanceService.getProgramStageInstances( searchTexts, orgunits,
-// followup, ProgramInstance.STATUS_ACTIVE, paging.getStartPos(), paging.getPageSize() );
-//
-// for ( Integer stageInstanceId : stageInstanceIds )
-// {
-// ProgramStageInstance programStageInstance = programStageInstanceService
-// .getProgramStageInstance( stageInstanceId );
-// programStageInstances.add( programStageInstance );
-// }
-// }
-// else if ( trackingReport != null && trackingReport )
-// {
-// grid = entityInstanceService.getTrackingEventsReport( program, searchTexts, orgunits, followup,
-// ProgramInstance.STATUS_ACTIVE, i18n );
-// }
-// else
-// {
-// grid = entityInstanceService.getScheduledEventsReport( searchTexts, orgunits, followup,
-// ProgramInstance.STATUS_ACTIVE, null, null, i18n );
-// }
-// }
-
- return type == null ? SUCCESS : type;
- }
-}
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/reminder/GetProgramStageInstanceByIdAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/reminder/GetProgramStageInstanceByIdAction.java 2014-03-18 08:10:10 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/reminder/GetProgramStageInstanceByIdAction.java 2014-04-22 23:05:35 +0000
@@ -56,9 +56,9 @@
// Getter && Setter
// -------------------------------------------------------------------------
- private Integer programStageInstanceId;
+ private String programStageInstanceId;
- public void setProgramStageInstanceId( Integer programStageInstanceId )
+ public void setProgramStageInstanceId( String programStageInstanceId )
{
this.programStageInstanceId = programStageInstanceId;
}
=== removed file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/reminder/SendSmsToListAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/reminder/SendSmsToListAction.java 2014-04-22 00:17:55 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/reminder/SendSmsToListAction.java 1970-01-01 00:00:00 +0000
@@ -1,204 +0,0 @@
-package org.hisp.dhis.caseentry.action.reminder;
-
-/*
- * Copyright (c) 2004-2014, 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.
- */
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.hisp.dhis.i18n.I18n;
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
-import org.hisp.dhis.program.ProgramInstance;
-import org.hisp.dhis.program.ProgramStageInstanceService;
-import org.hisp.dhis.sms.SmsSender;
-import org.hisp.dhis.sms.SmsServiceException;
-import org.hisp.dhis.sms.outbound.OutboundSms;
-import org.hisp.dhis.trackedentity.TrackedEntityInstanceService;
-import org.hisp.dhis.user.CurrentUserService;
-
-import com.opensymphony.xwork2.Action;
-
-/**
- * @author Chau Thu Tran
- *
- * @version SendSmsToListAction.java 13:29:34 AM Aug 16, 2012 $
- */
-public class SendSmsToListAction
- implements Action
-{
- // -------------------------------------------------------------------------
- // Dependencies
- // -------------------------------------------------------------------------
-
- private OrganisationUnitSelectionManager selectionManager;
-
- private TrackedEntityInstanceService entityInstanceService;
-
- private SmsSender smsSender;
-
- private ProgramStageInstanceService programStageInstanceService;
-
- private CurrentUserService currentUserService;
-
- private I18n i18n;
-
- // -------------------------------------------------------------------------
- // Input/output
- // -------------------------------------------------------------------------
-
- private List<String> searchTexts = new ArrayList<String>();
-
- private Boolean searchBySelectedOrgunit;
-
- private Boolean searchByUserOrgunits;
-
- private Boolean followup;
-
- // -------------------------------------------------------------------------
- // Getters && Setters
- // -------------------------------------------------------------------------
-
- public void setCurrentUserService( CurrentUserService currentUserService )
- {
- this.currentUserService = currentUserService;
- }
-
- public void setSmsSender( SmsSender smsSender )
- {
- this.smsSender = smsSender;
- }
-
- public void setProgramStageInstanceService( ProgramStageInstanceService programStageInstanceService )
- {
- this.programStageInstanceService = programStageInstanceService;
- }
-
- public void setI18n( I18n i18n )
- {
- this.i18n = i18n;
- }
-
- public void setFollowup( Boolean followup )
- {
- this.followup = followup;
- }
-
- public void setSelectionManager( OrganisationUnitSelectionManager selectionManager )
- {
- this.selectionManager = selectionManager;
- }
-
- public void setSearchBySelectedOrgunit( Boolean searchBySelectedOrgunit )
- {
- this.searchBySelectedOrgunit = searchBySelectedOrgunit;
- }
-
- public void setSearchByUserOrgunits( Boolean searchByUserOrgunits )
- {
- this.searchByUserOrgunits = searchByUserOrgunits;
- }
-
- public void setEntityInstanceService( TrackedEntityInstanceService entityInstanceService )
- {
- this.entityInstanceService = entityInstanceService;
- }
-
- public void setSearchTexts( List<String> searchTexts )
- {
- this.searchTexts = searchTexts;
- }
-
- private String msg;
-
- public void setMsg( String msg )
- {
- this.msg = msg;
- }
-
- private String message = "";
-
- public String getMessage()
- {
- return message;
- }
-
- // -------------------------------------------------------------------------
- // Action Implementation
- // -------------------------------------------------------------------------
-
- @Override
- public String execute()
- throws Exception
- {
- OrganisationUnit organisationUnit = selectionManager.getSelectedOrganisationUnit();
- Collection<OrganisationUnit> orgunits = new HashSet<OrganisationUnit>();
-
- if ( searchByUserOrgunits )
- {
- Collection<OrganisationUnit> userOrgunits = currentUserService.getCurrentUser().getOrganisationUnits();
- orgunits.addAll( userOrgunits );
- }
- else if ( searchBySelectedOrgunit )
- {
- orgunits.add( organisationUnit );
- }
- else
- {
- organisationUnit = null;
- }
-
- Collection<Integer> programStageInstanceIds = entityInstanceService.getProgramStageInstances( searchTexts, orgunits,
- followup, ProgramInstance.STATUS_ACTIVE, null, null );
-
-// Set<String> phoneNumberList = new HashSet<String>( entityInstanceService.getTrackedEntityInstancePhoneNumbers( searchTexts,
-// orgunits, followup, ProgramInstance.STATUS_ACTIVE, null, null ) );
-// try
-// {
-// OutboundSms outboundSms = new OutboundSms();
-// outboundSms.setMessage( msg );
-// outboundSms.setRecipients( phoneNumberList );
-// outboundSms.setSender( currentUserService.getCurrentUsername() );
-//
-// smsSender.sendMessage( outboundSms, null );
-//
-// programStageInstanceService.updateProgramStageInstances( programStageInstanceIds, outboundSms );
-//
-// message = i18n.getString( "sent_message_success" );
-// }
-// catch ( SmsServiceException e )
-// {
-// message = e.getMessage();
-// }
-
- return SUCCESS;
- }
-}
=== removed file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/SearchTrackedEntityInstanceAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/SearchTrackedEntityInstanceAction.java 2014-04-22 00:17:55 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/SearchTrackedEntityInstanceAction.java 1970-01-01 00:00:00 +0000
@@ -1,320 +0,0 @@
-package org.hisp.dhis.caseentry.action.trackedentity;
-
-/*
- * Copyright (c) 2004-2014, 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.
- */
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.organisationunit.OrganisationUnitService;
-import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
-import org.hisp.dhis.paging.ActionPagingSupport;
-import org.hisp.dhis.program.Program;
-import org.hisp.dhis.program.ProgramService;
-import org.hisp.dhis.trackedentity.TrackedEntityInstance;
-import org.hisp.dhis.trackedentity.TrackedEntityAttribute;
-import org.hisp.dhis.trackedentity.TrackedEntityAttributeService;
-import org.hisp.dhis.trackedentity.TrackedEntityInstanceService;
-import org.hisp.dhis.trackedentity.comparator.TrackedEntityAttributeSortOrderInListNoProgramComparator;
-import org.hisp.dhis.user.CurrentUserService;
-import org.hisp.dhis.user.User;
-import org.hisp.dhis.user.UserService;
-import org.springframework.beans.factory.annotation.Autowired;
-
-/**
- * @author Abyot Asalefew Gizaw
- */
-public class SearchTrackedEntityInstanceAction
- extends ActionPagingSupport<TrackedEntityInstance>
-{
- private final String SEARCH_IN_ALL_ORGUNITS = "searchInAllOrgunits";
-
- private final String SEARCH_IN_USER_ORGUNITS = "searchInUserOrgunits";
-
- private final String SEARCH_IN_BELOW_SELECTED_ORGUNIT = "searchInBelowSelectedOrgunit";
-
- // -------------------------------------------------------------------------
- // Dependencies
- // -------------------------------------------------------------------------
-
- private OrganisationUnitSelectionManager selectionManager;
-
- private TrackedEntityInstanceService entityInstanceService;
-
- private ProgramService programService;
-
- private CurrentUserService currentUserService;
-
- private OrganisationUnitService organisationUnitService;
-
- private UserService userService;
-
- @Autowired
- private TrackedEntityAttributeService attributeService;
-
- // -------------------------------------------------------------------------
- // Input/output
- // -------------------------------------------------------------------------
-
- private List<String> searchTexts = new ArrayList<String>();
-
- private Integer statusEnrollment;
-
- private String facilityLB;
-
- private boolean listAll;
-
- private Collection<TrackedEntityInstance> entityInstances = new ArrayList<TrackedEntityInstance>();
-
- // -------------------------------------------------------------------------
- // Getters && Setters
- // -------------------------------------------------------------------------
-
- public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
- {
- this.organisationUnitService = organisationUnitService;
- }
-
- public void setUserService( UserService userService )
- {
- this.userService = userService;
- }
-
- public void setCurrentUserService( CurrentUserService currentUserService )
- {
- this.currentUserService = currentUserService;
- }
-
- public void setStatusEnrollment( Integer statusEnrollment )
- {
- this.statusEnrollment = statusEnrollment;
- }
-
- public void setFacilityLB( String facilityLB )
- {
- this.facilityLB = facilityLB;
- }
-
- public void setSelectionManager( OrganisationUnitSelectionManager selectionManager )
- {
- this.selectionManager = selectionManager;
- }
-
- public void setProgramService( ProgramService programService )
- {
- this.programService = programService;
- }
-
- public void setEntityInstanceService( TrackedEntityInstanceService entityInstanceService )
- {
- this.entityInstanceService = entityInstanceService;
- }
-
- public void setSearchTexts( List<String> searchTexts )
- {
- this.searchTexts = searchTexts;
- }
-
- public boolean isListAll()
- {
- return listAll;
- }
-
- public void setListAll( boolean listAll )
- {
- this.listAll = listAll;
- }
-
- public Collection<TrackedEntityInstance> getEntityInstances()
- {
- return entityInstances;
- }
-
- private Integer total;
-
- public Integer getTotal()
- {
- return total;
- }
-
- private Map<Integer, String> mapEntityInstanceOrgunit = new HashMap<Integer, String>();
-
- public Map<Integer, String> getMapEntityInstanceOrgunit()
- {
- return mapEntityInstanceOrgunit;
- }
-
- private Integer programId;
-
- public void setProgramId( Integer programId )
- {
- this.programId = programId;
- }
-
- private OrganisationUnit organisationUnit;
-
- public OrganisationUnit getOrganisationUnit()
- {
- return organisationUnit;
- }
-
- private Map<String, String> mapUsers = new HashMap<String, String>();
-
- public Map<String, String> getMapUsers()
- {
- return mapUsers;
- }
-
- private Program program;
-
- public Program getProgram()
- {
- return program;
- }
-
- private List<TrackedEntityAttribute> attributes;
-
- public List<TrackedEntityAttribute> getAttributes()
- {
- return attributes;
- }
-
- // -------------------------------------------------------------------------
- // Action implementation
- // -------------------------------------------------------------------------
-
- public String execute()
- throws Exception
- {
-// organisationUnit = selectionManager.getSelectedOrganisationUnit();
-//
-// Collection<OrganisationUnit> orgunits = new HashSet<OrganisationUnit>();
-//
-// if ( programId != null )
-// {
-// program = programService.getProgram( programId );
-// }
-// else
-// {
-// attributes = new ArrayList<TrackedEntityAttribute>(
-// attributeService.getTrackedEntityAttributesDisplayInList( true ) );
-// Collections.sort( attributes, new TrackedEntityAttributeSortOrderInListNoProgramComparator() );
-// }
-//
-// // List all entityInstances
-// if ( listAll )
-// {
-// total = entityInstanceService.countGetTrackedEntityInstancesByOrgUnit( organisationUnit );
-// this.paging = createPaging( total );
-//
-// entityInstances = new ArrayList<TrackedEntityInstance>( entityInstanceService.getTrackedEntityInstances(
-// organisationUnit, paging.getStartPos(), paging.getPageSize() ) );
-// }
-// // search entityInstances
-// else if ( searchTexts.size() > 0 )
-// {
-// // selected orgunit
-// if ( facilityLB == null || facilityLB.isEmpty() )
-// {
-// orgunits.add( organisationUnit );
-// }
-// else if ( facilityLB.equals( SEARCH_IN_USER_ORGUNITS ) )
-// {
-// Collection<OrganisationUnit> userOrgunits = currentUserService.getCurrentUser().getOrganisationUnits();
-// orgunits.addAll( userOrgunits );
-// }
-// else if ( facilityLB.equals( SEARCH_IN_BELOW_SELECTED_ORGUNIT ) )
-// {
-// Collection<Integer> orgunitIds = organisationUnitService.getOrganisationUnitHierarchy().getChildren(
-// organisationUnit.getId() );
-// orgunits.add( organisationUnit );
-// orgunits.addAll( organisationUnitService.getOrganisationUnits( orgunitIds ) );
-// }
-// else if ( facilityLB.equals( SEARCH_IN_ALL_ORGUNITS ) )
-// {
-// orgunits = null;
-// }
-//
-// // -----------------------------------------------------------------
-// // Users by orgunits for searching
-// // -----------------------------------------------------------------
-//
-// Collection<User> users = userService.getAllUsers();
-// for ( User user : users )
-// {
-// mapUsers.put( user.getId() + "", user.getName() );
-// }
-//
-// // -----------------------------------------------------------------
-// // Searching
-// // -----------------------------------------------------------------
-//
-// total = entityInstanceService.countSearchTrackedEntityInstances( searchTexts, orgunits, null,
-// statusEnrollment );
-// this.paging = createPaging( total );
-// entityInstances = entityInstanceService.searchTrackedEntityInstances( searchTexts, orgunits, null, null,
-// statusEnrollment, paging.getStartPos(), paging.getPageSize() );
-//
-// if ( facilityLB != null && !facilityLB.isEmpty() )
-// {
-// for ( TrackedEntityInstance entityInstance : entityInstances )
-// {
-// mapEntityInstanceOrgunit.put( entityInstance.getId(),
-// getHierarchyOrgunit( entityInstance.getOrganisationUnit() ) );
-// }
-// }
-//
-// }
-
- return SUCCESS;
- }
-
- // -------------------------------------------------------------------------
- // Supportive method
- // -------------------------------------------------------------------------
-
- private String getHierarchyOrgunit( OrganisationUnit orgunit )
- {
- String hierarchyOrgunit = orgunit.getName();
-
- while ( orgunit.getParent() != null )
- {
- hierarchyOrgunit = orgunit.getParent().getName() + " / " + hierarchyOrgunit;
-
- orgunit = orgunit.getParent();
- }
-
- return hierarchyOrgunit;
- }
-}
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml 2014-04-21 16:30:29 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml 2014-04-22 23:05:35 +0000
@@ -12,19 +12,6 @@
ref="org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager" />
</bean>
- <bean id="org.hisp.dhis.caseentry.action.trackedentity.SearchTrackedEntityInstanceAction"
- class="org.hisp.dhis.caseentry.action.trackedentity.SearchTrackedEntityInstanceAction"
- scope="prototype">
- <property name="selectionManager"
- ref="org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager" />
- <property name="entityInstanceService" ref="org.hisp.dhis.trackedentity.TrackedEntityInstanceService" />
- <property name="programService" ref="org.hisp.dhis.program.ProgramService" />
- <property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
- <property name="organisationUnitService"
- ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
- <property name="userService" ref="org.hisp.dhis.user.UserService" />
- </bean>
-
<bean
id="org.hisp.dhis.caseentry.action.caseentry.SaveExecutionDateAction"
class="org.hisp.dhis.caseentry.action.caseentry.SaveExecutionDateAction"
@@ -182,17 +169,6 @@
ref="org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager" />
</bean>
- <bean id="org.hisp.dhis.caseentry.action.caseentry.GetDataRecordsAction"
- class="org.hisp.dhis.caseentry.action.caseentry.GetDataRecordsAction"
- scope="prototype">
- <property name="selectionManager"
- ref="org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager" />
- <property name="entityInstanceService" ref="org.hisp.dhis.trackedentity.TrackedEntityInstanceService" />
- <property name="programStageInstanceService"
- ref="org.hisp.dhis.program.ProgramStageInstanceService" />
- <property name="programService" ref="org.hisp.dhis.program.ProgramService" />
- </bean>
-
<!-- Single-event DataEntry -->
<bean
@@ -742,18 +718,6 @@
<property name="programInstanceService" ref="org.hisp.dhis.program.ProgramInstanceService" />
</bean>
- <bean id="org.hisp.dhis.caseentry.action.reminder.SendSmsToListAction"
- class="org.hisp.dhis.caseentry.action.reminder.SendSmsToListAction"
- scope="prototype">
- <property name="selectionManager"
- ref="org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager" />
- <property name="entityInstanceService" ref="org.hisp.dhis.trackedentity.TrackedEntityInstanceService" />
- <property name="smsSender" ref="org.hisp.dhis.sms.SmsSender" />
- <property name="programStageInstanceService"
- ref="org.hisp.dhis.program.ProgramStageInstanceService" />
- <property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
- </bean>
-
<bean id="org.hisp.dhis.caseentry.action.reminder.SetEventStatusAction"
class="org.hisp.dhis.caseentry.action.reminder.SetEventStatusAction"
scope="prototype">
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml 2014-04-21 16:30:29 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml 2014-04-22 23:05:35 +0000
@@ -43,21 +43,6 @@
<param name="requiredAuthorities">F_TRACKED_ENTITY_INSTANCE_SEARCH</param>
</action>
- <action name="searchTrackedEntityInstance"
- class="org.hisp.dhis.caseentry.action.trackedentity.SearchTrackedEntityInstanceAction">
- <result name="success" type="velocity">/content.vm</result>
- <param name="page">/dhis-web-caseentry/listTrackedEntityInstance.vm</param>
- <param name="requiredAuthorities">F_TRACKED_ENTITY_INSTANCE_SEARCH</param>
- </action>
-
- <action name="listAllTrackedEntityInstances"
- class="org.hisp.dhis.caseentry.action.trackedentity.SearchTrackedEntityInstanceAction">
- <result name="success" type="velocity">/content.vm</result>
- <param name="listAll">true</param>
- <param name="page">/dhis-web-caseentry/listTrackedEntityInstance.vm</param>
- <param name="requiredAuthorities">F_TRACKED_ENTITY_INSTANCE_SEARCH</param>
- </action>
-
<action name="loadProgramStageInstances"
class="org.hisp.dhis.caseentry.action.caseentry.LoadProgramStageInstancesAction">
<result name="success" type="velocity-json">
@@ -464,13 +449,6 @@
<param name="requiredAuthorities">F_TRACKED_ENTITY_INSTANCE_MANAGEMENT</param>
</action>
- <action name="searchRegistrationTrackedEntityInstance"
- class="org.hisp.dhis.caseentry.action.trackedentity.SearchTrackedEntityInstanceAction">
- <result name="success" type="velocity">/content.vm</result>
- <param name="page">/dhis-web-caseentry/trackedEntityInstanceRegistrationList.vm</param>
- <param name="requiredAuthorities">F_TRACKED_ENTITY_INSTANCE_SEARCH</param>
- </action>
-
<action name="removeTrackedEntityInstance"
class="org.hisp.dhis.caseentry.action.trackedentity.RemoveTrackedEntityInstanceAction">
<result name="success" type="velocity-json">
@@ -806,14 +784,6 @@
<param name="requiredAuthorities">F_PROGRAM_TRACKING_MANAGEMENT</param>
</action>
- <action name="getSMSTrackedEntityInstanceRecords"
- class="org.hisp.dhis.caseentry.action.caseentry.GetDataRecordsAction">
- <result name="success" type="velocity">/content.vm</result>
- <param name="page">/dhis-web-caseentry/programTrackingRecords.vm</param>
- <param name="stylesheets">style/style.css</param>
- <param name="requiredAuthorities">F_PROGRAM_TRACKING_SEARCH</param>
- </action>
-
<action name="programTrackingList"
class="org.hisp.dhis.caseentry.action.reminder.GetProgramTrackingListAction">
<result name="success" type="velocity">/content.vm</result>
@@ -834,16 +804,6 @@
<param name="requiredAuthorities">F_MOBILE_SENDSMS</param>
</action>
- <action name="sendSMSTotList"
- class="org.hisp.dhis.caseentry.action.reminder.SendSmsToListAction">
- <result name="success" type="velocity-json">/dhis-web-commons/ajax/jsonResponseSuccess.vm
- </result>
- <result name="error" type="velocity-json">/dhis-web-commons/ajax/jsonResponseError.vm
- </result>
- <param name="onExceptionReturn">plainTextError</param>
- <param name="requiredAuthorities">F_MOBILE_SENDSMS</param>
- </action>
-
<action name="setEventStatus"
class="org.hisp.dhis.caseentry.action.reminder.SetEventStatusAction">
<result name="success" type="velocity-json">/dhis-web-commons/ajax/jsonResponseSuccess.vm
@@ -859,6 +819,12 @@
<param name="page">/dhis-web-caseentry/trackingEventMessage.vm</param>
<param name="stylesheets">style/style.css</param>
</action>
+
+ <action name="getProgramStageInstanceByUid"
+ class="org.hisp.dhis.caseentry.action.reminder.GetProgramStageInstanceByIdAction">
+ <result name="success" type="velocity-json">/dhis-web-caseentry/jsonProgramStageInstance.vm
+ </result>
+ </action>
<!-- Dashboard -->
@@ -923,15 +889,6 @@
<param name="requiredAuthorities">F_ACTIVITY_PLAN</param>
</action>
- <action name="getActivityPlanRecords"
- class="org.hisp.dhis.caseentry.action.caseentry.GetDataRecordsAction">
- <result name="success" type="velocity">/content.vm</result>
- <param name="page">/dhis-web-caseentry/activityPlanRecords.vm</param>
- <param name="stylesheets">style/style.css</param>
- <result name="xls" type="gridXlsResult" />
- <result name="pdf" type="gridPdfResult" />
- </action>
-
<action name="accessAttributes" class="org.hisp.dhis.caseentry.action.NoAction">
<result name="success" type="velocity-json">/dhis-web-commons/ajax/jsonResponseSuccess.vm
</result>
=== removed file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/activityPlanRecords.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/activityPlanRecords.vm 2014-04-04 17:58:28 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/activityPlanRecords.vm 1970-01-01 00:00:00 +0000
@@ -1,94 +0,0 @@
-<script src="javascript/tooltip.js" type="text/javascript"></script>
-<table>
- <tr>
- <td class='text-column'>$i18n.getString( "total_result" ):</td>
- <td> </td>
- <td> </td>
- <td>$!total</td>
- </tr>
-</table>
-
-#if( $programStageInstances && $programStageInstances.size()>0 )
-
-<table class='listTable gridTable'>
- <thead>
- <tr>
- <th>#</th>
- <th>$i18n.getString('date_scheduled')</th>
- <th>$i18n.getString('orgunit')</th>
-
- #if( $auth.hasAccess( "dhis-web-caseentry", "accessAttributes" ) )
- #foreach( $programAttribute in $program.programAttributes )
- #if($programAttribute.displayInList=='true')
- <th id="attributeName">$encoder.htmlEncode($programAttribute.attribute.displayName)</th>
- #end
- #end
- #end
-
- <th>$i18n.getString('events')</th>
- <th>$i18n.getString('operations')</th>
- </tr>
- </thead>
- <tbody id="list">
- #set( $mark = false )
- #foreach( $programStageInstance in $programStageInstances )
- #set($entityInstance = $programStageInstance.programInstance.entityInstance)
- <tr id='tr$programStageInstance.id'>
- <td>
- #set( $nr = ( ( $paging.getCurrentPage() - 1 ) * $paging.pageSize ) + $velocityCount )
- $nr
- </td>
-
- <td>
- #if($!programStageInstance.executionDate)
- $format.formatDate($!programStageInstance.executionDate)
- #else
- $format.formatDate($!programStageInstance.dueDate)
- #end
- </td>
-
- <td>
- #if($!programStageInstance.executionDate)
- $!programStageInstance.organisationUnit.name
- #else
- $entityInstance.organisationUnit.name
- #end
- </td>
-
- #if( $auth.hasAccess( "dhis-web-caseentry", "accessAttributes" ) )
- #foreach( $programAttribute in $program.programAttributes )
- #if($programAttribute.displayInList=='true')
- <td style="cursor:pointer;" onclick="javascript:isDashboard=true;showTrackedEntityInstanceDashboardForm( '$entityInstance.uid' )">
- #foreach( $attributeValue in $entityInstance.attributeValues)
- #if($!attributeValue.attribute.id==$programAttribute.attribute.id)
- #set($value=$attributeValue.value)
- #if( $programAttribute.attribute.valueType == 'bool')
- #set($value=$i18n.getString($attributeValue.value))
- #end
- #end
- #end
- <a>$encoder.htmlEncode($value)</a>
- </td>
- #end
- #end
- #end
-
- <td><a href="javascript:loadDataEntryDialog( $programStageInstance.id, '$programStageInstance.programStage.uid' );">$programStageInstance.programStage.displayName</a></td>
-
- <td>
- <a href="javascript:isDashboard=false;showTrackedEntityInstanceDashboardForm( '$entityInstance.uid' )" title="$i18n.getString( 'dashboard' )"><img src="../images/enroll.png" alt='$i18n.getString( "dashboard" )'></a>
- <a href="javascript:loadDataEntryDialog( $programStageInstance.id, '$programStageInstance.programStage.uid' );" title="$i18n.getString( 'data_entry' )"><img src="images/data_entry.png" alt="$i18n.getString( 'data_entry' )"></a>
- <a href="javascript:showTrackedEntityInstanceHistory('$entityInstance.uid')" title='$i18n.getString( "tracked_entity_instance_details_and_history" )'><img src="../images/information.png" alt='$i18n.getString( "tracked_entity_instance_details_and_history" )'></a>
- </td>
-
- </tr>
- #end
- </tbody>
-</table>
-<div class="paging-container">
- #parse( "/dhis-web-commons/paging/paging.vm" )
-</div>
-
-<div id="detailsInfo"></div>
-
-#end
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/activityPlan.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/activityPlan.js 2014-04-22 00:05:56 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/activityPlan.js 2014-04-22 23:05:35 +0000
@@ -64,6 +64,7 @@
success : function(json) {
setInnerHTML('listEntityInstanceDiv', displayevents(json, page));
showById('listEntityInstanceDiv');
+ setTableStyles();
jQuery('#loaderDiv').hide();
hideLoader();
}
@@ -133,12 +134,6 @@
+ "'><img src='../images/enroll.png' alt='"
+ i18n_dashboard
+ "'></a>";
- table += "<a href=\"javascript:loadDataEntryDialog( '" + uid + "' ) \" "
- + " title='"
- + i18n_edit
- + "'><img src= '../images/edit.png' alt='"
- + i18n_edit
- + "'></a>";
table += "<a href=\"javascript:showTrackedEntityInstanceHistory( '" + uid + "' ) \" "
+ " title='"
+ i18n_tracked_entity_instance_details_and_history
@@ -236,10 +231,10 @@
params += "&programStatus=ACTIVE";
params += "&trackedEntityInstance=" + teiUid;
if(getFieldValue('status')!=''){
- params += '&eventStatus=' + getFieldValue('status');
+ params += '&status=' + getFieldValue('status');
}
- params += "&eventStartDate=" + getFieldValue('startDueDate');
- params += "&eventEndDate=" + getFieldValue('endDueDate');
+ params += "&startDate=" + getFieldValue('startDueDate');
+ params += "&endDate=" + getFieldValue('endDueDate');
$.ajax({
type : "GET",
@@ -252,7 +247,7 @@
var row = json.events[i];
var uid = row.event;
var eventDate = row.eventDate;
- table += "<tr><td><a href='javascript:programTrackingList( \"" + uid + "\") ' >" + eventDate + "</a></td></tr>";
+ table += "<tr><td><a href='javascript:loadDataEntryDialog( \"" + uid + "\") ' >" + eventDate + "</a></td></tr>";
}
table += "</table>";
$('#eventList').html(table);
@@ -260,7 +255,7 @@
title : i18n_events,
maximize : true,
closable : true,
- modal : false,
+ modal : true,
width : 380,
height : 290
}).show('fast');
@@ -296,28 +291,40 @@
// EntityInstance program tracking
// --------------------------------------------------------------------
-function loadDataEntryDialog( programStageInstanceId, programStageUid )
+function loadDataEntryDialog( programStageInstanceId )
{
- jQuery('[id=programStageInstanceId]').val(programStageInstanceId);
- jQuery('.stage-object-selected').attr('psuid', programStageUid);
-
- $('#contentDataRecord' ).load("viewProgramStageRecords.action", {
- programStageInstanceId: programStageInstanceId
- }, function() {
- jQuery('#programStageUid').val(programStageUid);
- showById('reportDateDiv');
- showById('entityInstanceInforTB');
- showById('entryForm');
- showById('inputCriteriaDiv');
- }).dialog({
- title:i18n_program_stage,
- maximize:true,
- closable:true,
- modal:false,
- overlay:{background:'#000000', opacity:0.1},
- width:850,
- height:500
- });
+ $.ajax({
+ type : "GET",
+ url : "getProgramStageInstanceByUid.action?programStageInstanceId=" + programStageInstanceId,
+ dataType : "json",
+ success : function(json) {
+ var psiid = json.id;
+ jQuery('.stage-object-selected').attr('psuid', json.programStage.uid);
+ jQuery('[id=programStageInstanceId]').val(psiid);
+ jQuery('#programStageUid').val(json.programStage.uid);
+
+ $('#contentDataRecord' ).load("viewProgramStageRecords.action", {
+ programStageInstanceId: psiid
+ }, function( html ) {
+ setInnerHTML('contentDataRecord',html);
+ showById('reportDateDiv');
+ showById('entityInstanceInforTB');
+ showById('entryForm');
+ showById('inputCriteriaDiv');
+ entryFormContainerOnReady();
+ }).dialog({
+ title:i18n_program_stage,
+ maximize:true,
+ closable:true,
+ modal:false,
+ overlay:{background:'#000000', opacity:0.1},
+ width:850,
+ height:500
+ });
+ }
+ });
+
+
}
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js 2014-04-21 16:30:29 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js 2014-04-22 23:05:35 +0000
@@ -847,7 +847,7 @@
type: 'GET',
dataType: 'json'
} ).done(function(data) {
- if( data.response=='undefined'){
+ if( data.response==undefined){
$( "#programStageInstanceId" ).val( data.id );
$( "#entryFormContainer input[id='programStageInstanceId']" ).val( data.id );
$( "#entryFormContainer input[id='incidentDate']" ).val( data.programInstance.dateOfIncident );
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/smsReminder.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/smsReminder.js 2014-04-22 00:17:55 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/smsReminder.js 2014-04-22 23:05:35 +0000
@@ -272,15 +272,15 @@
var params = "orgUnit=" + getFieldValue("orgunitId");
params += "&program=" + getFieldValue('program');
params += "&trackedEntityInstance=" + teiUid;
- params += '&eventStatus=' + getFieldValue('status');
+ params += '&status=' + getFieldValue('status');
if( isAdvancedSearch ){ // advanced-search
- params += "&eventStartDate=" + getFieldValue('startDate');
- params += "&eventEndDate=" + getFieldValue('endDate');
+ params += "&startDate=" + getFieldValue('startDate');
+ params += "&endDate=" + getFieldValue('endDate');
}
else // list
{
- params += "&eventStartDate=1900-01-01";
- params += "&eventEndDate=3000-01-01";
+ params += "&startDate=1900-01-01";
+ params += "&endDate=3000-01-01";
}
$.ajax({
@@ -369,49 +369,6 @@
}
// --------------------------------------------------------------------
-// Send SMS
-// --------------------------------------------------------------------
-
-function showSendSmsForm()
-{
- jQuery('#sendSmsToListForm').dialog({
- title: i18n_send_message,
- maximize: true,
- closable: true,
- modal:true,
- overlay:{background:'#000000', opacity:0.1},
- width: 420,
- height: 200
- });
-}
-
-function sendSmsToList()
-{
- params = getSearchParams();
- params += "&msg=" + getFieldValue( 'smsMessage' );
- params += "&programStageInstanceId=" + getFieldValue('programStageInstanceId');
- $.ajax({
- url: 'sendSMSTotList.action',
- type:"POST",
- data: params,
- success: function( json ){
- if ( json.response == "success" ) {
- var programStageName = getFieldValue('programStageName');
- var currentTime = date.getHours() + ":" + date.getMinutes();
- jQuery('#commentTB').prepend("<tr><td>" + getFieldValue("currentDate") + " " + currentTime + "</td>"
- + "<td>" + programStageName + "</td>"
- + "<td>" + getFieldValue( 'smsMessage' ) + "</td></tr>");
- showSuccessMessage( json.message );
- }
- else {
- showErrorMessage( json.message );
- }
- jQuery('#sendSmsFormDiv').dialog('close')
- }
- });
-}
-
-// --------------------------------------------------------------------
// Post Comments/Send Message
// --------------------------------------------------------------------
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/searchTrackedEntityInstanceCriteria.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/searchTrackedEntityInstanceCriteria.vm 2014-04-21 14:30:25 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/searchTrackedEntityInstanceCriteria.vm 2014-04-22 23:05:35 +0000
@@ -142,7 +142,6 @@
<div style="padding: 10px 0 15px 3px">
<input type="button" class='large-button' value='$i18n.getString( "add_filter" )' onclick='addAttributeOption();'>
<input type="button" class='large-button' value='$i18n.getString( "search" )' onclick='isAdvancedSearch=true;validateAdvancedSearch(1);' id='searchEntityInstanceBtn'>
- <input type="button" class='large-button hidden' id='sendSmsToListBtn' value="$i18n.getString('sms')" onclick="setFieldValue('sendToList', true);showSendSmsForm();">
</div>
</div>
=== modified file 'dhis-2/dhis-web/dhis-web-sms/src/main/java/org/hisp/dhis/sms/outcoming/SearchPatientAction.java'
--- dhis-2/dhis-web/dhis-web-sms/src/main/java/org/hisp/dhis/sms/outcoming/SearchPatientAction.java 2014-04-22 00:23:35 +0000
+++ dhis-2/dhis-web/dhis-web-sms/src/main/java/org/hisp/dhis/sms/outcoming/SearchPatientAction.java 2014-04-22 23:05:35 +0000
@@ -139,18 +139,18 @@
orgunits.add( organisationUnit );
}
-// total = patientService.countSearchTrackedEntityInstances( searchTexts, orgunits, null, ProgramInstance.STATUS_ACTIVE );
-// this.paging = createPaging( total );
-// patients = patientService.searchTrackedEntityInstances( searchTexts, orgunits, null, null, ProgramInstance.STATUS_ACTIVE,
-// paging.getStartPos(), paging.getPageSize() );
-//
-// if ( !searchBySelectedOrgunit )
-// {
-// for ( TrackedEntityInstance patient : patients )
-// {
-// mapPatientOrgunit.put( patient.getId(), getHierarchyOrgunit( patient.getOrganisationUnit() ) );
-// }
-// }
+ total = patientService.countSearchTrackedEntityInstances( searchTexts, orgunits, null, ProgramInstance.STATUS_ACTIVE );
+ this.paging = createPaging( total );
+ patients = patientService.searchTrackedEntityInstances( searchTexts, orgunits, null, null, ProgramInstance.STATUS_ACTIVE,
+ paging.getStartPos(), paging.getPageSize() );
+
+ if ( !searchBySelectedOrgunit )
+ {
+ for ( TrackedEntityInstance patient : patients )
+ {
+ mapPatientOrgunit.put( patient.getId(), getHierarchyOrgunit( patient.getOrganisationUnit() ) );
+ }
+ }
}
return SUCCESS;