Commit 51fbee13 authored by Olivier PEREZ's avatar Olivier PEREZ
Browse files

Javascript : Don't let user insert more than 123 dates in a row

parent 1ddc11af
......@@ -238,7 +238,10 @@ $(document).ready(function () {
startDateField.parent().removeClass('has-error');
endDateField.parent().removeClass('has-error');
if (startDate != null && endDate != null) {
var maxDates = 123; // 123 = 4 months
var tooMuchDates = endDate - startDate > maxDates * 86400 * 1000;
if (startDate != null && endDate != null && !tooMuchDates) {
if (startDate <= endDate) {
while (startDate <= endDate) {
var dateStr = formatDate(startDate, window.date_formats.DATE);
......@@ -263,10 +266,10 @@ $(document).ready(function () {
}
} else {
setTimeout(function () {
if (startDate == null) {
if (startDate == null || tooMuchDates) {
startDateField.parent().addClass('has-error');
}
if (endDate == null) {
if (endDate == null || tooMuchDates) {
endDateField.parent().addClass('has-error');
}
}, 200);
......
......@@ -52,6 +52,7 @@
"MONTH_YEAR": "%B %Y",
"DATETIME": "%Y-%m-%d %H:%M",
"Add range dates": "DE_Ajout d'un intervalle de dates",
"Max dates count": "DE_Vous pouvez sélectionner au maximum 4 mois",
"Start date": "DE_Date de début",
"End date": "DE_Date de fin"
},
......
......@@ -52,6 +52,7 @@
"MONTH_YEAR": "%B %Y",
"DATETIME": "%m/%d/%Y %H:%M",
"Add range dates": "Add range dates",
"Max dates count": "You can select at most 4 months",
"Start date": "Start date",
"End date": "End date"
},
......
......@@ -52,6 +52,7 @@
"MONTH_YEAR": "%B de %Y",
"DATETIME": "%d/%m/%Y %H:%M",
"Add range dates": "ES_Ajout d'un intervalle de dates",
"Max dates count": "ES_Vous pouvez sélectionner au maximum 4 mois",
"Start date": "ES_Date de début",
"End date": "ES_Date de fin"
},
......
......@@ -52,6 +52,7 @@
"MONTH_YEAR": "%B %Y",
"DATETIME": "%d-%m-%Y %H:%M",
"Add range dates": "Ajout d'un intervalle de dates",
"Max dates count": "Vous pouvez sélectionner au maximum 4 mois",
"Start date": "Date de début",
"End date": "Date de fin"
},
......
......@@ -52,6 +52,7 @@
"MONTH_YEAR": "%B %Y",
"DATETIME": "%d/%m/%Y %H:%M",
"Add range dates": "IT_Ajout d'un intervalle de dates",
"Max dates count": "IT_Vous pouvez sélectionner au maximum 4 mois",
"Start date": "IT_Date de début",
"End date": "IT_Date de fin"
},
......
......@@ -42,11 +42,17 @@
"Date": {
"dd/mm/yyyy": "jj/mm/aaaa",
"%A, den %e. %B %Y": "%A %e %B %Y",
"datepicker": "dd/mm/yyyy",
"datetime_parseformat": "d/m/Y",
"FULL": "%A %e %B %Y",
"SHORT": "%A %e %B %Y",
"DAY": "%a %e",
"DATE": "%Y-%m-%d",
"MONTH_YEAR": "%B %Y"
"MONTH_YEAR": "%B %Y",
"Add range dates": "OC_Ajout d'un intervalle de dates",
"Max dates count": "OC_Vous pouvez sélectionner au maximum 4 mois",
"Start date": "OC_Date de début",
"End date": "OC_Date de fin"
},
"Language selector": {
"Select the language": "Seleccionar la lenga",
......
......@@ -121,6 +121,11 @@
<h4 class="modal-title">{__('Date', 'Add range dates')}</h4>
</div>
<div class="modal-body row">
<div class="col-xs-12">
<div class="alert alert-info">
{__('Date', 'Max dates count')}
</div>
</div>
<div class="col-xs-12">
<label for="range_start">{__('Date', 'Start date')}</label>
<div class="input-group date">
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment