From 056e1c074f1e233e14ee02cf16f8e9d33ddb2830 Mon Sep 17 00:00:00 2001 From: Olli Kautonen Date: Thu, 3 Jul 2025 09:06:00 +0300 Subject: [PATCH] Bug 36136: Add validation to subscription end date Fixed an issue where editing an existing subscription as a duplicate would result in being able to select the end date before the start date. To test: 1)In Koha go to Serials 2)Search for existing subscriptions 3)Select a subscription 4)Select Edit, Edit as new(duplicate) 5)On the second page set the end date before the start date 6)When pressing save subscription a warning pops up, preventing you from selecting the end date before the start date. Sponsored-by: Koha-Suomi Oy --- koha-tmpl/intranet-tmpl/prog/js/subscription-add.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/subscription-add.js b/koha-tmpl/intranet-tmpl/prog/js/subscription-add.js index 1a7b10774b..93d72a35c8 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/subscription-add.js +++ b/koha-tmpl/intranet-tmpl/prog/js/subscription-add.js @@ -149,7 +149,13 @@ function Check_page2() { } return false; } - + // Validate that enddate is later than acqui_date + const acquiDate = new Date($("#acqui_date").val()); + const endDate = new Date($("input[name='enddate']").val()); + if (endDate < acquiDate) { + alert( __("End date must be after the first publication date") ); + return false; + } return true; } -- 2.34.1