dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #31009
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15769: Fixed bug - Don't save the phone number value in TEI registration form if it is just the phone nu...
------------------------------------------------------------
revno: 15769
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2014-06-19 21:44:22 +0800
message:
Fixed bug - Don't save the phone number value in TEI registration form if it is just the phone number code which are defined in system setting.
modified:
dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityFormService.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/trackedEntityInstanceForm.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/trackedentity/DefaultTrackedEntityFormService.java'
--- dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityFormService.java 2014-06-17 12:21:26 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityFormService.java 2014-06-19 13:44:22 +0000
@@ -294,9 +294,18 @@
{
inputHtml += ",number:true";
}
+ else if ( TrackedEntityAttribute.TYPE_PHONE_NUMBER.equals( attribute.getValueType() ) )
+ {
+ inputHtml += ",phone:true";
+ }
inputHtml += "}}\" ";
- if ( attribute.getValueType().equals( TrackedEntityAttribute.TYPE_TRUE_ONLY ) )
+
+ if ( attribute.getValueType().equals( TrackedEntityAttribute.TYPE_PHONE_NUMBER ) )
+ {
+ inputHtml += " phoneNumber ";
+ }
+ else if ( attribute.getValueType().equals( TrackedEntityAttribute.TYPE_TRUE_ONLY ) )
{
inputHtml += " type='checkbox' value='true' ";
if ( value.equals( "true" ) )
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js 2014-06-18 13:30:41 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js 2014-06-19 13:44:22 +0000
@@ -224,20 +224,25 @@
// Get Params form Div
// ----------------------------------------------------------------
+var phoneNumberAreaCode = "";
function getParamsForDiv(entityInstanceDiv) {
var params = '';
var dateOperator = '';
$("#" + entityInstanceDiv + " :input").each(function() {
- var elementId = $(this).attr('id');
- if ($(this).attr('type') == 'checkbox') {
- var checked = jQuery(this).attr('checked') ? true : false;
+ var item = jQuery(this);
+ var elementId = item.attr('id');
+ if (item.attr('type') == 'checkbox') {
+ var checked = item.attr('checked') ? true : false;
params += elementId + "=" + checked + "&";
} else if (elementId == 'dateOperator') {
- dateOperator = jQuery(this).val();
+ dateOperator = item.val();
} else if ($(this).attr('type') != 'button') {
var value = "";
- if (jQuery(this).val() != null && jQuery(this).val() != '') {
- value = htmlEncode(jQuery(this).val());
+ if (item.val() != null && item.val() != '') {
+ if( (item.attr('phoneNumber')==undefined)
+ || ( item.attr('phoneNumber')!=undefined && item.val()!= phoneNumberAreaCode) ){
+ value = htmlEncode(item.val());
+ }
}
if (dateOperator != '') {
value = dateOperator + "'" + value + "'";
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/trackedEntityInstanceForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/trackedEntityInstanceForm.vm 2014-06-17 12:21:26 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/trackedEntityInstanceForm.vm 2014-06-19 13:44:22 +0000
@@ -41,66 +41,66 @@
#if( $attributesByGroup && $attributesByGroup.size() > 0 )
<tr><td> </td></tr>
<tr><th colspan="2" class="heading-column">$attributeGroup.displayName</th></tr>
- #foreach($attribute in $attributesByGroup )
- #if( $attribute )
- #set($value = "")
- #set($value = $attributeValueMap.get($attribute.id))
- #set($mandatory = $mandatoryMap.get($attribute.id))
- #set($allowDateInFuture = $allowDateInFutureMap.get($attribute.id))
- #if( $mandatory ) #else #set($mandatory=false) #end
- <tr name='attributesFields'>
- <td class='text-column'><label>$encoder.htmlEncode($attribute.displayName) #if($mandatory ) <em title="$i18n.getString( 'required' )" class="required">*</em> #end</label></td>
- <td class="input-column">
- #if( $attribute.valueType == "bool" )
- <select id="attr$attribute.id" name="attr$attribute.id" inherit="$!attribute.inherit" class="{validate:{required:$mandatory }}" >
- <option value="" selected="selected">[$i18n.getString( "please_select" )]</option>
- <option value="true" #if($value=='true') selected #end>$i18n.getString( "yes" )</option>
- <option value="false" #if($value=='false') selected #end>$i18n.getString( "no" )</option>
- </select>
- #elseif( $attribute.valueType == "trueOnly" )
- <input type='checkbox' value="true" id="attr$attribute.id" name="attr$attribute.id" inherit="$!attribute.inherit" #if($value=='true') checked #end class="{validate:{required:$mandatory }}" >
- #elseif( $attribute.valueType == "date" )
- <input type="text" id="attr$attribute.id" name="attr$attribute.id" inherit="$!attribute.inherit" value='$value' class="{validate:{required:$mandatory }}" />
- <script type="text/javascript">
- #if($allowDateInFuture=='true')
- datePicker( 'attr$attribute.id', false, false );
- #else
- datePickerValid( 'attr$attribute.id', false, false );
- #end
- </script>
- #elseif( $attribute.valueType == "optionSet" )
- <select id="attr$attribute.id" name="attr$attribute.id" inherit="$!attribute.inherit" class="{validate:{required:$mandatory }}" >
- <option value="">[$i18n.getString( "please_select" )]</option>
- #foreach ($option in $attribute.optionSet.options )
- <option value="$option" #if("$value"=="$option") selected #end>$option</option>
- #end
- </select>
- #elseif( $attribute.valueType == "users" )
- <select inherit="$!attribute.inherit" class=' #validate( "default" $mandatory )' >
- <option value="">[$i18n.getString("please_select")]</option>
- #foreach( $user in $healthWorkers)
- <option value="$user.id" #if($value == $user.id) selected="selected" #end >$user.name</option>
- #end
- </select>
- #elseif( $attribute.valueType == "phoneNumber" )
- #if($value=='')
- #set($value=$!phoneNumberAreaCode)
- #end
- <input type='text' value='$!value' id="attr$attribute.id" name="attr$attribute.id" inherit="$!attribute.inherit" class="{validate:{phone:true,required:$mandatory }}"/>
- #elseif( $attribute.valueType == "trackerAssociate" )
- <input type="checkbox" value='true' id="attr$attribute.id" name="attr$attribute.id"
- inherit="$!attribute.inherit" #if($value=='true') checked #end
- onclick="toggleUnderAge(this);" class='underAge' />
- #elseif( $attribute.valueType == "age" || $attribute.valueType == "number" )
- <input type='text' id="attr$attribute.id" value="$value" name="attr$attribute.id" inherit="$!attribute.inherit" class="{validate:{required:$mandatory ,number:true}}"/>
- #elseif( $attribute.valueType == "age" || $attribute.valueType == "number" )
- <input type='text' id="attr$attribute.id" value="$value" name="attr$attribute.id" inherit="$!attribute.inherit" class="{validate:{required:$mandatory ,letterswithbasicpunc:true}}"/>
- #else
- <input type="text" id="attr$attribute.id" name="attr$attribute.id" inherit="$!attribute.inherit" value='$value' class="{validate:{required:$mandatory #if($attribute.valueType=='NUMBER'),number:true #end }}" />
- #end
- </td>
- </tr>
- #end
+ #foreach($attribute in $attributesByGroup )
+ #if( $attribute )
+ #set($value = "")
+ #set($value = $attributeValueMap.get($attribute.id))
+ #set($mandatory = $mandatoryMap.get($attribute.id))
+ #set($allowDateInFuture = $allowDateInFutureMap.get($attribute.id))
+ #if( $mandatory ) #else #set($mandatory=false) #end
+ <tr name='attributesFields'>
+ <td class='text-column'><label>$encoder.htmlEncode($attribute.displayName) #if($mandatory ) <em title="$i18n.getString( 'required' )" class="required">*</em> #end</label></td>
+ <td class="input-column">
+ #if( $attribute.valueType == "bool" )
+ <select id="attr$attribute.id" name="attr$attribute.id" inherit="$!attribute.inherit" class="{validate:{required:$mandatory }}" >
+ <option value="" selected="selected">[$i18n.getString( "please_select" )]</option>
+ <option value="true" #if($value=='true') selected #end>$i18n.getString( "yes" )</option>
+ <option value="false" #if($value=='false') selected #end>$i18n.getString( "no" )</option>
+ </select>
+ #elseif( $attribute.valueType == "trueOnly" )
+ <input type='checkbox' value="true" id="attr$attribute.id" name="attr$attribute.id" inherit="$!attribute.inherit" #if($value=='true') checked #end class="{validate:{required:$mandatory }}" >
+ #elseif( $attribute.valueType == "date" )
+ <input type="text" id="attr$attribute.id" name="attr$attribute.id" inherit="$!attribute.inherit" value='$value' class="{validate:{required:$mandatory }}" />
+ <script type="text/javascript">
+ #if($allowDateInFuture=='true')
+ datePicker( 'attr$attribute.id', false, false );
+ #else
+ datePickerValid( 'attr$attribute.id', false, false );
+ #end
+ </script>
+ #elseif( $attribute.valueType == "optionSet" )
+ <select id="attr$attribute.id" name="attr$attribute.id" inherit="$!attribute.inherit" class="{validate:{required:$mandatory }}" >
+ <option value="">[$i18n.getString( "please_select" )]</option>
+ #foreach ($option in $attribute.optionSet.options )
+ <option value="$option" #if("$value"=="$option") selected #end>$option</option>
+ #end
+ </select>
+ #elseif( $attribute.valueType == "users" )
+ <select inherit="$!attribute.inherit" class=' #validate( "default" $mandatory )' >
+ <option value="">[$i18n.getString("please_select")]</option>
+ #foreach( $user in $healthWorkers)
+ <option value="$user.id" #if($value == $user.id) selected="selected" #end >$user.name</option>
+ #end
+ </select>
+ #elseif( $attribute.valueType == "phoneNumber" )
+ #if($value=='')
+ #set($value=$!phoneNumberAreaCode)
+ #end
+ <input type='text' value='$!value' id="attr$attribute.id" name="attr$attribute.id" inherit="$!attribute.inherit" phoneNumber class="{validate:{phone:true,required:$mandatory }}"/>
+ #elseif( $attribute.valueType == "trackerAssociate" )
+ <input type="checkbox" value='true' id="attr$attribute.id" name="attr$attribute.id"
+ inherit="$!attribute.inherit" #if($value=='true') checked #end
+ onclick="toggleUnderAge(this);" class='underAge' />
+ #elseif( $attribute.valueType == "age" || $attribute.valueType == "number" )
+ <input type='text' id="attr$attribute.id" value="$value" name="attr$attribute.id" inherit="$!attribute.inherit" class="{validate:{required:$mandatory ,number:true}}"/>
+ #elseif( $attribute.valueType == "age" || $attribute.valueType == "number" )
+ <input type='text' id="attr$attribute.id" value="$value" name="attr$attribute.id" inherit="$!attribute.inherit" class="{validate:{required:$mandatory ,letterswithbasicpunc:true}}"/>
+ #else
+ <input type="text" id="attr$attribute.id" name="attr$attribute.id" inherit="$!attribute.inherit" value='$value' class="{validate:{required:$mandatory #if($attribute.valueType=='NUMBER'),number:true #end }}" />
+ #end
+ </td>
+ </tr>
+ #end
#end
#end
#end
@@ -153,7 +153,7 @@
#if($attributeValue=='')
#set($attributeValue=$!phoneNumberAreaCode)
#end
- <input type='text' value='$attributeValue' id="attr$attribute.id" name="attr$attribute.id" inherit="$!attribute.inherit" class="{validate:{phone:true}}"/>
+ <input type='text' value='$attributeValue' id="attr$attribute.id" name="attr$attribute.id" inherit="$!attribute.inherit" phoneNumber class="{validate:{required:$mandatory,phone:true}}"/>
#elseif( $attribute.valueType == "trackerAssociate" )
<input type="checkbox" value='true' id="attr$attribute.id" name="attr$attribute.id"
inherit="$!attribute.inherit" #if($attributeValue=='true') checked #end
@@ -217,4 +217,6 @@
#if( $addRelationship=='true')
jQuery('[inherit="true"]').attr('disabled',true);
#end
+
+ phoneNumberAreaCode = "$!phoneNumberAreaCode";
</script>