← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13911: PBF Modifications

 

------------------------------------------------------------
revno: 13911
committer: Samta Bajpayee<samta-bajpayee@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2014-02-01 06:47:08 +0000
message:
  PBF Modifications
modified:
  local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/action/AddTariffDataAction.java
  local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/action/GetDataElementforTariffAction.java
  local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/impl/HibernateQualityMaxValueStore.java
  local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/quality/dataentry/GetOrganisationUnitForMaxAction.java
  local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/quality/dataentry/QualityMaxInitAction.java
  local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/quality/dataentry/ValidateQualityMaxDataAction.java
  local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/javascript/qualityMaxDataEntry.js
  local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/loadDataElementsforTariff.vm
  local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/tariffStatus.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-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/action/AddTariffDataAction.java'
--- local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/action/AddTariffDataAction.java	2014-01-18 12:25:59 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/action/AddTariffDataAction.java	2014-02-01 06:47:08 +0000
@@ -140,8 +140,14 @@
             tariffDataValue = new TariffDataValue();
             
             tariffDataValue.setValue( Double.parseDouble( tariff ) );
-            tariffDataValue.setTarget(Integer.parseInt(target));
-            tariffDataValue.setTargetPercentage(Double.parseDouble(targetPercentage));
+            if(!target.equals(""))
+            {
+            	tariffDataValue.setTarget(Integer.parseInt(target));
+            }
+            if(!targetPercentage.equals(""))
+            {
+            	tariffDataValue.setTargetPercentage(Double.parseDouble(targetPercentage));
+            }            
             tariffDataValue.setStartDate( sDate );
             tariffDataValue.setEndDate( eDate );
             tariffDataValue.setTimestamp( new Date() );
@@ -156,8 +162,14 @@
         else
         {
             tariffDataValue.setValue( Double.parseDouble( tariff ) );
-            tariffDataValue.setTarget(Integer.parseInt(target));
-            tariffDataValue.setTargetPercentage(Double.parseDouble(targetPercentage));
+            if(!target.equals(""))
+            {
+            	tariffDataValue.setTarget(Integer.parseInt(target));
+            }
+            if(!targetPercentage.equals(""))
+            {
+            	tariffDataValue.setTargetPercentage(Double.parseDouble(targetPercentage));
+            }   
             tariffDataValue.setTimestamp( new Date() );
             tariffDataValue.setStoredBy( currentUserService.getCurrentUsername() );
             

=== modified file 'local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/action/GetDataElementforTariffAction.java'
--- local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/action/GetDataElementforTariffAction.java	2013-12-24 12:23:11 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/action/GetDataElementforTariffAction.java	2014-02-01 06:47:08 +0000
@@ -88,8 +88,8 @@
         Constant tariffDataElement = constantService.getConstantByName( TARIFF_DATAELEMENT );
         if ( tariff_authority == null )
         {
-            tariff_setting_authority = "Level 3";
-            List<OrganisationUnit> allLevelOrg = new ArrayList<OrganisationUnit>( organisationUnitService.getOrganisationUnitsAtLevel( 3 ) );
+            tariff_setting_authority = "Level 1";
+            List<OrganisationUnit> allLevelOrg = new ArrayList<OrganisationUnit>( organisationUnitService.getOrganisationUnitsAtLevel( 1 ) );
             for ( OrganisationUnit org : allLevelOrg )
             {
                 levelOrgUnitIds.add( "\"" + org.getUid() + "\"" );

=== modified file 'local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/impl/HibernateQualityMaxValueStore.java'
--- local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/impl/HibernateQualityMaxValueStore.java	2014-01-18 12:25:59 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/impl/HibernateQualityMaxValueStore.java	2014-02-01 06:47:08 +0000
@@ -6,6 +6,7 @@
 import org.hibernate.Criteria;
 import org.hibernate.Session;
 import org.hibernate.SessionFactory;
+import org.hibernate.criterion.Projections;
 import org.hibernate.criterion.Restrictions;
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataset.DataSet;

=== modified file 'local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/quality/dataentry/GetOrganisationUnitForMaxAction.java'
--- local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/quality/dataentry/GetOrganisationUnitForMaxAction.java	2014-01-23 12:25:55 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/quality/dataentry/GetOrganisationUnitForMaxAction.java	2014-02-01 06:47:08 +0000
@@ -76,16 +76,7 @@
 
     public String execute() throws Exception
     {
-        OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( orgUnitId );
-        
-        List<OrganisationUnit> organisationUnitList = new ArrayList<OrganisationUnit>( organisationUnitService.getOrganisationUnitWithChildren(organisationUnit.getId()) ) ;
-        for (OrganisationUnit org : organisationUnitList) 
-        {
-        	if(!dataSets.containsAll(org.getDataSets()))
-        	{
-        		dataSets.addAll(org.getDataSets());
-        	}
-		}
+        OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( orgUnitId );        
         
         List<Lookup> lookups = new ArrayList<Lookup>( lookupService.getAllLookupsByType( Lookup.DS_QUALITY_TYPE ) );
         
@@ -103,7 +94,7 @@
             }
         }
         
-        dataSets.retainAll( pbfDataSets );
+        dataSets.addAll( pbfDataSets );
         Collections.sort(dataSets);
         
        

=== modified file 'local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/quality/dataentry/QualityMaxInitAction.java'
--- local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/quality/dataentry/QualityMaxInitAction.java	2014-01-23 12:25:55 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/quality/dataentry/QualityMaxInitAction.java	2014-02-01 06:47:08 +0000
@@ -140,14 +140,7 @@
             organisationUnit = organisationUnitService.getOrganisationUnit( orgUnitId );
            
         }
-        List<OrganisationUnit> organisationUnitList = new ArrayList<OrganisationUnit>( organisationUnitService.getLeafOrganisationUnits(organisationUnit.getId()) ) ;
-        for (OrganisationUnit org : organisationUnitList) 
-        {
-        	if(!dataSets.containsAll(org.getDataSets()))
-        	{
-        		dataSets.addAll(org.getDataSets());
-        	}
-		}
+        
        // dataSets = new ArrayList<DataSet>( organisationUnit.getDataSets() );
         
         List<Lookup> lookups = new ArrayList<Lookup>( lookupService.getAllLookupsByType( Lookup.DS_QUALITY_TYPE ) );
@@ -166,7 +159,7 @@
             }
         }
         
