dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #29717
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15056: RBF: Changing setting TariffData to orgunit group instead orgunit level
------------------------------------------------------------
revno: 15056
committer: Bharath <chbharathk@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2014-04-28 12:42:33 +0100
message:
RBF: Changing setting TariffData to orgunit group instead orgunit level
modified:
local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/dataentry/LoadDataEntryFormAction.java
local/in/dhis-web-maintenance-rbf/src/main/resources/struts.xml
local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/loadDataElementsforTariff.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-rbf/src/main/java/org/hisp/dhis/rbf/dataentry/LoadDataEntryFormAction.java'
--- local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/dataentry/LoadDataEntryFormAction.java 2014-04-26 11:27:06 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/dataentry/LoadDataEntryFormAction.java 2014-04-28 11:42:33 +0000
@@ -18,6 +18,9 @@
import org.hisp.dhis.dataset.DataSetService;
import org.hisp.dhis.datavalue.DataValueService;
import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
+import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
+import org.hisp.dhis.organisationunit.OrganisationUnitGroupSet;
import org.hisp.dhis.organisationunit.OrganisationUnitService;
import org.hisp.dhis.period.Period;
import org.hisp.dhis.period.PeriodType;
@@ -26,6 +29,7 @@
import org.hisp.dhis.rbf.api.PBFDataValueService;
import org.hisp.dhis.rbf.api.TariffDataValueService;
import org.hisp.dhis.user.CurrentUserService;
+import org.springframework.beans.factory.annotation.Autowired;
import com.opensymphony.xwork2.Action;
@@ -104,6 +108,8 @@
this.constantService = constantService;
}
+ @Autowired
+ private OrganisationUnitGroupService orgUnitGroupService;
// -------------------------------------------------------------------------
// Comparator
// -------------------------------------------------------------------------
@@ -246,12 +252,22 @@
}
+ OrganisationUnitGroup orgUnitGroup = findPBFOrgUnitGroupforTariff( organisationUnit );
+
+ if( orgUnitGroup != null )
+ {
+ tariffDataValueMap.putAll( tariffDataValueService.getTariffDataValues( orgUnitGroup, dataSet, period ) );
+ }
+
+ /*
OrganisationUnit parentOrgunit = findParentOrgunitforTariff( organisationUnit, tariff_setting_authority );
if ( parentOrgunit != null )
{
tariffDataValueMap.putAll( tariffDataValueService.getTariffDataValues( parentOrgunit, dataSet, period ) );
}
+ */
+
pbfDataValueMap = new HashMap<DataElement, PBFDataValue>();
@@ -349,6 +365,17 @@
return SUCCESS;
}
+ public OrganisationUnitGroup findPBFOrgUnitGroupforTariff( OrganisationUnit organisationUnit )
+ {
+ Constant tariff_authority = constantService.getConstantByName( TARIFF_SETTING_AUTHORITY );
+
+ OrganisationUnitGroupSet orgUnitGroupSet = orgUnitGroupService.getOrganisationUnitGroupSet( (int) tariff_authority.getValue() );
+
+ OrganisationUnitGroup orgUnitGroup = organisationUnit.getGroupInGroupSet( orgUnitGroupSet );
+
+ return orgUnitGroup;
+ }
+
public OrganisationUnit findParentOrgunitforTariff( OrganisationUnit organisationUnit, Integer tariffOULevel )
{
Integer ouLevel = organisationUnitService.getLevelOfOrganisationUnit( organisationUnit.getId() );
=== 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-04-26 11:27:06 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/resources/struts.xml 2014-04-28 11:42:33 +0000
@@ -18,7 +18,7 @@
<action name="dataElementTariffManagement" class="org.hisp.dhis.rbf.action.GetDataElementforTariffAction">
<result name="success" type="velocity">/main.vm</result>
<param name="page">/dhis-web-maintenance-rbf/loadDataElementsforTariff.vm</param>
- <param name="menu">/dhis-web-maintenance-rbf/tariffMenu.vm</param>
+ <param name="menu">/dhis-web-maintenance-rbf/menu.vm</param>
<param name="javascripts">../dhis-web-commons/ouwt/ouwt.js,../dhis-web-commons/javascripts/ext/ext-all.js,javascript/TransformGrid.js,javascript/dataElement_combo.js</param>
<param name="stylesheets">../dhis-web-commons/javascripts/ext/resources/css/ext-all-gray.css</param>
</action>
=== modified file 'local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/loadDataElementsforTariff.vm'
--- local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/loadDataElementsforTariff.vm 2014-04-27 08:51:10 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/loadDataElementsforTariff.vm 2014-04-28 11:42:33 +0000
@@ -79,13 +79,22 @@
function orgUnitGroupChange()
{
- document.getElementById('simpleCombo').style.display = 'block';
- document.getElementById('loadTariffDetails').style.display = 'block';
- if($('#dataElementName').val() != '')
- {
- getTariffData();
+ if( $('#orgUnitGroupId').val() == "-1" )
+ {
+ document.getElementById('simpleCombo').style.display = 'none';
+ document.getElementById('loadTariffDetails').style.display = 'none';
+ }
+ else
+ {
+ document.getElementById('simpleCombo').style.display = 'block';
+ document.getElementById('loadTariffDetails').style.display = 'block';
+ if( $('#dataElementName').val() != '' )
+ {
+ getTariffData();
+ }
}
}
+
function organisationUnitSelected( orgUnits, orgUnitNames )
{
var countryTags = $levelOrgUnitIds;
@@ -145,24 +154,30 @@
inset 8px 10px 10px rgba(255,255,255,0.75);
}
</style>
+
+<!--
<div width="100%">
<div id="tariffSetting">
Tariff Setting Authority : $!tariff_setting_authority
</div>
</div>
+-->
+
<h3>$i18n.getString( "dataelement_tariff_target_management" )</h3>
<br/>
-<input type="hidden" name="orgUnitUid" id="orgUnitUid">
-<input type="hidden" name="dataElementName" id="dataElementName" value="">
+<input type="hidden" name="orgUnitUid" id="orgUnitUid" />
+<input type="hidden" name="dataElementName" id="dataElementName" value="" />
<table width="60%">
<tr>
- <td >Orgainsation Unit:
+ <td >Orgainsation Unit Group:
<select id="orgUnitGroupId" name="orgUnitGroupId" onchange="javascript:orgUnitGroupChange()">
+ <option value="-1">[Please select]</option>
#foreach( $orgUnitGroup in $orgUnitGroups )
<option value="$!orgUnitGroup.id">$!orgUnitGroup.name</option>
#end
</select>
- <input type="text" id="orgUnit" name="orgUnit" readonly size="55"/></td>
+ <input type="hidden" id="orgUnit" name="orgUnit" readonly size="55" style="display:none" />
+ </td>
<td > </td>
</tr>
<tr >