This commit is contained in:
holger.trampe 2021-01-29 17:16:27 +01:00
parent 756cf916f9
commit 14840671fb
1 changed files with 18 additions and 12 deletions

View File

@ -137,21 +137,27 @@ def getICSFileEx(request, code, ag):
#try:
agency = Agency.objects.get(pk=ag)
if agency != None and agency.agencycal_publicstatus == 1 and code == agency.agencycalurl:
send_mail(
'KAL',
str(code) + ' ' + str(agency.agencycalurl),
'noreply@digitale-agentur.com',
["htrampe@gmail.com"],
fail_silently=True
)
if agency != None and agency.agencycal_publicstatus == 1 and str(code) == str(agency.agencycalurl):
c = Calendar()
absencedays = Absence.objects.filter(agency=ag).exclude(confirm_status=2)
for ab in absencedays:
try:
if ab.start != None and ab.end != None:
e = Event()
e.name = ab.user.first_name + " " + ab.user.last_name + " abwesend "
e.uid = "da-ab-" + str(ab.pk)
e.begin = ab.start
e.end = ab.end
#e.allday = True
c.events.add(e)
except:
pass
if ab.start != None and ab.end != None:
e = Event()
e.name = ab.user.first_name + " " + ab.user.last_name + " abwesend "
e.uid = "da-ab-" + str(ab.pk)
e.begin = ab.start
e.end = ab.end
#e.allday = True
c.events.add(e)
return HttpResponse(c, content_type='text/calendar')
else:
realm = ""