Make sure that the duration of a service does not become less than the minimum acceptable value as otherwise it will make problems with the availability generation

This commit is contained in:
Alex Tselegidis 2021-03-25 11:32:10 +01:00
parent e496105fac
commit 76672db959
31 changed files with 42 additions and 2 deletions

View file

@ -105,6 +105,7 @@ $lang['new_unavailable_title'] = 'فترة غير متاحة جديدة';
$lang['edit_unavailable_title'] = 'تعديل فترة غير متاحة';
$lang['unavailable_saved'] = 'تم حفظ الفترة الغير متاحة بنجاح';
$lang['start_date_before_end_error'] = 'تاريخ البداية أكبر من تاريخ الانتهاء.';
$lang['invalid_duration'] = 'Invalid duration.';
$lang['invalid_email'] = 'بريد الكتروني غير صحيح';
$lang['customers'] = 'الزبائن';
$lang['details'] = 'التفاصيل';

View file

@ -105,6 +105,7 @@ $lang['new_unavailable_title'] = 'Нов неработен период';
$lang['edit_unavailable_title'] = 'Промяна на неработен период';
$lang['unavailable_saved'] = 'Неработен период запазен успешно.';
$lang['start_date_before_end_error'] = 'Стартовият период е по-дълъг от крайната дата.';
$lang['invalid_duration'] = 'Invalid duration.';
$lang['invalid_email'] = 'Невалиден адрес на електронна поща.';
$lang['customers'] = 'Клиенти';
$lang['details'] = 'Детайли';

View file

@ -110,6 +110,7 @@ $lang['new_unavailable_title'] = 'Nou període de no disponibilitat';
$lang['edit_unavailable_title'] = 'Edita el període de no disponibilitat';
$lang['unavailable_saved'] = 'El període de no disponibilitat s\'ha desat correctament.';
$lang['start_date_before_end_error'] = 'La data d\'inici és posterior de la de fi.';
$lang['invalid_duration'] = 'Invalid duration.';
$lang['invalid_email'] = 'L\'adreça de correu electrònic no és vàlida.';
$lang['customers'] = 'Clients';
$lang['details'] = 'Detalls';

View file

@ -105,6 +105,7 @@ $lang['new_unavailable_title'] = '新的不可预约时间段';
$lang['edit_unavailable_title'] = '编辑不可预定时间段';
$lang['unavailable_saved'] = '不可预定时间段保存成功.';
$lang['start_date_before_end_error'] = '开始日期数值晚于结束日期.';
$lang['invalid_duration'] = 'Invalid duration.';
$lang['invalid_email'] = '无效电子邮箱地址.';
$lang['customers'] = '客户';
$lang['details'] = '详细资料';

View file

@ -110,6 +110,7 @@ $lang['new_unavailable_title'] = 'Nové období nedostupnosti';
$lang['edit_unavailable_title'] = 'Editovat období nedostupnosti';
$lang['unavailable_saved'] = 'Období nedostupnosti úspěšně uloženo.';
$lang['start_date_before_end_error'] = 'Datum zahájení je vyšší než datum ukončení.';
$lang['invalid_duration'] = 'Invalid duration.';
$lang['invalid_email'] = 'Neplatná emailová adresa.';
$lang['customers'] = 'Zákazníci';
$lang['details'] = 'Základní údaje';
@ -418,6 +419,7 @@ $lang['new_unavailable_title'] = 'Nové období nedostupnosti';
$lang['edit_unavailable_title'] = 'Editovat období nedostupnosti';
$lang['unavailable_saved'] = 'Období nedostupnosti úspěšně uloženo.';
$lang['start_date_before_end_error'] = 'Datum zahájení je vyšší než datum ukončení.';
$lang['invalid_duration'] = 'Invalid duration.';
$lang['invalid_email'] = 'Neplatná emailová adresa.';
$lang['customers'] = 'Zákazníci';
$lang['details'] = 'Základní údaje';

View file

