diff --git a/ChangeLog b/ChangeLog index d7b8f53..661dc8b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -v0.3 (11/04/2012) +v0.3 (27/04/2012) ** User ** New interface in Qt Use BDD file from .local/share/kisscount @@ -10,13 +10,15 @@ v0.3 (11/04/2012) Better auto completion for transfert operation (not two times the same operation completed) ** Dev ** - Version 3 of database (account hidden item added) + Version 3 of database : account hidden item added, some id deleted, on delete constraints added + This version is not compatible with previous ones ** Bugs ** Fix a bug in language settings Virtual transferts must not be considered as a debit Last account/category wasn't taken in account during search - + New users have system language set instead of English + Account/Category modification are immediatly reported in other panels v0.2 (04/07/2011) Remove dependancies of libsqlite and libxml diff --git a/ressources/init.sql b/ressources/init.sql index d7059b9..f84b108 100644 --- a/ressources/init.sql +++ b/ressources/init.sql @@ -2,9 +2,9 @@ CREATE TABLE kisscount(db_version VARCHAR(20)); CREATE TABLE user (id INTEGER PRIMARY KEY, name VARCHAR(255), password VARCHAR(255)); CREATE TABLE account(id INTEGER PRIMARY KEY, user REFERENCES user(id), name VARCHAR(255), number VARCHAR(255), shared CHAR(1), blocked CHAR(1), default_account CHAR(1), virtual CHAR(1), hidden CHAR(1)); CREATE TABLE shared_account(account REFERENCES account(id), user REFERENCES user(id)); -CREATE TABLE account_amount(id INTEGER PRIMARY KEY, account REFERENCES account(id), year INTEGER, month INTEGER, amount FLOAT); -CREATE TABLE operation(id INTEGER PRIMARY KEY, parent REFERENCES operation(id), user REFERENCES user(id), account REFERENCES account(id), year INTEGER, month INTEGER, day INTEGER, amount FLOAT, description VARCHAR(255), category REFERENCES category(id), fix_cost CHAR(1), checked CHAR(1), formula VARCHAR(255), transfert REFERENCES operation(id), meta CHAR(1), virtual CHAR(1)); -CREATE TABLE category(id INTEGER PRIMARY KEY, user REFERENCES user(id), parent REFERENCES category(id), name VARCHAR(255), backcolor VARCHAR(10), forecolor VARCHAR(10), font VARCHAR(255), fix_cost CHAR(1)); -CREATE TABLE preference(id INTEGER PRIMARY KEY, user REFERENCES user(id), name VARCHAR(255), value VARCHAR(255)); -CREATE TABLE import_pattern(id INTEGER PRIMARY KEY, user REFERENCES user(id), description VARCHAR(255), pattern VARCHAR(255), account REFERENCES account(id), category REFERENCES category(id)); +CREATE TABLE account_amount(account REFERENCES account(id), year INTEGER, month INTEGER, amount FLOAT, PRIMARY KEY(account, year, month)); +CREATE TABLE operation(id INTEGER PRIMARY KEY, parent REFERENCES operation(id), user REFERENCES user(id), account REFERENCES account(id) ON DELETE SET NULL, year INTEGER, month INTEGER, day INTEGER, amount FLOAT, description VARCHAR(255), category REFERENCES category(id) ON DELETE SET NULL, fix_cost CHAR(1), checked CHAR(1), formula VARCHAR(255), transfert REFERENCES operation(id), meta CHAR(1), virtual CHAR(1)); +CREATE TABLE category(id INTEGER PRIMARY KEY, user REFERENCES user(id), parent REFERENCES category(id) ON DELETE SET NULL, name VARCHAR(255), backcolor VARCHAR(10), forecolor VARCHAR(10), font VARCHAR(255), fix_cost CHAR(1)); +CREATE TABLE preference(user REFERENCES user(id), name VARCHAR(255), value VARCHAR(255), PRIMARY KEY(user, name)); +CREATE TABLE import_pattern(user REFERENCES user(id), description VARCHAR(255), pattern VARCHAR(255), account REFERENCES account(id), category REFERENCES category(id), PRIMARY KEY(user, description)); INSERT INTO kisscount ("db_version") VALUES ("3"); diff --git a/ressources/po/french.mo b/ressources/po/french.mo index f75865a..4dc748f 100644 Binary files a/ressources/po/french.mo and b/ressources/po/french.mo differ diff --git a/ressources/po/french.po b/ressources/po/french.po index 5465f0f..f3ab2b1 100644 --- a/ressources/po/french.po +++ b/ressources/po/french.po @@ -148,7 +148,7 @@ msgstr "Format de fichier non reconnu" #: src/view/SnapshotsDialog.cpp:169 msgid "Are you sure want to come back to " -msgstr "ëtes vous sûr de vouloir revenir à " +msgstr "êtes vous sûr de vouloir revenir à " #: src/view/SnapshotsDialog.cpp:137 #: src/view/PreferencesPanel.cpp:1090 diff --git a/ressources/po/kisscount.pot b/ressources/po/kisscount.pot index fdb0f83..a07f121 100644 --- a/ressources/po/kisscount.pot +++ b/ressources/po/kisscount.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-03-20 20:58+0100\n" +"POT-Creation-Date: 2012-04-28 10:33+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -21,9 +21,9 @@ msgstr "" msgid " - " msgstr "" -#: src/view/UsersDialog.cpp:120 src/view/PreferencesPanel.cpp:826 -#: src/view/PreferencesPanel.cpp:846 src/view/PreferencesPanel.cpp:978 -#: src/view/PreferencesPanel.cpp:997 src/view/PreferencesPanel.cpp:1038 +#: src/view/UsersDialog.cpp:123 src/view/PreferencesPanel.cpp:870 +#: src/view/PreferencesPanel.cpp:893 src/view/PreferencesPanel.cpp:1027 +#: src/view/PreferencesPanel.cpp:1049 src/view/PreferencesPanel.cpp:1092 msgid " already exists" msgstr "" @@ -43,11 +43,11 @@ msgstr "" msgid " not found, aborting" msgstr "" -#: src/view/AccountPanel.cpp:984 +#: src/view/AccountPanel.cpp:1009 msgid " operations ?" msgstr "" -#: src/view/PreferencesPanel.cpp:1090 +#: src/view/PreferencesPanel.cpp:1148 msgid " profil ?" msgstr "" @@ -85,23 +85,23 @@ msgstr "" msgid "1 entry found" msgstr "" -#: src/view/SearchBanner.cpp:93 src/view/grid/GridAccount.cpp:72 +#: src/view/SearchBanner.cpp:93 src/view/grid/GridAccount.cpp:73 msgid "Account" msgstr "" -#: src/view/PreferencesPanel.cpp:826 src/view/PreferencesPanel.cpp:846 +#: src/view/PreferencesPanel.cpp:870 src/view/PreferencesPanel.cpp:893 msgid "Account " msgstr "" -#: src/controller/KissCount.cpp:344 +#: src/controller/KissCount.cpp:341 msgid "Account 1" msgstr "" -#: src/view/ImportPanel.cpp:64 src/view/AccountPanel.cpp:476 +#: src/view/ImportPanel.cpp:64 src/view/AccountPanel.cpp:501 msgid "Account name" msgstr "" -#: src/view/AccountPanel.cpp:475 +#: src/view/AccountPanel.cpp:500 msgid "Account number" msgstr "" @@ -109,7 +109,7 @@ msgstr "" msgid "Accounts" msgstr "" -#: src/view/AccountPanel.cpp:1200 +#: src/view/AccountPanel.cpp:1244 msgid "Accounts updated until " msgstr "" @@ -125,7 +125,7 @@ msgstr "" msgid "Amount to" msgstr "" -#: src/view/AccountPanel.cpp:1205 +#: src/view/AccountPanel.cpp:1249 msgid "Any account updated !" msgstr "" @@ -137,12 +137,12 @@ msgstr "" msgid "Are you sure want to come back to " msgstr "" -#: src/view/SnapshotsDialog.cpp:137 src/view/PreferencesPanel.cpp:1090 -#: src/view/AccountPanel.cpp:979 +#: src/view/SnapshotsDialog.cpp:137 src/view/PreferencesPanel.cpp:1148 +#: src/view/AccountPanel.cpp:1004 msgid "Are you sure want to delete " msgstr "" -#: src/view/grid/GridAccount.cpp:776 +#: src/view/grid/GridAccount.cpp:777 msgid "Are you sure want to delete : \n" msgstr "" @@ -150,7 +150,7 @@ msgstr "" msgid "Are you sure want to integrate these operations ?" msgstr "" -#: src/view/PreferencesPanel.cpp:470 +#: src/view/PreferencesPanel.cpp:476 msgid "Ascending" msgstr "" @@ -158,15 +158,15 @@ msgstr "" msgid "Back to this snapshot" msgstr "" -#: src/view/PreferencesPanel.cpp:356 +#: src/view/PreferencesPanel.cpp:354 msgid "Background color" msgstr "" -#: src/view/AccountPanel.cpp:277 +#: src/view/AccountPanel.cpp:299 msgid "Balance" msgstr "" -#: src/view/PreferencesPanel.cpp:223 +#: src/view/PreferencesPanel.cpp:221 msgid "Blocked" msgstr "" @@ -175,15 +175,15 @@ msgstr "" msgid "Cancel" msgstr "" -#: src/view/grid/GridAccount.cpp:1266 src/view/grid/GridAccount.cpp:1279 +#: src/view/grid/GridAccount.cpp:1272 src/view/grid/GridAccount.cpp:1285 msgid "Cannot group these operations" msgstr "" -#: src/view/grid/GridAccount.cpp:1410 src/view/grid/GridAccount.cpp:1416 +#: src/view/grid/GridAccount.cpp:1416 src/view/grid/GridAccount.cpp:1422 msgid "Cannot ungroup these operations" msgstr "" -#: src/controller/KissCount.cpp:335 +#: src/controller/KissCount.cpp:332 msgid "Car" msgstr "" @@ -191,11 +191,11 @@ msgstr "" msgid "Categories" msgstr "" -#: src/view/SearchBanner.cpp:91 src/view/grid/GridAccount.cpp:72 +#: src/view/SearchBanner.cpp:91 src/view/grid/GridAccount.cpp:73 msgid "Category" msgstr "" -#: src/view/PreferencesPanel.cpp:978 src/view/PreferencesPanel.cpp:997 +#: src/view/PreferencesPanel.cpp:1027 src/view/PreferencesPanel.cpp:1049 msgid "Category " msgstr "" @@ -223,7 +223,7 @@ msgstr "" msgid "Change password" msgstr "" -#: src/view/AccountPanel.cpp:150 +#: src/view/AccountPanel.cpp:160 msgid "Check" msgstr "" @@ -247,7 +247,7 @@ msgstr "" msgid "Confirm password" msgstr "" -#: src/view/StatsPanel.cpp:158 src/view/AccountPanel.cpp:99 +#: src/view/StatsPanel.cpp:158 src/view/AccountPanel.cpp:109 msgid "Cost repartition" msgstr "" @@ -261,23 +261,23 @@ msgstr "" msgid "Create snapshot" msgstr "" -#: src/view/grid/GridAccount.cpp:72 +#: src/view/grid/GridAccount.cpp:73 msgid "Credit" msgstr "" -#: src/view/AccountPanel.cpp:273 +#: src/view/AccountPanel.cpp:295 msgid "Cur Credit" msgstr "" -#: src/view/AccountPanel.cpp:274 +#: src/view/AccountPanel.cpp:296 msgid "Cur Debit" msgstr "" -#: src/view/AccountPanel.cpp:478 +#: src/view/AccountPanel.cpp:503 msgid "Current value" msgstr "" -#: src/view/grid/GridAccount.cpp:72 +#: src/view/grid/GridAccount.cpp:73 msgid "Date" msgstr "" @@ -293,16 +293,20 @@ msgstr "" msgid "Days" msgstr "" -#: src/view/grid/GridAccount.cpp:72 +#: src/view/grid/GridAccount.cpp:73 msgid "Debit" msgstr "" -#: src/view/PreferencesPanel.cpp:221 +#: src/view/PreferencesPanel.cpp:219 msgid "Default" msgstr "" -#: src/view/PreferencesPanel.cpp:224 src/view/PreferencesPanel.cpp:359 -#: src/view/AccountPanel.cpp:837 +#: src/view/PreferencesPanel.cpp:674 +msgid "Default account cannot be hidden" +msgstr "" + +#: src/view/PreferencesPanel.cpp:222 src/view/PreferencesPanel.cpp:357 +#: src/view/AccountPanel.cpp:862 msgid "Delete" msgstr "" @@ -310,11 +314,11 @@ msgstr "" msgid "Delete snapshot" msgstr "" -#: src/view/PreferencesPanel.cpp:471 +#: src/view/PreferencesPanel.cpp:477 msgid "Descending" msgstr "" -#: src/view/SearchBanner.cpp:88 src/view/grid/GridAccount.cpp:72 +#: src/view/SearchBanner.cpp:88 src/view/grid/GridAccount.cpp:73 msgid "Description" msgstr "" @@ -322,33 +326,34 @@ msgstr "" msgid "Enter a new description" msgstr "" -#: src/view/StatsPanel.cpp:431 src/view/UsersDialog.cpp:90 -#: src/view/UsersDialog.cpp:120 src/view/SearchBanner.cpp:149 +#: src/view/StatsPanel.cpp:431 src/view/UsersDialog.cpp:93 +#: src/view/UsersDialog.cpp:123 src/view/SearchBanner.cpp:149 #: src/view/SearchBanner.cpp:159 src/view/SearchBanner.cpp:172 #: src/view/SearchBanner.cpp:181 src/view/SnapshotsDialog.cpp:117 #: src/view/SnapshotsDialog.cpp:133 src/view/SnapshotsDialog.cpp:142 #: src/view/SnapshotsDialog.cpp:165 src/view/SnapshotsDialog.cpp:174 #: src/view/ImportPanel.cpp:170 src/view/ExportPanel.cpp:118 #: src/view/ExportPanel.cpp:131 src/view/ExportPanel.cpp:138 -#: src/view/PreferencesPanel.cpp:585 src/view/PreferencesPanel.cpp:826 -#: src/view/PreferencesPanel.cpp:846 src/view/PreferencesPanel.cpp:978 -#: src/view/PreferencesPanel.cpp:997 src/view/PreferencesPanel.cpp:1032 -#: src/view/PreferencesPanel.cpp:1038 src/view/PreferencesPanel.cpp:1078 -#: src/view/PasswordDialog.cpp:64 src/view/PasswordDialog.cpp:70 -#: src/view/AccountPanel.cpp:975 src/view/grid/GridAccount.cpp:1266 -#: src/view/grid/GridAccount.cpp:1279 src/view/grid/GridAccount.cpp:1410 -#: src/view/grid/GridAccount.cpp:1416 src/view/grid/FormulaDelegate.cpp:59 -#: src/model/Database.cpp:56 src/model/Database.cpp:64 -#: src/model/Database.cpp:83 src/model/Database.cpp:111 -#: src/model/Database.cpp:117 src/model/Database.cpp:123 -#: src/model/Database.cpp:133 src/model/Database.cpp:153 -#: src/model/Database.cpp:603 src/model/Database.cpp:785 -#: src/model/Database.cpp:927 src/model/Database.cpp:1760 -#: src/model/DatabaseUpdate.cpp:31 src/model/DatabaseUpdate.cpp:162 +#: src/view/PreferencesPanel.cpp:601 src/view/PreferencesPanel.cpp:674 +#: src/view/PreferencesPanel.cpp:870 src/view/PreferencesPanel.cpp:893 +#: src/view/PreferencesPanel.cpp:1027 src/view/PreferencesPanel.cpp:1049 +#: src/view/PreferencesPanel.cpp:1086 src/view/PreferencesPanel.cpp:1092 +#: src/view/PreferencesPanel.cpp:1134 src/view/PasswordDialog.cpp:64 +#: src/view/PasswordDialog.cpp:70 src/view/AccountPanel.cpp:1000 +#: src/view/grid/GridAccount.cpp:1272 src/view/grid/GridAccount.cpp:1285 +#: src/view/grid/GridAccount.cpp:1416 src/view/grid/GridAccount.cpp:1422 +#: src/view/grid/FormulaDelegate.cpp:59 src/model/Database.cpp:56 +#: src/model/Database.cpp:64 src/model/Database.cpp:83 +#: src/model/Database.cpp:111 src/model/Database.cpp:117 +#: src/model/Database.cpp:123 src/model/Database.cpp:133 +#: src/model/Database.cpp:152 src/model/Database.cpp:608 +#: src/model/Database.cpp:784 src/model/Database.cpp:926 +#: src/model/Database.cpp:1746 src/model/DatabaseUpdate.cpp:31 +#: src/model/DatabaseUpdate.cpp:162 msgid "Error" msgstr "" -#: src/model/Database.cpp:153 +#: src/model/Database.cpp:152 msgid "Error creating original database" msgstr "" @@ -368,20 +373,20 @@ msgstr "" msgid "File category" msgstr "" -#: src/view/AccountPanel.cpp:479 +#: src/view/AccountPanel.cpp:504 msgid "Final value" msgstr "" -#: src/view/SearchBanner.cpp:70 src/view/grid/GridAccount.cpp:359 -#: src/controller/KissCount.cpp:335 +#: src/view/SearchBanner.cpp:70 src/view/grid/GridAccount.cpp:360 +#: src/controller/KissCount.cpp:332 msgid "Fix" msgstr "" -#: src/view/PreferencesPanel.cpp:358 +#: src/view/PreferencesPanel.cpp:356 msgid "Font" msgstr "" -#: src/view/PreferencesPanel.cpp:357 +#: src/view/PreferencesPanel.cpp:355 msgid "Foreground color" msgstr "" @@ -393,7 +398,7 @@ msgstr "" msgid "From " msgstr "" -#: src/view/GenerateDialog.cpp:33 src/view/AccountPanel.cpp:834 +#: src/view/GenerateDialog.cpp:33 src/view/AccountPanel.cpp:859 msgid "Generate month" msgstr "" @@ -401,19 +406,19 @@ msgstr "" msgid "Grisbi files (*.gsb)" msgstr "" -#: src/controller/KissCount.cpp:335 +#: src/controller/KissCount.cpp:332 msgid "Groceries" msgstr "" -#: src/view/AccountPanel.cpp:168 +#: src/view/AccountPanel.cpp:184 msgid "Group" msgstr "" -#: src/view/PreferencesPanel.cpp:225 +#: src/view/PreferencesPanel.cpp:223 msgid "Hidden" msgstr "" -#: src/controller/KissCount.cpp:335 +#: src/controller/KissCount.cpp:332 msgid "Hobbies" msgstr "" @@ -421,7 +426,7 @@ msgstr "" msgid "Import" msgstr "" -#: src/view/AccountPanel.cpp:477 +#: src/view/AccountPanel.cpp:502 msgid "Initial value" msgstr "" @@ -457,7 +462,7 @@ msgstr "" msgid "Invalid formula !" msgstr "" -#: src/view/PreferencesPanel.cpp:1032 +#: src/view/PreferencesPanel.cpp:1086 msgid "Invalid name !" msgstr "" @@ -465,7 +470,7 @@ msgstr "" msgid "Invalid old password" msgstr "" -#: src/view/UsersDialog.cpp:90 +#: src/view/UsersDialog.cpp:93 msgid "Invalid password" msgstr "" @@ -473,11 +478,11 @@ msgstr "" msgid "Invalide date range" msgstr "" -#: src/view/PreferencesPanel.cpp:585 +#: src/view/PreferencesPanel.cpp:601 msgid "It must be at least one account !" msgstr "" -#: src/view/AccountPanel.cpp:975 +#: src/view/AccountPanel.cpp:1000 msgid "It must be at least one month !" msgstr "" @@ -512,11 +517,11 @@ msgstr "" msgid "Language" msgstr "" -#: src/view/PreferencesPanel.cpp:1078 +#: src/view/PreferencesPanel.cpp:1134 msgid "Language not changed" msgstr "" -#: src/view/PreferencesPanel.cpp:1075 +#: src/view/PreferencesPanel.cpp:1131 msgid "Language successfully changed, please go to another panel" msgstr "" @@ -524,7 +529,7 @@ msgstr "" msgid "Load operations" msgstr "" -#: src/view/AccountPanel.cpp:146 +#: src/view/AccountPanel.cpp:156 msgid "Mode" msgstr "" @@ -532,16 +537,16 @@ msgstr "" msgid "Months" msgstr "" -#: src/view/PreferencesPanel.cpp:59 src/view/PreferencesPanel.cpp:219 -#: src/view/PreferencesPanel.cpp:355 +#: src/view/PreferencesPanel.cpp:59 src/view/PreferencesPanel.cpp:217 +#: src/view/PreferencesPanel.cpp:353 msgid "Name" msgstr "" -#: src/view/PreferencesPanel.cpp:1044 +#: src/view/PreferencesPanel.cpp:1098 msgid "Name changed" msgstr "" -#: src/view/UsersDialog.cpp:51 src/view/UsersDialog.cpp:111 +#: src/view/UsersDialog.cpp:51 src/view/UsersDialog.cpp:114 msgid "New User" msgstr "" @@ -568,12 +573,12 @@ msgid "No operation to save" msgstr "" #: src/view/StatsPanel.cpp:134 src/view/SearchBanner.cpp:72 -#: src/view/AccountPanel.cpp:278 +#: src/view/AccountPanel.cpp:300 msgid "Non fix" msgstr "" #: src/view/SearchPanel.cpp:140 src/view/SearchPanel.cpp:180 -#: src/view/PreferencesPanel.cpp:601 src/view/PreferencesPanel.cpp:676 +#: src/view/PreferencesPanel.cpp:617 src/view/PreferencesPanel.cpp:709 msgid "None" msgstr "" @@ -581,7 +586,7 @@ msgstr "" msgid "Not checked" msgstr "" -#: src/view/PreferencesPanel.cpp:220 +#: src/view/PreferencesPanel.cpp:218 msgid "Number" msgstr "" @@ -602,7 +607,7 @@ msgstr "" msgid "Operation order" msgstr "" -#: src/view/SearchBanner.cpp:92 src/view/AccountPanel.cpp:232 +#: src/view/SearchBanner.cpp:92 src/view/AccountPanel.cpp:254 msgid "Operations" msgstr "" @@ -614,7 +619,7 @@ msgstr "" msgid "Operations successfuly saved" msgstr "" -#: src/controller/KissCount.cpp:336 +#: src/controller/KissCount.cpp:333 msgid "Other" msgstr "" @@ -626,7 +631,7 @@ msgstr "" msgid "Password changed" msgstr "" -#: src/view/wxUI.cpp:287 +#: src/view/wxUI.cpp:295 msgid "" "Personal accounting software\n" "\n" @@ -641,15 +646,15 @@ msgstr "" msgid "Please retype new password" msgstr "" -#: src/view/PreferencesPanel.cpp:205 src/view/PreferencesPanel.cpp:1083 +#: src/view/PreferencesPanel.cpp:203 src/view/PreferencesPanel.cpp:1139 msgid "Preferences" msgstr "" -#: src/view/wxUI.cpp:292 +#: src/view/wxUI.cpp:300 msgid "Quit KissCount ?" msgstr "" -#: src/view/AccountPanel.cpp:149 +#: src/view/AccountPanel.cpp:159 msgid "Real" msgstr "" @@ -674,7 +679,7 @@ msgstr "" msgid "Shared with" msgstr "" -#: src/view/SnapshotsDialog.cpp:32 src/view/AccountPanel.cpp:171 +#: src/view/SnapshotsDialog.cpp:32 src/view/AccountPanel.cpp:187 msgid "Snapshots" msgstr "" @@ -686,15 +691,15 @@ msgstr "" msgid "To" msgstr "" -#: src/view/AccountPanel.cpp:252 src/view/AccountPanel.cpp:275 +#: src/view/AccountPanel.cpp:274 src/view/AccountPanel.cpp:297 msgid "Total Credit" msgstr "" -#: src/view/AccountPanel.cpp:253 src/view/AccountPanel.cpp:276 +#: src/view/AccountPanel.cpp:275 src/view/AccountPanel.cpp:298 msgid "Total Debit" msgstr "" -#: src/view/AccountPanel.cpp:169 +#: src/view/AccountPanel.cpp:185 msgid "UnGroup" msgstr "" @@ -711,7 +716,7 @@ msgid "Unable to open Database" msgstr "" #: src/model/Database.cpp:56 src/model/Database.cpp:64 -#: src/model/Database.cpp:83 src/model/Database.cpp:1760 +#: src/model/Database.cpp:83 src/model/Database.cpp:1746 msgid "Unable to open database" msgstr "" @@ -723,14 +728,14 @@ msgstr "" msgid "Unable to upgrade Database" msgstr "" -#: src/controller/KissCount.cpp:336 +#: src/controller/KissCount.cpp:333 msgid "Unexpected" msgstr "" #: src/view/SearchBanner.cpp:61 src/view/SearchBanner.cpp:80 -#: src/view/AccountPanel.cpp:624 src/view/AccountPanel.cpp:660 -#: src/view/AccountPanel.cpp:698 src/model/User.cpp:62 src/model/User.cpp:80 -#: src/model/User.cpp:158 +#: src/view/AccountPanel.cpp:649 src/view/AccountPanel.cpp:685 +#: src/view/AccountPanel.cpp:723 src/model/User.cpp:65 src/model/User.cpp:83 +#: src/model/User.cpp:161 msgid "Unknown" msgstr "" @@ -742,12 +747,12 @@ msgstr "" msgid "Unresolved categories" msgstr "" -#: src/model/Database.cpp:603 src/model/Database.cpp:785 -#: src/model/Database.cpp:927 +#: src/model/Database.cpp:608 src/model/Database.cpp:784 +#: src/model/Database.cpp:926 msgid "Update failed !\n" msgstr "" -#: src/view/AccountPanel.cpp:170 +#: src/view/AccountPanel.cpp:186 msgid "Update next months" msgstr "" @@ -755,8 +760,8 @@ msgstr "" msgid "User" msgstr "" -#: src/view/UsersDialog.cpp:40 src/view/UsersDialog.cpp:120 -#: src/view/PreferencesPanel.cpp:1038 +#: src/view/UsersDialog.cpp:40 src/view/UsersDialog.cpp:123 +#: src/view/PreferencesPanel.cpp:1092 msgid "User " msgstr "" @@ -764,11 +769,11 @@ msgstr "" msgid "Users" msgstr "" -#: src/view/PreferencesPanel.cpp:222 src/view/AccountPanel.cpp:148 +#: src/view/PreferencesPanel.cpp:220 src/view/AccountPanel.cpp:158 msgid "Virtual" msgstr "" -#: src/view/grid/GridAccount.cpp:1072 +#: src/view/grid/GridAccount.cpp:1078 msgid "Warning" msgstr "" @@ -776,62 +781,62 @@ msgstr "" msgid "Welcome back to " msgstr "" -#: src/view/PreferencesPanel.cpp:606 +#: src/view/PreferencesPanel.cpp:622 msgid "Wich account will replace this one ?" msgstr "" -#: src/view/PreferencesPanel.cpp:682 +#: src/view/PreferencesPanel.cpp:715 msgid "Wich category will replace this one ?" msgstr "" -#: src/view/grid/GridAccount.cpp:1072 +#: src/view/grid/GridAccount.cpp:1078 msgid "You made a debit on a blocked account" msgstr "" -#: src/view/wxUI.cpp:157 +#: src/view/wxUI.cpp:158 msgid "april" msgstr "" -#: src/view/wxUI.cpp:161 +#: src/view/wxUI.cpp:162 msgid "august" msgstr "" -#: src/view/wxUI.cpp:165 +#: src/view/wxUI.cpp:166 msgid "december" msgstr "" -#: src/view/wxUI.cpp:155 +#: src/view/wxUI.cpp:156 msgid "february" msgstr "" -#: src/view/wxUI.cpp:154 +#: src/view/wxUI.cpp:155 msgid "january" msgstr "" -#: src/view/wxUI.cpp:160 +#: src/view/wxUI.cpp:161 msgid "july" msgstr "" -#: src/view/wxUI.cpp:159 +#: src/view/wxUI.cpp:160 msgid "june" msgstr "" -#: src/view/wxUI.cpp:156 +#: src/view/wxUI.cpp:157 msgid "march" msgstr "" -#: src/view/wxUI.cpp:158 +#: src/view/wxUI.cpp:159 msgid "may" msgstr "" -#: src/view/wxUI.cpp:164 +#: src/view/wxUI.cpp:165 msgid "november" msgstr "" -#: src/view/wxUI.cpp:163 +#: src/view/wxUI.cpp:164 msgid "october" msgstr "" -#: src/view/wxUI.cpp:162 +#: src/view/wxUI.cpp:163 msgid "september" msgstr "" diff --git a/src/controller/KissCount.cpp b/src/controller/KissCount.cpp index 6c5a1f3..ec88612 100644 --- a/src/controller/KissCount.cpp +++ b/src/controller/KissCount.cpp @@ -98,9 +98,9 @@ User* KissCount::GetUser() return _user; } -double KissCount::GetAccountAmount(int id, int month, int year) +double KissCount::GetAccountAmount(int id, int month, int year, bool* had_value) { - return _db->GetAccountAmount(id, month, year); + return _db->GetAccountAmount(id, month, year, had_value); } double KissCount::CalcAccountAmount(int id, int month, int year, bool* had_values) @@ -179,7 +179,7 @@ int KissCount::AddAccount(Account& ac) ac.id = _db->AddAccount(_user, ac); _user->AddAccount(ac); - SetAccountAmount(ac.id, curDate.month(), curDate.year(), 0.0); + SetAccountAmount(ac.id, curDate.month()-1, curDate.year(), 0.0); return ac.id; } @@ -188,9 +188,6 @@ void KissCount::UpdateAccount(Account& ac) { _db->UpdateAccount(ac); _user->UpdateAccount(ac); - - // if (ac._default) - // std::sort(_user->_accounts.begin(), _user->_accounts.end(), Account()); } void KissCount::DeleteAccount(Account& ac, int replacement) @@ -338,7 +335,7 @@ QString default_cats[] = { void KissCount::NewUser(const QString& name) { - QDate curDate = QDate::currentDate(); + // QDate curDate = QDate::currentDate(); Account ac = { /*.id = */0, /*.name = */_("Account 1"), @@ -369,8 +366,6 @@ void KissCount::NewUser(const QString& name) AddCategory(cat); SetOperationOrder("ASC"); - - _db->GenerateMonth(_user, -1, -1, (int)curDate.month(), curDate.year()); } void KissCount::KillMe() diff --git a/src/controller/KissCount.hpp b/src/controller/KissCount.hpp index 514ad59..d37cce4 100644 --- a/src/controller/KissCount.hpp +++ b/src/controller/KissCount.hpp @@ -75,7 +75,7 @@ public: double MetaAmount(int id); double MetaPositiveAmount(int id); - double GetAccountAmount(int id, int month, int year); + double GetAccountAmount(int id, int month, int year, bool* had_values=NULL); void SetAccountAmount(int accountId, int month, int year, double value); double CalcAccountAmount(int id, int month, int year, bool* had_values); diff --git a/src/model/Database.cpp b/src/model/Database.cpp index fad4384..e231ab8 100644 --- a/src/model/Database.cpp +++ b/src/model/Database.cpp @@ -275,7 +275,7 @@ User* Database::LoadUser(const QString& name) query.clear(); - req = QString("SELECT * FROM account WHERE user='%1' ORDER BY default_account DESC, virtual, blocked, name ASC").arg(user->_id); + req = QString("SELECT * FROM account WHERE user='%1' ORDER BY default_account DESC, blocked, virtual, name ASC").arg(user->_id); EXECUTE_SQL_QUERY_WITH_CODE(req, 0, {delete user;}, {delete user;}); @@ -406,7 +406,7 @@ void Database::LoadYear(User* user, int year) query.clear(); } -double Database::GetAccountAmount(int id, int month, int year) +double Database::GetAccountAmount(int id, int month, int year, bool* had_value) { QSqlRecord set; QString req; @@ -422,9 +422,15 @@ double Database::GetAccountAmount(int id, int month, int year) { set = query.record(); res = set.value("amount").toDouble(); + if (had_value) + *had_value = true; } else + { SetAccountAmount(id, month, year, 0.0); + if (had_value) + *had_value = false; + } query.clear(); @@ -759,15 +765,9 @@ void Database::SetAccountAmount(int accountId, int month, int year, double amoun QString req; QSqlQuery query(_db); - req = QString("UPDATE account_amount SET amount='%1' WHERE account='%2' AND month='%3' AND year='%4'"). - arg(DoubleToString(amount), QString::number(accountId), QString::number(month), QString::number(year)); - - if (!query.exec(req)) - { - req = "INSERT INTO account_amount ('account', 'year', 'month', 'amount') VALUES ('%1', '%2', '%3', '%4')" ; - req = req.arg(QString::number(accountId), QString::number(year), QString::number(month), DoubleToString(amount)); - EXECUTE_SQL_UPDATE(req, ); - } + req = "INSERT or REPLACE INTO account_amount ('account', 'year', 'month', 'amount') VALUES ('%1', '%2', '%3', '%4')" ; + req = req.arg(QString::number(accountId), QString::number(year), QString::number(month), DoubleToString(amount)); + EXECUTE_SQL_UPDATE(req, ); } int Database::AddAccount(User* user, Account& ac) @@ -936,18 +936,30 @@ int Database::AddCategory(User* user, Category& category) void Database::UpdateCategory(Category& category) { - QString req; + QString req, tmp; QString backcolor, forecolor; backcolor = "#" ; - backcolor += QString::number(category.backcolor.red(), 16); - backcolor += QString::number(category.backcolor.green(), 16); - backcolor += QString::number(category.backcolor.blue(), 16); + tmp = QString::number(category.backcolor.red(), 16); + if (tmp.length() == 1) tmp = "0" + tmp; + backcolor += tmp; + tmp = QString::number(category.backcolor.green(), 16); + if (tmp.length() == 1) tmp = "0" + tmp; + backcolor += tmp; + tmp = QString::number(category.backcolor.blue(), 16); + if (tmp.length() == 1) tmp = "0" + tmp; + backcolor += tmp; forecolor = "#" ; - forecolor += QString::number(category.forecolor.red(), 16); - forecolor += QString::number(category.forecolor.green(), 16); - forecolor += QString::number(category.forecolor.blue(), 16); + tmp = QString::number(category.forecolor.red(), 16); + if (tmp.length() == 1) tmp = "0" + tmp; + forecolor += tmp; + tmp = QString::number(category.forecolor.green(), 16); + if (tmp.length() == 1) tmp = "0" + tmp; + forecolor += tmp; + tmp = QString::number(category.forecolor.blue(), 16); + if (tmp.length() == 1) tmp = "0" + tmp; + forecolor += tmp; req = "UPDATE category SET" ; req += " parent='" + QString::number(category.parent) + "'"; @@ -1104,20 +1116,6 @@ void Database::GenerateMonth(User* user, int monthFrom, int yearFrom, int monthT double amount; QSqlQuery query(_db); - if (monthFrom == -1 || yearFrom == -1) - { - for (it = user->_accounts.begin(); it != user->_accounts.end(); it++) - { - req = "INSERT INTO account_amount ('account', 'year', 'month', 'amount') VALUES " ; - req += "('%1', '%2', '%3', '%4')"; - req = req.arg(QString::number(it->id), QString::number(yearTo), - QString::number(monthTo), "0.0"); - EXECUTE_SQL_UPDATE(req, ); - } - - return; - } - for (it = user->_accounts.begin(); it != user->_accounts.end(); it++) { amount = 0.0; @@ -1249,14 +1247,9 @@ void Database::UpdatePreference(User* user, const QString& preference) QString value = user->_preferences[preference]; QSqlQuery query(_db); - req = QString("UPDATE preference SET name='%1', value='%2' WHERE user='%3'").arg(preference, value, QString::number(user->_id)) ; - - if (!query.exec(req)) - { - req = "INSERT INTO preference ('user', 'name', 'value') VALUES ('%1', '%2', '%3')" ; - req = req.arg(QString::number(user->_id), preference, value); - EXECUTE_SQL_UPDATE(req, ); - } + req = "INSERT or REPLACE INTO preference ('user', 'name', 'value') VALUES ('%1', '%2', '%3')" ; + req = req.arg(QString::number(user->_id), preference, value); + EXECUTE_SQL_UPDATE(req, ); } std::vector* Database::Search(User* user, QString* description, QDate* dateFrom, QDate* dateTo, @@ -1714,16 +1707,10 @@ void Database::UpdateImportPattern(User* user) key = ImportEngine::RemoveUnused(it->first); - req = "UPDATE import_pattern SET pattern='%1', account='%2', category='%3' WHERE description='%4'" ; - req = req.arg(it->second.pattern, QString::number(it->second.account), QString::number(it->second.category), key); - - if (!query.exec(req)) - { - req = "INSERT INTO import_pattern ('user', 'description', 'pattern', 'account', 'category') VALUES " ; - req += "('%1', '%2', '%3', '%4', '%5')"; - req = req.arg(QString::number(user->_id), key, it->second.pattern, QString::number(it->second.account), QString::number(it->second.category)); - EXECUTE_SQL_UPDATE(req, ); - } + req = "INSERT or REPLACE INTO import_pattern ('user', 'description', 'pattern', 'account', 'category') VALUES " ; + req += "('%1', '%2', '%3', '%4', '%5')"; + req = req.arg(QString::number(user->_id), key, it->second.pattern, QString::number(it->second.account), QString::number(it->second.category)); + EXECUTE_SQL_UPDATE(req, ); } } diff --git a/src/model/Database.hpp b/src/model/Database.hpp index 3ce8bc8..5f10cb8 100644 --- a/src/model/Database.hpp +++ b/src/model/Database.hpp @@ -109,7 +109,7 @@ public: double MetaAmount(int id); double MetaPositiveAmount(int id); - double GetAccountAmount(int id, int month, int year); + double GetAccountAmount(int id, int month, int year, bool* had_value=NULL); void SetAccountAmount(int accountId, int month, int year, double amount); double CalcAccountAmount(int id, int month, int year, bool* had_values);