Skip to content

Commit 75376d4

Browse files
committed
Merge branch 'develop'
2 parents c328f38 + e4c5696 commit 75376d4

8 files changed

Lines changed: 47 additions & 11 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
Change Log
22
===============================================================================
3+
Version 1.4.3 *(2014-09-09)*
4+
----------------------------
5+
* Fixed: Cannot edit transactions when in single-entry mode
6+
* Fixed: Transaction type button sometimes hidden in single-entry mode
7+
* Fixed: Problems saving new transactions from templates
8+
39
Version 1.4.2 *(2014-08-30)*
410
----------------------------
511
* Fixed: Newly added transactions cannot be exported

app/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
1919
package="org.gnucash.android"
20-
android:versionCode="39"
20+
android:versionCode="40"
2121
android:versionName="@string/app_version_name" >
2222

2323
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="16"/>

app/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<description>Gnucash Android companion application</description>
2323

2424
<parent>
25-
<version>1.4.2-SNAPSHOT</version>
25+
<version>1.4.3-SNAPSHOT</version>
2626
<groupId>org.gnucash.android</groupId>
2727
<artifactId>gnucash-android-parent</artifactId>
2828
</parent>

app/res/values/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
1919
<string name="app_name">GnuCash</string>
20-
<string name="app_version_name">1.4.2</string>
20+
<string name="app_version_name">1.4.3</string>
2121
<string name="title_add_account">Create Account</string>
2222
<string name="title_edit_account">Edit Account</string>
2323
<string name="info_details">Info</string>

app/src/org/gnucash/android/db/SplitsDbAdapter.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,9 @@ public String getUID(long id){
286286
* @return Cursor to splits
287287
*/
288288
public Cursor fetchSplitsForTransaction(String transactionUID){
289+
if (transactionUID == null)
290+
throw new IllegalArgumentException("Transaction UID cannot be null");
291+
289292
Log.v(TAG, "Fetching all splits for transaction UID " + transactionUID);
290293
return mDb.query(SplitEntry.TABLE_NAME,
291294
null, SplitEntry.COLUMN_TRANSACTION_UID + " = ?",
@@ -390,6 +393,17 @@ public boolean deleteRecord(long rowId) {
390393
return result;
391394
}
392395

396+
/**
397+
* Deletes a split from the database.
398+
* This is a convenience method which essentially calls {@link #deleteRecord(long)}
399+
* @param uid String unique ID of split
400+
* @return <code>true</code> if the split was deleted, <code>false</code> otherwise
401+
*/
402+
public boolean deleteSplit(String uid){
403+
long id = getID(uid);
404+
return deleteRecord(id);
405+
}
406+
393407
/**
394408
* Returns the database record ID for the specified transaction UID
395409
* @param transactionUID Unique idendtifier of the transaction

app/src/org/gnucash/android/ui/transaction/TransactionFormFragment.java

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ public void onActivityCreated(Bundle savedInstanceState) {
209209
actionBar.setDisplayShowTitleEnabled(false);
210210

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

594596
if (mTransaction != null){
595597
if (!mUseDoubleEntry){
598+
//first remove old splits for this transaction, since there is only one split
599+
SplitsDbAdapter splitsDbAdapter = new SplitsDbAdapter(getActivity());
600+
for (Split split : mTransaction.getSplits()) {
601+
splitsDbAdapter.deleteSplit(split.getUID());
602+
}
603+
splitsDbAdapter.close();
604+
596605
Split split = new Split(amount, accountUID);
597606
split.setType(mTransactionTypeButton.getTransactionType());
598607
mTransaction.getSplits().clear();
599608
mTransaction.addSplit(split);
600-
} else
609+
} else {
601610
mTransaction.setSplits(mSplitsList);
611+
}
602612
mTransaction.setDescription(description);
603613
} else {
604614
mTransaction = new Transaction(description);
615+
if (!mUseDoubleEntry){
616+
Split split = new Split(amount, accountUID);
617+
split.setType(mTransactionTypeButton.getTransactionType());
618+
mSplitsList.clear();
619+
mSplitsList.add(split);
620+
}
621+
605622
if (mSplitsList.isEmpty()) { //amount entered in the simple interface (not using splits Editor)
606623
Split split = new Split(amount, accountUID);
607624
split.setType(mTransactionTypeButton.getTransactionType());
@@ -707,8 +724,7 @@ public void setSplitList(List<Split> splitList, List<String> removedSplitUIDs){
707724
//once we set the split list, do not allow direct editing of the total
708725
if (mSplitsList.size() > 1){
709726
mAmountEditText.setEnabled(false);
710-
mTransactionTypeButton.setVisibility(View.GONE);
711-
getView().findViewById(R.id.layout_double_entry).setVisibility(View.GONE);
727+
setAmountEditViewVisible(View.GONE);
712728
}
713729

714730
SplitsDbAdapter splitsDbAdapter = new SplitsDbAdapter(getActivity());

integration-tests/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<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">
1818
<modelVersion>4.0.0</modelVersion>
1919
<parent>
20-
<version>1.4.2-SNAPSHOT</version>
20+
<version>1.4.3-SNAPSHOT</version>
2121
<groupId>org.gnucash.android</groupId>
2222
<artifactId>gnucash-android-parent</artifactId>
2323
</parent>

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
<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">
1919
<modelVersion>4.0.0</modelVersion>
20-
<version>1.4.2-SNAPSHOT</version>
20+
<version>1.4.3-SNAPSHOT</version>
2121
<groupId>org.gnucash.android</groupId>
2222
<artifactId>gnucash-android-parent</artifactId>
2323
<name>GnuCash Android parent</name>

0 commit comments

Comments
 (0)