[Dhis2-devs] New aggregation operators

2015-10-09 Thread Seid Hussein
Hi all,

We have a peculiar aggregation need here. I don't know if any other country
uses it or it is only Ethiopia but here it is.

Consider this data element which is collected monthly:

*Number of adults and children who are currently on ART - **First Line
Regimen *

When analyzing data for a year, the last month's data shall always be taken
rather than the summation or average of the data values.

There are a few data elements like this we  capture every month.


However, the current aggregation operators cannot handle this. The max and
the min operators may be the closest ones to handle this (for data that
increases and decreases over time respectively).

Would it be possible to add one more aggregation operator that always takes
the last period's value when the aggregation is across periods and when it
is hierarchically it sums the last period's values of each captured data.

Regards,


Seid,
___
Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help   : https://help.launchpad.net/ListHelp


[Dhis2-devs] [Branch ~dhis2-devs-core/dhis2/trunk] Rev 20598: tracker-capture: provide notifcation that registration is successful when user clicks save and ad...

2015-10-09 Thread noreply

revno: 20598
committer: Abyot Asalefew Gizaw 
branch nick: dhis2
timestamp: Fri 2015-10-09 11:07:58 +0200
message:
  tracker-capture: provide notifcation that registration is successful when 
user clicks save and add new
modified:
  
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration-controller.js
  
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/i18n/i18n_app.properties


--
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 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration-controller.js	2015-10-06 10:52:09 +
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration-controller.js	2015-10-09 09:07:58 +
@@ -124,13 +124,22 @@
 var goToDashboard = function(destination, teiId){
 //reset form
 $scope.selectedTei = {};
-$scope.selectedEnrollment = {};
-$scope.outerForm.submitted = false; 
+$scope.selectedEnrollment = {enrollmentDate: $scope.today, incidentDate: $scope.today, orgUnitName: $scope.selectedOrgUnit.name};
+$scope.outerForm.submitted = false;
+$scope.outerForm.$setPristine();
 
 if(destination === 'DASHBOARD') {
 $location.path('/dashboard').search({tei: teiId,
 program: $scope.selectedProgram ? $scope.selectedProgram.id: null});
-}
+}
+else{
+//notify user
+var dialogOptions = {
+headerText: 'success',
+bodyText: 'registration_complete'
+};
+DialogService.showDialog({}, dialogOptions);
+}
 };
 
 var reloadProfileWidget = function(){

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/i18n/i18n_app.properties'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/i18n/i18n_app.properties	2015-10-08 11:26:14 +
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/i18n/i18n_app.properties	2015-10-09 09:07:58 +
@@ -276,6 +276,7 @@
 no_enity_for_tracker_associate_attribute=Selected attribute has invalid tracked entity
 error=Error
 success=Success
+registration_complete=Registration is completed
 validation_error=Validation Error
 validation_warnings=Validation Warnings
 dashboard_layout_saved=Dashboard layout saved as default.

___
Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help   : https://help.launchpad.net/ListHelp


[Dhis2-devs] [Branch ~dhis2-devs-core/dhis2/trunk] Rev 20599: Code style

2015-10-09 Thread noreply

revno: 20599
committer: Lars Helge Overland 
branch nick: dhis2
timestamp: Fri 2015-10-09 11:15:00 +0200
message:
  Code style
modified:
  
dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityInstance.java


--
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 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityInstance.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityInstance.java	2015-09-03 17:49:15 +
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityInstance.java	2015-10-09 09:15:00 +
@@ -168,11 +168,13 @@
 @JsonView( { DetailedView.class, ExportView.class } )
 @JacksonXmlElementWrapper( localName = "inactive", namespace = DxfNamespaces.DXF_2_0 )
 @JacksonXmlProperty( localName = "inactive", namespace = DxfNamespaces.DXF_2_0 )
-	public Boolean isInactive() {
-		return inactive;
-	}
+public Boolean isInactive()
+{
+return inactive;
+}
 
-	public void setInactive(Boolean inactive) {
-		this.inactive = inactive;
-	}
+public void setInactive( Boolean inactive )
+{
+this.inactive = inactive;
+}
 }

___
Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help   : https://help.launchpad.net/ListHelp


[Dhis2-devs] [Branch ~dhis2-devs-core/dhis2/trunk] Rev 20600: TEI query. Using left join for attribute values. Added tests.

2015-10-09 Thread noreply

revno: 20600
committer: Lars Helge Overland 
branch nick: dhis2
timestamp: Fri 2015-10-09 11:23:30 +0200
message:
  TEI query. Using left join for attribute values. Added tests.
modified:
  
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentity/hibernate/HibernateTrackedEntityInstanceStore.java
  
dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceStoreTest.java