@ -105,6 +105,7 @@ $lang['new_unavailable_title'] = 'Ny ikke tilgængelig periode';
$lang['edit_unavailable_title'] = 'Redigere ikke tilgængelig periode';
$lang['unavailable_saved'] = 'Ikke tilgængelig periode er gemt.';
$lang['start_date_before_end_error'] = 'Start dato er større end slut dato';
$lang['invalid_duration'] = 'Invalid duration.';
$lang['invalid_email'] = 'Ugyldig email adresse';
$lang['customers'] = 'Kunderne';
$lang['details'] = 'Detaljer';

View file

@ -105,6 +105,7 @@ $lang['new_unavailable_title'] = 'Nieuwe periode waarop men niet beschikbaar is'
$lang['edit_unavailable_title'] = 'Bewerk beschikbare periode';
$lang['unavailable_saved'] = 'Onbeschikbaar periode succesvol opgeslagen.';
$lang['start_date_before_end_error'] = 'De startdatum is later dan de einddatum.';
$lang['invalid_duration'] = 'Invalid duration.';
$lang['invalid_email'] = 'Ongeldig e-mailadres.';
$lang['customers'] = 'Klanten';
$lang['details'] = 'Details';

View file

@ -110,6 +110,7 @@ $lang['new_unavailable_title'] = 'New Unavailable Period';
$lang['edit_unavailable_title'] = 'Edit Unavailable Period';
$lang['unavailable_saved'] = 'Unavailable period saved successfully.';
$lang['start_date_before_end_error'] = 'Start date value is latter than end date.';
$lang['invalid_duration'] = 'Invalid duration.';
$lang['invalid_email'] = 'Invalid email address.';
$lang['customers'] = 'Customers';
$lang['details'] = 'Details';

View file

@ -105,6 +105,7 @@ $lang['new_unavailable_title'] = 'Uusi poissaolojakso';
$lang['edit_unavailable_title'] = 'Muokkaa poissaolojaksoa';
$lang['unavailable_saved'] = 'Poissaolojakso tallennettiin.';
$lang['start_date_before_end_error'] = 'Aloituspäivämäärä on loppupäivää myöhäisempi.';
$lang['invalid_duration'] = 'Invalid duration.';
$lang['invalid_email'] = 'Virheellinen sähköpostiosoite.';
$lang['customers'] = 'Asiakkaat';
$lang['details'] = 'Lisätiedot';

View file

@ -109,6 +109,7 @@ $lang['new_unavailable_title'] = 'Nouvelle période d\'indisponibilité';
$lang['edit_unavailable_title'] = 'Editer une période d\'indisponibilité';
$lang['unavailable_saved'] = 'Période d\'indisponibilité sauvegardée avec succès .';
$lang['start_date_before_end_error'] = 'La date de début est ultérieure à la date de fin .';
$lang['invalid_duration'] = 'Invalid duration.';
$lang['invalid_email'] = 'Adresse email non valide .';
$lang['customers'] = 'Clients';
$lang['details'] = 'Détails';

View file

@ -108,6 +108,7 @@ $lang['new_unavailable_title'] = 'Neuer nicht zur Verfügung stehender Zeitraum'
$lang['edit_unavailable_title'] = 'Nicht zur Verfügung stehenden Zeitraum bearbeiten';
$lang['unavailable_saved'] = 'Nicht zur Verfügung stehender Zeitraum erfolgreich gespeichert.';
$lang['start_date_before_end_error'] = 'Das Startdatum ist größer als das Enddatum.';
$lang['invalid_duration'] = 'Invalid duration.';
$lang['invalid_email'] = 'Ungültige E-Mail-Adresse.';
$lang['customers'] = 'Kunden';
$lang['details'] = 'Details';

View file

