dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #16063
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5999: added feedback for when a datavalue is saved and there is a lock in place
------------------------------------------------------------
revno: 5999
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2012-02-17 02:55:38 +0700
message:
added feedback for when a datavalue is saved and there is a lock in place
modified:
dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/SaveValueAction.java
dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/org/hisp/dhis/de/i18n_module.properties
dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/entry.js
dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js
dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/select.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-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/SaveValueAction.java'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/SaveValueAction.java 2012-02-16 18:13:44 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/SaveValueAction.java 2012-02-16 19:55:38 +0000
@@ -27,8 +27,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import java.util.Date;
-
+import com.opensymphony.xwork2.Action;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hisp.dhis.dataelement.DataElement;
@@ -44,7 +43,7 @@
import org.hisp.dhis.period.PeriodType;
import org.hisp.dhis.user.CurrentUserService;
-import com.opensymphony.xwork2.Action;
+import java.util.Date;
/**
* @author Abyot Asalefew
@@ -53,7 +52,7 @@
implements Action
{
private static final Log log = LogFactory.getLog( SaveValueAction.class );
-
+
// -------------------------------------------------------------------------
// Dependencies
// -------------------------------------------------------------------------
@@ -92,7 +91,7 @@
{
this.organisationUnitService = organisationUnitService;
}
-
+
private DataSetService dataSetService;
public void setDataSetService( DataSetService dataSetService )
@@ -157,7 +156,7 @@
public String execute()
{
Period period = PeriodType.createPeriodExternalId( periodId );
-
+
if ( period == null )
{
return logError( "Illegal period identifier: " + periodId );
@@ -172,7 +171,7 @@
DataElementCategoryOptionCombo optionCombo = categoryService.getDataElementCategoryOptionCombo( optionComboId );
Date now = new Date();
-
+
if ( storedBy == null )
{
storedBy = "[unknown]";
@@ -194,9 +193,9 @@
if ( dataSetService.isLocked( dataElement, period, organisationUnit, null ) )
{
- return logError( "Entry locked for combination: " + dataElement + ", " + period + ", " + organisationUnit );
+ return logError( "Entry locked for combination: " + dataElement + ", " + period + ", " + organisationUnit, 2 );
}
-
+
// ---------------------------------------------------------------------
// Update data
// ---------------------------------------------------------------------
@@ -229,10 +228,15 @@
private String logError( String message )
{
+ return logError( message, 1 );
+ }
+
+ private String logError( String message, int statusCode )
+ {
log.info( message );
-
- statusCode = 1;
-
+
+ this.statusCode = statusCode;
+
return SUCCESS;
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/org/hisp/dhis/de/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/org/hisp/dhis/de/i18n_module.properties 2012-02-16 12:49:27 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/org/hisp/dhis/de/i18n_module.properties 2012-02-16 19:55:38 +0000
@@ -49,6 +49,7 @@
value_must_integer=Value must be an integer and maximum length not exceeds 255 characters
saving_value_failed_status_code=Saving value failed with status code
saving_value_failed_error_code=Saving value failed with error code
+saving_value_failed_dataset_is_locked=Saving data value failed, data set is locked, please contact the system administrator
saving_comment_failed_status_code=Saving comment failed with status code
saving_comment_failed_error_code=Saving comment failed with error code
saving_minmax_failed_error_code=Saving min/max values failed with error code
=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/entry.js'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/entry.js 2012-01-18 06:11:17 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/entry.js 2012-02-16 19:55:38 +0000
@@ -269,6 +269,11 @@
storageManager.clearDataValueJSON( dataValue );
markValue( resultColor );
}
+ else if(code == 2)
+ {
+ markValue( COLOR_RED );
+ window.alert( i18n_saving_value_failed_dataset_is_locked + '\n\n' + code );
+ }
else // Server error during save
{
markValue( COLOR_RED );
=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js 2012-02-16 12:49:27 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js 2012-02-16 19:55:38 +0000
@@ -1586,7 +1586,7 @@
};
/**
- * Indicators whether there exists data values or complete data set
+ * Indicates whether there exists data values or complete data set
* registrations in the local storage.
*
* @return true if local data exists, false otherwise.
=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/select.vm'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/select.vm 2012-02-16 12:49:27 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/select.vm 2012-02-16 19:55:38 +0000
@@ -13,6 +13,7 @@
var i18n_value_must_negative_integer = '$encoder.jsEscape( $i18n.getString( "value_must_negative_integer" ) , "'")';
var i18n_field_unallowed_save_zero = '$encoder.jsEscape( $i18n.getString( "field_unallowed_save_zero" ) , "'")';
var i18n_saving_value_failed_status_code = '$encoder.jsEscape( $i18n.getString( "saving_value_failed_status_code" ) , "'")';
+var i18n_saving_value_failed_dataset_is_locked = '$encoder.jsEscape( $i18n.getString( "saving_value_failed_dataset_is_locked" ) , "'")';
var i18n_saving_comment_failed_status_code = '$encoder.jsEscape( $i18n.getString( "saving_comment_failed_status_code" ) , "'")';
var i18n_saving_minmax_failed_error_code = '$encoder.jsEscape( $i18n.getString( "saving_minmax_failed_error_code" ) , "'")';
var i18n_confirm_complete = '$encoder.jsEscape( $i18n.getString( "confirm_complete" ) , "'")';