← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16578: Fixed bug in option set management form.

 

------------------------------------------------------------
revno: 16578
committer: Tran Chau<tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2014-08-29 22:16:13 +0700
message:
   Fixed bug in option set management form.
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/option/OptionService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/option/DefaultOptionService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/option/hibernate/HibernateOptionStore.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/option/GetOptionListAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/option/RemoveOptionAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/option.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/updateOptionForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/resources/org/hisp/dhis/trackedentity/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/option/OptionService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/option/OptionService.java	2014-08-29 12:48:40 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/option/OptionService.java	2014-08-29 15:16:13 +0000
@@ -76,6 +76,14 @@
     
     Option getOption( int id );
     
+    Option getOptionByCode( String code );
+    
+    Option getOptionValueByName( OptionSet optionSet, String name );
+    
+    Collection<Option> getOptionValues( OptionSet optionSet, String option, Integer min, Integer max );
+    
+    void deleteOption( Option option  );
+    
     Option getOptionByName( OptionSet optionSet, String name );
 
     Option getOptionByCode( OptionSet optionSet, String code );

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/option/DefaultOptionService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/option/DefaultOptionService.java	2014-08-29 13:03:34 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/option/DefaultOptionService.java	2014-08-29 15:16:13 +0000
@@ -196,4 +196,9 @@
     {
         return i18n( i18nService, optionStore.getOptions( optionSet, option, min, max ) );
     }
+    
+    public void deleteOption( Option option  )
+    {
+        optionValueStore.delete( option );
+    }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/option/hibernate/HibernateOptionStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/option/hibernate/HibernateOptionStore.java	2014-08-29 13:03:34 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/option/hibernate/HibernateOptionStore.java	2014-08-29 15:16:13 +0000
@@ -82,7 +82,7 @@
 
         Query query = getQuery( hql );
         query.setEntity( "optionSet", optionSet );
-        query.setString( "name", name );
+        query.setString( "name", name.toLowerCase() );
 
         return (Option) query.uniqueResult();
     }
@@ -109,7 +109,7 @@
 
         if ( option != null )
         {
-            hql += "and lower(option.name) like ('%" + option + "%') ";
+            hql += "and lower(option.name) like ('%" + option.toLowerCase() + "%') ";
         }
 
         hql += " order by index(option)";

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/option/GetOptionListAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/option/GetOptionListAction.java	2014-08-29 12:48:40 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/option/GetOptionListAction.java	2014-08-29 15:16:13 +0000
@@ -77,6 +77,11 @@
         this.key = key;
     }
 
+    public String getKey()
+    {
+        return key;
+    }
+
     private OptionSet optionSet;
 
     public OptionSet getOptionSet()

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/option/RemoveOptionAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/option/RemoveOptionAction.java	2014-07-29 07:52:47 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/option/RemoveOptionAction.java	2014-08-29 15:16:13 +0000
@@ -83,6 +83,7 @@
 
         Option option = optionService.getOption( id );
         optionSet.getOptions().remove( option );
+        optionService.deleteOption(option);
 
         optionService.updateOptionSet( optionSet );
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties	2014-08-29 12:04:53 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties	2014-08-29 15:16:13 +0000
@@ -189,6 +189,8 @@
 add_new_sql_view=Add new SQL view
 update_sql_view=Update SQL view
 name_is_null=Name is not allowed to be null
+name_in_use=Name is in use
+code_in_use=Code is in use
 language_country_in_use=The language and country set is already in use
 sqlquery_is_empty=SQL statement cannot be null
 sqlquery_is_invalid=This SQL statement is invalid.

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/option.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/option.vm	2014-08-03 07:05:52 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/option.vm	2014-08-29 15:16:13 +0000
@@ -31,7 +31,7 @@
 				<tr>
 					<td>
 						<form onsubmit="submitFilter()" method="GET" action="option.action" id="filterKeyForm">
-							<input type="text" class="filterInput" placeholder="$i18n.getString('filter_by_name')" name="key" id="key">
+							<input type="text" class="filterInput" placeholder="$i18n.getString('filter_by_name')" name="key" id="key" value="$!key">
 							<input type="hidden" id="optionSetId" name="optionSetId" value="$optionSet.id" />
 							<input type="hidden" value="" name="curKey" id="curKey">
 							<input type="submit" class="filterButton" value="Filter" id="filterButton">
@@ -65,8 +65,10 @@
       #end
       </tbody>
 			</table>
-			<p></p>
-			#parse( "/dhis-web-commons/paging/paging.vm" )
+			#if($options.size() > 0)
+				<p></p>
+				#parse( "/dhis-web-commons/paging/paging.vm" )
+			#end
 		</td>
 		
 		<td id="detailsData">

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/updateOptionForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/updateOptionForm.vm	2014-08-29 13:08:45 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/updateOptionForm.vm	2014-08-29 15:16:13 +0000
@@ -35,7 +35,7 @@
 	<tr>
 	  <td></td>
 	  <td colspan="2">
-		<input type="submit"  value="$i18n.getString( 'add' )" style="width:10em">
+		<input type="submit"  value="$i18n.getString( 'update' )" style="width:10em">
 		<input type="button" onclick="window.location.href='option.action?optionSetId=$optionSet.id'" value="$i18n.getString( 'cancel' )" style="width:10em"/></p>
       </td>
 	</tr>

=== 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-08-29 06:39:13 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/resources/org/hisp/dhis/trackedentity/i18n_module.properties	2014-08-29 15:16:13 +0000
@@ -30,9 +30,9 @@
 create_new_tracked_entity_attribute=Create new tracked entity attribute
 confirm_delete_tracked_entity_attribute=Are you sure you want to delete this tracked entity attribute?
 tracked_entity_attribute_management=Tracked entity attribute management
-name_in_use=Name in use
+name_in_use=Name is in use
 short_name_in_use=Short name in use
-code_in_use=Code in use
+code_in_use=Code is in use
 program_stage_sort_order=Program Stage Sort Order
 sort=Sort
 value_must_positive=Value must be a positive number