--
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 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentity/hibernate/HibernateTrackedEntityInstanceStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentity/hibernate/HibernateTrackedEntityInstanceStore.java	2015-10-09 03:21:10 +
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentity/hibernate/HibernateTrackedEntityInstanceStore.java	2015-10-09 09:23:30 +
@@ -121,7 +121,7 @@
 
 private String buildTrackedEntityInstanceHql( TrackedEntityInstanceQueryParams params )
 {
-String hql = "select distinct tei from TrackedEntityInstance tei inner join fetch tei.attributeValues";
+String hql = "select distinct tei from TrackedEntityInstance tei left join fetch tei.attributeValues";
 SqlHelper hlp = new SqlHelper( true );
 
 if ( params.hasTrackedEntity() )

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceStoreTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceStoreTest.java	2015-10-08 14:12:50 +
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceStoreTest.java	2015-10-09 09:23:30 +
@@ -33,9 +33,17 @@
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 
+import java.util.List;
+
 import org.hisp.dhis.DhisSpringTest;
+import org.hisp.dhis.analytics.AggregationType;
+import org.hisp.dhis.common.QueryItem;
+import org.hisp.dhis.common.QueryOperator;
+import org.hisp.dhis.common.ValueType;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
+import org.hisp.dhis.trackedentityattributevalue.TrackedEntityAttributeValue;
+import org.hisp.dhis.trackedentityattributevalue.TrackedEntityAttributeValueService;
 import org.junit.Test;
 import org.springframework.beans.factory.annotation.Autowired;
 
@@ -46,7 +54,7 @@
 extends DhisSpringTest
 {
 @Autowired
-private TrackedEntityInstanceStore entityInstanceStore;
+private TrackedEntityInstanceStore teiStore;
 
 @Autowired
 private OrganisationUnitService organisationUnitService;
@@ -54,75 +62,123 @@
 @Autowired
 private TrackedEntityAttributeService attributeService;
 
-private TrackedEntityInstance entityInstanceA1;
-
-private TrackedEntityInstance entityInstanceB1;
-
-private OrganisationUnit organisationUnit;
+@Autowired
+private TrackedEntityAttributeValueService attributeValueService;
+
+private TrackedEntityInstance teiA;
+private TrackedEntityInstance teiB;
+private TrackedEntityInstance teiC;
+private TrackedEntityInstance teiD;
+private TrackedEntityInstance teiE;
+private TrackedEntityInstance teiF;
+
+private TrackedEntityAttribute atA;
+private TrackedEntityAttribute atB;
+
+private OrganisationUnit ouA;
+private OrganisationUnit ouB;
+private OrganisationUnit ouC;
 
 @Override
 public void setUpTest()
 {
-organisationUnit = createOrganisationUnit( 'A' );
-organisationUnitService.addOrganisationUnit( organisationUnit );
-
-OrganisationUnit organisationUnitB = createOrganisationUnit( 'B' );
-organisationUnitService.addOrganisationUnit( organisationUnitB );
-
-TrackedEntityAttribute entityInstanceAttributeB = createTrackedEntityAttribute( 'B' );
-entityInstanceAttributeB.setUnique( true );
-attributeService.addTrackedEntityAttribute( entityInstanceAttributeB );
+ouA = createOrganisationUnit( 'A' );
+ouB = createOrganisationUnit( 'B', ouA );
+ouC = createOrganisationUnit( 'C', ouB );
+
+organisationUnitService.addOrganisationUnit( ouA );
+organisationUnitService.addOrganisationUnit( ouB );
+organisationUnitService.addOrganisationUnit( ouC );
+
+atA = createTrackedEntityAttribute( 'A' );
+atB = createTrackedEntityAttribute( 'B' );
+atB.setUnique( true );
+
+attributeService.addTrackedEntityAttribute( atA );
+attribute

[Dhis2-devs] [Branch ~dhis2-devs-core/dhis2/trunk] Rev 20601: Changed CORS whitelist from being a system setting to be part of configuration

2015-10-09 Thread noreply

revno: 20601
committer: Lars Helge Overland 
branch nick: dhis2
timestamp: Fri 2015-10-09 12:49:19 +0200
message:
  Changed CORS whitelist from being a system setting to be part of configuration
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/configuration/Configuration.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/setting/Setting.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/setting/SystemSettingManager.java
  
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/setting/DefaultSystemSettingManager.java
  
dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/configuration/hibernate/Configuration.hbm.xml
  
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/ConfigurationController.java
  
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/StaticContentController.java
  
dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/security/filter/CorsFilter.java
  
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/system/GetAccessSettingsAction.java
  
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/system/SetAccessSettingsAction.java


--
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 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/configuration/Configuration.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/configuration/Configuration.java	2015-10-06 14:23:01 +
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/configuration/Configuration.java	2015-10-09 10:49:19 +
@@ -29,11 +29,13 @@
  */
 
 import java.io.Serializable;
+import java.util.HashSet;
+import java.util.Set;
 
-import org.hisp.dhis.indicator.IndicatorGroup;
 import org.hisp.dhis.common.BaseIdentifiableObject;
 import org.hisp.dhis.common.DxfNamespaces;
 import org.hisp.dhis.dataelement.DataElementGroup;
+import org.hisp.dhis.indicator.IndicatorGroup;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.organisationunit.OrganisationUnitLevel;
 import org.hisp.dhis.period.PeriodType;
@@ -44,10 +46,12 @@
 import com.fasterxml.jackson.annotation.JsonProperty;
 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
 
 /**
  * @author Lars Helge Overland
  */
+@JacksonXmlRootElement( localName = "configuration", namespace = DxfNamespaces.DXF_2_0 )
 public class Configuration
 implements Serializable
 {
@@ -79,6 +83,8 @@
 private UserAuthorityGroup selfRegistrationRole;
 
 private OrganisationUnit selfRegistrationOrgUnit;
+
+private Set corsWhitelist = new HashSet<>();
 
 // -
 // Remote synch
@@ -283,4 +289,16 @@
 {
 this.smtpPassword = smtpPassword;
 }
+
+@JsonProperty
+@JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
+public Set getCorsWhitelist()
+{
+return corsWhitelist;
+}
+
+public void setCorsWhitelist( Set corsWhitelist )
+{
+this.corsWhitelist = corsWhitelist;
+}
 }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/setting/Setting.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/setting/Setting.java	2015-10-07 09:31:10 +
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/setting/Setting.java	2015-10-09 10:49:19 +
@@ -92,7 +92,7 @@
 ACCEPTANCE_REQUIRED_FOR_APPROVAL( "keyAcceptanceRequiredForApproval", Boolean.FALSE, Boolean.class ),
 SYSTEM_NOTIFICATIONS_EMAIL( "keySystemNotificationsEmail" ),
 ANALYSIS_RELATIVE_PERIOD( "keyAnalysisRelativePeriod", "LAST_12_MONTHS", String.class ),
-CORS_WHITELIST( "keyCorsWhitelist", List.class ),
+CORS_WHITELIST2( "keyCorsWhitelist", List.class ),
 REQUIRE_ADD_TO_VIEW( "keyRequireAddToView", Boolean.FALSE, Boolean.class ),
 ALLOW_OBJECT_ASSIGNMENT( "keyAllowObjectAssignment", Boolean.FALSE, Boolean.class ),
 USE_CUSTOM_LOGO_FRONT( "keyUseCustomLogoFront", Boolean.FALSE, Boolean.class ),

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/setting/SystemSettingManager.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/setting/SystemSettingManager.java	2015-10-06 22:23:53 +
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/setting/SystemSettingManager.java	2015-10-09 10:49:19 +
@@ -176,6 +176,4 @@
 String googleAnalyticsUA();
 
 Integer credentialsExpires();
-
-List getCorsWhitelist();
 }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/

[Dhis2-devs] [Branch ~dhis2-devs-core/dhis2/trunk] Rev 20602: Minor

2015-10-09 Thread noreply

revno: 20602
committer: Lars Helge Overland 
branch nick: dhis2
timestamp: Fri 2015-10-09 12:56:54 +0200
message:
  Minor
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/setting/Setting.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/setting/SystemSettingManager.java


--
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 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/setting/Setting.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/setting/Setting.java	2015-10-09 10:49:19 +
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/setting/Setting.java	2015-10-09 10:56:54 +
@@ -92,7 +92,6 @@
 ACCEPTANCE_REQUIRED_FOR_APPROVAL( "keyAcceptanceRequiredForApproval", Boolean.FALSE, Boolean.class ),
 SYSTEM_NOTIFICATIONS_EMAIL( "keySystemNotificationsEmail" ),
 ANALYSIS_RELATIVE_PERIOD( "keyAnalysisRelativePeriod", "LAST_12_MONTHS", String.class ),
-CORS_WHITELIST2( "keyCorsWhitelist", List.class ),
 REQUIRE_ADD_TO_VIEW( "keyRequireAddToView", Boolean.FALSE, Boolean.class ),
 ALLOW_OBJECT_ASSIGNMENT( "keyAllowObjectAssignment", Boolean.FALSE, Boolean.class ),
 USE_CUSTOM_LOGO_FRONT( "keyUseCustomLogoFront", Boolean.FALSE, Boolean.class ),

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/setting/SystemSettingManager.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/setting/SystemSettingManager.java	2015-10-09 10:49:19 +
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/setting/SystemSettingManager.java	2015-10-09 10:56:54 +
@@ -97,7 +97,6 @@
 String KEY_ACCEPTANCE_REQUIRED_FOR_APPROVAL = "keyAcceptanceRequiredForApproval";
 String KEY_SYSTEM_NOTIFICATIONS_EMAIL = "keySystemNotificationsEmail";
 String KEY_ANALYSIS_RELATIVE_PERIOD = "keyAnalysisRelativePeriod";
-String KEY_CORS_WHITELIST = "keyCorsWhitelist";
 String KEY_REQUIRE_ADD_TO_VIEW = "keyRequireAddToView";
 String KEY_ALLOW_OBJECT_ASSIGNMENT = "keyAllowObjectAssignment";
 String KEY_USE_CUSTOM_LOGO_FRONT = "keyUseCustomLogoFront";

___
Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help   : https://help.launchpad.net/ListHelp


[Dhis2-devs] [Branch ~dhis2-devs-core/dhis2/trunk] Rev 20603: Minor

2015-10-09 Thread noreply

revno: 20603
committer: Lars Helge Overland 
branch nick: dhis2
timestamp: Fri 2015-10-09 12:59:01 +0200
message:
  Minor
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/setting/Setting.java
  
dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/configuration/hibernate/Configuration.hbm.xml


--
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 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/setting/Setting.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/setting/Setting.java	2015-10-09 10:56:54 +
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/setting/Setting.java	2015-10-09 10:59:01 +
@@ -30,7 +30,6 @@
 
 import java.io.Serializable;
 import java.util.Date;
-import java.util.List;
 import java.util.Map;
 import java.util.Optional;
 

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/configuration/hibernate/Configuration.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/configuration/hibernate/Configuration.hbm.xml	2015-10-09 10:49:19 +
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/configuration/hibernate/Configuration.hbm.xml	2015-10-09 10:59:01 +
@@ -46,7 +46,7 @@
 	
 		
 		
-	
+		
 	 
 	
   

___
Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help   : https://help.launchpad.net/ListHelp


Re: [Dhis2-devs] sending email notification with attachment from dhis messages

2015-10-09 Thread Lars Helge Øverland
Hi Furqonuddin,

sorry at the moment this is not possible.

We do have a blueprint for attachments in messages here:

https://blueprints.launchpad.net/dhis2/+spec/message-attachments

regards,

Lars


On Fri, Oct 9, 2015 at 4:23 AM, Furqonuddin Ramdhani 
wrote:

> yes, send email to users. is it possible to take our reports/charts from
> pivot table(xls/pdf) or data visualizer(png/jpg) as a link (url)  so we can
> include the url in our messages  ?
>
> Regards,
> Dhani
>
> On Fri, Oct 9, 2015 at 6:45 AM, Knut Staring  wrote:
>
>> You want to send email to users? Could it be just a link (url)?
>>
>> Knut
>>
>> On Fri, Oct 9, 2015 at 1:41 AM, Furqonuddin Ramdhani 
>> wrote:
>>
>>> Hi All,
>>>
>>> is it possible to send notification with attachment from dihis messages,
>>> for example I want to send output of my pivot table report in xls/pdf ?
>>> If not possible , any suggestion how to do it ?
>>>
>>> Thanks
>>>
>>> --
>>> Best Regards
>>> *Furqonuddin Ramdhani*
>>>
>>> ___
>>> Mailing list: https://launchpad.net/~dhis2-devs
>>> Post to : dhis2-devs@lists.launchpad.net
>>> Unsubscribe : https://launchpad.net/~dhis2-devs
>>> More help   : https://help.launchpad.net/ListHelp
>>>
>>>
>>
>>
>> --
>> Knut Staring
>> Dept. of Informatics, University of Oslo
>> Norway: +4791880522
>> Skype: knutstar
>> http://dhis2.org
>>
>
>
>
> --
> Salam
> *Furqonuddin Ramdhani*
>
> ___
> Mailing list: https://launchpad.net/~dhis2-devs
> Post to : dhis2-devs@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~dhis2-devs
> More help   : https://help.launchpad.net/ListHelp
>
>


-- 
Lars Helge Øverland
Lead developer, DHIS 2
University of Oslo
Skype: larshelgeoverland
http://www.dhis2.org 
___
Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help   : https://help.launchpad.net/ListHelp


Re: [Dhis2-devs] Imporing orgunits through Web API with JSON

2015-10-09 Thread Lars Helge Øverland
Hi David,

I think the problem is the coordinates part. I think it should be a plain
string, e.g.


   -
   coordinates: "[-10.7983,8.6966]",



Try adjusting that in your payload.


regards,

Lars



On Thu, Oct 8, 2015 at 3:11 PM, David Huser 
wrote:

> *In reference to this question*
> *https://lists.launchpad.net/dhis2-devs/msg32117.html
> *
>
> I'd like to post multiple organization units (facilities) where the upper
> level already exists in the system (districts).
>
> My curl request:
> curl -d @all.json "http://localhost:8081/api/metaData";
>  -X POST -H "Content-Type:
> application/json" -u admin:district
>
> My all.json looks like this, legit according to http://jsonlint.com/
>
> {
> "organisationUnits": [
> {
> "code": "100229-4",
> "coordinates": [
> 35.312,
> -5.7452
> ],
> "level": "4",
> "name": "Bahi RC",
> "parent": [
> {
> "id": "jbKhQuPUg8V"
> }
> ],
> "shortName": "Bahi RC"
> },
> {
> "code": "100231-0",
> "level": "4",
> "name": "Bakwata",
> "parent": [
> {
> "id": "PGqrKhQZ8AA"
> }
> ],
> "shortName": "Bakwata"
> }
> ]
> }
>
>
> When I post to the api/metadata endpoint, I always get  the error below
> (the same as Jason in the referenced post). Has something of the Metadata
> import process / its standard changed since August 2014?
> If I post it to the api/organisationUnits endpoint, it says successful but
> imported/updated/ignored/deleted: all 0
>
> Thank you
> David
>
>
>
> 08-Oct-2015 14:55:46.394 SEVERE [http-nio-8081-exec-5]
> org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for
> servlet [webapi] in context with path [] threw exception
>  com.fasterxml.jackson.databind.JsonMappingException: *Can not
> deserialize instance of java.lang.String out of START_ARRAY token*
>  at [Source: org.apache.catalina.connector.CoyoteInputStream@92c234;
> line: 1, column: 56] (through reference chain:
> org.hisp.dhis.dxf2.metadata.MetaData["organisationUnits"]->java.util.ArrayList[0]->org.hisp.dhis.organisationunit.OrganisationUnit["coordinates"])
> at
> com.fasterxml.jackson.databind.JsonMappingException.from(JsonMappingException.java:148)
> at
> com.fasterxml.jackson.databind.DeserializationContext.mappingException(DeserializationContext.java:835)
> at
> com.fasterxml.jackson.databind.deser.std.StringDeserializer.deserialize(StringDeserializer.java:59)
> at
> com.fasterxml.jackson.databind.deser.std.StringDeserializer.deserialize(StringDeserializer.java:12)
> at
> com.fasterxml.jackson.databind.deser.SettableBeanProperty.deserialize(SettableBeanProperty.java:523)
> at
> com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:95)
> at
> com.fasterxml.jackson.databind.deser.impl.BeanPropertyMap._findDeserializeAndSet2(BeanPropertyMap.java:313)
> at
> com.fasterxml.jackson.databind.deser.impl.BeanPropertyMap.findDeserializeAndSet(BeanPropertyMap.java:291)
> at
> com.fasterxml.jackson.databind.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:335)
> at
> com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:142)
> at
> com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:245)
> at
> com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:217)
> at
> com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:25)
> at
> com.fasterxml.jackson.databind.deser.SettableBeanProperty.deserialize(SettableBeanProperty.java:523)
> at
> com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:95)
> at
> com.fasterxml.jackson.databind.deser.impl.BeanPropertyMap.findDeserializeAndSet(BeanPropertyMap.java:285)
> at
> com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:248)
> at
> com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:136)
> at
> com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3562)
> at
> com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2648)
> at
> org.hisp.dhis.dxf2.common.JacksonUtils.fromJson(JacksonUtils.java:154)
> at
> org.hisp.dhis.webapi.controller.MetaDataController.importJson(MetaDataController.java:249)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> at sun.ref

