← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15527: Fixed bug - Exception thrown when to delete a program

 

------------------------------------------------------------
revno: 15527
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2014-06-03 12:55:04 +0800
message:
  Fixed bug - Exception thrown when to delete a program
modified:
  dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/program/ProgramInstanceDeletionHandler.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/resources/org/hisp/dhis/trackedentity/i18n_module.properties
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateAttibuteGroupForm.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 'dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/program/ProgramInstanceDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/program/ProgramInstanceDeletionHandler.java	2014-03-18 08:10:10 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/program/ProgramInstanceDeletionHandler.java	2014-06-03 04:55:04 +0000
@@ -28,6 +28,7 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import java.util.Collection;
 import java.util.Iterator;
 
 import org.hisp.dhis.system.deletion.DeletionHandler;
@@ -117,13 +118,17 @@
     @Override
     public void deleteProgram( Program program )
     {
-        Iterator<ProgramInstance> iterator = program.getProgramInstances().iterator();
+        Collection<ProgramInstance> programInstances = programInstanceService.getProgramInstances( program );
 
-        while ( iterator.hasNext() )
+        if ( programInstances != null )
         {
-            ProgramInstance programInstance = iterator.next();
-            iterator.remove();
-            programInstanceService.deleteProgramInstance( programInstance );
+            Iterator<ProgramInstance> iterator = programInstances.iterator();
+            while ( iterator.hasNext() )
+            {
+                ProgramInstance programInstance = iterator.next();
+                iterator.remove();
+                programInstanceService.deleteProgramInstance( programInstance );
+            }
         }
     }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/resources/org/hisp/dhis/trackedentity/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/resources/org/hisp/dhis/trackedentity/i18n_module.properties	2014-06-02 04:53:15 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/resources/org/hisp/dhis/trackedentity/i18n_module.properties	2014-06-03 04:55:04 +0000
@@ -494,5 +494,5 @@
 orgunit = Organisation unit
 program_within_orgunit = Program within organisation unit
 auto_save_registration_forms = Auto save registration form 
-show_hide_advanced_options = Show advanced options
+show_advanced_options = Show advanced options
 hide_advanced_options = Hide advanced options
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateAttibuteGroupForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateAttibuteGroupForm.vm	2014-06-02 02:07:05 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateAttibuteGroupForm.vm	2014-06-03 04:55:04 +0000
@@ -40,7 +40,7 @@
 	
 	<tr>
 		<td>
-			<select style="height: 200px; width: 100%; margin-top: 22px;" multiple id="availableAttributes" name="availableAttributes" size="15"></select>
+			<select style="height: 200px; width: 100%;" multiple id="availableAttributes" name="availableAttributes" size="15"></select>
 		</td>
 		<td>
 			<input type="button" value="&gt;" title="$i18n.getString('move_selected')" onclick="dhisAjaxSelect_moveAllSelected( 'availableAttributes', 'selectedAttributes' )" class='filterButton'/><br/>