Skip to content
Snippets Groups Projects
Commit d8802d48 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

Merge remote-tracking branch 'origin/master' into fix/436

parents f2132a9a 045a41a6
No related branches found
No related tags found
1 merge request!334fix #436 also remove ordering from columns in mail template
Pipeline #45582 passed
smasch (1.1.0~alpha.0-1) unstable; urgency=low
* improvement: remove sorting from columns that do not require sorting in
mail template menu and languages menu
* improvement: added explanatory tooltip for the column `order` in language menu
* improvement: remove sorting from columns that do not require sorting in
mail template menu and languages menu (#436)
* improvement: added explanatory tooltip for the column `order` in language
menu (#436)
* improvement: warn the user on invalid date range when creating a
holidays/extra availability (#427)
* improvement: user can modify/add Subject types with custom follow up schema
(#371)
* improvement: added week day to daily planning main date (#425)
* improvement: possibility to import custom fields data from csv file (#385)
* improvement: added warning in case of printing voucher with no voucher
templates (#451)
* bug fix: privacy notice files were not removed when policy was removed
* bug fix: holidays were wrongly encoded and displayed when they span
multiple days (#430, #429)
* bug fix: Search form should always redirect to web.views.kit_requests
(#433)
-- Piotr Gawron <piotr.gawron@uni.lu> Thu, 25 Feb 2021 17:00:00 +0200
......@@ -82,7 +92,7 @@ smasch (0.14.0) stable; urgency=low
(#312)
* small improvement: there is possibility to select RedCap checks (#300)
* small improvement: permissions list extended. New permissions: view daily
planning; modify sample kits (equipement items); modify flying teams;
planning; modify sample kits (equipment items); modify flying teams;
modify rooms; view kit requests; view statistics; modify mail templates;
can export (#322)
* small improvement: next of keen data added to subject (#318)
......@@ -107,7 +117,7 @@ smasch (0.13.1) stable; urgency=low
smasch (0.13.0) stable; urgency=low
* small improvement: Enpoint reached column added
* small improvement: Endpoint reached column added
* small improvement: Option "removed" to vouchers
* small improvement: Option to show all voucher types when issuing a voucher
to a subject
......@@ -341,7 +351,7 @@ smasch (0.6.0) stable; urgency=low
* improvement: add command to import public holidays (#100)
* small improvement: field "pd in family" has now three states ("unknown",
"false" or "true"). All entries which has this value set to "false" are now
set to "unknown". An import from excel should in the futur fix this to
set to "unknown". An import from excel should in the future fix this to
restore the real "false" values (#107)
* small improvement: a link to navigate to the corresponding visit from an
appointment has been added (#111)
......@@ -378,16 +388,16 @@ smasch (0.5.0) stable; urgency=low
* improvement: contact attempts
* improvement: automatic post mail creation
* improvement: configuration panel for system configuration options (like
colors, mail adresses, etc)
colors, mail addresses, etc)
* small improvement: after subject is added system stays on the edit subject
page
* small improvement: cancelled appointments are 'GREY' in callendar view
* small improvement: no show appointments are "RED' in callendar view
* small improvement: cancelled appointments are 'GREY' in calendar view
* small improvement: no show appointments are "RED' in calendar view
* small improvement: kit requests (equipment&rooms->kit request) contain
information about location and person who is responsible for the
appointment
* small improvement: subject contain two additional boolean fields: PD in
family, information sent. Infomration sent is also visible in subject list
family, information sent. Information sent is also visible in subject list
webpage
* small improvement: appointment contains additional boolean field: post mail
sent
......@@ -426,7 +436,7 @@ smasch (0.4.0) stable; urgency=low
* bug fix: when marking subject as deceased/resigned information was not
saved properly
* bug fix: when marking visit as finished information was not saved properly
* bug fix: list of visits/appoitntments from reminder is sorted by date
* bug fix: list of visits/appointments from reminder is sorted by date
* bug fix: visit id field removed from editing appointment
* bug fix: visit list doesn't allow to change properties of the visit
* bug fix: login problem for users with non ascii characters in their names
......@@ -444,16 +454,16 @@ smasch (0.3.1) stable; urgency=low
smasch (0.3.0) stable; urgency=low
* improvement: there is view for upcoming examinations requiring kits
(disponsible items)
* improvement: notification with remonder to send post email for upcoming
(disposable items)
* improvement: notification with reminder to send post email for upcoming
visit (3-6 months before visit)
* improvement: selecting appointment type in appointment view automatically
recalculate time required for appointment
* improvement: each subjest has optional field with requested contact date,
* improvement: each subject has optional field with requested contact date,
this date is used to create a notification about contact request
* improvement: subject has possibility to be 'postponed' - this will exclude
subject from list of subjects without visit
* bug fix: refirection after login fixed
* bug fix: redirection after login fixed
-- Piotr Gawron <piotr.gawron@uni.lu> Mon, 17 Mar 2017 08:43:10 +0100
......@@ -470,7 +480,7 @@ smasch (0.2.1) stable; urgency=low
* improvement: click oin calendar redirects to edit appointment view
* improvement: after new visit is added there is button to add new
appointment
* bug fix: export to csv was broken when new line appeard in comment
* bug fix: export to csv was broken when new line appeared in comment
-- Piotr Gawron <piotr.gawron@uni.lu> Mon, 09 Mar 2017 18:40:22 +0100
......@@ -478,7 +488,7 @@ smasch (0.2.0) stable; urgency=low
* improvement: export of subjects and appointments to csv added
* improvement: notifications added (exceeded visit time, subject without
visit, unfinished visits, approching visits, unfinished appointments)
visit, unfinished visits, approaching visits, unfinished appointments)
* improvement: calendar is separated between locations
-- Piotr Gawron <piotr.gawron@uni.lu> Mon, 07 Mar 2017 18:10:42 +0100
......
......@@ -55,10 +55,21 @@ def get_holidays(worker, date):
minutes = int(
(holiday.datetime_end - holiday.datetime_start).total_seconds() / 60)
# hack for time zones
start_date = datetime.datetime.combine(
if holiday.datetime_start < today_start:
#if the start date of the holiday is before than today, we put the link_start today 00.00
start_date = today_start
else:
start_date = datetime.datetime.combine(
today_start, holiday.datetime_start.time())
end_date = datetime.datetime.combine(
today_start, holiday.datetime_end.time())
if holiday.datetime_end > today_end:
#if the end date of the holiday is later than today, we put the link_end today 23.59
end_date = today_end
else:
#truncates the end link to today at the time of the holiday end date
end_date = datetime.datetime.combine(
today_start, holiday.datetime_end.time())
event = {
'duration': build_duration(minutes),
'link_when': start_date,
......
......@@ -490,6 +490,7 @@ function addDailyPlanningCalendar(calendar_selector, replace_all, calendar_dict_
snapDuration: '00:05',
minTime: "08:00:00",
maxTime: "19:00:00",
titleFormat: 'dddd, MMMM D, YYYY',
businessHours: {
start: '08:00',
end: '19:00'
......
......@@ -32,7 +32,7 @@
changes)</a>
</div>
<form method="post" action="" class="form-horizontal">
<form id="add_holiday_form" method="post" action="" class="form-horizontal">
{% csrf_token %}
<div class="box-body">
......@@ -78,4 +78,18 @@
{{ block.super }}
{% include "includes/datetimepicker.js.html" %}
<script>
$(function(){
$('#add_holiday_form').on('submit', function(e){
var start = moment($('#id_datetime_start').val());
var end = moment($('#id_datetime_end').val());
if(end <= start){
e.preventDefault();
alert('End date must be greater than start date.');
return false;
}
return true;
});
})
</script>
{% endblock scripts %}
......@@ -21,7 +21,7 @@
{% block content %}
<div class="box box-info">
<form method="post" action="" class="form-horizontal">
<form method="post" action="{% url 'web.views.kit_requests' %}" class="form-horizontal">
{% csrf_token %}
<div class="box-body">
......
......@@ -126,9 +126,9 @@ class TestDailyPlanningApi(LoggedInWithWorkerTestCase):
availability.save()
holiday = Holiday.objects.create(person=self.worker,
datetime_start=timezone.now().replace(year=2017, month=9, day=6,
datetime_start=timezone.now().replace(year=2017, month=9, day=5,
hour=12),
datetime_end=timezone.now().replace(year=2017, month=9, day=6,
datetime_end=timezone.now().replace(year=2017, month=9, day=7,
hour=20)
)
holiday.save()
......@@ -137,9 +137,50 @@ class TestDailyPlanningApi(LoggedInWithWorkerTestCase):
self.assertEqual(response.status_code, 200)
availabilities = json.loads(response.content)['availabilities']
self.assertEqual(1, len(availabilities))
holidays = json.loads(response.content)['holidays']
self.assertEqual(1, len(holidays))
def test_multi_day_holiday(self):
holiday = Holiday.objects.create(person=self.worker,
datetime_start=timezone.now().replace(year=2017, month=9, day=4,
hour=10, minute=0, second=0, microsecond=0),
datetime_end=timezone.now().replace(year=2017, month=9, day=6,
hour=15, minute=0, second=0, microsecond=0)
)#monday to wed
holiday.save()
#monday
response = self.client.get(reverse('web.api.events', kwargs={'date': "2017-09-04"}))
self.assertEqual(response.status_code, 200)
holidays = json.loads(response.content)['holidays']
self.assertEqual(1, len(holidays))
holiday = holidays[0]
self.assertTrue('2017-09-04T10:00:00' in holiday['link_when'])
self.assertTrue('2017-09-04T23:59:00' in holiday['link_end'])
#tuesday
response = self.client.get(reverse('web.api.events', kwargs={'date': "2017-09-05"}))
self.assertEqual(response.status_code, 200)
holidays = json.loads(response.content)['holidays']
self.assertEqual(1, len(holidays))
holiday = holidays[0]
self.assertTrue('2017-09-05T00:00:00' in holiday['link_when'])
self.assertTrue('2017-09-05T23:59:00' in holiday['link_end'])
#wed
response = self.client.get(reverse('web.api.events', kwargs={'date': "2017-09-06"}))
self.assertEqual(response.status_code, 200)
holidays = json.loads(response.content)['holidays']
self.assertEqual(1, len(holidays))
holiday = holidays[0]
self.assertTrue('2017-09-06T00:00:00' in holiday['link_when'])
self.assertTrue('2017-09-06T15:00:00' in holiday['link_end'])
def test_nonempty_availabilities_with_included_holidays(self):
availability = Availability.objects.create(person=self.worker, day_number=TUESDAY_AS_DAY_OF_WEEK,
available_from="8:00", available_till="16:00")
......@@ -157,6 +198,8 @@ class TestDailyPlanningApi(LoggedInWithWorkerTestCase):
self.assertEqual(response.status_code, 200)
availabilities = json.loads(response.content)['availabilities']
holidays = json.loads(response.content)['holidays']
self.assertEqual(1, len(holidays))
self.assertEqual(2, len(availabilities))
......
......@@ -225,10 +225,8 @@ def kit_requests_send_mail(request, start_date, end_date=None):
except Exception as e:
traceback.print_exc()
logger.warning('Kit Request Send Mail Failed: |{}|\n{}'.format(
e.message, e.args))
messages.add_message(request, messages.ERROR,
'There was problem with sending email')
logger.warning('Kit Request Send Mail Failed: |{}|\n{}'.format(str(e), e.args))
messages.add_message(request, messages.ERROR, 'There was problem with sending email')
return wrap_response(request, 'equipment_and_rooms/kit_requests/kit_requests.html', get_kit_requests_data(request))
......
......@@ -121,6 +121,10 @@ def generate_for_vouchers(request):
vouchers.append(Voucher.objects.get(pk=int(voucher_id)))
templates = MailTemplate.get_voucher_mail_templates([])[0]
if len(templates) == 0:
messages.add_message(request, messages.WARNING, 'There are no voucher mail templates. Please add one in order to print vouchers.')
return redirect(request.META.get('HTTP_REFERER', 'web.views.subjects'))
output_stream = io.BytesIO()
inputs = []
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment