dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #34236
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 17578: local/in Set versionsSet versions to 2.18-SNAPSHOT and add validation in Partner add/update in Ma...
------------------------------------------------------------
revno: 17578
committer: Mithilesh Kumar Thakur <mithilesh.hisp@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2014-11-25 07:11:06 +0000
message:
local/in Set versionsSet versions to 2.18-SNAPSHOT and add validation in Partner add/update in Maintenance RBF
added:
local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/partner/action/ValidatePartnerAction.java
modified:
local/in/dhis-in-api/pom.xml
local/in/dhis-in-services/dhis-in-service-coldchain/pom.xml
local/in/dhis-in-services/dhis-in-service-configuration/pom.xml
local/in/dhis-in-services/dhis-in-service-lookup/pom.xml
local/in/dhis-in-services/dhis-in-service-reports/pom.xml
local/in/dhis-in-services/dhis-in-service-survey/pom.xml
local/in/dhis-in-services/dhis-service-aggregationengine/pom.xml
local/in/dhis-in-services/pom.xml
local/in/dhis-web-coldchain/pom.xml
local/in/dhis-web-maintenance-ccem/pom.xml
local/in/dhis-web-maintenance-in/pom.xml
local/in/dhis-web-maintenance-pbf/pom.xml
local/in/dhis-web-maintenance-rbf/pom.xml
local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/partner/action/GetDataElementAndPeriodListAction.java
local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/partner/action/PartnerFundManagement.java
local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/partner/action/SavePartnerDetailsResultAction.java
local/in/dhis-web-maintenance-rbf/src/main/resources/META-INF/dhis/beans.xml
local/in/dhis-web-maintenance-rbf/src/main/resources/org/hisp/dhis/rbf/i18n_module.properties
local/in/dhis-web-maintenance-rbf/src/main/resources/struts.xml
local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/javascript/partner.js
local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/partnerForm.vm
local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/partnerFundManagement.vm
local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/updatePartnerForm.vm
--
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 'local/in/dhis-in-api/pom.xml'
--- local/in/dhis-in-api/pom.xml 2014-07-25 10:59:27 +0000
+++ local/in/dhis-in-api/pom.xml 2014-11-25 07:11:06 +0000
@@ -4,7 +4,7 @@
<parent>
<groupId>org.hisp.dhis</groupId>
<artifactId>dhis</artifactId>
- <version>2.17-SNAPSHOT</version>
+ <version>2.18-SNAPSHOT</version>
</parent>
<artifactId>dhis-in-api</artifactId>
=== modified file 'local/in/dhis-in-services/dhis-in-service-coldchain/pom.xml'
--- local/in/dhis-in-services/dhis-in-service-coldchain/pom.xml 2014-01-10 07:08:30 +0000
+++ local/in/dhis-in-services/dhis-in-service-coldchain/pom.xml 2014-11-25 07:11:06 +0000
@@ -6,7 +6,7 @@
<parent>
<groupId>org.hisp.dhis</groupId>
<artifactId>dhis-in-services</artifactId>
- <version>2.15-SNAPSHOT</version>
+ <version>2.18-SNAPSHOT</version>
</parent>
<artifactId>dhis-in-service-coldchain</artifactId>
=== modified file 'local/in/dhis-in-services/dhis-in-service-configuration/pom.xml'
--- local/in/dhis-in-services/dhis-in-service-configuration/pom.xml 2014-07-25 10:59:27 +0000
+++ local/in/dhis-in-services/dhis-in-service-configuration/pom.xml 2014-11-25 07:11:06 +0000
@@ -5,7 +5,7 @@
<parent>
<groupId>org.hisp.dhis</groupId>
<artifactId>dhis-in-services</artifactId>
- <version>2.17-SNAPSHOT</version>
+ <version>2.18-SNAPSHOT</version>
</parent>
<artifactId>dhis-in-service-configuration</artifactId>
=== modified file 'local/in/dhis-in-services/dhis-in-service-lookup/pom.xml'
--- local/in/dhis-in-services/dhis-in-service-lookup/pom.xml 2014-07-25 10:59:27 +0000
+++ local/in/dhis-in-services/dhis-in-service-lookup/pom.xml 2014-11-25 07:11:06 +0000
@@ -6,7 +6,7 @@
<parent>
<groupId>org.hisp.dhis</groupId>
<artifactId>dhis-in-services</artifactId>
- <version>2.17-SNAPSHOT</version>
+ <version>2.18-SNAPSHOT</version>
</parent>
<artifactId>dhis-in-service-lookup</artifactId>
=== modified file 'local/in/dhis-in-services/dhis-in-service-reports/pom.xml'
--- local/in/dhis-in-services/dhis-in-service-reports/pom.xml 2014-09-05 05:06:07 +0000
+++ local/in/dhis-in-services/dhis-in-service-reports/pom.xml 2014-11-25 07:11:06 +0000
@@ -6,7 +6,7 @@
<parent>
<groupId>org.hisp.dhis</groupId>
<artifactId>dhis-in-services</artifactId>
- <version>2.17-SNAPSHOT</version>
+ <version>2.18-SNAPSHOT</version>
</parent>
<artifactId>dhis-in-service-reports</artifactId>
=== modified file 'local/in/dhis-in-services/dhis-in-service-survey/pom.xml'
--- local/in/dhis-in-services/dhis-in-service-survey/pom.xml 2014-09-05 05:06:07 +0000
+++ local/in/dhis-in-services/dhis-in-service-survey/pom.xml 2014-11-25 07:11:06 +0000
@@ -6,7 +6,7 @@
<parent>
<groupId>org.hisp.dhis</groupId>
<artifactId>dhis-in-services</artifactId>
- <version>2.17-SNAPSHOT</version>
+ <version>2.18-SNAPSHOT</version>
</parent>
<artifactId>dhis-in-service-survey</artifactId>
=== modified file 'local/in/dhis-in-services/dhis-service-aggregationengine/pom.xml'
--- local/in/dhis-in-services/dhis-service-aggregationengine/pom.xml 2014-09-05 05:06:07 +0000
+++ local/in/dhis-in-services/dhis-service-aggregationengine/pom.xml 2014-11-25 07:11:06 +0000
@@ -6,7 +6,7 @@
<parent>
<groupId>org.hisp.dhis</groupId>
<artifactId>dhis-in-services</artifactId>
- <version>2.17-SNAPSHOT</version>
+ <version>2.18-SNAPSHOT</version>
</parent>
<artifactId>dhis-service-aggregationengine-default</artifactId>
=== modified file 'local/in/dhis-in-services/pom.xml'
--- local/in/dhis-in-services/pom.xml 2014-09-05 05:06:07 +0000
+++ local/in/dhis-in-services/pom.xml 2014-11-25 07:11:06 +0000
@@ -6,7 +6,7 @@
<parent>
<groupId>org.hisp.dhis</groupId>
<artifactId>dhis</artifactId>
- <version>2.17-SNAPSHOT</version>
+ <version>2.18-SNAPSHOT</version>
</parent>
<artifactId>dhis-in-services</artifactId>
=== modified file 'local/in/dhis-web-coldchain/pom.xml'
--- local/in/dhis-web-coldchain/pom.xml 2014-01-10 07:08:30 +0000
+++ local/in/dhis-web-coldchain/pom.xml 2014-11-25 07:11:06 +0000
@@ -6,7 +6,7 @@
<parent>
<groupId>org.hisp.dhis</groupId>
<artifactId>dhis-web</artifactId>
- <version>2.15-SNAPSHOT</version>
+ <version>2.18-SNAPSHOT</version>
</parent>
<repositories>
<repository>
=== modified file 'local/in/dhis-web-maintenance-ccem/pom.xml'
--- local/in/dhis-web-maintenance-ccem/pom.xml 2014-01-10 07:08:30 +0000
+++ local/in/dhis-web-maintenance-ccem/pom.xml 2014-11-25 07:11:06 +0000
@@ -6,7 +6,7 @@
<parent>
<groupId>org.hisp.dhis</groupId>
<artifactId>dhis-web</artifactId>
- <version>2.15-SNAPSHOT</version>
+ <version>2.18-SNAPSHOT</version>
</parent>
<repositories>
<repository>
=== modified file 'local/in/dhis-web-maintenance-in/pom.xml'
--- local/in/dhis-web-maintenance-in/pom.xml 2014-07-25 10:59:27 +0000
+++ local/in/dhis-web-maintenance-in/pom.xml 2014-11-25 07:11:06 +0000
@@ -6,7 +6,7 @@
<parent>
<groupId>org.hisp.dhis</groupId>
<artifactId>dhis-web</artifactId>
- <version>2.17-SNAPSHOT</version>
+ <version>2.18-SNAPSHOT</version>
</parent>
<artifactId>dhis-web-maintenance-in</artifactId>
=== modified file 'local/in/dhis-web-maintenance-pbf/pom.xml'
--- local/in/dhis-web-maintenance-pbf/pom.xml 2014-07-25 10:59:27 +0000
+++ local/in/dhis-web-maintenance-pbf/pom.xml 2014-11-25 07:11:06 +0000
@@ -6,7 +6,7 @@
<parent>
<groupId>org.hisp.dhis</groupId>
<artifactId>dhis-web</artifactId>
- <version>2.17-SNAPSHOT</version>
+ <version>2.18-SNAPSHOT</version>
</parent>
<repositories>
<repository>
=== modified file 'local/in/dhis-web-maintenance-rbf/pom.xml'
--- local/in/dhis-web-maintenance-rbf/pom.xml 2014-09-04 10:07:26 +0000
+++ local/in/dhis-web-maintenance-rbf/pom.xml 2014-11-25 07:11:06 +0000
@@ -6,7 +6,7 @@
<parent>
<groupId>org.hisp.dhis</groupId>
<artifactId>dhis-web</artifactId>
- <version>2.17-SNAPSHOT</version>
+ <version>2.18-SNAPSHOT</version>
</parent>
<repositories>
<repository>
=== modified file 'local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/partner/action/GetDataElementAndPeriodListAction.java'
--- local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/partner/action/GetDataElementAndPeriodListAction.java 2014-10-24 11:05:35 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/partner/action/GetDataElementAndPeriodListAction.java 2014-11-25 07:11:06 +0000
@@ -75,6 +75,8 @@
dataElements = new ArrayList<DataElement>( dataSet.getDataElements() );
+ Collections.sort( dataElements );
+
String periodTypeName = dataSet.getPeriodType().getName();
PeriodType periodType = periodService.getPeriodTypeByName( periodTypeName );
=== modified file 'local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/partner/action/PartnerFundManagement.java'
--- local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/partner/action/PartnerFundManagement.java 2014-11-15 09:02:15 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/partner/action/PartnerFundManagement.java 2014-11-25 07:11:06 +0000
@@ -1,6 +1,7 @@
package org.hisp.dhis.rbf.partner.action;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import org.hisp.dhis.dataset.DataSet;
@@ -63,16 +64,34 @@
Lookup partnerOptionSetLookup = lookupService.getLookupByName( Lookup.OPTION_SET_PARTNER );
- OptionSet activitesOptionSet = optionService
- .getOptionSet( Integer.parseInt( partnerOptionSetLookup.getValue() ) );
+ OptionSet activitesOptionSet = optionService.getOptionSet( Integer.parseInt( partnerOptionSetLookup.getValue() ) );
if ( activitesOptionSet != null )
{
options = new ArrayList<Option>( activitesOptionSet.getOptions() );
+
+ dataSets = new ArrayList<DataSet>( dataSetService.getAllDataSets() );
+
+ List<Lookup> lookups = new ArrayList<Lookup>( lookupService.getAllLookupsByType( Lookup.DS_PBF_TYPE ) );
+
+ List<DataSet> pbfDataSets = new ArrayList<DataSet>();
+
+ for( Lookup lookup : lookups )
+ {
+ Integer dataSetId = Integer.parseInt( lookup.getValue() );
+
+ DataSet dataSet = dataSetService.getDataSet( dataSetId );
+ if( dataSet != null )
+ {
+ pbfDataSets.add(dataSet);
+ }
+ }
+
+ dataSets.retainAll( pbfDataSets );
+ Collections.sort(dataSets);
+
}
- dataSets = new ArrayList<DataSet>( dataSetService.getAllDataSets() );
-
return SUCCESS;
}
}
=== modified file 'local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/partner/action/SavePartnerDetailsResultAction.java'
--- local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/partner/action/SavePartnerDetailsResultAction.java 2014-11-20 06:34:00 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/partner/action/SavePartnerDetailsResultAction.java 2014-11-25 07:11:06 +0000
@@ -171,8 +171,13 @@
//System.out.println( " Size of Children " + orgUnitList.size() );
//System.out.println( " Size of Period List is " + periodsBetweenDates.size() );
-
- for ( OrganisationUnit organisationUnit : orgUnitList )
+
+
+ Set<OrganisationUnit> dataSetSources = new HashSet<OrganisationUnit>( dataSet.getSources() );
+
+ dataSetSources.retainAll( orgUnitList );
+
+ for ( OrganisationUnit organisationUnit : dataSetSources )
{
if( periodsBetweenDates!= null && periodsBetweenDates.size() > 0 )
{
@@ -218,9 +223,6 @@
}
// save partnet in partner
- Set<OrganisationUnit> dataSetSources = new HashSet<OrganisationUnit>( dataSet.getSources() );
-
- dataSetSources.retainAll( orgUnitList );
//System.out.println( " Data Set source size " + dataSetSources.size() );
=== added file 'local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/partner/action/ValidatePartnerAction.java'
--- local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/partner/action/ValidatePartnerAction.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/partner/action/ValidatePartnerAction.java 2014-11-25 07:11:06 +0000
@@ -0,0 +1,179 @@
+package org.hisp.dhis.rbf.partner.action;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementService;
+import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.dataset.DataSetService;
+import org.hisp.dhis.i18n.I18n;
+import org.hisp.dhis.option.Option;
+import org.hisp.dhis.option.OptionService;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
+import org.hisp.dhis.oust.manager.SelectionTreeManager;
+import org.hisp.dhis.period.PeriodService;
+import org.hisp.dhis.rbf.api.PartnerService;
+import org.hisp.dhis.user.CurrentUserService;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Mithilesh Kumar Thakur
+ */
+public class ValidatePartnerAction implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private SelectionTreeManager selectionTreeManager;
+
+ public void setSelectionTreeManager( SelectionTreeManager selectionTreeManager )
+ {
+ this.selectionTreeManager = selectionTreeManager;
+ }
+
+ @Autowired
+ private OrganisationUnitService organisationUnitService;
+
+ @Autowired
+ private PartnerService partnerService;
+
+ @Autowired
+ private CurrentUserService currentUserService;
+
+ @Autowired
+ private DataSetService dataSetService;
+
+ @Autowired
+ private DataElementService dataElementService;
+
+ @Autowired
+ private PeriodService periodService;
+
+ @Autowired
+ private OptionService optionService;
+
+
+ // -------------------------------------------------------------------------
+ // I18n
+ // -------------------------------------------------------------------------
+
+ private I18n i18n;
+
+ public void setI18n( I18n i18n )
+ {
+ this.i18n = i18n;
+ }
+
+
+
+ // -------------------------------------------------------------------------
+ // Input & Output
+ // -------------------------------------------------------------------------
+
+ private Integer dataSetId;
+
+ public void setDataSetId( Integer dataSetId )
+ {
+ this.dataSetId = dataSetId;
+ }
+
+ private Integer optionSetId;
+
+ public void setOptionSetId( Integer optionSetId )
+ {
+ this.optionSetId = optionSetId;
+ }
+
+ private Integer dataElementId;
+
+ public void setDataElementId( Integer dataElementId )
+ {
+ this.dataElementId = dataElementId;
+ }
+
+ private String message;
+
+ public String getMessage()
+ {
+ return message;
+ }
+ // -------------------------------------------------------------------------
+ // Action
+ // -------------------------------------------------------------------------
+
+ public String execute() throws Exception
+ {
+ System.out.println( " Inside validate partner" );
+
+ DataSet dataSet = dataSetService.getDataSet( dataSetId );
+
+ if ( dataSet == null )
+ {
+ message = i18n.getString( "please_select_dataset" );
+
+ return INPUT;
+ }
+
+ Option option = optionService.getOption( optionSetId );
+
+ if ( option == null )
+ {
+ message = i18n.getString( "please_select_partner" );
+
+ return INPUT;
+ }
+
+ DataElement dataElement = dataElementService.getDataElement( dataElementId );
+
+ if ( dataElement == null )
+ {
+ message = i18n.getString( "please_select_dataelement" );
+
+ return INPUT;
+ }
+
+ Set<OrganisationUnit> selectedOrgUnitList = new HashSet<OrganisationUnit>( selectionTreeManager.getReloadedSelectedOrganisationUnits() );
+
+ if ( selectedOrgUnitList == null || selectedOrgUnitList.size() == 0 )
+ {
+ message = i18n.getString( "please_select_organisationunit" );
+
+ return INPUT;
+ }
+
+ //System.out.println( " selectedOrgUnitList " + selectedOrgUnitList.size() );
+
+ List<OrganisationUnit> orgUnitList = new ArrayList<OrganisationUnit>();
+
+ for ( OrganisationUnit organisationUnit : selectedOrgUnitList )
+ {
+ orgUnitList.addAll( organisationUnitService.getOrganisationUnitWithChildren( organisationUnit.getId() ) );
+ }
+
+ //System.out.println( " Size of Children " + orgUnitList.size() );
+
+ //System.out.println( " Size of Period List is " + periodsBetweenDates.size() );
+
+ Set<OrganisationUnit> dataSetSources = new HashSet<OrganisationUnit>( dataSet.getSources() );
+
+ dataSetSources.retainAll( orgUnitList );
+
+ //System.out.println( " Size of DataSet Source " + dataSetSources.size() );
+
+ if ( dataSetSources == null || dataSetSources.size() == 0 )
+ {
+ message = i18n.getString( "combination_of_dataset_and_dataelement_does_not_exists_for_the_selected_facility" );
+
+ return INPUT;
+ }
+
+ return SUCCESS;
+ }
+}
=== modified file 'local/in/dhis-web-maintenance-rbf/src/main/resources/META-INF/dhis/beans.xml'
--- local/in/dhis-web-maintenance-rbf/src/main/resources/META-INF/dhis/beans.xml 2014-11-20 06:34:00 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/resources/META-INF/dhis/beans.xml 2014-11-25 07:11:06 +0000
@@ -839,12 +839,19 @@
</bean>
<!-- Remove Partner -->
-
<bean id="org.hisp.dhis.rbf.partner.action.RemovePartnerAction"
class="org.hisp.dhis.rbf.partner.action.RemovePartnerAction"
scope="prototype">
</bean>
+ <!-- Validate Partner -->
+ <bean id="org.hisp.dhis.rbf.partner.action.ValidatePartnerAction"
+ class="org.hisp.dhis.rbf.partner.action.ValidatePartnerAction"
+ scope="prototype">
+ <property name="selectionTreeManager"
+ ref="org.hisp.dhis.oust.manager.SelectionTreeManager" />
+ </bean>
+
<!-- Get DataElements and Periods List-->
<bean id="org.hisp.dhis.rbf.partner.action.GetDataElementAndPeriodListAction"
=== modified file 'local/in/dhis-web-maintenance-rbf/src/main/resources/org/hisp/dhis/rbf/i18n_module.properties'
--- local/in/dhis-web-maintenance-rbf/src/main/resources/org/hisp/dhis/rbf/i18n_module.properties 2014-11-20 06:34:00 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/resources/org/hisp/dhis/rbf/i18n_module.properties 2014-11-25 07:11:06 +0000
@@ -118,7 +118,14 @@
dataSet = DataSet
partner = Partner
dataElement = DataElement
-confirm_delete_partner = Are you sure you want to delete Partner
+confirm_delete_partner = Are you sure you want to delete the record?
+please_select_organisationunit = Please Select Organisationunit
+combination_of_dataset_and_dataelement_does_not_exists_for_the_selected_facility = Combination of dataset and dataelement does not exists for the selected facility
+
+
+
+
+
report_management = Report Management
lookup = Lookup
=== modified file 'local/in/dhis-web-maintenance-rbf/src/main/resources/struts.xml'
--- local/in/dhis-web-maintenance-rbf/src/main/resources/struts.xml 2014-11-20 06:34:00 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/resources/struts.xml 2014-11-25 07:11:06 +0000
@@ -693,6 +693,13 @@
<result name="error" type="velocity-json">/dhis-web-commons/ajax/jsonResponseError.vm</result>
</action>
+
+ <!-- Validate Partner -->
+ <action name="validatePartner" class="org.hisp.dhis.rbf.partner.action.ValidatePartnerAction">
+ <result name="success" type="velocity-json">/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+ <result name="input" type="velocity-json">/dhis-web-commons/ajax/jsonResponseInput.vm</result>
+ <param name="onExceptionReturn">plainTextError</param>
+ </action>
<!-- Get DataElements and Periods List-->
<action name="getDataElementsAndPeriodList" class="org.hisp.dhis.rbf.partner.action.GetDataElementAndPeriodListAction">
=== modified file 'local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/javascript/partner.js'
--- local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/javascript/partner.js 2014-11-20 06:34:00 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/javascript/partner.js 2014-11-25 07:11:06 +0000
@@ -95,6 +95,32 @@
}
+//Validation of Partner Add
+function validateAddPartner()
+{
+
+ var url = "validatePartner.action?";
+ url += '&dataSetId=' + $("#dataSetId").val();
+ url += '&optionSetId=' + $("#optionSetId").val();
+ url += '&dataElementId=' + $("#dataElementId").val();
+
+ //alert( " In Validation :" + url );
+ $.postJSON( url, {}, function( json )
+ {
+ if ( json.response == "input" )
+ {
+ //setHeaderDelayMessage( json.message );
+ //showWarningMessage( json.message )
+ setHeaderDelayMessage( json.message );
+ }
+ else if ( json.response == "success" )
+ {
+ addPartner();
+ }
+ });
+}
+
+
function addPartner()
{
//document.forms['addPartnerForm'].submit();
@@ -172,6 +198,33 @@
}
+
+//Validation of Partner Update
+function validateUpdatePartner()
+{
+
+ var url = "validatePartner.action?";
+ url += '&dataSetId=' + $("#dataSetId").val();
+ url += '&optionSetId=' + $("#optionSetId").val();
+ url += '&dataElementId=' + $("#dataElementId").val();
+
+ //alert( " In Validation :" + url );
+ $.postJSON( url, {}, function( json )
+ {
+ if ( json.response == "input" )
+ {
+ //setHeaderDelayMessage( json.message );
+ //showWarningMessage( json.message )
+ setHeaderDelayMessage( json.message );
+ }
+ else if ( json.response == "success" )
+ {
+ updatePartner();
+ }
+ });
+}
+
+
// update partner form
function updatePartner()
{
@@ -357,6 +410,9 @@
dataElementId.add(option, null);
}
+ loadPartnerList();
+
+
/*var periodList = data.getElementsByTagName("period");
periodId.options[0] = new Option( "Select", "-1" , false, false);
=== modified file 'local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/partnerForm.vm'
--- local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/partnerForm.vm 2014-11-20 06:34:00 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/partnerForm.vm 2014-11-25 07:11:06 +0000
@@ -80,7 +80,8 @@
{
if( isSubmit )
{
- addPartner();
+ //addPartner();
+ validateAddPartner();
}
}
});
@@ -138,7 +139,7 @@
</tr>-->
<tr >
- <td style="width:40%;">Start Date <b class="mandatory">*</b> </td>
+ <td style="width:40%;">Start Date <em title="$i18n.getString( 'required' )" class="required">*</em></td>
<td style="width:60%;"><input type="text" id="startDate" style="width:100%;" name = "startDate" class="{validate:{required:true}}" />
<script type="text/javascript">
datePicker( 'startDate' );
@@ -147,7 +148,7 @@
</tr>
<tr >
- <td style="width:40%;">End Date <b class="mandatory">*</b> </td>
+ <td style="width:40%;">End Date <em title="$i18n.getString( 'required' )" class="required">*</em></td>
<td style="width:60%;"><input type="text" id="endDate" style="width:100%;" name = "endDate" class="{validate:{required:true}}" />
<script type="text/javascript">
datePicker( 'endDate' );
=== modified file 'local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/partnerFundManagement.vm'
--- local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/partnerFundManagement.vm 2014-11-20 06:34:00 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/partnerFundManagement.vm 2014-11-25 07:11:06 +0000
@@ -36,7 +36,7 @@
<tr>
<td><label for="partner">$i18n.getString( "partner" )</label></td>
- <td><select id="optionSetId" name="optionSetId" style="width:220px" #if( $dataSets.size() == 0 ) disabled="disabled" #end >
+ <td><select id="optionSetId" name="optionSetId" style="width:220px" #if( $options.size() == 0 ) disabled="disabled" #end onchange="loadPartnerList();" >
<option value="-1">[$i18n.getString( "select" )]</option>
#foreach( $option in $options )
<option value="$option.id" text="$option.name">$encoder.htmlEncode( $option.name )</option>
@@ -48,7 +48,7 @@
<tr>
<td><label>$i18n.getString( "dataElement" )</label></td>
<td>
- <select id="dataElementId" name = "dataElementId" style="width:220px" onchange="loadPartnerList();" #if( $dataSets.size() == 0 ) disabled="disabled" #end >
+ <select id="dataElementId" name = "dataElementId" style="width:220px" onchange="loadPartnerList();" #if( $dataSets.size() == 0 || $options.size() == 0 ) disabled="disabled" #end >
<option value="-1">[$i18n.getString( "select" )]</option>
</select>
</td>
=== modified file 'local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/updatePartnerForm.vm'
--- local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/updatePartnerForm.vm 2014-11-20 06:34:00 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/updatePartnerForm.vm 2014-11-25 07:11:06 +0000
@@ -20,7 +20,8 @@
{
if( isSubmit )
{
- updatePartner();
+ //updatePartner();
+ validateUpdatePartner();
}
}
});
@@ -49,7 +50,7 @@
</tr>
<tr>
- <td style="width:40%;">Start Date <b class="mandatory">*</b> </td>
+ <td style="width:40%;">Start Date <em title="$i18n.getString( 'required' )" class="required">*</em></td>
<td style="width:60%;"><input type="text" id="startDate" style="width:100%;" name = "startDate" class="{validate:{required:true}}" value="$startDate" />
<script type="text/javascript">
datePicker( 'startDate' );
@@ -58,7 +59,7 @@
</tr>
<tr >
- <td style="width:40%;">End Date <b class="mandatory">*</b> </td>
+ <td style="width:40%;">End Date <em title="$i18n.getString( 'required' )" class="required">*</em></td>
<td style="width:60%;"><input type="text" id="endDate" style="width:100%;" name = "endDate" class="{validate:{required:true}}" value="$endDate" />
<script type="text/javascript">
datePicker( 'endDate' );