@ -105,6 +105,7 @@ $lang['new_unavailable_title'] = 'Νέα Μη Διαθέσιμη Περίοδο
$lang['edit_unavailable_title'] = 'Επεξεργασία Μη Διαθέσιμης Περιόδου';
$lang['unavailable_saved'] = 'Η μη διαθέσιμη περίοδος αποθηκεύτηκε επιτυχώς.';
$lang['start_date_before_end_error'] = 'Η ημερομηνία εκκίνησης είναι μεγαλύτερα από την ημερομηνία λήξης.';
$lang['invalid_duration'] = 'Invalid duration.';
$lang['invalid_email'] = 'Λανθασμένη διεύθυνση email.';
$lang['customers'] = 'Πελάτες';
$lang['details'] = 'Λεπτομέρειες';

View file

@ -110,6 +110,7 @@ $lang['new_unavailable_title'] = ' מועד לא זמין חדש';
$lang['edit_unavailable_title'] = 'עריכת מועד לא זמין';
$lang['unavailable_saved'] = 'מועד לא זמין נשמר בהצלחה!';
$lang['start_date_before_end_error'] = 'ערך תאריך ההתחלה גדול מתאריך הסיום!';
$lang['invalid_duration'] = 'Invalid duration.';
$lang['invalid_email'] = 'כתובת דוא"ל לא חוקית!';
$lang['customers'] = 'לקוחות';
$lang['details'] = 'פרטים';

View file

@ -105,6 +105,7 @@ $lang['new_unavailable_title'] = 'नए अनुपलब्ध अवधि';
$lang['edit_unavailable_title'] = 'अनुपलब्ध अवधि संपादित करें';
$lang['unavailable_saved'] = 'अनुपलब्ध अवधि सफलतापूर्वक बचाया.';
$lang['start_date_before_end_error'] = 'प्रारंभ दिनांक मान के अंत की तारीख से भी बड़ा है';
$lang['invalid_duration'] = 'Invalid duration.';
$lang['invalid_email'] = 'अमान्य ईमेल पता.';
$lang['customers'] = 'उपभोक्ता';
$lang['details'] = 'विवरण';

View file

@ -105,6 +105,7 @@ $lang['new_unavailable_title'] = 'Új nem foglalható időpont ';
$lang['edit_unavailable_title'] = 'Nem foglalható időpont szerkesztése';
$lang['unavailable_saved'] = 'A nem foglalható időpont sikeresen mentve.';
$lang['start_date_before_end_error'] = 'A kezdeti időpont későbbre esik, mint vég időpont.';
$lang['invalid_duration'] = 'Invalid duration.';
$lang['invalid_email'] = 'Érvénytelen email cím.';
$lang['customers'] = 'Vendégek';
$lang['details'] = 'Részletek';

View file

@ -105,6 +105,7 @@ $lang['new_unavailable_title'] = 'Nuovo perido di indisponibilità';
$lang['edit_unavailable_title'] = 'Modifica periodo di indisponibilità';
$lang['unavailable_saved'] = 'Periodo di indisponibilità salvato con successo.';
$lang['start_date_before_end_error'] = 'La data di inizio è successiva alla data di fine.';
$lang['invalid_duration'] = 'Invalid duration.';
$lang['invalid_email'] = 'Indirizzo e-mail non valido.';
$lang['customers'] = 'Clienti';
$lang['details'] = 'Dettagli';

View file

@ -105,6 +105,7 @@ $lang['new_unavailable_title'] = '新規の都合悪い時間';
$lang['edit_unavailable_title'] = '都合悪い時間の編集';
$lang['unavailable_saved'] = '都合の悪い時間の保存が完了しました。';
$lang['start_date_before_end_error'] = '開始時間が終了時間よりも後になっています。';
$lang['invalid_duration'] = 'Invalid duration.';
$lang['invalid_email'] = 'Emailアドレスのフォーマットエラー';
$lang['customers'] = 'お客様';
$lang['details'] = '詳細';

View file

