Bugs und so

This commit is contained in:
Holger Trampe 2020-07-09 15:09:43 +02:00
parent 3b15847ce6
commit e6c7eaf225
6 changed files with 100 additions and 18 deletions

View File

@ -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

View File

@ -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!"

View File

@ -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 = ""

View File

@ -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 @@
<div id="content-wrapper">
<!-- Main Content -->
<!-- Topbar -->
<nav id="topnavbarmain" class="navbar navbar-expand navbar-light bg-white topbar fixed-top mb-4 static-top shadow" style="margin-left: 224px;">
<nav id="topnavbarmain" class="navbar navbar-expand navbar-light bg-white topbar fixed-top mb-4 static-top shadow" style="margin-left: 224px;">
<!-- Sidebar Toggle (Topbar) -->
<button id="sidebarToggleTop" class="btn btn-link d-md-none rounded-circle mr-3" onclick="javascript:toggleSidebar()">
<i class="fa fa-bars"></i>

View File

@ -906,8 +906,67 @@ def cronactions(request, code):
channel_layer = channels.layers.get_channel_layer()
async_to_sync(channel_layer.group_send)("user_" + str(user.pk), {'type' : 'pushhandler', 'pushtext' : "pushnotification__News | Neue Agenturnews: " + news.name})
# LEXOFFICE TEST
# HEADERS CURL
'''
headers = {
'Authorization': 'Bearer 33bfb1b9-2994-4fd4-b447-1f4754a5c7cb',
'Content-Type': 'application/json',
'Accept': 'application/json',
}
# DataJSON
lexdata = {
"voucherDate": "2020-07-09T00:00:00.000+01:00",
"address" : {
"name" : "Agenturname XXX",
"countryCode" : "DE"
},
"totalPrice" : {
"currency" : "EUR",
},
"lineItems" : [
{
"type" : "custom",
"name" : "Monatsbeitrag",
"quantity" : 1,
"unitName" : "Stück",
"unitPrice" :
{
"currency" : "EUR",
"netAmount" : 10,
"taxRatePercentage" : 16
},
},
{
"type" : "custom",
"name" : "Abwesenheitsmodul",
"quantity" : 1,
"unitName" : "Stück",
"unitPrice" :
{
"currency" : "EUR",
"netAmount" : 10,
"taxRatePercentage" : 16
},
}
],
"taxConditions": {
"taxType": "net"
},
"shippingConditions": {
"shippingDate": "2020-07-09T00:00:00.000+01:00",
"shippingType": "service"
},
}
json_data = json.dumps(lexdata)
r = requests.get("https://api.lexoffice.io/v1/invoices/0f9b6a1d-1912-4a10-9926-7909e5580202", data=json_data, headers=headers)
print(r)
print(r.text)
'''
else:
print("API CODE FAILED")
data.update({"status" : "failed"})
@ -961,7 +1020,7 @@ def cronactionsdaily(request, code):
# Erinnerungsmails/Push bei Vertretung verschicken
one_week_later = date.today() + timedelta(days=7)
repre_absence = Absence.objects.filter(representator=user, start=one_week_later)
repre_absence = Absence.objects.filter(representator=user, start=one_week_later, confirm_status=0)
for r in repre_absence:
if(r.representator.usernotifications.absence_user_is_rep_reminder_mail):