Warn user when some operation dates are modified due to month restriction
This commit is contained in:
@@ -256,11 +256,12 @@ std::map<int, std::vector<int> > KissCount::GetAllOperations()
|
||||
return _db->GetAllOperations(_user);
|
||||
}
|
||||
|
||||
void KissCount::GenerateMonth(int monthFrom, int yearFrom, int monthTo, int yearTo)
|
||||
int KissCount::GenerateMonth(int monthFrom, int yearFrom, int monthTo, int yearTo)
|
||||
{
|
||||
std::vector<Operation>::iterator it, it2;
|
||||
std::map<int, int> meta;
|
||||
Operation op;
|
||||
int nb_update_days = 0;
|
||||
|
||||
_db->GenerateMonth(_user, monthFrom, yearFrom, monthTo, yearTo);
|
||||
|
||||
@@ -290,6 +291,7 @@ void KissCount::GenerateMonth(int monthFrom, int yearFrom, int monthTo, int year
|
||||
{
|
||||
QDate d(op.year, op.month+1, 1);
|
||||
op.day = d.daysInMonth()-1;
|
||||
nb_update_days++;
|
||||
}
|
||||
|
||||
(*_user->_operations[yearTo])[monthTo].push_back(op);
|
||||
@@ -317,6 +319,8 @@ void KissCount::GenerateMonth(int monthFrom, int yearFrom, int monthTo, int year
|
||||
}
|
||||
}
|
||||
_wxUI->GenerateMonth(monthTo, yearTo);
|
||||
|
||||
return nb_update_days;
|
||||
}
|
||||
|
||||
void KissCount::ChangePassword(const QString& password)
|
||||
|
||||
@@ -95,7 +95,7 @@ public:
|
||||
|
||||
std::map<int, std::vector<int> > GetAllOperations();
|
||||
|
||||
void GenerateMonth(int monthFrom, int yearFrom, int monthTo, int yearTo);
|
||||
int GenerateMonth(int monthFrom, int yearFrom, int monthTo, int yearTo);
|
||||
void KillMe();
|
||||
|
||||
void SetLanguage(QString language);
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
*/
|
||||
#include "GenerateDialog.hpp"
|
||||
#include <QLabel>
|
||||
#include <QMessageBox>
|
||||
|
||||
GenerateDialog::GenerateDialog(KissCount* kiss, wxUI *parent, int month, int year) : QDialog(0, Qt::Dialog), _kiss(kiss), _wxUI(parent)
|
||||
{
|
||||
@@ -210,7 +211,9 @@ void GenerateDialog::OnOK()
|
||||
|
||||
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
|
||||
close();
|
||||
_kiss->GenerateMonth(monthFrom, yearFrom, monthTo, yearTo);
|
||||
if (_kiss->GenerateMonth(monthFrom, yearFrom, monthTo, yearTo))
|
||||
QMessageBox::warning(0, _("Warning"), _("Some operations date has been updated"));
|
||||
|
||||
QApplication::restoreOverrideCursor();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user