@ -105,6 +105,7 @@ $lang['new_unavailable_title'] = 'Neien Zäitraum deen net zur Verfügung steet'
$lang['edit_unavailable_title'] = 'Zäitraum, deen net zur Verfügung steet, änneren';
$lang['unavailable_saved'] = 'Zäitraum, deen net zur Verfügung steet erfollegräich gespäichert.';
$lang['start_date_before_end_error'] = 'Den Ufanksdatum ass méi héich wéi de Schlussdatum.';
$lang['invalid_duration'] = 'Invalid duration.';
$lang['invalid_email'] = 'Déi E-Mail-Adresse ass ongülteg.';
$lang['customers'] = 'Clienten';
$lang['details'] = 'Detailer';

View file

@ -107,6 +107,7 @@ $lang['new_unavailable_title'] = 'नवीन गहाळ कालावध
$lang['edit_unavailable_title'] = 'गहाळ कालावधी संपादित करा';
$lang['unavailable_saved'] = 'गहाळ कालावधी यशस्वीरित्या जतन झाला.';
$lang['start_date_before_end_error'] = 'प्रारंभ तारीख मूल्याच्या अंतिम तारखेपेक्षा मोठी आहे';
$lang['invalid_duration'] = 'Invalid duration.';
$lang['invalid_email'] = 'अवैध ईमेल पत्ता.';
$lang['customers'] = 'उपभोक्ता';
$lang['details'] = 'विवरण';

View file

@ -105,6 +105,7 @@ $lang['new_unavailable_title'] = 'Nowy Niedostępny Okres';
$lang['edit_unavailable_title'] = 'Edytuj Niedostępny Okres';
$lang['unavailable_saved'] = 'Niedostępny okres zapisano pomyślnie.';
$lang['start_date_before_end_error'] = 'Wartość początkowa jest większa niż data końcowa.';
$lang['invalid_duration'] = 'Invalid duration.';
$lang['invalid_email'] = 'Niepoprawny adres email.';
$lang['customers'] = 'Klienci';
$lang['details'] = 'Szczegóły';

View file

@ -105,6 +105,7 @@ $lang['new_unavailable_title'] = 'Novo Período Indisponível';
$lang['edit_unavailable_title'] = 'Edite Período Indisponível';
$lang['unavailable_saved'] = 'Período Indisponível salvo com sucesso.';
$lang['start_date_before_end_error'] = 'A data início é superior ao valor da data fim.';
$lang['invalid_duration'] = 'Invalid duration.';
$lang['invalid_email'] = 'Email inválido.';
$lang['customers'] = 'Clientes';
$lang['details'] = 'Detalhes';

View file

@ -105,6 +105,7 @@ $lang['new_unavailable_title'] = 'Novo Período Indisponível';
$lang['edit_unavailable_title'] = 'Edite Período Indisponível';
$lang['unavailable_saved'] = 'Período Indisponível guardado com sucesso.';
$lang['start_date_before_end_error'] = 'A data início é superior ao valor da data fim.';
$lang['invalid_duration'] = 'Invalid duration.';
$lang['invalid_email'] = 'Email invalido.';
$lang['customers'] = 'Clientes';
$lang['details'] = 'Detalhes';

View file

@ -105,6 +105,7 @@ $lang['new_unavailable_title'] = 'Perioada de indisponibilitate noua';
$lang['edit_unavailable_title'] = 'Editeaza perioada de indisponibilitate';
$lang['unavailable_saved'] = 'Perioada de indisponibilitate a fost salvata.';
$lang['start_date_before_end_error'] = 'Data de început se afla dupa data de sfârsit.';
$lang['invalid_duration'] = 'Invalid duration.';
$lang['invalid_email'] = 'Adresa de email este invalida.';
$lang['customers'] = 'Clienti';
$lang['details'] = 'Detalii';

View file

@ -105,6 +105,7 @@ $lang['new_unavailable_title'] = 'Новый недоступный период
$lang['edit_unavailable_title'] = 'Редактировать недоступный период';
$lang['unavailable_saved'] = 'Недоступный период успешно сохранен.';
$lang['start_date_before_end_error'] = 'Начальная дата больше чем конечная.';
$lang['invalid_duration'] = 'Invalid duration.';
$lang['invalid_email'] = 'Недействительный e-mail адрес.';
$lang['customers'] = 'Заказчики';
$lang['details'] = 'Детали';

