Skip to content

Commit

Permalink
Fixed: crash when deleting scheduled transactions
Browse files Browse the repository at this point in the history
  • Loading branch information
codinguser committed Feb 9, 2015
1 parent f22f24c commit 5d13458
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,7 @@ public String getUID(long transactionId){
@Override
public boolean deleteRecord(long rowId){
Log.d(TAG, "Delete transaction with record Id: " + rowId);
//the splits db adapter handles deletion of the transaction
return mSplitsDbAdapter.deleteSplitsForTransaction(rowId);
}

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/org/gnucash/android/model/Split.java
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public String toString() {
* @return
*/
public String toCsv(){
String splitString = mAmount.toString() + ";" + mAmount.getCurrency().getCurrencyCode() + ";"
String splitString = mAmount.asString() + ";" + mAmount.getCurrency().getCurrencyCode() + ";"
+ mAccountUID + ";" + mSplitType.name();
if (mMemo != null){
splitString = splitString + ";" + mMemo;
Expand Down
7 changes: 6 additions & 1 deletion app/src/main/java/org/gnucash/android/model/Transaction.java
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,15 @@ public Transaction(Transaction transaction, boolean generateNewUID){
initDefaults();
setDescription(transaction.getDescription());
setNote(transaction.getNote());
setTime(transaction.getTimeMillis());
mCurrencyCode = transaction.mCurrencyCode;
mRecurrencePeriod = transaction.mRecurrencePeriod;
//exported flag is left at default value of false

for (Split split : transaction.mSplitList) {
addSplit(new Split(split, true));
}
setTime(transaction.getTimeMillis());

if (!generateNewUID){
setUID(transaction.getUID());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,10 @@ public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
Toast.makeText(getActivity(), R.string.toast_recurring_transaction_deleted, Toast.LENGTH_SHORT).show();
}
}
refreshList();
mode.finish();
WidgetConfigurationActivity.updateAllWidgets(getActivity());
getLoaderManager().destroyLoader(0);
refreshList();
return true;

default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,7 @@ public AmountTextWatcher(EditText amountInput) {
@Override
public void afterTextChanged(Editable s) {
String value = s.toString();
if (mTransactionTypeButton.isChecked()){
if (value.length() > 0 && mTransactionTypeButton.isChecked()){
if (s.charAt(0) != '-'){
s = Editable.Factory.getInstance().newEditable("-" + value);
}
Expand Down

0 comments on commit 5d13458

Please sign in to comment.