Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Amount field in Savings Account Transaction Fragment accepts zero (0) as amount #664

Merged
merged 1 commit into from
Jun 26, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.ViewFlipper;

import com.google.gson.Gson;
Expand Down Expand Up @@ -205,6 +206,20 @@ public void onReviewTransactionButtonClicked() {
.message_field_required)).notifyUserWithToast(getActivity());
return;
}
// Notify the user if zero is entered in the Amount
// field or only "." (Decimal point) is entered.
try {
if (Float.parseFloat(et_transactionAmount.getEditableText().toString()) == 0) {
new RequiredFieldException(getString(R.string.amount), getString(string
.message_cannot_be_zero)).notifyUserWithToast(getActivity());
return;
}
} catch (NumberFormatException e) {

Toast.makeText(getActivity(), string.error_invalid_amount, Toast.LENGTH_SHORT).show();
return;
}

String[] headers = {getResources().getString(string.field),
getResources().getString(string.value)};
String[][] data = {
Expand Down
1 change: 1 addition & 0 deletions mifosng-android/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,7 @@
<string name="message_no_identifiers_available">No Identifiers available for this client</string>
<string name="message_no_charges_available">No Charges available for this client</string>
<string name="message_field_required"> is mandatory and cannot be left blank</string>
<string name="message_cannot_be_zero">cannot be zero</string>
<string name="upload_document">Upload Document</string>
<string name="uploaded_successfully">%1$s Uploaded Successfully</string>
<string name="upload_failed">Upload Failed</string>
Expand Down