[Dhis2-devs] [Branch ~dhis2-devs-core/dhis2/trunk] Rev 20604: tracker-capture: more control on attribute uniquenss validation

2015-10-09 Thread noreply

revno: 20604
committer: Abyot Asalefew Gizaw 
branch nick: dhis2
timestamp: Fri 2015-10-09 15:42:57 +0200
message:
  tracker-capture: more control on attribute uniquenss validation
modified:
  
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/default-registration-form.html
  
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration-controller.js
  
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.validations.js


--
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 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/default-registration-form.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/default-registration-form.html	2015-10-08 07:53:00 +
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/default-registration-form.html	2015-10-09 13:42:57 +
@@ -32,7 +32,9 @@
ng-model="selectedTei[attribute.id]"
ng-model-options="{ updateOn: 'blur', allowInvalid: true }"
d2-attribute-validator 
-   attribute-data="attribute" selected-program="selectedProgram.id"  
+   attribute-data="attribute" 
+   selected-program-id="selectedProgram.id"  
+   selected-tei-id="selectedTei.trackedEntityInstance"  
ng-disabled="editingDisabled" 
blur-or-change="teiValueUpdated(selectedTei, attribute.id)"
ng-required="attribute.mandatory || attribute.unique"/>
@@ -44,7 +46,9 @@
ng-model="selectedTei[attribute.id]" 
ng-model-options="{ updateOn: 'blur', allowInvalid: true }"
d2-attribute-validator 
-   attribute-data="attribute" selected-program="selectedProgram.id"  
+   attribute-data="attribute" 
+   selected-program-id="selectedProgram.id"  
+   selected-tei-id="selectedTei.trackedEntityInstance"  
ng-disabled="editingDisabled" 
ng-change="teiValueUpdated(selectedTei, attribute.id)"
ng-required="attribute.mandatory || attribute.unique"/>
@@ -54,7 +58,9 @@
 ng-model="selectedTei[attribute.id]" 
 ng-model-options="{ updateOn: 'blur', allowInvalid: true }" 
 d2-attribute-validator 