View file

@ -105,6 +105,7 @@ $lang['new_unavailable_title'] = 'Nové nedostupné obdobie';
$lang['edit_unavailable_title'] = 'Upraviť nedostupné obdobie';
$lang['unavailable_saved'] = 'Nedostupné obdobie úspešne uložené.';
$lang['start_date_before_end_error'] = 'Dátum začatia je väčší ako dátum konca.';
$lang['invalid_duration'] = 'Invalid duration.';
$lang['invalid_email'] = 'Neplatné emailová adresa.';
$lang['customers'] = 'Zákazníci';
$lang['details'] = 'Podrobnosti';

View file

@ -105,6 +105,7 @@ $lang['new_unavailable_title'] = 'Nuevo periodo No disponible';
$lang['edit_unavailable_title'] = 'Editar periodo No disponible';
$lang['unavailable_saved'] = 'Periodo No disponible guardado exitosamente';
$lang['start_date_before_end_error'] = 'La fecha del inicio es posterior a la fecha del final';
$lang['invalid_duration'] = 'Invalid duration.';
$lang['invalid_email'] = 'Dirección de E-mail inválida';
$lang['customers'] = 'Clientes';
$lang['details'] = 'Detalles';

View file

@ -105,6 +105,7 @@ $lang['new_unavailable_title'] = 'Ny låst period';
$lang['edit_unavailable_title'] = 'Ändra låst period';
$lang['unavailable_saved'] = 'Låst period sparad.';
$lang['start_date_before_end_error'] = 'Startdatum är efter slutdatum.';
$lang['invalid_duration'] = 'Invalid duration.';
$lang['invalid_email'] = 'Ogiltig epostadress';
$lang['customers'] = 'Kunder';
$lang['details'] = 'Detaljer';

View file

@ -105,6 +105,7 @@ $lang['new_unavailable_title'] = 'Yeni Uygun Olmayan Zaman Aralığı';
$lang['edit_unavailable_title'] = 'Uygun Olmayan Zaman Aralığı Düzenle';
$lang['unavailable_saved'] = 'Uygun Olmayan Zaman Aralığı Başarıyla Kaydedildi.';
$lang['start_date_before_end_error'] = 'Başlangıç tarihi bitiş tarihinden büyük olamaz.';
$lang['invalid_duration'] = 'Invalid duration.';
$lang['invalid_email'] = 'Hatalı eposta adresi.';
$lang['customers'] = 'Müşteriler';
$lang['details'] = 'Detaylar';

View file

@ -97,6 +97,11 @@ class Services_model extends EA_Model {
{
throw new Exception('Service duration is not numeric.');
}
if ((int)$service['duration'] < EVENT_MINIMUM_DURATION)
{
throw new Exception('The service duration cannot be less than ' . EVENT_MINIMUM_DURATION . ' minutes.');
}
}
if ($service['price'] !== NULL)

View file

@ -116,7 +116,7 @@
<?= lang('duration_minutes') ?>
<span class="text-danger">*</span>
</label>
<input id="service-duration" class="form-control required" type="number" min="15">
<input id="service-duration" class="form-control required" type="number" min="5">
</div>
<div class="form-group">

View file

@ -269,7 +269,7 @@
.hide();
try {
// validate required fields.
// Validate required fields.
var missingRequired = false;
$('#services .required').each(function (index, requiredField) {
@ -283,6 +283,12 @@
throw new Error(EALang.fields_are_required);
}
// Validate the duration.
if (Number($('#service-duration').val()) < 5) {
$('#service-duration').closest('.form-group').addClass('has-error');
throw new Error(EALang.invalid_duration);
}
return true;
} catch (error) {
$('#services .form-message')