示例#1
0
/* Report if there is no conversion rate for the currency passed in
   (curr_id in curr_symbol and curr_rate tables).
   curr_id < 0 indicates that we really want to report that no base currency
   has been defined (sNoConversionRate is overloaded to avoid duplicating its
   logic in sNoBase(QWidget*) below).
 */
static void sNoConversionRate(QWidget* parent, const int curr_id, const QDate& effective, const char *caller)
{
    bool displayMsg = false;
    QPair<int, QDate> currDatePair =
        qMakePair(curr_id, curr_id < 0 ? nullDate : effective);

    errorListLock.lock();
    DateToCurrMap::Iterator currMap = errorMap.find(currDatePair);	// int*
    if (currMap == errorMap.end())
    {
        errorMap[currDatePair] = 0;
        currMap = errorMap.find(currDatePair);
    }
    if (currMap.data() <= 0)
    {
        displayMsg = true;
        errorMap[currDatePair] = currMap.data() + 1;
    }
    errorListLock.unlock();

    if (displayMsg)
    {
        qWarning("%s::sNoConversionRate(%p, %d, %s, %s)",
                 (parent ? qPrintable(parent->objectName()) : "unknown"),
                 parent, curr_id, qPrintable(effective.toString()), caller);
        if (curr_id >= 0)
            QMessageBox::critical(parent,
                                  QObject::tr("No Currency Exchange Rate"),
                                  QObject::tr("<p>This document uses a currency which "
                                              "has no valid Exchange Rate. Please review your "
                                              "Exchange Rates to correct the problem. (%1 on %2)")
                                  .arg(curr_id)
                                  .arg(effective.toString()));
        else
            QMessageBox::critical(parent,
                                  QObject::tr("No Base Currency"),
                                  QObject::tr("<p>No base currency has been defined. "
                                              "Call your system administrator."));
    }
}
示例#2
0
/* Report if there is no conversion rate for the currency passed in
   (curr_id in curr_symbol and curr_rate tables).
   curr_id < 0 indicates that we really want to report that no base currency
   has been defined (sNoConversionRate is overloaded to avoid duplicating its
   logic in sNoBase(QWidget*) below).
 */
static void sNoConversionRate(QWidget* parent, const int curr_id, const QDate& effective)
{
    bool displayMsg = false;
    QPair<int, QDate> currDatePair =
        qMakePair(curr_id, curr_id < 0 ? nullDate : effective);

    errorListLock.lock();
    DateToCurrMap::Iterator currMap = errorMap.find(currDatePair);	// int*
    if (currMap == errorMap.end())
    {
        errorMap[currDatePair] = 0;
        currMap = errorMap.find(currDatePair);
    }
    if (currMap.data() <= 0)
    {
        displayMsg = true;
        errorMap[currDatePair] = currMap.data() + 1;
    }
    errorListLock.unlock();

    if (displayMsg)
    {
        if (curr_id >= 0)
            QMessageBox::critical(parent,
                                  QObject::tr("No Currency Exchange Rate"),
                                  QObject::tr("This document uses a currency which has "
                                              "no valid Exchange Rate.\nPlease review your "
                                              "Exchange Rates to correct the problem.\n(%1 on %2)")
                                  .arg(curr_id)
                                  .arg(effective.toString()));
        else
            QMessageBox::critical(parent,
                                  QObject::tr("No Base Currency"),
                                  QObject::tr("No base currency has been defined.\n"
                                              "Call your system administrator."));
    }
}