-attribute-data="attribute" selected-program="selectedProgram.id"  
+attribute-data="attribute" 
+selected-program-id="selectedProgram.id"  
+selected-tei-id="selectedTei.trackedEntityInstance"  
 class="form-control" 
 ng-disabled="editingDisabled" 
 ng-change="teiValueUpdated(selectedTei, attribute.id)"
@@ -71,7 +77,9 @@
ng-model="selectedTei[attribute.id]" 
ng-model-options="{ updateOn: 'blur', allowInvalid: true }" 
d2-attribute-validator 
-   attribute-data="attribute" selected-program="selectedProgram.id"  
+   attribute-data="attribute" 
+   selected-program-id="selectedProgram.id"  
+   selected-tei-id="selectedTei.trackedEntityInstance"  
d2-number-validator 
number-type={{attribute.valueType}} 
ng-disabled="editingDisabled" 
@@ -85,7 +93,9 @@
ng-model="selectedTei[attribute.id]" 
ng-model-options="{ updateOn: 'blur', allowInvalid: true }" 
d2-attribute-validator 
-   attribute-data="attribute" selected-program="selectedProgram.id"  
+   attribute-data="attribute" 
+   selected-program-id="selectedProgram.id"  
+   selected-tei-id="selectedTei.trackedEntityInstance"  

