Commit d2102b5c authored by Jérome Perrin's avatar Jérome Perrin

payroll_l10n_fr: use Base_redirect to redirect in Make DSN Report script

parent 3ab8e40d
from erp5.component.module.DateUtils import addToDate from erp5.component.module.DateUtils import addToDate
from Products.ERP5Type.Message import translateString
if context.getSourceAdministration() is None \ if context.getSourceAdministration() is None \
or context.getEffectiveDate() is None \ or context.getEffectiveDate() is None \
or context.getFormat() is None \ or context.getFormat() is None \
or len(context.getAggregateRelatedIdList()) <= 0: or len(context.getAggregateRelatedIdList()) <= 0:
return context.REQUEST.response.redirect("%s?portal_status_message=%s" % (context.absolute_url(), "DSN can't be built if some fields are empty")) return context.Base_redirect(form_id, keep_items={
'portal_status_message': translateString("DSN can't be built if some fields are empty"),
'portal_status_level': 'error',
})
getDSNblockDict = context.DSNMonthlyReport_getDataDictPhaseTwo getDSNblockDict = context.DSNMonthlyReport_getDataDictPhaseTwo
getEventDSNblockDict = context.DSNEarlyRecoveryReport_getDataDictPhaseTwo getEventDSNblockDict = context.DSNEarlyRecoveryReport_getDataDictPhaseTwo
...@@ -56,7 +60,10 @@ if leave_period.getExpirationDate() <= leave_period.getStopDate(): ...@@ -56,7 +60,10 @@ if leave_period.getExpirationDate() <= leave_period.getStopDate():
else: else:
if batch_mode: if batch_mode:
return return
context.REQUEST.response.redirect("%s?portal_status_message=%s" % (context.absolute_url(), "No need to create this DSN event report : return date is not previous to last leaved date.")) return context.Base_redirect(form_id, keep_items={
'portal_status_message': translateString("No need to create this DSN event report : return date is not previous to last leaved date."),
'portal_status_level': 'error',
})
# Print DSN # Print DSN
dsn_report_string = "" dsn_report_string = ""
...@@ -76,4 +83,7 @@ context.setTextContent(dsn_report_string.strip()) ...@@ -76,4 +83,7 @@ context.setTextContent(dsn_report_string.strip())
if batch_mode: if batch_mode:
return return
context.REQUEST.response.redirect("%s?portal_status_message=%s" % (context.absolute_url(), "Event DSN Record Created.")) return context.Base_redirect(form_id, keep_items={
'portal_status_message': translateString( "Event DSN Record Created."),
'portal_status_level': 'success',
})
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>batch_mode=False</string> </value> <value> <string>form_id=\'\', batch_mode=False</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
from Products.ERP5Type.Message import translateString
from erp5.component.module.DateUtils import getNumberOfDayInMonth from erp5.component.module.DateUtils import getNumberOfDayInMonth
if context.getSourceAdministration() is None \ if context.getSourceAdministration() is None \
...@@ -5,7 +6,10 @@ if context.getSourceAdministration() is None \ ...@@ -5,7 +6,10 @@ if context.getSourceAdministration() is None \
or context.getFormat() is None \ or context.getFormat() is None \
or context.getQuantity() is None \ or context.getQuantity() is None \
or len(context.getAggregateRelatedIdList()) <= 0: or len(context.getAggregateRelatedIdList()) <= 0:
return context.REQUEST.response.redirect("%s?portal_status_message=%s" % (context.absolute_url(), "DSN can't be built if some fields are empty")) return context.Base_redirect(form_id, keep_items={
'portal_status_message': translateString("DSN can't be built if some fields are empty"),
'portal_status_level': 'error',
})
portal = context.getPortalObject() portal = context.getPortalObject()
accounting_module = portal.getDefaultModuleValue("Pay Sheet Transaction") accounting_module = portal.getDefaultModuleValue("Pay Sheet Transaction")
...@@ -317,4 +321,7 @@ if batch_mode: ...@@ -317,4 +321,7 @@ if batch_mode:
context.REQUEST.response.setHeader("Content-Type", "text/plain; charset=iso-8859-1") context.REQUEST.response.setHeader("Content-Type", "text/plain; charset=iso-8859-1")
return return
context.REQUEST.response.redirect("%s?portal_status_message=%s" % (context.absolute_url(), "Monthly DSN Record Created.")) return context.Base_redirect(form_id, keep_items={
'portal_status_message': translateString("Monthly DSN Record Created."),
'portal_status_level': 'error',
})
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>batch_mode=False</string> </value> <value> <string>form_id=\'\', batch_mode=False</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
from Products.ERP5Type.Message import translateString
from erp5.component.module.DateUtils import addToDate, getNumberOfDayInMonth from erp5.component.module.DateUtils import addToDate, getNumberOfDayInMonth
if context.getSourceAdministration() is None \ if context.getSourceAdministration() is None \
or context.getEffectiveDate() is None \ or context.getEffectiveDate() is None \
or context.getQuantity() is None: or context.getQuantity() is None:
return context.REQUEST.response.redirect("%s?portal_status_message=%s" % (context.absolute_url(), "DSN can't be built if some fields are empty")) return context.Base_redirect(form_id, keep_items={
'portal_status_message': translateString("DSN can't be built if some fields are empty"),
'portal_status_level': 'error',
})
portal = context.getPortalObject() portal = context.getPortalObject()
accounting_module = portal.getDefaultModuleValue("Pay Sheet Transaction") accounting_module = portal.getDefaultModuleValue("Pay Sheet Transaction")
...@@ -39,7 +43,7 @@ else: ...@@ -39,7 +43,7 @@ else:
establishment = context.getSourceTradeValue() establishment = context.getSourceTradeValue()
establishment_registration_code = ''.join(establishment.getCorporateRegistrationCode().split(' ')) establishment_registration_code = ''.join(establishment.getCorporateRegistrationCode().split(' '))
# Finds the head office of the comany # Finds the head office of the company
if len(payment_transaction_list): if len(payment_transaction_list):
organisation = payment_transaction_list[0].getSourceSectionValue() organisation = payment_transaction_list[0].getSourceSectionValue()
elif len(paysheet_list): elif len(paysheet_list):
...@@ -438,4 +442,7 @@ if batch_mode: ...@@ -438,4 +442,7 @@ if batch_mode:
context.REQUEST.response.setHeader("Content-Type", "text/plain; charset=iso-8859-1") context.REQUEST.response.setHeader("Content-Type", "text/plain; charset=iso-8859-1")
return return
context.REQUEST.response.redirect("%s?portal_status_message=%s" % (context.absolute_url(), "Monthly DSN Record Created.")) return context.Base_redirect(form_id, keep_items={
'portal_status_message': translateString("Monthly DSN Record Created."),
'portal_status_level': 'success',
})
\ No newline at end of file
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>batch_mode=False</string> </value> <value> <string>form_id=\'\', batch_mode=False</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment