rubric_value_dict['S21.G00.79.004'] = formatFloat(target['base']) if block_id == 'S21.G00.81': rubric_value_dict['S21.G00.81.001'] = target['code'] rubric_value_dict['S21.G00.81.002'] = ( target['corporate_registration_code'] if target['code'] not in ('059', '063', '064') else '') rubric_value_dict['S21.G00.81.003'] = (formatFloat(target['base']) if target['base'] else '') rubric_value_dict['S21.G00.81.004'] = (formatFloat(target['quantity']) if target['quantity'] else '') rubric_value_dict['S21.G00.81.005'] = target['zip_code'] if block_id == 'S21.G00.86': career_start_date = enrollment_record.getCareerStartDate() seniority = getIntervalBetweenDates(career_start_date, DateTime()) if seniority['year'] != 0: rubric_value_dict['S21.G00.86.002'] = '03' rubric_value_dict['S21.G00.86.003'] = int(seniority['year']) elif seniority['month'] != 0: rubric_value_dict['S21.G00.86.002'] = '02' rubric_value_dict['S21.G00.86.003'] = int(seniority['month']) elif seniority['day'] != 0: rubric_value_dict['S21.G00.86.002'] = '01' rubric_value_dict['S21.G00.86.003'] = int(seniority['day']) rubric_value_dict['S21.G00.86.001'] = '01' rubric_value_dict['S21.G00.86.005'] = '00000' if block_id == 'S90.G00.90': rubric_value_dict['S90.G00.90.001'] = int(kw['length']) + 2 rubric_value_dict['S90.G00.90.002'] = kw['dsn_record_counter']
from Products.DCWorkflow.DCWorkflow import ValidationFailed from Products.ERP5Type.Message import Message from Products.ERP5Type.DateUtils import getIntervalBetweenDates if stop_date is None: from DateTime import DateTime stop_date = DateTime().Date() resource_title = resource.getTitle() # context.log("date %s %s" %(start_date, stop_date), "title = %s" %resource_title) if "compte" in resource_title: interval = getIntervalBetweenDates(start_date, stop_date) # context.log("interval", interval) if interval["year"] == 3: if interval["month"] > 0 or interval["day"] > 0: msg = Message(domain="ui", message="Check $check is more than 3 years old.", mapping={"check": check_nb}) raise ValidationFailed, (msg,) elif interval["year"] > 3: msg = Message(domain="ui", message="Check $check is more than 3 years old.", mapping={"check": check_nb}) raise ValidationFailed, (msg,) elif "virement" in resource_title: interval = getIntervalBetweenDates(start_date, stop_date) # context.log("interval", interval) if interval["month"] == 3: if interval["day"] > 0: msg = Message(domain="ui", message="Check $check is more than 3 month old.", mapping={"check": check_nb}) raise ValidationFailed, (msg,) elif interval["month"] > 3 or interval["year"] > 0:
"""Returns the age of the person at the current date or at the given `at_date`. If `year` is true, return the integer value, otherwise returns a translated string. """ from DateTime import DateTime from Products.ERP5Type.DateUtils import getIntervalBetweenDates Base_translateString = context.Base_translateString birthday = context.getBirthday() if birthday is None: return None if at_date is None: at_date = DateTime() interval_dict = getIntervalBetweenDates(from_date=birthday, to_date=at_date) if year: return interval_dict['year'] # mapping contains year, month & day return Base_translateString("${year} years old", mapping=interval_dict)
from Products.DCWorkflow.DCWorkflow import ValidationFailed from Products.ERP5Type.Message import Message from Products.ERP5Type.DateUtils import getIntervalBetweenDates if stop_date is None: from DateTime import DateTime stop_date = DateTime().Date() resource_title = resource.getTitle() #context.log("date %s %s" %(start_date, stop_date), "title = %s" %resource_title) if 'compte' in resource_title: interval = getIntervalBetweenDates(start_date, stop_date) #context.log("interval", interval) if interval['year'] == 3: if interval['month'] > 0 or interval["day"] > 0: msg = Message(domain='ui', message="Check $check is more than 3 years old.", mapping={"check": check_nb}) raise ValidationFailed, (msg, ) elif interval['year'] > 3: msg = Message(domain='ui', message="Check $check is more than 3 years old.", mapping={"check": check_nb}) raise ValidationFailed, (msg, ) elif 'virement' in resource_title: interval = getIntervalBetweenDates(start_date, stop_date) #context.log("interval", interval) if interval['month'] == 3: if interval["day"] > 0:
"""Returns the age of the person at the current date or at the given `at_date`. If `year` is true, return the integer value, otherwise returns a translated string. """ from DateTime import DateTime from Products.ERP5Type.DateUtils import getIntervalBetweenDates Base_translateString = context.Base_translateString birthday = context.getBirthday() if birthday is None: return None if at_date is None: at_date = DateTime() interval_dict = getIntervalBetweenDates(from_date=birthday, to_date=at_date) if year: return interval_dict['year'] # mapping contains year, month & day return Base_translateString("${year} years old", mapping=interval_dict)