Re: [Dhis2-devs] Imporing orgunits through Web API with JSON

2015-10-09 Thread David Huser
I could make it work (json formatting errors) like below, maybe it helps 
others in the future.



{
"organisationUnits": [
{
"name": "Bahi RC",
"shortName": "Bahi RC",
"openingDate": "2015-10-01",
"parent": {
 "id": "jbKhQuPUg8V"
 },
"level": 4,
"coordinates": "[36.53,-6.54]"

}
]
}





On 08.10.2015 15:11, David Huser wrote:

/In reference to this question//
//https://lists.launchpad.net/dhis2-devs/msg32117.html/

I'd like to post multiple organization units (facilities) where the 
upper level already exists in the system (districts).


My curl request:
curl -d @all.json "http://localhost:8081/api/metaData"; -X POST -H 
"Content-Type: application/json" -u admin:district


My all.json looks like this, legit according to http://jsonlint.com/

{
"organisationUnits": [
{
"code": "100229-4",
"coordinates": [
35.312,
-5.7452
],
"level": "4",
"name": "Bahi RC",
"parent": [
{
"id": "jbKhQuPUg8V"
}
],
"shortName": "Bahi RC"
},
{
"code": "100231-0",
"level": "4",
"name": "Bakwata",
"parent": [
{
"id": "PGqrKhQZ8AA"
}
],
"shortName": "Bakwata"
}
]
}


When I post to the api/metadata endpoint, I always get  the error 
below (the same as Jason in the referenced post). Has something of the 
Metadata import process / its standard changed since August 2014?
If I post it to the api/organisationUnits endpoint, it says successful 
but imported/updated/ignored/deleted: all 0


Thank you
David



08-Oct-2015 14:55:46.394 SEVERE [http-nio-8081-exec-5] 
org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() 
for servlet [webapi] in context with path [] threw exception
 com.fasterxml.jackson.databind.JsonMappingException: *Can not 
deserialize instance of java.lang.String out of START_ARRAY token*
 at [Source: org.apache.catalina.connector.CoyoteInputStream@92c234; 
line: 1, column: 56] (through reference chain: 
org.hisp.dhis.dxf2.metadata.MetaData["organisationUnits"]->java.util.ArrayList[0]->org.hisp.dhis.organisationunit.OrganisationUnit["coordinates"])
at 
com.fasterxml.jackson.databind.JsonMappingException.from(JsonMappingException.java:148)
at 
com.fasterxml.jackson.databind.DeserializationContext.mappingException(DeserializationContext.java:835)
at 
com.fasterxml.jackson.databind.deser.std.StringDeserializer.deserialize(StringDeserializer.java:59)
at 
com.fasterxml.jackson.databind.deser.std.StringDeserializer.deserialize(StringDeserializer.java:12)
at 
com.fasterxml.jackson.databind.deser.SettableBeanProperty.deserialize(SettableBeanProperty.java:523)
at 
com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:95)
at 
com.fasterxml.jackson.databind.deser.impl.BeanPropertyMap._findDeserializeAndSet2(BeanPropertyMap.java:313)
at 
com.fasterxml.jackson.databind.deser.impl.BeanPropertyMap.findDeserializeAndSet(BeanPropertyMap.java:291)
at 
com.fasterxml.jackson.databind.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:335)
at 
com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:142)
at 
com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:245)
at 
com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:217)
at 
com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:25)
at 
com.fasterxml.jackson.databind.deser.SettableBeanProperty.deserialize(SettableBeanProperty.java:523)
at 
com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:95)
at 
com.fasterxml.jackson.databind.deser.impl.BeanPropertyMap.findDeserializeAndSet(BeanPropertyMap.java:285)
at 
com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:248)
at 
com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:136)
at 
com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3562)
at 
com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2648)
at 
org.hisp.dhis.dxf2.common.JacksonUtils.fromJson(JacksonUtils.java:154)
at 
org.hisp.dhis.webapi.controller.MetaDataController.importJson(MetaDataController.java:249)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Sou

[Dhis2-devs] [Branch ~dhis2-devs-core/dhis2/trunk] Rev 20605: tracker-capture: minor

2015-10-09 Thread noreply

revno: 20605
committer: Abyot Asalefew Gizaw 
branch nick: dhis2
timestamp: Fri 2015-10-09 16:20:56 +0200
message:
  tracker-capture: minor
modified:
  
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/services.js


--
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 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/services.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/services.js	2015-10-07 15:13:26 +
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/services.js	2015-10-09 14:20:56 +
@@ -492,6 +492,7 @@
 }
 delete tei[k];
 }
+formTei.attributes = tei.attributes;
 return {tei: tei, formEmpty: formEmpty};
 }
 };

___
Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help   : https://help.launchpad.net/ListHelp


[Dhis2-devs] [Branch ~dhis2-devs-core/dhis2/trunk] Rev 20606: tracker-capture: unique attribute value detection directive now uses attribute instead of isolate...

2015-10-09 Thread noreply

revno: 20606
committer: Abyot Asalefew Gizaw 
branch nick: dhis2
timestamp: Fri 2015-10-09 17:13:55 +0200
message:
  tracker-capture: unique attribute value detection directive now uses 
attribute instead of isolated scope as it created a conflict with ui-select.
modified:
  
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/default-registration-form.html
  
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/services.js
  
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.validations.js


--
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 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/default-registration-form.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/default-registration-form.html	2015-10-09 13:42:57 +
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/default-registration-form.html	2015-10-09 15:13:55 +
@@ -9,9 +9,13 @@
 
 
 {{$select.selected.name  || $select.selected}}
@@ -32,9 +36,9 @@
ng-model="selectedTei[attribute.id]"
ng-model-options="{ updateOn: 'blur', allowInvalid: true }"
d2-attribute-validator 
-   attribute-data="attribute" 
-   selected-program-id="selectedProgram.id"  
-   selected-tei-id="selectedTei.trackedEntityInstance"  
+   attribute-data={{attribute}}
+   selected-program-id={{selectedProgram.id}}  
+   selected-tei-id={{selectedTei.trackedEntityInstance}}  
ng-disabled="editingDisabled" 
blur-or-change="teiValueUpdated(selectedTei, attribute.id)"
ng-required="attribute.mandatory || attribute.unique"/>
@@ -46,9 +50,9 @@
ng-model="selectedTei[attribute.id]" 
ng-model-options="{ updateOn: 'blur', allowInvalid: true }"
d2-attribute-validator 
-   attribute-data="attribute" 
-   selected-program-id="selectedProgram.id"  
-   selected-tei-id="selectedTei.trackedEntityInstance"  
+   attribute-data={{attribute}}
+   selected-program-id={{selectedProgram.id}}  
+   selected-tei-id={{selectedTei.trackedEntityInstance}}  
ng-disabled="editingDisabled" 
ng-change="teiValueUpdated(selectedTei, attribute.id)"
ng-required="attribute.mandatory || attribute.unique"/>
@@ -58,9 +62,9 @@
 ng-model="selectedTei[attribute.id]" 
 ng-model-options="{ updateOn: 'blur', allowInvalid: true }" 
 d2-attribute-validator 
