Skip to content

Commit

Permalink
Backup before deleting an account
Browse files Browse the repository at this point in the history
  • Loading branch information
rivaldi8 committed Feb 10, 2018
1 parent 5526180 commit 8310451
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
import org.gnucash.android.ui.util.AccountBalanceTask;
import org.gnucash.android.ui.util.CursorRecyclerAdapter;
import org.gnucash.android.ui.util.widget.EmptyRecyclerView;
import org.gnucash.android.util.BackupManager;

import java.util.List;

Expand Down Expand Up @@ -247,6 +248,7 @@ public void tryDeleteAccount(long rowId) {
if (acc.getTransactionCount() > 0 || mAccountsDbAdapter.getSubAccountCount(acc.getUID()) > 0) {
showConfirmationDialog(rowId);
} else {
BackupManager.backupActiveBook();
// Avoid calling AccountsDbAdapter.deleteRecord(long). See #654
String uid = mAccountsDbAdapter.getUID(rowId);
mAccountsDbAdapter.deleteRecord(uid);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import org.gnucash.android.model.AccountType;
import org.gnucash.android.ui.common.Refreshable;
import org.gnucash.android.ui.homescreen.WidgetConfigurationActivity;
import org.gnucash.android.util.BackupManager;
import org.gnucash.android.util.QualifiedAccountNameCursorAdapter;

import java.util.List;
Expand Down Expand Up @@ -209,6 +210,7 @@ public void onClick(View v) {

@Override
public void onClick(View v) {
BackupManager.backupActiveBook();

AccountsDbAdapter accountsDbAdapter = AccountsDbAdapter.getInstance();

Expand Down

0 comments on commit 8310451

Please sign in to comment.