-        dataSets.retainAll( pbfDataSets );
+        dataSets.addAll( pbfDataSets );
         Collections.sort(dataSets);
         return SUCCESS;
     }

=== modified file 'local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/quality/dataentry/ValidateQualityMaxDataAction.java'
--- local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/quality/dataentry/ValidateQualityMaxDataAction.java	2014-01-23 12:25:55 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/quality/dataentry/ValidateQualityMaxDataAction.java	2014-02-01 06:47:08 +0000
@@ -104,12 +104,19 @@
     {
         return message;
     }
+    
+    private String maximumRange;
+    
+    public String getMaximumRange() 
+    {
+		return maximumRange;
+	}
 
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
 
-    public String execute()
+	public String execute()
         throws Exception
     {
         SimpleDateFormat dateFormat = new SimpleDateFormat( "yyyy-MM-dd" );
@@ -126,22 +133,22 @@
             if ( qualityMaxValue.getStartDate().getTime() ==  sDate.getTime() && qualityMaxValue.getEndDate().getTime() ==  eDate.getTime() )
             {
                 message = message && false;
-            }
-            else if (qualityMaxValue.getStartDate().before(sDate) && qualityMaxValue.getEndDate().after(eDate) )
-            {            	
-            	message = message || true;
-            	//System.out.println("Start date is less and end date is greater or equal "+message);
-            }
-            else if (qualityMaxValue.getStartDate().getTime() >  sDate.getTime() && qualityMaxValue.getEndDate().getTime() <=  eDate.getTime() )
-            {            	
-            	message = message || true;
-            	//System.out.println("Start date is less and end date is greater or equal "+message);
-            }
-            else if (qualityMaxValue.getStartDate().getTime() <=  sDate.getTime() && qualityMaxValue.getEndDate().getTime() >  eDate.getTime() )
-            {            	
-            	message = message || true;
-            	//System.out.println("Start date is greater than and end date in less "+message);
-            }           
+            }  
+            else if (sDate.before( qualityMaxValue.getStartDate() ) && eDate.after( qualityMaxValue.getEndDate() ) )
+            {            	
+            	message = message || true;            	
+            	//System.out.println("Start date is less and end date is greater or equal "+message);
+            }
+            else if (qualityMaxValue.getStartDate().getTime() >=  sDate.getTime() && sDate.getTime() <= qualityMaxValue.getEndDate().getTime() )
+            {            	
+            	message = message || true;
+            	//System.out.println("Start date between max start date and end date "+message);
+            }
+            else if (qualityMaxValue.getStartDate().getTime() >=  eDate.getTime() && eDate.getTime() <= qualityMaxValue.getEndDate().getTime() )
+            {            	
+            	message = message || true;
+            	//System.out.println("End date between max start date and end date  "+message);
+            }            
             else
             {
             	message = message && false;

=== modified file 'local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/javascript/qualityMaxDataEntry.js'
--- local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/javascript/qualityMaxDataEntry.js	2014-01-23 12:25:55 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/javascript/qualityMaxDataEntry.js	2014-02-01 06:47:08 +0000
@@ -8,7 +8,7 @@
 	var LocaleColor = 'black';
 	var countryTags;
 	
-function orgUnitHasBeenSelected( orgUnitIds )
+function orgUnitHasBeenSelected( orgUnitIds , orgUnitNames )
 {
 	$( '#dataEntryFormDiv' ).html( '' );
 	var bValue = false;
@@ -21,10 +21,16 @@
 	}
 	if(bValue == false)
 	{
+		$("#startDate").val('');
+		$("#endDate").val('');
 		disable('dataSetId');
         disable('selectedPeriodId');
         disable('startDate');
         disable('endDate');
+       
+        setFieldValue('orgUnitName', orgUnitNames[0] );
+        setFieldValue('selectedOrgunitName', orgUnitNames[0] );
+        $("select#dataSetId option[value=-1]").attr('selected', 'selected');
 		alert('Please Select Correct level OrgUnit');
 	}
 	else
@@ -44,7 +50,8 @@
 					enable('startDate');
 					enable('endDate');
 					var options = '';
-		            $.each(json.dataSets, function(i, obj){
+					options += '<option value="-1">Please Select</option>';
+		            $.each(json.dataSets, function(i, obj){		            	
 		                options += '<option value="' + obj.id + '"'+ '>' + obj.name + '</option>';
 		            });
 		            $("select#dataSetId").html(options);

=== modified file 'local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/loadDataElementsforTariff.vm'
--- local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/loadDataElementsforTariff.vm	2014-01-23 12:25:55 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/loadDataElementsforTariff.vm	2014-02-01 06:47:08 +0000
@@ -86,12 +86,19 @@
 	}
 	if(bValue == false)
 	{
+		document.getElementById('simpleCombo').style.display = 'none';
+		setFieldValue("orgUnit", orgUnitNames[0]);
+        disable('orgUnit');
+		document.getElementById('loadTariffDetails').style.display = 'none';
 		alert('Please Select Correct level OrgUnit');
 	}
 	else
 	{
+		document.getElementById('simpleCombo').style.display = 'block';
+        enable('orgUnit'); 
 		setFieldValue("orgUnit", orgUnitNames[0]);
 		setFieldValue("orgUnitUid", orgUnits[0]);
+		document.getElementById('loadTariffDetails').style.display = 'block';
 		if($('#dataElementName').val() != '')
 		{
 			getTariffData();	
@@ -144,8 +151,8 @@
 		<td >&nbsp;</td>
     </tr>
 	<tr>
-		<td ><div id="simpleCombo"></div></td>
-		<td ><input type="button" id="addDataElement" value="Add DataElement" disabled/></td>
+		<td ><div id="simpleCombo" style="display:none;"></div></td>
+		<td ><input type="button" id="addDataElement" value="Add DataElement" disabled style="display:none;"/></td>
 	</tr>
 </table>
 <br/><br/><br/>

=== modified file 'local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/tariffStatus.vm'
--- local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/tariffStatus.vm	2014-01-18 12:25:59 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/tariffStatus.vm	2014-02-01 06:47:08 +0000
@@ -1,3 +1,6 @@
 {
 "message":"${message}"
+#if($maximumRange)
+	,"maximumRange":"${maximumRange}"
+#end
 }
\ No newline at end of file