diff --git a/Products/Reportek/EnvelopeCustomDataflows.py b/Products/Reportek/EnvelopeCustomDataflows.py index b3914401..5390081f 100644 --- a/Products/Reportek/EnvelopeCustomDataflows.py +++ b/Products/Reportek/EnvelopeCustomDataflows.py @@ -30,6 +30,7 @@ """ +import datetime import json import logging import re @@ -1553,6 +1554,20 @@ def get_previous_deliveries(self): return envs + def get_updated_report_id(self, old_rep_id, offset=None, rep_year=None): + """ Return an up to date report id, from an old report where offset is + current year +- offset or using the provided rep_year + Designed to work with copyFromPreviousDelivery script + """ + if not rep_year: + rep_year = datetime.datetime.now().year + if offset: + rep_year = rep_year + int(offset) + rep_year = str(rep_year) + rep_id = re.sub(r'(?:19|20)\d{2}', rep_year, old_rep_id) + + return rep_id + # Initialize the class in order the security assertions be taken into account InitializeClass(EnvelopeCustomDataflows) diff --git a/Products/Reportek/version.txt b/Products/Reportek/version.txt index 6ae0dcb1..bf77d549 100644 --- a/Products/Reportek/version.txt +++ b/Products/Reportek/version.txt @@ -1 +1 @@ -4.15 +4.2 diff --git a/docs/HISTORY.txt b/docs/HISTORY.txt index 12d4b0a9..c7367a6a 100644 --- a/docs/HISTORY.txt +++ b/docs/HISTORY.txt @@ -1,6 +1,11 @@ Changelog ========= +4.2 - (2022-02-16) +--------------------------- +* Change: Develop + [olimpiurob] + 4.15 - (2022-02-15) --------------------------- * Change: Refs #145482; Changed required permission to View on get_previous_del… [olimpiurob]