=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java 2012-05-17 19:54:00 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java 2012-05-24 05:13:57 +0000 @@ -102,8 +102,6 @@ private String phoneNumber; - private boolean hasPatients; - private Set groups = new HashSet(); private Set dataSets = new HashSet(); @@ -746,19 +744,6 @@ @JsonProperty @JsonView( {DetailedView.class, ExportView.class} ) @JacksonXmlProperty( namespace = Dxf2Namespace.NAMESPACE ) - public boolean isHasPatients() - { - return hasPatients; - } - - public void setHasPatients( boolean hasPatients ) - { - this.hasPatients = hasPatients; - } - - @JsonProperty - @JsonView( {DetailedView.class, ExportView.class} ) - @JacksonXmlProperty( namespace = Dxf2Namespace.NAMESPACE ) public String getType() { return type; @@ -903,7 +888,6 @@ address = organisationUnit.getAddress() == null ? address : organisationUnit.getAddress(); email = organisationUnit.getEmail() == null ? email : organisationUnit.getEmail(); phoneNumber = organisationUnit.getPhoneNumber() == null ? phoneNumber : organisationUnit.getPhoneNumber(); - hasPatients = organisationUnit.isHasPatients(); parent = organisationUnit.getParent(); groups.clear(); === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitService.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitService.java 2012-05-14 20:24:22 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitService.java 2012-05-24 05:13:57 +0000 @@ -332,10 +332,6 @@ int getMaxOfOrganisationUnitLevels(); - void updateOrganisationUnits( Collection units ); - - Collection getOrganisationUnits( Boolean hasPatients ); - // ------------------------------------------------------------------------- // Version // ------------------------------------------------------------------------- === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitStore.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitStore.java 2012-04-23 09:49:08 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitStore.java 2012-05-24 05:13:57 +0000 @@ -97,7 +97,4 @@ */ void updateOrganisationUnitParent( int organisationUnitId, int parentId ); - void update( Collection units ); - - Collection get( Boolean hasPatients ); } === modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitService.java' --- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitService.java 2012-05-14 20:24:22 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitService.java 2012-05-24 05:13:57 +0000 @@ -687,18 +687,6 @@ return organisationUnitLevelStore.getMaxLevels(); } - @Override - public void updateOrganisationUnits( Collection units ) - { - organisationUnitStore.update( units ); - } - - @Override - public Collection getOrganisationUnits( Boolean hasPatients ) - { - return organisationUnitStore.get( hasPatients ); - } - // ------------------------------------------------------------------------- // Version // ------------------------------------------------------------------------- === modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/hibernate/HibernateOrganisationUnitStore.java' --- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/hibernate/HibernateOrganisationUnitStore.java 2012-04-23 09:49:08 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/hibernate/HibernateOrganisationUnitStore.java 2012-05-24 05:13:57 +0000 @@ -27,21 +27,29 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Timestamp; +import java.util.Collection; +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang.StringUtils; -import org.hibernate.Criteria; import org.hibernate.Query; import org.hibernate.criterion.Restrictions; import org.hisp.dhis.common.hibernate.HibernateIdentifiableObjectStore; -import org.hisp.dhis.organisationunit.*; +import org.hisp.dhis.organisationunit.OrganisationUnit; +import org.hisp.dhis.organisationunit.OrganisationUnitGroup; +import org.hisp.dhis.organisationunit.OrganisationUnitHierarchy; +import org.hisp.dhis.organisationunit.OrganisationUnitService; +import org.hisp.dhis.organisationunit.OrganisationUnitStore; import org.hisp.dhis.system.objectmapper.OrganisationUnitRelationshipRowMapper; import org.springframework.jdbc.core.RowCallbackHandler; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Timestamp; -import java.util.*; - /** * @author Kristian Nordal */ @@ -192,46 +200,4 @@ jdbcTemplate.execute( sql ); } - - @Override - public void update( Collection units ) - { - Timestamp now = new Timestamp( new Date().getTime() ); - - Collection unitIds = new HashSet(); - - for ( OrganisationUnit orgunit : units ) - { - unitIds.add( orgunit.getId() ); - } - - if ( unitIds.size() > 0 ) - { - String sql = "update OrganisationUnit set hasPatients=true,lastUpdated='" + now + - "' where organisationunitid in (:unitIds)"; - Query query = sessionFactory.getCurrentSession().createQuery( sql ); - query.setParameterList( "unitIds", unitIds ); - query.executeUpdate(); - - sql = "UPDATE OrganisationUnit SET hasPatients=false,lastUpdated='" + now + - "' WHERE organisationunitid not in ( :unitIds )"; - query = sessionFactory.getCurrentSession().createQuery( sql ); - query.setParameterList( "unitIds", unitIds ); - query.executeUpdate(); - } - else - { - String sql = "update OrganisationUnit set hasPatients=false,,lastUpdated='" + now + "'"; - Query query = sessionFactory.getCurrentSession().createQuery( sql ); - query.executeUpdate(); - } - } - - @SuppressWarnings( "unchecked" ) - public Collection get( Boolean hasPatients ) - { - Criteria criteria = sessionFactory.getCurrentSession().createCriteria( OrganisationUnit.class ); - - return criteria.add( Restrictions.eq( "hasPatients", hasPatients ) ).list(); - } } === modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java' --- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java 2012-04-25 13:42:08 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java 2012-05-24 05:13:57 +0000 @@ -154,6 +154,8 @@ executeSql( "ALTER TABLE indicator DROP COLUMN extendeddataelementid" ); executeSql( "DROP TABLE extendeddataelement" ); + executeSql( "ALTER TABLE organisationunit DROP COLUMN hasPatients" ); + // --------------------------------------------------------------------- // Update tables for dimensional model // --------------------------------------------------------------------- === modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/organisationunit/hibernate/OrganisationUnit.hbm.xml' --- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/organisationunit/hibernate/OrganisationUnit.hbm.xml 2012-05-08 17:24:42 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/organisationunit/hibernate/OrganisationUnit.hbm.xml 2012-05-24 05:13:57 +0000 @@ -44,8 +44,6 @@ - - === modified file 'dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/OrganisationUnitBatchHandler.java' --- dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/OrganisationUnitBatchHandler.java 2011-12-26 10:07:59 +0000 +++ dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/OrganisationUnitBatchHandler.java 2012-05-24 05:13:57 +0000 @@ -103,7 +103,6 @@ statementBuilder.setColumn( "featuretype" ); statementBuilder.setColumn( "coordinates" ); statementBuilder.setColumn( "lastupdated" ); - statementBuilder.setColumn( "haspatients" ); } protected void setValues( OrganisationUnit unit ) @@ -121,6 +120,5 @@ statementBuilder.setValue( unit.getFeatureType() ); statementBuilder.setValue( unit.getCoordinates() ); statementBuilder.setValue( unit.getLastUpdated() ); - statementBuilder.setValue( unit.isHasPatients() ); } } === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/organisationUnit.xsl' --- dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/organisationUnit.xsl 2012-04-08 20:23:29 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/organisationUnit.xsl 2012-05-24 05:13:57 +0000 @@ -37,10 +37,6 @@ Active - - Has Patients - - === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SelectAction.java' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SelectAction.java 2011-09-27 08:10:08 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SelectAction.java 2012-05-24 05:13:57 +0000 @@ -115,15 +115,6 @@ organisationUnit = selectionManager.getSelectedOrganisationUnit(); - if ( organisationUnit == null ) - { - status = 1; - } - else if ( !organisationUnit.isHasPatients() ) - { - status = 2; - } - return SUCCESS; } } === removed file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/VerifyOrganisationUnitHasParentAction.java' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/VerifyOrganisationUnitHasParentAction.java 2011-12-26 10:07:59 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/VerifyOrganisationUnitHasParentAction.java 1970-01-01 00:00:00 +0000 @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2004-2012, 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.caseentry.action.patient; - -import org.hisp.dhis.organisationunit.OrganisationUnit; -import org.hisp.dhis.organisationunit.OrganisationUnitService; - -import com.opensymphony.xwork2.Action; - -/** - * @author Chau Thu Tran - */ -public class VerifyOrganisationUnitHasParentAction - implements Action -{ - // ------------------------------------------------------------------------- - // Dependencies - // ------------------------------------------------------------------------- - - private OrganisationUnitService organisationUnitService; - - public void setOrganisationUnitService( OrganisationUnitService organisationUnitService ) - { - this.organisationUnitService = organisationUnitService; - } - - // ------------------------------------------------------------------------- - // Input/output - // ------------------------------------------------------------------------- - - private Integer orgunitId; - - public void setOrgunitId( Integer orgunitId ) - { - this.orgunitId = orgunitId; - } - - public String getMessage() - { - return message; - } - - private String message; - - // ------------------------------------------------------------------------- - // Action implementation - // ------------------------------------------------------------------------- - - public String execute() - throws Exception - { - OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( orgunitId ); - - message = organisationUnit.getName(); - - if ( !organisationUnit.isHasPatients() ) - { - return INPUT; - } - - return SUCCESS; - } -} === removed file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/VerifyOrgunitRegistrationAction.java' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/VerifyOrgunitRegistrationAction.java 2012-03-27 14:19:09 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/VerifyOrgunitRegistrationAction.java 1970-01-01 00:00:00 +0000 @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2004-2012, 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.caseentry.action.patient; - -import org.hisp.dhis.organisationunit.OrganisationUnit; -import org.hisp.dhis.oust.manager.SelectionTreeManager; - -import com.opensymphony.xwork2.Action; - -/** - * @author Chau Thu Tran - * - * @version $VerifyOrgunitRegistrationAction.java Mar 27, 2012 04:58:27 PM$ - */ -public class VerifyOrgunitRegistrationAction - implements Action -{ - // ------------------------------------------------------------------------- - // Dependencies - // ------------------------------------------------------------------------- - - private SelectionTreeManager selectionTreeManager; - - public void setSelectionTreeManager( SelectionTreeManager selectionTreeManager ) - { - this.selectionTreeManager = selectionTreeManager; - } - - // ------------------------------------------------------------------------- - // Action implementation - // ------------------------------------------------------------------------- - - public String execute() - throws Exception - { - OrganisationUnit orgunit = selectionTreeManager.getReloadedSelectedOrganisationUnit(); - - if ( orgunit == null || !orgunit.isHasPatients() ) - { - return INPUT; - } - - return SUCCESS; - } -} === 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 2012-05-23 19:48:53 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml 2012-05-24 05:13:57 +0000 @@ -400,14 +400,6 @@ - - - - @@ -559,14 +551,6 @@ - - - - === 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 2012-05-09 08:30:28 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml 2012-05-24 05:13:57 +0000 @@ -351,14 +351,6 @@ F_PATIENT_MANAGEMENT - - - /dhis-web-commons/ajax/jsonResponseSuccess.vm - - /dhis-web-commons/ajax/jsonResponseInput.vm - - /content.vm @@ -462,14 +454,6 @@ F_PATIENT_UPDATE - - - /dhis-web-commons/ajax/jsonResponseSuccess.vm - - /dhis-web-commons/ajax/jsonResponseInput.vm - - === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js 2012-05-23 15:02:50 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js 2012-05-24 05:13:57 +0000 @@ -5,38 +5,17 @@ var COLOR_RED = '#ff8a8a'; var COLOR_GREY = '#cccccc'; -function organisationUnitSelected( orgUnits ) +function organisationUnitSelected( orgUnits, orgUnitNames ) { showById('selectDiv'); - disable('listPatientBtn'); - - hideById('searchPatientDiv'); + showById('searchPatientDiv'); hideById('listPatientDiv'); hideById('editPatientDiv'); hideById('enrollmentDiv'); hideById('listRelationshipDiv'); hideById('addRelationshipDiv'); hideById('migrationPatientDiv'); - - $.getJSON( 'organisationUnitHasPatients.action', {orgunitId:orgUnits[0]} - , function( json ) - { - var type = json.response; - setFieldValue('selectedOrgunitText', json.message ); - - if( type == 'success' ) - { - showById('searchPatientDiv'); - enable('listPatientBtn'); - setInnerHTML('warnmessage',''); - setFieldValue('selectedOrgunitText', json.message ); - } - else if( type == 'input' ) - { - setInnerHTML('warnmessage', i18n_can_not_register_patient_for_orgunit); - disable('listPatientBtn'); - } - } ); + setFieldValue("selectedOrgunitText", orgUnitNames[0]); } selection.setListenerFunction( organisationUnitSelected ); @@ -875,23 +854,6 @@ }); } -function verifyOrgunitRegistration( patientId ) -{ - $.getJSON( 'verifyOrgunitRegistration.action', {} - , function( json ) - { - var type = json.response; - if( type == 'success' ) - { - registerPatientLocation( patientId ); - } - else if( type == 'input' ) - { - showWarningMessage( i18n_can_not_register_patient_for_orgunit); - } - } ); -} - function registerPatientLocation( patientId ) { $.getJSON( 'registerPatientLocation.action',{ patientId:patientId } === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientLocation.vm' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientLocation.vm 2012-03-27 14:19:09 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientLocation.vm 2012-05-24 05:13:57 +0000 @@ -10,7 +10,7 @@ - + === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/selectPatient.vm' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/selectPatient.vm 2012-05-03 10:18:41 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/selectPatient.vm 2012-05-24 05:13:57 +0000 @@ -7,14 +7,16 @@ - - + + + + -