-attribute-data="attribute" 
-selected-program-id="selectedProgram.id"  
-selected-tei-id="selectedTei.trackedEntityInstance"  
+attribute-data={{attribute}}
+selected-program-id={{selectedProgram.id}}  
+selected-tei-id={{selectedTei.trackedEntityInstance}}  
 class="form-control" 
 ng-disabled="editingDisabled" 
 ng-change="teiValueUpdated(selectedTei, attribute.id)"
@@ -77,9 +81,9 @@
ng-model="selectedTei[attribute.id]" 
ng-model-options="{ updateOn: 'blur', allowInvalid: true }" 
d2-attribute-validator 
-   attribute-data="attribute" 
-   selected-program-id="selectedProgram.id"  
-   selected-tei-id="selectedTei.trackedEntityInstance"  
+   attribute-data={{attribute}}
+   selected-program-id={{selectedProgram.id}}  
+   selected-tei-id={{selectedTei.trackedEntityInstance}}  
d2-number-validator

[Dhis2-devs] [Branch ~dhis2-devs-core/dhis2/trunk] Rev 20607: tracker-capture: unique attribute detection is now also applied in custom forms

2015-10-09 Thread noreply

revno: 20607
committer: Abyot Asalefew Gizaw 
branch nick: dhis2
timestamp: Fri 2015-10-09 17:14:42 +0200
message:
  tracker-capture: unique attribute detection is now also applied in custom 
forms
modified:
  
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.js


--
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 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.js	2015-10-08 13:59:37 +
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.js	2015-10-09 15:14:42 +
@@ -497,7 +497,10 @@
 ' element-id="' + i + '"' +
 this.getAttributesAsString(attributes) +
 ' d2-focus-next-on-enter' +
-' ng-model="selectedTei.' + attId + '" ' +
+' ng-model="selectedTei.' + attId + '" ' + 
+' attribute-data="attributesById.' + attId + '" ' + 
+' selected-program-id="selectedProgram.id" ' +
+' selected-tei-id="selectedTei.trackedEntityInstance" ' +
 ' ng-disabled="editingDisabled || isHidden(attributesById.' + attId + '.id) || ' + isTrackerAssociate + '"' +
 ' d2-validation ' +
 ' ng-required=" ' + (att.mandatory || att.unique) + '" ';

___
Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help   : https://help.launchpad.net/ListHelp


[Dhis2-devs] [Branch ~dhis2-devs-core/dhis2/trunk] Rev 20608: TEI query testing

2015-10-09 Thread noreply

revno: 20608
committer: Lars Helge Overland 
branch nick: dhis2
timestamp: Fri 2015-10-09 17:33:21 +0200
message:
  TEI query testing
modified:
  
dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceStoreTest.java


--
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 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceStoreTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceStoreTest.java	2015-10-09 09:23:30 +
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceStoreTest.java	2015-10-09 15:33:21 +
@@ -33,15 +33,20 @@
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 
+import java.util.Date;
 import java.util.List;
 
 import org.hisp.dhis.DhisSpringTest;
 import org.hisp.dhis.analytics.AggregationType;
+import org.hisp.dhis.common.IdentifiableObjectManager;
+import org.hisp.dhis.common.OrganisationUnitSelectionMode;
 import org.hisp.dhis.common.QueryItem;
 import org.hisp.dhis.common.QueryOperator;
 import org.hisp.dhis.common.ValueType;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
+import org.hisp.dhis.program.Program;
+import org.hisp.dhis.program.ProgramInstanceService;
 import org.hisp.dhis.trackedentityattributevalue.TrackedEntityAttributeValue;
 import org.hisp.dhis.trackedentityattributevalue.TrackedEntityAttributeValueService;
 import org.junit.Test;
@@ -60,10 +65,13 @@
 private OrganisationUnitService organisationUnitService;
 
 @Autowired
-private TrackedEntityAttributeService attributeService;
+private IdentifiableObjectManager idObjectManager;
 
 @Autowired
 private TrackedEntityAttributeValueService attributeValueService;
+
+@Autowired
+private ProgramInstanceService programInstanceService;
 
 private TrackedEntityInstance teiA;
 private TrackedEntityInstance teiB;
@@ -78,10 +86,20 @@
 private OrganisationUnit ouA;
 private OrganisationUnit ouB;
 private OrganisationUnit ouC;
