[office/kmymoney] /: Refactor sort code/routing number into bank code

Dawid Wróbel null at kde.org
Tue Nov 3 14:56:51 GMT 2020


Git commit 5f618d4f8fc7610585baf8050eb88e631b31e65f by Dawid Wróbel.
Committed on 22/10/2020 at 05:10.
Pushed by wrobelda into branch 'master'.

Refactor sort code/routing number into bank code

Sort Code is specific to UK, while routing number specific to US.
Both were being used in the code interchangeably, causing confusion. Use
generic Bank Code (http://en.wikipedia.org/wiki/Bank_code) term instead
where applicable.

Also amend the documentation to be more explicit about its purpose.

M  +3    -2    doc/details-institutions.docbook
M  +5    -3    doc/firsttime.docbook
M  +2    -2    kmymoney/dialogs/knewbankdlg.cpp
M  +3    -3    kmymoney/dialogs/knewbankdlg.ui
M  +1    -1    kmymoney/models/accountsproxymodel.cpp
M  +1    -1    kmymoney/models/institutionsproxymodel.cpp
M  +1    -1    kmymoney/models/modelenums.h
M  +1    -1    kmymoney/mymoney/mymoneyaccount.cpp
M  +1    -1    kmymoney/mymoney/mymoneyenums.h
M  +7    -7    kmymoney/mymoney/mymoneyinstitution.cpp
M  +3    -3    kmymoney/mymoney/mymoneyinstitution.h
M  +3    -4    kmymoney/mymoney/mymoneyinstitution_p.h
M  +4    -4    kmymoney/mymoney/mymoneystatement.cpp
M  +1    -1    kmymoney/mymoney/mymoneystatement.h
M  +3    -3    kmymoney/mymoney/storage/accountsmodel.cpp
M  +1    -1    kmymoney/mymoney/storage/accountsmodel.h
M  +2    -2    kmymoney/mymoney/storage/institutionsmodel.cpp
M  +4    -4    kmymoney/mymoney/tests/mymoneyfile-test.cpp
M  +2    -2    kmymoney/mymoney/tests/mymoneyinstitution-test.cpp
M  +8    -8    kmymoney/plugins/kbanking/kbanking.cpp
M  +4    -4    kmymoney/plugins/ofx/import/ofximporter.cpp
M  +2    -2    kmymoney/plugins/sql/mymoneystoragesql.cpp
M  +3    -3    kmymoney/plugins/sql/mymoneystoragesql_p.h
M  +1    -1    kmymoney/plugins/xml/mymoneystorageanon.cpp
M  +1    -1    kmymoney/plugins/xml/mymoneystoragenames.cpp
M  +1    -1    kmymoney/plugins/xml/mymoneystoragenames.h
M  +2    -2    kmymoney/plugins/xml/mymoneystoragexml.cpp
M  +1    -1    kmymoney/plugins/xml/tests/mymoneyxmlcontenthandler-test.cpp
M  +2    -2    kmymoney/wizards/newuserwizard/kaccountpage.ui
M  +1    -1    kmymoney/wizards/newuserwizard/knewuserwizard.cpp

https://invent.kde.org/office/kmymoney/commit/5f618d4f8fc7610585baf8050eb88e631b31e65f

diff --git a/doc/details-institutions.docbook b/doc/details-institutions.docbook
index cf592428e..c023681cc 100644
--- a/doc/details-institutions.docbook
+++ b/doc/details-institutions.docbook
@@ -210,8 +210,9 @@
   Only the name is required in the New Institution Dialog, all other fields are
   optional.  As with the personal information dialog, this data is not currently
   used by &kmymoney;, but will be required by future releases for certain
-  features.  In particular, the Routing Number and the <acronym><ulink
-  url="https://en.wikipedia.org/wiki/ISO_9362">BIC (Bank Identifier
+  features.  In particular, the <ulink
+  url="https://en.wikipedia.org/wiki/Bank_code">Bank Code</ulink> and the <acronym>
+  <ulink url="https://en.wikipedia.org/wiki/ISO_9362">BIC (Bank Identifier
   Code)</ulink></acronym> will be required for online banking.
 </para>
 </sect2>
diff --git a/doc/firsttime.docbook b/doc/firsttime.docbook
index 2c19fbe8f..855d603df 100644
--- a/doc/firsttime.docbook
+++ b/doc/firsttime.docbook
@@ -452,9 +452,11 @@
   the account and the opening balance of the account.  For example, you want to
   use &kmymoney; to manage all your finances as of 2008-01-01, then enter the
   balance of the account at the beginning of this date.  The number can possibly
-  be obtained from a paper statement.  Also enter the name and routing number of
-  the institution, though this information is optional and only required for
-  online banking purposes.
+  be obtained from a paper statement.  You may also enter the name and the bank
+  code of the institution.  The latter, known as the routing number in the US or 
+  the sort code in the UK, is optional and only required for online banking 
+  purposes, but it may also be helpful when importing bank statements in some of
+  the formats supported (OFX, QFX). 
 </para>
 
 <para>
diff --git a/kmymoney/dialogs/knewbankdlg.cpp b/kmymoney/dialogs/knewbankdlg.cpp
index 4c851e351..6a1cea8fa 100644
--- a/kmymoney/dialogs/knewbankdlg.cpp
+++ b/kmymoney/dialogs/knewbankdlg.cpp
@@ -89,7 +89,7 @@ KNewBankDlg::KNewBankDlg(MyMoneyInstitution& institution, QWidget *parent) :
   d->ui->streetEdit->setText(institution.street());
   d->ui->postcodeEdit->setText(institution.postcode());
   d->ui->telephoneEdit->setText(institution.telephone());
-  d->ui->sortCodeEdit->setText(institution.sortcode());
+  d->ui->bankCodeEdit->setText(institution.bankcode());
   d->ui->bicEdit->setText(institution.value(QStringLiteral("bic")));
   d->ui->urlEdit->setText(institution.value(QStringLiteral("url")));
 
@@ -149,7 +149,7 @@ void KNewBankDlg::okClicked()
   d->m_institution.setStreet(d->ui->streetEdit->text());
   d->m_institution.setPostcode(d->ui->postcodeEdit->text());
   d->m_institution.setTelephone(d->ui->telephoneEdit->text());
-  d->m_institution.setSortcode(d->ui->sortCodeEdit->text());
+  d->m_institution.setBankCode(d->ui->bankCodeEdit->text());
   d->m_institution.setValue(QStringLiteral("bic"), d->ui->bicEdit->text());
   d->m_institution.setValue(QStringLiteral("url"), d->ui->urlEdit->text());
   d->m_institution.deletePair(QStringLiteral("icon"));
diff --git a/kmymoney/dialogs/knewbankdlg.ui b/kmymoney/dialogs/knewbankdlg.ui
index fb60a4d36..c526e7229 100644
--- a/kmymoney/dialogs/knewbankdlg.ui
+++ b/kmymoney/dialogs/knewbankdlg.ui
@@ -66,7 +66,7 @@
        </widget>
       </item>
       <item row="5" column="1" colspan="4">
-       <widget class="KLineEdit" name="sortCodeEdit"/>
+       <widget class="KLineEdit" name="bankCodeEdit"/>
       </item>
       <item row="6" column="0">
        <widget class="QLabel" name="TextLabel7">
@@ -166,7 +166,7 @@
          </size>
         </property>
         <property name="text">
-         <string>Routing Number:</string>
+         <string>Bank Code:</string>
         </property>
         <property name="wordWrap">
          <bool>false</bool>
@@ -231,7 +231,7 @@
   <tabstop>streetEdit</tabstop>
   <tabstop>postcodeEdit</tabstop>
   <tabstop>telephoneEdit</tabstop>
-  <tabstop>sortCodeEdit</tabstop>
+  <tabstop>bankCodeEdit</tabstop>
   <tabstop>bicEdit</tabstop>
   <tabstop>urlEdit</tabstop>
   <tabstop>iconButton</tabstop>
diff --git a/kmymoney/models/accountsproxymodel.cpp b/kmymoney/models/accountsproxymodel.cpp
index d968b06a5..b4f9c50f5 100644
--- a/kmymoney/models/accountsproxymodel.cpp
+++ b/kmymoney/models/accountsproxymodel.cpp
@@ -234,7 +234,7 @@ bool AccountsProxyModel::acceptSourceItem(const QModelIndex &source) const
   if (source.isValid()) {
     const auto accountTypeValue = sourceModel()->data(source, eMyMoney::Model::Roles::AccountTypeRole);
     const bool isValidAccountEntry = accountTypeValue.isValid();
-    const bool isValidInstititonEntry = sourceModel()->data(source, eMyMoney::Model::Roles::InstitutionSortCodeRole).isValid();
+    const bool isValidInstititonEntry = sourceModel()->data(source, eMyMoney::Model::Roles::InstitutionBankCodeRole).isValid();
 
     if (isValidAccountEntry) {
       const auto accountType = static_cast<eMyMoney::Account::Type>(accountTypeValue.toInt());
diff --git a/kmymoney/models/institutionsproxymodel.cpp b/kmymoney/models/institutionsproxymodel.cpp
index 9554e82a8..c381c8be2 100644
--- a/kmymoney/models/institutionsproxymodel.cpp
+++ b/kmymoney/models/institutionsproxymodel.cpp
@@ -112,7 +112,7 @@ bool InstitutionsProxyModel::acceptSourceItem(const QModelIndex &source) const
   if (source.isValid()) {
     const auto accountTypeValue = sourceModel()->data(source, eMyMoney::Model::Roles::AccountTypeRole);
     const bool isValidAccountEntry = accountTypeValue.isValid();
-    const bool isValidInstititonEntry = sourceModel()->data(source, eMyMoney::Model::Roles::InstitutionSortCodeRole).isValid();
+    const bool isValidInstititonEntry = sourceModel()->data(source, eMyMoney::Model::Roles::InstitutionBankCodeRole).isValid();
 
     if (isValidAccountEntry) {
       const auto accountType = static_cast<eMyMoney::Account::Type>(accountTypeValue.toInt());
diff --git a/kmymoney/models/modelenums.h b/kmymoney/models/modelenums.h
index 775e43033..73a6cb39a 100644
--- a/kmymoney/models/modelenums.h
+++ b/kmymoney/models/modelenums.h
@@ -36,7 +36,7 @@ namespace eAccountsModel {
         PostedValue,
         TotalValue,
         AccountNumber,
-        AccountSortCode,
+        AccountBankCode,
         LastColumnMarker
     };
 
diff --git a/kmymoney/mymoney/mymoneyaccount.cpp b/kmymoney/mymoney/mymoneyaccount.cpp
index c7656128e..23bc42250 100644
--- a/kmymoney/mymoney/mymoneyaccount.cpp
+++ b/kmymoney/mymoney/mymoneyaccount.cpp
@@ -619,7 +619,7 @@ QList< payeeIdentifier > MyMoneyAccount::payeeIdentifiers() const
   if (!number().isEmpty()) {
     payeeIdentifierTyped<payeeIdentifiers::nationalAccount> national(new payeeIdentifiers::nationalAccount);
     national->setAccountNumber(number());
-    national->setBankCode(file->institution(institutionId()).sortcode());
+    national->setBankCode(file->institution(institutionId()).bankcode());
     if (file->user().state().length() == 2)
       national->setCountry(file->user().state());
     national->setOwnerName(file->user().name());
diff --git a/kmymoney/mymoney/mymoneyenums.h b/kmymoney/mymoney/mymoneyenums.h
index 0d30a8145..04d43b5c2 100644
--- a/kmymoney/mymoney/mymoneyenums.h
+++ b/kmymoney/mymoney/mymoneyenums.h
@@ -479,7 +479,7 @@ namespace eMyMoney {
       AccountIsAssetLiabilityRole,
 
       // MyMoneyInstitution
-      InstitutionSortCodeRole,
+      InstitutionBankCodeRole,
 
       // MyMoneyCostCenter
       CostCenterShortNameRole,
diff --git a/kmymoney/mymoney/mymoneyinstitution.cpp b/kmymoney/mymoney/mymoneyinstitution.cpp
index bdca0fb15..a1e9d270b 100644
--- a/kmymoney/mymoney/mymoneyinstitution.cpp
+++ b/kmymoney/mymoney/mymoneyinstitution.cpp
@@ -59,7 +59,7 @@ MyMoneyInstitution::MyMoneyInstitution(const QString& name,
                                        const QString& postcode,
                                        const QString& telephone,
                                        const QString& manager,
-                                       const QString& sortcode) :
+                                       const QString& bankcode) :
   MyMoneyObject(*new MyMoneyInstitutionPrivate),
   MyMoneyKeyValueContainer()
 {
@@ -71,7 +71,7 @@ MyMoneyInstitution::MyMoneyInstitution(const QString& name,
   d->m_postcode = postcode;
   d->m_telephone = telephone;
   d->m_manager = manager;
-  d->m_sortcode = sortcode;
+  d->m_bankcode = bankcode;
 }
 
 MyMoneyInstitution::MyMoneyInstitution(const MyMoneyInstitution& other) :
@@ -172,16 +172,16 @@ void MyMoneyInstitution::setCity(const QString& town)
   setTown(town);
 }
 
-QString MyMoneyInstitution::sortcode() const
+QString MyMoneyInstitution::bankcode() const
 {
   Q_D(const MyMoneyInstitution);
-  return d->m_sortcode;
+  return d->m_bankcode;
 }
 
-void MyMoneyInstitution::setSortcode(const QString& code)
+void MyMoneyInstitution::setBankCode(const QString& code)
 {
   Q_D(MyMoneyInstitution);
-  d->m_sortcode = code;
+  d->m_bankcode = code;
 }
 
 void MyMoneyInstitution::addAccountId(const QString& account)
@@ -239,7 +239,7 @@ bool MyMoneyInstitution::operator == (const MyMoneyInstitution& right) const
       ((d->m_street.length() == 0 && d2->m_street.length() == 0) || (d->m_street == d2->m_street)) &&
       ((d->m_postcode.length() == 0 && d2->m_postcode.length() == 0) || (d->m_postcode == d2->m_postcode)) &&
       ((d->m_telephone.length() == 0 && d2->m_telephone.length() == 0) || (d->m_telephone == d2->m_telephone)) &&
-      ((d->m_sortcode.length() == 0 && d2->m_sortcode.length() == 0) || (d->m_sortcode == d2->m_sortcode)) &&
+      ((d->m_bankcode.length() == 0 && d2->m_bankcode.length() == 0) || (d->m_bankcode == d2->m_bankcode)) &&
       ((d->m_manager.length() == 0 && d2->m_manager.length() == 0) || (d->m_manager == d2->m_manager)) &&
       (d->m_accountList == d2->m_accountList)) {
     return true;
diff --git a/kmymoney/mymoney/mymoneyinstitution.h b/kmymoney/mymoney/mymoneyinstitution.h
index 3a18ff6e8..42e864c42 100644
--- a/kmymoney/mymoney/mymoneyinstitution.h
+++ b/kmymoney/mymoney/mymoneyinstitution.h
@@ -70,7 +70,7 @@ public:
                               const QString& postcode,
                               const QString& telephone,
                               const QString& manager,
-                              const QString& sortCode);
+                              const QString& bankcode);
 
   MyMoneyInstitution(const MyMoneyInstitution & other);
   MyMoneyInstitution(MyMoneyInstitution && other);
@@ -111,8 +111,8 @@ public:
   QString city() const;
   void setCity(const QString& town);
 
-  QString sortcode() const;
-  void setSortcode(const QString& code);
+  QString bankcode() const;
+  void setBankCode(const QString& code);
 
   /**
     * This method adds the id of an account to the account list of
diff --git a/kmymoney/mymoney/mymoneyinstitution_p.h b/kmymoney/mymoney/mymoneyinstitution_p.h
index 5ef9f691e..88e3070c6 100644
--- a/kmymoney/mymoney/mymoneyinstitution_p.h
+++ b/kmymoney/mymoney/mymoneyinstitution_p.h
@@ -74,11 +74,10 @@ public:
   QString m_manager;
 
   /**
-    * This member variable keeps the sort code of the institution.
-    * FIXME: I have no idea
-    * what it is good for. I keep it because it was in the old engine.
+    * This member variable keeps the bank code (e.g. sort code,
+    * routing number) of the institution.
     */
-  QString m_sortcode;
+  QString m_bankcode;
 
   /**
     * This member variable keeps the sorted list of the account ids
diff --git a/kmymoney/mymoney/mymoneystatement.cpp b/kmymoney/mymoney/mymoneystatement.cpp
index bdcfcc9c8..6dc4e5bcb 100644
--- a/kmymoney/mymoney/mymoneystatement.cpp
+++ b/kmymoney/mymoney/mymoneystatement.cpp
@@ -52,7 +52,7 @@ namespace eMyMoney {
       Version,
       AccountName,
       AccountNumber,
-      RoutingNumber,
+      BankCode,
       Currency,
       BeginDate,
       EndDate,
@@ -124,7 +124,7 @@ QString getAttrName(const Statement::Attribute attr)
     {Statement::Attribute::Version,              QStringLiteral("version")},
     {Statement::Attribute::AccountName,          QStringLiteral("accountname")},
     {Statement::Attribute::AccountNumber,        QStringLiteral("accountnumber")},
-    {Statement::Attribute::RoutingNumber,        QStringLiteral("routingnumber")},
+    {Statement::Attribute::BankCode,             QStringLiteral("routingnumber")},
     {Statement::Attribute::Currency,             QStringLiteral("currency")},
     {Statement::Attribute::BeginDate,            QStringLiteral("begindate")},
     {Statement::Attribute::EndDate,              QStringLiteral("enddate")},
@@ -156,7 +156,7 @@ void MyMoneyStatement::write(QDomElement& _root, QDomDocument* _doc) const
   e.setAttribute(getAttrName(Statement::Attribute::Version), QStringLiteral("1.1"));
   e.setAttribute(getAttrName(Statement::Attribute::AccountName), m_strAccountName);
   e.setAttribute(getAttrName(Statement::Attribute::AccountNumber), m_strAccountNumber);
-  e.setAttribute(getAttrName(Statement::Attribute::RoutingNumber), m_strRoutingNumber);
+  e.setAttribute(getAttrName(Statement::Attribute::BankCode), m_strBankCode);
   e.setAttribute(getAttrName(Statement::Attribute::Currency), m_strCurrency);
   e.setAttribute(getAttrName(Statement::Attribute::BeginDate), m_dateBegin.toString(Qt::ISODate));
   e.setAttribute(getAttrName(Statement::Attribute::EndDate), m_dateEnd.toString(Qt::ISODate));
@@ -227,7 +227,7 @@ bool MyMoneyStatement::read(const QDomElement& _e)
 
     m_strAccountName = _e.attribute(getAttrName(Statement::Attribute::AccountName));
     m_strAccountNumber = _e.attribute(getAttrName(Statement::Attribute::AccountNumber));
-    m_strRoutingNumber = _e.attribute(getAttrName(Statement::Attribute::RoutingNumber));
+    m_strBankCode = _e.attribute(getAttrName(Statement::Attribute::BankCode));
     m_strCurrency = _e.attribute(getAttrName(Statement::Attribute::Currency));
     m_dateBegin = QDate::fromString(_e.attribute(getAttrName(Statement::Attribute::BeginDate)), Qt::ISODate);
     m_dateEnd = QDate::fromString(_e.attribute(getAttrName(Statement::Attribute::EndDate)), Qt::ISODate);
diff --git a/kmymoney/mymoney/mymoneystatement.h b/kmymoney/mymoney/mymoneystatement.h
index d77d1a7fa..8f5452da2 100644
--- a/kmymoney/mymoney/mymoneystatement.h
+++ b/kmymoney/mymoney/mymoneystatement.h
@@ -91,7 +91,7 @@ public:
 
   QString m_strAccountName;
   QString m_strAccountNumber;
-  QString m_strRoutingNumber;
+  QString m_strBankCode;
 
   /**
    * The statement provider's information for the statement reader how to find the
diff --git a/kmymoney/mymoney/storage/accountsmodel.cpp b/kmymoney/mymoney/storage/accountsmodel.cpp
index 4c21853ec..f73a82d15 100644
--- a/kmymoney/mymoney/storage/accountsmodel.cpp
+++ b/kmymoney/mymoney/storage/accountsmodel.cpp
@@ -367,8 +367,8 @@ QVariant AccountsModel::headerData(int section, Qt::Orientation orientation, int
         return i18n("Total Value");
       case Column::Number:
         return i18n("Number");
-      case Column::SortCode:
-        return i18n("SortCode");
+      case Column::BankCode:
+        return i18nc("Consider using both generic and the language-specific term, if one is common, e.g. 'Bank Code (Routing Code)' (en_US) or 'Bank Code (Sort Code)' (en_GB)", "Bank Code");
       default:
         return QVariant();
     }
@@ -452,7 +452,7 @@ QVariant AccountsModel::data(const QModelIndex& idx, int role) const
         case Column::Number:
           return account.number();
 
-        case Column::SortCode:
+        case Column::BankCode:
           return account.value("iban");
 
         default:
diff --git a/kmymoney/mymoney/storage/accountsmodel.h b/kmymoney/mymoney/storage/accountsmodel.h
index 6f317e73d..a7dc3f1e3 100644
--- a/kmymoney/mymoney/storage/accountsmodel.h
+++ b/kmymoney/mymoney/storage/accountsmodel.h
@@ -53,7 +53,7 @@ public:
     PostedValue,
     TotalPostedValue,
     Number,
-    SortCode,
+    BankCode,
     Balance,
     // insert new columns above this line
     MaxColumns
diff --git a/kmymoney/mymoney/storage/institutionsmodel.cpp b/kmymoney/mymoney/storage/institutionsmodel.cpp
index 8b7214d79..abec0829a 100644
--- a/kmymoney/mymoney/storage/institutionsmodel.cpp
+++ b/kmymoney/mymoney/storage/institutionsmodel.cpp
@@ -179,8 +179,8 @@ QVariant InstitutionsModel::data(const QModelIndex& idx, int role) const
     case eMyMoney::Model::Roles::IdRole:
       return institution.id();
 
-    case eMyMoney::Model::InstitutionSortCodeRole:
-      return institution.sortcode();
+    case eMyMoney::Model::InstitutionBankCodeRole:
+      return institution.bankcode();
 
     case eMyMoney::Model::AccountDisplayOrderRole:
       // make sure the no bank assigned accounts show up at the top
diff --git a/kmymoney/mymoney/tests/mymoneyfile-test.cpp b/kmymoney/mymoney/tests/mymoneyfile-test.cpp
index 34e587752..fe9153807 100644
--- a/kmymoney/mymoney/tests/mymoneyfile-test.cpp
+++ b/kmymoney/mymoney/tests/mymoneyfile-test.cpp
@@ -152,7 +152,7 @@ void MyMoneyFileTest::testAddOneInstitution()
   institution.setPostcode("postcode");
   institution.setTelephone("telephone");
   institution.setManager("manager");
-  institution.setSortcode("sortcode");
+  institution.setBankCode("sortcode");
 
   // MyMoneyInstitution institution_file("", institution);
   MyMoneyInstitution institution_id("I000002", institution);
@@ -217,7 +217,7 @@ void MyMoneyFileTest::testAddTwoInstitutions()
   institution.setPostcode("postcode");
   institution.setTelephone("telephone");
   institution.setManager("manager");
-  institution.setSortcode("sortcode");
+  institution.setBankCode("sortcode");
 
   m->setDirty(false);
 
@@ -372,7 +372,7 @@ void MyMoneyFileTest::testInstitutionModify()
   institution.setTelephone("new telephone");
   institution.setManager("new manager");
   institution.setName("new name");
-  institution.setSortcode("new sortcode");
+  institution.setBankCode("new sortcode");
 
   m->setDirty(false);
 
@@ -405,7 +405,7 @@ void MyMoneyFileTest::testInstitutionModify()
   QCOMPARE(newInstitution.telephone(), QLatin1String("new telephone"));
   QCOMPARE(newInstitution.manager(), QLatin1String("new manager"));
   QCOMPARE(newInstitution.name(), QLatin1String("new name"));
-  QCOMPARE(newInstitution.sortcode(), QLatin1String("new sortcode"));
+  QCOMPARE(newInstitution.bankcode(), QLatin1String("new sortcode"));
 
   m->setDirty(false);
 
diff --git a/kmymoney/mymoney/tests/mymoneyinstitution-test.cpp b/kmymoney/mymoney/tests/mymoneyinstitution-test.cpp
index df6c4838e..52bb07dc4 100644
--- a/kmymoney/mymoney/tests/mymoneyinstitution-test.cpp
+++ b/kmymoney/mymoney/tests/mymoneyinstitution-test.cpp
@@ -82,7 +82,7 @@ void MyMoneyInstitutionTest::testNonemptyConstructor()
   QVERIFY(n->telephone() == "telephone");
   QVERIFY(n->manager() == "manager");
   QVERIFY(n->name() == "name");
-  QVERIFY(n->sortcode() == "sortcode");
+  QVERIFY(n->bankcode() == "sortcode");
 }
 
 void MyMoneyInstitutionTest::testCopyConstructor()
@@ -105,7 +105,7 @@ void MyMoneyInstitutionTest::testMyMoneyFileConstructor()
   QVERIFY(t->telephone() == "telephone");
   QVERIFY(t->manager() == "manager");
   QVERIFY(t->name() == "name");
-  QVERIFY(t->sortcode() == "sortcode");
+  QVERIFY(t->bankcode() == "sortcode");
 }
 
 void MyMoneyInstitutionTest::testEquality()
diff --git a/kmymoney/plugins/kbanking/kbanking.cpp b/kmymoney/plugins/kbanking/kbanking.cpp
index d38b14199..11d5461a6 100644
--- a/kmymoney/plugins/kbanking/kbanking.cpp
+++ b/kmymoney/plugins/kbanking/kbanking.cpp
@@ -450,9 +450,9 @@ void KBanking::setupAccountReference(const MyMoneyAccount& acc, AB_ACCOUNT_SPEC*
 
   if (ab_acc) {
     QString accountNumber = stripLeadingZeroes(AB_AccountSpec_GetAccountNumber(ab_acc));
-    QString routingNumber = stripLeadingZeroes(AB_AccountSpec_GetBankCode(ab_acc));
+    QString bankCode = stripLeadingZeroes(AB_AccountSpec_GetBankCode(ab_acc));
 
-    QString val = QString("%1-%2-%3").arg(routingNumber, accountNumber).arg(AB_AccountSpec_GetType(ab_acc));
+    QString val = QString("%1-%2-%3").arg(bankCode, accountNumber).arg(AB_AccountSpec_GetType(ab_acc));
 
     if (val != acc.onlineBankingSettings().value("kbanking-acc-ref")) {
       kvp.clear();
@@ -1035,13 +1035,13 @@ bool KBankingExt::askMapAccount(const MyMoneyAccount& acc)
 
   QString bankId;
   QString accountId;
-  // extract some information about the bank. if we have a sortcode
+  // extract some information about the bank. if we have a bank code
   // (BLZ) we display it, otherwise the name is enough.
   try {
     const MyMoneyInstitution &bank = file->institution(acc.institutionId());
     bankId = bank.name();
-    if (!bank.sortcode().isEmpty())
-      bankId = bank.sortcode();
+    if (!bank.bankcode().isEmpty())
+      bankId = bank.bankcode();
   } catch (const MyMoneyException &e) {
     // no bank assigned, we just leave the field empty
   }
@@ -1441,12 +1441,12 @@ bool KBankingExt::importAccountInfo(AB_IMEXPORTER_CONTEXT *ctx,
 
   p = AB_ImExporterAccountInfo_GetBankCode(ai);
   if (p) {
-    ks.m_strRoutingNumber = m_parent->stripLeadingZeroes(p);
+    ks.m_strBankCode = m_parent->stripLeadingZeroes(p);
   }
 
   MyMoneyAccount kacc;
-  if (!ks.m_strAccountNumber.isEmpty() || !ks.m_strRoutingNumber.isEmpty()) {
-    kacc = m_parent->account("kbanking-acc-ref", QString("%1-%2-%3").arg(ks.m_strRoutingNumber, ks.m_strAccountNumber).arg(AB_ImExporterAccountInfo_GetAccountType(ai)));
+  if (!ks.m_strAccountNumber.isEmpty() || !ks.m_strBankCode.isEmpty()) {
+    kacc = m_parent->account("kbanking-acc-ref", QString("%1-%2-%3").arg(ks.m_strBankCode, ks.m_strAccountNumber).arg(AB_ImExporterAccountInfo_GetAccountType(ai)));
     ks.m_accountId = kacc.id();
   }
 
diff --git a/kmymoney/plugins/ofx/import/ofximporter.cpp b/kmymoney/plugins/ofx/import/ofximporter.cpp
index 308b3db74..370abdc52 100644
--- a/kmymoney/plugins/ofx/import/ofximporter.cpp
+++ b/kmymoney/plugins/ofx/import/ofximporter.cpp
@@ -689,10 +689,10 @@ int OFXImporter::ofxAccountCallback(struct OfxAccountData data, void * pv)
     s.m_strAccountNumber = QString::fromUtf8(data.account_id);
   }
   if (data.bank_id_valid) {
-    s.m_strRoutingNumber = QString::fromUtf8(data.bank_id);
+    s.m_strBankCode = QString::fromUtf8(data.bank_id);
   }
   if (data.broker_id_valid) {
-    s.m_strRoutingNumber = QString::fromUtf8(data.broker_id);
+    s.m_strBankCode = QString::fromUtf8(data.broker_id);
   }
   if (data.currency_valid) {
     s.m_strCurrency = QString::fromUtf8(data.currency);
@@ -719,8 +719,8 @@ int OFXImporter::ofxAccountCallback(struct OfxAccountData data, void * pv)
 
   // ask KMyMoney for an account id
   // but only if we have any information to ask for
-  if (!s.m_strAccountNumber.isEmpty() || !s.m_strRoutingNumber.isEmpty()) {
-    s.m_accountId = pofx->account(QStringLiteral("kmmofx-acc-ref"), QString("%1-%2").arg(s.m_strRoutingNumber, s.m_strAccountNumber)).id();
+  if (!s.m_strAccountNumber.isEmpty() || !s.m_strBankCode.isEmpty()) {
+    s.m_accountId = pofx->account(QStringLiteral("kmmofx-acc-ref"), QString("%1-%2").arg(s.m_strBankCode, s.m_strAccountNumber)).id();
   }
 
   // copy over the securities
diff --git a/kmymoney/plugins/sql/mymoneystoragesql.cpp b/kmymoney/plugins/sql/mymoneystoragesql.cpp
index 587346126..83ad25744 100644
--- a/kmymoney/plugins/sql/mymoneystoragesql.cpp
+++ b/kmymoney/plugins/sql/mymoneystoragesql.cpp
@@ -1208,7 +1208,7 @@ QMap<QString, MyMoneyInstitution> MyMoneyStorageSql::fetchInstitutions(const QSt
   int idCol = t.fieldNumber("id");
   int nameCol = t.fieldNumber("name");
   int managerCol = t.fieldNumber("manager");
-  int routingCodeCol = t.fieldNumber("routingCode");
+  int bankCodeCol = t.fieldNumber("routingCode");
   int addressStreetCol = t.fieldNumber("addressStreet");
   int addressCityCol = t.fieldNumber("addressCity");
   int addressZipcodeCol = t.fieldNumber("addressZipcode");
@@ -1220,7 +1220,7 @@ QMap<QString, MyMoneyInstitution> MyMoneyStorageSql::fetchInstitutions(const QSt
     QString iid = GETSTRING(idCol);
     inst.setName(GETSTRING(nameCol));
     inst.setManager(GETSTRING(managerCol));
-    inst.setSortcode(GETSTRING(routingCodeCol));
+    inst.setBankCode(GETSTRING(bankCodeCol));
     inst.setStreet(GETSTRING(addressStreetCol));
     inst.setCity(GETSTRING(addressCityCol));
     inst.setPostcode(GETSTRING(addressZipcodeCol));
diff --git a/kmymoney/plugins/sql/mymoneystoragesql_p.h b/kmymoney/plugins/sql/mymoneystoragesql_p.h
index 4e83dac36..094947529 100644
--- a/kmymoney/plugins/sql/mymoneystoragesql_p.h
+++ b/kmymoney/plugins/sql/mymoneystoragesql_p.h
@@ -956,7 +956,7 @@ public:
     QVariantList idList;
     QVariantList nameList;
     QVariantList managerList;
-    QVariantList routingCodeList;
+    QVariantList bankCodeList;
     QVariantList addressStreetList;
     QVariantList addressCityList;
     QVariantList addressZipcodeList;
@@ -967,7 +967,7 @@ public:
       idList << i.id();
       nameList << i.name();
       managerList << i.manager();
-      routingCodeList << i.sortcode();
+      bankCodeList << i.bankcode();
       addressStreetList << i.street();
       addressCityList << i.city();
       addressZipcodeList << i.postcode();
@@ -978,7 +978,7 @@ public:
     query.bindValue(":id", idList);
     query.bindValue(":name", nameList);
     query.bindValue(":manager", managerList);
-    query.bindValue(":routingCode", routingCodeList);
+    query.bindValue(":routingCode", bankCodeList);
     query.bindValue(":addressStreet", addressStreetList);
     query.bindValue(":addressCity", addressCityList);
     query.bindValue(":addressZipcode", addressZipcodeList);
diff --git a/kmymoney/plugins/xml/mymoneystorageanon.cpp b/kmymoney/plugins/xml/mymoneystorageanon.cpp
index cc551b4a9..a69abf63b 100644
--- a/kmymoney/plugins/xml/mymoneystorageanon.cpp
+++ b/kmymoney/plugins/xml/mymoneystorageanon.cpp
@@ -103,7 +103,7 @@ void MyMoneyStorageANON::writeInstitution(QDomElement& institution, const MyMone
   // mangle fields
   i.setName(i.id());
   i.setManager(hideString(i.manager()));
-  i.setSortcode(hideString(i.sortcode()));
+  i.setBankCode(hideString(i.bankcode()));
 
   i.setStreet(hideString(i.street()));
   i.setCity(hideString(i.city()));
diff --git a/kmymoney/plugins/xml/mymoneystoragenames.cpp b/kmymoney/plugins/xml/mymoneystoragenames.cpp
index 613e9b49a..e0f62af0b 100644
--- a/kmymoney/plugins/xml/mymoneystoragenames.cpp
+++ b/kmymoney/plugins/xml/mymoneystoragenames.cpp
@@ -322,7 +322,7 @@ QString attributeName(Attribute::Institution attributeID)
     {Attribute::Institution::ID,         QStringLiteral("id")},
     {Attribute::Institution::Name,       QStringLiteral("name")},
     {Attribute::Institution::Manager,    QStringLiteral("manager")},
-    {Attribute::Institution::SortCode,   QStringLiteral("sortcode")},
+    {Attribute::Institution::BankCode,   QStringLiteral("sortcode")},
     {Attribute::Institution::Street,     QStringLiteral("street")},
     {Attribute::Institution::City,       QStringLiteral("city")},
     {Attribute::Institution::Zip,        QStringLiteral("zip")},
diff --git a/kmymoney/plugins/xml/mymoneystoragenames.h b/kmymoney/plugins/xml/mymoneystoragenames.h
index acc83b345..d3d5c6fcf 100644
--- a/kmymoney/plugins/xml/mymoneystoragenames.h
+++ b/kmymoney/plugins/xml/mymoneystoragenames.h
@@ -257,7 +257,7 @@ namespace Attribute {
     ID = 0,
     Name,
     Manager,
-    SortCode,
+    BankCode,
     Street,
     City,
     Zip,
diff --git a/kmymoney/plugins/xml/mymoneystoragexml.cpp b/kmymoney/plugins/xml/mymoneystoragexml.cpp
index b22471a2c..c738f479f 100644
--- a/kmymoney/plugins/xml/mymoneystoragexml.cpp
+++ b/kmymoney/plugins/xml/mymoneystoragexml.cpp
@@ -1129,7 +1129,7 @@ MyMoneyInstitution MyMoneyXmlContentHandler::readInstitution(const QDomElement &
 
   addToKeyValueContainer(institution, node.elementsByTagName(nodeName(Node::KeyValuePairs)).item(0).toElement());
 
-  institution.setSortcode(node.attribute(attributeName(Attribute::Institution::SortCode)));
+  institution.setBankCode(node.attribute(attributeName(Attribute::Institution::BankCode)));
   institution.setName(node.attribute(attributeName(Attribute::Institution::Name)));
   institution.setManager(node.attribute(attributeName(Attribute::Institution::Manager)));
 
@@ -1161,7 +1161,7 @@ void MyMoneyXmlContentHandler::writeInstitution(const MyMoneyInstitution &instit
 
   el.setAttribute(attributeName(Attribute::Institution::Name), institution.name());
   el.setAttribute(attributeName(Attribute::Institution::Manager), institution.manager());
-  el.setAttribute(attributeName(Attribute::Institution::SortCode), institution.sortcode());
+  el.setAttribute(attributeName(Attribute::Institution::BankCode), institution.bankcode());
 
   auto address = document.createElement(elementName(Element::Institution::Address));
   address.setAttribute(attributeName(Attribute::Institution::Street), institution.street());
diff --git a/kmymoney/plugins/xml/tests/mymoneyxmlcontenthandler-test.cpp b/kmymoney/plugins/xml/tests/mymoneyxmlcontenthandler-test.cpp
index 9076e748d..37578bb99 100644
--- a/kmymoney/plugins/xml/tests/mymoneyxmlcontenthandler-test.cpp
+++ b/kmymoney/plugins/xml/tests/mymoneyxmlcontenthandler-test.cpp
@@ -964,7 +964,7 @@ void MyMoneyXmlContentHandlerTest::readInstitution()
     alist << "A000001" << "A000003";
     i = MyMoneyXmlContentHandler::readInstitution(node);
 
-    QVERIFY(i.sortcode() == "sortcode");
+    QVERIFY(i.bankcode() == "sortcode");
     QVERIFY(i.id() == "I00001");
     QVERIFY(i.manager() == "manager");
     QVERIFY(i.name() == "name");
diff --git a/kmymoney/wizards/newuserwizard/kaccountpage.ui b/kmymoney/wizards/newuserwizard/kaccountpage.ui
index 1b65c4fb6..a2b7cba20 100644
--- a/kmymoney/wizards/newuserwizard/kaccountpage.ui
+++ b/kmymoney/wizards/newuserwizard/kaccountpage.ui
@@ -56,7 +56,7 @@
             <item row="6" column="1">
               <widget class="KLineEdit" name="m_institutionNumberEdit">
                 <property name="whatsThis" stdset="0">
-                  <string>Each institution has a routing number. Enter it here. If uncertain, leave the field blank. You can modify it later.</string>
+                  <string>Each institution has a bank code, known as routing number in the US or a sort code in the UK. Enter it here. If uncertain, leave the field blank. You can modify it later.</string>
                 </property>
               </widget>
             </item>
@@ -73,7 +73,7 @@
             <item row="6" column="0">
               <widget class="QLabel" name="textLabel4">
                 <property name="text">
-                  <string>Routing number</string>
+                  <string>Bank Code</string>
                 </property>
                 <property name="wordWrap">
                   <bool>false</bool>
diff --git a/kmymoney/wizards/newuserwizard/knewuserwizard.cpp b/kmymoney/wizards/newuserwizard/knewuserwizard.cpp
index 089133a04..9bafda95c 100644
--- a/kmymoney/wizards/newuserwizard/knewuserwizard.cpp
+++ b/kmymoney/wizards/newuserwizard/knewuserwizard.cpp
@@ -107,7 +107,7 @@ namespace NewUserWizard
       if (d->m_accountPage->d_func()->ui->m_institutionNameEdit->text().length()) {
         inst.setName(d->m_accountPage->d_func()->ui->m_institutionNameEdit->text());
         if (d->m_accountPage->d_func()->ui->m_institutionNumberEdit->text().length())
-          inst.setSortcode(d->m_accountPage->d_func()->ui->m_institutionNumberEdit->text());
+          inst.setBankCode(d->m_accountPage->d_func()->ui->m_institutionNumberEdit->text());
       }
     }
     return inst;



More information about the kde-doc-english mailing list