Forbid database upgrade from version 2 to version 3
Always display date in insertion and fix a bug in day display
This commit is contained in:
parent
aafc26c768
commit
3f428ab7c2
|
@ -90,6 +90,8 @@ static void Version_2_to_3(QSqlDatabase& _db)
|
||||||
req = "UPDATE account SET hidden='0'";
|
req = "UPDATE account SET hidden='0'";
|
||||||
|
|
||||||
UPDATE_TABLE("2", "3", "2");
|
UPDATE_TABLE("2", "3", "2");
|
||||||
|
|
||||||
|
ON_ERROR(_("Cannot update database version 2 to version 3 because some columns needs to be deleted."));
|
||||||
}
|
}
|
||||||
|
|
||||||
static update_func updates[] = {
|
static update_func updates[] = {
|
||||||
|
|
|
@ -441,7 +441,23 @@ void GridAccount::InsertOperation(User* user, Operation& op, int line, bool fix,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setItem(line, OP_DATE, new QTableWidgetItem(_kiss->FormatDate(curDate.day(), month+1, year)));
|
int day;
|
||||||
|
if (curDate.year() == year)
|
||||||
|
{
|
||||||
|
if (curDate.month() > (month+1))
|
||||||
|
day = QDate(year, month+1, 1).daysInMonth();
|
||||||
|
else if (curDate.month() < (month+1))
|
||||||
|
day = 1;
|
||||||
|
else
|
||||||
|
day = curDate.day();
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (curDate.year() > year)
|
||||||
|
day = QDate(year, month+1, 1).daysInMonth();
|
||||||
|
else
|
||||||
|
day = 1;
|
||||||
|
|
||||||
|
setItem(line, OP_DATE, new QTableWidgetItem(_kiss->FormatDate(day, month+1, year)));
|
||||||
SET_ROW_COLOR(line, view::OWN_GREEN, Qt::black);
|
SET_ROW_COLOR(line, view::OWN_GREEN, Qt::black);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1051,9 +1067,22 @@ void GridAccount::OnOperationModified(int row, int col)
|
||||||
}
|
}
|
||||||
if (!fix_cost)
|
if (!fix_cost)
|
||||||
{
|
{
|
||||||
if (_curMonth+1 == curDate.month() &&
|
int day;
|
||||||
_curYear == curDate.year())
|
if (curDate.year() == _curYear)
|
||||||
setItem(row, OP_DATE, new QTableWidgetItem(_kiss->FormatDate(curDate.day(), _curMonth+1, _curYear)));
|
{
|
||||||
|
if (curDate.month() > (_curMonth+1))
|
||||||
|
day = QDate(_curYear, _curMonth+1, 1).daysInMonth();
|
||||||
|
else if (curDate.month() < (_curMonth+1))
|
||||||
|
day = 1;
|
||||||
|
else
|
||||||
|
day = curDate.day();
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (curDate.year() > _curYear)
|
||||||
|
day = QDate(_curYear, _curMonth+1, 1).daysInMonth();
|
||||||
|
else
|
||||||
|
day = 1;
|
||||||
|
setItem(row, OP_DATE, new QTableWidgetItem(_kiss->FormatDate(day, _curMonth+1, _curYear)));
|
||||||
}
|
}
|
||||||
DEFAULT_FONT(font);
|
DEFAULT_FONT(font);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue