dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #07592
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2185: Fix bug: When we try to sort by attribute if there is no data for that attribute it will through ...
------------------------------------------------------------
revno: 2185
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: trunk
timestamp: Tue 2010-09-21 14:21:36 +0700
message:
Fix bug: When we try to sort by attribute if there is no data for that attribute it will through exception.
modified:
dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientStore.java
dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientattributevalue/hibernate/HibernatePatientAttributeValueStore.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/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-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientStore.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientStore.java 2010-05-11 16:29:50 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientStore.java 2010-09-21 07:21:36 +0000
@@ -106,7 +106,7 @@
Number rs = (Number)getCriteria(
Restrictions.disjunction().add( Restrictions.ilike( "firstName", "%" + name + "%" ) ).add(
Restrictions.ilike( "middleName", "%" + name + "%" ) ).add(
- Restrictions.ilike( "lastName", "%" + name + "%" ) ) ).addOrder( Order.asc( "firstName" ) ).setProjection( Projections.rowCount() ).uniqueResult();
+ Restrictions.ilike( "lastName", "%" + name + "%" ) ) ).setProjection( Projections.rowCount() ).uniqueResult();
return rs != null ? rs.intValue() : 0;
}
=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientattributevalue/hibernate/HibernatePatientAttributeValueStore.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientattributevalue/hibernate/HibernatePatientAttributeValueStore.java 2010-05-11 16:29:50 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientattributevalue/hibernate/HibernatePatientAttributeValueStore.java 2010-09-21 07:21:36 +0000
@@ -121,8 +121,9 @@
public int countSearchPatientAttributeValue( PatientAttribute patientAttribute, String searchText )
{
- return (Integer)getCriteria( Restrictions.eq( "patientAttribute", patientAttribute ),
+ Number rs = (Number) getCriteria( Restrictions.eq( "patientAttribute", patientAttribute ),
Restrictions.ilike( "value", "%" + searchText + "%" ) ).setProjection( Projections.rowCount() ).uniqueResult();
+ return rs != null ? rs.intValue() : 0;
}
@SuppressWarnings( "unchecked" )
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/SearchPatientAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/SearchPatientAction.java 2010-09-01 08:32:05 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/SearchPatientAction.java 2010-09-21 07:21:36 +0000
@@ -311,7 +311,7 @@
//System.out.println(" searchingAttributeId != null && searchText != null ");
patients = patientAttributeValueService.searchPatientAttributeValue(
patientAttribute, searchText, pagingUtil.getStartPos(), pagingUtil.getPageSize() );
-
+
if( patients != null && patients.size() > 0 )
{
if(sortPatientAttributeId!=null && patientAttribute!=null)