diff --git a/chat/views.py b/chat/views.py index 0cb0985..95ba670 100644 --- a/chat/views.py +++ b/chat/views.py @@ -65,7 +65,7 @@ class ChatUpdateGroupChat(LoginRequiredMixin, UpdateView): return super().form_valid(form) def get_context_data(self, **kwargs): - context = super(ChatUpdateGroupChat, self).get_context_data(**kwargs) + context = super(ChatUpdateGroupChat, self).get_context_data(**kwargs) context['active_link'] = 'chat' print(context) return context diff --git a/standards/templatetags/__pycache__/counter_tag.cpython-38.pyc b/standards/templatetags/__pycache__/counter_tag.cpython-38.pyc index 8e6e9a6..747c3fc 100644 Binary files a/standards/templatetags/__pycache__/counter_tag.cpython-38.pyc and b/standards/templatetags/__pycache__/counter_tag.cpython-38.pyc differ diff --git a/standards/templatetags/counter_tag.py b/standards/templatetags/counter_tag.py index f221c7d..d65c8bf 100644 --- a/standards/templatetags/counter_tag.py +++ b/standards/templatetags/counter_tag.py @@ -486,7 +486,7 @@ def getMessageDayInfo(info): def getUserIsRep(user): # REPRESENTATOR today = date.today() - absence = Absence.objects.filter(agency=user.profile.agency, representator=user, start__lte=today, end__gte=today) + absence = Absence.objects.filter(agency=user.profile.agency, representator=user, start__lte=today, end__gte=today, confirm_status=0) repstring = False if(len(absence) > 0): @@ -499,7 +499,7 @@ def getUserIsRep(user): ab_counter += 1 # IN HOLIDAY? - absence_holiday = Absence.objects.filter(agency=user.profile.agency, user=user, start__lte=today, end__gte=today, reason__is_holiday=True) + absence_holiday = Absence.objects.filter(agency=user.profile.agency, user=user, start__lte=today, end__gte=today, reason__is_holiday=True, confirm_status=0) if(len(absence_holiday) > 0): repstring = "Wir wünschen Ihnen noch bis zum " + absence_holiday[0].end.strftime("%d.%m.%Y") + " einen schönen Urlaub!" diff --git a/timemanagement/views.py b/timemanagement/views.py index d3c2eb7..1ade4d5 100644 --- a/timemanagement/views.py +++ b/timemanagement/views.py @@ -246,7 +246,7 @@ def AbsenceManagmenet(request, activemonth=False, activeyear=False): allreasons = AbsenceReason.objects.filter(agency=request.user.profile.agency).order_by("name") final_reasons = [] for ar in allreasons: - tempabsece = Absence.objects.filter(reason=ar, user=request.user, start__year=activeyear) + tempabsece = Absence.objects.filter(reason=ar, user=request.user, start__year=activeyear, confirm_status=0) temp_sum = 0.0 for t in tempabsece: temp_sum += calculatingHolidaysByAbsence(request, t) @@ -635,7 +635,7 @@ def TimeAjax(request): # POrüfen, ob es in diesem Zeitraum noch andere Abwesenheiten gibt - other_absences = Absence.objects.filter(start__lte=absence.start, end__gte=absence.end, agency=request.user.profile.agency).exclude(user=absence.user) + other_absences = Absence.objects.filter(start__lte=absence.start, end__gte=absence.end, agency=request.user.profile.agency, confirm_status=0).exclude(user=absence.user) other_absences_string = False if (len(other_absences) > 0): @@ -661,6 +661,28 @@ def TimeAjax(request): # Eingeloggter Nutzer hat Rechte, Urlaube einzutragen if(absence.user.profile.agency == request.user.profile.agency and request.user.has_perm("users.absencemanager")): absence.confirm_status = new_stat + + # Wenn eine Abwesenheit abgelehnt wurde, werden hier die Tage wieder auf das Kontingent geschrieben. Die Abewesenheit selber wird aber nicht gelöscht, sondern ist dann einfach "leer" + if(new_stat == "2"): + year = absence.start.year + userabinfo_thisyear = list(UserYearAbsenceInfo.objects.filter(user=absence.user, year=year))[0] + userabinfo_nextyear = list(UserYearAbsenceInfo.objects.filter(user=absence.user, year=year+1))[0] + + userabinfo_thisyear.days_inuse = userabinfo_thisyear.days_inuse - absence.holidays_normal - absence.holidays_rest + userabinfo_thisyear.restdays = userabinfo_thisyear.restdays + absence.holidays_rest + + userabinfo_nextyear.days_inuse = userabinfo_nextyear.days_inuse - absence.holidays_normal_next - absence.holidays_rest_next + userabinfo_nextyear.restdays = userabinfo_nextyear.restdays + absence.holidays_rest_next + + userabinfo_thisyear.save() + userabinfo_nextyear.save() + + absence.holidays_normal = 0 + absence.holidays_rest = 0 + absence.holidays_normal_next = 0 + absence.holidays_rest_next = 0 + + absence.confirm_info = info post_save.disconnect(save_newabsence, sender=Absence) absence.save() @@ -776,7 +798,7 @@ def TimeAjax(request): days_nextyear_normal = temprest * -1 # POrüfen, ob es in diesem Zeitraum noch andere Abwesenheiten gibt - other_absences = Absence.objects.filter(start__lte=start_day_obj, end__gte=end_day_obj, agency=request.user.profile.agency).exclude(user=user) + other_absences = Absence.objects.filter(start__lte=start_day_obj, end__gte=end_day_obj, agency=request.user.profile.agency, confirm_status=0).exclude(user=user) other_absences_string = False if (len(other_absences) > 0): @@ -786,8 +808,8 @@ def TimeAjax(request): # Prüfen, ob der Nutzer selbst schon Abwesenheiten in diesem Zeitraum hat - userown_absences = Absence.objects.filter(start__lte=start_day_obj, end__gte=end_day_obj, agency=request.user.profile.agency, user=user) - print(userown_absences) + userown_absences = Absence.objects.filter(start__lte=start_day_obj, end__gte=end_day_obj, agency=request.user.profile.agency, user=user, confirm_status=0) + userown_absences_string = False if (len(userown_absences) > 0): userown_absences_string = "" diff --git a/users/templates/users/base.html b/users/templates/users/base.html index 0448ffb..d29b5f1 100644 --- a/users/templates/users/base.html +++ b/users/templates/users/base.html @@ -251,6 +251,13 @@ margin-left: 212px; margin-top: -72px; } + /* MARGIN TOP FOR FIREFOX */ + @-moz-document url-prefix() { + #content-wrapper { + margin-left: 212px; + margin-top: -158px; + } + } /*@media screen and (max-width: 768px) { #content-wrapper { margin-left: 0px !important; @@ -260,13 +267,7 @@