From 34bbd08de66e3c6f0b01453d5b84774b0d86f59a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Sat, 8 Feb 2014 12:21:07 +0100 Subject: [PATCH] Fix a bug in generate month : if the next month has less days than the first, but there are operations on non existings days, use last day of new month. --- src/controller/KissCount.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/controller/KissCount.cpp b/src/controller/KissCount.cpp index 3697276..4371890 100644 --- a/src/controller/KissCount.cpp +++ b/src/controller/KissCount.cpp @@ -285,6 +285,13 @@ void KissCount::GenerateMonth(int monthFrom, int yearFrom, int monthTo, int year op._virtual = false; if (op.meta) meta[it->id] = op.id; + + if (!QDate::isValid(op.year, op.month+1, op.day+1)) + { + QDate d(op.year, op.month+1, 1); + op.day = d.daysInMonth()-1; + } + (*_user->_operations[yearTo])[monthTo].push_back(op); }