+
+private Program prA;
+private Program prB;
 
 @Override
 public void setUpTest()
 {
+atA = createTrackedEntityAttribute( 'A' );
+atB = createTrackedEntityAttribute( 'B' );
+atB.setUnique( true );
+
+idObjectManager.save( atA );
+idObjectManager.save( atB );
+
 ouA = createOrganisationUnit( 'A' );
 ouB = createOrganisationUnit( 'B', ouA );
 ouC = createOrganisationUnit( 'C', ouB );
@@ -90,12 +108,11 @@
 organisationUnitService.addOrganisationUnit( ouB );
 organisationUnitService.addOrganisationUnit( ouC );
 
-atA = createTrackedEntityAttribute( 'A' );
-atB = createTrackedEntityAttribute( 'B' );
-atB.setUnique( true );
-
-attributeService.addTrackedEntityAttribute( atA );
-attributeService.addTrackedEntityAttribute( atB );
+prA = createProgram( 'A', null, null );
+prB = createProgram( 'B', null, null );
+
+idObjectManager.save( prA );
+idObjectManager.save( prB );
   
 teiA = createTrackedEntityInstance( 'A', ouA );
 teiB = createTrackedEntityInstance( 'B', ouB );
@@ -168,17 +185,74 @@
 attributeValueService.addTrackedEntityAttributeValue( new TrackedEntityAttributeValue( atA, teiE, "Male" ) );
 attributeValueService.addTrackedEntityAttributeValue( new TrackedEntityAttributeValue( atA, teiF, "Female" ) );
 
+programInstanceService.enrollTrackedEntityInstance( teiB, prA, new Date(), new Date(), ouB );
+programInstanceService.enrollTrackedEntityInstance( teiE, prA, new Date(), new Date(), ouB );
+
+// Get all
+
 TrackedEntityInstanceQueryParams params = new TrackedEntityInstanceQueryParams();
 
 List teis = teiStore.getTrackedEntityInstances( params );
 
 assertEquals( 6, teis.size() );
 
+// Filter by attribute
+
 params = new TrackedEntityInstanceQueryParams();
 params.addFilter( new QueryItem( atA, QueryOperator.EQ, "Male", ValueType.TEXT, AggregationType.NONE, null ) );
 
 teis = teiStore.getTrackedEntityInstances( params );
 
 assertEquals( 2, teis.size() );
+assertTrue( teis.contains( teiD ) );
+assertTrue( teis.contains( teiE ) );
+
+// Filter by attribute
+
+params = new TrackedEntityInstanceQueryParams();
+params.addFilter( new Q

[Dhis2-devs] [Branch ~dhis2-devs-core/dhis2/trunk] Rev 20609: dataStore now protected with app authorities IF an app has protected its namespace. protecting na...

2015-10-09 Thread noreply
Merge authors:
  Stian Sandvold (stian-sandvold)

revno: 20609 [merge]
committer: Stian Sandvold 
branch nick: dhis2
timestamp: Fri 2015-10-09 23:25:13 +0200
message:
  dataStore now protected with app authorities IF an app has protected its 
namespace. protecting namespaces can be done by defining the namespace in 
webapp.manifest: activities.dhis2.namespace; deleting apps now have the option 
to delete appData associated with the app.
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/appmanager/AppDhis.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/appmanager/AppManager.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/keyjsonvalue/KeyJsonValue.java
  
dhis-2/dhis-api/src/main/java/org/hisp/dhis/keyjsonvalue/KeyJsonValueService.java
  
dhis-2/dhis-api/src/main/java/org/hisp/dhis/keyjsonvalue/KeyJsonValueStore.java
  
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/appmanager/DefaultAppManager.java
  
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AppController.java
  
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/KeyJsonValueController.java
  
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-appmanager/src/main/java/org/hisp/dhis/appmanager/action/AddAppAction.java
  
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-appmanager/src/main/java/org/hisp/dhis/appmanager/action/DeleteAppAction.java
  
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-appmanager/src/main/resources/org/hisp/dhis/appmanager/i18n_module.properties


--
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 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/appmanager/AppDhis.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/appmanager/AppDhis.java	2015-01-17 07:41:26 +
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/appmanager/AppDhis.java	2015-10-09 17:01:55 +
@@ -45,6 +45,9 @@
 @JsonProperty( "href" )
 private String href;
 
+@JsonProperty( "namespace" )
+private String namespace;
+
 public String getHref()
 {
 return href;
@@ -54,4 +57,14 @@
 {
 this.href = href;
 }
+
+public String getNamespace()
+{
+return namespace;
+}
+
+public void setNamespace( String namespace )
+{
+this.namespace = namespace;
+}
 }
\ No newline at end of file

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/appmanager/AppManager.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/appmanager/AppManager.java	2015-10-06 22:23:53 +
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/appmanager/AppManager.java	2015-10-09 21:21:12 +
@@ -69,7 +69,7 @@
  * @param rootPath the root path of the instance.
  * @throws IOException if the app manifest file could not be read.
  */
-void installApp( File file, String fileName, String rootPath )
+AppStatus installApp( File file, String fileName, String rootPath )
 throws IOException;
 
 /**
@@ -84,11 +84,12 @@
  * Deletes the app with the given name.
  *
  * @param name the app name.
+ * @param deleteAppData decide if associated data in dataStore should be deleted or not.
  * @return true if the delete was successful, false if there is no app with
  * the given name or if the app could not be removed from the file
  * system.
  */
-boolean deleteApp( String name );
+boolean deleteApp( String name, boolean deleteAppData );
 
 /**
  * Reload list of apps.
@@ -140,4 +141,12 @@
 boolean isAccessible( App app );
 
 boolean isAccessible( App app, User user );
+
+/**
+ * Returns the app associated with the namespace, or null if no app is associated.
+ * @param namespace the namespace to check
+ * @return App or null
+ */
+App getAppByNamespace( String namespace);
+
 }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/keyjsonvalue/KeyJsonValue.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/keyjsonvalue/KeyJsonValue.java	2015-10-01 09:03:27 +
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/keyjsonvalue/KeyJsonValue.java	2015-10-05 10:45:53 +
@@ -37,10 +37,19 @@
 public class KeyJsonValue
 extends BaseIdentifiableObject
 {
+/**
+ * A namespace represents a collection of keys
+ */
 private String namespace;
 
+/**
+ * A key belongs to a namespace, and represent a value
+ */
 private String key;
 
+/**
+ * A value referenced by a key and namespace, json-formatted data stored as a string.
+ */
 private String value;
 
 @JsonProperty

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/keyjsonvalue/KeyJsonValueService.java'
--- dhis-2/dhis-api/sr

[Dhis2-devs] [Branch ~dhis2-devs-core/dhis2/trunk] Rev 20610: Added enum AppStatus

2015-10-09 Thread noreply

revno: 20610
committer: Lars Helge Overland 
branch nick: dhis2
timestamp: Fri 2015-10-09 23:43:56 +0200
message:
  Added enum AppStatus
added:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/appmanager/AppStatus.java
modified:
  
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/appmanager/DefaultAppManager.java


--
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
=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/appmanager/AppStatus.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/appmanager/AppStatus.java	1970-01-01 00:00:00 +
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/appmanager/AppStatus.java	2015-10-09 21:43:56 +
@@ -0,0 +1,34 @@
+package org.hisp.dhis.appmanager;
+
+/*
+ * Copyright (c) 2004-2015, 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.
+ */
+
+public enum AppStatus
+{
+OK, NAMESPACE_TAKEN;
+}

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/appmanager/DefaultAppManager.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/appmanager/DefaultAppManager.java	2015-10-09 21:21:12 +
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/appmanager/DefaultAppManager.java	2015-10-09 21:43:56 +
@@ -1,5 +1,31 @@
 package org.hisp.dhis.appmanager;
 
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.stream.Collectors;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+
+import javax.annotation.PostConstruct;
+
+import org.apache.ant.compress.taskdefs.Unzip;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.hisp.dhis.datavalue.DefaultDataValueService;
+import org.hisp.dhis.keyjsonvalue.KeyJsonValueService;
+import org.hisp.dhis.setting.Setting;
+import org.hisp.dhis.setting.SystemSettingManager;
+import org.hisp.dhis.user.CurrentUserService;
+import org.hisp.dhis.user.User;
+import org.hisp.dhis.user.UserCredentials;
+import org.springframework.beans.factory.annotation.Autowired;
+
 /*
  * Copyright (c) 2004-2015, University of Oslo
  * All rights reserved.
@@ -31,33 +57,6 @@
 import com.fasterxml.jackson.databind.DeserializationFeature;
 import com.fasterxml.jackson.databind.ObjectMapper;
 
-import org.apache.ant.compress.taskdefs.Unzip;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.hisp.dhis.datavalue.DefaultDataValueService;
-import org.hisp.dhis.keyjsonvalue.KeyJsonValueService;
-import org.hisp.dhis.setting.Setting;
-import org.hisp.dhis.setting.SystemSettingManager;
-import org.hisp.dhis.user.CurrentUserService;
-import org.hisp.dhis.user.User;
-import org.hisp.dhis.user.UserCredentials;
-import org.springframework.beans.factory.annotation.Autowired;
-
-import javax.annotation.PostConstruct;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.

[Dhis2-devs] [Branch ~dhis2-devs-core/dhis2/trunk] Rev 20611: Minor

2015-10-09 Thread noreply

revno: 20611
committer: Lars Helge Overland 
branch nick: dhis2
timestamp: Fri 2015-10-09 23:48:42 +0200
message:
  Minor
modified:
  
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-appmanager/src/main/java/org/hisp/dhis/appmanager/action/AddAppAction.java


--
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 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-appmanager/src/main/java/org/hisp/dhis/appmanager/action/AddAppAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-appmanager/src/main/java/org/hisp/dhis/appmanager/action/AddAppAction.java	2015-10-09 17:01:55 +
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-appmanager/src/main/java/org/hisp/dhis/appmanager/action/AddAppAction.java	2015-10-09 21:48:42 +
@@ -141,12 +141,13 @@
 
 AppStatus appStatus = appManager.installApp( file, fileName, contextPath );
 
-if(appStatus == AppStatus.NAMESPACE_TAKEN)
+if ( appStatus == AppStatus.NAMESPACE_TAKEN )
 {
 message = i18n.getString( "appmanager_namespace_taken" );
 log.warn( "Namespace in the app's manifest already taken." );
 return FAILURE;
 }
+
 message = i18n.getString( "appmanager_install_success" );
 
 return SUCCESS;

___
Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help   : https://help.launchpad.net/ListHelp


[Dhis2-devs] [Branch ~dhis2-devs-core/dhis2/trunk] Rev 20612: Closing zip if namespace is taken (DefaultAppManager)

2015-10-09 Thread noreply
Merge authors:
  Stian Sandvold (stian-sandvold)

revno: 20612 [merge]
committer: Stian Sandvold 
branch nick: dhis2
timestamp: Fri 2015-10-09 23:59:06 +0200
message:
  Closing zip if namespace is taken (DefaultAppManager)
modified:
  
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/appmanager/DefaultAppManager.java


--
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 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/appmanager/DefaultAppManager.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/appmanager/DefaultAppManager.java	2015-10-09 21:43:56 +
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/appmanager/DefaultAppManager.java	2015-10-09 21:56:56 +
@@ -150,6 +150,7 @@
 if ( appNamespace != null && ( this.appNamespaces.containsKey( appNamespace ) && 
 !app.equals( appNamespaces.get( appNamespace ) ) ) )
 {
+zip.close();
 return AppStatus.NAMESPACE_TAKEN;
 }
 

___
Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help   : https://help.launchpad.net/ListHelp


Re: [Dhis2-devs] sending email notification with attachment from dhis messages

2015-10-09 Thread Furqonuddin Ramdhani
Okay, thx Lars.

On Fri, Oct 9, 2015 at 6:17 PM, Lars Helge Øverland 
wrote:

> Hi Furqonuddin,
>
> sorry at the moment this is not possible.
>
> We do have a blueprint for attachments in messages here:
>
> https://blueprints.launchpad.net/dhis2/+spec/message-attachments
>
> regards,
>
> Lars
>
>
> On Fri, Oct 9, 2015 at 4:23 AM, Furqonuddin Ramdhani 
> wrote:
>
>> yes, send email to users. is it possible to take our reports/charts from
>> pivot table(xls/pdf) or data visualizer(png/jpg) as a link (url)  so we can
>> include the url in our messages  ?
>>
>> Regards,
>> Dhani
>>
>> On Fri, Oct 9, 2015 at 6:45 AM, Knut Staring  wrote:
>>
>>> You want to send email to users? Could it be just a link (url)?
>>>
>>> Knut
>>>
>>> On Fri, Oct 9, 2015 at 1:41 AM, Furqonuddin Ramdhani >> > wrote:
>>>
 Hi All,

 is it possible to send notification with attachment from dihis
 messages, for example I want to send output of my pivot table report in
 xls/pdf ?
 If not possible , any suggestion how to do it ?

 Thanks

 --
 Best Regards
 *Furqonuddin Ramdhani*

 ___
 Mailing list: https://launchpad.net/~dhis2-devs
 Post to : dhis2-devs@lists.launchpad.net
 Unsubscribe : https://launchpad.net/~dhis2-devs
 More help   : https://help.launchpad.net/ListHelp


>>>
>>>
>>> --
>>> Knut Staring
>>> Dept. of Informatics, University of Oslo
>>> Norway: +4791880522
>>> Skype: knutstar
>>> http://dhis2.org
>>>
>>
>>
>>
>> --
>> Salam
>> *Furqonuddin Ramdhani*
>>
>> ___
>> Mailing list: https://launchpad.net/~dhis2-devs
>> Post to : dhis2-devs@lists.launchpad.net
>> Unsubscribe : https://launchpad.net/~dhis2-devs
>> More help   : https://help.launchpad.net/ListHelp
>>
>>
>
>
> --
> Lars Helge Øverland
> Lead developer, DHIS 2
> University of Oslo
> Skype: larshelgeoverland
> http://www.dhis2.org 
>
>


-- 
Salam
*Furqonuddin Ramdhani*
___
Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help   : https://help.launchpad.net/ListHelp