getPaymentOptionIndex():
Fix: make sure only one payment option can be chosen.
This commit is contained in:
parent
f02521d3c2
commit
6d2bde1fe9
@ -1547,48 +1547,48 @@ int getPaymentOptionIndex(Configuration const &cfg) {
|
||||
QDateTime const dt = QDateTime::currentDateTime();
|
||||
int const dayOfWeek = dt.date().dayOfWeek();
|
||||
|
||||
switch (dayOfWeek) {
|
||||
case (int)Qt::Monday: {
|
||||
if (pop_business_hours & BusinessHours::MON) {
|
||||
return opt;
|
||||
}
|
||||
} break;
|
||||
case (int)Qt::Tuesday: {
|
||||
if (pop_business_hours & BusinessHours::TUE) {
|
||||
return opt;
|
||||
}
|
||||
} break;
|
||||
case (int)Qt::Wednesday: {
|
||||
if (pop_business_hours & BusinessHours::WED) {
|
||||
return opt;
|
||||
}
|
||||
} break;
|
||||
case (int)Qt::Thursday: {
|
||||
if (pop_business_hours & BusinessHours::THU) {
|
||||
return opt;
|
||||
}
|
||||
} break;
|
||||
case (int)Qt::Friday: {
|
||||
if (pop_business_hours & BusinessHours::FRI) {
|
||||
return opt;
|
||||
}
|
||||
} break;
|
||||
case (int)Qt::Saturday: {
|
||||
if (pop_business_hours & BusinessHours::SAT) {
|
||||
return opt;
|
||||
}
|
||||
} break;
|
||||
case (int)Qt::Sunday: {
|
||||
if (pop_business_hours & BusinessHours::SUN) {
|
||||
return opt;
|
||||
}
|
||||
} break;
|
||||
}
|
||||
|
||||
if (isHoliday(cfg, dt)) {
|
||||
if (pop_business_hours & BusinessHours::OFFICIAL_HOLIDAY) {
|
||||
return opt;
|
||||
}
|
||||
} else {
|
||||
switch (dayOfWeek) {
|
||||
case (int)Qt::Monday: {
|
||||
if (pop_business_hours & BusinessHours::MON) {
|
||||
return opt;
|
||||
}
|
||||
} break;
|
||||
case (int)Qt::Tuesday: {
|
||||
if (pop_business_hours & BusinessHours::TUE) {
|
||||
return opt;
|
||||
}
|
||||
} break;
|
||||
case (int)Qt::Wednesday: {
|
||||
if (pop_business_hours & BusinessHours::WED) {
|
||||
return opt;
|
||||
}
|
||||
} break;
|
||||
case (int)Qt::Thursday: {
|
||||
if (pop_business_hours & BusinessHours::THU) {
|
||||
return opt;
|
||||
}
|
||||
} break;
|
||||
case (int)Qt::Friday: {
|
||||
if (pop_business_hours & BusinessHours::FRI) {
|
||||
return opt;
|
||||
}
|
||||
} break;
|
||||
case (int)Qt::Saturday: {
|
||||
if (pop_business_hours & BusinessHours::SAT) {
|
||||
return opt;
|
||||
}
|
||||
} break;
|
||||
case (int)Qt::Sunday: {
|
||||
if (pop_business_hours & BusinessHours::SUN) {
|
||||
return opt;
|
||||
}
|
||||
} break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1852,6 +1852,7 @@ Configuration::getWeekDayWorkTime(QTime const &time, Qt::DayOfWeek dayOfWeek) {
|
||||
|
||||
bool isHoliday(Configuration const &cfg, QDateTime const &t) {
|
||||
int const weekDay = t.date().dayOfWeek();
|
||||
|
||||
for (auto[iter, rEnd] = cfg.WeekDays.equal_range(static_cast<Qt::DayOfWeek>(weekDay));
|
||||
iter != rEnd;
|
||||
++iter) {
|
||||
|
Loading…
Reference in New Issue
Block a user