Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
codinguser committed Sep 8, 2014
2 parents c328f38 + e4c5696 commit 75376d4
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 11 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
Change Log
===============================================================================
Version 1.4.3 *(2014-09-09)*
----------------------------
* Fixed: Cannot edit transactions when in single-entry mode
* Fixed: Transaction type button sometimes hidden in single-entry mode
* Fixed: Problems saving new transactions from templates

Version 1.4.2 *(2014-08-30)*
----------------------------
* Fixed: Newly added transactions cannot be exported
Expand Down
2 changes: 1 addition & 1 deletion app/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.gnucash.android"
android:versionCode="39"
android:versionCode="40"
android:versionName="@string/app_version_name" >

<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="16"/>
Expand Down
2 changes: 1 addition & 1 deletion app/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<description>Gnucash Android companion application</description>

<parent>
<version>1.4.2-SNAPSHOT</version>
<version>1.4.3-SNAPSHOT</version>
<groupId>org.gnucash.android</groupId>
<artifactId>gnucash-android-parent</artifactId>
</parent>
Expand Down
2 changes: 1 addition & 1 deletion app/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string name="app_name">GnuCash</string>
<string name="app_version_name">1.4.2</string>
<string name="app_version_name">1.4.3</string>
<string name="title_add_account">Create Account</string>
<string name="title_edit_account">Edit Account</string>
<string name="info_details">Info</string>
Expand Down
14 changes: 14 additions & 0 deletions app/src/org/gnucash/android/db/SplitsDbAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,9 @@ public String getUID(long id){
* @return Cursor to splits
*/
public Cursor fetchSplitsForTransaction(String transactionUID){
if (transactionUID == null)
throw new IllegalArgumentException("Transaction UID cannot be null");

Log.v(TAG, "Fetching all splits for transaction UID " + transactionUID);
return mDb.query(SplitEntry.TABLE_NAME,
null, SplitEntry.COLUMN_TRANSACTION_UID + " = ?",
Expand Down Expand Up @@ -390,6 +393,17 @@ public boolean deleteRecord(long rowId) {
return result;
}

/**
* Deletes a split from the database.
* This is a convenience method which essentially calls {@link #deleteRecord(long)}
* @param uid String unique ID of split
* @return <code>true</code> if the split was deleted, <code>false</code> otherwise
*/
public boolean deleteSplit(String uid){
long id = getID(uid);
return deleteRecord(id);
}

/**
* Returns the database record ID for the specified transaction UID
* @param transactionUID Unique idendtifier of the transaction
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ public void onActivityCreated(Bundle savedInstanceState) {
actionBar.setDisplayShowTitleEnabled(false);

SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
mUseDoubleEntry = sharedPrefs.getBoolean(getString(R.string.key_use_double_entry), true);
mUseDoubleEntry = sharedPrefs.getBoolean(getString(R.string.key_use_double_entry), false);
if (!mUseDoubleEntry){
getView().findViewById(R.id.layout_double_entry).setVisibility(View.GONE);
mOpenSplitsButton.setVisibility(View.GONE);
Expand Down Expand Up @@ -306,7 +306,9 @@ public void onItemClick(AdapterView<?> adapterView, View view, int position, lon
mSplitsList.clear();
setAmountEditViewVisible(View.VISIBLE);
} else {
setAmountEditViewVisible(View.GONE);
if (mUseDoubleEntry) { //don't hide the view in single entry mode
setAmountEditViewVisible(View.GONE);
}
}
}
mTransaction = null; //we are creating a new transaction after all
Expand Down Expand Up @@ -346,7 +348,7 @@ private void initializeViewsWithTransaction(){
} else {
for (Split split : mTransaction.getSplits()) {
//two splits, one belongs to this account and the other to another account
if (!split.getAccountUID().equals(accountUID)) {
if (mUseDoubleEntry && !split.getAccountUID().equals(accountUID)) {
setSelectedTransferAccount(mAccountsDbAdapter.getAccountID(split.getAccountUID()));
}
}
Expand Down Expand Up @@ -593,15 +595,30 @@ private void saveNewTransaction() {

if (mTransaction != null){
if (!mUseDoubleEntry){
//first remove old splits for this transaction, since there is only one split
SplitsDbAdapter splitsDbAdapter = new SplitsDbAdapter(getActivity());
for (Split split : mTransaction.getSplits()) {
splitsDbAdapter.deleteSplit(split.getUID());
}
splitsDbAdapter.close();

Split split = new Split(amount, accountUID);
split.setType(mTransactionTypeButton.getTransactionType());
mTransaction.getSplits().clear();
mTransaction.addSplit(split);
} else
} else {
mTransaction.setSplits(mSplitsList);
}
mTransaction.setDescription(description);
} else {
mTransaction = new Transaction(description);
if (!mUseDoubleEntry){
Split split = new Split(amount, accountUID);
split.setType(mTransactionTypeButton.getTransactionType());
mSplitsList.clear();
mSplitsList.add(split);
}

if (mSplitsList.isEmpty()) { //amount entered in the simple interface (not using splits Editor)
Split split = new Split(amount, accountUID);
split.setType(mTransactionTypeButton.getTransactionType());
Expand Down Expand Up @@ -707,8 +724,7 @@ public void setSplitList(List<Split> splitList, List<String> removedSplitUIDs){
//once we set the split list, do not allow direct editing of the total
if (mSplitsList.size() > 1){
mAmountEditText.setEnabled(false);
mTransactionTypeButton.setVisibility(View.GONE);
getView().findViewById(R.id.layout_double_entry).setVisibility(View.GONE);
setAmountEditViewVisible(View.GONE);
}

SplitsDbAdapter splitsDbAdapter = new SplitsDbAdapter(getActivity());
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<version>1.4.2-SNAPSHOT</version>
<version>1.4.3-SNAPSHOT</version>
<groupId>org.gnucash.android</groupId>
<artifactId>gnucash-android-parent</artifactId>
</parent>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<version>1.4.2-SNAPSHOT</version>
<version>1.4.3-SNAPSHOT</version>
<groupId>org.gnucash.android</groupId>
<artifactId>gnucash-android-parent</artifactId>
<name>GnuCash Android parent</name>
Expand Down

0 comments on commit 75376d4

Please sign in to comment.