From 8260893b0b7ad54e388fc72132adac368789d90a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Demont=C3=A9?= Date: Mon, 15 Jul 2024 10:44:06 +0200 Subject: [PATCH] URB-2993: Add fusion method getValidityEndDate --- news/URB-2993.feature | 2 ++ src/Products/urban/content/licence/GenericLicence.py | 10 ++++++++++ 2 files changed, 12 insertions(+) create mode 100644 news/URB-2993.feature diff --git a/news/URB-2993.feature b/news/URB-2993.feature new file mode 100644 index 000000000..d4c9debe1 --- /dev/null +++ b/news/URB-2993.feature @@ -0,0 +1,2 @@ +Add fusion method getValidityEndDate +[daggelpop] \ No newline at end of file diff --git a/src/Products/urban/content/licence/GenericLicence.py b/src/Products/urban/content/licence/GenericLicence.py index 7b71b335b..cd582418c 100755 --- a/src/Products/urban/content/licence/GenericLicence.py +++ b/src/Products/urban/content/licence/GenericLicence.py @@ -1765,6 +1765,16 @@ def getLastEventWithValidityDate(self): return None return events[-1] + def getValidityEndDate(self): + """ + Get the last "validity end date" found in any of the licence's events, or nothing. + """ + validity_event = self.getLastEventWithValidityDate() + if validity_event: + return validity_event.getValidityEndDate() + else: + return None + def get_bound_roaddecrees(self): roaddecrees = [] annotations = IAnnotations(self)