=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataentryform/DataEntryFormService.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataentryform/DataEntryFormService.java 2015-01-17 07:41:26 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataentryform/DataEntryFormService.java 2015-03-19 12:47:13 +0000 @@ -122,26 +122,23 @@ * Prepares the data entry form code by injecting the data element operand * name as value and title for each entry field. * - * @param htmlCode the HTML code of the data entry form. + * @param dataEntryForm the data entry form. + * @param dataSet the data set associated with this form. * @param i18n the i18n object. * @return HTML code for the data entry form. */ - String prepareDataEntryFormForEdit( String htmlCode, I18n i18n ); + String prepareDataEntryFormForEdit( DataEntryForm dataEntryForm, DataSet dataSet, I18n i18n ); /** * Prepares the data entry form for data entry by injecting required javascripts * and drop down lists. * - * @param htmlCode the HTML code of the data entry form. - * @param dataValues the data values which are registered for this form. - * @param minMaxMap a map with data element operand identifier as key and - * corresponding min max data element as value. - * @param disabled whether this form is disabled for entry. + * @param dataEntryForm the data entry form. + * @param dataSet the data set associated with this form. * @param i18n the i18n object. - * @param dataSet the data set associated with this form. * @return HTML code for the form. */ - String prepareDataEntryFormForEntry( String htmlCode, I18n i18n, DataSet dataSet ); + String prepareDataEntryFormForEntry( DataEntryForm dataEntryForm, DataSet dataSet, I18n i18n ); Set getDataElementsInDataEntryForm( DataSet dataSet ); === modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataentryform/DefaultDataEntryFormService.java' --- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataentryform/DefaultDataEntryFormService.java 2015-03-19 12:24:51 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataentryform/DefaultDataEntryFormService.java 2015-03-19 12:47:13 +0000 @@ -187,23 +187,25 @@ } @Override - public String prepareDataEntryFormForEdit( String htmlCode, I18n i18n ) + public String prepareDataEntryFormForEdit( DataEntryForm dataEntryForm, DataSet dataSet, I18n i18n ) { //TODO HTML encode names - if ( htmlCode == null ) + if ( dataEntryForm == null || !dataEntryForm.hasForm() || dataSet == null ) { return null; } - + CachingMap optionComboMap = new CachingMap<>(); + + optionComboMap.putAll( IdentifiableObjectUtils.getUidObjectMap( dataSet.getDataElementOptionCombos() ) ); IdentifiableObjectCallable optionComboCallabel = new IdentifiableObjectCallable( idObjectManager, DataElementCategoryOptionCombo.class, null ); StringBuffer sb = new StringBuffer(); - Matcher inputMatcher = INPUT_PATTERN.matcher( htmlCode ); + Matcher inputMatcher = INPUT_PATTERN.matcher( dataEntryForm.getHtmlCode() ); while ( inputMatcher.find() ) { @@ -274,11 +276,11 @@ } @Override - public String prepareDataEntryFormForEntry( String htmlCode, I18n i18n, DataSet dataSet ) + public String prepareDataEntryFormForEntry( DataEntryForm dataEntryForm, DataSet dataSet, I18n i18n ) { //TODO HTML encode names - if ( htmlCode == null ) + if ( dataEntryForm == null || !dataEntryForm.hasForm() || dataSet == null ) { return null; } @@ -300,7 +302,7 @@ StringBuffer sb = new StringBuffer(); - Matcher inputMatcher = INPUT_PATTERN.matcher( htmlCode ); + Matcher inputMatcher = INPUT_PATTERN.matcher( dataEntryForm.getHtmlCode() ); while ( inputMatcher.find() ) { === modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/LoadFormAction.java' --- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/LoadFormAction.java 2015-03-18 23:16:20 +0000 +++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/LoadFormAction.java 2015-03-19 12:47:13 +0000 @@ -244,7 +244,7 @@ if ( DataSet.TYPE_CUSTOM.equals( dataSetType ) && dataSet.hasDataEntryForm() ) { dataEntryForm = dataSet.getDataEntryForm(); - customDataEntryFormCode = dataEntryFormService.prepareDataEntryFormForEntry( dataEntryForm.getHtmlCode(), i18n, dataSet ); + customDataEntryFormCode = dataEntryFormService.prepareDataEntryFormForEntry( dataEntryForm, dataSet, i18n ); return dataSetType; } === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/dataentryform/ViewDataEntryFormAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/dataentryform/ViewDataEntryFormAction.java 2015-01-17 07:41:26 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/dataentryform/ViewDataEntryFormAction.java 2015-03-19 12:47:13 +0000 @@ -171,8 +171,7 @@ dataEntryForm = dataSet.getDataEntryForm(); - dataEntryValue = dataEntryForm != null ? dataEntryFormService.prepareDataEntryFormForEdit( dataEntryForm - .getHtmlCode(), i18n ) : ""; + dataEntryValue = dataEntryForm != null ? dataEntryFormService.prepareDataEntryFormForEdit( dataEntryForm, dataSet, i18n ) : ""; autoSave = (Boolean) userSettingService.getUserSetting( UserSettingService.AUTO_SAVE_DATA_ENTRY_FORM, false );