Changeset View
Changeset View
Standalone View
Standalone View
kmymoney/mymoney/mymoneyfile.cpp
Show First 20 Lines • Show All 336 Lines • ▼ Show 20 Line(s) | |||||
337 | } | 337 | } | ||
338 | 338 | | |||
339 | MyMoneyFile::MyMoneyFile(IMyMoneyStorage *storage) : | 339 | MyMoneyFile::MyMoneyFile(IMyMoneyStorage *storage) : | ||
340 | d(new Private) | 340 | d(new Private) | ||
341 | { | 341 | { | ||
342 | attachStorage(storage); | 342 | attachStorage(storage); | ||
343 | } | 343 | } | ||
344 | 344 | | |||
345 | MyMoneyFile* MyMoneyFile::instance() | ||||
346 | { | ||||
347 | return &file; | ||||
348 | } | ||||
349 | | ||||
345 | void MyMoneyFile::attachStorage(IMyMoneyStorage* const storage) | 350 | void MyMoneyFile::attachStorage(IMyMoneyStorage* const storage) | ||
346 | { | 351 | { | ||
347 | if (d->m_storage != 0) | 352 | if (d->m_storage != 0) | ||
348 | throw MYMONEYEXCEPTION("Storage already attached"); | 353 | throw MYMONEYEXCEPTION("Storage already attached"); | ||
349 | 354 | | |||
350 | if (storage == 0) | 355 | if (storage == 0) | ||
351 | throw MYMONEYEXCEPTION("Storage must not be 0"); | 356 | throw MYMONEYEXCEPTION("Storage must not be 0"); | ||
352 | 357 | | |||
▲ Show 20 Lines • Show All 101 Lines • ▼ Show 20 Line(s) | 411 | { | |||
454 | 459 | | |||
455 | // now send out the balanceChanged signal for all those | 460 | // now send out the balanceChanged signal for all those | ||
456 | // accounts for which we have an indication about a possible | 461 | // accounts for which we have an indication about a possible | ||
457 | // change. | 462 | // change. | ||
458 | foreach (const QString& id, d->m_balanceChangedSet) { | 463 | foreach (const QString& id, d->m_balanceChangedSet) { | ||
459 | // if we notify about balance change we don't need to notify about value change | 464 | // if we notify about balance change we don't need to notify about value change | ||
460 | // for the same account since a balance change implies a value change | 465 | // for the same account since a balance change implies a value change | ||
461 | d->m_valueChangedSet.remove(id); | 466 | d->m_valueChangedSet.remove(id); | ||
462 | const MyMoneyAccount& acc = d->m_cache.account(id); | 467 | const auto acc = d->m_cache.account(id); | ||
463 | emit balanceChanged(acc); | 468 | emit balanceChanged(acc); | ||
464 | } | 469 | } | ||
465 | d->m_balanceChangedSet.clear(); | 470 | d->m_balanceChangedSet.clear(); | ||
466 | 471 | | |||
467 | // now notify about the remaining value changes | 472 | // now notify about the remaining value changes | ||
468 | foreach (const QString& id, d->m_valueChangedSet) { | 473 | foreach (const QString& id, d->m_valueChangedSet) { | ||
469 | const MyMoneyAccount& acc = d->m_cache.account(id); | 474 | const auto acc = d->m_cache.account(id); | ||
470 | emit valueChanged(acc); | 475 | emit valueChanged(acc); | ||
471 | } | 476 | } | ||
472 | d->m_valueChangedSet.clear(); | 477 | d->m_valueChangedSet.clear(); | ||
473 | 478 | | |||
474 | // as a last action, send out the global dataChanged signal | 479 | // as a last action, send out the global dataChanged signal | ||
475 | if (changed) { | 480 | if (changed) { | ||
476 | emit dataChanged(); | 481 | emit dataChanged(); | ||
477 | } | 482 | } | ||
▲ Show 20 Lines • Show All 58 Lines • ▼ Show 20 Line(s) | 538 | { | |||
536 | MyMoneyTransaction tCopy(transaction); | 541 | MyMoneyTransaction tCopy(transaction); | ||
537 | 542 | | |||
538 | // now check the splits | 543 | // now check the splits | ||
539 | bool loanAccountAffected = false; | 544 | bool loanAccountAffected = false; | ||
540 | QList<MyMoneySplit>::ConstIterator it_s; | 545 | QList<MyMoneySplit>::ConstIterator it_s; | ||
541 | for (it_s = transaction.splits().constBegin(); it_s != transaction.splits().constEnd(); ++it_s) { | 546 | for (it_s = transaction.splits().constBegin(); it_s != transaction.splits().constEnd(); ++it_s) { | ||
542 | // the following line will throw an exception if the | 547 | // the following line will throw an exception if the | ||
543 | // account does not exist | 548 | // account does not exist | ||
544 | MyMoneyAccount acc = MyMoneyFile::account((*it_s).accountId()); | 549 | auto acc = MyMoneyFile::account((*it_s).accountId()); | ||
545 | if (acc.id().isEmpty()) | 550 | if (acc.id().isEmpty()) | ||
546 | throw MYMONEYEXCEPTION("Cannot store split with no account assigned"); | 551 | throw MYMONEYEXCEPTION("Cannot store split with no account assigned"); | ||
547 | if (isStandardAccount((*it_s).accountId())) | 552 | if (isStandardAccount((*it_s).accountId())) | ||
548 | throw MYMONEYEXCEPTION("Cannot store split referencing standard account"); | 553 | throw MYMONEYEXCEPTION("Cannot store split referencing standard account"); | ||
549 | if (acc.isLoan() && ((*it_s).action() == MyMoneySplit::ActionTransfer)) | 554 | if (acc.isLoan() && ((*it_s).action() == MyMoneySplit::ActionTransfer)) | ||
550 | loanAccountAffected = true; | 555 | loanAccountAffected = true; | ||
551 | } | 556 | } | ||
552 | 557 | | |||
553 | // change transfer splits between asset/liability and loan accounts | 558 | // change transfer splits between asset/liability and loan accounts | ||
554 | // into amortization splits | 559 | // into amortization splits | ||
555 | if (loanAccountAffected) { | 560 | if (loanAccountAffected) { | ||
556 | QList<MyMoneySplit> list = transaction.splits(); | 561 | QList<MyMoneySplit> list = transaction.splits(); | ||
557 | for (it_s = list.constBegin(); it_s != list.constEnd(); ++it_s) { | 562 | for (it_s = list.constBegin(); it_s != list.constEnd(); ++it_s) { | ||
558 | if ((*it_s).action() == MyMoneySplit::ActionTransfer) { | 563 | if ((*it_s).action() == MyMoneySplit::ActionTransfer) { | ||
559 | MyMoneyAccount acc = MyMoneyFile::account((*it_s).accountId()); | 564 | auto acc = MyMoneyFile::account((*it_s).accountId()); | ||
560 | 565 | | |||
561 | if (acc.isAssetLiability()) { | 566 | if (acc.isAssetLiability()) { | ||
562 | MyMoneySplit s = (*it_s); | 567 | MyMoneySplit s = (*it_s); | ||
563 | s.setAction(MyMoneySplit::ActionAmortization); | 568 | s.setAction(MyMoneySplit::ActionAmortization); | ||
564 | tCopy.modifySplit(s); | 569 | tCopy.modifySplit(s); | ||
565 | } | 570 | } | ||
566 | } | 571 | } | ||
567 | } | 572 | } | ||
Show All 30 Lines | |||||
598 | } | 603 | } | ||
599 | 604 | | |||
600 | void MyMoneyFile::modifyAccount(const MyMoneyAccount& _account) | 605 | void MyMoneyFile::modifyAccount(const MyMoneyAccount& _account) | ||
601 | { | 606 | { | ||
602 | d->checkTransaction(Q_FUNC_INFO); | 607 | d->checkTransaction(Q_FUNC_INFO); | ||
603 | 608 | | |||
604 | MyMoneyAccount account(_account); | 609 | MyMoneyAccount account(_account); | ||
605 | 610 | | |||
606 | MyMoneyAccount acc = MyMoneyFile::account(account.id()); | 611 | auto acc = MyMoneyFile::account(account.id()); | ||
607 | 612 | | |||
608 | // check that for standard accounts only specific parameters are changed | 613 | // check that for standard accounts only specific parameters are changed | ||
609 | if (isStandardAccount(account.id())) { | 614 | if (isStandardAccount(account.id())) { | ||
610 | // make sure to use the stuff we found on file | 615 | // make sure to use the stuff we found on file | ||
611 | account = acc; | 616 | account = acc; | ||
612 | 617 | | |||
613 | // and only use the changes that are allowed | 618 | // and only use the changes that are allowed | ||
614 | account.setName(_account.name()); | 619 | account.setName(_account.name()); | ||
▲ Show 20 Lines • Show All 72 Lines • ▼ Show 20 Line(s) | 668 | if (acc.accountGroup() == parent.accountGroup() | |||
687 | d->m_changeSet += MyMoneyNotification(File::Mode::Modify, curParent); | 692 | d->m_changeSet += MyMoneyNotification(File::Mode::Modify, curParent); | ||
688 | d->m_changeSet += MyMoneyNotification(File::Mode::Modify, parent); | 693 | d->m_changeSet += MyMoneyNotification(File::Mode::Modify, parent); | ||
689 | d->m_changeSet += MyMoneyNotification(File::Mode::Modify, acc); | 694 | d->m_changeSet += MyMoneyNotification(File::Mode::Modify, acc); | ||
690 | 695 | | |||
691 | } else | 696 | } else | ||
692 | throw MYMONEYEXCEPTION("Unable to reparent to different account type"); | 697 | throw MYMONEYEXCEPTION("Unable to reparent to different account type"); | ||
693 | } | 698 | } | ||
694 | 699 | | |||
695 | const MyMoneyInstitution& MyMoneyFile::institution(const QString& id) const | 700 | MyMoneyInstitution MyMoneyFile::institution(const QString& id) const | ||
696 | { | 701 | { | ||
697 | return d->m_cache.institution(id); | 702 | return d->m_cache.institution(id); | ||
698 | } | 703 | } | ||
699 | 704 | | |||
700 | const MyMoneyAccount& MyMoneyFile::account(const QString& id) const | 705 | MyMoneyAccount MyMoneyFile::account(const QString& id) const | ||
701 | { | 706 | { | ||
702 | return d->m_cache.account(id); | 707 | return d->m_cache.account(id); | ||
703 | } | 708 | } | ||
704 | 709 | | |||
705 | const MyMoneyAccount& MyMoneyFile::subAccountByName(const MyMoneyAccount& acc, const QString& name) const | 710 | MyMoneyAccount MyMoneyFile::subAccountByName(const MyMoneyAccount& acc, const QString& name) const | ||
706 | { | 711 | { | ||
707 | static MyMoneyAccount nullAccount; | 712 | static MyMoneyAccount nullAccount; | ||
708 | 713 | | |||
709 | QList<QString>::const_iterator it_a; | 714 | QList<QString>::const_iterator it_a; | ||
710 | for (it_a = acc.accountList().constBegin(); it_a != acc.accountList().constEnd(); ++it_a) { | 715 | for (it_a = acc.accountList().constBegin(); it_a != acc.accountList().constEnd(); ++it_a) { | ||
711 | const MyMoneyAccount& sacc = account(*it_a); | 716 | const auto sacc = account(*it_a); | ||
712 | if (sacc.name() == name) | 717 | if (sacc.name() == name) | ||
713 | return sacc; | 718 | return sacc; | ||
714 | } | 719 | } | ||
715 | return nullAccount; | 720 | return nullAccount; | ||
716 | } | 721 | } | ||
717 | 722 | | |||
718 | const MyMoneyAccount& MyMoneyFile::accountByName(const QString& name) const | 723 | MyMoneyAccount MyMoneyFile::accountByName(const QString& name) const | ||
719 | { | 724 | { | ||
720 | return d->m_cache.accountByName(name); | 725 | return d->m_cache.accountByName(name); | ||
721 | } | 726 | } | ||
722 | 727 | | |||
723 | void MyMoneyFile::removeTransaction(const MyMoneyTransaction& transaction) | 728 | void MyMoneyFile::removeTransaction(const MyMoneyTransaction& transaction) | ||
724 | { | 729 | { | ||
725 | d->checkTransaction(Q_FUNC_INFO); | 730 | d->checkTransaction(Q_FUNC_INFO); | ||
726 | 731 | | |||
727 | // clear all changed objects from cache | 732 | // clear all changed objects from cache | ||
728 | MyMoneyNotifier notifier(d); | 733 | MyMoneyNotifier notifier(d); | ||
729 | 734 | | |||
730 | // get the engine's idea about this transaction | 735 | // get the engine's idea about this transaction | ||
731 | MyMoneyTransaction tr = MyMoneyFile::transaction(transaction.id()); | 736 | MyMoneyTransaction tr = MyMoneyFile::transaction(transaction.id()); | ||
732 | QList<MyMoneySplit>::ConstIterator it_s; | 737 | QList<MyMoneySplit>::ConstIterator it_s; | ||
733 | 738 | | |||
734 | // scan the splits again to update notification list | 739 | // scan the splits again to update notification list | ||
735 | for (it_s = tr.splits().constBegin(); it_s != tr.splits().constEnd(); ++it_s) { | 740 | for (it_s = tr.splits().constBegin(); it_s != tr.splits().constEnd(); ++it_s) { | ||
736 | MyMoneyAccount acc = account((*it_s).accountId()); | 741 | auto acc = account((*it_s).accountId()); | ||
737 | if (acc.isClosed()) | 742 | if (acc.isClosed()) | ||
738 | throw MYMONEYEXCEPTION(i18n("Cannot remove transaction that references a closed account.")); | 743 | throw MYMONEYEXCEPTION(i18n("Cannot remove transaction that references a closed account.")); | ||
739 | d->addCacheNotification((*it_s).accountId(), tr.postDate()); | 744 | d->addCacheNotification((*it_s).accountId(), tr.postDate()); | ||
740 | d->addCacheNotification((*it_s).payeeId()); | 745 | d->addCacheNotification((*it_s).payeeId()); | ||
741 | //FIXME-ALEX Do I need to add d->addCacheNotification((*it_s).tagList()); ?? | 746 | //FIXME-ALEX Do I need to add d->addCacheNotification((*it_s).tagList()); ?? | ||
742 | } | 747 | } | ||
743 | 748 | | |||
744 | d->m_storage->removeTransaction(transaction); | 749 | d->m_storage->removeTransaction(transaction); | ||
Show All 27 Lines | |||||
772 | } | 777 | } | ||
773 | 778 | | |||
774 | void MyMoneyFile::setAccountName(const QString& id, const QString& name) const | 779 | void MyMoneyFile::setAccountName(const QString& id, const QString& name) const | ||
775 | { | 780 | { | ||
776 | d->checkTransaction(Q_FUNC_INFO); | 781 | d->checkTransaction(Q_FUNC_INFO); | ||
777 | 782 | | |||
778 | MyMoneyNotifier notifier(d); | 783 | MyMoneyNotifier notifier(d); | ||
779 | 784 | | |||
780 | MyMoneyAccount acc = account(id); | 785 | auto acc = account(id); | ||
781 | d->m_storage->setAccountName(id, name); | 786 | d->m_storage->setAccountName(id, name); | ||
782 | d->addCacheNotification(id); | 787 | d->addCacheNotification(id); | ||
783 | 788 | | |||
784 | d->m_changeSet += MyMoneyNotification(File::Mode::Modify, acc); | 789 | d->m_changeSet += MyMoneyNotification(File::Mode::Modify, acc); | ||
785 | } | 790 | } | ||
786 | 791 | | |||
787 | void MyMoneyFile::removeAccount(const MyMoneyAccount& account) | 792 | void MyMoneyFile::removeAccount(const MyMoneyAccount& account) | ||
788 | { | 793 | { | ||
Show All 19 Lines | |||||
808 | } | 813 | } | ||
809 | 814 | | |||
810 | // clear all changed objects from cache | 815 | // clear all changed objects from cache | ||
811 | MyMoneyNotifier notifier(d); | 816 | MyMoneyNotifier notifier(d); | ||
812 | 817 | | |||
813 | // collect all sub-ordinate accounts for notification | 818 | // collect all sub-ordinate accounts for notification | ||
814 | foreach (const QString& id, acc.accountList()) { | 819 | foreach (const QString& id, acc.accountList()) { | ||
815 | d->addCacheNotification(id); | 820 | d->addCacheNotification(id); | ||
816 | const MyMoneyAccount& acc = MyMoneyFile::account(id); | 821 | const auto acc = MyMoneyFile::account(id); | ||
817 | d->m_changeSet += MyMoneyNotification(File::Mode::Modify, acc); | 822 | d->m_changeSet += MyMoneyNotification(File::Mode::Modify, acc); | ||
818 | } | 823 | } | ||
819 | // don't forget the parent and a possible institution | 824 | // don't forget the parent and a possible institution | ||
820 | d->addCacheNotification(parent.id()); | 825 | d->addCacheNotification(parent.id()); | ||
821 | d->addCacheNotification(account.institutionId()); | 826 | d->addCacheNotification(account.institutionId()); | ||
822 | 827 | | |||
823 | if (!institution.id().isEmpty()) { | 828 | if (!institution.id().isEmpty()) { | ||
824 | institution.removeAccountId(account.id()); | 829 | institution.removeAccountId(account.id()); | ||
▲ Show 20 Lines • Show All 70 Lines • ▼ Show 20 Line(s) | 896 | { | |||
895 | MyMoneyNotifier notifier(d); | 900 | MyMoneyNotifier notifier(d); | ||
896 | 901 | | |||
897 | QList<QString>::ConstIterator it_a; | 902 | QList<QString>::ConstIterator it_a; | ||
898 | MyMoneyInstitution inst = MyMoneyFile::institution(institution.id()); | 903 | MyMoneyInstitution inst = MyMoneyFile::institution(institution.id()); | ||
899 | 904 | | |||
900 | bool blocked = signalsBlocked(); | 905 | bool blocked = signalsBlocked(); | ||
901 | blockSignals(true); | 906 | blockSignals(true); | ||
902 | for (it_a = inst.accountList().constBegin(); it_a != inst.accountList().constEnd(); ++it_a) { | 907 | for (it_a = inst.accountList().constBegin(); it_a != inst.accountList().constEnd(); ++it_a) { | ||
903 | MyMoneyAccount acc = account(*it_a); | 908 | auto acc = account(*it_a); | ||
904 | acc.setInstitutionId(QString()); | 909 | acc.setInstitutionId(QString()); | ||
905 | modifyAccount(acc); | 910 | modifyAccount(acc); | ||
906 | d->m_changeSet += MyMoneyNotification(File::Mode::Modify, acc); | 911 | d->m_changeSet += MyMoneyNotification(File::Mode::Modify, acc); | ||
907 | } | 912 | } | ||
908 | blockSignals(blocked); | 913 | blockSignals(blocked); | ||
909 | 914 | | |||
910 | d->m_storage->removeInstitution(institution); | 915 | d->m_storage->removeInstitution(institution); | ||
911 | 916 | | |||
▲ Show 20 Lines • Show All 105 Lines • ▼ Show 20 Line(s) | 1021 | if (!account.parentAccountId().isEmpty()) | |||
1017 | throw MYMONEYEXCEPTION("New account must have no parent-id"); | 1022 | throw MYMONEYEXCEPTION("New account must have no parent-id"); | ||
1018 | 1023 | | |||
1019 | if (account.accountType() == Account::Type::Unknown) | 1024 | if (account.accountType() == Account::Type::Unknown) | ||
1020 | throw MYMONEYEXCEPTION("Account has invalid type"); | 1025 | throw MYMONEYEXCEPTION("Account has invalid type"); | ||
1021 | 1026 | | |||
1022 | // make sure, that the parent account exists | 1027 | // make sure, that the parent account exists | ||
1023 | // if not, an exception is thrown. If it exists, | 1028 | // if not, an exception is thrown. If it exists, | ||
1024 | // get a copy of the current data | 1029 | // get a copy of the current data | ||
1025 | MyMoneyAccount acc = MyMoneyFile::account(parent.id()); | 1030 | auto acc = MyMoneyFile::account(parent.id()); | ||
1026 | 1031 | | |||
1027 | #if 0 | 1032 | #if 0 | ||
1028 | // TODO: remove the following code as we now can have multiple accounts | 1033 | // TODO: remove the following code as we now can have multiple accounts | ||
1029 | // with the same name even in the same hierarchy position of the account tree | 1034 | // with the same name even in the same hierarchy position of the account tree | ||
1030 | // | 1035 | // | ||
1031 | // check if the selected name is currently not among the child accounts | 1036 | // check if the selected name is currently not among the child accounts | ||
1032 | // if we find one, then return it as the new account | 1037 | // if we find one, then return it as the new account | ||
1033 | QStringList::const_iterator it_a; | 1038 | QStringList::const_iterator it_a; | ||
▲ Show 20 Lines • Show All 141 Lines • ▼ Show 20 Line(s) | 1179 | } catch (const MyMoneyException &) { | |||
1175 | // If not, keep searching | 1180 | // If not, keep searching | ||
1176 | ++it_t; | 1181 | ++it_t; | ||
1177 | } | 1182 | } | ||
1178 | } | 1183 | } | ||
1179 | 1184 | | |||
1180 | return result; | 1185 | return result; | ||
1181 | } | 1186 | } | ||
1182 | 1187 | | |||
1183 | const MyMoneyAccount MyMoneyFile::openingBalanceAccount(const MyMoneySecurity& security) | 1188 | MyMoneyAccount MyMoneyFile::openingBalanceAccount(const MyMoneySecurity& security) | ||
1184 | { | 1189 | { | ||
1185 | if (!security.isCurrency()) | 1190 | if (!security.isCurrency()) | ||
1186 | throw MYMONEYEXCEPTION("Opening balance for non currencies not supported"); | 1191 | throw MYMONEYEXCEPTION("Opening balance for non currencies not supported"); | ||
1187 | 1192 | | |||
1188 | try { | 1193 | try { | ||
1189 | return openingBalanceAccount_internal(security); | 1194 | return openingBalanceAccount_internal(security); | ||
1190 | } catch (const MyMoneyException &) { | 1195 | } catch (const MyMoneyException &) { | ||
1191 | MyMoneyFileTransaction ft; | 1196 | MyMoneyFileTransaction ft; | ||
1192 | MyMoneyAccount acc; | 1197 | MyMoneyAccount acc; | ||
1193 | 1198 | | |||
1194 | try { | 1199 | try { | ||
1195 | acc = createOpeningBalanceAccount(security); | 1200 | acc = createOpeningBalanceAccount(security); | ||
1196 | ft.commit(); | 1201 | ft.commit(); | ||
1197 | 1202 | | |||
1198 | } catch (const MyMoneyException &) { | 1203 | } catch (const MyMoneyException &) { | ||
1199 | qDebug("Unable to create opening balance account for security %s", qPrintable(security.id())); | 1204 | qDebug("Unable to create opening balance account for security %s", qPrintable(security.id())); | ||
1200 | } | 1205 | } | ||
1201 | return acc; | 1206 | return acc; | ||
1202 | } | 1207 | } | ||
1203 | } | 1208 | } | ||
1204 | 1209 | | |||
1205 | const MyMoneyAccount MyMoneyFile::openingBalanceAccount(const MyMoneySecurity& security) const | 1210 | MyMoneyAccount MyMoneyFile::openingBalanceAccount(const MyMoneySecurity& security) const | ||
1206 | { | 1211 | { | ||
1207 | return openingBalanceAccount_internal(security); | 1212 | return openingBalanceAccount_internal(security); | ||
1208 | } | 1213 | } | ||
1209 | 1214 | | |||
1210 | const MyMoneyAccount MyMoneyFile::openingBalanceAccount_internal(const MyMoneySecurity& security) const | 1215 | MyMoneyAccount MyMoneyFile::openingBalanceAccount_internal(const MyMoneySecurity& security) const | ||
1211 | { | 1216 | { | ||
1212 | if (!security.isCurrency()) | 1217 | if (!security.isCurrency()) | ||
1213 | throw MYMONEYEXCEPTION("Opening balance for non currencies not supported"); | 1218 | throw MYMONEYEXCEPTION("Opening balance for non currencies not supported"); | ||
1214 | 1219 | | |||
1215 | MyMoneyAccount acc; | 1220 | MyMoneyAccount acc; | ||
1216 | QList<MyMoneyAccount> accounts; | 1221 | QList<MyMoneyAccount> accounts; | ||
1217 | QList<MyMoneyAccount>::ConstIterator it; | 1222 | QList<MyMoneyAccount>::ConstIterator it; | ||
1218 | 1223 | | |||
Show All 19 Lines | |||||
1238 | 1243 | | |||
1239 | if (acc.id().isEmpty()) { | 1244 | if (acc.id().isEmpty()) { | ||
1240 | throw MYMONEYEXCEPTION(QString("No opening balance account for %1").arg(security.tradingSymbol())); | 1245 | throw MYMONEYEXCEPTION(QString("No opening balance account for %1").arg(security.tradingSymbol())); | ||
1241 | } | 1246 | } | ||
1242 | 1247 | | |||
1243 | return acc; | 1248 | return acc; | ||
1244 | } | 1249 | } | ||
1245 | 1250 | | |||
1246 | const MyMoneyAccount MyMoneyFile::createOpeningBalanceAccount(const MyMoneySecurity& security) | 1251 | MyMoneyAccount MyMoneyFile::createOpeningBalanceAccount(const MyMoneySecurity& security) | ||
1247 | { | 1252 | { | ||
1248 | d->checkTransaction(Q_FUNC_INFO); | 1253 | d->checkTransaction(Q_FUNC_INFO); | ||
1249 | 1254 | | |||
1250 | MyMoneyAccount acc; | 1255 | MyMoneyAccount acc; | ||
1251 | QList<MyMoneyAccount> accounts; | 1256 | QList<MyMoneyAccount> accounts; | ||
1252 | QList<MyMoneyAccount>::ConstIterator it; | 1257 | QList<MyMoneyAccount>::ConstIterator it; | ||
1253 | 1258 | | |||
1254 | accountList(accounts, equity().accountList(), true); | 1259 | accountList(accounts, equity().accountList(), true); | ||
▲ Show 20 Lines • Show All 47 Lines • ▼ Show 20 Line(s) | 1306 | if (!transaction.postDate().isValid()) | |||
1302 | throw MYMONEYEXCEPTION("Unable to add transaction with invalid postdate"); | 1307 | throw MYMONEYEXCEPTION("Unable to add transaction with invalid postdate"); | ||
1303 | 1308 | | |||
1304 | // now check the splits | 1309 | // now check the splits | ||
1305 | bool loanAccountAffected = false; | 1310 | bool loanAccountAffected = false; | ||
1306 | QList<MyMoneySplit>::ConstIterator it_s; | 1311 | QList<MyMoneySplit>::ConstIterator it_s; | ||
1307 | for (it_s = transaction.splits().constBegin(); it_s != transaction.splits().constEnd(); ++it_s) { | 1312 | for (it_s = transaction.splits().constBegin(); it_s != transaction.splits().constEnd(); ++it_s) { | ||
1308 | // the following line will throw an exception if the | 1313 | // the following line will throw an exception if the | ||
1309 | // account does not exist or is one of the standard accounts | 1314 | // account does not exist or is one of the standard accounts | ||
1310 | MyMoneyAccount acc = MyMoneyFile::account((*it_s).accountId()); | 1315 | auto acc = MyMoneyFile::account((*it_s).accountId()); | ||
1311 | if (acc.id().isEmpty()) | 1316 | if (acc.id().isEmpty()) | ||
1312 | throw MYMONEYEXCEPTION("Cannot add split with no account assigned"); | 1317 | throw MYMONEYEXCEPTION("Cannot add split with no account assigned"); | ||
1313 | if (acc.isLoan()) | 1318 | if (acc.isLoan()) | ||
1314 | loanAccountAffected = true; | 1319 | loanAccountAffected = true; | ||
1315 | if (isStandardAccount((*it_s).accountId())) | 1320 | if (isStandardAccount((*it_s).accountId())) | ||
1316 | throw MYMONEYEXCEPTION("Cannot add split referencing standard account"); | 1321 | throw MYMONEYEXCEPTION("Cannot add split referencing standard account"); | ||
1317 | } | 1322 | } | ||
1318 | 1323 | | |||
1319 | // change transfer splits between asset/liability and loan accounts | 1324 | // change transfer splits between asset/liability and loan accounts | ||
1320 | // into amortization splits | 1325 | // into amortization splits | ||
1321 | if (loanAccountAffected) { | 1326 | if (loanAccountAffected) { | ||
1322 | QList<MyMoneySplit> list = transaction.splits(); | 1327 | QList<MyMoneySplit> list = transaction.splits(); | ||
1323 | for (it_s = list.constBegin(); it_s != list.constEnd(); ++it_s) { | 1328 | for (it_s = list.constBegin(); it_s != list.constEnd(); ++it_s) { | ||
1324 | if ((*it_s).action() == MyMoneySplit::ActionTransfer) { | 1329 | if ((*it_s).action() == MyMoneySplit::ActionTransfer) { | ||
1325 | MyMoneyAccount acc = MyMoneyFile::account((*it_s).accountId()); | 1330 | auto acc = MyMoneyFile::account((*it_s).accountId()); | ||
1326 | 1331 | | |||
1327 | if (acc.isAssetLiability()) { | 1332 | if (acc.isAssetLiability()) { | ||
1328 | MyMoneySplit s = (*it_s); | 1333 | MyMoneySplit s = (*it_s); | ||
1329 | s.setAction(MyMoneySplit::ActionAmortization); | 1334 | s.setAction(MyMoneySplit::ActionAmortization); | ||
1330 | transaction.modifySplit(s); | 1335 | transaction.modifySplit(s); | ||
1331 | } | 1336 | } | ||
1332 | } | 1337 | } | ||
1333 | } | 1338 | } | ||
Show All 15 Lines | 1353 | for (it_s = transaction.splits().constBegin(); it_s != transaction.splits().constEnd(); ++it_s) { | |||
1349 | d->addCacheNotification((*it_s).accountId(), transaction.postDate()); | 1354 | d->addCacheNotification((*it_s).accountId(), transaction.postDate()); | ||
1350 | d->addCacheNotification((*it_s).payeeId()); | 1355 | d->addCacheNotification((*it_s).payeeId()); | ||
1351 | //FIXME-ALEX Do I need to add d->addCacheNotification((*it_s).tagList()); ?? | 1356 | //FIXME-ALEX Do I need to add d->addCacheNotification((*it_s).tagList()); ?? | ||
1352 | } | 1357 | } | ||
1353 | 1358 | | |||
1354 | d->m_changeSet += MyMoneyNotification(File::Mode::Add, transaction); | 1359 | d->m_changeSet += MyMoneyNotification(File::Mode::Add, transaction); | ||
1355 | } | 1360 | } | ||
1356 | 1361 | | |||
1357 | const MyMoneyTransaction MyMoneyFile::transaction(const QString& id) const | 1362 | MyMoneyTransaction MyMoneyFile::transaction(const QString& id) const | ||
1358 | { | 1363 | { | ||
1359 | d->checkStorage(); | 1364 | d->checkStorage(); | ||
1360 | 1365 | | |||
1361 | return d->m_storage->transaction(id); | 1366 | return d->m_storage->transaction(id); | ||
1362 | } | 1367 | } | ||
1363 | 1368 | | |||
1364 | const MyMoneyTransaction MyMoneyFile::transaction(const QString& account, const int idx) const | 1369 | MyMoneyTransaction MyMoneyFile::transaction(const QString& account, const int idx) const | ||
1365 | { | 1370 | { | ||
1366 | d->checkStorage(); | 1371 | d->checkStorage(); | ||
1367 | 1372 | | |||
1368 | return d->m_storage->transaction(account, idx); | 1373 | return d->m_storage->transaction(account, idx); | ||
1369 | } | 1374 | } | ||
1370 | 1375 | | |||
1371 | void MyMoneyFile::addPayee(MyMoneyPayee& payee) | 1376 | void MyMoneyFile::addPayee(MyMoneyPayee& payee) | ||
1372 | { | 1377 | { | ||
1373 | d->checkTransaction(Q_FUNC_INFO); | 1378 | d->checkTransaction(Q_FUNC_INFO); | ||
1374 | 1379 | | |||
1375 | // clear all changed objects from cache | 1380 | // clear all changed objects from cache | ||
1376 | MyMoneyNotifier notifier(d); | 1381 | MyMoneyNotifier notifier(d); | ||
1377 | 1382 | | |||
1378 | d->m_storage->addPayee(payee); | 1383 | d->m_storage->addPayee(payee); | ||
1379 | 1384 | | |||
1380 | // The notifier mechanism only refreshes the cache but does not | 1385 | // The notifier mechanism only refreshes the cache but does not | ||
1381 | // load new objects. So we simply force loading of the new one here | 1386 | // load new objects. So we simply force loading of the new one here | ||
1382 | d->m_cache.preloadPayee(payee); | 1387 | d->m_cache.preloadPayee(payee); | ||
1383 | 1388 | | |||
1384 | d->m_changeSet += MyMoneyNotification(File::Mode::Add, payee); | 1389 | d->m_changeSet += MyMoneyNotification(File::Mode::Add, payee); | ||
1385 | } | 1390 | } | ||
1386 | 1391 | | |||
1387 | const MyMoneyPayee& MyMoneyFile::payee(const QString& id) const | 1392 | MyMoneyPayee MyMoneyFile::payee(const QString& id) const | ||
1388 | { | 1393 | { | ||
1389 | return d->m_cache.payee(id); | 1394 | return d->m_cache.payee(id); | ||
1390 | } | 1395 | } | ||
1391 | 1396 | | |||
1392 | const MyMoneyPayee& MyMoneyFile::payeeByName(const QString& name) const | 1397 | MyMoneyPayee MyMoneyFile::payeeByName(const QString& name) const | ||
1393 | { | 1398 | { | ||
1394 | d->checkStorage(); | 1399 | d->checkStorage(); | ||
1395 | 1400 | | |||
1396 | return d->m_cache.payee(d->m_storage->payeeByName(name).id()); | 1401 | return d->m_cache.payee(d->m_storage->payeeByName(name).id()); | ||
1397 | } | 1402 | } | ||
1398 | 1403 | | |||
1399 | void MyMoneyFile::modifyPayee(const MyMoneyPayee& payee) | 1404 | void MyMoneyFile::modifyPayee(const MyMoneyPayee& payee) | ||
1400 | { | 1405 | { | ||
Show All 36 Lines | 1435 | { | |||
1437 | 1442 | | |||
1438 | // The notifier mechanism only refreshes the cache but does not | 1443 | // The notifier mechanism only refreshes the cache but does not | ||
1439 | // load new objects. So we simply force loading of the new one here | 1444 | // load new objects. So we simply force loading of the new one here | ||
1440 | d->m_cache.preloadTag(tag); | 1445 | d->m_cache.preloadTag(tag); | ||
1441 | 1446 | | |||
1442 | d->m_changeSet += MyMoneyNotification(File::Mode::Add, tag); | 1447 | d->m_changeSet += MyMoneyNotification(File::Mode::Add, tag); | ||
1443 | } | 1448 | } | ||
1444 | 1449 | | |||
1445 | const MyMoneyTag& MyMoneyFile::tag(const QString& id) const | 1450 | MyMoneyTag MyMoneyFile::tag(const QString& id) const | ||
1446 | { | 1451 | { | ||
1447 | return d->m_cache.tag(id); | 1452 | return d->m_cache.tag(id); | ||
1448 | } | 1453 | } | ||
1449 | 1454 | | |||
1450 | const MyMoneyTag& MyMoneyFile::tagByName(const QString& name) const | 1455 | MyMoneyTag MyMoneyFile::tagByName(const QString& name) const | ||
1451 | { | 1456 | { | ||
1452 | d->checkStorage(); | 1457 | d->checkStorage(); | ||
1453 | 1458 | | |||
1454 | return d->m_cache.tag(d->m_storage->tagByName(name).id()); | 1459 | return d->m_cache.tag(d->m_storage->tagByName(name).id()); | ||
1455 | } | 1460 | } | ||
1456 | 1461 | | |||
1457 | void MyMoneyFile::modifyTag(const MyMoneyTag& tag) | 1462 | void MyMoneyFile::modifyTag(const MyMoneyTag& tag) | ||
1458 | { | 1463 | { | ||
▲ Show 20 Lines • Show All 65 Lines • ▼ Show 20 Line(s) | 1504 | #endif | |||
1524 | } | 1529 | } | ||
1525 | } | 1530 | } | ||
1526 | 1531 | | |||
1527 | void MyMoneyFile::institutionList(QList<MyMoneyInstitution>& list) const | 1532 | void MyMoneyFile::institutionList(QList<MyMoneyInstitution>& list) const | ||
1528 | { | 1533 | { | ||
1529 | d->m_cache.institution(list); | 1534 | d->m_cache.institution(list); | ||
1530 | } | 1535 | } | ||
1531 | 1536 | | |||
1532 | const QList<MyMoneyInstitution> MyMoneyFile::institutionList() const | 1537 | QList<MyMoneyInstitution> MyMoneyFile::institutionList() const | ||
1533 | { | 1538 | { | ||
1534 | QList<MyMoneyInstitution> list; | 1539 | QList<MyMoneyInstitution> list; | ||
1535 | institutionList(list); | 1540 | institutionList(list); | ||
1536 | return list; | 1541 | return list; | ||
1537 | } | 1542 | } | ||
1538 | 1543 | | |||
1539 | // general get functions | 1544 | // general get functions | ||
1540 | const MyMoneyPayee& MyMoneyFile::user() const | 1545 | MyMoneyPayee MyMoneyFile::user() const | ||
1541 | { | 1546 | { | ||
1542 | d->checkStorage(); | 1547 | d->checkStorage(); | ||
1543 | return d->m_storage->user(); | 1548 | return d->m_storage->user(); | ||
1544 | } | 1549 | } | ||
1545 | 1550 | | |||
1546 | // general set functions | 1551 | // general set functions | ||
1547 | void MyMoneyFile::setUser(const MyMoneyPayee& user) | 1552 | void MyMoneyFile::setUser(const MyMoneyPayee& user) | ||
1548 | { | 1553 | { | ||
Show All 30 Lines | |||||
1579 | void MyMoneyFile::ensureDefaultCurrency(MyMoneyAccount& acc) const | 1584 | void MyMoneyFile::ensureDefaultCurrency(MyMoneyAccount& acc) const | ||
1580 | { | 1585 | { | ||
1581 | if (acc.currencyId().isEmpty()) { | 1586 | if (acc.currencyId().isEmpty()) { | ||
1582 | if (!baseCurrency().id().isEmpty()) | 1587 | if (!baseCurrency().id().isEmpty()) | ||
1583 | acc.setCurrencyId(baseCurrency().id()); | 1588 | acc.setCurrencyId(baseCurrency().id()); | ||
1584 | } | 1589 | } | ||
1585 | } | 1590 | } | ||
1586 | 1591 | | |||
1587 | const MyMoneyAccount& MyMoneyFile::liability() const | 1592 | MyMoneyAccount MyMoneyFile::liability() const | ||
1588 | { | 1593 | { | ||
1589 | d->checkStorage(); | 1594 | d->checkStorage(); | ||
1590 | 1595 | | |||
1591 | return d->m_cache.account(STD_ACC_LIABILITY); | 1596 | return d->m_cache.account(STD_ACC_LIABILITY); | ||
1592 | } | 1597 | } | ||
1593 | 1598 | | |||
1594 | const MyMoneyAccount& MyMoneyFile::asset() const | 1599 | MyMoneyAccount MyMoneyFile::asset() const | ||
1595 | { | 1600 | { | ||
1596 | d->checkStorage(); | 1601 | d->checkStorage(); | ||
1597 | 1602 | | |||
1598 | return d->m_cache.account(STD_ACC_ASSET); | 1603 | return d->m_cache.account(STD_ACC_ASSET); | ||
1599 | } | 1604 | } | ||
1600 | 1605 | | |||
1601 | const MyMoneyAccount& MyMoneyFile::expense() const | 1606 | MyMoneyAccount MyMoneyFile::expense() const | ||
1602 | { | 1607 | { | ||
1603 | d->checkStorage(); | 1608 | d->checkStorage(); | ||
1604 | 1609 | | |||
1605 | return d->m_cache.account(STD_ACC_EXPENSE); | 1610 | return d->m_cache.account(STD_ACC_EXPENSE); | ||
1606 | } | 1611 | } | ||
1607 | 1612 | | |||
1608 | const MyMoneyAccount& MyMoneyFile::income() const | 1613 | MyMoneyAccount MyMoneyFile::income() const | ||
1609 | { | 1614 | { | ||
1610 | d->checkStorage(); | 1615 | d->checkStorage(); | ||
1611 | 1616 | | |||
1612 | return d->m_cache.account(STD_ACC_INCOME); | 1617 | return d->m_cache.account(STD_ACC_INCOME); | ||
1613 | } | 1618 | } | ||
1614 | 1619 | | |||
1615 | const MyMoneyAccount& MyMoneyFile::equity() const | 1620 | MyMoneyAccount MyMoneyFile::equity() const | ||
1616 | { | 1621 | { | ||
1617 | d->checkStorage(); | 1622 | d->checkStorage(); | ||
1618 | 1623 | | |||
1619 | return d->m_cache.account(STD_ACC_EQUITY); | 1624 | return d->m_cache.account(STD_ACC_EQUITY); | ||
1620 | } | 1625 | } | ||
1621 | 1626 | | |||
1622 | unsigned int MyMoneyFile::transactionCount(const QString& account) const | 1627 | unsigned int MyMoneyFile::transactionCount(const QString& account) const | ||
1623 | { | 1628 | { | ||
1624 | d->checkStorage(); | 1629 | d->checkStorage(); | ||
1625 | 1630 | | |||
1626 | return d->m_storage->transactionCount(account); | 1631 | return d->m_storage->transactionCount(account); | ||
1627 | } | 1632 | } | ||
1633 | | ||||
1628 | unsigned int MyMoneyFile::transactionCount() const | 1634 | unsigned int MyMoneyFile::transactionCount() const | ||
1629 | { | 1635 | { | ||
1630 | return transactionCount(QString()); | 1636 | return transactionCount(QString()); | ||
1631 | } | 1637 | } | ||
1632 | 1638 | | |||
1633 | const QMap<QString, unsigned long> MyMoneyFile::transactionCountMap() const | 1639 | QMap<QString, unsigned long> MyMoneyFile::transactionCountMap() const | ||
1634 | { | 1640 | { | ||
1635 | d->checkStorage(); | 1641 | d->checkStorage(); | ||
1636 | 1642 | | |||
1637 | return d->m_storage->transactionCountMap(); | 1643 | return d->m_storage->transactionCountMap(); | ||
1638 | } | 1644 | } | ||
1639 | 1645 | | |||
1640 | unsigned int MyMoneyFile::institutionCount() const | 1646 | unsigned int MyMoneyFile::institutionCount() const | ||
1641 | { | 1647 | { | ||
1642 | d->checkStorage(); | 1648 | d->checkStorage(); | ||
1643 | 1649 | | |||
1644 | return d->m_storage->institutionCount(); | 1650 | return d->m_storage->institutionCount(); | ||
1645 | } | 1651 | } | ||
1646 | 1652 | | |||
1647 | const MyMoneyMoney MyMoneyFile::balance(const QString& id, const QDate& date) const | 1653 | MyMoneyMoney MyMoneyFile::balance(const QString& id, const QDate& date) const | ||
1648 | { | 1654 | { | ||
1649 | if (date.isValid()) { | 1655 | if (date.isValid()) { | ||
1650 | MyMoneyBalanceCacheItem bal = d->m_balanceCache.balance(id, date); | 1656 | MyMoneyBalanceCacheItem bal = d->m_balanceCache.balance(id, date); | ||
1651 | if (bal.isValid()) | 1657 | if (bal.isValid()) | ||
1652 | return bal.balance(); | 1658 | return bal.balance(); | ||
1653 | } | 1659 | } | ||
1654 | 1660 | | |||
1655 | d->checkStorage(); | 1661 | d->checkStorage(); | ||
1656 | 1662 | | |||
1657 | MyMoneyMoney returnValue = d->m_storage->balance(id, date); | 1663 | MyMoneyMoney returnValue = d->m_storage->balance(id, date); | ||
1658 | 1664 | | |||
1659 | if (date.isValid()) { | 1665 | if (date.isValid()) { | ||
1660 | d->m_balanceCache.insert(id, date, returnValue); | 1666 | d->m_balanceCache.insert(id, date, returnValue); | ||
1661 | } | 1667 | } | ||
1662 | 1668 | | |||
1663 | return returnValue; | 1669 | return returnValue; | ||
1664 | } | 1670 | } | ||
1665 | const MyMoneyMoney MyMoneyFile::balance(const QString& id) const | 1671 | | ||
1672 | MyMoneyMoney MyMoneyFile::balance(const QString& id) const | ||||
1666 | { | 1673 | { | ||
1667 | return balance(id, QDate()); | 1674 | return balance(id, QDate()); | ||
1668 | } | 1675 | } | ||
1669 | 1676 | | |||
1670 | const MyMoneyMoney MyMoneyFile::clearedBalance(const QString &id, const QDate& date) const | 1677 | MyMoneyMoney MyMoneyFile::clearedBalance(const QString &id, const QDate& date) const | ||
1671 | { | 1678 | { | ||
1672 | MyMoneyMoney cleared; | 1679 | MyMoneyMoney cleared; | ||
1673 | QList<MyMoneyTransaction> list; | 1680 | QList<MyMoneyTransaction> list; | ||
1674 | 1681 | | |||
1675 | cleared = balance(id, date); | 1682 | cleared = balance(id, date); | ||
1676 | 1683 | | |||
1677 | MyMoneyAccount account = this->account(id); | 1684 | MyMoneyAccount account = this->account(id); | ||
1678 | MyMoneyMoney factor(1, 1); | 1685 | MyMoneyMoney factor(1, 1); | ||
Show All 14 Lines | 1698 | for (QList<MyMoneySplit>::const_iterator it_s = splits.constBegin(); it_s != splits.constEnd(); ++it_s) { | |||
1693 | if (split.accountId() != id) | 1700 | if (split.accountId() != id) | ||
1694 | continue; | 1701 | continue; | ||
1695 | cleared -= split.shares(); | 1702 | cleared -= split.shares(); | ||
1696 | } | 1703 | } | ||
1697 | } | 1704 | } | ||
1698 | return cleared * factor; | 1705 | return cleared * factor; | ||
1699 | } | 1706 | } | ||
1700 | 1707 | | |||
1701 | const MyMoneyMoney MyMoneyFile::totalBalance(const QString& id, const QDate& date) const | 1708 | MyMoneyMoney MyMoneyFile::totalBalance(const QString& id, const QDate& date) const | ||
1702 | { | 1709 | { | ||
1703 | d->checkStorage(); | 1710 | d->checkStorage(); | ||
1704 | 1711 | | |||
1705 | return d->m_storage->totalBalance(id, date); | 1712 | return d->m_storage->totalBalance(id, date); | ||
1706 | } | 1713 | } | ||
1707 | 1714 | | |||
1708 | const MyMoneyMoney MyMoneyFile::totalBalance(const QString& id) const | 1715 | MyMoneyMoney MyMoneyFile::totalBalance(const QString& id) const | ||
1709 | { | 1716 | { | ||
1710 | return totalBalance(id, QDate()); | 1717 | return totalBalance(id, QDate()); | ||
1711 | } | 1718 | } | ||
1712 | 1719 | | |||
1713 | void MyMoneyFile::warningMissingRate(const QString& fromId, const QString& toId) const | 1720 | void MyMoneyFile::warningMissingRate(const QString& fromId, const QString& toId) const | ||
1714 | { | 1721 | { | ||
1715 | MyMoneySecurity from, to; | 1722 | MyMoneySecurity from, to; | ||
1716 | try { | 1723 | try { | ||
Show All 13 Lines | |||||
1730 | } | 1737 | } | ||
1731 | 1738 | | |||
1732 | void MyMoneyFile::transactionList(QList<MyMoneyTransaction>& list, MyMoneyTransactionFilter& filter) const | 1739 | void MyMoneyFile::transactionList(QList<MyMoneyTransaction>& list, MyMoneyTransactionFilter& filter) const | ||
1733 | { | 1740 | { | ||
1734 | d->checkStorage(); | 1741 | d->checkStorage(); | ||
1735 | d->m_storage->transactionList(list, filter); | 1742 | d->m_storage->transactionList(list, filter); | ||
1736 | } | 1743 | } | ||
1737 | 1744 | | |||
1738 | const QList<MyMoneyTransaction> MyMoneyFile::transactionList(MyMoneyTransactionFilter& filter) const | 1745 | QList<MyMoneyTransaction> MyMoneyFile::transactionList(MyMoneyTransactionFilter& filter) const | ||
1739 | { | 1746 | { | ||
1740 | QList<MyMoneyTransaction> list; | 1747 | QList<MyMoneyTransaction> list; | ||
1741 | transactionList(list, filter); | 1748 | transactionList(list, filter); | ||
1742 | return list; | 1749 | return list; | ||
1743 | } | 1750 | } | ||
1744 | 1751 | | |||
1745 | const QList<MyMoneyPayee> MyMoneyFile::payeeList() const | 1752 | QList<MyMoneyPayee> MyMoneyFile::payeeList() const | ||
1746 | { | 1753 | { | ||
1747 | QList<MyMoneyPayee> list; | 1754 | QList<MyMoneyPayee> list; | ||
1748 | d->m_cache.payee(list); | 1755 | d->m_cache.payee(list); | ||
1749 | return list; | 1756 | return list; | ||
1750 | } | 1757 | } | ||
1751 | 1758 | | |||
1752 | const QList<MyMoneyTag> MyMoneyFile::tagList() const | 1759 | QList<MyMoneyTag> MyMoneyFile::tagList() const | ||
1753 | { | 1760 | { | ||
1754 | QList<MyMoneyTag> list; | 1761 | QList<MyMoneyTag> list; | ||
1755 | d->m_cache.tag(list); | 1762 | d->m_cache.tag(list); | ||
1756 | return list; | 1763 | return list; | ||
1757 | } | 1764 | } | ||
1758 | 1765 | | |||
1759 | QString MyMoneyFile::accountToCategory(const QString& accountId, bool includeStandardAccounts) const | 1766 | QString MyMoneyFile::accountToCategory(const QString& accountId, bool includeStandardAccounts) const | ||
1760 | { | 1767 | { | ||
▲ Show 20 Lines • Show All 107 Lines • ▼ Show 20 Line(s) | |||||
1868 | { | 1875 | { | ||
1869 | d->checkTransaction(Q_FUNC_INFO); | 1876 | d->checkTransaction(Q_FUNC_INFO); | ||
1870 | 1877 | | |||
1871 | MyMoneyTransaction transaction = sched.transaction(); | 1878 | MyMoneyTransaction transaction = sched.transaction(); | ||
1872 | QList<MyMoneySplit>::ConstIterator it_s; | 1879 | QList<MyMoneySplit>::ConstIterator it_s; | ||
1873 | for (it_s = transaction.splits().constBegin(); it_s != transaction.splits().constEnd(); ++it_s) { | 1880 | for (it_s = transaction.splits().constBegin(); it_s != transaction.splits().constEnd(); ++it_s) { | ||
1874 | // the following line will throw an exception if the | 1881 | // the following line will throw an exception if the | ||
1875 | // account does not exist or is one of the standard accounts | 1882 | // account does not exist or is one of the standard accounts | ||
1876 | MyMoneyAccount acc = MyMoneyFile::account((*it_s).accountId()); | 1883 | auto acc = MyMoneyFile::account((*it_s).accountId()); | ||
1877 | if (acc.id().isEmpty()) | 1884 | if (acc.id().isEmpty()) | ||
1878 | throw MYMONEYEXCEPTION("Cannot add split with no account assigned"); | 1885 | throw MYMONEYEXCEPTION("Cannot add split with no account assigned"); | ||
1879 | if (isStandardAccount((*it_s).accountId())) | 1886 | if (isStandardAccount((*it_s).accountId())) | ||
1880 | throw MYMONEYEXCEPTION("Cannot add split referencing standard account"); | 1887 | throw MYMONEYEXCEPTION("Cannot add split referencing standard account"); | ||
1881 | } | 1888 | } | ||
1882 | 1889 | | |||
1883 | // clear all changed objects from cache | 1890 | // clear all changed objects from cache | ||
1884 | MyMoneyNotifier notifier(d); | 1891 | MyMoneyNotifier notifier(d); | ||
Show All 11 Lines | |||||
1896 | { | 1903 | { | ||
1897 | d->checkTransaction(Q_FUNC_INFO); | 1904 | d->checkTransaction(Q_FUNC_INFO); | ||
1898 | 1905 | | |||
1899 | MyMoneyTransaction transaction = sched.transaction(); | 1906 | MyMoneyTransaction transaction = sched.transaction(); | ||
1900 | QList<MyMoneySplit>::ConstIterator it_s; | 1907 | QList<MyMoneySplit>::ConstIterator it_s; | ||
1901 | for (it_s = transaction.splits().constBegin(); it_s != transaction.splits().constEnd(); ++it_s) { | 1908 | for (it_s = transaction.splits().constBegin(); it_s != transaction.splits().constEnd(); ++it_s) { | ||
1902 | // the following line will throw an exception if the | 1909 | // the following line will throw an exception if the | ||
1903 | // account does not exist or is one of the standard accounts | 1910 | // account does not exist or is one of the standard accounts | ||
1904 | MyMoneyAccount acc = MyMoneyFile::account((*it_s).accountId()); | 1911 | auto acc = MyMoneyFile::account((*it_s).accountId()); | ||
1905 | if (acc.id().isEmpty()) | 1912 | if (acc.id().isEmpty()) | ||
1906 | throw MYMONEYEXCEPTION("Cannot store split with no account assigned"); | 1913 | throw MYMONEYEXCEPTION("Cannot store split with no account assigned"); | ||
1907 | if (isStandardAccount((*it_s).accountId())) | 1914 | if (isStandardAccount((*it_s).accountId())) | ||
1908 | throw MYMONEYEXCEPTION("Cannot store split referencing standard account"); | 1915 | throw MYMONEYEXCEPTION("Cannot store split referencing standard account"); | ||
1909 | } | 1916 | } | ||
1910 | 1917 | | |||
1911 | // clear all changed objects from cache | 1918 | // clear all changed objects from cache | ||
1912 | MyMoneyNotifier notifier(d); | 1919 | MyMoneyNotifier notifier(d); | ||
Show All 12 Lines | 1928 | { | |||
1925 | MyMoneyNotifier notifier(d); | 1932 | MyMoneyNotifier notifier(d); | ||
1926 | 1933 | | |||
1927 | d->m_storage->removeSchedule(sched); | 1934 | d->m_storage->removeSchedule(sched); | ||
1928 | 1935 | | |||
1929 | d->addCacheNotification(sched.id(), false); | 1936 | d->addCacheNotification(sched.id(), false); | ||
1930 | d->m_changeSet += MyMoneyNotification(File::Mode::Remove, sched); | 1937 | d->m_changeSet += MyMoneyNotification(File::Mode::Remove, sched); | ||
1931 | } | 1938 | } | ||
1932 | 1939 | | |||
1933 | const MyMoneySchedule MyMoneyFile::schedule(const QString& id) const | 1940 | MyMoneySchedule MyMoneyFile::schedule(const QString& id) const | ||
1934 | { | 1941 | { | ||
1935 | return d->m_cache.schedule(id); | 1942 | return d->m_cache.schedule(id); | ||
1936 | } | 1943 | } | ||
1937 | 1944 | | |||
1938 | const QList<MyMoneySchedule> MyMoneyFile::scheduleList( | 1945 | QList<MyMoneySchedule> MyMoneyFile::scheduleList( | ||
1939 | const QString& accountId, | 1946 | const QString& accountId, | ||
1940 | const Schedule::Type type, | 1947 | const Schedule::Type type, | ||
1941 | const Schedule::Occurrence occurrence, | 1948 | const Schedule::Occurrence occurrence, | ||
1942 | const Schedule::PaymentType paymentType, | 1949 | const Schedule::PaymentType paymentType, | ||
1943 | const QDate& startDate, | 1950 | const QDate& startDate, | ||
1944 | const QDate& endDate, | 1951 | const QDate& endDate, | ||
1945 | const bool overdue) const | 1952 | const bool overdue) const | ||
1946 | { | 1953 | { | ||
1947 | d->checkStorage(); | 1954 | d->checkStorage(); | ||
1948 | 1955 | | |||
1949 | return d->m_storage->scheduleList(accountId, type, occurrence, paymentType, startDate, endDate, overdue); | 1956 | return d->m_storage->scheduleList(accountId, type, occurrence, paymentType, startDate, endDate, overdue); | ||
1950 | } | 1957 | } | ||
1951 | 1958 | | |||
1952 | const QList<MyMoneySchedule> MyMoneyFile::scheduleList( | 1959 | QList<MyMoneySchedule> MyMoneyFile::scheduleList( | ||
1953 | const QString& accountId) const | 1960 | const QString& accountId) const | ||
1954 | { | 1961 | { | ||
1955 | return scheduleList(accountId, Schedule::Type::Any, Schedule::Occurrence::Any, Schedule::PaymentType::Any, | 1962 | return scheduleList(accountId, Schedule::Type::Any, Schedule::Occurrence::Any, Schedule::PaymentType::Any, | ||
1956 | QDate(), QDate(), false); | 1963 | QDate(), QDate(), false); | ||
1957 | } | 1964 | } | ||
1958 | 1965 | | |||
1959 | const QList<MyMoneySchedule> MyMoneyFile::scheduleList() const | 1966 | QList<MyMoneySchedule> MyMoneyFile::scheduleList() const | ||
1960 | { | 1967 | { | ||
1961 | return scheduleList(QString(), Schedule::Type::Any, Schedule::Occurrence::Any, Schedule::PaymentType::Any, | 1968 | return scheduleList(QString(), Schedule::Type::Any, Schedule::Occurrence::Any, Schedule::PaymentType::Any, | ||
1962 | QDate(), QDate(), false); | 1969 | QDate(), QDate(), false); | ||
1963 | } | 1970 | } | ||
1964 | 1971 | | |||
1965 | const QStringList MyMoneyFile::consistencyCheck() | 1972 | QStringList MyMoneyFile::consistencyCheck() | ||
1966 | { | 1973 | { | ||
1967 | QList<MyMoneyAccount> list; | 1974 | QList<MyMoneyAccount> list; | ||
1968 | QList<MyMoneyAccount>::Iterator it_a; | 1975 | QList<MyMoneyAccount>::Iterator it_a; | ||
1969 | QList<MyMoneySchedule>::Iterator it_sch; | 1976 | QList<MyMoneySchedule>::Iterator it_sch; | ||
1970 | QList<MyMoneyPayee>::Iterator it_p; | 1977 | QList<MyMoneyPayee>::Iterator it_p; | ||
1971 | QList<MyMoneyTransaction>::Iterator it_t; | 1978 | QList<MyMoneyTransaction>::Iterator it_t; | ||
1972 | QList<MyMoneyReport>::Iterator it_r; | 1979 | QList<MyMoneyReport>::Iterator it_r; | ||
1973 | QStringList accountRebuild; | 1980 | QStringList accountRebuild; | ||
▲ Show 20 Lines • Show All 308 Lines • ▼ Show 20 Line(s) | 2286 | for (it_s = splits.constBegin(); it_s != splits.constEnd(); ++it_s) { | |||
2282 | if (payeeConversionMap.find((*it_s).payeeId()) != payeeConversionMap.end()) { | 2289 | if (payeeConversionMap.find((*it_s).payeeId()) != payeeConversionMap.end()) { | ||
2283 | s.setPayeeId(payeeConversionMap[s.payeeId()]); | 2290 | s.setPayeeId(payeeConversionMap[s.payeeId()]); | ||
2284 | sChanged = true; | 2291 | sChanged = true; | ||
2285 | rc << i18n(" * Payee id updated in split of transaction '%1'.", t.id()); | 2292 | rc << i18n(" * Payee id updated in split of transaction '%1'.", t.id()); | ||
2286 | ++problemCount; | 2293 | ++problemCount; | ||
2287 | } | 2294 | } | ||
2288 | 2295 | | |||
2289 | try { | 2296 | try { | ||
2290 | const MyMoneyAccount& acc = this->account(s.accountId()); | 2297 | const auto acc = this->account(s.accountId()); | ||
2291 | // compute the newest opening date of all accounts involved in the transaction | 2298 | // compute the newest opening date of all accounts involved in the transaction | ||
2292 | // in case the newest opening date is newer than the transaction post date, do one | 2299 | // in case the newest opening date is newer than the transaction post date, do one | ||
2293 | // of the following: | 2300 | // of the following: | ||
2294 | // | 2301 | // | ||
2295 | // a) for category and stock accounts: update the opening date of the account | 2302 | // a) for category and stock accounts: update the opening date of the account | ||
2296 | // b) for account types where the user cannot modify the opening date through | 2303 | // b) for account types where the user cannot modify the opening date through | ||
2297 | // the UI issue a warning (for each account only once) | 2304 | // the UI issue a warning (for each account only once) | ||
2298 | // c) others will be caught later | 2305 | // c) others will be caught later | ||
▲ Show 20 Lines • Show All 82 Lines • ▼ Show 20 Line(s) | 2381 | #if 0 | |||
2381 | // copy the price information for investments to the new date | 2388 | // copy the price information for investments to the new date | ||
2382 | QList<MyMoneySplit>::const_iterator it_t; | 2389 | QList<MyMoneySplit>::const_iterator it_t; | ||
2383 | for (it_t = t.splits().constBegin(); it_t != t.splits().constEnd(); ++it_t) { | 2390 | for (it_t = t.splits().constBegin(); it_t != t.splits().constEnd(); ++it_t) { | ||
2384 | if (((*it_t).action() != "Buy") && | 2391 | if (((*it_t).action() != "Buy") && | ||
2385 | ((*it_t).action() != "Reinvest")) { | 2392 | ((*it_t).action() != "Reinvest")) { | ||
2386 | continue; | 2393 | continue; | ||
2387 | } | 2394 | } | ||
2388 | QString id = (*it_t).accountId(); | 2395 | QString id = (*it_t).accountId(); | ||
2389 | MyMoneyAccount acc = this->account(id); | 2396 | auto acc = this->account(id); | ||
2390 | MyMoneySecurity sec = this->security(acc.currencyId()); | 2397 | MyMoneySecurity sec = this->security(acc.currencyId()); | ||
2391 | MyMoneyPrice price(acc.currencyId(), | 2398 | MyMoneyPrice price(acc.currencyId(), | ||
2392 | sec.tradingCurrency(), | 2399 | sec.tradingCurrency(), | ||
2393 | t.postDate(), | 2400 | t.postDate(), | ||
2394 | (*it_t).price(), "Transaction"); | 2401 | (*it_t).price(), "Transaction"); | ||
2395 | this->addPrice(price); | 2402 | this->addPrice(price); | ||
2396 | break; | 2403 | break; | ||
2397 | } | 2404 | } | ||
Show All 40 Lines | 2443 | if (!(*it_s).bankID().isEmpty()) { | |||
2438 | sChanged = true; | 2445 | sChanged = true; | ||
2439 | rc << i18n(" * Removed bankid from split in scheduled transaction '%1'.", (*it_sch).name()); | 2446 | rc << i18n(" * Removed bankid from split in scheduled transaction '%1'.", (*it_sch).name()); | ||
2440 | ++problemCount; | 2447 | ++problemCount; | ||
2441 | } | 2448 | } | ||
2442 | 2449 | | |||
2443 | // make sure, that shares and value have the same number if they | 2450 | // make sure, that shares and value have the same number if they | ||
2444 | // represent the same currency. | 2451 | // represent the same currency. | ||
2445 | try { | 2452 | try { | ||
2446 | const MyMoneyAccount& acc = this->account(s.accountId()); | 2453 | const auto acc = this->account(s.accountId()); | ||
2447 | if (t.commodity() == acc.currencyId() | 2454 | if (t.commodity() == acc.currencyId() | ||
2448 | && s.shares().reduce() != s.value().reduce()) { | 2455 | && s.shares().reduce() != s.value().reduce()) { | ||
2449 | // use the value as master if the transaction is balanced | 2456 | // use the value as master if the transaction is balanced | ||
2450 | if (t.splitSum().isZero()) { | 2457 | if (t.splitSum().isZero()) { | ||
2451 | s.setShares(s.value()); | 2458 | s.setShares(s.value()); | ||
2452 | rc << i18n(" * shares set to value in split in schedule '%1'.", (*it_sch).name()); | 2459 | rc << i18n(" * shares set to value in split in schedule '%1'.", (*it_sch).name()); | ||
2453 | } else { | 2460 | } else { | ||
2454 | s.setValue(s.shares()); | 2461 | s.setValue(s.shares()); | ||
▲ Show 20 Lines • Show All 273 Lines • ▼ Show 20 Line(s) | 2721 | if (!found) { | |||
2728 | createAccount(newAccount, parent, brokerage, MyMoneyMoney()); | 2735 | createAccount(newAccount, parent, brokerage, MyMoneyMoney()); | ||
2729 | accountId = newAccount.id(); | 2736 | accountId = newAccount.id(); | ||
2730 | } | 2737 | } | ||
2731 | } | 2738 | } | ||
2732 | 2739 | | |||
2733 | return accountId; | 2740 | return accountId; | ||
2734 | } | 2741 | } | ||
2735 | 2742 | | |||
2736 | const QList<MyMoneySchedule> MyMoneyFile::scheduleListEx(int scheduleTypes, | | |||
2737 | int scheduleOcurrences, | | |||
2738 | int schedulePaymentTypes, | | |||
2739 | QDate startDate, | | |||
2740 | const QStringList& accounts) const | | |||
2741 | { | | |||
2742 | d->checkStorage(); | | |||
2743 | | ||||
2744 | return d->m_storage->scheduleListEx(scheduleTypes, scheduleOcurrences, schedulePaymentTypes, startDate, accounts); | | |||
2745 | } | | |||
2746 | | ||||
2747 | void MyMoneyFile::addSecurity(MyMoneySecurity& security) | 2743 | void MyMoneyFile::addSecurity(MyMoneySecurity& security) | ||
2748 | { | 2744 | { | ||
2749 | d->checkTransaction(Q_FUNC_INFO); | 2745 | d->checkTransaction(Q_FUNC_INFO); | ||
2750 | 2746 | | |||
2751 | // clear all changed objects from cache | 2747 | // clear all changed objects from cache | ||
2752 | MyMoneyNotifier notifier(d); | 2748 | MyMoneyNotifier notifier(d); | ||
2753 | 2749 | | |||
2754 | d->m_storage->addSecurity(security); | 2750 | d->m_storage->addSecurity(security); | ||
Show All 30 Lines | 2774 | { | |||
2785 | 2781 | | |||
2786 | d->m_storage->removeSecurity(security); | 2782 | d->m_storage->removeSecurity(security); | ||
2787 | 2783 | | |||
2788 | d->addCacheNotification(security.id(), false); | 2784 | d->addCacheNotification(security.id(), false); | ||
2789 | 2785 | | |||
2790 | d->m_changeSet += MyMoneyNotification(File::Mode::Remove, security); | 2786 | d->m_changeSet += MyMoneyNotification(File::Mode::Remove, security); | ||
2791 | } | 2787 | } | ||
2792 | 2788 | | |||
2793 | const MyMoneySecurity& MyMoneyFile::security(const QString& id) const | 2789 | MyMoneySecurity MyMoneyFile::security(const QString& id) const | ||
2794 | { | 2790 | { | ||
2795 | if (id.isEmpty()) | 2791 | if (id.isEmpty()) | ||
2796 | return baseCurrency(); | 2792 | return baseCurrency(); | ||
2797 | 2793 | | |||
2798 | return d->m_cache.security(id); | 2794 | return d->m_cache.security(id); | ||
2799 | } | 2795 | } | ||
2800 | 2796 | | |||
2801 | const QList<MyMoneySecurity> MyMoneyFile::securityList() const | 2797 | QList<MyMoneySecurity> MyMoneyFile::securityList() const | ||
2802 | { | 2798 | { | ||
2803 | d->checkStorage(); | 2799 | d->checkStorage(); | ||
2804 | 2800 | | |||
2805 | return d->m_storage->securityList(); | 2801 | return d->m_storage->securityList(); | ||
2806 | } | 2802 | } | ||
2807 | 2803 | | |||
2808 | void MyMoneyFile::addCurrency(const MyMoneySecurity& currency) | 2804 | void MyMoneyFile::addCurrency(const MyMoneySecurity& currency) | ||
2809 | { | 2805 | { | ||
▲ Show 20 Lines • Show All 44 Lines • ▼ Show 20 Line(s) | 2839 | { | |||
2854 | 2850 | | |||
2855 | d->m_storage->removeCurrency(currency); | 2851 | d->m_storage->removeCurrency(currency); | ||
2856 | 2852 | | |||
2857 | d->addCacheNotification(currency.id(), false); | 2853 | d->addCacheNotification(currency.id(), false); | ||
2858 | 2854 | | |||
2859 | d->m_changeSet += MyMoneyNotification(File::Mode::Remove, currency); | 2855 | d->m_changeSet += MyMoneyNotification(File::Mode::Remove, currency); | ||
2860 | } | 2856 | } | ||
2861 | 2857 | | |||
2862 | const MyMoneySecurity& MyMoneyFile::currency(const QString& id) const | 2858 | MyMoneySecurity MyMoneyFile::currency(const QString& id) const | ||
2863 | { | 2859 | { | ||
2864 | if (id.isEmpty()) | 2860 | if (id.isEmpty()) | ||
2865 | return baseCurrency(); | 2861 | return baseCurrency(); | ||
2866 | 2862 | | |||
2867 | const MyMoneySecurity& curr = d->m_cache.security(id); | 2863 | const MyMoneySecurity& curr = d->m_cache.security(id); | ||
2868 | if (curr.id().isEmpty()) { | 2864 | if (curr.id().isEmpty()) { | ||
2869 | QString msg; | 2865 | QString msg; | ||
2870 | msg = QString("Currency '%1' not found.").arg(id); | 2866 | msg = QString("Currency '%1' not found.").arg(id); | ||
2871 | throw MYMONEYEXCEPTION(msg); | 2867 | throw MYMONEYEXCEPTION(msg); | ||
2872 | } | 2868 | } | ||
2873 | return curr; | 2869 | return curr; | ||
2874 | } | 2870 | } | ||
2875 | 2871 | | |||
2876 | const QMap<MyMoneySecurity, MyMoneyPrice> MyMoneyFile::ancientCurrencies() const | 2872 | QMap<MyMoneySecurity, MyMoneyPrice> MyMoneyFile::ancientCurrencies() const | ||
2877 | { | 2873 | { | ||
2878 | QMap<MyMoneySecurity, MyMoneyPrice> ancientCurrencies; | 2874 | QMap<MyMoneySecurity, MyMoneyPrice> ancientCurrencies; | ||
2879 | 2875 | | |||
2880 | ancientCurrencies.insert(MyMoneySecurity("ATS", i18n("Austrian Schilling"), "ÖS"), MyMoneyPrice("ATS", "EUR", QDate(1998, 12, 31), MyMoneyMoney(10000, 137603), QLatin1Literal("KMyMoney"))); | 2876 | ancientCurrencies.insert(MyMoneySecurity("ATS", i18n("Austrian Schilling"), "ÖS"), MyMoneyPrice("ATS", "EUR", QDate(1998, 12, 31), MyMoneyMoney(10000, 137603), QLatin1Literal("KMyMoney"))); | ||
2881 | ancientCurrencies.insert(MyMoneySecurity("DEM", i18n("German Mark"), "DM"), MyMoneyPrice("ATS", "EUR", QDate(1998, 12, 31), MyMoneyMoney(100000, 195583), QLatin1Literal("KMyMoney"))); | 2877 | ancientCurrencies.insert(MyMoneySecurity("DEM", i18n("German Mark"), "DM"), MyMoneyPrice("ATS", "EUR", QDate(1998, 12, 31), MyMoneyMoney(100000, 195583), QLatin1Literal("KMyMoney"))); | ||
2882 | ancientCurrencies.insert(MyMoneySecurity("FRF", i18n("French Franc"), "FF"), MyMoneyPrice("FRF", "EUR", QDate(1998, 12, 31), MyMoneyMoney(100000, 655957), QLatin1Literal("KMyMoney"))); | 2878 | ancientCurrencies.insert(MyMoneySecurity("FRF", i18n("French Franc"), "FF"), MyMoneyPrice("FRF", "EUR", QDate(1998, 12, 31), MyMoneyMoney(100000, 655957), QLatin1Literal("KMyMoney"))); | ||
2883 | ancientCurrencies.insert(MyMoneySecurity("ITL", i18n("Italian Lira"), QChar(0x20A4)), MyMoneyPrice("ITL", "EUR", QDate(1998, 12, 31), MyMoneyMoney(100, 193627), QLatin1Literal("KMyMoney"))); | 2879 | ancientCurrencies.insert(MyMoneySecurity("ITL", i18n("Italian Lira"), QChar(0x20A4)), MyMoneyPrice("ITL", "EUR", QDate(1998, 12, 31), MyMoneyMoney(100, 193627), QLatin1Literal("KMyMoney"))); | ||
2884 | ancientCurrencies.insert(MyMoneySecurity("ESP", i18n("Spanish Peseta"), QString()), MyMoneyPrice("ESP", "EUR", QDate(1998, 12, 31), MyMoneyMoney(1000, 166386), QLatin1Literal("KMyMoney"))); | 2880 | ancientCurrencies.insert(MyMoneySecurity("ESP", i18n("Spanish Peseta"), QString()), MyMoneyPrice("ESP", "EUR", QDate(1998, 12, 31), MyMoneyMoney(1000, 166386), QLatin1Literal("KMyMoney"))); | ||
Show All 33 Lines | 2912 | ancientCurrencies.insert(MyMoneySecurity("AZM", i18n("Azerbaijani Manat"), "m."), MyMoneyPrice("AZM", "AZN", QDate(2006, 1, 1), MyMoneyMoney(1, 5000), QLatin1Literal("KMyMoney"))); | |||
2918 | // Source: https://en.wikipedia.org/wiki/Litas | 2914 | // Source: https://en.wikipedia.org/wiki/Litas | ||
2919 | ancientCurrencies.insert(MyMoneySecurity("LTL", i18n("Lithuanian Litas"), "Lt"), MyMoneyPrice("LTL", "EUR", QDate(2015, 1, 1), MyMoneyMoney(100000, 345280), QLatin1Literal("KMyMoney"))); | 2915 | ancientCurrencies.insert(MyMoneySecurity("LTL", i18n("Lithuanian Litas"), "Lt"), MyMoneyPrice("LTL", "EUR", QDate(2015, 1, 1), MyMoneyMoney(100000, 345280), QLatin1Literal("KMyMoney"))); | ||
2920 | 2916 | | |||
2921 | // Source: https://en.wikipedia.org/wiki/Belarusian_ruble | 2917 | // Source: https://en.wikipedia.org/wiki/Belarusian_ruble | ||
2922 | ancientCurrencies.insert(MyMoneySecurity("BYR", i18n("Belarusian Ruble (old)"), "BYR"), MyMoneyPrice("BYR", "BYN", QDate(2016, 7, 1), MyMoneyMoney(1, 10000), QLatin1Literal("KMyMoney"))); | 2918 | ancientCurrencies.insert(MyMoneySecurity("BYR", i18n("Belarusian Ruble (old)"), "BYR"), MyMoneyPrice("BYR", "BYN", QDate(2016, 7, 1), MyMoneyMoney(1, 10000), QLatin1Literal("KMyMoney"))); | ||
2923 | return ancientCurrencies; | 2919 | return ancientCurrencies; | ||
2924 | } | 2920 | } | ||
2925 | 2921 | | |||
2926 | const QList<MyMoneySecurity> MyMoneyFile::availableCurrencyList() const | 2922 | QList<MyMoneySecurity> MyMoneyFile::availableCurrencyList() const | ||
2927 | { | 2923 | { | ||
2928 | QList<MyMoneySecurity> currencyList; | 2924 | QList<MyMoneySecurity> currencyList; | ||
2929 | currencyList.append(MyMoneySecurity("AFA", i18n("Afghanistan Afghani"))); | 2925 | currencyList.append(MyMoneySecurity("AFA", i18n("Afghanistan Afghani"))); | ||
2930 | currencyList.append(MyMoneySecurity("ALL", i18n("Albanian Lek"))); | 2926 | currencyList.append(MyMoneySecurity("ALL", i18n("Albanian Lek"))); | ||
2931 | currencyList.append(MyMoneySecurity("ANG", i18n("Netherland Antillian Guilder"))); | 2927 | currencyList.append(MyMoneySecurity("ANG", i18n("Netherland Antillian Guilder"))); | ||
2932 | currencyList.append(MyMoneySecurity("DZD", i18n("Algerian Dinar"))); | 2928 | currencyList.append(MyMoneySecurity("DZD", i18n("Algerian Dinar"))); | ||
2933 | currencyList.append(MyMoneySecurity("ADF", i18n("Andorran Franc"))); | 2929 | currencyList.append(MyMoneySecurity("ADF", i18n("Andorran Franc"))); | ||
2934 | currencyList.append(MyMoneySecurity("ADP", i18n("Andorran Peseta"))); | 2930 | currencyList.append(MyMoneySecurity("ADP", i18n("Andorran Peseta"))); | ||
▲ Show 20 Lines • Show All 155 Lines • ▼ Show 20 Line(s) | |||||
3090 | currencyList.append(MyMoneySecurity("XPD", i18n("Palladium"), "XPD", 1000000)); | 3086 | currencyList.append(MyMoneySecurity("XPD", i18n("Palladium"), "XPD", 1000000)); | ||
3091 | currencyList.append(MyMoneySecurity("XPT", i18n("Platinum"), "XPT", 1000000)); | 3087 | currencyList.append(MyMoneySecurity("XPT", i18n("Platinum"), "XPT", 1000000)); | ||
3092 | currencyList.append(MyMoneySecurity("XAG", i18n("Silver"), "XAG", 1000000)); | 3088 | currencyList.append(MyMoneySecurity("XAG", i18n("Silver"), "XAG", 1000000)); | ||
3093 | 3089 | | |||
3094 | currencyList.append(ancientCurrencies().keys()); | 3090 | currencyList.append(ancientCurrencies().keys()); | ||
3095 | return currencyList; | 3091 | return currencyList; | ||
3096 | } | 3092 | } | ||
3097 | 3093 | | |||
3098 | const QList<MyMoneySecurity> MyMoneyFile::currencyList() const | 3094 | QList<MyMoneySecurity> MyMoneyFile::currencyList() const | ||
3099 | { | 3095 | { | ||
3100 | d->checkStorage(); | 3096 | d->checkStorage(); | ||
3101 | 3097 | | |||
3102 | return d->m_storage->currencyList(); | 3098 | return d->m_storage->currencyList(); | ||
3103 | } | 3099 | } | ||
3104 | 3100 | | |||
3105 | const QString& MyMoneyFile::foreignCurrency(const QString& first, const QString& second) const | 3101 | QString MyMoneyFile::foreignCurrency(const QString& first, const QString& second) const | ||
3106 | { | 3102 | { | ||
3107 | if (baseCurrency().id() == second) | 3103 | if (baseCurrency().id() == second) | ||
3108 | return first; | 3104 | return first; | ||
3109 | return second; | 3105 | return second; | ||
3110 | } | 3106 | } | ||
3111 | 3107 | | |||
3112 | const MyMoneySecurity& MyMoneyFile::baseCurrency() const | 3108 | MyMoneySecurity MyMoneyFile::baseCurrency() const | ||
3113 | { | 3109 | { | ||
3114 | if (d->m_baseCurrency.id().isEmpty()) { | 3110 | if (d->m_baseCurrency.id().isEmpty()) { | ||
3115 | QString id = QString(value("kmm-baseCurrency")); | 3111 | QString id = QString(value("kmm-baseCurrency")); | ||
3116 | if (!id.isEmpty()) | 3112 | if (!id.isEmpty()) | ||
3117 | d->m_baseCurrency = currency(id); | 3113 | d->m_baseCurrency = currency(id); | ||
3118 | } | 3114 | } | ||
3119 | 3115 | | |||
3120 | return d->m_baseCurrency; | 3116 | return d->m_baseCurrency; | ||
▲ Show 20 Lines • Show All 97 Lines • ▼ Show 20 Line(s) | 3213 | { | |||
3218 | return price(fromId, toId, QDate::currentDate(), false); | 3214 | return price(fromId, toId, QDate::currentDate(), false); | ||
3219 | } | 3215 | } | ||
3220 | 3216 | | |||
3221 | MyMoneyPrice MyMoneyFile::price(const QString& fromId) const | 3217 | MyMoneyPrice MyMoneyFile::price(const QString& fromId) const | ||
3222 | { | 3218 | { | ||
3223 | return price(fromId, QString(), QDate::currentDate(), false); | 3219 | return price(fromId, QString(), QDate::currentDate(), false); | ||
3224 | } | 3220 | } | ||
3225 | 3221 | | |||
3226 | const MyMoneyPriceList MyMoneyFile::priceList() const | 3222 | MyMoneyPriceList MyMoneyFile::priceList() const | ||
3227 | { | 3223 | { | ||
3228 | d->checkStorage(); | 3224 | d->checkStorage(); | ||
3229 | 3225 | | |||
3230 | return d->m_storage->priceList(); | 3226 | return d->m_storage->priceList(); | ||
3231 | } | 3227 | } | ||
3232 | 3228 | | |||
3233 | bool MyMoneyFile::hasAccount(const QString& id, const QString& name) const | 3229 | bool MyMoneyFile::hasAccount(const QString& id, const QString& name) const | ||
3234 | { | 3230 | { | ||
3235 | MyMoneyAccount acc = d->m_cache.account(id); | 3231 | auto acc = d->m_cache.account(id); | ||
3236 | QStringList list = acc.accountList(); | 3232 | QStringList list = acc.accountList(); | ||
3237 | QStringList::ConstIterator it; | 3233 | QStringList::ConstIterator it; | ||
3238 | bool rc = false; | 3234 | bool rc = false; | ||
3239 | for (it = list.constBegin(); rc == false && it != list.constEnd(); ++it) { | 3235 | for (it = list.constBegin(); rc == false && it != list.constEnd(); ++it) { | ||
3240 | MyMoneyAccount a = d->m_cache.account(*it); | 3236 | MyMoneyAccount a = d->m_cache.account(*it); | ||
3241 | if (a.name() == name) | 3237 | if (a.name() == name) | ||
3242 | rc = true; | 3238 | rc = true; | ||
3243 | } | 3239 | } | ||
3244 | return rc; | 3240 | return rc; | ||
3245 | } | 3241 | } | ||
3246 | 3242 | | |||
3247 | const QList<MyMoneyReport> MyMoneyFile::reportList() const | 3243 | QList<MyMoneyReport> MyMoneyFile::reportList() const | ||
3248 | { | 3244 | { | ||
3249 | d->checkStorage(); | 3245 | d->checkStorage(); | ||
3250 | 3246 | | |||
3251 | return d->m_storage->reportList(); | 3247 | return d->m_storage->reportList(); | ||
3252 | } | 3248 | } | ||
3253 | 3249 | | |||
3254 | void MyMoneyFile::addReport(MyMoneyReport& report) | 3250 | void MyMoneyFile::addReport(MyMoneyReport& report) | ||
3255 | { | 3251 | { | ||
Show All 19 Lines | |||||
3275 | 3271 | | |||
3276 | unsigned MyMoneyFile::countReports() const | 3272 | unsigned MyMoneyFile::countReports() const | ||
3277 | { | 3273 | { | ||
3278 | d->checkStorage(); | 3274 | d->checkStorage(); | ||
3279 | 3275 | | |||
3280 | return d->m_storage->countReports(); | 3276 | return d->m_storage->countReports(); | ||
3281 | } | 3277 | } | ||
3282 | 3278 | | |||
3283 | const MyMoneyReport MyMoneyFile::report(const QString& id) const | 3279 | MyMoneyReport MyMoneyFile::report(const QString& id) const | ||
3284 | { | 3280 | { | ||
3285 | d->checkStorage(); | 3281 | d->checkStorage(); | ||
3286 | 3282 | | |||
3287 | return d->m_storage->report(id); | 3283 | return d->m_storage->report(id); | ||
3288 | } | 3284 | } | ||
3289 | 3285 | | |||
3290 | void MyMoneyFile::removeReport(const MyMoneyReport& report) | 3286 | void MyMoneyFile::removeReport(const MyMoneyReport& report) | ||
3291 | { | 3287 | { | ||
3292 | d->checkTransaction(Q_FUNC_INFO); | 3288 | d->checkTransaction(Q_FUNC_INFO); | ||
3293 | MyMoneyNotifier notifier(d); | 3289 | MyMoneyNotifier notifier(d); | ||
3294 | 3290 | | |||
3295 | d->m_storage->removeReport(report); | 3291 | d->m_storage->removeReport(report); | ||
3296 | 3292 | | |||
3297 | d->addCacheNotification(report.id(), false); | 3293 | d->addCacheNotification(report.id(), false); | ||
3298 | } | 3294 | } | ||
3299 | 3295 | | |||
3300 | 3296 | | |||
3301 | const QList<MyMoneyBudget> MyMoneyFile::budgetList() const | 3297 | QList<MyMoneyBudget> MyMoneyFile::budgetList() const | ||
3302 | { | 3298 | { | ||
3303 | d->checkStorage(); | 3299 | d->checkStorage(); | ||
3304 | 3300 | | |||
3305 | return d->m_storage->budgetList(); | 3301 | return d->m_storage->budgetList(); | ||
3306 | } | 3302 | } | ||
3307 | 3303 | | |||
3308 | void MyMoneyFile::addBudget(MyMoneyBudget& budget) | 3304 | void MyMoneyFile::addBudget(MyMoneyBudget &budget) | ||
3309 | { | 3305 | { | ||
3310 | d->checkTransaction(Q_FUNC_INFO); | 3306 | d->checkTransaction(Q_FUNC_INFO); | ||
3311 | 3307 | | |||
3312 | // clear all changed objects from cache | 3308 | // clear all changed objects from cache | ||
3313 | MyMoneyNotifier notifier(d); | 3309 | MyMoneyNotifier notifier(d); | ||
3314 | 3310 | | |||
3315 | d->m_storage->addBudget(budget); | 3311 | d->m_storage->addBudget(budget); | ||
3316 | } | 3312 | } | ||
3317 | 3313 | | |||
3318 | const MyMoneyBudget MyMoneyFile::budgetByName(const QString& name) const | 3314 | MyMoneyBudget MyMoneyFile::budgetByName(const QString& name) const | ||
3319 | { | 3315 | { | ||
3320 | d->checkStorage(); | 3316 | d->checkStorage(); | ||
3321 | 3317 | | |||
3322 | return d->m_storage->budgetByName(name); | 3318 | return d->m_storage->budgetByName(name); | ||
3323 | } | 3319 | } | ||
3324 | 3320 | | |||
3325 | void MyMoneyFile::modifyBudget(const MyMoneyBudget& budget) | 3321 | void MyMoneyFile::modifyBudget(const MyMoneyBudget& budget) | ||
3326 | { | 3322 | { | ||
Show All 9 Lines | |||||
3336 | 3332 | | |||
3337 | unsigned MyMoneyFile::countBudgets() const | 3333 | unsigned MyMoneyFile::countBudgets() const | ||
3338 | { | 3334 | { | ||
3339 | d->checkStorage(); | 3335 | d->checkStorage(); | ||
3340 | 3336 | | |||
3341 | return d->m_storage->countBudgets(); | 3337 | return d->m_storage->countBudgets(); | ||
3342 | } | 3338 | } | ||
3343 | 3339 | | |||
3344 | const MyMoneyBudget MyMoneyFile::budget(const QString& id) const | 3340 | MyMoneyBudget MyMoneyFile::budget(const QString& id) const | ||
3345 | { | 3341 | { | ||
3346 | d->checkStorage(); | 3342 | d->checkStorage(); | ||
3347 | 3343 | | |||
3348 | return d->m_storage->budget(id); | 3344 | return d->m_storage->budget(id); | ||
3349 | } | 3345 | } | ||
3350 | 3346 | | |||
3351 | void MyMoneyFile::removeBudget(const MyMoneyBudget& budget) | 3347 | void MyMoneyFile::removeBudget(const MyMoneyBudget& budget) | ||
3352 | { | 3348 | { | ||
Show All 21 Lines | |||||
3374 | void MyMoneyFile::modifyOnlineJob(const onlineJob job) | 3370 | void MyMoneyFile::modifyOnlineJob(const onlineJob job) | ||
3375 | { | 3371 | { | ||
3376 | d->checkTransaction(Q_FUNC_INFO); | 3372 | d->checkTransaction(Q_FUNC_INFO); | ||
3377 | d->m_storage->modifyOnlineJob(job); | 3373 | d->m_storage->modifyOnlineJob(job); | ||
3378 | d->m_changeSet += MyMoneyNotification(File::Mode::Modify, job); | 3374 | d->m_changeSet += MyMoneyNotification(File::Mode::Modify, job); | ||
3379 | d->addCacheNotification(job.id()); | 3375 | d->addCacheNotification(job.id()); | ||
3380 | } | 3376 | } | ||
3381 | 3377 | | |||
3382 | const onlineJob MyMoneyFile::getOnlineJob(const QString &jobId) const | 3378 | onlineJob MyMoneyFile::getOnlineJob(const QString &jobId) const | ||
3383 | { | 3379 | { | ||
3384 | d->checkStorage(); | 3380 | d->checkStorage(); | ||
3385 | return d->m_storage->getOnlineJob(jobId); | 3381 | return d->m_storage->getOnlineJob(jobId); | ||
3386 | } | 3382 | } | ||
3387 | 3383 | | |||
3388 | const QList<onlineJob> MyMoneyFile::onlineJobList() const | 3384 | QList<onlineJob> MyMoneyFile::onlineJobList() const | ||
3389 | { | 3385 | { | ||
3390 | d->checkStorage(); | 3386 | d->checkStorage(); | ||
3391 | return d->m_storage->onlineJobList(); | 3387 | return d->m_storage->onlineJobList(); | ||
3392 | } | 3388 | } | ||
3393 | 3389 | | |||
3394 | /** @todo improve speed by passing count job to m_storage */ | 3390 | /** @todo improve speed by passing count job to m_storage */ | ||
3395 | int MyMoneyFile::countOnlineJobs() const | 3391 | int MyMoneyFile::countOnlineJobs() const | ||
3396 | { | 3392 | { | ||
▲ Show 20 Lines • Show All 165 Lines • ▼ Show 20 Line(s) | |||||
3562 | 3558 | | |||
3563 | void MyMoneyFile::clearCache() | 3559 | void MyMoneyFile::clearCache() | ||
3564 | { | 3560 | { | ||
3565 | d->checkStorage(); | 3561 | d->checkStorage(); | ||
3566 | d->m_cache.clear(); | 3562 | d->m_cache.clear(); | ||
3567 | d->m_balanceCache.clear(); | 3563 | d->m_balanceCache.clear(); | ||
3568 | } | 3564 | } | ||
3569 | 3565 | | |||
3566 | void MyMoneyFile::forceDataChanged() | ||||
3567 | { | ||||
3568 | emit dataChanged(); | ||||
3569 | } | ||||
3570 | | ||||
3570 | void MyMoneyFile::preloadCache() | 3571 | void MyMoneyFile::preloadCache() | ||
3571 | { | 3572 | { | ||
3572 | d->checkStorage(); | 3573 | d->checkStorage(); | ||
3573 | 3574 | | |||
3574 | d->m_cache.clear(); | 3575 | d->m_cache.clear(); | ||
3575 | QList<MyMoneyAccount> a_list; | 3576 | QList<MyMoneyAccount> a_list; | ||
3576 | d->m_storage->accountList(a_list); | 3577 | d->m_storage->accountList(a_list); | ||
3577 | d->m_cache.preloadAccount(a_list); | 3578 | d->m_cache.preloadAccount(a_list); | ||
3578 | d->m_cache.preloadPayee(d->m_storage->payeeList()); | 3579 | d->m_cache.preloadPayee(d->m_storage->payeeList()); | ||
3579 | d->m_cache.preloadTag(d->m_storage->tagList()); | 3580 | d->m_cache.preloadTag(d->m_storage->tagList()); | ||
3580 | d->m_cache.preloadInstitution(d->m_storage->institutionList()); | 3581 | d->m_cache.preloadInstitution(d->m_storage->institutionList()); | ||
3581 | d->m_cache.preloadSecurity(d->m_storage->securityList() + | 3582 | d->m_cache.preloadSecurity(d->m_storage->securityList() + | ||
3582 | d->m_storage->currencyList()); | 3583 | d->m_storage->currencyList()); | ||
3583 | d->m_cache.preloadSchedule(d->m_storage->scheduleList()); | 3584 | d->m_cache.preloadSchedule(d->m_storage->scheduleList()); | ||
3584 | d->m_cache.preloadOnlineJob(d->m_storage->onlineJobList()); | 3585 | d->m_cache.preloadOnlineJob(d->m_storage->onlineJobList()); | ||
3585 | } | 3586 | } | ||
3586 | 3587 | | |||
3587 | bool MyMoneyFile::isTransfer(const MyMoneyTransaction& t) const | 3588 | bool MyMoneyFile::isTransfer(const MyMoneyTransaction& t) const | ||
3588 | { | 3589 | { | ||
3589 | bool rc = false; | 3590 | bool rc = false; | ||
3590 | if (t.splitCount() == 2) { | 3591 | if (t.splitCount() == 2) { | ||
3591 | QList<MyMoneySplit>::const_iterator it_s; | 3592 | QList<MyMoneySplit>::const_iterator it_s; | ||
3592 | for (it_s = t.splits().begin(); it_s != t.splits().end(); ++it_s) { | 3593 | for (it_s = t.splits().begin(); it_s != t.splits().end(); ++it_s) { | ||
3593 | MyMoneyAccount acc = account((*it_s).accountId()); | 3594 | auto acc = account((*it_s).accountId()); | ||
3594 | if (acc.isIncomeExpense()) | 3595 | if (acc.isIncomeExpense()) | ||
3595 | break; | 3596 | break; | ||
3596 | } | 3597 | } | ||
3597 | if (it_s == t.splits().end()) | 3598 | if (it_s == t.splits().end()) | ||
3598 | rc = true; | 3599 | rc = true; | ||
3599 | } | 3600 | } | ||
3600 | return rc; | 3601 | return rc; | ||
3601 | } | 3602 | } | ||
Show All 33 Lines | 3632 | try { | |||
3635 | id = uid.toString(); | 3636 | id = uid.toString(); | ||
3636 | } catch (const MyMoneyException &) { | 3637 | } catch (const MyMoneyException &) { | ||
3637 | qDebug("Unable to setup UID for new storage object"); | 3638 | qDebug("Unable to setup UID for new storage object"); | ||
3638 | } | 3639 | } | ||
3639 | } | 3640 | } | ||
3640 | return id; | 3641 | return id; | ||
3641 | } | 3642 | } | ||
3642 | 3643 | | |||
3643 | const QString MyMoneyFile::openingBalancesPrefix() | 3644 | QString MyMoneyFile::openingBalancesPrefix() | ||
3644 | { | 3645 | { | ||
3645 | return i18n("Opening Balances"); | 3646 | return i18n("Opening Balances"); | ||
3646 | } | 3647 | } | ||
3647 | 3648 | | |||
3648 | bool MyMoneyFile::hasMatchingOnlineBalance(const MyMoneyAccount& _acc) const | 3649 | bool MyMoneyFile::hasMatchingOnlineBalance(const MyMoneyAccount& _acc) const | ||
3649 | { | 3650 | { | ||
3650 | // get current values | 3651 | // get current values | ||
3651 | MyMoneyAccount acc = account(_acc.id()); | 3652 | auto acc = account(_acc.id()); | ||
3652 | 3653 | | |||
3653 | // if there's no last transaction import data we are done | 3654 | // if there's no last transaction import data we are done | ||
3654 | if (acc.value("lastImportedTransactionDate").isEmpty() | 3655 | if (acc.value("lastImportedTransactionDate").isEmpty() | ||
3655 | || acc.value("lastStatementBalance").isEmpty()) | 3656 | || acc.value("lastStatementBalance").isEmpty()) | ||
3656 | return false; | 3657 | return false; | ||
3657 | 3658 | | |||
3658 | // otherwise, we compare the balances | 3659 | // otherwise, we compare the balances | ||
3659 | MyMoneyMoney balance(acc.value("lastStatementBalance")); | 3660 | MyMoneyMoney balance(acc.value("lastStatementBalance")); | ||
Show All 15 Lines | 3672 | } | |||
3675 | */ | 3676 | */ | ||
3676 | void MyMoneyFile::fixSplitPrecision(MyMoneyTransaction& t) const | 3677 | void MyMoneyFile::fixSplitPrecision(MyMoneyTransaction& t) const | ||
3677 | { | 3678 | { | ||
3678 | QList<MyMoneySplit>::iterator its; | 3679 | QList<MyMoneySplit>::iterator its; | ||
3679 | MyMoneySecurity transactionSecurity = security(t.commodity()); | 3680 | MyMoneySecurity transactionSecurity = security(t.commodity()); | ||
3680 | int transactionFraction = transactionSecurity.smallestAccountFraction(); | 3681 | int transactionFraction = transactionSecurity.smallestAccountFraction(); | ||
3681 | 3682 | | |||
3682 | for(its = t.splits().begin(); its != t.splits().end(); ++its) { | 3683 | for(its = t.splits().begin(); its != t.splits().end(); ++its) { | ||
3683 | MyMoneyAccount acc = account((*its).accountId()); | 3684 | auto acc = account((*its).accountId()); | ||
3684 | int fraction = acc.fraction(); | 3685 | int fraction = acc.fraction(); | ||
3685 | if(fraction == -1) { | 3686 | if(fraction == -1) { | ||
3686 | MyMoneySecurity sec = security(acc.currencyId()); | 3687 | MyMoneySecurity sec = security(acc.currencyId()); | ||
3687 | fraction = acc.fraction(sec); | 3688 | fraction = acc.fraction(sec); | ||
3688 | } | 3689 | } | ||
3689 | (*its).setShares(static_cast<const MyMoneyMoney>((*its).shares().convertDenominator(fraction).canonicalize())); | 3690 | (*its).setShares(static_cast<const MyMoneyMoney>((*its).shares().convertDenominator(fraction).canonicalize())); | ||
3690 | (*its).setValue(static_cast<const MyMoneyMoney>((*its).value().convertDenominator(transactionFraction).canonicalize())); | 3691 | (*its).setValue(static_cast<const MyMoneyMoney>((*its).value().convertDenominator(transactionFraction).canonicalize())); | ||
3691 | } | 3692 | } | ||
▲ Show 20 Lines • Show All 60 Lines • Show Last 20 Lines |