dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #01374
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 402: Fixed bug #3365955
------------------------------------------------------------
revno: 402
committer: Lars Helge Oeverland larshelge@xxxxxxxxx
branch nick: trunk
timestamp: Tue 2009-06-30 17:44:49 +0200
message:
Fixed bug #3365955
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitService.java
dhis-2/dhis-services/dhis-service-organisationunit/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitService.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/hierarchy/MoveOrganisationUnitAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/AddOrganisationUnitAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/RemoveOrganisationUnitAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/UpdateOrganisationUnitAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/updateOrganisationUnitForm.vm
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitService.java 2009-06-10 22:25:07 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitService.java 2009-06-30 15:44:49 +0000
@@ -63,6 +63,15 @@
void updateOrganisationUnit( OrganisationUnit organisationUnit );
/**
+ * Updates an OrganisationUnit.
+ *
+ * @param organisationUnit the organisationUnit to update.
+ * @param updateHierarchy indicate whether the OrganisationUnit hierarchy
+ * has been updated.
+ */
+ void updateOrganisationUnit( OrganisationUnit organisationUnit, boolean updateHierarchy );
+
+ /**
* Deletes an OrganisationUnit. OrganisationUnits with children cannot be
* deleted.
*
=== modified file 'dhis-2/dhis-services/dhis-service-organisationunit/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitService.java'
--- dhis-2/dhis-services/dhis-service-organisationunit/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitService.java 2009-06-10 22:25:07 +0000
+++ dhis-2/dhis-services/dhis-service-organisationunit/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitService.java 2009-06-30 15:44:49 +0000
@@ -96,6 +96,8 @@
i18nService.addObject( organisationUnit );
+ addOrganisationUnitHierarchy( organisationUnit.getOpeningDate() );
+
return id;
}
@@ -105,6 +107,16 @@
i18nService.verify( organisationUnit );
}
+
+ public void updateOrganisationUnit( OrganisationUnit organisationUnit, boolean updateHierarchy )
+ {
+ updateOrganisationUnit( organisationUnit );
+
+ if ( updateHierarchy )
+ {
+ addOrganisationUnitHierarchy( new Date() );
+ }
+ }
public void deleteOrganisationUnit( OrganisationUnit organisationUnit )
throws HierarchyViolationException
@@ -126,6 +138,8 @@
i18nService.removeObject( organisationUnit );
sourceStore.deleteSource( organisationUnit );
+
+ addOrganisationUnitHierarchy( organisationUnit.getClosedDate() != null ? organisationUnit.getClosedDate() : new Date() );
}
public OrganisationUnit getOrganisationUnit( int id )
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/hierarchy/MoveOrganisationUnitAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/hierarchy/MoveOrganisationUnitAction.java 2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/hierarchy/MoveOrganisationUnitAction.java 2009-06-30 15:44:49 +0000
@@ -27,8 +27,6 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import java.util.Date;
-
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.organisationunit.OrganisationUnitService;
import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
@@ -108,9 +106,7 @@
unitToMove.setParent( newParent );
- organisationUnitService.updateOrganisationUnit( unitToMove );
-
- organisationUnitService.addOrganisationUnitHierarchy( new Date() );
+ organisationUnitService.updateOrganisationUnit( unitToMove, true );
return SUCCESS;
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/AddOrganisationUnitAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/AddOrganisationUnitAction.java 2009-06-25 11:18:23 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/AddOrganisationUnitAction.java 2009-06-30 15:44:49 +0000
@@ -36,6 +36,8 @@
import com.opensymphony.xwork.ActionSupport;
+import static org.hisp.dhis.system.util.TextUtils.nullIfEmpty;
+
/**
* @author Torgeir Lorange Ostby
* @version $Id: AddOrganisationUnitAction.java 1898 2006-09-22 12:06:56Z torgeilo $
@@ -150,15 +152,13 @@
public String execute()
throws Exception
{
- if ( code != null && code.trim().length() == 0 )
- {
- code = null;
- }
-
- if ( comment != null && comment.trim().length() == 0 )
- {
- comment = null;
- }
+ code = nullIfEmpty( code );
+ comment = nullIfEmpty( comment );
+ type = nullIfEmpty( type );
+ polygonCoordinates = nullIfEmpty( polygonCoordinates );
+ latitude = nullIfEmpty( latitude );
+ longitude = nullIfEmpty( longitude );
+ url = nullIfEmpty( url );
Date date = format.parseDate( openingDate );
@@ -194,8 +194,6 @@
organisationUnitService.addOrganisationUnit( organisationUnit );
- organisationUnitService.addOrganisationUnitHierarchy( date );
-
return SUCCESS;
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/RemoveOrganisationUnitAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/RemoveOrganisationUnitAction.java 2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/RemoveOrganisationUnitAction.java 2009-06-30 15:44:49 +0000
@@ -27,8 +27,6 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import java.util.Date;
-
import org.hisp.dhis.common.DeleteNotAllowedException;
import org.hisp.dhis.i18n.I18n;
import org.hisp.dhis.organisationunit.OrganisationUnit;
@@ -92,13 +90,9 @@
{
OrganisationUnit unit = organisationUnitService.getOrganisationUnit( id );
- Date closedDate = unit.getClosedDate() != null ? unit.getClosedDate() : new Date();
-
try
{
organisationUnitService.deleteOrganisationUnit( unit );
-
- organisationUnitService.addOrganisationUnitHierarchy( closedDate );
}
catch ( DeleteNotAllowedException ex )
{
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/UpdateOrganisationUnitAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/UpdateOrganisationUnitAction.java 2009-06-25 11:18:23 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/UpdateOrganisationUnitAction.java 2009-06-30 15:44:49 +0000
@@ -27,6 +27,8 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import static org.hisp.dhis.system.util.TextUtils.nullIfEmpty;
+
import java.util.Date;
import org.hisp.dhis.i18n.I18nFormat;
@@ -162,10 +164,13 @@
public String execute()
throws Exception
{
- if ( code != null && code.trim().length() == 0 )
- {
- code = null;
- }
+ code = nullIfEmpty( code );
+ comment = nullIfEmpty( comment );
+ type = nullIfEmpty( type );
+ polygonCoordinates = nullIfEmpty( polygonCoordinates );
+ latitude = nullIfEmpty( latitude );
+ longitude = nullIfEmpty( longitude );
+ url = nullIfEmpty( url );
Date oDate = format.parseDate( openingDate );
@@ -176,11 +181,6 @@
cDate = format.parseDate( closedDate );
}
- if ( comment != null && comment.trim().length() == 0 )
- {
- comment = null;
- }
-
// ---------------------------------------------------------------------
// Update organisation unit
// ---------------------------------------------------------------------
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/updateOrganisationUnitForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/updateOrganisationUnitForm.vm 2009-06-25 11:18:23 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/updateOrganisationUnitForm.vm 2009-06-30 15:44:49 +0000
@@ -59,7 +59,7 @@
</tr>
<tr>
<td><label for="polygonCoordinates">$i18n.getString( "polygon_coordinates" )</label></td>
- <td><textarea id="polygonCoordinates" name="polygonCoordinates" value="$!encoder.htmlEncode( $organisationUnit.polygonCoordinates )" style="width:20em; height:5em"></td>
+ <td><textarea id="polygonCoordinates" name="polygonCoordinates" style="width:20em; height:5em">$!encoder.htmlEncode( $organisationUnit.polygonCoordinates )</textarea></td>
</tr>
<tr>
<td><label for="latitude">$i18n.getString( "latitude" )</label></td>
--
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.